From 3006e2bf75fce7c65e5f086487b7b75f6e1c8a43 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 27 Mar 2019 12:05:42 +0100 Subject: [PATCH 001/739] memorize line before delete (for triggers) --- htdocs/commande/class/commande.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 07b7a907150..6eff20da863 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1367,7 +1367,7 @@ class Commande extends CommonOrder // Check parameters if ($type < 0) return -1; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); @@ -2194,6 +2194,12 @@ class Commande extends CommonOrder // For triggers $line->fetch($lineid); + // Memorize previous line for triggers + $staticline=new OrderLine($this->db); + $staticline->fetch($lineid); + $staticline->fetch_optionals($lineid); + $line->oldline = $staticline; + if ($line->delete($user) > 0) { $result=$this->update_price(1); @@ -2947,7 +2953,7 @@ class Commande extends CommonOrder if (empty($txlocaltax2)) $txlocaltax2=0; if (empty($remise_percent)) $remise_percent=0; if (empty($special_code) || $special_code == 3) $special_code=0; - + if ($date_start && $date_end && $date_start > $date_end) { $langs->load("errors"); $this->error=$langs->trans('ErrorStartDateGreaterEnd'); @@ -2962,7 +2968,7 @@ class Commande extends CommonOrder $txtva=price2num($txtva); $txlocaltax1=price2num($txlocaltax1); $txlocaltax2=price2num($txlocaltax2); - + $this->db->begin(); // Calcul du total TTC et de la TVA pour la ligne a partir de From 631be04d5de1c7489af970338d94163dc174d61e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 27 Mar 2019 12:15:50 +0100 Subject: [PATCH 002/739] better clone oldline and avoid emptylabel on update --- htdocs/commande/class/commande.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 6eff20da863..18495a68f50 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2195,9 +2195,7 @@ class Commande extends CommonOrder $line->fetch($lineid); // Memorize previous line for triggers - $staticline=new OrderLine($this->db); - $staticline->fetch($lineid); - $staticline->fetch_optionals($lineid); + $staticline = clone $line; $line->oldline = $staticline; if ($line->delete($user) > 0) @@ -3054,7 +3052,7 @@ class Commande extends CommonOrder } $this->line->rowid=$rowid; - $this->line->label=$label; + $this->line->label=!empty($label)?$label:$this->line->oldline->label; $this->line->desc=$desc; $this->line->qty=$qty; From 98e482de71c72da6692f5fc4aeeec7019c4dec3d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 22 Mar 2021 06:53:09 +0100 Subject: [PATCH 003/739] Add text for popup --- htdocs/langs/en_US/accountancy.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index c635809404e..3785961246e 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -328,6 +328,9 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ## Export +NotifiedExportDate=Notified export date +NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible) +ConfirmExportFile=Confirmation of the generation of the accounting export file ? ExportDraftJournal=Export draft journal Modelcsv=Model of export Selectmodelcsv=Select a model of export From 49faedae6fef9775b889a063921ee252aa06ffad Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 24 Mar 2021 11:56:23 +0100 Subject: [PATCH 004/739] Work on date_validation --- htdocs/accountancy/bookkeeping/card.php | 95 ++++++++++++------- htdocs/accountancy/bookkeeping/list.php | 51 +++++++++- .../accountancy/class/bookkeeping.class.php | 46 +++++++-- 3 files changed, 146 insertions(+), 46 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index e3cac139c08..03600781319 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2020 Frédéric France * @@ -537,6 +537,22 @@ if ($action == 'create') { print ''; print ''; + // Date document creation + print ''; + print ''.$langs->trans("DateExport").''; + print ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print ''; + print ''; + + // Date document creation + print ''; + print ''.$langs->trans("DateValidation").''; + print ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print ''; + print ''; + // Validate /* print ''; @@ -619,7 +635,9 @@ if ($action == 'create') { print_liste_field_titre("LabelOperation"); print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); - print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); + if (empty($object->date_validation)) { + print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"'); + } print "\n"; @@ -665,18 +683,22 @@ if ($action == 'create') { print ''.price($line->debit).''; print ''.price($line->credit).''; - print ''; - print 'id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; - print img_edit('', 0, 'class="marginrightonly"'); - print '  '; - - $actiontodelete = 'delete'; - if ($mode == '_tmp' || $action != 'delmouv') { - $actiontodelete = 'confirm_delete'; + if (empty($line->date_export) || empty($line->date_validation)) { + print ''; + print 'id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; + print img_edit('', 0, 'class="marginrightonly"'); + print '  '; } - print ''; - print img_delete(); + if (empty($line->date_validation)) { + $actiontodelete = 'delete'; + if ($mode == '_tmp' || $action != 'delmouv') { + $actiontodelete = 'confirm_delete'; + } + + print ''; + print img_delete(); + } print ''; print ''; @@ -691,32 +713,33 @@ if ($action == 'create') { setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_debit, $total_credit)), 'warnings'); } - if ($action == "" || $action == 'add') { - print ''; - print ''; - print ''; - print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); - print ''; - print ''; - // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: - // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. - // Also, it is not possible to use a value that is not in the list. - // Also, the label is not automatically filled when a value is selected. - if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { - print $formaccounting->select_auxaccount('', 'subledger_account', 1); - } else { - print ''; + if (empty($object->date_export) || empty($object->date_validation)) { + if ($action == "" || $action == 'add') { + print ''; + print ''; + print ''; + print $formaccounting->select_account('', 'accountingaccount_number', 1, array(), 1, 1, ''); + print ''; + print ''; + // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because: + // It does not use the setup of "key pressed" to select a thirdparty and this hang browser on large databases. + // Also, it is not possible to use a value that is not in the list. + // Also, the label is not automatically filled when a value is selected. + if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print $formaccounting->select_auxaccount('', 'subledger_account', 1); + } else { + print ''; + } + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; } - print ''; - if ($mode == '_tmp' && $action == '') { print '
'; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 40a8284adc4..dcaa16ffd4e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * @@ -53,6 +53,8 @@ $search_date_modification_start = dol_mktime(0, 0, 0, GETPOST('date_modification $search_date_modification_end = dol_mktime(0, 0, 0, GETPOST('date_modification_endmonth', 'int'), GETPOST('date_modification_endday', 'int'), GETPOST('date_modification_endyear', 'int')); $search_date_export_start = dol_mktime(0, 0, 0, GETPOST('date_export_startmonth', 'int'), GETPOST('date_export_startday', 'int'), GETPOST('date_export_startyear', 'int')); $search_date_export_end = dol_mktime(0, 0, 0, GETPOST('date_export_endmonth', 'int'), GETPOST('date_export_endday', 'int'), GETPOST('date_export_endyear', 'int')); +$search_date_validation_start = dol_mktime(0, 0, 0, GETPOST('date_validation_startmonth', 'int'), GETPOST('date_validation_startday', 'int'), GETPOST('date_validation_startyear', 'int')); +$search_date_validation_end = dol_mktime(0, 0, 0, GETPOST('date_validation_endmonth', 'int'), GETPOST('date_validation_endday', 'int'), GETPOST('date_validation_endyear', 'int')); //var_dump($search_date_start);exit; if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) { @@ -157,6 +159,7 @@ $arrayfields = array( 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), ); if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { @@ -224,6 +227,8 @@ if (empty($reshook)) { $search_date_modification_end = ''; $search_date_export_start = ''; $search_date_export_end = ''; + $search_date_validation_start = ''; + $search_date_validation_end = ''; $search_debit = ''; $search_credit = ''; $search_lettering_code = ''; @@ -328,6 +333,16 @@ if (empty($reshook)) { $tmp = dol_getdate($search_date_export_end); $param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']); } + if (!empty($search_date_validation_start)) { + $filter['t.date_validated>='] = $search_date_validation_start; + $tmp = dol_getdate($search_date_validation_start); + $param .= '&date_validation_startmonth='.urlencode($tmp['mon']).'&date_validation_startday='.urlencode($tmp['mday']).'&date_validation_startyear='.urlencode($tmp['year']); + } + if (!empty($search_date_validation_end)) { + $filter['t.date_validated<='] = $search_date_validation_end; + $tmp = dol_getdate($search_date_validation_end); + $param .= '&date_validation_endmonth='.urlencode($tmp['mon']).'&date_validation_endday='.urlencode($tmp['mday']).'&date_validation_endyear='.urlencode($tmp['year']); + } if (!empty($search_debit)) { $filter['t.debit'] = $search_debit; $param .= '&search_debit='.urlencode($search_debit); @@ -447,7 +462,8 @@ $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification,"; -$sql .= " t.date_export"; +$sql .= " t.date_export,"; +$sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t'; // Manage filter $sqlwhere = array(); @@ -469,6 +485,8 @@ if (count($filter) > 0) { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; + } elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') { + $sqlwhere[] = $key.'\''.$db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); } elseif ($key == 't.reconciled_option') { @@ -846,6 +864,17 @@ if (!empty($arrayfields['t.date_export']['checked'])) { print ''; print ''; } +// Date validation +if (!empty($arrayfields['t.date_validated']['checked'])) { + print ''; + print '
'; + print $form->selectDate($search_date_validation_start, 'date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); + print '
'; + print '
'; + print $form->selectDate($search_date_validation_end, 'date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); + print '
'; + print ''; +} // Action column print ''; $searchpicto = $form->showFilterButtons(); @@ -897,6 +926,9 @@ if (!empty($arrayfields['t.tms']['checked'])) { if (!empty($arrayfields['t.date_export']['checked'])) { print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); } +if (!empty($arrayfields['t.date_validated']['checked'])) { + print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center '); +} print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -939,6 +971,7 @@ while ($i < min($num, $limit)) { $line->date_creation = $db->jdate($obj->date_creation); $line->date_modification = $db->jdate($obj->date_modification); $line->date_export = $db->jdate($obj->date_export); + $line->date_validation = $db->jdate($obj->date_validation); $total_debit += $line->debit; $total_credit += $line->credit; @@ -1131,12 +1164,22 @@ while ($i < min($num, $limit)) { } } + // Validated operation date + if (!empty($arrayfields['t.date_validated']['checked'])) { + print ''.dol_print_date($line->date_validation, 'dayhour').''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Action column print ''; - if (empty($line->date_export)) { + if (empty($line->date_export) || empty($line->date_validation)) { if ($user->rights->accounting->mouvements->creer) { - print ''.img_edit().''; + print '' . img_edit() . ''; } + } + if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { print ''.img_delete().''; } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 7286e954d0e..d1939b84665 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -135,7 +135,6 @@ class BookKeeping extends CommonObject /** * @var float FEC:Amount (Not necessary) - * @deprecated No more used */ public $amount; @@ -722,7 +721,9 @@ class BookKeeping extends CommonObject $sql .= " t.code_journal,"; $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; - $sql .= " t.date_creation"; + $sql .= " t.date_creation,"; + $sql .= " t.date_export,"; + $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; $sql .= ' WHERE 1 = 1'; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -763,6 +764,9 @@ class BookKeeping extends CommonObject $this->journal_label = $obj->journal_label; $this->piece_num = $obj->piece_num; $this->date_creation = $this->db->jdate($obj->date_creation); + $this->date_export = $this->db->jdate($obj->date_export); + $this->date_validation = $this->db->jdate($obj->date_validated); + $this->date_validation = $this->db->jdate($obj->date_validation); } $this->db->free($resql); @@ -828,7 +832,8 @@ class BookKeeping extends CommonObject $sql .= " t.journal_label,"; $sql .= " t.piece_num,"; $sql .= " t.date_creation,"; - $sql .= " t.date_export"; + $sql .= " t.date_export,"; + $sql .= " t.date_validated as date_validation"; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { @@ -847,6 +852,8 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; + } elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') { + $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); } elseif ($key == 't.reconciled_option') { @@ -920,6 +927,8 @@ class BookKeeping extends CommonObject $line->piece_num = $obj->piece_num; $line->date_creation = $this->db->jdate($obj->date_creation); $line->date_export = $this->db->jdate($obj->date_export); + $line->date_validation = $this->db->jdate($obj->date_validated); + $line->date_validation = $this->db->jdate($obj->date_validation); $this->lines[] = $line; @@ -982,6 +991,7 @@ class BookKeeping extends CommonObject $sql .= " t.date_lim_reglement,"; $sql .= " t.tms as date_modification,"; $sql .= " t.date_export"; + $sql .= " t.date_validated as date_validation,"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; // Manage filter $sqlwhere = array(); @@ -1003,6 +1013,8 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') { $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; + } elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') { + $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); } else { @@ -1062,6 +1074,8 @@ class BookKeeping extends CommonObject $line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement); $line->date_modification = $this->db->jdate($obj->date_modification); $line->date_export = $this->db->jdate($obj->date_export); + $line->date_validation = $this->db->jdate($obj->date_validated); + $line->date_validation = $this->db->jdate($obj->date_validation); $this->lines[] = $line; @@ -1442,6 +1456,8 @@ class BookKeeping extends CommonObject $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; } $sql .= " AND entity IN (".getEntity('accountancy').")"; + // Exclusion of validated entries at the time of deletion + $sql .= " AND date_validated IS NULL"; // TODO: In a future we must forbid deletion if record is inside a closed fiscal period. @@ -1591,7 +1607,8 @@ class BookKeeping extends CommonObject { global $conf; - $sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation"; + $sql = "SELECT piece_num, doc_date,code_journal, journal_label, doc_ref, doc_type,"; + $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1608,6 +1625,10 @@ class BookKeeping extends CommonObject $this->doc_ref = $obj->doc_ref; $this->doc_type = $obj->doc_type; $this->date_creation = $obj->date_creation; + $this->date_modification = $obj->date_modification; + $this->date_export = $obj->date_export; + $this->date_validation = $obj->date_validated; + $this->date_validation = $obj->date_validation; } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(__METHOD__.$this->error, LOG_ERR); @@ -1663,7 +1684,8 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, journal_label, piece_num,"; + $sql .= " date_creation, tms as date_modification, date_export, date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".$piecenum; $sql .= " AND entity IN (".getEntity('accountancy').")"; @@ -1696,6 +1718,10 @@ class BookKeeping extends CommonObject $line->journal_label = $obj->journal_label; $line->piece_num = $obj->piece_num; $line->date_creation = $obj->date_creation; + $line->date_modification = $obj->date_modification; + $line->date_export = $obj->date_export; + $line->date_validation = $obj->date_validated; + $line->date_validation = $obj->date_validation; $this->linesmvt[] = $line; } @@ -1723,7 +1749,8 @@ class BookKeeping extends CommonObject $sql = "SELECT rowid, doc_date, doc_type,"; $sql .= " doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,"; $sql .= " numero_compte, label_compte, label_operation, debit, credit,"; - $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num"; + $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; + $sql .= " date_validated as date_validation"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE entity IN (".getEntity('accountancy').")"; @@ -1758,6 +1785,8 @@ class BookKeeping extends CommonObject $line->sens = $obj->sens; $line->code_journal = $obj->code_journal; $line->piece_num = $obj->piece_num; + $line->date_validation = $obj->date_validated; + $line->date_validation = $obj->date_validation; $this->linesexport[] = $line; } @@ -2091,4 +2120,9 @@ class BookKeepingLine * @var integer|string $date_export; */ public $date_export; + + /** + * @var integer|string $date_validation; + */ + public $date_validation; } From 305b338a116f60af5583b36f8071718dc5849e7c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 19 Apr 2021 06:03:03 +0200 Subject: [PATCH 005/739] Update notified --- htdocs/accountancy/bookkeeping/list.php | 36 +++++++++++++------ .../class/accountancycategory.class.php | 2 +- .../accountancy/class/bookkeeping.class.php | 4 +-- htdocs/langs/en_US/accountancy.lang | 4 +-- 4 files changed, 30 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 9ad21bb2e0a..429aac9b877 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -524,10 +524,15 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex $accountancyexport = new AccountancyExport($db); $accountancyexport->export($object->lines, $formatexportset); + $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha'); + $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha'); + + dol_syslog("date_export/date_validated=".$notifiedexportdate.'/'.$notifiedvalidationdate, LOG_DEBUG); + if (!empty($accountancyexport->errors)) { setEventMessages('', $accountancyexport->errors, 'errors'); - } else { - // Specify as export : update field date_export + } elseif (!$notifiedexportdate || !$notifiedvalidationdate) { + // Specify as export : update field date_export or date_validated $error = 0; $db->begin(); @@ -536,8 +541,15 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex $now = dol_now(); $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; - $sql .= " SET date_export = '".$db->idate($now)."'"; - $sql .= " , date_validated = '".$db->idate($now)."'"; + $sql .= " SET"; + if (!$notifiedexportdate && !$notifiedvalidationdate) { + $sql .= " date_export = '".$db->idate($now)."'"; + $sql .= ", date_validated = '".$db->idate($now)."'"; + } elseif (!$notifiedexportdate) { + $sql .= " date_export = '".$db->idate($now)."'"; + } elseif (!$notifiedvalidationdate) { + $sql .= " date_validated = '".$db->idate($now)."'"; + } $sql .= " WHERE rowid = ".((int) $movement->id); dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=".$sql, LOG_DEBUG); @@ -551,11 +563,11 @@ if ($action == 'export_fileconfirm' && $user->rights->accounting->mouvements->ex if (!$error) { $db->commit(); - // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); + // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExportedOrValidated"), null, 'mesgs'); } else { $error++; $db->rollback(); - setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); + setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated"), null, 'errors'); } } exit; @@ -603,6 +615,8 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { llxHeader('', $title_page); +$formconfirm = ''; + if ($action == 'export_file') { $form_question = array(); @@ -614,17 +628,15 @@ if ($action == 'export_file') { ); $form_question['notifiedvalidationdate'] = array( 'name' => 'notifiedvalidationdate', - 'type' => 'checkbox', // We don't use select here, the journal_array is already a select html component + 'type' => 'checkbox', 'label' => $langs->trans('NotifiedValidationDate'), 'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) ? 'false' : 'true'), ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300); - print $formconfirm; + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); } if ($action == 'delmouv') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); - print $formconfirm; } if ($action == 'delbookkeepingyear') { $form_question = array(); @@ -664,9 +676,11 @@ if ($action == 'delbookkeepingyear') { ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); - print $formconfirm; } +// Print form confirm +print $formconfirm; + //$param=''; param started before if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 9550933f2d8..75f1275c142 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -263,7 +263,7 @@ class AccountancyCategory // extends CommonObject if ($id) { $sql .= " WHERE t.rowid = ".((int) $id); } else { - $sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid + $sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Don't use entity if you use rowid if ($code) { $sql .= " AND t.code = '".$this->db->escape($code)."'"; } elseif ($label) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index afb9b502a9e..611dfcdc30c 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -993,8 +993,8 @@ class BookKeeping extends CommonObject $sql .= " t.date_creation,"; $sql .= " t.date_lim_reglement,"; $sql .= " t.tms as date_modification,"; - $sql .= " t.date_export"; - $sql .= " t.date_validated as date_validation,"; + $sql .= " t.date_export,"; + $sql .= " t.date_validated as date_validation"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; // Manage filter $sqlwhere = array(); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 69d2a4e22e2..0d38544dacb 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -328,7 +328,7 @@ ACCOUNTING_DISABLE_BINDING_ON_PURCHASES=Disable binding & transfer in accountanc ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS=Disable binding & transfer in accountancy on expense reports (expense reports will not be taken into account in accounting) ## Export -NotifiedExportDate=Notified export date +NotifiedExportDate=Notified export date (modification of the entries will not be possible) NotifiedValidationDate=Validation of the entries (modification or deletion of the entries will not be possible) ConfirmExportFile=Confirmation of the generation of the accounting export file ? ExportDraftJournal=Export draft journal @@ -430,4 +430,4 @@ WarningReportNotReliable=Warning, this report is not based on the Ledger, so doe ExpenseReportJournal=Expense Report Journal InventoryJournal=Inventory Journal -NAccounts=%s accounts \ No newline at end of file +NAccounts=%s accounts From 1b7854e69825206acea25602c6d12e6a60247d25 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 10:15:28 +0200 Subject: [PATCH 006/739] added security to suggestion page index.php (securekey and id encoded) --- htdocs/public/project/index.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 03f26ed2f37..65237be02ac 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -78,7 +78,23 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", // No check on module enabled. Done later according to $validpaymentmethod $action = GETPOST('action', 'aZ09'); -$id = dol_decode(GETPOST('id'), $dolibarr_main_instance_unique_id); + +$encodedid = GETPOST('id'); +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); + +// Getting 'securekey'.'id' from Post and decoding it +$encodedsecurekeyandid = GETPOST('securekey', 'alpha'); +$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id); + +// Securekey decomposition into pure securekey and id added at the end +$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($encodedid)); +$idgotfromsecurekey = dol_decode(substr($securekeyandid, -strlen($encodedid), strlen($encodedid)), $dolibarr_main_instance_unique_id); + +// We check if the securekey collected is OK and if the id collected is the same than the id in the securekey +if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecurekey != $id) { + print $langs->trans('MissingOrBadSecureKey'); + exit; +} // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -113,15 +129,6 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -// Show sandbox warning -if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'int'))) { // We can force sand box with param 'forcesandbox' - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), '', 'warning'); -} -if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'int'))) { - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} - - print ''."\n"; print '
'."\n"; print '
'."\n"; From 45531d0f1aab5d18a0c63793239a7ab4b4fc0af2 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 10:39:22 +0200 Subject: [PATCH 007/739] index suggestion page form added, needs to be improved to show only necessary fields --- htdocs/public/project/index.php | 600 +++++++++++++++++++++++++------- 1 file changed, 478 insertions(+), 122 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 65237be02ac..f493b2a379f 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -1,10 +1,11 @@ - * Copyright (C) 2006-2017 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2018 Juanjo Menent - * Copyright (C) 2018-2019 Thibault FOUCART - * Copyright (C) 2021 Waël Almoman +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2001-2002 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange + * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,21 +19,22 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * For Paypal test: https://developer.paypal.com/ - * For Paybox test: ??? - * For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing - * - * Variants: - * - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new PaymentIntent API - * - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API - * - If no option set, we use old APIS (charge) */ /** - * \file htdocs/public/payment/newpayment.php - * \ingroup core - * \brief File to offer a way to make a payment for a particular Dolibarr object + * \file htdocs/public/members/new.php + * \ingroup member + * \brief Example of form to add a new member + * + * Note that you can add following constant to change behaviour of page + * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form + * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe + * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) + * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted + * MEMBER_NEWFORM_FORCETYPE Force type of member + * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) + * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country */ if (!defined('NOLOGIN')) { @@ -47,41 +49,52 @@ if (!defined('NOIPCHECK')) { if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} // For MultiCompany module. -// Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)))); +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); if (is_numeric($entity)) { define("DOLENTITY", $entity); } require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -// Hook to be used by external payment modules (ie Payzen, ...) -include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; -$hookmanager = new HookManager($db); -$hookmanager->initHooks(array('newpayment')); +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -// For encryption global $dolibarr_main_instance_unique_id; +global $dolibarr_main_url_root; -// Load translation files -$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data - -// Security check -// No check on module enabled. Done later according to $validpaymentmethod - +// Init vars +$errmsg = ''; +$num = 0; +$error = 0; +$backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); +$email = GETPOST("email"); +$societe = GETPOST("societe"); + +// Getting id from Post and decoding it $encodedid = GETPOST('id'); $id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$project = new Project($db); +$resultproject = $project->fetch($id); +if ($resultproject < 0) { + $error++; + $errmsg .= $project->error; +} + // Getting 'securekey'.'id' from Post and decoding it $encodedsecurekeyandid = GETPOST('securekey', 'alpha'); $securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id); @@ -96,108 +109,447 @@ if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecure exit; } -// Define $urlwithroot -//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); -//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file -$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. +// Load translation files +$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); -$project = new Project($db); -$resultproject = $project->fetch($id); -if ($resultproject < 0) { - $error++; - $errmsg .= $project->error; +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('publicnewmembercard', 'globalcard')); + +$extrafields = new ExtraFields($db); + +$user->loadDefaultValues(); + + +/** + * Show header for new member + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +{ + global $user, $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } + print '
'; + + print '
'; } +/** + * Show footer for new member + * + * @return void + */ +function llxFooterVierge() +{ + print '
'; + + printCommonFooter('public'); + + print "\n"; + print "\n"; +} + + + /* * Actions */ +global $mysoc; +$parameters = array(); +// Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +// Action called when page is submitted +if (empty($reshook) && $action == 'add') { + $error = 0; + + $urlback = ''; + + $db->begin(); + + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + // If the price has been set, name is required for the invoice + if (!GETPOST("societe") && !empty(floatval($project->price_registration))) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; + } + if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + } + if (!GETPOST("country_id")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; + } + + if (!$error) { + // Check if attendee already exists (by email and for this event) + $confattendee = new ConferenceOrBoothAttendee($db); + $resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"')); + if ($resultfetchconfattendee > 0 && count($resultfetchconfattendee)>0) { + // Found confattendee + $confattendee = array_shift($resultfetchconfattendee); + } else { + // Need to create a confattendee + $confattendee->date_subscription = dol_now(); + $confattendee->email = $email; + $confattendee->fk_actioncomm = $id; + $resultconfattendee = $confattendee->create($user); + if ($resultconfattendee < 0) { + $error++; + $errmsg .= $confattendee->error; + } + } + // At this point, we have an attendee. It may not be linked to a thirdparty if we just created it + + // If the attendee has already paid + if ($confattendee->status == 1) { + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); + Header("Location: ".$redirection); + exit; + } + // Getting the thirdparty or creating it + $thirdparty = new Societe($db); + // Fetch using fk_soc if the attendee was already existing + if (!empty($confattendee->fk_soc)) { + $resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc); + } else { + // Fetch using the input field by user if we just created the attendee + if (!empty($societe)) { + $resultfetchthirdparty = $thirdparty->fetch('', $societe); + if ($resultfetchthirdparty<=0) { + // Need to create a new one (not found or multiple with the same name) + $resultfetchthirdparty = 0; + } else { + // We found an unique result with that name, so we put in in fk_soc of attendee + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } + } else { + // Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences) + $resultfetchthirdparty = 0; + } + } + if ($resultfetchthirdparty<0) { + $error++; + $errmsg .= $thirdparty->error; + } elseif ($resultfetchthirdparty==0) { + // creation of a new thirdparty + if (!empty($societe)) { + $thirdparty->name = $societe; + } else { + $thirdparty->name = $email; + } + $thirdparty->address = GETPOST("address"); + $thirdparty->zip = GETPOST("zipcode"); + $thirdparty->town = GETPOST("town"); + $thirdparty->client = 2; + $thirdparty->fournisseur = 0; + $thirdparty->country_id = GETPOST("country_id", 'int'); + $thirdparty->state_id = GETPOST("state_id", 'int'); + $thirdparty->email = $email; + + // Load object modCodeTiers + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeClient = new $module($db); + + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); + } + $thirdparty->code_client = $tmpcode; + $readythirdparty = $thirdparty->create($user); + if ($readythirdparty <0) { + $error++; + $errmsg .= $thirdparty->error; + } else { + $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); + $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); + $confattendee->fk_soc = $thirdparty->id; + $confattendee->update($user); + } + } + } + + if (!$error) { + $db->commit(); + if (!empty(floatval($project->price_registration))) { + $productforinvoicerow = new Product($db); + $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION); + if ($resultprod < 0) { + $error++; + $errmsg .= $productforinvoicerow->error; + } else { + $facture = new Facture($db); + $facture->type = Facture::TYPE_STANDARD; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + $facture->date = dol_now(); + $facture->cond_reglement_id = $confattendee->cond_reglement_id; + + if (empty($facture->cond_reglement_id)) { + $paymenttermstatic = new PaymentTerm($confattendee->db); + $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); + if (empty($facture->cond_reglement_id)) { + $error++; + $confattendee->error = 'ErrorNoPaymentTermRECEPFound'; + $confattendee->errors[] = $confattendee->error; + } + } + $resultfacture = $facture->create($user); + if ($resultfacture <= 0) { + $confattendee->error = $facture->error; + $confattendee->errors = $facture->errors; + $error++; + } else { + $facture->add_object_linked($confattendee->element, $confattendee->id); + } + } + + if (!$error) { + // Add line to draft invoice + $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); + $result = $facture->addline($langs->trans("ConferenceAttendeeFee", $conference->label, dol_print_date($conference->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conference->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $confattendee->error = $facture->error; + $confattendee->errors = $facture->errors; + $error++; + } + if (!$error) { + $valid = true; + $sourcetouse = 'conferencesubscription'; + $reftouse = $facture->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + Header("Location: ".$redirection); + exit; + } + } + } else { + // No price has been set + // Validating the subscription + $confattendee->setStatut(1); + + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); + Header("Location: ".$redirection); + exit; + } + //Header("Location: ".$urlback); + //exit; + } else { + $db->rollback(); + } +} /* * View */ -$head = ''; -if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { - $head = ''."\n"; -} +$form = new Form($db); +$formcompany = new FormCompany($db); -$conf->dol_hide_topmenu = 1; -$conf->dol_hide_leftmenu = 1; - -$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); +llxHeaderVierge($langs->trans("NewSuggestion")); -print ''."\n"; -print '
'."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''; -print ''; -print "\n"; +print load_fiche_titre($langs->trans("NewSuggestion"), '', '', 0, 0, 'center'); -// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) -// Define logo and logosmall -$logosmall = $mysoc->logo_small; -$logo = $mysoc->logo; -$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; -if (!empty($conf->global->$paramlogo)) { - $logosmall = $conf->global->$paramlogo; -} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) { - $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; -} -//print ''."\n"; -// Define urllogo -$urllogo = ''; -$urllogofull = ''; -if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); -} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); - $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); -} +print '
'; +print '
'; +print '
'; -// Output html code for logo -if ($urllogo) { - print '
'; - print '
'; - print ''; - print '
'; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; - } - print '
'; -} - -print ''."\n"; - -$text = ''."\n"; +// Welcome message +$text = '
'; $text .= ''."\n"; -$text .= ''."\n";; - +$text .= ''."\n";; print $text; +print ''; -// Output payment summary form -print ''."\n"; - -print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'.$project->note_public.'

'.$project->note_public.'
'; +dol_htmloutput_errors($errmsg); -$found = false; -$error = 0; -$var = false; +// Print form +print ''."\n"; +print ''; +print ''; +print ''; +print ''; +print ''; -$object = null; +print '
'; -print "\n"; +print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; +//print $langs->trans("FieldsWithIsForPublic",'**').'
'; + +print dol_get_fiche_head(''); + +print ''; + +print ''."\n"; + +// Email +print ''."\n"; +// Company +print ''."\n"; +// Address +print ''."\n"; +// Zip / Town +print ''; +// Country +print ''; +// State +if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + print ''; +} + +print "
'.$langs->trans("Email").'*
'.$langs->trans("Company"); +if (!empty(floatval($project->price_registration))) { + print '*'; +} +print '
'.$langs->trans("Address").''."\n"; +print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; +print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); +print ' / '; +print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); +print '
'.$langs->trans('Country').'*'; +$country_id = GETPOST('country_id'); +if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); +} +if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) { + $country_id = $new_country_id; + } + } +} +$country_code = getCountry($country_id, 2, $db, $langs); +print $form->select_country($country_id, 'country_id'); +print '
'.$langs->trans('State').''; + if ($country_code) { + print $formcompany->select_state(GETPOST("state_id"), $country_code); + } else { + print ''; + } + print '
\n"; + +print dol_get_fiche_end(); // Show all action buttons +print '
'; print '
'; // Output introduction text if ($project->accept_conference_suggestions) { @@ -209,20 +561,24 @@ print '

'; if ($project->accept_booth_suggestions) { print ''; } +print '
'; + +print '

'; + +// Save +print '
'; +print ''; +if (!empty($backtopage)) { + print '     '; +} +print '
'; - -print '
'."\n"; - -print ''."\n"; -print '
'."\n"; -print '
'; +print "\n"; +print "
"; +print '
'; -htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); - -llxFooter('', 'public'); +llxFooterVierge(); $db->close(); From bced3d60dd17cae8f3cb555f471b654aa350ed57 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 11:11:23 +0200 Subject: [PATCH 008/739] added required name to the form --- htdocs/public/project/index.php | 200 ++++---------------------------- 1 file changed, 23 insertions(+), 177 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index f493b2a379f..3aeab9997b5 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -208,8 +208,11 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; } - // If the price has been set, name is required for the invoice - if (!GETPOST("societe") && !empty(floatval($project->price_registration))) { + if (!GETPOST("lastname")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; + } + if (!GETPOST("societe")) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; } @@ -224,63 +227,12 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { - // Check if attendee already exists (by email and for this event) - $confattendee = new ConferenceOrBoothAttendee($db); - $resultfetchconfattendee = $confattendee->fetchAll('', '', 0, 0, array('t.fk_actioncomm'=>$id, 'customsql'=>'t.email="'.$email.'"')); - if ($resultfetchconfattendee > 0 && count($resultfetchconfattendee)>0) { - // Found confattendee - $confattendee = array_shift($resultfetchconfattendee); - } else { - // Need to create a confattendee - $confattendee->date_subscription = dol_now(); - $confattendee->email = $email; - $confattendee->fk_actioncomm = $id; - $resultconfattendee = $confattendee->create($user); - if ($resultconfattendee < 0) { - $error++; - $errmsg .= $confattendee->error; - } - } - // At this point, we have an attendee. It may not be linked to a thirdparty if we just created it - - // If the attendee has already paid - if ($confattendee->status == 1) { - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); - Header("Location: ".$redirection); - exit; - } // Getting the thirdparty or creating it $thirdparty = new Societe($db); - // Fetch using fk_soc if the attendee was already existing - if (!empty($confattendee->fk_soc)) { - $resultfetchthirdparty = $thirdparty->fetch($confattendee->fk_soc); - } else { - // Fetch using the input field by user if we just created the attendee - if (!empty($societe)) { - $resultfetchthirdparty = $thirdparty->fetch('', $societe); - if ($resultfetchthirdparty<=0) { - // Need to create a new one (not found or multiple with the same name) - $resultfetchthirdparty = 0; - } else { - // We found an unique result with that name, so we put in in fk_soc of attendee - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); - } - } else { - // Need to create a thirdparty (put number>0 if we do not want to create a thirdparty for free-conferences) - $resultfetchthirdparty = 0; - } - } - if ($resultfetchthirdparty<0) { - $error++; - $errmsg .= $thirdparty->error; - } elseif ($resultfetchthirdparty==0) { - // creation of a new thirdparty - if (!empty($societe)) { - $thirdparty->name = $societe; - } else { - $thirdparty->name = $email; - } + $resultfetchthirdparty = $thirdparty->fetch('', $societe); + if ($resultfetchthirdparty<=0) { + // Need to create a new one (not found or multiple with the same name) + $thirdparty->name = $societe; $thirdparty->address = GETPOST("address"); $thirdparty->zip = GETPOST("zipcode"); $thirdparty->town = GETPOST("town"); @@ -315,126 +267,16 @@ if (empty($reshook) && $action == 'add') { } else { $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); - $confattendee->fk_soc = $thirdparty->id; - $confattendee->update($user); } } - } - - if (!$error) { + // From there we have a thirdparty, now looking for the contact + $contact = new Contact($db); + $resultcontact = $contact->fetch('', $user, '', $email); + if ($resultcontact<=0) { + // Need to create a contact + } + // We have the contact and the thirdparty $db->commit(); - if (!empty(floatval($project->price_registration))) { - $productforinvoicerow = new Product($db); - $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION); - if ($resultprod < 0) { - $error++; - $errmsg .= $productforinvoicerow->error; - } else { - $facture = new Facture($db); - $facture->type = Facture::TYPE_STANDARD; - $facture->socid = $thirdparty->id; - $facture->paye = 0; - $facture->date = dol_now(); - $facture->cond_reglement_id = $confattendee->cond_reglement_id; - - if (empty($facture->cond_reglement_id)) { - $paymenttermstatic = new PaymentTerm($confattendee->db); - $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); - if (empty($facture->cond_reglement_id)) { - $error++; - $confattendee->error = 'ErrorNoPaymentTermRECEPFound'; - $confattendee->errors[] = $confattendee->error; - } - } - $resultfacture = $facture->create($user); - if ($resultfacture <= 0) { - $confattendee->error = $facture->error; - $confattendee->errors = $facture->errors; - $error++; - } else { - $facture->add_object_linked($confattendee->element, $confattendee->id); - } - } - - if (!$error) { - // Add line to draft invoice - $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); - $result = $facture->addline($langs->trans("ConferenceAttendeeFee", $conference->label, dol_print_date($conference->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conference->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_registration), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); - if ($result <= 0) { - $confattendee->error = $facture->error; - $confattendee->errors = $facture->errors; - $error++; - } - if (!$error) { - $valid = true; - $sourcetouse = 'conferencesubscription'; - $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical - } else { - $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - } - } - Header("Location: ".$redirection); - exit; - } - } - } else { - // No price has been set - // Validating the subscription - $confattendee->setStatut(1); - - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); - } - - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); - Header("Location: ".$redirection); - exit; - } - //Header("Location: ".$urlback); - //exit; } else { $db->rollback(); } @@ -495,6 +337,10 @@ jQuery(document).ready(function () { print ''."\n"; +// Name +print ''; +print ''; +print ''; // Email print ''."\n"; // Company @@ -553,13 +399,13 @@ print '
'; print '
'; // Output introduction text if ($project->accept_conference_suggestions) { - print ''; + print ''; print '

'; } -print ''; +print ''; print '

'; if ($project->accept_booth_suggestions) { - print ''; + print ''; } print '
'; From de63c93ad4c1b832e17d324fc188d59df660b338 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 12:09:39 +0200 Subject: [PATCH 009/739] wip on creating the contact --- htdocs/public/project/index.php | 50 +++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 3aeab9997b5..0eb2acd209f 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -274,9 +274,55 @@ if (empty($reshook) && $action == 'add') { $resultcontact = $contact->fetch('', $user, '', $email); if ($resultcontact<=0) { // Need to create a contact + $contact->socid = $thirdparty->id; + $contact->lastname = (string) GETPOST("lastname", 'alpha'); + $contact->firstname = (string) GETPOST("firstname", 'alpha'); + $contact->address = (string) GETPOST("address", 'alpha'); + $contact->zip = (string) GETPOST("zipcode", 'alpha'); + $contact->town = (string) GETPOST("town", 'alpha'); + $contact->country_id = (int) GETPOST("country_id", 'int'); + $contact->state_id = (int) GETPOST("state_id", 'int'); + $contact->email = $email; + $contact->statut = 1; //Default status to Actif + + $resultcreatecontact = $contact->create($user); + if ($resultcreatecontact<0) { + $error++; + $errmsg .= $contact->error; + } + } + + if (!$error) { + // Adding supplier tag + $category = new Categorie($db); + if (GETPOST("suggestconference")) { + // Conference case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); + } else { + // Booth case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); + } + + if ($resultcategory<0) { + $error++; + $errmsg .= $category->error; + } else { + $contact->setCategoriesCommon($category->id, Categorie::TYPE_CONTACT, false); + $resultupdate = $contact->update($contact->id); + if ($resultupdate <= 0) { + $error++; + $errmsg .= $contact->error; + } + } + } + + if (!$error) { + // We have the contact and the thirdparty + + + + $db->commit(); } - // We have the contact and the thirdparty - $db->commit(); } else { $db->rollback(); } From 1b4b93bc6aca0ace30a9126fa8e6f62d3f599b50 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 14:28:37 +0200 Subject: [PATCH 010/739] thirdparty/contact creation seems ok --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/public/project/index.php | 61 +++++++++++------------- 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2c9e81b369e..18868f70271 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9156,6 +9156,7 @@ abstract class CommonObject if ($c->fetch($add) > 0) { $result = $c->add_type($this, $type_categ); if ($result < 0) { + var_dump($result); $error++; $this->error = $c->error; $this->errors = $c->errors; @@ -9165,7 +9166,6 @@ abstract class CommonObject } } } - return $error ? -1 * $error : $ok; } diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 0eb2acd209f..ec8f0eca312 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -65,8 +65,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -270,29 +271,32 @@ if (empty($reshook) && $action == 'add') { } } // From there we have a thirdparty, now looking for the contact - $contact = new Contact($db); - $resultcontact = $contact->fetch('', $user, '', $email); - if ($resultcontact<=0) { - // Need to create a contact - $contact->socid = $thirdparty->id; - $contact->lastname = (string) GETPOST("lastname", 'alpha'); - $contact->firstname = (string) GETPOST("firstname", 'alpha'); - $contact->address = (string) GETPOST("address", 'alpha'); - $contact->zip = (string) GETPOST("zipcode", 'alpha'); - $contact->town = (string) GETPOST("town", 'alpha'); - $contact->country_id = (int) GETPOST("country_id", 'int'); - $contact->state_id = (int) GETPOST("state_id", 'int'); - $contact->email = $email; - $contact->statut = 1; //Default status to Actif - - $resultcreatecontact = $contact->create($user); - if ($resultcreatecontact<0) { - $error++; - $errmsg .= $contact->error; - } - } if (!$error) { + $contact = new Contact($db); + $resultcontact = $contact->fetch('', '', '', $email); + if ($resultcontact<=0) { + // Need to create a contact + $contact->socid = $thirdparty->id; + $contact->lastname = (string) GETPOST("lastname", 'alpha'); + $contact->firstname = (string) GETPOST("firstname", 'alpha'); + $contact->address = (string) GETPOST("address", 'alpha'); + $contact->zip = (string) GETPOST("zipcode", 'alpha'); + $contact->town = (string) GETPOST("town", 'alpha'); + $contact->country_id = (int) GETPOST("country_id", 'int'); + $contact->state_id = (int) GETPOST("state_id", 'int'); + $contact->email = $email; + $contact->statut = 1; //Default status to Actif + + $resultcreatecontact = $contact->create($user); + if ($resultcreatecontact<0) { + $error++; + $errmsg .= $contact->error; + } + } + } + // Only if we created the contact + if (!$error && $resultcontact<=0) { // Adding supplier tag $category = new Categorie($db); if (GETPOST("suggestconference")) { @@ -307,9 +311,8 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $category->error; } else { - $contact->setCategoriesCommon($category->id, Categorie::TYPE_CONTACT, false); - $resultupdate = $contact->update($contact->id); - if ($resultupdate <= 0) { + $resultsetcategory = $contact->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CONTACT, false); + if ($resultsetcategory <=0) { $error++; $errmsg .= $contact->error; } @@ -454,16 +457,8 @@ if ($project->accept_booth_suggestions) { print ''; } print ''; - print '

'; -// Save -print '
'; -print ''; -if (!empty($backtopage)) { - print '     '; -} -print '
'; print "\n"; From dd9c42876a381b01f1891122c2a39c064d658cd6 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 14:29:28 +0200 Subject: [PATCH 011/739] cleared test modif on core --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 18868f70271..2c9e81b369e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9156,7 +9156,6 @@ abstract class CommonObject if ($c->fetch($add) > 0) { $result = $c->add_type($this, $type_categ); if ($result < 0) { - var_dump($result); $error++; $this->error = $c->error; $this->errors = $c->errors; @@ -9166,6 +9165,7 @@ abstract class CommonObject } } } + return $error ? -1 * $error : $ok; } From a71697375764c9c20307ec04f204e2993eac199f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 15:44:08 +0200 Subject: [PATCH 012/739] form completed, tags added to thirdparty --- htdocs/public/project/index.php | 90 ++++++++++++++++++++++++-- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index ec8f0eca312..64fbea05505 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -84,6 +84,10 @@ $action = GETPOST('action', 'aZ09'); $email = GETPOST("email"); $societe = GETPOST("societe"); +$label = GETPOST("label"); +$note = GETPOST("note"); +$datestart = GETPOST("datestart"); +$dateend = GETPOST("dateend"); // Getting id from Post and decoding it $encodedid = GETPOST('id'); @@ -205,6 +209,26 @@ if (empty($reshook) && $action == 'add') { $db->begin(); + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + if (!GETPOST("label")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."
\n"; + } + if (!GETPOST("note")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
\n"; + } + if (!GETPOST("datestart")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))."
\n"; + } + if (!GETPOST("dateend")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))."
\n"; + } if (!GETPOST("email")) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; @@ -295,9 +319,9 @@ if (empty($reshook) && $action == 'add') { } } } - // Only if we created the contact - if (!$error && $resultcontact<=0) { - // Adding supplier tag + + if (!$error) { + // Adding supplier tag and tag from setup to thirdparty $category = new Categorie($db); if (GETPOST("suggestconference")) { // Conference case @@ -311,18 +335,58 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $category->error; } else { - $resultsetcategory = $contact->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CONTACT, false); + $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false); if ($resultsetcategory <=0) { $error++; - $errmsg .= $contact->error; + $errmsg .= $thirdparty->error; } + $thirdparty->fournisseur = 1; + // Load object modCodeFournisseur + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeFournisseur = new $module; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 0); + } + $thirdparty->code_fournisseur = $tmpcode; + + $res = $thirdparty->update(0); } } if (!$error) { + /* // We have the contact and the thirdparty - - + $conforbooth = new ConferenceOrBooth($db); + $conforbooth->label = $label; + $conforbooth->fk_soc = $thirdparty->id; + $conforbooth->fk_project = $project->id; + $conforbooth->note = $note; + //$conforbooth->fk_action = + $conforbooth->datep =$datestart; + $conforbooth->datep2 = $dateend; + $conforbooth->datec = dol_now(); + $conforbooth->tms = dol_now(); + //$conforbooth->fk_user_author = + //$conforbooth->fk_user_mod = + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $resultconforbooth = $conforbooth->create($user); + if ($resultconforbooth<=0) { + $error++; + $errmsg .= $conforbooth->error; + } else { + //conforbooth created + var_dump('gg'); + }*/ $db->commit(); } @@ -392,6 +456,18 @@ print '
'."\n"; +// Label +print ''."\n"; +print ''."\n"; +// Note +print ''."\n"; +print ''."\n"; +// Start Date +print ''."\n"; +print ''."\n"; +// End Date +print ''."\n"; +print ''."\n"; // Company print ''."\n"; print ''."\n"; // Start Date print ''."\n"; -print ''."\n"; +print ''."\n"; // End Date print ''."\n"; -print ''."\n"; +print ''."\n"; // Company print ''; print ''; } From cedb8adfe25280ca409495e1bfcf22e108ba590f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 09:52:11 +0200 Subject: [PATCH 015/739] removal of vardump --- htdocs/societe/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 64a46f9d1a8..68efa8e694c 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2468,7 +2468,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } - var_dump($tmpcheck); print ''; print ''; } From bfadcfc4bb430966330672c4d8cb969ac0a23e79 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 10:49:10 +0200 Subject: [PATCH 016/739] added red star on label and note, that are required --- htdocs/public/project/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index d6614c8ed29..3a40649b183 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -464,10 +464,10 @@ print ''; // Email print ''."\n"; // Label -print ''."\n"; +print ''."\n"; print ''."\n"; // Note -print ''."\n"; +print ''."\n"; print ''."\n"; // Start Date print ''."\n"; From 151819b7adbe58ed7f9f693bf7d94abb41fa3ab8 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 11:22:40 +0200 Subject: [PATCH 017/739] added payment redirection to pay a booth, or status update for free booth/conference --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/project/index.php | 119 ++++++++++++++++++++-- 2 files changed, 113 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 6ef39e81ff6..6d15d599789 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -107,6 +107,7 @@ MissingOrBadSecureKey = The security key is invalid or missing EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference EvntOrgDuration = This conference starts on %s and ends on %s ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s +BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s # # SubscriptionOk page # diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 3a40649b183..06e46e465eb 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -371,7 +371,6 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { - /* // We have the contact and the thirdparty $conforbooth = new ConferenceOrBooth($db); $conforbooth->label = $label; @@ -383,17 +382,123 @@ if (empty($reshook) && $action == 'add') { $conforbooth->datep2 = $dateend; $conforbooth->datec = dol_now(); $conforbooth->tms = dol_now(); - //$conforbooth->fk_user_author = - //$conforbooth->fk_user_mod = - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; $resultconforbooth = $conforbooth->create($user); if ($resultconforbooth<=0) { $error++; $errmsg .= $conforbooth->error; } else { - //conforbooth created - var_dump('gg'); - }*/ + // If this is a paying booth, we have to redirect to payment page and create an invoice + if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { + $productforinvoicerow = new Product($db); + $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); + if ($resultprod < 0) { + $error++; + $errmsg .= $productforinvoicerow->error; + } else { + $facture = new Facture($db); + $facture->type = Facture::TYPE_STANDARD; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + $facture->date = dol_now(); + $facture->cond_reglement_id = $contact->cond_reglement_id; + + if (empty($facture->cond_reglement_id)) { + $paymenttermstatic = new PaymentTerm($contact->db); + $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); + if (empty($facture->cond_reglement_id)) { + $error++; + $contact->error = 'ErrorNoPaymentTermRECEPFound'; + $contact->errors[] = $contact->error; + } + } + $resultfacture = $facture->create($user); + if ($resultfacture <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } else { + $facture->add_object_linked($contact->element, $contact->id); + } + } + + if (!$error) { + // Add line to draft invoice + $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); + $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } + if (!$error) { + $valid = true; + $sourcetouse = 'boothlocation'; + $reftouse = $facture->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + Header("Location: ".$redirection); + exit; + } + } + } else { + // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update + $conforbooth->setStatut(CONFERENCEORBOOTH::STATUS_SUGGESTED); + $conforbooth->update($user); + + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); + Header("Location: ".$redirection); + exit; + } + } $db->commit(); } From b24b297a407da6d7fc4281b5ba6d2773de3fed5d Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 12:30:49 +0200 Subject: [PATCH 018/739] adaptation of the payment for the booth location case --- htdocs/langs/en_US/eventorganization.lang | 5 +- htdocs/public/payment/newpayment.php | 107 +++++++++ htdocs/public/payment/paymentok.php | 272 ++++++++++++++++++---- htdocs/public/project/index.php | 2 +- 4 files changed, 341 insertions(+), 45 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 6d15d599789..eb340795a1e 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -119,5 +119,6 @@ ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to a co # # Payment page # -Attendee = Participant -PaymentConferenceAttendee = Paiement de participation à une conférence +Attendee = Attendee +PaymentConferenceAttendee = Conference attendee payment +PaymentBoothLocation = Booth location payment diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b351367f6ea..346e5f7bdda 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -142,6 +142,23 @@ if ($source == 'conferencesubscription') { } } } +} elseif ($source == 'boothlocation') { + // Getting the amount to pay, the invoice, finding the thirdparty + $invoiceid = GETPOST('ref'); + $invoice = new Facture($db); + $resultinvoice = $invoice->fetch($invoiceid); + if ($resultinvoice <= 0) { + setEventMessages(null, $invoice->errors, "errors"); + } else { + $amount = price2num($invoice->total_ttc); + // Finding the associated thirdparty + $thirdparty = new Societe($db); + $resultthirdparty = $thirdparty->fetch($invoice->socid); + if ($resultthirdparty <= 0) { + setEventMessages(null, $thirdparty->errors, "errors"); + } + $object = $thirdparty; + } } @@ -1862,6 +1879,96 @@ if ($source == 'conferencesubscription') { print ''."\n"; } +if ($source == 'boothlocation') { + $found = true; + $langs->load("members"); + + if (GETPOST('fulltag', 'alpha')) { + $fulltag = GETPOST('fulltag', 'alpha'); + } else { + $fulltag = 'BOO='.GETPOST("booth").'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + if (!empty($TAG)) { + $tag = $TAG; $fulltag .= '.TAG='.$TAG; + } + } + $fulltag = dol_string_unaccent($fulltag); + + // Creditor + print ''."\n"; + + // Debitor + print ''."\n"; + + // Object + $text = ''.$langs->trans("PaymentBoothLocation").''; + if (GETPOST('desc', 'alpha')) { + $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; + } + print ''."\n"; + + // Amount + print ''."\n"; + + // Tag + print ''."\n"; + + // Shipping address + $shipToName = $thirdparty->getFullName($langs); + $shipToStreet = $thirdparty->address; + $shipToCity = $thirdparty->town; + $shipToState = $thirdparty->state_code; + $shipToCountryCode = $thirdparty->country_code; + $shipToZip = $thirdparty->zip; + $shipToStreet2 = ''; + $phoneNum = $thirdparty->phone; + if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) { + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + } else { + print ''."\n"; + } + print ''."\n"; + print ''."\n"; + $labeldesc = $langs->trans("PaymentSubscription"); + if (GETPOST('desc', 'alpha')) { + $labeldesc = GETPOST('desc', 'alpha'); + } + print ''."\n"; +} + + if (!$found && !$mesg) { $mesg = $langs->trans("ErrorBadParameters"); } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 3d3946927c8..d8905d86eac 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -104,7 +104,6 @@ if (empty($FULLTAG)) { } $source = GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha'); $ref = GETPOST('ref'); -$invoiceref = GETPOST('invoice'); $suffix = GETPOST("suffix", 'aZ09'); $membertypeid = GETPOST("membertypeid", 'int'); @@ -893,48 +892,51 @@ if ($ispaymentok) { // Sending mail $thirdparty = new Societe($db); - $thirdparty->fetch($attendeetovalidate->fk_soc); - - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + $resultthirdparty = $thirdparty->fetch($attendeetovalidate->fk_soc); + if ($resultthirdparty < 0) { + setEventMessages(null, $attendeetovalidate->errors, "errors"); } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } } } } else { @@ -951,6 +953,192 @@ if ($ispaymentok) { } } elseif (array_key_exists('BOO', $tmptag) && $tmptag['BOO'] > 0) { // @todo BOOTH CASE (to copy and adapt from above) + // Record payment + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $object = new Facture($db); + $result = $object->fetch($ref); + if ($result) { + $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; + + $paymentTypeId = 0; + if ($paymentmethod == 'paybox') { + $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; + } + if ($paymentmethod == 'paypal') { + $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS; + } + if ($paymentmethod == 'stripe') { + $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; + } + if (empty($paymentTypeId)) { + $paymentType = $_SESSION["paymentType"]; + if (empty($paymentType)) { + $paymentType = 'CB'; + } + $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); + } + + $currencyCodeType = $_SESSION['currencyCodeType']; + + // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) + if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { + $resultvalidate = $object->validate($user); + if ($resultvalidate < 0) { + $postactionmessages[] = 'Cannot validate invoice'; + $ispostactionok = -1; + $error++; // Not yet supported + } else { + $db->begin(); + + // Creation of payment line + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; + $paiement = new Paiement($db); + $paiement->datepaye = $now; + if ($currencyCodeType == $conf->currency) { + $paiement->amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id + } else { + $paiement->multicurrency_amounts = array($object->id => $FinalPaymentAmt); // Array with all payments dispatching + + $postactionmessages[] = 'Payment was done in a different currency that currency expected of company'; + $ispostactionok = -1; + $error++; // Not yet supported + } + $paiement->paiementid = $paymentTypeId; + $paiement->num_payment = ''; + $paiement->note_public = 'Online payment '.dol_print_date($now, 'standard').' from '.$ipaddress; + $paiement->ext_payment_id = $TRANSACTIONID; + $paiement->ext_payment_site = $service; + + if (!$error) { + $paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents + if ($paiement_id < 0) { + $postactionmessages[] = $paiement->error.' '.join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + } else { + $postactionmessages[] = 'Payment created'; + $ispostactionok = 1; + } + } + + if (!$error && !empty($conf->banque->enabled)) { + $bankaccountid = 0; + if ($paymentmethod == 'paybox') { + $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; + } elseif ($paymentmethod == 'paypal') { + $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; + } elseif ($paymentmethod == 'stripe') { + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; + } + + if ($bankaccountid > 0) { + $label = '(CustomerInvoicePayment)'; + if ($object->type == Facture::TYPE_CREDIT_NOTE) { + $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note + } + $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', ''); + if ($result < 0) { + $postactionmessages[] = $paiement->error.' '.join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + } else { + $postactionmessages[] = 'Bank transaction of payment created'; + $ispostactionok = 1; + } + } else { + $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; + $ispostactionok = -1; + $error++; + } + } + + if (!$error) { + // Putting the booth to "suggested" state + $booth = new ConferenceOrBooth($db); + $resultbooth = $booth->fetch($tmptag['BOO']); + if ($resultbooth < 0) { + $error++; + setEventMessages(null, $booth->errors, "errors"); + } else { + $booth->setStatut(CONFERENCEORBOOTH::STATUS_SUGGESTED); + $resultboothupdate = $booth->update($user); + if ($resultboothupdate<0) { + // Finding the thirdparty by getting the invoice + $invoice = new Facture($db); + $resultinvoice = $invoice->fetch($ref); + if ($resultinvoice<0) { + $postactionmessages[] = 'Could not find the associated invoice.'; + $ispostactionok = -1; + $error++; + } else { + $thirdparty = new Societe($db); + $resultthirdparty = $thirdparty->fetch($invoice->socid); + if ($resultthirdparty<0) { + $error++; + setEventMessages(null, $thirdparty->errors, "errors"); + } else { + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + } + } + } + } + } + + if (!$error) { + $db->commit(); + } else { + $db->rollback(); + } + } + } else { + $postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type" ('.$paymentType.') to record the payment of invoice '.$tmptag['ATT'].'. May be payment was already recorded.'; + $ispostactionok = -1; + } + } else { + $postactionmessages[] = 'Invoice paid '.$tmptag['ATT'].' was not found'; + $ispostactionok = -1; + } } else { // Nothing done } diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 06e46e465eb..7eb7f263a16 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -434,7 +434,7 @@ if (empty($reshook) && $action == 'add') { $valid = true; $sourcetouse = 'boothlocation'; $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical From f2f1eaa95e9ceb8f8d89fb0726d2e3407511053c Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 16:01:01 +0200 Subject: [PATCH 019/739] wip --- .../attendee_subscription.php | 28 +++++++++++-------- htdocs/public/project/index.php | 28 +++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 4940f5965fe..7a377a7121a 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -374,15 +374,15 @@ if (empty($reshook) && $action == 'add') { $valid = true; $sourcetouse = 'conferencesubscription'; $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse; + $redirection = $dolibarr_main_url_root . '/public/payment/newpayment.php?source=' . $sourcetouse . '&ref=' . $reftouse; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + $redirection .= '&securekey=' . dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical } else { - $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + $redirection .= '&securekey=' . $conf->global->PAYMENT_SECURITY_TOKEN; } } - Header("Location: ".$redirection); + Header("Location: " . $redirection); exit; } } @@ -392,8 +392,8 @@ if (empty($reshook) && $action == 'add') { $confattendee->setStatut(1); // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); @@ -410,7 +410,7 @@ if (empty($reshook) && $action == 'add') { if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; + $msg = $arraydefaultmessage->content; } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); @@ -429,19 +429,23 @@ if (empty($reshook) && $action == 'add') { $result = $mailfile->sendfile(); if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + dol_syslog("EMail sent to " . $sendto, LOG_DEBUG, 0, '_payment'); } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + dol_syslog("Failed to send EMail to " . $sendto, LOG_ERR, 0, '_payment'); } $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); - $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; - Header("Location: ".$redirection); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY . 'conferenceorbooth' . $id, 2); + $redirection = $dolibarr_main_url_root . '/public/eventorganization/subscriptionok.php?id=' . $encodedid . '&securekey=' . $securekeyurl; + Header("Location: " . $redirection); exit; } //Header("Location: ".$urlback); //exit; + } + + if (!$error) { + $db->commit(); } else { $db->rollback(); } diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 7eb7f263a16..bbfe55a6522 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -100,16 +100,12 @@ if ($resultproject < 0) { $errmsg .= $project->error; } -// Getting 'securekey'.'id' from Post and decoding it -$encodedsecurekeyandid = GETPOST('securekey', 'alpha'); -$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id); +// Security check +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$securekeyreceived = GETPOST("securekey"); +$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); -// Securekey decomposition into pure securekey and id added at the end -$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($encodedid)); -$idgotfromsecurekey = dol_decode(substr($securekeyandid, -strlen($encodedid), strlen($encodedid)), $dolibarr_main_instance_unique_id); - -// We check if the securekey collected is OK and if the id collected is the same than the id in the securekey -if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecurekey != $id) { +if ($securekeytocompare != $securekeyreceived) { print $langs->trans('MissingOrBadSecureKey'); exit; } @@ -377,12 +373,13 @@ if (empty($reshook) && $action == 'add') { $conforbooth->fk_soc = $thirdparty->id; $conforbooth->fk_project = $project->id; $conforbooth->note = $note; - //$conforbooth->fk_action = + $conforbooth->fk_action = 63; $conforbooth->datep =$datestart; $conforbooth->datep2 = $dateend; $conforbooth->datec = dol_now(); $conforbooth->tms = dol_now(); $resultconforbooth = $conforbooth->create($user); + var_dump($conforbooth); if ($resultconforbooth<=0) { $error++; $errmsg .= $conforbooth->error; @@ -494,14 +491,17 @@ if (empty($reshook) && $action == 'add') { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id); + $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; Header("Location: ".$redirection); exit; } } - - $db->commit(); } + } + if (!$error) { + $db->commit(); } else { $db->rollback(); } @@ -540,7 +540,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print '
'; From 5203a417fe13d91d93909817def137b334c0139b Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 16:31:14 +0200 Subject: [PATCH 020/739] select array OK for event type --- htdocs/public/project/index.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index bbfe55a6522..ce3f06a4cc3 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -82,6 +82,7 @@ $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); +$eventtype = GETPOST("eventtype"); $email = GETPOST("email"); $societe = GETPOST("societe"); $label = GETPOST("label"); @@ -120,6 +121,8 @@ $extrafields = new ExtraFields($db); $user->loadDefaultValues(); +$cactioncomm = new CActionComm($db); +$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); /** * Show header for new member @@ -373,13 +376,12 @@ if (empty($reshook) && $action == 'add') { $conforbooth->fk_soc = $thirdparty->id; $conforbooth->fk_project = $project->id; $conforbooth->note = $note; - $conforbooth->fk_action = 63; + $conforbooth->fk_action = $eventtype; $conforbooth->datep =$datestart; $conforbooth->datep2 = $dateend; $conforbooth->datec = dol_now(); $conforbooth->tms = dol_now(); $resultconforbooth = $conforbooth->create($user); - var_dump($conforbooth); if ($resultconforbooth<=0) { $error++; $errmsg .= $conforbooth->error; @@ -568,6 +570,9 @@ print '
'."\n"; +// Type of event +print ''."\n"; +print ''; // Label print ''."\n"; print ''."\n"; From 54b5a43006174ccfec34c9cdc57f5622d906b227 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 17:06:25 +0200 Subject: [PATCH 021/739] wip --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/project/index.php | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 9ad2d45ddf4..7b5ddd8160c 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -108,6 +108,7 @@ EvntOrgWelcomeMessage = This form allows you to register as a new participant to EvntOrgDuration = This conference starts on %s and ends on %s. ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s. BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s +EventType = Event type # # SubscriptionOk page # diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index ce3f06a4cc3..4f376a2f10f 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -295,7 +295,6 @@ if (empty($reshook) && $action == 'add') { } } // From there we have a thirdparty, now looking for the contact - if (!$error) { $contact = new Contact($db); $resultcontact = $contact->fetch('', '', '', $email); @@ -447,9 +446,8 @@ if (empty($reshook) && $action == 'add') { } } else { // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update - $conforbooth->setStatut(CONFERENCEORBOOTH::STATUS_SUGGESTED); + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; $conforbooth->update($user); - // Sending mail require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -492,18 +490,17 @@ if (empty($reshook) && $action == 'add') { } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } - - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); - $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; - Header("Location: ".$redirection); - exit; } } } } if (!$error) { $db->commit(); + $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; + Header("Location: ".$redirection); + exit; } else { $db->rollback(); } From 15e65729f6abf38cc744e2047a04cc8134f297e7 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 27 Apr 2021 17:19:13 +0200 Subject: [PATCH 022/739] put company under email in the form --- htdocs/public/project/index.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 4f376a2f10f..e4c030c9718 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -567,6 +567,9 @@ print ''."\n"; +// Company +print ''."\n"; // Type of event print ''."\n"; print ''; @@ -582,12 +585,6 @@ print ''."\n"; -// Company -print ''."\n"; // Address print ''."\n"; From 4c50d210dd0af5f0ef97b1dff27a385ead9c788d Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 11:26:42 +0200 Subject: [PATCH 023/739] creation of the 3 main pages --- htdocs/public/project/suggestbooth.php | 1 + htdocs/public/project/suggestconference.php | 1 + htdocs/public/project/viewandvote.php | 1 + 3 files changed, 3 insertions(+) create mode 100644 htdocs/public/project/suggestbooth.php create mode 100644 htdocs/public/project/suggestconference.php create mode 100644 htdocs/public/project/viewandvote.php diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php new file mode 100644 index 00000000000..b3d9bbc7f37 --- /dev/null +++ b/htdocs/public/project/suggestbooth.php @@ -0,0 +1 @@ + Date: Thu, 6 May 2021 11:27:48 +0200 Subject: [PATCH 024/739] wip --- htdocs/public/project/index.php | 8 - htdocs/public/project/suggestbooth.php | 657 ++++++++++++++++++++ htdocs/public/project/suggestconference.php | 657 ++++++++++++++++++++ 3 files changed, 1314 insertions(+), 8 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index e4c030c9718..fcbc786be4c 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -82,14 +82,6 @@ $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); -$eventtype = GETPOST("eventtype"); -$email = GETPOST("email"); -$societe = GETPOST("societe"); -$label = GETPOST("label"); -$note = GETPOST("note"); -$datestart = GETPOST("datestart"); -$dateend = GETPOST("dateend"); - // Getting id from Post and decoding it $encodedid = GETPOST('id'); $id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index b3d9bbc7f37..e4c030c9718 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -1 +1,658 @@ + * Copyright (C) 2001-2002 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange + * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018 Alexandre Spangaro + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/members/new.php + * \ingroup member + * \brief Example of form to add a new member + * + * Note that you can add following constant to change behaviour of page + * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form + * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe + * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) + * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted + * MEMBER_NEWFORM_FORCETYPE Force type of member + * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) + * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country + */ + +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} + +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) { + define("DOLENTITY", $entity); +} + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + +global $dolibarr_main_instance_unique_id; +global $dolibarr_main_url_root; + +// Init vars +$errmsg = ''; +$num = 0; +$error = 0; +$backtopage = GETPOST('backtopage', 'alpha'); +$action = GETPOST('action', 'aZ09'); + +$eventtype = GETPOST("eventtype"); +$email = GETPOST("email"); +$societe = GETPOST("societe"); +$label = GETPOST("label"); +$note = GETPOST("note"); +$datestart = GETPOST("datestart"); +$dateend = GETPOST("dateend"); + +// Getting id from Post and decoding it +$encodedid = GETPOST('id'); +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); + +$project = new Project($db); +$resultproject = $project->fetch($id); +if ($resultproject < 0) { + $error++; + $errmsg .= $project->error; +} + +// Security check +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$securekeyreceived = GETPOST("securekey"); +$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + +if ($securekeytocompare != $securekeyreceived) { + print $langs->trans('MissingOrBadSecureKey'); + exit; +} + +// Load translation files +$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('publicnewmembercard', 'globalcard')); + +$extrafields = new ExtraFields($db); + +$user->loadDefaultValues(); + +$cactioncomm = new CActionComm($db); +$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); + +/** + * Show header for new member + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +{ + global $user, $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } + print '
'; + + print '
'; +} + +/** + * Show footer for new member + * + * @return void + */ +function llxFooterVierge() +{ + print '
'; + + printCommonFooter('public'); + + print "\n"; + print "\n"; +} + + + +/* + * Actions + */ +global $mysoc; +$parameters = array(); +// Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +// Action called when page is submitted +if (empty($reshook) && $action == 'add') { + $error = 0; + + $urlback = ''; + + $db->begin(); + + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + if (!GETPOST("label")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."
\n"; + } + if (!GETPOST("note")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
\n"; + } + if (!GETPOST("datestart")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))."
\n"; + } + if (!GETPOST("dateend")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))."
\n"; + } + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + if (!GETPOST("lastname")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; + } + if (!GETPOST("societe")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; + } + if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + } + if (!GETPOST("country_id")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; + } + + if (!$error) { + // Getting the thirdparty or creating it + $thirdparty = new Societe($db); + $resultfetchthirdparty = $thirdparty->fetch('', $societe); + + if ($resultfetchthirdparty<=0) { + // Need to create a new one (not found or multiple with the same name) + $thirdparty->name = $societe; + $thirdparty->address = GETPOST("address"); + $thirdparty->zip = GETPOST("zipcode"); + $thirdparty->town = GETPOST("town"); + $thirdparty->client = 2; + $thirdparty->fournisseur = 0; + $thirdparty->country_id = GETPOST("country_id", 'int'); + $thirdparty->state_id = GETPOST("state_id", 'int'); + $thirdparty->email = $email; + + // Load object modCodeTiers + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeClient = new $module($db); + + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); + } + $thirdparty->code_client = $tmpcode; + $readythirdparty = $thirdparty->create($user); + if ($readythirdparty <0) { + $error++; + $errmsg .= $thirdparty->error; + } else { + $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); + $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); + } + } + // From there we have a thirdparty, now looking for the contact + if (!$error) { + $contact = new Contact($db); + $resultcontact = $contact->fetch('', '', '', $email); + if ($resultcontact<=0) { + // Need to create a contact + $contact->socid = $thirdparty->id; + $contact->lastname = (string) GETPOST("lastname", 'alpha'); + $contact->firstname = (string) GETPOST("firstname", 'alpha'); + $contact->address = (string) GETPOST("address", 'alpha'); + $contact->zip = (string) GETPOST("zipcode", 'alpha'); + $contact->town = (string) GETPOST("town", 'alpha'); + $contact->country_id = (int) GETPOST("country_id", 'int'); + $contact->state_id = (int) GETPOST("state_id", 'int'); + $contact->email = $email; + $contact->statut = 1; //Default status to Actif + + $resultcreatecontact = $contact->create($user); + if ($resultcreatecontact<0) { + $error++; + $errmsg .= $contact->error; + } + } + } + + if (!$error) { + // Adding supplier tag and tag from setup to thirdparty + $category = new Categorie($db); + if (GETPOST("suggestconference")) { + // Conference case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); + } else { + // Booth case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); + } + + if ($resultcategory<=0) { + $error++; + $errmsg .= $category->error; + } else { + $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false); + if ($resultsetcategory < 0) { + $error++; + $errmsg .= $thirdparty->error; + } else { + $thirdparty->fournisseur = 1; + + // Load object modCodeFournisseur + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeFournisseur = new $module; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); + } + $thirdparty->code_fournisseur = $tmpcode; + + $res = $thirdparty->update(0, $user, 1, 1, 1); + + if ($res <= 0) { + $error++; + } + } + } + } + + if (!$error) { + // We have the contact and the thirdparty + $conforbooth = new ConferenceOrBooth($db); + $conforbooth->label = $label; + $conforbooth->fk_soc = $thirdparty->id; + $conforbooth->fk_project = $project->id; + $conforbooth->note = $note; + $conforbooth->fk_action = $eventtype; + $conforbooth->datep =$datestart; + $conforbooth->datep2 = $dateend; + $conforbooth->datec = dol_now(); + $conforbooth->tms = dol_now(); + $resultconforbooth = $conforbooth->create($user); + if ($resultconforbooth<=0) { + $error++; + $errmsg .= $conforbooth->error; + } else { + // If this is a paying booth, we have to redirect to payment page and create an invoice + if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { + $productforinvoicerow = new Product($db); + $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); + if ($resultprod < 0) { + $error++; + $errmsg .= $productforinvoicerow->error; + } else { + $facture = new Facture($db); + $facture->type = Facture::TYPE_STANDARD; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + $facture->date = dol_now(); + $facture->cond_reglement_id = $contact->cond_reglement_id; + + if (empty($facture->cond_reglement_id)) { + $paymenttermstatic = new PaymentTerm($contact->db); + $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); + if (empty($facture->cond_reglement_id)) { + $error++; + $contact->error = 'ErrorNoPaymentTermRECEPFound'; + $contact->errors[] = $contact->error; + } + } + $resultfacture = $facture->create($user); + if ($resultfacture <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } else { + $facture->add_object_linked($contact->element, $contact->id); + } + } + + if (!$error) { + // Add line to draft invoice + $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); + $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } + if (!$error) { + $valid = true; + $sourcetouse = 'boothlocation'; + $reftouse = $facture->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + Header("Location: ".$redirection); + exit; + } + } + } else { + // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->update($user); + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + } + } + } + } + if (!$error) { + $db->commit(); + $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; + Header("Location: ".$redirection); + exit; + } else { + $db->rollback(); + } +} + + +/* + * View + */ + +$form = new Form($db); +$formcompany = new FormCompany($db); + +llxHeaderVierge($langs->trans("NewSuggestion")); + + +print load_fiche_titre($langs->trans("NewSuggestion"), '', '', 0, 0, 'center'); + + +print '
'; +print '
'; +print '
'; + +// Welcome message +$text = '

'; +$text .= ''."\n"; +$text .= ''."\n";; +print $text; +print ''; + +dol_htmloutput_errors($errmsg); + +// Print form +print ''."\n"; +print ''; +print ''; +print ''; +print ''; +print ''; + +print '
'; + +print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; +//print $langs->trans("FieldsWithIsForPublic",'**').'
'; + +print dol_get_fiche_head(''); + +print ''; + +print '
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
*
'.$langs->trans("Label").'
'.$langs->trans("Note").'
'.$langs->trans("DateStart").'
'.$langs->trans("DateEnd").'
'.$langs->trans("Company"); if (!empty(floatval($project->price_registration))) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9d449922dd2..4ce6211c767 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1322,7 +1322,7 @@ class Societe extends CommonObject } } } - + var_dump($result); if ($result >= 0) { dol_syslog(get_class($this)."::update verify ok or not done"); From c8440a62836e8cdf8d6e8764fdce17da503619e2 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 16:17:42 +0200 Subject: [PATCH 013/739] fix on form dates --- htdocs/public/project/index.php | 6 ++++-- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 64fbea05505..932a36dad92 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -340,7 +340,9 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $thirdparty->error; } + $thirdparty->fournisseur = 1; + // Load object modCodeFournisseur $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { @@ -464,10 +466,10 @@ print '
'.$langs->trans("Note").'
'.$langs->trans("DateStart").'
'.$langs->trans("DateEnd").'
'.$langs->trans("Company"); if (!empty(floatval($project->price_registration))) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4ce6211c767..9d449922dd2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1322,7 +1322,7 @@ class Societe extends CommonObject } } } - var_dump($result); + if ($result >= 0) { dol_syslog(get_class($this)."::update verify ok or not done"); From a3628954b21b82bfad96b69d4fa396322778d77e Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 26 Apr 2021 17:46:30 +0200 Subject: [PATCH 014/739] fix for the supplier code --- htdocs/public/project/index.php | 47 ++++++++++++++++++--------------- htdocs/societe/card.php | 1 + 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 932a36dad92..d6614c8ed29 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -255,6 +255,7 @@ if (empty($reshook) && $action == 'add') { // Getting the thirdparty or creating it $thirdparty = new Societe($db); $resultfetchthirdparty = $thirdparty->fetch('', $societe); + if ($resultfetchthirdparty<=0) { // Need to create a new one (not found or multiple with the same name) $thirdparty->name = $societe; @@ -331,37 +332,41 @@ if (empty($reshook) && $action == 'add') { $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); } - if ($resultcategory<0) { + if ($resultcategory<=0) { $error++; $errmsg .= $category->error; } else { $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false); - if ($resultsetcategory <=0) { + if ($resultsetcategory < 0) { $error++; $errmsg .= $thirdparty->error; - } + } else { + $thirdparty->fournisseur = 1; - $thirdparty->fournisseur = 1; + // Load object modCodeFournisseur + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeFournisseur = new $module; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); + } + $thirdparty->code_fournisseur = $tmpcode; - // Load object modCodeFournisseur - $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module) - 4); - } - $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) { - $res = dol_include_once($dirroot.$module.'.php'); - if ($res) { - break; + $res = $thirdparty->update(0, $user, 1, 1, 1); + + if ($res <= 0) { + $error++; } } - $modCodeFournisseur = new $module; - if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { - $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 0); - } - $thirdparty->code_fournisseur = $tmpcode; - - $res = $thirdparty->update(0); } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 68efa8e694c..64a46f9d1a8 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2468,6 +2468,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } + var_dump($tmpcheck); print '
'.$langs->trans("Email").'*
'.$langs->trans("Label").'
'.$langs->trans("Label").'*
'.$langs->trans("Note").'
'.$langs->trans("Note").'*
'.$langs->trans("DateStart").'
'.$langs->trans("Creditor"); + print ''.$creditor.''; + print ''; + print '
'.$langs->trans("Attendee"); + print ''; + print $thirdparty->name; + print ''; + print '
'.$langs->trans("Designation"); + print ''.$text; + print ''; + print ''; + print '
'.$langs->trans("Amount"); + print ''; + $valtoshow = $amount; + print ''.price($valtoshow).''; + print ''; + print ''; + + // Currency + print ' '.$langs->trans("Currency".$currency).''; + print ''; + print '
'.$langs->trans("PaymentCode"); + print ''.$fulltag.''; + print ''; + print ''; + print '
*
'.$langs->trans("EventType").'*'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).'
'.$langs->trans("Label").'*
*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("EventType").'*'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).''."\n"; print '
'.$langs->trans("Company"); -if (!empty(floatval($project->price_registration))) { - print '*'; -} -print '
'.$langs->trans("Address").''."\n"; print '
'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'.$project->note_public.'
'."\n"; + +// Name +print ''; +print ''; +print ''; +// Email +print ''."\n"; +// Company +print ''."\n"; +// Type of event +print ''."\n"; +print ''; +// Label +print ''."\n"; +print ''."\n"; +// Note +print ''."\n"; +print ''."\n"; +// Start Date +print ''."\n"; +print ''."\n"; +// End Date +print ''."\n"; +print ''."\n"; +// Address +print ''."\n"; +// Zip / Town +print ''; +// Country +print ''; +// State +if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + print ''; +} + +print "
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("EventType").'*'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).'
'.$langs->trans("Label").'*
'.$langs->trans("Note").'*
'.$langs->trans("DateStart").'
'.$langs->trans("DateEnd").'
'.$langs->trans("Address").''."\n"; +print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; +print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); +print ' / '; +print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); +print '
'.$langs->trans('Country').'*'; +$country_id = GETPOST('country_id'); +if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); +} +if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) { + $country_id = $new_country_id; + } + } +} +$country_code = getCountry($country_id, 2, $db, $langs); +print $form->select_country($country_id, 'country_id'); +print '
'.$langs->trans('State').''; + if ($country_code) { + print $formcompany->select_state(GETPOST("state_id"), $country_code); + } else { + print ''; + } + print '
\n"; + +print dol_get_fiche_end(); + + +// Show all action buttons +print '
'; +print '
'; +// Output introduction text +if ($project->accept_conference_suggestions) { + print ''; + print '

'; +} +print ''; +print '

'; +if ($project->accept_booth_suggestions) { + print ''; +} +print '
'; +print '

'; + + + +print "\n"; +print "
"; +print '
'; + + +llxFooterVierge(); + +$db->close(); diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index b3d9bbc7f37..e4c030c9718 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -1 +1,658 @@ + * Copyright (C) 2001-2002 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2012 J. Fernando Lagrange + * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018 Alexandre Spangaro + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/members/new.php + * \ingroup member + * \brief Example of form to add a new member + * + * Note that you can add following constant to change behaviour of page + * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form + * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited + * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe + * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) + * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted + * MEMBER_NEWFORM_FORCETYPE Force type of member + * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) + * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country + */ + +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} + +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) { + define("DOLENTITY", $entity); +} + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + +global $dolibarr_main_instance_unique_id; +global $dolibarr_main_url_root; + +// Init vars +$errmsg = ''; +$num = 0; +$error = 0; +$backtopage = GETPOST('backtopage', 'alpha'); +$action = GETPOST('action', 'aZ09'); + +$eventtype = GETPOST("eventtype"); +$email = GETPOST("email"); +$societe = GETPOST("societe"); +$label = GETPOST("label"); +$note = GETPOST("note"); +$datestart = GETPOST("datestart"); +$dateend = GETPOST("dateend"); + +// Getting id from Post and decoding it +$encodedid = GETPOST('id'); +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); + +$project = new Project($db); +$resultproject = $project->fetch($id); +if ($resultproject < 0) { + $error++; + $errmsg .= $project->error; +} + +// Security check +$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$securekeyreceived = GETPOST("securekey"); +$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + +if ($securekeytocompare != $securekeyreceived) { + print $langs->trans('MissingOrBadSecureKey'); + exit; +} + +// Load translation files +$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('publicnewmembercard', 'globalcard')); + +$extrafields = new ExtraFields($db); + +$user->loadDefaultValues(); + +$cactioncomm = new CActionComm($db); +$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); + +/** + * Show header for new member + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param array $arrayofjs Array of complementary js files + * @param array $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') +{ + global $user, $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; + } + print '
'; + + print '
'; +} + +/** + * Show footer for new member + * + * @return void + */ +function llxFooterVierge() +{ + print '
'; + + printCommonFooter('public'); + + print "\n"; + print "\n"; +} + + + +/* + * Actions + */ +global $mysoc; +$parameters = array(); +// Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +// Action called when page is submitted +if (empty($reshook) && $action == 'add') { + $error = 0; + + $urlback = ''; + + $db->begin(); + + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + if (!GETPOST("label")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."
\n"; + } + if (!GETPOST("note")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
\n"; + } + if (!GETPOST("datestart")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))."
\n"; + } + if (!GETPOST("dateend")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))."
\n"; + } + if (!GETPOST("email")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; + } + if (!GETPOST("lastname")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; + } + if (!GETPOST("societe")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; + } + if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + } + if (!GETPOST("country_id")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; + } + + if (!$error) { + // Getting the thirdparty or creating it + $thirdparty = new Societe($db); + $resultfetchthirdparty = $thirdparty->fetch('', $societe); + + if ($resultfetchthirdparty<=0) { + // Need to create a new one (not found or multiple with the same name) + $thirdparty->name = $societe; + $thirdparty->address = GETPOST("address"); + $thirdparty->zip = GETPOST("zipcode"); + $thirdparty->town = GETPOST("town"); + $thirdparty->client = 2; + $thirdparty->fournisseur = 0; + $thirdparty->country_id = GETPOST("country_id", 'int'); + $thirdparty->state_id = GETPOST("state_id", 'int'); + $thirdparty->email = $email; + + // Load object modCodeTiers + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeClient = new $module($db); + + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { + $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); + } + $thirdparty->code_client = $tmpcode; + $readythirdparty = $thirdparty->create($user); + if ($readythirdparty <0) { + $error++; + $errmsg .= $thirdparty->error; + } else { + $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); + $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); + } + } + // From there we have a thirdparty, now looking for the contact + if (!$error) { + $contact = new Contact($db); + $resultcontact = $contact->fetch('', '', '', $email); + if ($resultcontact<=0) { + // Need to create a contact + $contact->socid = $thirdparty->id; + $contact->lastname = (string) GETPOST("lastname", 'alpha'); + $contact->firstname = (string) GETPOST("firstname", 'alpha'); + $contact->address = (string) GETPOST("address", 'alpha'); + $contact->zip = (string) GETPOST("zipcode", 'alpha'); + $contact->town = (string) GETPOST("town", 'alpha'); + $contact->country_id = (int) GETPOST("country_id", 'int'); + $contact->state_id = (int) GETPOST("state_id", 'int'); + $contact->email = $email; + $contact->statut = 1; //Default status to Actif + + $resultcreatecontact = $contact->create($user); + if ($resultcreatecontact<0) { + $error++; + $errmsg .= $contact->error; + } + } + } + + if (!$error) { + // Adding supplier tag and tag from setup to thirdparty + $category = new Categorie($db); + if (GETPOST("suggestconference")) { + // Conference case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); + } else { + // Booth case + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); + } + + if ($resultcategory<=0) { + $error++; + $errmsg .= $category->error; + } else { + $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false); + if ($resultsetcategory < 0) { + $error++; + $errmsg .= $thirdparty->error; + } else { + $thirdparty->fournisseur = 1; + + // Load object modCodeFournisseur + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); + if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { + $module = substr($module, 0, dol_strlen($module) - 4); + } + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + foreach ($dirsociete as $dirroot) { + $res = dol_include_once($dirroot.$module.'.php'); + if ($res) { + break; + } + } + $modCodeFournisseur = new $module; + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { + $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); + } + $thirdparty->code_fournisseur = $tmpcode; + + $res = $thirdparty->update(0, $user, 1, 1, 1); + + if ($res <= 0) { + $error++; + } + } + } + } + + if (!$error) { + // We have the contact and the thirdparty + $conforbooth = new ConferenceOrBooth($db); + $conforbooth->label = $label; + $conforbooth->fk_soc = $thirdparty->id; + $conforbooth->fk_project = $project->id; + $conforbooth->note = $note; + $conforbooth->fk_action = $eventtype; + $conforbooth->datep =$datestart; + $conforbooth->datep2 = $dateend; + $conforbooth->datec = dol_now(); + $conforbooth->tms = dol_now(); + $resultconforbooth = $conforbooth->create($user); + if ($resultconforbooth<=0) { + $error++; + $errmsg .= $conforbooth->error; + } else { + // If this is a paying booth, we have to redirect to payment page and create an invoice + if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { + $productforinvoicerow = new Product($db); + $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); + if ($resultprod < 0) { + $error++; + $errmsg .= $productforinvoicerow->error; + } else { + $facture = new Facture($db); + $facture->type = Facture::TYPE_STANDARD; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + $facture->date = dol_now(); + $facture->cond_reglement_id = $contact->cond_reglement_id; + + if (empty($facture->cond_reglement_id)) { + $paymenttermstatic = new PaymentTerm($contact->db); + $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); + if (empty($facture->cond_reglement_id)) { + $error++; + $contact->error = 'ErrorNoPaymentTermRECEPFound'; + $contact->errors[] = $contact->error; + } + } + $resultfacture = $facture->create($user); + if ($resultfacture <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } else { + $facture->add_object_linked($contact->element, $contact->id); + } + } + + if (!$error) { + // Add line to draft invoice + $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); + $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } + if (!$error) { + $valid = true; + $sourcetouse = 'boothlocation'; + $reftouse = $facture->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + Header("Location: ".$redirection); + exit; + } + } + } else { + // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->update($user); + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } + } + } + } + } + if (!$error) { + $db->commit(); + $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; + Header("Location: ".$redirection); + exit; + } else { + $db->rollback(); + } +} + + +/* + * View + */ + +$form = new Form($db); +$formcompany = new FormCompany($db); + +llxHeaderVierge($langs->trans("NewSuggestion")); + + +print load_fiche_titre($langs->trans("NewSuggestion"), '', '', 0, 0, 'center'); + + +print '
'; +print '
'; +print '
'; + +// Welcome message +$text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; +$text .= ''.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'."\n"; +$text .= ''.$project->note_public.''."\n";; +print $text; +print '
'; + +dol_htmloutput_errors($errmsg); + +// Print form +print '
'."\n"; +print ''; +print ''; +print ''; +print ''; +print ''; + +print '
'; + +print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; +//print $langs->trans("FieldsWithIsForPublic",'**').'
'; + +print dol_get_fiche_head(''); + +print ''; + +print ''."\n"; + +// Name +print ''; +print ''; +print ''; +// Email +print ''."\n"; +// Company +print ''."\n"; +// Type of event +print ''."\n"; +print ''; +// Label +print ''."\n"; +print ''."\n"; +// Note +print ''."\n"; +print ''."\n"; +// Start Date +print ''."\n"; +print ''."\n"; +// End Date +print ''."\n"; +print ''."\n"; +// Address +print ''."\n"; +// Zip / Town +print ''; +// Country +print ''; +// State +if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + print ''; +} + +print "
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; +print '
'.$langs->trans("EventType").'*'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).'
'.$langs->trans("Label").'*
'.$langs->trans("Note").'*
'.$langs->trans("DateStart").'
'.$langs->trans("DateEnd").'
'.$langs->trans("Address").''."\n"; +print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; +print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); +print ' / '; +print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); +print '
'.$langs->trans('Country').'*'; +$country_id = GETPOST('country_id'); +if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); +} +if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) { + $country_id = $new_country_id; + } + } +} +$country_code = getCountry($country_id, 2, $db, $langs); +print $form->select_country($country_id, 'country_id'); +print '
'.$langs->trans('State').''; + if ($country_code) { + print $formcompany->select_state(GETPOST("state_id"), $country_code); + } else { + print ''; + } + print '
\n"; + +print dol_get_fiche_end(); + + +// Show all action buttons +print '
'; +print '
'; +// Output introduction text +if ($project->accept_conference_suggestions) { + print ''; + print '

'; +} +print ''; +print '

'; +if ($project->accept_booth_suggestions) { + print ''; +} +print '
'; +print '

'; + + + +print "
\n"; +print "
"; +print '
'; + + +llxFooterVierge(); + +$db->close(); From 10c9e9b77c3017d618209de8bd4a8cd4ec8757ae Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 11:31:23 +0200 Subject: [PATCH 025/739] wip --- htdocs/public/project/index.php | 688 ++++++-------------------------- 1 file changed, 133 insertions(+), 555 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index fcbc786be4c..ce48db9e729 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -1,11 +1,10 @@ - * Copyright (C) 2001-2002 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2019 Frédéric France - * Copyright (C) 2018 Alexandre Spangaro +/* Copyright (C) 2001-2002 Rodolphe Quiedeville + * Copyright (C) 2006-2017 Laurent Destailleur + * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2021 Waël Almoman * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,22 +18,21 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * For Paypal test: https://developer.paypal.com/ + * For Paybox test: ??? + * For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing + * + * Variants: + * - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new PaymentIntent API + * - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API + * - If no option set, we use old APIS (charge) */ /** - * \file htdocs/public/members/new.php - * \ingroup member - * \brief Example of form to add a new member - * - * Note that you can add following constant to change behaviour of page - * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited - * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe - * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) - * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted - * MEMBER_NEWFORM_FORCETYPE Force type of member - * MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy) - * MEMBER_NEWFORM_FORCECOUNTRYCODE Force country + * \file htdocs/public/payment/newpayment.php + * \ingroup core + * \brief File to offer a way to make a payment for a particular Dolibarr object */ if (!defined('NOLOGIN')) { @@ -49,52 +47,38 @@ if (!defined('NOIPCHECK')) { if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); } -if (!defined('NOIPCHECK')) { - define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -} // For MultiCompany module. -// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php -// TODO This should be useless. Because entity must be retrieve from object ref and not from url. -$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +// Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)))); if (is_numeric($entity)) { define("DOLENTITY", $entity); } require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +// Hook to be used by external payment modules (ie Payzen, ...) +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('newpayment')); +// For encryption global $dolibarr_main_instance_unique_id; -global $dolibarr_main_url_root; -// Init vars -$errmsg = ''; -$num = 0; -$error = 0; -$backtopage = GETPOST('backtopage', 'alpha'); -$action = GETPOST('action', 'aZ09'); - -// Getting id from Post and decoding it -$encodedid = GETPOST('id'); -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); - -$project = new Project($db); -$resultproject = $project->fetch($id); -if ($resultproject < 0) { - $error++; - $errmsg .= $project->error; -} +// Load translation files +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data // Security check -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +// No check on module enabled. Done later according to $validpaymentmethod + +$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id'); $securekeyreceived = GETPOST("securekey"); $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); @@ -103,548 +87,142 @@ if ($securekeytocompare != $securekeyreceived) { exit; } -// Load translation files -$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); +// Define $urlwithroot +//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('publicnewmembercard', 'globalcard')); - -$extrafields = new ExtraFields($db); - -$user->loadDefaultValues(); - -$cactioncomm = new CActionComm($db); -$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); - -/** - * Show header for new member - * - * @param string $title Title - * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param array $arrayofjs Array of complementary js files - * @param array $arrayofcss Array of complementary css files - * @return void - */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') -{ - global $user, $conf, $langs, $mysoc; - - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - - print ''; - - // Define urllogo - $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; - - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } - - print '
'; - // Output html code for logo - if ($urllogo) { - print '
'; - print '
'; - print ''; - print '
'; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { - print ''; - } - print '
'; - } - print '
'; - - print '
'; +$project = new Project($db); +$resultproject = $project->fetch($id); +if ($resultproject < 0) { + $error++; + $errmsg .= $project->error; } -/** - * Show footer for new member - * - * @return void - */ -function llxFooterVierge() -{ - print '
'; - - printCommonFooter('public'); - - print "\n"; - print "\n"; -} - - - /* * Actions */ -global $mysoc; -$parameters = array(); -// Note that $action and $object may have been modified by some hooks -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} - -// Action called when page is submitted -if (empty($reshook) && $action == 'add') { - $error = 0; - - $urlback = ''; - - $db->begin(); - - if (!GETPOST("email")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; - } - if (!GETPOST("label")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."
\n"; - } - if (!GETPOST("note")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."
\n"; - } - if (!GETPOST("datestart")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))."
\n"; - } - if (!GETPOST("dateend")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))."
\n"; - } - if (!GETPOST("email")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."
\n"; - } - if (!GETPOST("lastname")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; - } - if (!GETPOST("societe")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."
\n"; - } - if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; - } - if (!GETPOST("country_id")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; - } - - if (!$error) { - // Getting the thirdparty or creating it - $thirdparty = new Societe($db); - $resultfetchthirdparty = $thirdparty->fetch('', $societe); - - if ($resultfetchthirdparty<=0) { - // Need to create a new one (not found or multiple with the same name) - $thirdparty->name = $societe; - $thirdparty->address = GETPOST("address"); - $thirdparty->zip = GETPOST("zipcode"); - $thirdparty->town = GETPOST("town"); - $thirdparty->client = 2; - $thirdparty->fournisseur = 0; - $thirdparty->country_id = GETPOST("country_id", 'int'); - $thirdparty->state_id = GETPOST("state_id", 'int'); - $thirdparty->email = $email; - - // Load object modCodeTiers - $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module) - 4); - } - $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) { - $res = dol_include_once($dirroot.$module.'.php'); - if ($res) { - break; - } - } - $modCodeClient = new $module($db); - - if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { - $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); - } - $thirdparty->code_client = $tmpcode; - $readythirdparty = $thirdparty->create($user); - if ($readythirdparty <0) { - $error++; - $errmsg .= $thirdparty->error; - } else { - $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); - $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); - } - } - // From there we have a thirdparty, now looking for the contact - if (!$error) { - $contact = new Contact($db); - $resultcontact = $contact->fetch('', '', '', $email); - if ($resultcontact<=0) { - // Need to create a contact - $contact->socid = $thirdparty->id; - $contact->lastname = (string) GETPOST("lastname", 'alpha'); - $contact->firstname = (string) GETPOST("firstname", 'alpha'); - $contact->address = (string) GETPOST("address", 'alpha'); - $contact->zip = (string) GETPOST("zipcode", 'alpha'); - $contact->town = (string) GETPOST("town", 'alpha'); - $contact->country_id = (int) GETPOST("country_id", 'int'); - $contact->state_id = (int) GETPOST("state_id", 'int'); - $contact->email = $email; - $contact->statut = 1; //Default status to Actif - - $resultcreatecontact = $contact->create($user); - if ($resultcreatecontact<0) { - $error++; - $errmsg .= $contact->error; - } - } - } - - if (!$error) { - // Adding supplier tag and tag from setup to thirdparty - $category = new Categorie($db); - if (GETPOST("suggestconference")) { - // Conference case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); - } else { - // Booth case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); - } - - if ($resultcategory<=0) { - $error++; - $errmsg .= $category->error; - } else { - $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false); - if ($resultsetcategory < 0) { - $error++; - $errmsg .= $thirdparty->error; - } else { - $thirdparty->fournisseur = 1; - - // Load object modCodeFournisseur - $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); - if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module) - 4); - } - $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); - foreach ($dirsociete as $dirroot) { - $res = dol_include_once($dirroot.$module.'.php'); - if ($res) { - break; - } - } - $modCodeFournisseur = new $module; - if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) { - $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1); - } - $thirdparty->code_fournisseur = $tmpcode; - - $res = $thirdparty->update(0, $user, 1, 1, 1); - - if ($res <= 0) { - $error++; - } - } - } - } - - if (!$error) { - // We have the contact and the thirdparty - $conforbooth = new ConferenceOrBooth($db); - $conforbooth->label = $label; - $conforbooth->fk_soc = $thirdparty->id; - $conforbooth->fk_project = $project->id; - $conforbooth->note = $note; - $conforbooth->fk_action = $eventtype; - $conforbooth->datep =$datestart; - $conforbooth->datep2 = $dateend; - $conforbooth->datec = dol_now(); - $conforbooth->tms = dol_now(); - $resultconforbooth = $conforbooth->create($user); - if ($resultconforbooth<=0) { - $error++; - $errmsg .= $conforbooth->error; - } else { - // If this is a paying booth, we have to redirect to payment page and create an invoice - if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { - $productforinvoicerow = new Product($db); - $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); - if ($resultprod < 0) { - $error++; - $errmsg .= $productforinvoicerow->error; - } else { - $facture = new Facture($db); - $facture->type = Facture::TYPE_STANDARD; - $facture->socid = $thirdparty->id; - $facture->paye = 0; - $facture->date = dol_now(); - $facture->cond_reglement_id = $contact->cond_reglement_id; - - if (empty($facture->cond_reglement_id)) { - $paymenttermstatic = new PaymentTerm($contact->db); - $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); - if (empty($facture->cond_reglement_id)) { - $error++; - $contact->error = 'ErrorNoPaymentTermRECEPFound'; - $contact->errors[] = $contact->error; - } - } - $resultfacture = $facture->create($user); - if ($resultfacture <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; - $error++; - } else { - $facture->add_object_linked($contact->element, $contact->id); - } - } - - if (!$error) { - // Add line to draft invoice - $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); - $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); - if ($result <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; - $error++; - } - if (!$error) { - $valid = true; - $sourcetouse = 'boothlocation'; - $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical - } else { - $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - } - } - Header("Location: ".$redirection); - exit; - } - } - } else { - // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; - $conforbooth->update($user); - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); - } - } - } - } - } - if (!$error) { - $db->commit(); - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); - $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; - Header("Location: ".$redirection); - exit; - } else { - $db->rollback(); - } -} /* * View */ -$form = new Form($db); -$formcompany = new FormCompany($db); +$head = ''; +if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { + $head = ''."\n"; +} -llxHeaderVierge($langs->trans("NewSuggestion")); +$conf->dol_hide_topmenu = 1; +$conf->dol_hide_leftmenu = 1; + +$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; +llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); -print load_fiche_titre($langs->trans("NewSuggestion"), '', '', 0, 0, 'center'); +// Show sandbox warning +if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'int'))) { // We can force sand box with param 'forcesandbox' + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), '', 'warning'); +} +if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'int'))) { + dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); +} -print '
'; -print '
'; -print '
'; +print ''."\n"; +print '
'."\n"; +print '
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''; +print ''; +print "\n"; -// Welcome message -$text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; + +// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logosmall = $mysoc->logo_small; +$logo = $mysoc->logo; +$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; +if (!empty($conf->global->$paramlogo)) { + $logosmall = $conf->global->$paramlogo; +} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) { + $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); +} + +// Output html code for logo +if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; +} + +print ''."\n"; + +$text = ''."\n"; $text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n";; + print $text; -print ''; -dol_htmloutput_errors($errmsg); +// Output payment summary form +print ''."\n"; + +print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'.$project->note_public.'
'.$project->note_public.'

'; -// Print form -print ''."\n"; -print ''; -print ''; -print ''; -print ''; -print ''; +$found = false; +$error = 0; +$var = false; -print '
'; +$object = null; -print '
'.$langs->trans("FieldsWithAreMandatory", '*').'
'; -//print $langs->trans("FieldsWithIsForPublic",'**').'
'; - -print dol_get_fiche_head(''); - -print ''; - -print ''."\n"; - -// Name -print ''; -print ''; -print ''; -// Email -print ''."\n"; -// Company -print ''."\n"; -// Type of event -print ''."\n"; -print ''; -// Label -print ''."\n"; -print ''."\n"; -// Note -print ''."\n"; -print ''."\n"; -// Start Date -print ''."\n"; -print ''."\n"; -// End Date -print ''."\n"; -print ''."\n"; -// Address -print ''."\n"; -// Zip / Town -print ''; -// Country -print ''; -// State -if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; -} - -print "
lastname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'.$langs->trans("Company").'*'; -print '
'.$langs->trans("EventType").'*'.FORM::selectarray('eventtype', $arrayofeventtype, $eventtype).'
'.$langs->trans("Label").'*
'.$langs->trans("Note").'*
'.$langs->trans("DateStart").'
'.$langs->trans("DateEnd").'
'.$langs->trans("Address").''."\n"; -print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; -print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); -print ' / '; -print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); -print '
'.$langs->trans('Country').'*'; -$country_id = GETPOST('country_id'); -if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { - $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); -} -if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { - $country_code = dol_user_country(); - //print $country_code; - if ($country_code) { - $new_country_id = getCountry($country_code, 3, $db, $langs); - //print 'xxx'.$country_code.' - '.$new_country_id; - if ($new_country_id) { - $country_id = $new_country_id; - } - } -} -$country_code = getCountry($country_id, 2, $db, $langs); -print $form->select_country($country_id, 'country_id'); -print '
'.$langs->trans('State').''; - if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); - } else { - print ''; - } - print '
\n"; - -print dol_get_fiche_end(); +print "\n"; // Show all action buttons -print '
'; print '
'; // Output introduction text if ($project->accept_conference_suggestions) { - print ''; + print ''; print '

'; } -print ''; +print ''; print '

'; if ($project->accept_booth_suggestions) { - print ''; + print ''; } -print '
'; -print '

'; -print "\n"; -print "
"; -print ''; +print '
'."\n"; + +print ''."\n"; +print '
'."\n"; +print '
'; -llxFooterVierge(); +htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); + +llxFooter('', 'public'); $db->close(); From 099ad77d44b282417187c3003479c4bc60c457a4 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 11:32:07 +0200 Subject: [PATCH 026/739] encryption change for url --- htdocs/eventorganization/conferenceorbooth_list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index e3ba815121c..be8770b6390 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -364,8 +364,7 @@ if ($projectid > 0) { // Link to the vote/register page print ''.$langs->trans("RegisterPage").''; - $encodedid = dol_encode($project->id, $dolibarr_main_instance_unique_id); - $linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$encodedid; + $linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id; $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2); $linkregister .= '&securekey='.urlencode($encodedsecurekey); print ''.$linkregister.''; From df78aaff889bfab4b3803e07b8d4267ce47ea895 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 11:49:00 +0200 Subject: [PATCH 027/739] now 2 distinct pages to suggest a conf or a booth --- htdocs/public/project/index.php | 45 ++++++++++++--------- htdocs/public/project/suggestbooth.php | 16 ++------ htdocs/public/project/suggestconference.php | 16 ++------ 3 files changed, 35 insertions(+), 42 deletions(-) diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index ce48db9e729..9ddfc8ce759 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -103,6 +103,23 @@ if ($resultproject < 0) { * Actions */ +if (GETPOST('suggestbooth')) { + header("Location: ".dol_buildpath('/public/project/suggestbooth.php', 1).'?id='.$id."&securekey=".$securekeyreceived); + exit; +} + +if (GETPOST('suggestconference')) { + header("Location: ".dol_buildpath('/public/project/suggestconference.php', 1).'?id='.$id."&securekey=".$securekeyreceived); + exit; +} + +if (GETPOST('viewandvote')) { + header("Location: ".dol_buildpath('/public/project/viewandvote.php', 1).'?id='.$id."&securekey=".$securekeyreceived); + exit; +} + + + /* * View @@ -119,24 +136,15 @@ $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); - -// Show sandbox warning -if ((empty($paymentmethod) || $paymentmethod == 'paypal') && !empty($conf->paypal->enabled) && (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'int'))) { // We can force sand box with param 'forcesandbox' - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Paypal'), '', 'warning'); -} -if ((empty($paymentmethod) || $paymentmethod == 'stripe') && !empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'int'))) { - dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} - - print ''."\n"; print '
'."\n"; print '
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; -print ''."\n"; +//print ''."\n"; +print ''."\n"; +print ''."\n"; print ''; print ''; print "\n"; @@ -200,15 +208,16 @@ print "\n"; // Show all action buttons print '
'; // Output introduction text -if ($project->accept_conference_suggestions) { - print ''; +if ($project->accept_booth_suggestions) { + print ''; print '

'; } -print ''; -print '

'; -if ($project->accept_booth_suggestions) { - print ''; +if ($project->accept_conference_suggestions) { + print ''; + print '

'; } +print ''; + diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index e4c030c9718..119741f6233 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -90,9 +90,7 @@ $note = GETPOST("note"); $datestart = GETPOST("datestart"); $dateend = GETPOST("dateend"); -// Getting id from Post and decoding it -$encodedid = GETPOST('id'); -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$id = GETPOST('id'); $project = new Project($db); $resultproject = $project->fetch($id); @@ -102,7 +100,6 @@ if ($resultproject < 0) { } // Security check -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); $securekeyreceived = GETPOST("securekey"); $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); @@ -122,7 +119,7 @@ $extrafields = new ExtraFields($db); $user->loadDefaultValues(); $cactioncomm = new CActionComm($db); -$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); +$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'booth@eventorganization\''); /** * Show header for new member @@ -322,13 +319,8 @@ if (empty($reshook) && $action == 'add') { if (!$error) { // Adding supplier tag and tag from setup to thirdparty $category = new Categorie($db); - if (GETPOST("suggestconference")) { - // Conference case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); - } else { - // Booth case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); - } + + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); if ($resultcategory<=0) { $error++; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index e4c030c9718..68ed90fc260 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -90,9 +90,7 @@ $note = GETPOST("note"); $datestart = GETPOST("datestart"); $dateend = GETPOST("dateend"); -// Getting id from Post and decoding it -$encodedid = GETPOST('id'); -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); +$id = GETPOST('id'); $project = new Project($db); $resultproject = $project->fetch($id); @@ -102,7 +100,6 @@ if ($resultproject < 0) { } // Security check -$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id); $securekeyreceived = GETPOST("securekey"); $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); @@ -122,7 +119,7 @@ $extrafields = new ExtraFields($db); $user->loadDefaultValues(); $cactioncomm = new CActionComm($db); -$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\' OR module=\'booth@eventorganization\''); +$arrayofeventtype = $cactioncomm->liste_array('', 'id', '', 0, 'module=\'conference@eventorganization\''); /** * Show header for new member @@ -322,13 +319,8 @@ if (empty($reshook) && $action == 'add') { if (!$error) { // Adding supplier tag and tag from setup to thirdparty $category = new Categorie($db); - if (GETPOST("suggestconference")) { - // Conference case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); - } else { - // Booth case - $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH); - } + + $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF); if ($resultcategory<=0) { $error++; From c56c7afa89f79761b18392649603ce79d343c5de Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 11:59:24 +0200 Subject: [PATCH 028/739] update on specifications on suggesting a booth/conf since its now two separated pages --- htdocs/public/project/suggestbooth.php | 4 +- htdocs/public/project/suggestconference.php | 141 ++++++-------------- 2 files changed, 42 insertions(+), 103 deletions(-) diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 119741f6233..bec7c1c55a1 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -378,7 +378,7 @@ if (empty($reshook) && $action == 'add') { $errmsg .= $conforbooth->error; } else { // If this is a paying booth, we have to redirect to payment page and create an invoice - if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { + if (!empty(floatval($project->price_booth))) { $productforinvoicerow = new Product($db); $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); if ($resultprod < 0) { @@ -437,7 +437,7 @@ if (empty($reshook) && $action == 'add') { } } } else { - // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update + // If no price has been set for the booth, we confirm it as suggested and we update $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; $conforbooth->update($user); // Sending mail diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 68ed90fc260..fc452c740bb 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -378,110 +378,49 @@ if (empty($reshook) && $action == 'add') { $errmsg .= $conforbooth->error; } else { // If this is a paying booth, we have to redirect to payment page and create an invoice - if (GETPOST("suggestbooth") && !empty(floatval($project->price_booth))) { - $productforinvoicerow = new Product($db); - $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); - if ($resultprod < 0) { - $error++; - $errmsg .= $productforinvoicerow->error; - } else { - $facture = new Facture($db); - $facture->type = Facture::TYPE_STANDARD; - $facture->socid = $thirdparty->id; - $facture->paye = 0; - $facture->date = dol_now(); - $facture->cond_reglement_id = $contact->cond_reglement_id; + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->update($user); + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; - if (empty($facture->cond_reglement_id)) { - $paymenttermstatic = new PaymentTerm($contact->db); - $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); - if (empty($facture->cond_reglement_id)) { - $error++; - $contact->error = 'ErrorNoPaymentTermRECEPFound'; - $contact->errors[] = $contact->error; - } - } - $resultfacture = $facture->create($user); - if ($resultfacture <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; - $error++; - } else { - $facture->add_object_linked($contact->element, $contact->id); - } - } + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } - if (!$error) { - // Add line to draft invoice - $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); - $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); - if ($result <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; - $error++; - } - if (!$error) { - $valid = true; - $sourcetouse = 'boothlocation'; - $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical - } else { - $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - } - } - Header("Location: ".$redirection); - exit; - } - } + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); } else { - // If no price has been set for the booth or this is a conference, we confirm it as suggested and we update - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; - $conforbooth->update($user); - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); - } + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } } From 4d8d94bfbf254aee0af122821d8f04c42c0a0560 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 12:13:49 +0200 Subject: [PATCH 029/739] fixes: show only correspond button on specific page, id no longer encoded in hidden parameter --- htdocs/public/project/suggestbooth.php | 13 ++----------- htdocs/public/project/suggestconference.php | 15 +++------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index bec7c1c55a1..96a00434374 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -530,7 +530,7 @@ print ''. print ''; print ''; print ''; -print ''; +print ''; print ''; print '
'; @@ -625,16 +625,7 @@ print dol_get_fiche_end(); // Show all action buttons print '
'; print '
'; -// Output introduction text -if ($project->accept_conference_suggestions) { - print ''; - print '

'; -} -print ''; -print '

'; -if ($project->accept_booth_suggestions) { - print ''; -} +print ''; print '
'; print '

'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index fc452c740bb..1350716072b 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -469,7 +469,7 @@ print ''. print ''; print ''; print ''; -print ''; +print ''; print ''; print '
'; @@ -564,21 +564,12 @@ print dol_get_fiche_end(); // Show all action buttons print '
'; print '
'; -// Output introduction text -if ($project->accept_conference_suggestions) { - print ''; - print '

'; -} -print ''; -print '

'; -if ($project->accept_booth_suggestions) { - print ''; -} -print '
'; +print ''; print '

'; + print "\n"; print "
"; print '
'; From abeb1c644c7721bc931eaf97611d0ac6b09489da Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 13:50:13 +0200 Subject: [PATCH 030/739] country now only required when paying a booth, dates of start and end required --- htdocs/public/project/suggestbooth.php | 13 +++++++++---- htdocs/public/project/suggestconference.php | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 96a00434374..e8b7ad44874 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -242,7 +242,7 @@ if (empty($reshook) && $action == 'add') { $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; } - if (!GETPOST("country_id")) { + if (!GETPOST("country_id") && !empty(floatval($project->price_booth))) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; } @@ -407,6 +407,7 @@ if (empty($reshook) && $action == 'add') { $contact->errors = $facture->errors; $error++; } else { + $db->commit(); $facture->add_object_linked($contact->element, $contact->id); } } @@ -572,10 +573,10 @@ print '*'."\n"; print ''."\n"; // Start Date -print ''.$langs->trans("DateStart").''."\n"; +print ''.$langs->trans("DateStart").'*'."\n"; print ''."\n"; // End Date -print ''.$langs->trans("DateEnd").''."\n"; +print ''.$langs->trans("DateEnd").'*'."\n"; print ''."\n"; // Address print ''.$langs->trans("Address").''."\n"; @@ -587,7 +588,11 @@ print ' / '; print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); print ''; // Country -print ''.$langs->trans('Country').'*'; +print ''.$langs->trans('Country'); +if (!empty(floatval($project->price_booth))) { + print '*'; +} +print ''; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 1350716072b..0483312e519 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -526,7 +526,7 @@ print ' / '; print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); print ''; // Country -print ''.$langs->trans('Country').'*'; +print ''.$langs->trans('Country').''; $country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); From 9c20e92e179eb86ac4f49b9321e221edcc9be662 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 14:06:53 +0200 Subject: [PATCH 031/739] country no longer required for conf, preparation of add_contact to conforbooth (not done, commented) and page name change --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/project/index.php | 2 +- htdocs/public/project/suggestbooth.php | 10 +++- htdocs/public/project/suggestconference.php | 61 +++++++++++---------- 4 files changed, 43 insertions(+), 31 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 7b5ddd8160c..1d7b16c17f6 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -96,6 +96,7 @@ EvntOrgCancelled = Cancelled # # Public page # +SuggestForm = Suggestion page RegisterPage = Page for conferences or booth EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestion page. EvntOrgRegistrationHelpMessage = Here, you can suggest a new conference or a new booth for the project diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 9ddfc8ce759..b05f2b1fc6f 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -134,7 +134,7 @@ $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); +llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); print ''."\n"; print '
'."\n"; diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index e8b7ad44874..3db61f67129 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -377,7 +377,14 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $conforbooth->error; } else { - // If this is a paying booth, we have to redirect to payment page and create an invoice + // Adding the contact to the project + /*$resultaddcontact = $conforbooth->add_contact($contact); + if ($resultaddcontact<0) { + $error++; + $errmsg .= $conforbooth->error; + } else {*/ + + // If this is a paying booth, we have to redirect to payment page and create an invoice if (!empty(floatval($project->price_booth))) { $productforinvoicerow = new Product($db); $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); @@ -484,6 +491,7 @@ if (empty($reshook) && $action == 'add') { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } + //} } } } diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 0483312e519..21cbe7d77bd 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -242,10 +242,6 @@ if (empty($reshook) && $action == 'add') { $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; } - if (!GETPOST("country_id")) { - $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; - } if (!$error) { // Getting the thirdparty or creating it @@ -377,22 +373,28 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $conforbooth->error; } else { - // If this is a paying booth, we have to redirect to payment page and create an invoice - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; - $conforbooth->update($user); - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; + // Adding the contact to the project + /*$resultaddcontact = $conforbooth->add_contact($contact); + if ($resultaddcontact<0) { + $error++; + $errmsg .= $conforbooth->error; + } else {*/ + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->update($user); - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); } @@ -402,26 +404,27 @@ if (empty($reshook) && $action == 'add') { $msg = $arraydefaultmessage->content; } - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; - $ishtml = dol_textishtml($texttosend); // May contain urls + $ishtml = dol_textishtml($texttosend); // May contain urls - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - $result = $mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } + //} } } } From a00c9c44c35f3e98542de2b50b804638210f496f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 14:26:41 +0200 Subject: [PATCH 032/739] now adding contact to conforbooth, not only to thirdparty --- htdocs/public/project/suggestbooth.php | 203 ++++++++++---------- htdocs/public/project/suggestconference.php | 28 +-- 2 files changed, 115 insertions(+), 116 deletions(-) diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 3db61f67129..bb03c0d3782 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -378,120 +378,119 @@ if (empty($reshook) && $action == 'add') { $errmsg .= $conforbooth->error; } else { // Adding the contact to the project - /*$resultaddcontact = $conforbooth->add_contact($contact); + $resultaddcontact = $conforbooth->add_contact($contact->id, 'RESPONSIBLE'); if ($resultaddcontact<0) { $error++; $errmsg .= $conforbooth->error; - } else {*/ - + } else { // If this is a paying booth, we have to redirect to payment page and create an invoice - if (!empty(floatval($project->price_booth))) { - $productforinvoicerow = new Product($db); - $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); - if ($resultprod < 0) { - $error++; - $errmsg .= $productforinvoicerow->error; - } else { - $facture = new Facture($db); - $facture->type = Facture::TYPE_STANDARD; - $facture->socid = $thirdparty->id; - $facture->paye = 0; - $facture->date = dol_now(); - $facture->cond_reglement_id = $contact->cond_reglement_id; - - if (empty($facture->cond_reglement_id)) { - $paymenttermstatic = new PaymentTerm($contact->db); - $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); - if (empty($facture->cond_reglement_id)) { - $error++; - $contact->error = 'ErrorNoPaymentTermRECEPFound'; - $contact->errors[] = $contact->error; - } - } - $resultfacture = $facture->create($user); - if ($resultfacture <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; + if (!empty(floatval($project->price_booth))) { + $productforinvoicerow = new Product($db); + $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION); + if ($resultprod < 0) { $error++; + $errmsg .= $productforinvoicerow->error; } else { - $db->commit(); - $facture->add_object_linked($contact->element, $contact->id); - } - } + $facture = new Facture($db); + $facture->type = Facture::TYPE_STANDARD; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + $facture->date = dol_now(); + $facture->cond_reglement_id = $contact->cond_reglement_id; - if (!$error) { - // Add line to draft invoice - $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); - $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); - if ($result <= 0) { - $contact->error = $facture->error; - $contact->errors = $facture->errors; - $error++; - } - if (!$error) { - $valid = true; - $sourcetouse = 'boothlocation'; - $reftouse = $facture->id; - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical - } else { - $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + if (empty($facture->cond_reglement_id)) { + $paymenttermstatic = new PaymentTerm($contact->db); + $facture->cond_reglement_id = $paymenttermstatic->getDefaultId(); + if (empty($facture->cond_reglement_id)) { + $error++; + $contact->error = 'ErrorNoPaymentTermRECEPFound'; + $contact->errors[] = $contact->error; } } - Header("Location: ".$redirection); - exit; + $resultfacture = $facture->create($user); + if ($resultfacture <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } else { + $db->commit(); + $facture->add_object_linked($contact->element, $contact->id); + } + } + + if (!$error) { + // Add line to draft invoice + $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id); + $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), floatval($project->price_booth), 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, '', 'HT', 0, 1); + if ($result <= 0) { + $contact->error = $facture->error; + $contact->errors = $facture->errors; + $error++; + } + if (!$error) { + $valid = true; + $sourcetouse = 'boothlocation'; + $reftouse = $facture->id; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id; + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical + } else { + $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; + } + } + Header("Location: ".$redirection); + exit; + } + } + } else { + // If no price has been set for the booth, we confirm it as suggested and we update + $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->update($user); + // Sending mail + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + $formmail = new FormMail($db); + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); + // Load traductions files required by page + $outputlangs->loadLangs(array("main", "members")); + // Get email content from template + $arraydefaultmessage = null; + + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + $sendto = $thirdparty->email; + $from = $conf->global->MAILING_EMAIL_FROM; + $urlback = $_SERVER["REQUEST_URI"]; + + $ishtml = dol_textishtml($texttosend); // May contain urls + + $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); + + $result = $mailfile->sendfile(); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } - } else { - // If no price has been set for the booth, we confirm it as suggested and we update - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; - $conforbooth->update($user); - // Sending mail - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - // Set output language - $outputlangs = new Translate('', $conf); - $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); - // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); - // Get email content from template - $arraydefaultmessage = null; - - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } - - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } - - $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); - complete_substitutions_array($substitutionarray, $outputlangs, $object); - - $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); - $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); - - $sendto = $thirdparty->email; - $from = $conf->global->MAILING_EMAIL_FROM; - $urlback = $_SERVER["REQUEST_URI"]; - - $ishtml = dol_textishtml($texttosend); // May contain urls - - $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); - - $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); - } } - //} } } } diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 21cbe7d77bd..92c53795004 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -374,11 +374,11 @@ if (empty($reshook) && $action == 'add') { $errmsg .= $conforbooth->error; } else { // Adding the contact to the project - /*$resultaddcontact = $conforbooth->add_contact($contact); + $resultaddcontact = $conforbooth->add_contact($contact->id, 'SPEAKER'); if ($resultaddcontact<0) { $error++; $errmsg .= $conforbooth->error; - } else {*/ + } else { $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; $conforbooth->update($user); @@ -395,14 +395,14 @@ if (empty($reshook) && $action == 'add') { $arraydefaultmessage = null; $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; - if (!empty($labeltouse)) { - $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); - } + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); + } - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { - $subject = $arraydefaultmessage->topic; - $msg = $arraydefaultmessage->content; - } + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); complete_substitutions_array($substitutionarray, $outputlangs, $object); @@ -419,12 +419,12 @@ if (empty($reshook) && $action == 'add') { $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml); $result = $mailfile->sendfile(); - if ($result) { - dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } else { - dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + if ($result) { + dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); + } else { + dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); + } } - //} } } } From 2f7dd4e8070bbc3cb877c0559cba3875cd747659 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 14:53:23 +0200 Subject: [PATCH 033/739] wip vote page --- htdocs/langs/en_US/eventorganization.lang | 4 +- htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- htdocs/public/project/viewandvote.php | 216 ++++++++++++++++++++ 4 files changed, 221 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 1d7b16c17f6..1940c9674c1 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -99,7 +99,9 @@ EvntOrgCancelled = Cancelled SuggestForm = Suggestion page RegisterPage = Page for conferences or booth EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestion page. -EvntOrgRegistrationHelpMessage = Here, you can suggest a new conference or a new booth for the project +EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project +EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project +EvntOrgVoteHelpMessage = Here, you can view and vote for the suggested events for the project SuggestConference = Suggest a new conference SuggestBooth = Suggest a booth ViewAndVote = View and vote for suggested events diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index bb03c0d3782..ecaf524c034 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -526,7 +526,7 @@ print '
'; // Welcome message $text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; -$text .= ''.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'."\n"; +$text .= ''.$langs->trans("EvntOrgRegistrationBoothHelpMessage").' '.$id.'.

'."\n"; $text .= ''.$project->note_public.''."\n";; print $text; print '
'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 92c53795004..53dc9581d9a 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -460,7 +460,7 @@ print '
'; // Welcome message $text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; -$text .= ''.$langs->trans("EvntOrgRegistrationHelpMessage").' '.$id.'.

'."\n"; +$text .= ''.$langs->trans("EvntOrgRegistrationConfHelpMessage").' '.$id.'.

'."\n"; $text .= ''.$project->note_public.''."\n";; print $text; print '
'; diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index b3d9bbc7f37..fe7d4d2ed59 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -1 +1,217 @@ + * Copyright (C) 2006-2017 Laurent Destailleur + * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2021 Waël Almoman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * For Paypal test: https://developer.paypal.com/ + * For Paybox test: ??? + * For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing + * + * Variants: + * - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new PaymentIntent API + * - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API + * - If no option set, we use old APIS (charge) + */ + +/** + * \file htdocs/public/payment/newpayment.php + * \ingroup core + * \brief File to offer a way to make a payment for a particular Dolibarr object + */ + +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} + +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and get of entity must be done before including main.inc.php +$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)))); +if (is_numeric($entity)) { + define("DOLENTITY", $entity); +} + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +// Hook to be used by external payment modules (ie Payzen, ...) +include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +$hookmanager = new HookManager($db); +$hookmanager->initHooks(array('newpayment')); + +// For encryption +global $dolibarr_main_instance_unique_id; + +// Load translation files +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data + +// Security check +// No check on module enabled. Done later according to $validpaymentmethod + +$action = GETPOST('action', 'aZ09'); +$id = GETPOST('id'); +$securekeyreceived = GETPOST("securekey"); +$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); + +if ($securekeytocompare != $securekeyreceived) { + print $langs->trans('MissingOrBadSecureKey'); + exit; +} + +// Define $urlwithroot +//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); +//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost. + +$project = new Project($db); +$resultproject = $project->fetch($id); +if ($resultproject < 0) { + $error++; + $errmsg .= $project->error; +} + +/* + * Actions + */ + +$listOfEvents = 'oui'; + + + +/* + * View + */ + +$head = ''; +if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { + $head = ''."\n"; +} + +$conf->dol_hide_topmenu = 1; +$conf->dol_hide_leftmenu = 1; + +$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; +llxHeader($head, $langs->trans("SuggestForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); + +print ''."\n"; +print '
'."\n"; +print '
'."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +//print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''; +print ''; +print "\n"; + + +// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logosmall = $mysoc->logo_small; +$logo = $mysoc->logo; +$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; +if (!empty($conf->global->$paramlogo)) { + $logosmall = $conf->global->$paramlogo; +} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) { + $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); +} + +// Output html code for logo +if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; +} + +print ''."\n"; + +$text = ''."\n"; +$text .= ''."\n"; +$text .= ''."\n";; + +print $text; + +print $listOfEvents; + +// Output payment summary form +print ''."\n"; + +print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgVoteHelpMessage").' '.$id.'.

'.$project->note_public.'

'; + +$found = false; +$error = 0; +$var = false; + +$object = null; + +print "\n"; + + +// Show all action buttons +print '
'; + +print ''; + + + + +print '
'."\n"; + +print '
'."\n"; +print '
'."\n"; +print '
'; + + +htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); + +llxFooter('', 'public'); + +$db->close(); From 295c63468b7ac1a22dac7db7dac89f4222a49b92 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 16:32:39 +0200 Subject: [PATCH 034/739] wip vote page --- htdocs/langs/en_US/eventorganization.lang | 2 + htdocs/public/project/viewandvote.php | 79 ++++++++++++++++++++--- 2 files changed, 73 insertions(+), 8 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 1940c9674c1..8f36876fddc 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -102,6 +102,8 @@ EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestio EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project EvntOrgVoteHelpMessage = Here, you can view and vote for the suggested events for the project +ListOfSuggestedConferences = List of suggested conferences +ListOfSuggestedBooths = List of suggested booths SuggestConference = Suggest a new conference SuggestBooth = Suggest a booth ViewAndVote = View and vote for suggested events diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index fe7d4d2ed59..89cdca7591b 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -63,6 +63,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; // Hook to be used by external payment modules (ie Payzen, ...) include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); @@ -102,10 +103,62 @@ if ($resultproject < 0) { /* * Actions */ +$tmpthirdparty = new Societe($db); -$listOfEvents = 'oui'; +$listOfConferences = $listOfBooths = ''.$langs->trans('Label').' + '.$langs->trans('Type').' + '.$langs->trans('DateStart').' + '.$langs->trans('DateEnd').' + '.$langs->trans('Thirdparty').' + '.$langs->trans('Note').''; +// For conferences +$sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle + FROM ".MAIN_DB_PREFIX."actioncomm as a + INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) + WHERE ca.module='conference@eventorganization' + AND a.status<2"; +$result = $db->query($sql); + +$i = 0; +while ($i < $db->num_rows($result)) { + $obj = $db->fetch_object($result); + + $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); + if ($resultthirdparty) { + $thirdpartyname = $tmpthirdparty->name; + } else { + $thirdpartyname = ''; + } + + $listOfConferences .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; + $listOfConferences .= ''; + $i++; +} + +// For booths +$sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle + FROM ".MAIN_DB_PREFIX."actioncomm as a + INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) + WHERE ca.module='booth@eventorganization' + AND a.status<2"; +$result = $db->query($sql); +$i = 0; +while ($i < $db->num_rows($result)) { + $obj = $db->fetch_object($result); + + $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); + if ($resultthirdparty) { + $thirdpartyname = $tmpthirdparty->name; + } else { + $thirdpartyname = ''; + } + + $listOfBooths .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; + $listOfBooths .= ''; + $i++; +} /* * View @@ -170,16 +223,26 @@ if ($urllogo) { } print '
'; } - -print ''."\n"; - +print '
'."\n"; $text = ''."\n"; -$text .= ''."\n"; +$text .= ''."\n"; $text .= ''."\n";; - print $text; +print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgVoteHelpMessage").' '.$id.'.

'.$langs->trans("EvntOrgVoteHelpMessage").' : "'.$project->title.'".

'.$project->note_public.'

'."\n"; -print $listOfEvents; +print dol_get_fiche_head(''); + +print ''."\n"; +print ''; +print $listOfConferences.'
'; +print '
'.$langs->trans("ListOfSuggestedConferences").'
'."\n"; + + +print ''."\n"; +print ''; +print $listOfBooths.'
'; +print '
'.$langs->trans("ListOfSuggestedBooths").'
'."\n"; +print dol_get_fiche_end(); // Output payment summary form print ''; @@ -196,7 +259,7 @@ print "\n"; // Show all action buttons print '
'; -print ''; +//print ''; From 166e15633b2d6e5ac6a0b8f2521bfedd01d6c12c Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 6 May 2021 17:30:11 +0200 Subject: [PATCH 035/739] factorisation --- htdocs/public/project/viewandvote.php | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 89cdca7591b..7b6f8776d3a 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -110,51 +110,44 @@ $listOfConferences = $listOfBooths = ''.$langs->trans('Label').' '.$langs->trans('DateStart').' '.$langs->trans('DateEnd').' '.$langs->trans('Thirdparty').' - '.$langs->trans('Note').''; + '.$langs->trans('Note').''; - -// For conferences $sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle FROM ".MAIN_DB_PREFIX."actioncomm as a INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) - WHERE ca.module='conference@eventorganization' - AND a.status<2"; -$result = $db->query($sql); + WHERE a.status<2"; +$sqlforconf = $sql." AND ca.module='conference@eventorganization'"; +$sqlforbooth = $sql." AND ca.module='booth@eventorganization'"; + + +// For conferences +$result = $db->query($sqlforconf); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); - $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if ($resultthirdparty) { $thirdpartyname = $tmpthirdparty->name; } else { $thirdpartyname = ''; } - $listOfConferences .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; $listOfConferences .= ''; $i++; } // For booths -$sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, ca.libelle - FROM ".MAIN_DB_PREFIX."actioncomm as a - INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as ca ON (a.fk_action=ca.id) - WHERE ca.module='booth@eventorganization' - AND a.status<2"; -$result = $db->query($sql); +$result = $db->query($sqlforbooth); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); - $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if ($resultthirdparty) { $thirdpartyname = $tmpthirdparty->name; } else { $thirdpartyname = ''; } - $listOfBooths .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; $listOfBooths .= ''; $i++; From 27cffbddf368ec8c47c0133dfdf5560cdccc8d19 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 12:21:15 +0200 Subject: [PATCH 036/739] vote page ok --- htdocs/langs/en_US/eventorganization.lang | 12 ++++- htdocs/public/payment/paymentok.php | 1 - htdocs/public/project/viewandvote.php | 61 +++++++++++++++++++++-- 3 files changed, 67 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 8f36876fddc..97293f3cbb0 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -98,10 +98,8 @@ EvntOrgCancelled = Cancelled # SuggestForm = Suggestion page RegisterPage = Page for conferences or booth -EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestion page. EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project -EvntOrgVoteHelpMessage = Here, you can view and vote for the suggested events for the project ListOfSuggestedConferences = List of suggested conferences ListOfSuggestedBooths = List of suggested booths SuggestConference = Suggest a new conference @@ -114,6 +112,16 @@ EvntOrgDuration = This conference starts on %s and ends on %s. ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s. BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s EventType = Event type + +# +# Vote page +# +EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestion page. +EvntOrgVoteHelpMessage = Here, you can view and vote for the suggested events for the project +VoteOk = Your vote has been accepted. +AlreadyVoted = You have already voted for this event. +VoteError = An error has occurred during the vote, please try again. + # # SubscriptionOk page # diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index bf140bdd600..5cbd3da966b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1068,7 +1068,6 @@ if ($ispaymentok) { $ispostactionok = -1; } } elseif (array_key_exists('BOO', $tmptag) && $tmptag['BOO'] > 0) { - // @todo BOOTH CASE (to copy and adapt from above) // Record payment include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 7b6f8776d3a..355156d73cb 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -70,7 +70,7 @@ $hookmanager = new HookManager($db); $hookmanager->initHooks(array('newpayment')); // For encryption -global $dolibarr_main_instance_unique_id; +global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; // Load translation files $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data @@ -88,6 +88,14 @@ if ($securekeytocompare != $securekeyreceived) { exit; } +if (GETPOST("votestatus")=="ok") { + setEventMessage($langs->trans("VoteOk"), 'mesgs'); +} else if (GETPOST("votestatus")=="ko") { + setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); +} else if (GETPOST("votestatus")=="err") { + setEventMessage($langs->trans("VoteError"), 'warnings'); +} + // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); //$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file @@ -120,7 +128,6 @@ $sql = "SELECT a.id, a.fk_action, a.datep, a.datep2, a.label, a.fk_soc, a.note, $sqlforconf = $sql." AND ca.module='conference@eventorganization'"; $sqlforbooth = $sql." AND ca.module='booth@eventorganization'"; - // For conferences $result = $db->query($sqlforconf); $i = 0; @@ -133,7 +140,7 @@ while ($i < $db->num_rows($result)) { $thirdpartyname = ''; } $listOfConferences .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; - $listOfConferences .= ''; + $listOfConferences .= ''; $i++; } @@ -149,10 +156,56 @@ while ($i < $db->num_rows($result)) { $thirdpartyname = ''; } $listOfBooths .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; - $listOfBooths .= ''; + $listOfBooths .= ''; $i++; } +// Get vote result +$idvote = GETPOST("vote"); +$hashedvote = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'vote'.$idvote); + +if (strlen($idvote)) { + if ($_COOKIE['VOTE_SUGGESTED_EVENTS_'.$hashedvote]==1) { + // Has already voted + $votestatus = 'ko'; + } else { + // Has not already voted + $conforbooth = new ActionComm($db); + $resultconforbooth = $conforbooth->fetch($idvote); + if ($resultconforbooth<=0) { + $error++; + $errmsg .= $conforbooth->error; + } else { + // Cookie expiration date : start of event, or 30 days if not specified + $startdate = $conforbooth->datep; + if (strlen($startdate)) { + $timeleftbeforestartofevent = $startdate; + } else { + // Cookie duration by default + $timeleftbeforestartofevent = time()+86400*30; + } + + // Process to vote + $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 1, 0); + if ($res) { + $conforbooth->num_vote++; + $resupdate = $conforbooth->update($user); + if ($resupdate) { + $votestatus = 'ok'; + } else { + //Error during update + $votestatus = 'err'; + $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 0, 0); + } + } else { + $votestatus = 'err'; + } + } + } + header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?votestatus='.$votestatus.'&id='.$id.'&securekey=', 1).$securekeyreceived); +} + + /* * View */ From 5bb100de29cb305728f057584c33587527b75774 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 13:02:34 +0200 Subject: [PATCH 037/739] conforbooth class required in paymentok to confirm the booth --- htdocs/public/payment/paymentok.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 5cbd3da966b..09ffc2318b0 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -52,6 +52,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; if (!empty($conf->paypal->enabled)) { require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; From 2169a106fa040afec242b1786999b6c012c8c642 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 14:34:29 +0200 Subject: [PATCH 038/739] note is now saved in database --- htdocs/eventorganization/class/conferenceorbooth.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 0df30ac61db..6227fb668ec 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -212,6 +212,7 @@ class ConferenceOrBooth extends ActionComm $this->type_id=$this->fk_action; $this->socid=$this->fk_soc; $this->datef=$this->datep2; + $this->note_private=$this->note; } /** From 6111f4394660511ec3c554e110f00b271046a2f0 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 14:49:00 +0200 Subject: [PATCH 039/739] security fix, id was encoded where it should not be encoded --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/project/suggestbooth.php | 3 +-- htdocs/public/project/suggestconference.php | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 97293f3cbb0..97090c343cf 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -98,6 +98,7 @@ EvntOrgCancelled = Cancelled # SuggestForm = Suggestion page RegisterPage = Page for conferences or booth +EvntOrgRegistrationHelpMessage = Here, you can vote for an event, or suggest a new conference or booth for the project EvntOrgRegistrationConfHelpMessage = Here, you can suggest a new conference for the project EvntOrgRegistrationBoothHelpMessage = Here, you can suggest a new booth for the project ListOfSuggestedConferences = List of suggested conferences diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index ecaf524c034..71663a7f15c 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -496,9 +496,8 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { $db->commit(); - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; Header("Location: ".$redirection); exit; } else { diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 53dc9581d9a..844641fc4cf 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -430,9 +430,8 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { $db->commit(); - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); - $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl; + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; Header("Location: ".$redirection); exit; } else { From dbde0f0b02e96d0db4fd954f762cb7086f6df693 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 15:05:37 +0200 Subject: [PATCH 040/739] fix on status change when a booth is paid --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 09ffc2318b0..390ce6ef555 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1176,7 +1176,7 @@ if ($ispaymentok) { $error++; setEventMessages(null, $booth->errors, "errors"); } else { - $booth->setStatut(CONFERENCEORBOOTH::STATUS_SUGGESTED); + $booth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; $resultboothupdate = $booth->update($user); if ($resultboothupdate<0) { // Finding the thirdparty by getting the invoice From dfd3742d91370735775864520aa53c8428024610 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 15:33:00 +0200 Subject: [PATCH 041/739] fix on label on payment page --- htdocs/public/payment/newpayment.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 9cadab8deb4..67323190e44 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1810,9 +1810,6 @@ if ($source == 'conferencesubscription') { // Object $text = ''.$langs->trans("PaymentConferenceAttendee").''; - if (GETPOST('desc', 'alpha')) { - $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; - } print ''.$langs->trans("Designation"); print ''.$text; print ''; @@ -1899,9 +1896,6 @@ if ($source == 'boothlocation') { // Object $text = ''.$langs->trans("PaymentBoothLocation").''; - if (GETPOST('desc', 'alpha')) { - $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; - } print ''.$langs->trans("Designation"); print ''.$text; print ''; From d344ce5e08d4392cbf5cb7006d4485835ebafb8c Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 15:59:25 +0200 Subject: [PATCH 042/739] clean viewandvote page --- htdocs/public/project/viewandvote.php | 28 --------------------------- 1 file changed, 28 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 355156d73cb..f167fcf1717 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -18,15 +18,6 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * - * For Paypal test: https://developer.paypal.com/ - * For Paybox test: ??? - * For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing - * - * Variants: - * - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new PaymentIntent API - * - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API - * - If no option set, we use old APIS (charge) */ /** @@ -288,7 +279,6 @@ print ''."\n"; print ''; print $listOfBooths.'
'; print '
'.$langs->trans("ListOfSuggestedBooths").'
'."\n"; -print dol_get_fiche_end(); // Output payment summary form print ''; @@ -301,24 +291,6 @@ $object = null; print "\n"; - -// Show all action buttons -print '
'; - -//print ''; - - - - -print ''."\n"; - -print ''."\n"; - -print ''."\n"; -print '
'."\n"; -print '
'; - - htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); From c48234409b30b811b341fe254cd370e7071d5923 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 16:15:13 +0200 Subject: [PATCH 043/739] added copyright --- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/eventorganization/attendee_subscription.php | 8 +------- htdocs/public/eventorganization/subscriptionok.php | 1 + htdocs/public/payment/newpayment.php | 1 + htdocs/public/payment/paymentok.php | 1 + htdocs/public/project/index.php | 7 +------ htdocs/public/project/suggestbooth.php | 8 +------- htdocs/public/project/suggestconference.php | 8 +------- htdocs/public/project/viewandvote.php | 7 +------ 9 files changed, 9 insertions(+), 33 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 97090c343cf..1a663c0b713 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -1,4 +1,5 @@ # Copyright (C) 2021 Florian Henry +# Copyright (C) 2021 Dorian Vabre # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 37972628eed..82e82d58129 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -1,11 +1,5 @@ - * Copyright (C) 2001-2002 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2019 Frédéric France - * Copyright (C) 2018 Alexandre Spangaro +/* Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 02fb456f7d2..8586535f5ab 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 67323190e44..9de10b44cac 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -5,6 +5,7 @@ * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 390ce6ef555..8ea5d6a2587 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -4,6 +4,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2021 Waël Almoman * Copyright (C) 2021 Maxime Demarest + * Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index b05f2b1fc6f..1231617768d 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -1,10 +1,5 @@ - * Copyright (C) 2006-2017 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2018 Juanjo Menent - * Copyright (C) 2018-2019 Thibault FOUCART - * Copyright (C) 2021 Waël Almoman +/* Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 71663a7f15c..90fb7046bab 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -1,11 +1,5 @@ - * Copyright (C) 2001-2002 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2019 Frédéric France - * Copyright (C) 2018 Alexandre Spangaro +/* Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 844641fc4cf..c4cb3e298ec 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -1,11 +1,5 @@ - * Copyright (C) 2001-2002 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2012 J. Fernando Lagrange - * Copyright (C) 2018-2019 Frédéric France - * Copyright (C) 2018 Alexandre Spangaro +/* Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index f167fcf1717..8ade643b8ce 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -1,10 +1,5 @@ - * Copyright (C) 2006-2017 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2018 Juanjo Menent - * Copyright (C) 2018-2019 Thibault FOUCART - * Copyright (C) 2021 Waël Almoman +/* Copyright (C) 2021 Dorian Vabre * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 05bbb3dbf6dc5927946f68a210920e6e1f1333f5 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 16:39:03 +0200 Subject: [PATCH 044/739] improved welcome msg on suggestbooth/conf pages --- htdocs/langs/en_US/eventorganization.lang | 2 ++ htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 1a663c0b713..f990779b305 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -119,6 +119,8 @@ EventType = Event type # Vote page # EvntOrgRegistrationWelcomeMessage = Welcome on the conference or booth suggestion page. +EvntOrgRegistrationConfWelcomeMessage = Welcome on the conference suggestion page. +EvntOrgRegistrationBoothWelcomeMessage = Welcome on the booth suggestion page. EvntOrgVoteHelpMessage = Here, you can view and vote for the suggested events for the project VoteOk = Your vote has been accepted. AlreadyVoted = You have already voted for this event. diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 90fb7046bab..32ca05d1b09 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -518,7 +518,7 @@ print '
'; print '
'; // Welcome message -$text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; +$text = ''.$langs->trans("EvntOrgRegistrationBoothWelcomeMessage").'
'; $text .= ''.$langs->trans("EvntOrgRegistrationBoothHelpMessage").' '.$id.'.

'."\n"; $text .= ''.$project->note_public.''."\n";; print $text; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index c4cb3e298ec..485d18ee2c6 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -452,7 +452,7 @@ print '
'; print '
'; // Welcome message -$text = ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'; +$text = ''.$langs->trans("EvntOrgRegistrationConfWelcomeMessage").'
'; $text .= ''.$langs->trans("EvntOrgRegistrationConfHelpMessage").' '.$id.'.

'."\n"; $text .= ''.$project->note_public.''."\n";; print $text; From 9ab12e24551ca712a1a6025ca3d78af540f99d14 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:06:53 +0200 Subject: [PATCH 045/739] add (getNomUrl) --- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 331e211e5ac..3728771c8aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -765,7 +765,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user; + global $langs, $conf, $user, $hookmanager; $result = ''; @@ -774,7 +774,15 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $label .= ' '.$this->getLibStatut(5); + $statusText = ' '.$this->getLibStatut(5); + $parameters = array('obj' => $this); + $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $statusText .= $hookmanager->resPrint; + } else { + $statusText = $hookmanager->resPrint; + } + $label .= $statusText; } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From c6d646f39e0ad1047493ef2960d4b3155770c3dc Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:08:36 +0200 Subject: [PATCH 046/739] add(prop)list --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d32e466444c..a294d2a4712 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1283,6 +1283,7 @@ if ($resql) { $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; + $objectstatic->socid = $obj->socid; $objectstatic->ref_supplier = $obj->ref_supplier; $objectstatic->total_ht = $obj->total_ht; $objectstatic->total_tva = $obj->total_tva; From a91d1b2e07d9262c9aeecf53f5777e9b90c6a891 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Fri, 7 May 2021 17:09:39 +0200 Subject: [PATCH 047/739] add(list) hook --- htdocs/fourn/commande/list.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index a294d2a4712..0aae47cd7fc 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1537,7 +1537,15 @@ if ($resql) { } // Status if (!empty($arrayfields['cf.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; + $parameters = array('obj' => $obj); + $morehtmlstatus = $objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed); + $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $morehtmlstatus .= $hookmanager->resPrint; + } else { + $morehtmlstatus = $hookmanager->resPrint; + } + print '' . $morehtmlstatus . ''; if (!$i) { $totalarray['nbfield']++; } From 058bef1a79d03f73c099854ebbff8c96a2029b11 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 7 May 2021 17:20:36 +0200 Subject: [PATCH 048/739] clean viewandvote page --- htdocs/public/project/viewandvote.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 8ade643b8ce..1f9b4d32dab 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -258,7 +258,7 @@ if ($urllogo) { print ''."\n"; $text = ''."\n"; $text .= ''."\n"; -$text .= ''."\n";; +$text .= ''."\n";; print $text; print '

'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'
'.$langs->trans("EvntOrgVoteHelpMessage").' : "'.$project->title.'".

'.$project->note_public.'

'.$project->note_public.'
'."\n"; @@ -269,23 +269,15 @@ print ''.$langs->trans("ListOfSuggestedConferences").''; print $listOfConferences.'
'; print ''."\n"; +print '
'; print ''."\n"; print ''; print $listOfBooths.'
'; print '
'.$langs->trans("ListOfSuggestedBooths").'
'."\n"; -// Output payment summary form -print ''; - -$found = false; -$error = 0; -$var = false; - $object = null; -print "\n"; - htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object); llxFooter('', 'public'); From d86b393d6023868bedef93c4a76a9e05dce37426 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 09:54:26 +0200 Subject: [PATCH 049/739] useless line removed --- htdocs/public/eventorganization/attendee_subscription.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 82e82d58129..4fdde7c7181 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -425,8 +425,7 @@ if (empty($reshook) && $action == 'add') { } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } - - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; Header("Location: ".$redirection); From 0dce9ee359746ca359566135e2bc04f7d773431c Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 10:22:45 +0200 Subject: [PATCH 050/739] now using correct email templates after booth/conf suggestion --- htdocs/public/eventorganization/attendee_subscription.php | 2 +- htdocs/public/payment/newpayment.php | 1 - htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 4fdde7c7181..a81ac456353 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -425,7 +425,7 @@ if (empty($reshook) && $action == 'add') { } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } - + $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2); $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl; Header("Location: ".$redirection); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 9de10b44cac..574085ac623 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1954,7 +1954,6 @@ if ($source == 'boothlocation') { print ''."\n"; } - if (!$found && !$mesg) { $mesg = $langs->trans("ErrorBadParameters"); } diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 32ca05d1b09..f510a5274f0 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -453,7 +453,7 @@ if (empty($reshook) && $action == 'add') { // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH; if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); } diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 485d18ee2c6..3eff5fad3a9 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -388,7 +388,7 @@ if (empty($reshook) && $action == 'add') { // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT; + $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF; if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, ''); } From 0e62edfd42fc06056b1dfb355683151077eb251b Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 12:47:09 +0200 Subject: [PATCH 051/739] fix error on fetching thirdparty when there is none --- htdocs/public/project/viewandvote.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 1f9b4d32dab..283d50eda8f 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -119,12 +119,17 @@ $result = $db->query($sqlforconf); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); - $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); - if ($resultthirdparty) { - $thirdpartyname = $tmpthirdparty->name; + if (!empty($obj->fk_soc)) { + $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); + if ($resultthirdparty) { + $thirdpartyname = $tmpthirdparty->name; + } else { + $thirdpartyname = ''; + } } else { $thirdpartyname = ''; } + $listOfConferences .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; $listOfConferences .= ''; $i++; @@ -135,12 +140,17 @@ $result = $db->query($sqlforbooth); $i = 0; while ($i < $db->num_rows($result)) { $obj = $db->fetch_object($result); - $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); - if ($resultthirdparty) { - $thirdpartyname = $tmpthirdparty->name; + if (!empty($obj->fk_soc)) { + $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); + if ($resultthirdparty) { + $thirdpartyname = $tmpthirdparty->name; + } else { + $thirdpartyname = ''; + } } else { $thirdpartyname = ''; } + $listOfBooths .= ''.$obj->label.''.$obj->libelle.''.$obj->datep.''.$obj->datep2.''.$thirdpartyname.''.$obj->note.''; $listOfBooths .= ''; $i++; From c5dc20b9dc611434037fe4f27fece9a7a7f5725b Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 15:31:52 +0200 Subject: [PATCH 052/739] opti --- htdocs/public/project/viewandvote.php | 5 ++--- htdocs/societe/card.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 283d50eda8f..0f07e5e297e 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -180,18 +180,17 @@ if (strlen($idvote)) { // Cookie duration by default $timeleftbeforestartofevent = time()+86400*30; } - + // Process to vote - $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 1, 0); if ($res) { $conforbooth->num_vote++; $resupdate = $conforbooth->update($user); if ($resupdate) { $votestatus = 'ok'; + $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 1, 0); } else { //Error during update $votestatus = 'err'; - $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 0, 0); } } else { $votestatus = 'err'; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8102c5064f2..104f45de979 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2467,7 +2467,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } - // Supplier code + // Su+pplier code if (((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) && $object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; From ee4e8dd99f6992ee96d4f14e6a717f623a1ea45f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 15:37:25 +0200 Subject: [PATCH 053/739] cookies to session transition --- htdocs/public/project/viewandvote.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 0f07e5e297e..304f42d637b 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -74,6 +74,8 @@ if ($securekeytocompare != $securekeyreceived) { exit; } +$listofvotes = explode(',', $_SESSION["savevotes"]); + if (GETPOST("votestatus")=="ok") { setEventMessage($langs->trans("VoteOk"), 'mesgs'); } else if (GETPOST("votestatus")=="ko") { @@ -161,7 +163,7 @@ $idvote = GETPOST("vote"); $hashedvote = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'vote'.$idvote); if (strlen($idvote)) { - if ($_COOKIE['VOTE_SUGGESTED_EVENTS_'.$hashedvote]==1) { + if (in_array($hashedvote, $listofvotes)) { // Has already voted $votestatus = 'ko'; } else { @@ -172,22 +174,13 @@ if (strlen($idvote)) { $error++; $errmsg .= $conforbooth->error; } else { - // Cookie expiration date : start of event, or 30 days if not specified - $startdate = $conforbooth->datep; - if (strlen($startdate)) { - $timeleftbeforestartofevent = $startdate; - } else { - // Cookie duration by default - $timeleftbeforestartofevent = time()+86400*30; - } - // Process to vote if ($res) { $conforbooth->num_vote++; $resupdate = $conforbooth->update($user); if ($resupdate) { $votestatus = 'ok'; - $res = setcookie('VOTE_SUGGESTED_EVENTS_'.$hashedvote, 1, 0); + $_SESSION["savevotes"] = $hashedvote.','.(empty($_SESSION["savevotes"]) ? '' : $_SESSION["savevotes"]); // Save voter } else { //Error during update $votestatus = 'err'; From d71dc37a75f8d3f8dac486c130cd369c88879ef5 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 15:39:39 +0200 Subject: [PATCH 054/739] fix --- htdocs/public/project/viewandvote.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 304f42d637b..333edd81755 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -175,17 +175,13 @@ if (strlen($idvote)) { $errmsg .= $conforbooth->error; } else { // Process to vote - if ($res) { - $conforbooth->num_vote++; - $resupdate = $conforbooth->update($user); - if ($resupdate) { - $votestatus = 'ok'; - $_SESSION["savevotes"] = $hashedvote.','.(empty($_SESSION["savevotes"]) ? '' : $_SESSION["savevotes"]); // Save voter - } else { - //Error during update - $votestatus = 'err'; - } + $conforbooth->num_vote++; + $resupdate = $conforbooth->update($user); + if ($resupdate) { + $votestatus = 'ok'; + $_SESSION["savevotes"] = $hashedvote.','.(empty($_SESSION["savevotes"]) ? '' : $_SESSION["savevotes"]); // Save voter } else { + //Error during update $votestatus = 'err'; } } From 7d0c3dcf6d64b61893c4d0158c2a285f14bd49bc Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 15:50:29 +0200 Subject: [PATCH 055/739] transition done from cookies to session --- htdocs/public/project/viewandvote.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 333edd81755..0468a9c2e59 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -76,13 +76,6 @@ if ($securekeytocompare != $securekeyreceived) { $listofvotes = explode(',', $_SESSION["savevotes"]); -if (GETPOST("votestatus")=="ok") { - setEventMessage($langs->trans("VoteOk"), 'mesgs'); -} else if (GETPOST("votestatus")=="ko") { - setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); -} else if (GETPOST("votestatus")=="err") { - setEventMessage($langs->trans("VoteError"), 'warnings'); -} // Define $urlwithroot //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); @@ -186,7 +179,15 @@ if (strlen($idvote)) { } } } - header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?votestatus='.$votestatus.'&id='.$id.'&securekey=', 1).$securekeyreceived); + if ($votestatus=="ok") { + setEventMessage($langs->trans("VoteOk"), 'mesgs'); + } else if ($votestatus=="ko") { + setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); + } else if ($votestatus=="err") { + setEventMessage($langs->trans("VoteError"), 'warnings'); + } + header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?id='.$id.'&securekey=', 1).$securekeyreceived); + exit; } From f6956d6a6272a14208f5b0d9da68f219f0b6751c Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 15:58:54 +0200 Subject: [PATCH 056/739] using validate() function instead of settStatut(1) to validate an attendee --- htdocs/public/payment/paymentok.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 8ea5d6a2587..2e6cd630694 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -1006,7 +1006,7 @@ if ($ispaymentok) { if ($resultattendee < 0) { setEventMessages(null, $attendeetovalidate->errors, "errors"); } else { - $attendeetovalidate->setStatut(1); + $attendeetovalidate->validate($user); // Sending mail $thirdparty = new Societe($db); From bf25fd083404a84f90512e3f7a2342876f8dc96b Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 16:04:13 +0200 Subject: [PATCH 057/739] confattendee merge OK to replace thirdparty --- .../class/conferenceorboothattendee.class.php | 17 +++++++++++++++++ htdocs/societe/card.php | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 6418d73580b..58bd38c35d8 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -1070,6 +1070,23 @@ class ConferenceOrBoothAttendee extends CommonObject return $error; } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'conferenceorboothattendee' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 104f45de979..20e8c06833d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -270,7 +270,8 @@ if (empty($reshook)) { 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', 'Ticket' => '/ticket/class/ticket.class.php', - 'User' => '/user/class/user.class.php' + 'User' => '/user/class/user.class.php', + 'ConfOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' ); //First, all core objects must update their tables From 48bbb500d3b98d1f10a29534477b5a136de5061a Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 16:25:44 +0200 Subject: [PATCH 058/739] fix on replacing thirdparty in attendees when merging multiple thirdparties --- .../class/conferenceorboothattendee.class.php | 2 +- htdocs/societe/card.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 58bd38c35d8..1cb24460523 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -1082,7 +1082,7 @@ class ConferenceOrBoothAttendee extends CommonObject public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { $tables = array( - 'conferenceorboothattendee' + 'eventorganization_conferenceorboothattendee' ); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 20e8c06833d..18cfdfa1f16 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -57,6 +57,10 @@ if (! empty($conf->accounting->enabled)) { if (! empty($conf->accounting->enabled)) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } +if (! empty($conf->eventorganization->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; +} + $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); if (!empty($conf->adherent->enabled)) { @@ -271,7 +275,7 @@ if (empty($reshook)) { 'Project' => '/projet/class/project.class.php', 'Ticket' => '/ticket/class/ticket.class.php', 'User' => '/user/class/user.class.php', - 'ConfOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' + 'ConferenceOrBoothAttendee' => '/eventorganization/class/conferenceorboothattendee.class.php' ); //First, all core objects must update their tables From c85b75924fc205648e67eeadb95c726100c53900 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 16:57:48 +0200 Subject: [PATCH 059/739] wip on adding a filter for the ics file + fix on class name --- htdocs/comm/action/class/actioncomm.class.php | 3 +++ htdocs/public/agenda/agendaexport.php | 3 +++ htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d8bcd0efb1b..bf6fa9fcc56 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1901,6 +1901,9 @@ class ActionComm extends CommonObject $sql .= " AND ar.fk_element = 0"; } } + if ($key == 'author') { + $sql .= " AND c.type = '".$this->db->escape($value)."'"; + } } $sql .= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index d40d75c0acf..00514cd026c 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -135,6 +135,9 @@ if (GETPOST("notolderthan", 'int')) { } else { $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; } +if (GETPOST("author", 'apha')) { + $filters['author'] = GETPOST("author", 'apha'); +} // Check config if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) { diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index f510a5274f0..65b15578b7d 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -439,7 +439,7 @@ if (empty($reshook) && $action == 'add') { } } else { // If no price has been set for the booth, we confirm it as suggested and we update - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED; $conforbooth->update($user); // Sending mail require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 3eff5fad3a9..0028f544f9f 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -373,7 +373,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $conforbooth->error; } else { - $conforbooth->status = CONFERENCEORBOOTH::STATUS_SUGGESTED; + $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED; $conforbooth->update($user); // Sending mail From e31d8f89f5592ae5f3a5fbc8d089b9b62c45319d Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 17:13:57 +0200 Subject: [PATCH 060/739] wip filter --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index bf6fa9fcc56..a6f9faf353f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1902,7 +1902,7 @@ class ActionComm extends CommonObject } } if ($key == 'author') { - $sql .= " AND c.type = '".$this->db->escape($value)."'"; + $sql .= " AND u.lastname = '".$this->db->escape($value)."'"; } } From 1e90e618f04a54b3b4eee79668740acb7f95469f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 10 May 2021 17:25:00 +0200 Subject: [PATCH 061/739] wip filter --- htdocs/eventorganization/conferenceorbooth_list.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 3e480efca54..24d6853abda 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -427,7 +427,17 @@ if ($projectid > 0) { print ""; print ''.$langs->trans("EventOrganizationICSLink").''; - print ''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); + + // Show message + $message = ''; + $message .= '
'; + $message .= '
'; + print $message; print ""; From 1bfcfc3a0ca69e8c44fb55d0d8c16b9059843056 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Wed, 12 May 2021 16:55:03 +0200 Subject: [PATCH 062/739] rename Hook and moved it into LibStatut method --- htdocs/fourn/class/fournisseur.commande.class.php | 7 ++++++- htdocs/fourn/commande/list.php | 10 +--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3728771c8aa..99b64ccead4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -690,7 +690,7 @@ class CommandeFournisseur extends CommonOrder public function LibStatut($status, $mode = 0, $billed = 0) { // phpcs:enable - global $conf, $langs; + global $conf, $langs, $hookmanager; if (empty($this->statuts) || empty($this->statutshort)) { $langs->load('orders'); @@ -749,6 +749,11 @@ class CommandeFournisseur extends CommonOrder $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); + $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); + $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + if ($reshook > 0) { + return $hookmanager->resPrint; + } return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0aae47cd7fc..a294d2a4712 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1537,15 +1537,7 @@ if ($resql) { } // Status if (!empty($arrayfields['cf.fk_statut']['checked'])) { - $parameters = array('obj' => $obj); - $morehtmlstatus = $objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed); - $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $morehtmlstatus .= $hookmanager->resPrint; - } else { - $morehtmlstatus = $hookmanager->resPrint; - } - print '' . $morehtmlstatus . ''; + print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''; if (!$i) { $totalarray['nbfield']++; } From ea0d8605930e51a0e84bd38c739cdcf2cc3e3a0e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 12 May 2021 14:55:32 +0000 Subject: [PATCH 063/739] Fixing style errors. --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 99b64ccead4..abfe6df1edc 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -753,7 +753,7 @@ class CommandeFournisseur extends CommonOrder $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; - } + } return dolGetStatus($statusLong, $statusShort, '', $statusClass, $mode); } From f95bd2f4396f9f159c1e872b96a16f7a84ebd92c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 17 May 2021 11:40:36 +0200 Subject: [PATCH 064/739] fixw that --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 7c9f4e6fe77..8ce23e6f9ad 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -424,7 +424,7 @@ class pdf_cyan extends ModelePDFPropales $salereparray = $object->thirdparty->getSalesRepresentatives($user); $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow .= dol_concatdesc($notetoshow, $salerepobj->signature); } } From c6aa078892f89198178258484550681ad1762e2b Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 17 May 2021 13:46:01 +0200 Subject: [PATCH 065/739] renamed LibStatut hook + removed useless hook --- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index abfe6df1edc..e8d6c0ed9c9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -750,7 +750,7 @@ class CommandeFournisseur extends CommonOrder $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); - $reshook = $hookmanager->executeHooks('diffHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $object); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; } @@ -779,15 +779,7 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $statusText = ' '.$this->getLibStatut(5); - $parameters = array('obj' => $this); - $reshook = $hookmanager->executeHooks('moreHtmlStatus', $parameters, $object); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $statusText .= $hookmanager->resPrint; - } else { - $statusText = $hookmanager->resPrint; - } - $label .= $statusText; + $label = ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From 779c868eaede3368a6d5b3f8674942565df26e84 Mon Sep 17 00:00:00 2001 From: Antonin MARCHAL Date: Mon, 17 May 2021 13:48:21 +0200 Subject: [PATCH 066/739] fix mistake and removed hookmanager unused --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e8d6c0ed9c9..9b643ff1464 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -770,7 +770,7 @@ class CommandeFournisseur extends CommonOrder */ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0) { - global $langs, $conf, $user, $hookmanager; + global $langs, $conf, $user; $result = ''; @@ -779,7 +779,7 @@ class CommandeFournisseur extends CommonOrder if ($user->rights->fournisseur->commande->lire) { $label = ''.$langs->trans("SupplierOrder").''; if (isset($this->statut)) { - $label = ' '.$this->getLibStatut(5); + $label .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; From 6f3d19b7b63c3fb62997dc64f8a32b16065501de Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 17 May 2021 15:12:25 +0200 Subject: [PATCH 067/739] dol_concatdesc better than concat operator --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 8ce23e6f9ad..2b40dffa30e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -424,7 +424,7 @@ class pdf_cyan extends ModelePDFPropales $salereparray = $object->thirdparty->getSalesRepresentatives($user); $salerepobj = new User($this->db); $salerepobj->fetch($salereparray[0]['id']); - if (!empty($salerepobj->signature)) $notetoshow .= dol_concatdesc($notetoshow, $salerepobj->signature); + if (!empty($salerepobj->signature)) $notetoshow = dol_concatdesc($notetoshow, $salerepobj->signature); } } @@ -438,9 +438,11 @@ class pdf_cyan extends ModelePDFPropales { $tmpuser = new User($this->db); $tmpuser->fetch($object->user_author_id); - $notetoshow .= $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); - if ($tmpuser->email) $notetoshow .= ', Mail: '.$tmpuser->email; - if ($tmpuser->office_phone) $notetoshow .= ', Tel: '.$tmpuser->office_phone; + $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); + if ($tmpuser->email) $creator_info .= ', Mail: '.$tmpuser->email; + if ($tmpuser->office_phone) $creator_info .= ', Tel: '.$tmpuser->office_phone; + + $notetoshow = dol_concatdesc($notetoshow, $creator_info); } $tab_height = $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter; From df81ac8622f4718986832136bdd60d5c2148b4e0 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 20 May 2021 16:30:49 +0200 Subject: [PATCH 068/739] wip --- htdocs/public/agenda/agendaexport.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 00514cd026c..6a07680c9b9 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -138,7 +138,9 @@ if (GETPOST("notolderthan", 'int')) { if (GETPOST("author", 'apha')) { $filters['author'] = GETPOST("author", 'apha'); } - +if (GETPOST("module", 'apha')) { + $filters['module'] = GETPOST("module", 'apha'); +} // Check config if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) { $user->getrights(); From 720a368b297cc38f82a150e428220488ee9bb7d1 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 20 May 2021 17:24:27 +0200 Subject: [PATCH 069/739] link ics ok (todo: add name of speaker) --- htdocs/comm/action/class/actioncomm.class.php | 7 +++++-- .../class/conferenceorbooth.class.php | 2 ++ .../conferenceorbooth_list.php | 7 ++++--- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/public/agenda/agendaexport.php | 17 +++++++++++++---- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a6f9faf353f..747c50c9640 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1901,8 +1901,11 @@ class ActionComm extends CommonObject $sql .= " AND ar.fk_element = 0"; } } - if ($key == 'author') { - $sql .= " AND u.lastname = '".$this->db->escape($value)."'"; + if ($key == 'module') { + $sql .= " AND c.module LIKE '%".$value."'"; + } + if ($key == 'status') { + $sql .= " AND a.status =".$value; } } diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 1719f0c508d..ff26d192301 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -134,6 +134,8 @@ class ConferenceOrBooth extends ActionComm public $status; // END MODULEBUILDER PROPERTIES + public $pubregister; + /** * Constructor * diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 24d6853abda..15664896700 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -430,11 +430,11 @@ if ($projectid > 0) { // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; - $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); // Show message - $message = ''; + $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...'); + $message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').''; $message .= '
'; $message .= '
'; print $message; @@ -457,6 +457,7 @@ if ($projectid > 0) { // -------------------------------------------------------------------- $sql = 'SELECT '; $sql .= $object->getFieldList('t'); + // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index f990779b305..335c257b224 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -82,6 +82,7 @@ PriceOfBoothHelp=Subscription price to stand a booth EventOrganizationICSLink=Link ICS for events ConferenceOrBoothInformation=Conference Or Booth informations Attendees = Attendees +DownloadICSLink = Download ICS link EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference SERVICE_BOOTH_LOCATION = Service used for the invoice row about a booth location SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to a conference diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 6a07680c9b9..5d48ffb06fe 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -135,11 +135,11 @@ if (GETPOST("notolderthan", 'int')) { } else { $filters['notolderthan'] = $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY; } -if (GETPOST("author", 'apha')) { - $filters['author'] = GETPOST("author", 'apha'); +if (GETPOST("module", 'alpha')) { + $filters['module'] = GETPOST("module", 'alpha'); } -if (GETPOST("module", 'apha')) { - $filters['module'] = GETPOST("module", 'apha'); +if (GETPOST("status", 'int')) { + $filters['status'] = GETPOST("status", 'int'); } // Check config if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) { @@ -206,6 +206,15 @@ foreach ($filters as $key => $value) { if ($key == 'notactiontype') { $filename .= '-notactiontype'.$value; } + if ($key == 'actiontype') { + $filename .= '-actiontype'.$value; + } + if ($key == 'module') { + $filename .= '-module'.$value; + } + if ($key == 'status') { + $filename .= '-status'.$value; + } } // Add extension if ($format == 'vcal') { From bbce806cb5e64c45e57a27f68b6ca9e61562ffc5 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 20 May 2021 17:32:48 +0200 Subject: [PATCH 070/739] typo --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 16818e86d4f..15a7565780b 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2473,7 +2473,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } - // Su+pplier code + // Supplier code if (((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) && $object->fournisseur) { print ''; print $langs->trans('SupplierCode').''; From 6f050fc23a93e0aef0628096efefe3ec5ce1bf45 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 20 May 2021 15:48:04 +0000 Subject: [PATCH 071/739] Fixing style errors. --- htdocs/public/project/viewandvote.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 0468a9c2e59..9177e0edc8d 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -181,9 +181,9 @@ if (strlen($idvote)) { } if ($votestatus=="ok") { setEventMessage($langs->trans("VoteOk"), 'mesgs'); - } else if ($votestatus=="ko") { + } elseif ($votestatus=="ko") { setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); - } else if ($votestatus=="err") { + } elseif ($votestatus=="err") { setEventMessage($langs->trans("VoteError"), 'warnings'); } header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?id='.$id.'&securekey=', 1).$securekeyreceived); From fe272d32925657b0fe12482eaf56264eda8d21f2 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 21 May 2021 16:01:44 +0200 Subject: [PATCH 072/739] wip name of contact to add on ics file --- htdocs/comm/action/class/actioncomm.class.php | 1 + .../class/conferenceorbooth.class.php | 1 + htdocs/public/project/suggestconference.php | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 747c50c9640..5790811fc2e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1944,6 +1944,7 @@ class ActionComm extends CommonObject $duration = ($datestart && $dateend) ? ($dateend - $datestart) : 0; $event['summary'] = $obj->label.($obj->socname ? " (".$obj->socname.")" : ""); + $event['desc'] = $obj->note; $event['startdate'] = $datestart; $event['enddate'] = $dateend; // Not required with type 'journal' diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index ff26d192301..bb8649106b9 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -215,6 +215,7 @@ class ConferenceOrBooth extends ActionComm $this->socid=$this->fk_soc; $this->datef=$this->datep2; $this->note_private=$this->note; + $this->fk_user_author=$this->fk_user_author; } /** diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 0028f544f9f..19eb0801c6a 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -225,7 +225,11 @@ if (empty($reshook) && $action == 'add') { } if (!GETPOST("lastname")) { $error++; - $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."
\n"; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; + } + if (!GETPOST("firstname")) { + $error++; + $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; } if (!GETPOST("societe")) { $error++; @@ -297,7 +301,6 @@ if (empty($reshook) && $action == 'add') { $contact->state_id = (int) GETPOST("state_id", 'int'); $contact->email = $email; $contact->statut = 1; //Default status to Actif - $resultcreatecontact = $contact->create($user); if ($resultcreatecontact<0) { $error++; @@ -362,6 +365,8 @@ if (empty($reshook) && $action == 'add') { $conforbooth->datep2 = $dateend; $conforbooth->datec = dol_now(); $conforbooth->tms = dol_now(); + $conforbooth->firstname = $contact->firstname; + $conforbooth->lastname = $contact->lastname; $resultconforbooth = $conforbooth->create($user); if ($resultconforbooth<=0) { $error++; @@ -488,10 +493,14 @@ jQuery(document).ready(function () { print ''."\n"; -// Name +// Last Name print ''; print ''; print ''; +// First Name +print ''; +print ''; +print ''; // Email print ''."\n"; // Company From 2fdd8486c948029a6ed25477e5f29b04761624cb Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Sat, 22 May 2021 06:13:16 +0200 Subject: [PATCH 073/739] No try to translate label field in dictionary for new --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c9ada83ed15..2bd55c6c66a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2015,7 +2015,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } @@ -335,7 +335,7 @@ if (!empty($arrayfields['variation']['checked'])) { // Filter: New Balance if (!empty($arrayfields['cpl.new_solde']['checked'])) { - print ''; } @@ -360,13 +360,20 @@ if (!empty($arrayfields['cpl.new_solde']['checked'])) print_liste_field_titre($a print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print ''; -// TODO: $i = 0; -$i = 1; -while ($i < min($num, $limit)) -{ - //TODO: $obj = $db->fetch_object($resql); +$j = 0; +while ($j < ($page * $limit)) { $obj = next($object->logs); + $j++; +} + +$i = 0; +while ($i < min($num, $limit)) { + //TODO: $obj = $db->fetch_object($resql); + $obj = current($object->logs); + if (empty($obj)) { + break; + } $holidaylogstatic->id = $obj['rowid']; $holidaylogstatic->date = $obj['date_action']; @@ -444,6 +451,7 @@ while ($i < min($num, $limit)) print ''; $i++; + next($object->logs); } if ($log_holiday == '2') { From 9c83bdff519aa2a6ce88ad98083efcbb79c6b184 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 26 May 2021 17:02:34 +0200 Subject: [PATCH 080/739] FIX : Add parameters (object and action) for user list DoActions hook --- htdocs/user/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 1f59656dcbd..e2b4fd3889d 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -154,7 +154,7 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; } $parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) From 60250443a1c91cbe17d62215a9440ebde030225b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 18:55:48 +0200 Subject: [PATCH 081/739] fix warning --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 5182a6ff778..d20318090e0 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1908,7 +1908,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Reactivate - if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) { + if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $object->statut) { if ($user->rights->adherent->creer) { print ''.$langs->trans("Reenable")."\n"; } else { From 9b51699228ef234b547eb94f9f6dab4d31b517cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 19:55:47 +0200 Subject: [PATCH 082/739] fix warnings --- htdocs/societe/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0a3e9207a96..3999158acaa 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -11,7 +11,7 @@ * Copyright (C) 2017 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2020 Open-Dsi - + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -221,7 +221,7 @@ $checkedprofid6 = 0; $checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0); $checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0); $arrayfields = array( - 's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), + 's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))), 's.nom'=>array('label'=>"ThirdPartyName", 'position'=>2, 'checked'=>1), 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), From 879a401724798510c93b3a1d8c0db90f532fa541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 20:00:23 +0200 Subject: [PATCH 083/739] fix warnings --- htdocs/societe/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0a3e9207a96..1a6c0ea6baf 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -942,7 +942,7 @@ if (empty($type) || $type == 'c' || $type == 'p') { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('Categories'); - $moreforfilter .= img_picto($tmptile, 'category', 'class="pictofixedwidth"'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); $moreforfilter .= '
'; } @@ -953,7 +953,7 @@ if (empty($type) || $type == 'f') { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('Categories'); - $moreforfilter .= img_picto($tmptilte, 'category', 'class="pictofixedwidth"'); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); $moreforfilter .= $formother->select_categories('supplier', $search_categ_sup, 'search_categ_sup', 1, $langs->trans('SuppliersCategoriesShort')); $moreforfilter .= '
'; } @@ -962,8 +962,8 @@ if (empty($type) || $type == 'f') { // If the user can view prospects other than his' if ($user->rights->societe->client->voir || $socid) { $moreforfilter .= '
'; - $tmptile = $langs->trans('SalesRepresentatives'); - $moreforfilter .= img_picto($tmptile, 'user', 'class="pictofixedwidth"'); + $tmptitle = $langs->trans('SalesRepresentatives'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $langs->trans('SalesRepresentatives'), ($conf->dol_optimize_smallscreen ? 'maxwidth200' : 'maxwidth300'), 1); $moreforfilter .= '
'; } From 0d62d3bace46532c60964c0031f6f77f9783c203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 23:36:36 +0200 Subject: [PATCH 084/739] fix warnings --- htdocs/contrat/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 19a040bf091..e1166fe385a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -494,14 +494,14 @@ $moreforfilter = ''; if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; - $tmpttile = $langs->trans('ThirdPartiesOfSaleRepresentative'); + $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmpttile, 'maxwidth250'); $moreforfilter .= '
'; } // If the user can view other users if ($user->rights->user->user->lire) { $moreforfilter .= '
'; - $tmpttile = $langs->trans('LinkedToSpecificUsers'); + $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmpttile, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= '
'; } @@ -509,7 +509,7 @@ if ($user->rights->user->user->lire) { if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; - $tmpttile = $langs->trans('IncludingProductWithTag'); + $tmptitle = $langs->trans('IncludingProductWithTag'); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmpttile, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; From 223ece5ca5a4e14cc926aae034f6756348ec4033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 23:43:14 +0200 Subject: [PATCH 085/739] Update list.php --- htdocs/contrat/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e1166fe385a..aea778f884c 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -495,14 +495,14 @@ if ($user->rights->societe->client->voir || $socid) { $langs->load("commercial"); $moreforfilter .= '
'; $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmpttile, 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth250'); $moreforfilter .= '
'; } // If the user can view other users if ($user->rights->user->user->lire) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); - $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmpttile, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); + $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250'); $moreforfilter .= '
'; } // If the user can view categories of products @@ -511,7 +511,7 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($use $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmpttile, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); + $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } From 4237b374dda29e08558cd13692ea3382ceb69393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 26 May 2021 23:45:45 +0200 Subject: [PATCH 086/739] Update list.php --- htdocs/contrat/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index aea778f884c..cf19f1178f6 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -706,6 +706,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; $totalarray = array(); +$totalarray['nbfield'] = 0; $typenArray = array(); $cacheCountryIDCode = array(); From 3ebe6eb014d440b7602a40252fc2fbb9ffc1caa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 00:02:01 +0200 Subject: [PATCH 087/739] fix bad setup of MAIN_USE_BACKGROUND_ON_PDF --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1babc31b4c2..281e45baf51 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -623,8 +623,8 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) { global $conf; - // Add a background image on document - if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF)) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image + // Add a background image on document only if good setup of const + if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF) && ($conf->global->MAIN_USE_BACKGROUND_ON_PDF != '-1')) // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image $pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); From 61753791b47eb270abf09d545c6e5a07754612f3 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Thu, 27 May 2021 12:20:42 +0200 Subject: [PATCH 088/739] Update card.php Add Batchinfo on invoice detail lines if hidden feature INCUDE_BATCHINFO_ON_INVOICE is set --- htdocs/compta/facture/card.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a088d94a01c..2d147c86b07 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,6 +2232,15 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { + + // Add batchinfo if the detailline has batchinfo + + if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)){ + foreach ($lines[$i]->detail_batch as $batchline){ + $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + } + } + // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise); From c31530e7edcc308ae7775020d07a5f698b60eef5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 May 2021 10:24:18 +0000 Subject: [PATCH 089/739] Fixing style errors. --- htdocs/compta/facture/card.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2d147c86b07..beb9463acab 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,15 +2232,14 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { - // Add batchinfo if the detailline has batchinfo - - if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)){ - foreach ($lines[$i]->detail_batch as $batchline){ - $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; - } + + if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { + foreach ($lines[$i]->detail_batch as $batchline) { + $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + } } - + // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $_POST['progress'], '', $fk_unit, $pu_ht_devise); From ca7e52d86185e5a65be20e496f227ead8e77a05d Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 27 May 2021 13:09:03 +0200 Subject: [PATCH 090/739] Update llx_c_email_templates.sql - formatting - removed *tms* at eventorganization --- .../mysql/data/llx_c_email_templates.sql | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index 5ca98be8545..acc09bad008 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -20,21 +20,24 @@ -- de l'install et tous les sigles '--' sont supprimés. -- -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null); +-- Bank Thirdparty +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines) VALUES (0,'banque','thirdparty','',0,null,null,'(YourSEPAMandate)',1,'$conf->societe->enabled && $conf->banque->enabled && $conf->prelevement->enabled',0,'__(YourSEPAMandate)__','__(Hello)__,

\n\n__(FindYourSEPAMandate)__ :
\n__MYCOMPANY_NAME__
\n__MYCOMPANY_FULLADDRESS__

\n__(Sincerely)__
\n__USER_SIGNATURE__',null); +-- Members +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnAutoSubscription)' ,10,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipRequestWasReceived)__','__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipRequestWasReceived)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnMemberValidation)' ,20,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasValidated)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourMembershipWasValidated)__
__(FirstName)__ : __MEMBER_FIRSTNAME__
__(LastName)__ : __MEMBER_LASTNAME__
__(ID)__ : __MEMBER_ID__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnNewSubscription)' ,30,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourSubscriptionWasRecorded)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfYourSubscriptionWasRecorded)__
\n\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,'$conf->adherent->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); +-- Recruiting +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); - -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailAskConf', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailAskBooth', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsBooth', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

__(Sincerely)__

__MYCOMPANY_NAME__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendees', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- Event organization +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationEmailAskConf', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventConfRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationEmailAskBooth', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothRequestWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationEmailSubsBooth', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsBooth)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBoothSubscriptionWasReceived)__

__ONLINE_PAYMENT_TEXT_AND_URL__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationEmailSubsEvent', 40, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailSubsEvent)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventEventSubscriptionWasReceived)__

__(Sincerely)__

__MYCOMPANY_NAME__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationMassEmailAttendees', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendees)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,

__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__

__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); From d0a8dc9df969c8432d4a0cf30a35c72407b4cd52 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 27 May 2021 13:25:00 +0200 Subject: [PATCH 091/739] Update llx_c_chargesociales.sql idea: fk_pays at first - id as second (based on fk_pays) --- htdocs/install/mysql/data/llx_c_chargesociales.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_chargesociales.sql b/htdocs/install/mysql/data/llx_c_chargesociales.sql index b728d9c6414..a7e12df0d31 100644 --- a/htdocs/install/mysql/data/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/data/llx_c_chargesociales.sql @@ -50,10 +50,10 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays -- -- Belgique -- -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (201, 'ONSS', 1,1,'TAXBEONSS' ,'2'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (210, 'Precompte professionnel', 1,1,'TAXBEPREPRO' ,'2'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (220, 'Prime existence', 1,1,'TAXBEPRIEXI' ,'2'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (230, 'Precompte immobilier', 1,1,'TAXBEPREIMMO','2'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 201, 'ONSS', 1,1,'TAXBEONSS'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 210, 'Precompte professionnel', 1,1,'TAXBEPREPRO'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 220, 'Prime existence', 1,1,'TAXBEPRIEXI'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 230, 'Precompte immobilier', 1,1,'TAXBEPREIMMO'); -- -- Austria From 8ed24d67969bf7a5375c90da5855a898e5cd8211 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 27 May 2021 16:02:12 +0200 Subject: [PATCH 092/739] Add missing trigger LINERECEPTION_DELETE --- .../fournisseur.commande.dispatch.class.php | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 0f8b8341a3d..5457a9ee376 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -333,7 +333,6 @@ class CommandeFournisseurDispatch extends CommonObject */ public function update($user, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -411,12 +410,12 @@ class CommandeFournisseurDispatch extends CommonObject } if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you + // Call triggers $result = $this->call_trigger('LINERECEPTION_UPDATE', $user); if ($result < 0) { $error++; } - //// End call triggers + // End call triggers } } @@ -444,24 +443,22 @@ class CommandeFournisseurDispatch extends CommonObject */ public function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $this->db->begin(); if (!$error) { if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers + // Call triggers + $result = $this->call_trigger('LINERECEPTION_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers } } - // Remove extrafields + // Remove extrafields if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) { @@ -496,7 +493,6 @@ class CommandeFournisseurDispatch extends CommonObject } - /** * Load an object from its id and create a new one in database * From 48f5cea91776bd8f3c47d1c45847844d0f2956dc Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 27 May 2021 16:03:17 +0200 Subject: [PATCH 093/739] Fix update receipt eatby --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b8812cf22e..2c847b9a421 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -443,7 +443,7 @@ if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionne $product = $supplierorderdispatch->fk_product; $price = price2num(GETPOST('price'), '', 2); $comment = $supplierorderdispatch->comment; - $eatby = $supplierorderdispatch->fk_product; + $eatby = $supplierorderdispatch->eatby; $sellby = $supplierorderdispatch->sellby; $batch = $supplierorderdispatch->batch; From fd2d10d443d73816b78b35120d7d954b4a1ceb03 Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Thu, 27 May 2021 16:23:33 +0200 Subject: [PATCH 094/739] Update card.php --- htdocs/compta/facture/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index beb9463acab..c7c9202c18c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -67,7 +67,7 @@ if (!empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); +$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals','productbatch')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } @@ -2236,7 +2236,8 @@ if (empty($reshook)) { if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' Batch: '.$batchline->batch.' aantal: '.$batchline->qty; + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty',$batchline->qty).' '; + } } From dfb2e547500646ddd5563fa1cf4fc8e0fe5907c2 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 27 May 2021 14:25:42 +0000 Subject: [PATCH 095/739] Fixing style errors. --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c7c9202c18c..02fb8467e21 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2236,8 +2236,7 @@ if (empty($reshook)) { if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty',$batchline->qty).' '; - + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } } From 14fdd4d0c6ff9be688b683ae330f965e500993b7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 27 May 2021 16:43:49 +0200 Subject: [PATCH 096/739] fix rollback to rollbac --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 2abc830eb7c..4344c2c7e08 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -160,7 +160,7 @@ if ($action == 'update' && !empty($user->rights->stock->mouvement->creer)) { if (! $error) { $db->commit(); } else { - $db->rollbak(); + $db->rollback(); } } From 00d60aa65a94b6b2f2e580261bceb3163907b0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 16:54:41 +0200 Subject: [PATCH 097/739] doxygen --- .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 8f6d12df1d0..07961dd3500 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2010-2014 Laurent Destailleur * Copyright (C) 2015 Marcos García - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1062,7 +1062,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param FactureFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { From f1b32dce17dfc86dbaf8a8726a1758f02b10260f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 17:07:59 +0200 Subject: [PATCH 098/739] Update pdf_canelle.modules.php --- .../core/modules/supplier_invoice/doc/pdf_canelle.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 8f6d12df1d0..ed4f8ed6590 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -376,7 +376,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note = $nexY - $tab_top; From 4095c69582d5fc62bf15107283d6c38af4acb744 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 27 May 2021 21:09:49 +0200 Subject: [PATCH 099/739] Fix #17743 newpayement source membersubscription is member Fix #17743 newpayement source membersubscription is not valid anymore @eldy I'm not sure, but the bug may still occure with external module referring to membersubscription instead of member. --- htdocs/core/lib/payments.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 59d9eb4aa4c..4621e22d122 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -158,7 +158,7 @@ function getValidOnlinePaymentMethods($paymentmethod = '') /** * Return string with full online payment Url * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) * @param string $ref Ref of object * @return string Url string */ @@ -182,7 +182,7 @@ function showOnlinePaymentUrl($type, $ref) /** * Return string with HTML link for online payment * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) * @param string $ref Ref of object * @param string $label Text or HTML tag to display, if empty it display the URL * @return string Url string @@ -199,7 +199,7 @@ function getHtmlOnlinePaymentLink($type, $ref, $label = '') * Return string with full Url * * @param int $mode 0=True url, 1=Url formated with colors - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) + * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'member' ...) * @param string $ref Ref of object * @param int $amount Amount (required for $type='free' only) * @param string $freetag Free tag @@ -304,7 +304,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag } } elseif ($type == 'member' || $type == 'membersubscription') { $newtype = 'member'; - $out = $urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); + $out = $urltouse.'/public/payment/newpayment.php?source=member&ref='.($mode ? '' : ''); if ($mode == 1) { $out .= 'member_ref'; } From 52d44bd75e1413345a4a5b86d165734d94b01a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:28:59 +0200 Subject: [PATCH 100/739] fix warnings --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f90b5f4fdc..28c3152359c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8325,10 +8325,10 @@ class Form $nophoto = 'company'; } else { $nophoto = '/public/theme/common/user_anonymous.png'; - if ($object->gender == 'man') { + if (!empty($object->gender) && $object->gender == 'man') { $nophoto = '/public/theme/common/user_man.png'; } - if ($object->gender == 'woman') { + if (!empty($object->gender) && $object->gender == 'woman') { $nophoto = '/public/theme/common/user_woman.png'; } } From 3b381dccc3af3a71a608ab897034fb7e34c2cf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:33:25 +0200 Subject: [PATCH 101/739] fix warnings --- htdocs/comm/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 589559ea426..95ba96abd74 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -580,9 +580,9 @@ if ($object->id > 0) { print '
lastname).'" autofocus="autofocus">
firstname).'" autofocus="autofocus">
'.$langs->trans("Email").'*
'; $transfound = 0; $transkey = ''; - if (in_array($fieldlist[$field], array('label', 'libelle'))) // For label + if (in_array($fieldlist[$field], array('label', 'libelle')) and !empty($obj->code)) // For label { // Special case for labels if ($tabname == MAIN_DB_PREFIX.'c_civility') { From 60176f7f5ed78b0e43a2240cb286722280c1bde7 Mon Sep 17 00:00:00 2001 From: piernov Date: Mon, 24 May 2021 18:01:27 +0200 Subject: [PATCH 074/739] Fix add/del user to group modifies LDAP group Adding or removing a user from a group modifies the user object on Dolibarr's side. In LDAP however, members of a group are stored in the group itself. Therefore group must be updated after adding/removing a user from it. Update group in LDAP with new list of users at the end of USER_MODIFY trigger. --- ...interface_50_modLdap_Ldapsynchro.class.php | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index d0b91bcbe37..d92f4c3ecc4 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -126,6 +126,52 @@ class InterfaceLdapsynchro extends DolibarrTriggers $newparent = $object->_load_ldap_dn($info, 1); $result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent); + + if ($result > 0 && !empty($object->context['newgroupid'])) { // We are in context of adding a new group to user + $usergroup = new Usergroup($this->db); + + $usergroup->fetch($object->context['newgroupid']); + + $oldinfo = $usergroup->_load_ldap_info(); + $olddn = $usergroup->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container = $usergroup->_load_ldap_dn($oldinfo, 1); + $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; + $records = $ldap->search($container, $search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) + $dn = $usergroup->_load_ldap_dn($info); + + $result = $ldap->update($dn, $info, $user, $olddn); + } + + if ($result > 0 && !empty($object->context['oldgroupid'])) { // We are in context of removing a group from user + $usergroup = new Usergroup($this->db); + + $usergroup->fetch($object->context['oldgroupid']); + + $oldinfo = $usergroup->_load_ldap_info(); + $olddn = $usergroup->_load_ldap_dn($oldinfo); + + // Verify if entry exist + $container = $usergroup->_load_ldap_dn($oldinfo, 1); + $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; + $records = $ldap->search($container, $search); + if (count($records) && $records['count'] == 0) + { + $olddn = ''; + } + + $info = $usergroup->_load_ldap_info(); // Contains all members, except the old one (remove already done before trigger call) + $dn = $usergroup->_load_ldap_dn($info); + + $result = $ldap->update($dn, $info, $user, $olddn); + } } if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; From bad90240bc8b6fda2ecf88489af2ae4ec22f0cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 May 2021 21:39:50 +0200 Subject: [PATCH 075/739] Update pdf_cyan.modules.php --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 2b40dffa30e..4d2d159ec02 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -434,13 +434,12 @@ class pdf_cyan extends ModelePDFPropales $notetoshow = dol_concatdesc($notetoshow, $extranote); } - if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) - { + if (!empty($conf->global->MAIN_ADD_CREATOR_IN_NOTE) && $object->user_author_id > 0) { $tmpuser = new User($this->db); $tmpuser->fetch($object->user_author_id); $creator_info = $langs->trans("CaseFollowedBy").' '.$tmpuser->getFullName($langs); - if ($tmpuser->email) $creator_info .= ', Mail: '.$tmpuser->email; - if ($tmpuser->office_phone) $creator_info .= ', Tel: '.$tmpuser->office_phone; + if ($tmpuser->email) $creator_info .= ', '.$langs->trans("EMail").': '.$tmpuser->email; + if ($tmpuser->office_phone) $creator_info .= ', '.$langs->trans("Phone").': '.$tmpuser->office_phone; $notetoshow = dol_concatdesc($notetoshow, $creator_info); } From fe6b25ede698f047f6a4864d43c95080b73c6e05 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Wed, 26 May 2021 09:48:13 +0200 Subject: [PATCH 076/739] fix on $value --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5790811fc2e..3943a37e5a7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1902,10 +1902,10 @@ class ActionComm extends CommonObject } } if ($key == 'module') { - $sql .= " AND c.module LIKE '%".$value."'"; + $sql .= " AND c.module LIKE '%".$this->db->escape($value)."'"; } if ($key == 'status') { - $sql .= " AND a.status =".$value; + $sql .= " AND a.status =".((int) $value); } } From 1d5b8cbb19f82a4c6192ee1c66bd677f5ce2a9bc Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 26 May 2021 14:59:28 +0200 Subject: [PATCH 077/739] Fix Quadra accountancy export for due date --- htdocs/accountancy/class/accountancyexport.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 114d0edf35a..0459c20a380 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -498,9 +498,8 @@ class AccountancyExport $Tab['contrepartie'] = str_repeat(' ', 8); // elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting - if (!empty($data->date_echeance)) - //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); - $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy + if (!empty($data->date_lim_reglement)) + $Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%y'); // elarifr: format must be ddmmyy else $Tab['date_echeance'] = '000000'; From b3a6bcd34f6b66a69b8614eadb4d1b9b8c90da0c Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 26 May 2021 15:01:31 +0200 Subject: [PATCH 078/739] Fix Winfic accountancy export for due date --- htdocs/accountancy/class/accountancyexport.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 6fd3518689d..358d0e282c8 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -617,9 +617,8 @@ class AccountancyExport $Tab['code_stat'] = str_repeat(' ', 4); - if (!empty($data->date_echeance)) - //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); - $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y'); + if (!empty($data->date_lim_reglement)) + $Tab['date_echeance'] = dol_print_date($data->date_lim_reglement, '%d%m%Y'); else $Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y'); From 421681cda4c9ed77c8fefcaece3f18681a1fe01f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 May 2021 15:22:49 +0200 Subject: [PATCH 079/739] FIX Navigation in list of holiday Conflicts: htdocs/holiday/view_log.php --- htdocs/holiday/view_log.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 2f2e223c87c..86562ef5f96 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -323,7 +323,7 @@ if (!empty($arrayfields['cpl.fk_type']['checked'])) { // Filter: Previous balance if (!empty($arrayfields['cpl.prev_solde']['checked'])) { - print ''; + print ''; print ''; print ''; + print ''; print ''; print '
'; print ''; if ($action == 'edittransportmode') { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, (!empty($object->fk_transport_mode) ? $object->fk_transport_mode : ''), 'fk_transport_mode', 1); } else { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'none'); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, (!empty($object->fk_transport_mode) ? $object->fk_transport_mode : ''), 'none'); } print ""; print ''; From e1a427f1601bc2aa1224ee95e3f9034505cdeeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:40:26 +0200 Subject: [PATCH 102/739] fix warnings --- htdocs/comm/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 589559ea426..ce7d4242b6b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -874,6 +874,7 @@ if ($object->id > 0) { $sql .= ", c.total_ttc"; $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture"; $sql .= ", c.date_commande as dc"; + $sql .= ", c.facture as billed"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; $sql .= " WHERE c.fk_soc = s.rowid "; $sql .= " AND s.rowid = ".$object->id; From 0b6457d83fae635dab80a6f65f21c24a8117aa83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:44:05 +0200 Subject: [PATCH 103/739] fix warning --- htdocs/holiday/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index b00abadb9c3..dbc4b78be1a 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -722,6 +722,7 @@ if ($resql) { $i = 0; $totalarray = array(); + $totalarray['nbfield'] = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); From 4c1503a93bd825c1ec3571729104f9abda1cd60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:50:56 +0200 Subject: [PATCH 104/739] fix warnings --- htdocs/expensereport/class/expensereport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 25ee6072a90..34bef81e5a2 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (c) 2018 Frédéric France + * Copyright (c) 2018-2021 Frédéric France * Copyright (C) 2016-2020 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -2478,9 +2478,9 @@ class ExpenseReport extends CommonObject $now = dol_now(); if ($option == 'toapprove') { - return ($this->datevalid ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); + return (!empty($this->datevalid) ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); } else { - return ($this->datevalid ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); + return (!empty($this->datevalid) ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); } } From d0b8a80c7a59cc87926aa1650db633a51e61cf79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 22:56:20 +0200 Subject: [PATCH 105/739] fix warning --- htdocs/core/tpl/commonfields_add.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 639be537dba..3a43f04c149 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -82,7 +82,7 @@ foreach ($object->fields as $key => $val) { } else { $value = GETPOST($key, 'alphanohtml'); } - if ($val['noteditable']) { + if (!empty($val['noteditable'])) { print $object->showOutputField($val, $key, $value, '', '', '', 0); } else { print $object->showInputField($val, $key, $value, '', '', '', 0); From ca0654323f0ab7da9e2000af21f289eeb4c481c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 May 2021 23:11:05 +0200 Subject: [PATCH 106/739] fix warnings --- htdocs/core/class/commonobject.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3f4b2dd9ee6..32cffe9e4f8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6397,7 +6397,7 @@ abstract class CommonObject $param = array(); $param['options'] = array(); $reg = array(); - $size = $this->fields[$key]['size']; + $size = !empty($this->fields[$key]['size']) ? $this->fields[$key]['size'] : 0; // Because we work on extrafields if (preg_match('/^(integer|link):(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) { $param['options'] = array($reg[2].':'.$reg[3].':'.$reg[4].':'.$reg[5] => 'N'); @@ -6430,21 +6430,21 @@ abstract class CommonObject } // Special case that force options and type ($type can be integer, varchar, ...) - if (is_array($this->fields[$key]['arrayofkeyval'])) { + if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { $param['options'] = $this->fields[$key]['arrayofkeyval']; $type = 'select'; } $label = $this->fields[$key]['label']; //$elementtype=$this->fields[$key]['elementtype']; // Seems not used - $default = $this->fields[$key]['default']; - $computed = $this->fields[$key]['computed']; - $unique = $this->fields[$key]['unique']; - $required = $this->fields[$key]['required']; - $autofocusoncreate = $this->fields[$key]['autofocusoncreate']; + $default = (!empty($this->fields[$key]['default']) ? $this->fields[$key]['default'] : ''); + $computed = (!empty($this->fields[$key]['computed']) ? $this->fields[$key]['computed'] : ''); + $unique = (!empty($this->fields[$key]['unique']) ? $this->fields[$key]['unique'] : 0); + $required = (!empty($this->fields[$key]['required']) ? $this->fields[$key]['required'] : 0); + $autofocusoncreate = (!empty($this->fields[$key]['autofocusoncreate']) ? $this->fields[$key]['autofocusoncreate'] : 0); - $langfile = $this->fields[$key]['langfile']; - $list = $this->fields[$key]['list']; + $langfile = (!empty($this->fields[$key]['langfile']) ? $this->fields[$key]['langfile'] : ''); + $list = (!empty($this->fields[$key]['list']) ? $this->fields[$key]['list'] : 0); $hidden = (in_array(abs($this->fields[$key]['visible']), array(0, 2)) ? 1 : 0); $objectid = $this->id; From e87d1750415679b2556f961fedd0c2aa64775446 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 28 May 2021 09:57:21 +0200 Subject: [PATCH 107/739] Fix inventory/inventory.php --- htdocs/langs/en_US/stocks.lang | 1 + htdocs/product/inventory/inventory.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 93cf9e9e037..977aab588a2 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -255,3 +255,4 @@ MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity ShowAllBatchByDefault=By default, show batch details on product "stock" tab CollapseBatchDetailHelp=You can set batch detail default display in stocks module configuration +FieldCannotBeNegative=Field "%s" cannot be negative \ No newline at end of file diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 2abc830eb7c..212f0404bd9 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -185,8 +185,11 @@ if ($action =='updateinventorylines' && $permissiontoadd) { if (GETPOST("id_".$lineid, 'alpha') != '') { // If a value was set ('0' or something else) $qtytoupdate = price2num(GETPOST("id_".$lineid, 'alpha'), 'MS'); - $result = $inventoryline->fetch($lineid); + if ($qtytoupdate < 0) { + $result = -1; + setEventMessages($langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv("RealQty")), null, 'errors'); + } if ($result > 0) { $inventoryline->qty_view = $qtytoupdate; $resultupdate = $inventoryline->update($user); @@ -251,7 +254,10 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); } - + if (GETPOST('qtytoadd') < 0) { + $error++; + setEventMessages($langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv("RealQty")), null, 'errors'); + } if (!$error && !empty($conf->productbatch->enabled)) { $tmpproduct = new Product($db); $result = $tmpproduct->fetch($fk_product); @@ -654,7 +660,7 @@ if ($object->id > 0) { // Real quantity print ''; if ($object->status == $object::STATUS_VALIDATED) { - $qty_view = GETPOST("id_".$obj->rowid) ? GETPOST("id_".$obj->rowid) : $obj->qty_view; + $qty_view = GETPOST("id_".$obj->rowid) && GETPOST("id_".$obj->rowid) >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view; $totalfound += price2num($qty_view, 'MS'); print ''; print ''; From e3a5abe20e9e1c1941d489f936b8e06edb921770 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 28 May 2021 10:02:48 +0200 Subject: [PATCH 108/739] Fix error name of menu knowledge management system --- htdocs/langs/en_US/knowledgemanagement.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index 269007e60f8..68f5cced76c 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -47,7 +47,7 @@ KnowledgeManagementArea = Knowledge Management # Menu # MenuKnowledgeRecord = Knowledge base -ListOfArticles = List of articles +ListKnowledgeRecord = List of articles NewKnowledgeRecord = New article ValidateReply = Validate solution KnowledgeRecords = Articles From 05a966b93e2834a6c946dbbb00885d0c0aafe06e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 28 May 2021 10:29:46 +0200 Subject: [PATCH 109/739] Fix of a bug on mass mailing --- htdocs/comm/mailing/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 86aff8a36e0..73f31f34f01 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -677,6 +677,7 @@ if (empty($reshook)) { $form = new Form($db); $htmlother = new FormOther($db); +$object->fetch($id); $help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; llxHeader( '', From 11bbd2ace33c58e236ea5cb25b9a612df8fcf7f8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 28 May 2021 10:31:54 +0200 Subject: [PATCH 110/739] fix: bad GETPOST test on payment module configuration --- htdocs/comm/propal/note.php | 2 +- htdocs/paybox/admin/paybox.php | 6 +++--- htdocs/paypal/admin/paypal.php | 6 +++--- htdocs/stripe/admin/stripe.php | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 06be1179fb1..cb91a85da5f 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -53,7 +53,7 @@ $object = new Propal($db); $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index a342e58b971..b5b45dc3891 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -58,11 +58,11 @@ if ($action == 'setvalue' && $user->admin) if (!$result > 0) $error++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index b16748f66b4..7d1c9879b9c 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -61,11 +61,11 @@ if ($action == 'setvalue' && $user->admin) if (!$result > 0) $error++; $result = dolibarr_set_const($db, "PAYPAL_ADD_PAYMENT_URL", GETPOST('PAYPAL_ADD_PAYMENT_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index c304a00ce3f..25343265a5f 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -92,13 +92,13 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_FORM", GETPOST('ONLINE_PAYMENT_MESSAGE_FORM', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_OK", GETPOST('ONLINE_PAYMENT_MESSAGE_OK', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; - $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'alpha'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "ONLINE_PAYMENT_MESSAGE_KO", GETPOST('ONLINE_PAYMENT_MESSAGE_KO', 'restricthtml'), 'chaine', 0, '', $conf->entity); if (!$result > 0) $error++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_SENDEMAIL", GETPOST('ONLINE_PAYMENT_SENDEMAIL'), 'chaine', 0, '', $conf->entity); From c4f7a8194c1b521852b61f6d776cf2db09d0f549 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 28 May 2021 10:32:53 +0200 Subject: [PATCH 111/739] remove space --- htdocs/comm/propal/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index cb91a85da5f..06be1179fb1 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -53,7 +53,7 @@ $object = new Propal($db); $permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once From fed5db032a0e83b1c87d6063a2779e7659175b23 Mon Sep 17 00:00:00 2001 From: Matthias Haberl Date: Fri, 28 May 2021 11:26:55 +0200 Subject: [PATCH 112/739] Fix label of subaccount --- htdocs/accountancy/bookkeeping/listbysubaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 129e695de3c..43d4acf343f 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -682,7 +682,7 @@ while ($i < min($num, $limit)) { print ""; print ''; if ($line->subledger_account != "" && $line->subledger_account != '-1') { - print $object->get_compte_desc($line->numero_compte).' : '.length_accounta($line->subledger_account); + print $line->subledger_label.' : '.length_accounta($line->subledger_account); } else { // Should not happen: subledger account must be null or a non empty value print ''.$langs->trans("Unknown"); From 81a94f5642b22507a07b82085412854b57d4f1d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 28 May 2021 18:04:45 +0200 Subject: [PATCH 113/739] FIX option MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE --- .../doc/pdf_aurore.modules.php | 2 +- htdocs/product/class/product.class.php | 32 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index e9e2179823b..3da4d72746b 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -239,7 +239,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { - $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; + $pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product'); $dir = $conf->product->dir_output.'/'.$pdir; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 685180e4659..1e60a0f63d3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5208,11 +5208,11 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Retourne tableau de toutes les photos du produit + * Return an array with all photos of product found on disk. There is no sorting criteria. * - * @param string $dir Repertoire a scanner - * @param int $nbmax Nombre maximum de photos (0=pas de max) - * @return array Tableau de photos + * @param string $dir Directory to scan + * @param int $nbmax Number maxium of photos (0=no maximum) + * @return array Array of photos */ public function liste_photos($dir, $nbmax = 0) { @@ -5226,16 +5226,17 @@ class Product extends CommonObject $dir_osencoded = dol_osencode($dir); $handle = @opendir($dir_osencoded); if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) - { - if (!utf8_check($file)) { $file = utf8_encode($file); // readdir returns ISO + while (($file = readdir($handle)) !== false) { + if (!utf8_check($file)) { + $file = utf8_encode($file); // readdir returns ISO } if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) { $nbphoto++; - // On determine nom du fichier vignette + // We forge name of thumb. $photo = $file; $photo_vignette = ''; + $regs = array(); if (preg_match('/('.$this->regeximgext.')$/i', $photo, $regs)) { $photo_vignette = preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0]; } @@ -5245,14 +5246,17 @@ class Product extends CommonObject // Objet $obj = array(); $obj['photo'] = $photo; - if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) { $obj['photo_vignette'] = 'thumbs/'.$photo_vignette; - } else { $obj['photo_vignette'] = ""; + if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) { + $obj['photo_vignette'] = 'thumbs/'.$photo_vignette; + } else { + $obj['photo_vignette'] = ""; } $tabobj[$nbphoto - 1] = $obj; - // On continue ou on arrete de boucler ? - if ($nbmax && $nbphoto >= $nbmax) { break; + // Do we have to continue with next photo ? + if ($nbmax && $nbphoto >= $nbmax) { + break; } } } @@ -5265,9 +5269,9 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Efface la photo du produit et sa vignette + * Delete a photo and its thumbs * - * @param string $file Chemin de l'image + * @param string $file Path to image file * @return void */ public function delete_photo($file) From f33869bf1c9432cb3a0f65c2daa14c9aac1cdebc Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 28 May 2021 18:08:01 +0200 Subject: [PATCH 114/739] fix: uploaddir for productlot --- htdocs/product/stock/productlot_document.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 5b19288deff..820ad4d38bb 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -94,7 +94,9 @@ $usercanread = $user->rights->produit->lire; $usercancreate = $user->rights->produit->creer; $usercandelete = $user->rights->produit->supprimer; -$upload_dir = $conf->productbatch->multidir_output[$conf->entity]; +if (empty($upload_dir)) { + $upload_dir = $conf->productbatch->multidir_output[$conf->entity]; +} $permissiontoread = $usercanread; $permissiontoadd = $usercancreate; From ab4941a558ff55ce00aabbc7bab1807216abd0c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 May 2021 02:22:30 +0200 Subject: [PATCH 115/739] Fix not visible button when missing permission --- htdocs/fichinter/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 0b919c3eb4b..84c4fd61c62 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1606,8 +1606,9 @@ if ($action == 'create') // Validate if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) { - print ''; + print ''; + } else { + print '
'.$langs->trans("Validate").'
'; } } @@ -1640,7 +1641,7 @@ if ($action == 'create') } } - // create intervention model + // Create intervention model if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { print '
'; print ''.$langs->trans("ChangeIntoRepeatableIntervention").''; From baea57ec05617e8f95b6b1898ad2e5f434d18e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 May 2021 08:38:07 +0200 Subject: [PATCH 116/739] force reload css after activate/desactivate module --- htdocs/admin/modules.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1a6d99261bd..5dc660adb9b 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -8,6 +8,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -246,6 +247,7 @@ if ($action == 'install') { if ($action == 'set' && $user->admin) { $resarray = activateModule($value); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); if (!empty($resarray['errors'])) { setEventMessages('', $resarray['errors'], 'errors'); } else { @@ -269,6 +271,7 @@ if ($action == 'set' && $user->admin) { exit; } elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') { $result = unActivateModule($value); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); if ($result) { setEventMessages($result, null, 'errors'); } From ab64f467f52c5e9f62d7d6cb510868355e777b1a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 31 May 2021 09:31:38 +0200 Subject: [PATCH 117/739] add of a new param in selectGroupTicket --- htdocs/core/class/html.formticket.class.php | 244 ++++++++++++++------ 1 file changed, 174 insertions(+), 70 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 3cec6c19789..23c220d43df 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -569,90 +569,194 @@ class FormTicket * @param int $noadmininfo 0=Add admin info, 1=Disable admin info * @param int $maxlength Max length of label * @param string $morecss More CSS + * @param int $use_multilevel if != 0 create a multilevel select ( Do not use any of the other params) * @return void */ - public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') + public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '', $use_multilevel = 0) { global $langs, $user; - $ticketstat = new Ticket($this->db); + if ($use_multilevel == 0) { + $ticketstat = new Ticket($this->db); - dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); + dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - $ticketstat->loadCacheCategoriesTickets(); + $ticketstat->loadCacheCategoriesTickets(); - print ''; + if ($empty) { + print ''; + } - if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) { - foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) { - // Exclude some record - if ($filtertype == 'public=1') { - if (empty($arraycategories['public'])) { + if (is_array($ticketstat->cache_category_tickets) && count($ticketstat->cache_category_tickets)) { + foreach ($ticketstat->cache_category_tickets as $id => $arraycategories) { + // Exclude some record + if ($filtertype == 'public=1') { + if (empty($arraycategories['public'])) { + continue; + } + } + + // We discard empty line if showempty is on because an empty line has already been output. + if ($empty && empty($arraycategories['code'])) { continue; } + + if ($format == 0) { + print ''; } - - // We discard empty line if showempty is on because an empty line has already been output. - if ($empty && empty($arraycategories['code'])) { - continue; - } - - if ($format == 0) { - print ''; } - } - print ''; - if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } + print ''; + if ($user->admin && !$noadmininfo) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } - print ajax_combobox('select'.$htmlname); + print ajax_combobox('select'.$htmlname); + } else { + $groupticket=GETPOST('groupticket', 'aZ09'); + $groupticketchild=GETPOST('groupticket_child', 'aZ09'); + $arraycodenotparent[] = ""; + $stringtoprint = ''.$langs->trans("GroupOfTicket").' '; + $stringtoprint .= ''; + } + $stringtoprint .= ' '; + + $stringtoprint .= ''; + + $stringtoprint .=''; + return $stringtoprint; + } } /** From 2c6eee2528b0fc0f0edf4d7a73e297a44f525f6e Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 31 May 2021 10:26:05 +0200 Subject: [PATCH 118/739] Update llx_00_c_country.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Roumanie -> Romania Rwanda = Rwanda Sainte-Hélène -> Saint Helena Saint-Christophe-et-Niévès -> Saint Kitts and Nevis Sainte-Lucie -> Saint Lucia Saint-Pierre-et-Miquelon -> Saint Pierre and Miquelon Saint-Vincent-et-les-Grenadines -> Saint Vincent and the Grenadines Samoa = Samoa Saint-Marin -> San Marino Sao Tomé-et-Principe -> Saint Thomas and Prince Serbie -> Serbia Seychelles = Seychelles Sierra Leone = Sierra Leone Slovaquie -> Slovakia Slovénie -> Slovenia --- .../install/mysql/data/llx_00_c_country.sql | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 677447f1af2..1e2e8b69c39 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -216,21 +216,21 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (18 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (184,'PL','POL','Pologne',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (185,'PR','PRI','Puerto Rico',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (186,'QA','QAT','Qatar',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (188,'RO','ROU','Roumanie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (188,'RO','ROU','Romania',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (189,'RW','RWA','Rwanda',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (190,'SH','SHN','Sainte-Hélène',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (191,'KN','KNA','Saint-Christophe-et-Niévès',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (192,'LC','LCA','Sainte-Lucie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (193,'PM','SPM','Saint-Pierre-et-Miquelon',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (194,'VC','VCT','Saint-Vincent-et-les-Grenadines',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (190,'SH','SHN','Saint Helena',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (191,'KN','KNA','Saint Kitts and Nevis',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (192,'LC','LCA','Saint Lucia',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (193,'PM','SPM','Saint Pierre and Miquelon',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (194,'VC','VCT','Saint Vincent and the Grenadines',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (195,'WS','WSM','Samoa',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (196,'SM','SMR','Saint-Marin',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (197,'ST','STP','Sao Tomé-et-Principe',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (198,'RS','SRB','Serbie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (196,'SM','SMR','San Marino ',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (197,'ST','STP','Saint Thomas and Prince',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (198,'RS','SRB','Serbia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (199,'SC','SYC','Seychelles',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (200,'SL','SLE','Sierra Leone',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovaquie',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovénie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovakia',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovenia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Iles Salomon',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalie',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','South Africa',1,0); From a97efdbdfa12ef4e121a556c3b5ed64822abd670 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 31 May 2021 10:31:25 +0200 Subject: [PATCH 119/739] Update list.php $title = $langs->trans('Supplier')." - ".$langs->trans('ProductsAndServices'); --- htdocs/fourn/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index f411d70af25..ed137fd5d86 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -121,7 +121,7 @@ $form = new Form($db); $productstatic = new Product($db); $companystatic = new Societe($db); -$title = $langs->trans("ProductsAndServices"); +$title = $langs->trans('Supplier')." - ".$langs->trans('ProductsAndServices'); if ($fourn_id) { $supplier = new Fournisseur($db); From fed7878d18ad9273560129fdaffdfd27f1f61645 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 31 May 2021 10:33:36 +0200 Subject: [PATCH 120/739] Update card.php $lineid was duplicate --- htdocs/fourn/commande/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8c4aa1e2a54..21cd61536ee 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -70,8 +70,6 @@ $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); $lineid = GETPOST('lineid', 'int'); - -$lineid = GETPOST('lineid', 'int'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility From 7aae5be54a86d704d63ea61bf5bf878cc3b78e9a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 31 May 2021 10:36:43 +0200 Subject: [PATCH 121/739] Update card.php --- htdocs/fourn/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0bc26ea8f2b..86cd9e439f9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1791,8 +1791,8 @@ if (!empty($conf->projet->enabled)) { $now = dol_now(); $title = $langs->trans('SupplierInvoice')." - ".$langs->trans('Card'); -$helpurl = "EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores"; -llxHeader('', $title, $helpurl); +$help_url = 'EN:Module_Suppliers_Invoices|FR:Module_Fournisseurs_Factures|ES:Módulo_Facturas_de_proveedores|DE:Modul_Lieferantenrechnungen'; +llxHeader('', $title, $help_url); // Mode creation if ($action == 'create') { From 55d48077a32301e509aa67925d19f07c11287e91 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 31 May 2021 09:26:53 +0200 Subject: [PATCH 122/739] ADD note to supplier order refusal --- .../interface_50_modAgenda_ActionsAuto.class.php | 7 ++++++- htdocs/fourn/commande/card.php | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 8e98030b484..3c7c8cb6e1c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -544,13 +544,18 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_REFUSE') { // Load translation files required by the page - $langs->loadLangs(array("agenda", "other", "orders")); + $langs->loadLangs(array("agenda", "other", "orders", "main")); if (empty($object->actionmsg2)) { $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); } $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); + if (!empty($object->refuse_note)) { + $object->actionmsg .= '
'; + $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; + } + $object->sendtoid = 0; } elseif ($action == 'ORDER_SUPPLIER_SUBMIT') { // Load translation files required by the page diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8c4aa1e2a54..d5ff9bc229f 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -960,6 +960,9 @@ if (empty($reshook)) { } if ($action == 'confirm_refuse' && $confirm == 'yes' && $usercanapprove) { + if (GETPOST('refuse_note')) { + $object->refuse_note = GETPOST('refuse_note'); + } $result = $object->refuse($user); if ($result > 0) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); @@ -1875,7 +1878,16 @@ if ($action == 'create') { // Confirmation de la desapprobation if ($action == 'refuse') { - $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", '', 0, 1); + $formquestion = array( + array( + 'type' => 'text', + 'name' => 'refuse_note', + 'label' => $langs->trans("MotifCP"), + 'value' => '', + 'morecss' => 'minwidth300' + ) + ); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=$object->id", $langs->trans("DenyingThisOrder"), $langs->trans("ConfirmDenyingThisOrder", $object->ref), "confirm_refuse", $formquestion, 0, 1); } // Confirmation de l'annulation From e1de510c389396730d4aef03ccecd780b226f3c3 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Mon, 31 May 2021 11:06:52 +0200 Subject: [PATCH 123/739] Do a strict comparison when check if stock is enough --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2429a4c09c5..ec2dfbc257e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -355,7 +355,7 @@ class MouvementStock extends CommonObject $qtyisnotenough = 0; foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) { - if ($batch != $batchcursor) continue; + if ($batch !== $batchcursor) continue; // Do a strict comparison because $batchcursar can be an integer $foundforbatch = 1; if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; break; From 90ae16372c7d2cc0a6d8939b224230b267909744 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Mon, 31 May 2021 12:11:16 +0200 Subject: [PATCH 124/739] add missing hooks in societe list.php --- htdocs/societe/list.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0df74bc166e..fe55d05dda4 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -429,6 +429,10 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_stcomm as st ON s.fk_stcomm = st.id"; // We'll need this table joined to the select in order to filter by sale if ($search_sale == -2) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; elseif ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($search_sale && $search_sale != -2) $sql .= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale @@ -490,6 +494,11 @@ if (empty($reshook)) { } $sql .= $hookmanager->resPrint; +// Add GroupBy from hooks +$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); // Count total nb of records From 2dc9ca334fa7ae9115847ee36bc7ffa2ed65c9ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 May 2021 23:36:37 +0200 Subject: [PATCH 125/739] CSS --- htdocs/admin/system/filecheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 50b27b30964..212fcc6228a 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -122,7 +122,7 @@ if (dol_is_file($xmlfile)) { print ''."\n"; if ($enableremotecheck) { print ' = '; - print '
'; + print '
'; } else { print ' '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote); if (!GETPOST('xmlremote')) { From 9d44df8a64e0857e0647ba08312a7301500f03f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Jun 2021 00:05:43 +0200 Subject: [PATCH 126/739] Fix escape --- htdocs/societe/list.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 0a3e9207a96..48cc882c052 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1405,7 +1405,7 @@ while ($i < min($num, $limit)) { } if (!empty($arrayfields['s.name_alias']['checked'])) { print ''; - print $companystatic->name_alias; + print dol_escape_htmltag($companystatic->name_alias); print "\n"; if (!$i) { $totalarray['nbfield']++; @@ -1413,70 +1413,70 @@ while ($i < min($num, $limit)) { } // Barcode if (!empty($arrayfields['s.barcode']['checked'])) { - print ''.$obj->barcode.''; + print ''.dol_escape_htmltag($obj->barcode).''; if (!$i) { $totalarray['nbfield']++; } } // Customer code if (!empty($arrayfields['s.code_client']['checked'])) { - print ''.$obj->code_client.''; + print ''.dol_escape_htmltag($obj->code_client).''; if (!$i) { $totalarray['nbfield']++; } } // Supplier code if (!empty($arrayfields['s.code_fournisseur']['checked'])) { - print ''.$obj->code_fournisseur.''; + print ''.dol_escape_htmltag($obj->code_fournisseur).''; if (!$i) { $totalarray['nbfield']++; } } // Account customer code if (!empty($arrayfields['s.code_compta']['checked'])) { - print ''.$obj->code_compta.''; + print ''.dol_escape_htmltag($obj->code_compta).''; if (!$i) { $totalarray['nbfield']++; } } // Account supplier code if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) { - print ''.$obj->code_compta_fournisseur.''; + print ''.dol_escape_htmltag($obj->code_compta_fournisseur).''; if (!$i) { $totalarray['nbfield']++; } } // Address if (!empty($arrayfields['s.address']['checked'])) { - print ''.$obj->address.''; + print ''.dol_escape_htmltag($obj->address).''; if (!$i) { $totalarray['nbfield']++; } } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print "".$obj->zip."\n"; + print "".dol_escape_htmltag($obj->zip)."\n"; if (!$i) { $totalarray['nbfield']++; } } // Town if (!empty($arrayfields['s.town']['checked'])) { - print "".$obj->town."\n"; + print ''.dol_escape_htmltag($obj->town)."\n"; if (!$i) { $totalarray['nbfield']++; } } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "".$obj->state_name."\n"; + print "".dol_escape_htmltag($obj->state_name)."\n"; if (!$i) { $totalarray['nbfield']++; } } // Region if (!empty($arrayfields['region.nom']['checked'])) { - print "".$obj->region_name."\n"; + print "".dol_escape_htmltag($obj->region_name)."\n"; if (!$i) { $totalarray['nbfield']++; } From d18c1ea0c0177618397c28996fde3e288eabf86b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Jun 2021 00:41:51 +0200 Subject: [PATCH 127/739] css --- htdocs/cron/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 2132cbc141b..28fa0287f0c 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -600,7 +600,7 @@ if ($num > 0) { print ''; // Output of last run - print ''; + print ''; if (!empty($obj->lastoutput)) { print dol_trunc(nl2br($obj->lastoutput), 50); } From a5c2ce1727044a141cbdc228c3f6680ac8115179 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 1 Jun 2021 08:45:45 +0200 Subject: [PATCH 128/739] NEW/FIX : Allow auto picking for child warehouse and taking into account of the quantities already affected in list --- htdocs/expedition/card.php | 118 +++++++++++++++++++++++++++-- htdocs/langs/en_US/deliveries.lang | 1 + htdocs/langs/fr_FR/deliveries.lang | 1 + 3 files changed, 114 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index cc441d9f50f..8d4ed510449 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1020,7 +1020,11 @@ if ($action == 'create') { // Load shipments already done for same order $object->loadExpeditions(); - if ($numAsked) { + + $alreadyQtyBatchSetted = $alreadyQtySetted = array(); + + if ($numAsked) + { print ''; print ''.$langs->trans("Description").''; print ''.$langs->trans("QtyOrdered").''; @@ -1044,6 +1048,15 @@ if ($action == 'create') { print "\n"; } + $warehouse_id = GETPOST('entrepot_id', 'int'); + $warehousePicking = array(); + // get all warehouse children for picking + if($warehouse_id > 0){ + $warehousePicking[] = $warehouse_id; + $warehouseObj = new Entrepot($db); + $warehouseObj->get_children_warehouses($warehouse_id,$warehousePicking); + } + $indiceAsked = 0; while ($indiceAsked < $numAsked) { $product = new Product($db); @@ -1293,6 +1306,12 @@ if ($action == 'create') { $subj = 0; // Define nb of lines suggested for this order line $nbofsuggested = 0; + + uasort ( $product->stock_warehouse , function ($a, $b){ + if ($a->real == $b->real) { return 0; } + return ($a->real < $b->real) ? -1 : 1; + }); + foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { if ($stock_warehouse->real > 0) { $nbofsuggested++; @@ -1300,6 +1319,12 @@ if ($action == 'create') { } $tmpwarehouseObject = new Entrepot($db); foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { // $stock_warehouse is product_stock + + if(!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)){ + // if a warehouse was selected by user, picking is limited to this warehouse and his children + continue; + } + $tmpwarehouseObject->fetch($warehouse_id); if ($stock_warehouse->real > 0) { $stock = + $stock_warehouse->real; // Convert it to number @@ -1309,7 +1334,32 @@ if ($action == 'create') { print ''; print ''; if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print ''; + if(isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])){ + $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]); + } + else{ + if(!isset($alreadyQtySetted[$line->fk_product])){ + $alreadyQtySetted[$line->fk_product] = array(); + } + + $deliverableQty = min($quantityToBeDelivered, $stock); + } + + if ($deliverableQty < 0) $deliverableQty = 0; + + $tooltip = ''; + if(!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])){ + $tooltip = ' class="classfortooltip" title="'.$langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].'" '; + } + + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]; + + $inputName = 'qtyl'.$indiceAsked.'_'.$subj; + if(GETPOSTISSET($inputName)){ + $deliverableQty = GETPOST($inputName, 'int'); + } + + print ''; print ''; } else { print $langs->trans("NA"); @@ -1366,6 +1416,12 @@ if ($action == 'create') { $tmpwarehouseObject = new Entrepot($db); $productlotObject = new Productlot($db); + + uasort ( $product->stock_warehouse , function ($a, $b){ + if ($a->real == $b->real) { return 0; } + return ($a->real < $b->real) ? -1 : 1; + }); + // Define nb of lines suggested for this order line $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { @@ -1373,18 +1429,68 @@ if ($action == 'create') { foreach ($stock_warehouse->detail_batch as $dbatch) { $nbofsuggested++; } + + // Sort Batch priority + uasort($stock_warehouse->detail_batch, function ($a, $b) { + $compare = 0; + $multiplePow = 0; + // The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. + + // PRIORITY FOR QTY : Eliminate place with small qty first + $multiplePow++; + $multiple = pow(10, $multiplePow); + $compare += (($a->qty < $b->qty) ? -1 : 1) * $multiple; + + // PRIORITY FOR SELL EXPIRATION DATE + $multiplePow++; + $multiple = pow(10, $multiplePow); + $compare += (($a->sellby < $b->sellby) ? -1 : 1) * $multiple; + + // PRIORITY FOR CONSUMPTION EXPIRATION DATE + $multiplePow++; + $multiple = pow(10, $multiplePow); + $compare += (($a->eatby < $b->eatby) ? -1 : 1) * $multiple; + + return $compare; + }); } } + foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { $tmpwarehouseObject->fetch($warehouse_id); if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { foreach ($stock_warehouse->detail_batch as $dbatch) { - //var_dump($dbatch); + $batchStock = + $dbatch->qty; // To get a numeric - $deliverableQty = min($quantityToBeDelivered, $batchStock); - if ($deliverableQty < 0) { - $deliverableQty = 0; + if(isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])){ + $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]); } + else{ + if(!isset($alreadyQtyBatchSetted[$line->fk_product])){ + $alreadyQtyBatchSetted[$line->fk_product] = array(); + } + + if(!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])){ + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array(); + } + + $deliverableQty = min($quantityToBeDelivered, $batchStock); + } + + if ($deliverableQty < 0) $deliverableQty = 0; + + $inputName = 'qtyl'.$indiceAsked.'_'.$subj; + if(GETPOSTISSET($inputName)){ + $deliverableQty = GETPOST($inputName, 'int'); + } + + $tooltip = ''; + if(!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])){ + $tooltip = ' class="classfortooltip" title="'.$langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)].'" '; + } + + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]; + print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang index fdfd6404a8a..cd8a36e6c70 100644 --- a/htdocs/langs/en_US/deliveries.lang +++ b/htdocs/langs/en_US/deliveries.lang @@ -30,3 +30,4 @@ NonShippable=Not Shippable ShowShippableStatus=Show shippable status ShowReceiving=Show delivery receipt NonExistentOrder=Nonexistent order +StockQuantitiesAlreadyAllocatedOnPreviousLines = Stock quantities already allocated on previous lines diff --git a/htdocs/langs/fr_FR/deliveries.lang b/htdocs/langs/fr_FR/deliveries.lang index bd13cce814c..6af98a54d4f 100644 --- a/htdocs/langs/fr_FR/deliveries.lang +++ b/htdocs/langs/fr_FR/deliveries.lang @@ -30,3 +30,4 @@ NonShippable=Non expédiable ShowShippableStatus=Afficher le statut Expédiable ShowReceiving=Afficher le bon de réception NonExistentOrder=Commande inexistante +StockQuantitiesAlreadyAllocatedOnPreviousLines = Qtés de stock déja attribuées sur une ou des lignes précédentes From cf9c9ec8825e5db3da054b9ecb8eeade7126eb9b Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 1 Jun 2021 09:07:05 +0200 Subject: [PATCH 129/739] fix condition --- htdocs/expedition/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8d4ed510449..64d554b9780 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1155,10 +1155,9 @@ if ($action == 'create') { } else { $quantityToBeDelivered = $quantityAsked - $quantityDelivered; } - $warehouse_id = GETPOST('entrepot_id', 'int'); $warehouseObject = null; - if ($warehouse_id > 0 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection + if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection print ''; //ship from preselected location $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number From 3cc65989c1eee25920d816aa8b50efd5d65f52ea Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 1 Jun 2021 07:25:29 +0000 Subject: [PATCH 130/739] Fixing style errors. --- htdocs/expedition/card.php | 45 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 64d554b9780..543a67311f0 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1021,10 +1021,9 @@ if ($action == 'create') { $object->loadExpeditions(); - $alreadyQtyBatchSetted = $alreadyQtySetted = array(); + $alreadyQtyBatchSetted = $alreadyQtySetted = array(); - if ($numAsked) - { + if ($numAsked) { print ''; print ''.$langs->trans("Description").''; print ''.$langs->trans("QtyOrdered").''; @@ -1049,12 +1048,12 @@ if ($action == 'create') { } $warehouse_id = GETPOST('entrepot_id', 'int'); - $warehousePicking = array(); - // get all warehouse children for picking - if($warehouse_id > 0){ + $warehousePicking = array(); + // get all warehouse children for picking + if ($warehouse_id > 0) { $warehousePicking[] = $warehouse_id; $warehouseObj = new Entrepot($db); - $warehouseObj->get_children_warehouses($warehouse_id,$warehousePicking); + $warehouseObj->get_children_warehouses($warehouse_id, $warehousePicking); } $indiceAsked = 0; @@ -1306,7 +1305,7 @@ if ($action == 'create') { // Define nb of lines suggested for this order line $nbofsuggested = 0; - uasort ( $product->stock_warehouse , function ($a, $b){ + uasort( $product->stock_warehouse, function ($a, $b) { if ($a->real == $b->real) { return 0; } return ($a->real < $b->real) ? -1 : 1; }); @@ -1318,8 +1317,7 @@ if ($action == 'create') { } $tmpwarehouseObject = new Entrepot($db); foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { // $stock_warehouse is product_stock - - if(!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)){ + if (!empty($warehousePicking) && !in_array($warehouse_id, $warehousePicking)) { // if a warehouse was selected by user, picking is limited to this warehouse and his children continue; } @@ -1333,11 +1331,10 @@ if ($action == 'create') { print ''; print ''; if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - if(isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])){ + if (isset($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) { $deliverableQty = min($quantityToBeDelivered, $stock - $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]); - } - else{ - if(!isset($alreadyQtySetted[$line->fk_product])){ + } else { + if (!isset($alreadyQtySetted[$line->fk_product])) { $alreadyQtySetted[$line->fk_product] = array(); } @@ -1347,14 +1344,14 @@ if ($action == 'create') { if ($deliverableQty < 0) $deliverableQty = 0; $tooltip = ''; - if(!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])){ + if (!empty($alreadyQtySetted[$line->fk_product][intval($warehouse_id)])) { $tooltip = ' class="classfortooltip" title="'.$langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtySetted[$line->fk_product][intval($warehouse_id)].'" '; } $alreadyQtySetted[$line->fk_product][intval($warehouse_id)] = $deliverableQty + $alreadyQtySetted[$line->fk_product][intval($warehouse_id)]; $inputName = 'qtyl'.$indiceAsked.'_'.$subj; - if(GETPOSTISSET($inputName)){ + if (GETPOSTISSET($inputName)) { $deliverableQty = GETPOST($inputName, 'int'); } @@ -1416,7 +1413,7 @@ if ($action == 'create') { $tmpwarehouseObject = new Entrepot($db); $productlotObject = new Productlot($db); - uasort ( $product->stock_warehouse , function ($a, $b){ + uasort( $product->stock_warehouse, function ($a, $b) { if ($a->real == $b->real) { return 0; } return ($a->real < $b->real) ? -1 : 1; }); @@ -1459,17 +1456,15 @@ if ($action == 'create') { $tmpwarehouseObject->fetch($warehouse_id); if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { foreach ($stock_warehouse->detail_batch as $dbatch) { - $batchStock = + $dbatch->qty; // To get a numeric - if(isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])){ + if (isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) { $deliverableQty = min($quantityToBeDelivered, $batchStock - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]); - } - else{ - if(!isset($alreadyQtyBatchSetted[$line->fk_product])){ + } else { + if (!isset($alreadyQtyBatchSetted[$line->fk_product])) { $alreadyQtyBatchSetted[$line->fk_product] = array(); } - if(!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])){ + if (!isset($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch])) { $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch] = array(); } @@ -1479,12 +1474,12 @@ if ($action == 'create') { if ($deliverableQty < 0) $deliverableQty = 0; $inputName = 'qtyl'.$indiceAsked.'_'.$subj; - if(GETPOSTISSET($inputName)){ + if (GETPOSTISSET($inputName)) { $deliverableQty = GETPOST($inputName, 'int'); } $tooltip = ''; - if(!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])){ + if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) { $tooltip = ' class="classfortooltip" title="'.$langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)].'" '; } From c91b9d613afc5c72f27b59e554b53a75ed3cc299 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 1 Jun 2021 15:30:17 +0200 Subject: [PATCH 131/739] FIX: order supplier stats by category now display figures --- htdocs/commande/class/commandestats.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index cbb93b940de..7d98c5be996 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -78,6 +78,7 @@ class CommandeStats extends Stats $this->field = 'total_ht'; $this->field_line = 'total_ht'; $this->where .= " c.fk_statut > 0"; // Not draft and not cancelled + $this->categ_link=MAIN_DB_PREFIX.'categorie_societe'; } elseif ($mode == 'supplier') { @@ -87,6 +88,7 @@ class CommandeStats extends Stats $this->field = 'total_ht'; $this->field_line = 'total_ht'; $this->where .= " c.fk_statut > 2"; // Only approved & ordered + $this->categ_link=MAIN_DB_PREFIX.'categorie_fournisseur'; } //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; $this->where .= ' AND c.entity IN ('.getEntity('commande').')'; @@ -106,7 +108,7 @@ class CommandeStats extends Stats if ($categid) { - $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cats ON cats.fk_soc = c.fk_soc'; + $this->join .= ' LEFT JOIN '.$this->categ_link.' as cats ON cats.fk_soc = c.fk_soc'; $this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cat.rowid = cats.fk_categorie'; $this->where .= ' AND cat.rowid = '.$categid; } From af509742e6a16910f55b9e95e21527dc1726a0b3 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 1 Jun 2021 16:34:39 +0200 Subject: [PATCH 132/739] Fix #17726 : holliday with advanced perms works --- htdocs/holiday/card.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index bab0655b4c2..97a70782e36 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -163,19 +163,23 @@ if (empty($reshook)) { $description = trim(GETPOST('description', 'restricthtml')); // Check that leave is for a user inside the hierarchy or advanced permission for all is set - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->id == $fuserid && empty($user->rights->holiday->write)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->id != $fuserid && empty($user->rights->holiday->writeall_advance)) - ) { - $error++; - setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + if (empty($user->rights->holiday->write)) { + $error++; + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); + } elseif (!in_array($fuserid, $childids)) { + $error++; + setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); + $action = 'create'; + } } else { - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)) { - if (!in_array($fuserid, $childids)) { - $error++; - setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); - $action = 'create'; - } + if (empty($user->rights->holiday->write) && empty($user->rights->holiday->writeall_advance)) { + $error++; + setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); + } elseif (empty($user->rights->holiday->writeall_advance) && !in_array($fuserid, $childids)) { + $error++; + setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors'); + $action = 'create'; } } @@ -1136,7 +1140,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { } // On vérifie si l'utilisateur à le droit de lire cette demande - if ($cancreate) { + if ($canread) { $head = holiday_prepare_head($object); if (($action == 'edit' && $object->statut == Holiday::STATUS_DRAFT) || ($action == 'editvalidator')) { From 49f4de8728a9acc266a9e436eacfd5f8b0b98a53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Jun 2021 16:57:55 +0200 Subject: [PATCH 133/739] Fix massaction on cron --- htdocs/cron/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 28fa0287f0c..80371b14889 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -202,7 +202,7 @@ if (empty($reshook)) { $permissiontodelete = $user->rights->cron->delete; $uploaddir = $conf->cron->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - if ($permissiontoadd) { + if ($massaction && $permissiontoadd) { $tmpcron = new Cronjob($db); foreach ($toselect as $id) { $result = $tmpcron->fetch($id); From f13388122cc57b6fd9b4a8863f64a51367a51715 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 1 Jun 2021 21:43:05 +0200 Subject: [PATCH 134/739] Add fetch stock order --- htdocs/expedition/card.php | 46 +++------------------ htdocs/product/class/product.class.php | 2 + htdocs/product/class/productbatch.class.php | 8 +++- 3 files changed, 14 insertions(+), 42 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 543a67311f0..ef6c80d20d8 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1305,11 +1305,6 @@ if ($action == 'create') { // Define nb of lines suggested for this order line $nbofsuggested = 0; - uasort( $product->stock_warehouse, function ($a, $b) { - if ($a->real == $b->real) { return 0; } - return ($a->real < $b->real) ? -1 : 1; - }); - foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { if ($stock_warehouse->real > 0) { $nbofsuggested++; @@ -1413,42 +1408,11 @@ if ($action == 'create') { $tmpwarehouseObject = new Entrepot($db); $productlotObject = new Productlot($db); - uasort( $product->stock_warehouse, function ($a, $b) { - if ($a->real == $b->real) { return 0; } - return ($a->real < $b->real) ? -1 : 1; - }); - // Define nb of lines suggested for this order line $nbofsuggested = 0; foreach ($product->stock_warehouse as $warehouse_id => $stock_warehouse) { if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { - foreach ($stock_warehouse->detail_batch as $dbatch) { - $nbofsuggested++; - } - - // Sort Batch priority - uasort($stock_warehouse->detail_batch, function ($a, $b) { - $compare = 0; - $multiplePow = 0; - // The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. - - // PRIORITY FOR QTY : Eliminate place with small qty first - $multiplePow++; - $multiple = pow(10, $multiplePow); - $compare += (($a->qty < $b->qty) ? -1 : 1) * $multiple; - - // PRIORITY FOR SELL EXPIRATION DATE - $multiplePow++; - $multiple = pow(10, $multiplePow); - $compare += (($a->sellby < $b->sellby) ? -1 : 1) * $multiple; - - // PRIORITY FOR CONSUMPTION EXPIRATION DATE - $multiplePow++; - $multiple = pow(10, $multiplePow); - $compare += (($a->eatby < $b->eatby) ? -1 : 1) * $multiple; - - return $compare; - }); + $nbofsuggested+=count($stock_warehouse->detail_batch); } } @@ -1478,15 +1442,15 @@ if ($action == 'create') { $deliverableQty = GETPOST($inputName, 'int'); } - $tooltip = ''; + $tooltipClass = $tooltipTitle = ''; if (!empty($alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)])) { - $tooltip = ' class="classfortooltip" title="'.$langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)].'" '; + $tooltipClass = ' classfortooltip'; + $tooltipTitle = $langs->trans('StockQuantitiesAlreadyAllocatedOnPreviousLines').' : '.$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]; } - $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)]; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2ccc5e63c8f..9d8977a2223 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5147,6 +5147,8 @@ class Product extends CommonObject $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; } + $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; + dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 10704f2f53e..7ac2e43740f 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -436,7 +436,7 @@ class Productbatch extends CommonObject */ public static function findAll($db, $fk_product_stock, $with_qty = 0, $fk_product = 0) { - global $langs; + global $langs, $conf; $ret = array(); $sql = "SELECT"; @@ -462,6 +462,12 @@ class Productbatch extends CommonObject $sql .= " AND t.qty <> 0"; } + $sql .= " ORDER BY "; + // TODO : use product lifo and fifo when product will implement it + if ($fk_product > 0) { $sql .= "pl.eatby ASC, pl.sellby ASC, "; } + $sql .= "t.eatby ASC, t.sellby ASC "; + $sql .= ", t.qty ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation + dol_syslog("productbatch::findAll", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { From b5904e49a023354f435858c7060a1d02cf9d3a07 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:43:43 +0200 Subject: [PATCH 135/739] NEW Add field date from/to in customer payment list --- htdocs/compta/paiement/list.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 1e99cf8676f..eb6d50712c5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -56,11 +56,10 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'p $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); -$day = GETPOST('day', 'int'); -$month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); $search_ref = GETPOST("search_ref", "alpha"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_company = GETPOST("search_company", 'alpha'); $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); @@ -130,14 +129,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; - $day = ''; - $year = ''; - $month = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -211,10 +209,15 @@ if (GETPOST("orphelins", "alpha")) { } // Search criteria - $sql .= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } + if ($search_date_start) { + $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; + } + if ($search_date_end) { + $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; + } if ($search_account > 0) { $sql .= " AND b.fk_account=".((int) $search_account); } @@ -275,6 +278,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); +$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); +$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); $param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); @@ -331,11 +336,14 @@ if (!empty($arrayfields['p.ref']['checked'])) { // Filter: Date if (!empty($arrayfields['p.datep']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } From 3744ccdd286b8e33968031248884f331cbefd133 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:50:55 +0200 Subject: [PATCH 136/739] Look & feel v14 --- htdocs/compta/paiement/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index eb6d50712c5..c06f8ee9cb5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -337,12 +337,10 @@ if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.datep']['checked'])) { print ''; print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; } From c35124f036d75ab99dbf9a2d76abfbe4f24f2d74 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 23:23:00 +0200 Subject: [PATCH 137/739] NEW Add field date from/to in supplier payment list --- htdocs/fourn/paiement/list.php | 41 ++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 6a38ae2033d..6b932ae2019 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -36,6 +36,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'banks', 'compta')); @@ -48,9 +49,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've $socid = GETPOST('socid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); -$search_day = GETPOST('search_day', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_company = GETPOST('search_company', 'alpha'); $search_payment_type = GETPOST('search_payment_type'); $search_cheque_num = GETPOST('search_cheque_num', 'alpha'); @@ -135,9 +135,8 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ''; - $search_day = ''; - $search_month = ''; - $search_year = ''; + $search_date_start = ''; + $search_date_end = ''; $search_company = ''; $search_payment_type = ''; $search_cheque_num = ''; @@ -187,7 +186,13 @@ if ($socid > 0) { if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } -$sql .= dolSqlDateFilter('p.datep', $search_day, $search_month, $search_year); +if ($search_date_start) { + $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; +} +if ($search_date_end) { + $sql .=" AND p.datep <= '" . $db->idate($search_date_end) . "'"; +} + if ($search_company) { $sql .= natural_search('s.nom', $search_company); } @@ -254,14 +259,11 @@ if ($optioncss != '') { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } -if ($saerch_day) { - $param .= '&search_day='.urlencode($search_day); +if ($search_date_start) { + $param.= '&search_date_start='.urlencode($search_date_start); } -if ($saerch_month) { - $param .= '&search_month='.urlencode($search_month); -} -if ($search_year) { - $param .= '&search_year='.urlencode($search_year); +if ($search_date_end) { + $param.= '&search_date_end='.urlencode($search_date_end); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); @@ -336,11 +338,12 @@ if (!empty($arrayfields['p.ref']['checked'])) { // Filter: Date if (!empty($arrayfields['p.datep']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } From bda42403b259550a30003cc0053d830dda862cee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 04:15:21 +0200 Subject: [PATCH 138/739] FIX Creation of reception (missing extrafields). Lose data if error. --- htdocs/reception/card.php | 84 ++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 75f5401d401..493a400c891 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -72,7 +72,7 @@ if (!empty($conf->productbatch->enabled)) { } $origin = GETPOST('origin', 'alpha') ?GETPOST('origin', 'alpha') : 'reception'; // Example: commande, propal -$origin_id = GETPOST('id', 'int') ?GETPOST('id', 'int') : ''; +$origin_id = GETPOST('id', 'int') ? GETPOST('id', 'int') : ''; $id = $origin_id; if (empty($origin_id)) { $origin_id = GETPOST('origin_id', 'int'); // Id of order or propal @@ -86,12 +86,12 @@ if (empty($origin_id)) { $ref = GETPOST('ref', 'alpha'); $line_id = GETPOST('lineid', 'int') ?GETPOST('lineid', 'int') : ''; -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); //Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); //PDF @@ -117,7 +117,6 @@ $permissiondellink = $user->rights->reception->creer; // Used by the include of $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); -$object = new Reception($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); @@ -725,13 +724,13 @@ if ($action == 'create') { $classname = ucfirst($origin); } - $object = new $classname($db); - if ($object->fetch($origin_id)) { // This include the fetch_lines + $objectsrc = new $classname($db); + if ($objectsrc->fetch($origin_id)) { // This include the fetch_lines $soc = new Societe($db); - $soc->fetch($object->socid); + $soc->fetch($objectsrc->socid); $author = new User($db); - $author->fetch($object->user_author_id); + $author->fetch($objectsrc->user_author_id); if (!empty($conf->stock->enabled)) { $entrepot = new Entrepot($db); @@ -741,8 +740,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''; - print ''; + print ''; if (GETPOST('entrepot_id', 'int')) { print ''; } @@ -754,10 +752,10 @@ if ($action == 'create') { // Ref print ''; if ($origin == 'supplierorder' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { - print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"), 'order').' '.$object->ref; + print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"), 'order').' '.$objectsrc->ref; } if ($origin == 'propal' && !empty($conf->propal->enabled)) { - print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"), 'propal').' '.$object->ref; + print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"), 'propal').' '.$objectsrc->ref; } print ''; print "\n"; @@ -770,7 +768,7 @@ if ($action == 'create') { print $langs->trans('RefSupplier'); } print ''; - print ''; + print ''; print ''; print ''; @@ -782,8 +780,8 @@ if ($action == 'create') { // Project if (!empty($conf->projet->enabled)) { $projectid = GETPOST('projectid', 'int') ?GETPOST('projectid', 'int') : 0; - if (empty($projectid) && !empty($object->fk_project)) { - $projectid = $object->fk_project; + if (empty($projectid) && !empty($objectsrc->fk_project)) { + $projectid = $objectsrc->fk_project; } if ($origin == 'project') { $projectid = ($originid ? $originid : 0); @@ -802,7 +800,7 @@ if ($action == 'create') { // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -810,15 +808,15 @@ if ($action == 'create') { // Note Public print ''.$langs->trans("NotePublic").''; print ''; - $doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $objectsrc->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print ""; // Note Private - if ($object->note_private && !$user->socid) { + if ($objectsrc->note_private && !$user->socid) { print ''.$langs->trans("NotePrivate").''; print ''; - $doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $objectsrc->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print ""; } @@ -861,15 +859,15 @@ if ($action == 'create') { // Other attributes $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid'=>$socid); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $objectsrc may have been modified by hook print $hookmanager->resPrint; - // Here $object can be of an object Order + // Here $object can be of an object Reception $extrafields->fetch_name_optionals_label($object->table_element); if (empty($reshook) && !empty($extrafields->attributes[$object->table_element]['label'])) { // copy from order - if ($object->fetch_optionals() > 0) { - $recept->array_options = array_merge($recept->array_options, $object->array_options); + if ($objectsrc->fetch_optionals() > 0) { + $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options); } print $object->showOptionals($extrafields, 'edit', $parameters); } @@ -877,9 +875,9 @@ if ($action == 'create') { // Incoterms if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); + print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : '')); print ''; } @@ -898,12 +896,14 @@ if ($action == 'create') { print dol_get_fiche_end(); - // Reception lines $numAsked = 0; $dispatchLines = array(); foreach ($_POST as $key => $value) { + // If create form is coming from the button "Create Reception" of previous page + // without batch module enabled + $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; @@ -934,6 +934,25 @@ if ($action == 'create') { $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } + + // If create form is coming from same page post was sent but an error occured + if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { + $numAsked++; + + // eat-by date dispatch + // $numline=$reg[2] + 1; // line of product + $numline = $numAsked; + $prod = 'productid'.$reg[1]; + $comment = 'comment'.$reg[1]; + $qty = 'qtyl'.$reg[1]; + $ent = 'entl'.$reg[1]; + $pu = 'pul'.$reg[1]; + $lot = 'batch'.$reg[1]; + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); + $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + } } @@ -961,7 +980,7 @@ if ($action == 'create') { print ''; // Load receptions already done for same order - $object->loadReceptions(); + $objectsrc->loadReceptions(); if ($numAsked) { print ''; @@ -993,14 +1012,13 @@ if ($action == 'create') { $indiceAsked = 1; while ($indiceAsked <= $numAsked) { $product = new Product($db); - foreach ($object->lines as $supplierLine) { + foreach ($objectsrc->lines as $supplierLine) { if ($dispatchLines[$indiceAsked]['fk_commandefourndet'] == $supplierLine->id) { $line = $supplierLine; break; } } - // Show product and description $type = $line->product_type ? $line->product_type : $line->fk_product_type; // Try to enhance type detection using date_start and date_end for free lines where type @@ -1012,7 +1030,7 @@ if ($action == 'create') { $type = 1; } - print ''."\n"; + print ''."\n"; print ''."\n"; @@ -1024,6 +1042,7 @@ if ($action == 'create') { print ''; @@ -1075,13 +1094,14 @@ if ($action == 'create') { // Qty print ''; $qtyProdCom = $line->qty; // Qty already received print ''; From 5a260865dc32c90c573c3b2889bbfee0e50d555b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 04:15:21 +0200 Subject: [PATCH 139/739] FIX Creation of reception (missing extrafields). Lose data if error. Conflicts: htdocs/reception/card.php --- htdocs/reception/card.php | 105 ++++++++++++++++++++++---------------- 1 file changed, 60 insertions(+), 45 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 18aa08b0d85..8b49f143176 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -62,7 +62,7 @@ if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (!empty($conf->productbatch->enabled)) $langs->load('productbatch'); $origin = GETPOST('origin', 'alpha') ?GETPOST('origin', 'alpha') : 'reception'; // Example: commande, propal -$origin_id = GETPOST('id', 'int') ?GETPOST('id', 'int') : ''; +$origin_id = GETPOST('id', 'int') ? GETPOST('id', 'int') : ''; $id = $origin_id; if (empty($origin_id)) $origin_id = GETPOST('origin_id', 'int'); // Id of order or propal if (empty($origin_id)) $origin_id = GETPOST('object_id', 'int'); // Id of order or propal @@ -87,7 +87,7 @@ $action = GETPOST('action', 'alpha'); if (GETPOST('modelselected')) { $action = 'presend'; } -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); //PDF @@ -707,14 +707,13 @@ if ($action == 'create') if ($origin == 'supplierorder')$classname = 'CommandeFournisseur'; else $classname = ucfirst($origin); - $object = new $classname($db); - if ($object->fetch($origin_id)) // This include the fetch_lines - { + $objectsrc = new $classname($db); + if ($objectsrc->fetch($origin_id)) { // This include the fetch_lines $soc = new Societe($db); - $soc->fetch($object->socid); + $soc->fetch($objectsrc->socid); $author = new User($db); - $author->fetch($object->user_author_id); + $author->fetch($objectsrc->user_author_id); if (!empty($conf->stock->enabled)) $entrepot = new Entrepot($db); @@ -722,10 +721,8 @@ if ($action == 'create') print ''; print ''; print ''; - print ''; - print ''; - if (GETPOST('entrepot_id', 'int')) - { + print ''; + if (GETPOST('entrepot_id', 'int')) { print ''; } @@ -735,13 +732,11 @@ if ($action == 'create') // Ref print ''; print "\n"; @@ -751,7 +746,7 @@ if ($action == 'create') if ($origin == 'supplier_order') print $langs->trans('SupplierOrder'); else print $langs->trans('RefSupplier'); print ''; print ''; @@ -764,8 +759,12 @@ if ($action == 'create') if (!empty($conf->projet->enabled)) { $projectid = GETPOST('projectid', 'int') ?GETPOST('projectid', 'int') : 0; - if (empty($projectid) && !empty($object->fk_project)) $projectid = $object->fk_project; - if ($origin == 'project') $projectid = ($originid ? $originid : 0); + if (empty($projectid) && !empty($objectsrc->fk_project)) { + $projectid = $objectsrc->fk_project; + } + if ($origin == 'project') { + $projectid = ($originid ? $originid : 0); + } $langs->load("projects"); print ''; @@ -779,7 +778,7 @@ if ($action == 'create') // Date delivery planned print ''; print '\n"; print ''; @@ -787,16 +786,15 @@ if ($action == 'create') // Note Public print ''; print '"; // Note Private - if ($object->note_private && !$user->socid) - { + if ($objectsrc->note_private && !$user->socid) { print ''; print '"; } @@ -837,15 +835,15 @@ if ($action == 'create') // Other attributes $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid'=>$socid); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $recept, $action); // Note that $action and $objectsrc may have been modified by hook print $hookmanager->resPrint; - // Here $object can be of an object Order + // Here $object can be of an object Reception $extrafields->fetch_name_optionals_label($object->table_element); if (empty($reshook) && !empty($extrafields->attributes[$object->table_element]['label'])) { // copy from order - if ($object->fetch_optionals() > 0) { - $recept->array_options = array_merge($recept->array_options, $object->array_options); + if ($objectsrc->fetch_optionals() > 0) { + $recept->array_options = array_merge($recept->array_options, $objectsrc->array_options); } print $object->showOptionals($extrafields, 'edit', $parameters); } @@ -854,9 +852,9 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; } @@ -876,15 +874,15 @@ if ($action == 'create') print dol_get_fiche_end(); - // Reception lines $numAsked = 0; $dispatchLines = array(); - foreach ($_POST as $key => $value) - { + foreach ($_POST as $key => $value) { + // If create form is coming from the button "Create Reception" of previous page + // without batch module enabled - if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) - { + $reg = array(); + if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $numAsked++; // $numline=$reg[2] + 1; // line of product @@ -915,6 +913,25 @@ if ($action == 'create') $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST('comment'), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); } + + // If create form is coming from same page post was sent but an error occured + if (preg_match('/^productid([0-9]+)$/i', $key, $reg)) { + $numAsked++; + + // eat-by date dispatch + // $numline=$reg[2] + 1; // line of product + $numline = $numAsked; + $prod = 'productid'.$reg[1]; + $comment = 'comment'.$reg[1]; + $qty = 'qtyl'.$reg[1]; + $ent = 'entl'.$reg[1]; + $pu = 'pul'.$reg[1]; + $lot = 'batch'.$reg[1]; + $dDLUO = dol_mktime(12, 0, 0, GETPOST('dluo'.$reg[1].'month', 'int'), GETPOST('dluo'.$reg[1].'day', 'int'), GETPOST('dluo'.$reg[1].'year', 'int')); + $dDLC = dol_mktime(12, 0, 0, GETPOST('dlc'.$reg[1].'month', 'int'), GETPOST('dlc'.$reg[1].'day', 'int'), GETPOST('dlc'.$reg[1].'year', 'int')); + $fk_commandefourndet = 'fk_commandefournisseurdet'.$reg[1]; + $dispatchLines[$numAsked] = array('prod' => GETPOST($prod, 'int'), 'qty' =>GETPOST($qty), 'ent' =>GETPOST($ent, 'int'), 'pu' =>GETPOST($pu), 'comment' =>GETPOST($comment), 'fk_commandefourndet' => GETPOST($fk_commandefourndet, 'int'), 'DLC'=> $dDLC, 'DLUO'=> $dDLUO, 'lot'=> GETPOST($lot, 'alpha')); + } } @@ -944,7 +961,7 @@ if ($action == 'create') print '
'; print ''; // ancre pour retourner sur la ligne + print ''; // Show product and description $product_static->type = $line->fk_product_type; @@ -1067,7 +1086,7 @@ if ($action == 'create') { // Comment //$defaultcomment = 'Line create from order line id '.$line->id; - $defaultcomment = ''; + $defaultcomment = $dispatchLines[$indiceAsked]['comment']; print ''; print ''; print ''.$line->qty; print ''; + print ''; print ''; print ''; - $quantityDelivered = $object->receptions[$line->id]; + $quantityDelivered = $objectsrc->receptions[$line->id]; print $quantityDelivered; print ''; print '
'; - if ($origin == 'supplierorder' && !empty($conf->fournisseur->enabled)) - { - print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"), 'order').' '.$object->ref; + if ($origin == 'supplierorder' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { + print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"), 'order').' '.$objectsrc->ref; } - if ($origin == 'propal' && !empty($conf->propal->enabled)) - { - print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"), 'propal').' '.$object->ref; + if ($origin == 'propal' && !empty($conf->propal->enabled)) { + print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"), 'propal').' '.$objectsrc->ref; } print '
'; - print ''; + print ''; print '
'.$langs->trans("DateDeliveryPlanned").''; - $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $objectsrc->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "
'.$langs->trans("NotePublic").''; - $doleditor = new DolEditor('note_public', $object->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('note_public', $objectsrc->note_public, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print "
'.$langs->trans("NotePrivate").''; - $doleditor = new DolEditor('note_private', $object->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + $doleditor = new DolEditor('note_private', $objectsrc->note_private, '', 60, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); print "
'; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); + print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : '')); print '
'; // Load receptions already done for same order - $object->loadReceptions(); + $objectsrc->loadReceptions(); if ($numAsked) { @@ -980,14 +997,13 @@ if ($action == 'create') while ($indiceAsked <= $numAsked) { $product = new Product($db); - foreach ($object->lines as $supplierLine) { + foreach ($objectsrc->lines as $supplierLine) { if ($dispatchLines[$indiceAsked]['fk_commandefourndet'] == $supplierLine->id) { $line = $supplierLine; break; } } - // Show product and description $type = $line->product_type ? $line->product_type : $line->fk_product_type; // Try to enhance type detection using date_start and date_end for free lines where type @@ -995,7 +1011,7 @@ if ($action == 'create') if (!empty($line->date_start)) $type = 1; if (!empty($line->date_end)) $type = 1; - print ''."\n"; + print ''."\n"; print ''."\n"; @@ -1008,6 +1024,7 @@ if ($action == 'create') print ''; $qtyProdCom = $line->qty; // Qty already received print ''; From 33a4c98dc3b2ecc134fdda48a0ed15a3f1d7a69c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 04:33:35 +0200 Subject: [PATCH 140/739] Fix popup --- htdocs/reception/card.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 8b49f143176..8a4d5edc611 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1027,10 +1027,7 @@ if ($action == 'create') print ''; // Show product and description - $product_static->type = $line->fk_product_type; - $product_static->id = $line->fk_product; - $product_static->ref = $line->ref; - $product_static->status_batch = $line->product_tobatch; + $product_static = $product; $text = $product_static->getNomUrl(1); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); From 68579f9cda31df18f0d61789da37c96a06e0d0ef Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Wed, 2 Jun 2021 08:17:34 +0200 Subject: [PATCH 141/739] fix html linebreak --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 3c7c8cb6e1c..8e23c258d88 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -552,7 +552,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref); if (!empty($object->refuse_note)) { - $object->actionmsg .= '
'; + $object->actionmsg .= '
'; $object->actionmsg .= $langs->trans("Reason") . ': '.$object->refuse_note; } From 6d049f5c2e018603ec04219fa4586f544952ce60 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 2 Jun 2021 09:31:04 +0200 Subject: [PATCH 142/739] Fix #17791 : Error when loading chart of accounts --- .../mysql/data/llx_accounting_account_es.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_es.sql b/htdocs/install/mysql/data/llx_accounting_account_es.sql index b3301de496f..c3d194fab2a 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_es.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_es.sql @@ -42,7 +42,7 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4008, 'PCG08-PYME','CAPIT', '10', '4001', 'CAPITAL', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4009, 'PCG08-PYME','CAPIT', '100', '4008', 'Capital social', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4010, 'PCG08-PYME','CAPIT', '101', '4008', 'Fondo social', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4011, 'PCG08-PYME','CAPIT', 'CAPITAL', '102', '4008', 'Capital', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4011, 'PCG08-PYME','CAPIT', '102', '4008', 'Capital', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4012, 'PCG08-PYME','CAPIT', '103', '4008', 'Socios por desembolsos no exigidos', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4013, 'PCG08-PYME','CAPIT', '1030', '4012', 'Socios por desembolsos no exigidos capital social', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4014, 'PCG08-PYME','CAPIT', '1034', '4012', 'Socios por desembolsos no exigidos capital pendiente de inscripción', 1); @@ -291,8 +291,8 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4257, 'PCG08-PYME','EXISTENCIAS', '394', '4252', 'Deterioro de valor de los productos semiterminados', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4258, 'PCG08-PYME','EXISTENCIAS', '395', '4252', 'Deterioro de valor de los productos terminados', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4259, 'PCG08-PYME','EXISTENCIAS', '396', '4252', 'Deterioro de valor de los subproductos, residuos y materiales recuperados', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4260, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '40', '4004', 'Proveedores', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4261, 'PCG08-PYME','ACREEDORES_DEUDORES', 'PROVEEDORES', '400', '4260', 'Proveedores', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4260, 'PCG08-PYME','ACREEDORES_DEUDORES', '40', '4004', 'Proveedores', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4261, 'PCG08-PYME','ACREEDORES_DEUDORES', '400', '4260', 'Proveedores', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4262, 'PCG08-PYME','ACREEDORES_DEUDORES', '4000', '4261', 'Proveedores euros', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4263, 'PCG08-PYME','ACREEDORES_DEUDORES', '4004', '4261', 'Proveedores moneda extranjera', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4264, 'PCG08-PYME','ACREEDORES_DEUDORES', '4009', '4261', 'Proveedores facturas pendientes de recibir o formalizar', 1); @@ -314,8 +314,8 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4280, 'PCG08-PYME','ACREEDORES_DEUDORES', '4109', '4277', 'Acreedores por prestaciones de servicios facturas pendientes de recibir o formalizar', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4281, 'PCG08-PYME','ACREEDORES_DEUDORES', '411', '4276', 'Acreedores efectos comerciales a pagar', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4282, 'PCG08-PYME','ACREEDORES_DEUDORES', '419', '4276', 'Acreedores por operaciones en común', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4283, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '43', '4004', 'Clientes', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4284, 'PCG08-PYME','ACREEDORES_DEUDORES', 'CLIENTES', '430', '4283', 'Clientes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4283, 'PCG08-PYME','ACREEDORES_DEUDORES', '43', '4004', 'Clientes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4284, 'PCG08-PYME','ACREEDORES_DEUDORES', '430', '4283', 'Clientes', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4285, 'PCG08-PYME','ACREEDORES_DEUDORES', '4300', '4284', 'Clientes euros', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4286, 'PCG08-PYME','ACREEDORES_DEUDORES', '4304', '4284', 'Clientes moneda extranjera', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4287, 'PCG08-PYME','ACREEDORES_DEUDORES', '4309', '4284', 'Clientes facturas pendientes de formalizar', 1); @@ -501,9 +501,9 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4467, 'PCG08-PYME','FINAN', '567', '4462', 'Intereses pagados por anticipado', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4468, 'PCG08-PYME','FINAN', '568', '4462', 'Intereses cobrados a corto plazo', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4469, 'PCG08-PYME','FINAN', '57', '4005', 'Tesorería', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4470, 'PCG08-PYME','FINAN', 'CAJA', '570', '4469', 'Caja euros', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4470, 'PCG08-PYME','FINAN', '570', '4469', 'Caja euros', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4471, 'PCG08-PYME','FINAN', '571', '4469', 'Caja moneda extranjera', 1); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4472, 'PCG08-PYME','FINAN', 'BANCOS', '572', '4469', 'Bancos e instituciones de crédito cc vista euros', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4472, 'PCG08-PYME','FINAN', '572', '4469', 'Bancos e instituciones de crédito cc vista euros', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4473, 'PCG08-PYME','FINAN', '573', '4469', 'Bancos e instituciones de crédito cc vista moneda extranjera', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4474, 'PCG08-PYME','FINAN', '574', '4469', 'Bancos e instituciones de crédito cuentas de ahorro euros', 1); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 4475, 'PCG08-PYME','FINAN', '575', '4469', 'Bancos e instituciones de crédito cuentas de ahorro moneda extranjera', 1); From f875bcfe09be360570096a8b610396a4574a3b09 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 2 Jun 2021 10:30:48 +0200 Subject: [PATCH 143/739] update ->nom field if different from ->name --- htdocs/user/class/usergroup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 20ac35b370f..b271eec5754 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -675,7 +675,7 @@ class UserGroup extends CommonObject { global $user, $conf; - if (empty($this->nom) && !empty($this->name)) { + if ((empty($this->nom) || $this->nom != $this->name) && !empty($this->name)) { $this->nom = $this->name; } From 89f6b66c2a8e091163a4bd8ecfe101117acbe2b0 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 2 Jun 2021 10:32:30 +0200 Subject: [PATCH 144/739] wrong join, request too long --- htdocs/compta/stats/cabyprodserv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 485a6088338..46908ac6b75 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -232,7 +232,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) { // Without any category $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } elseif ($selected_cat) { // Into a specific category - $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON (cp.fk_product = p.rowid) INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON (cp.fk_categorie = c.rowid)"; } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; From b8b30a9af6f6d3647e862c51e6eedf73698a383b Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 2 Jun 2021 10:53:04 +0200 Subject: [PATCH 145/739] wrong where cabyprodserv --- htdocs/compta/stats/cabyprodserv.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 46908ac6b75..7b8f1101004 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -263,11 +263,11 @@ if ($modecompta == 'CREANCES-DETTES') } } - $sql .= " AND (p.rowid IN "; - $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; + $sql .= " AND "; + if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; - $sql .= "))"; + } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From de1be814d5ff2cd60c7994579c73962c839872e9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 2 Jun 2021 09:23:50 +0000 Subject: [PATCH 146/739] Fixing style errors. --- htdocs/compta/stats/cabyprodserv.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7b8f1101004..3b00832c1a3 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -267,7 +267,6 @@ if ($modecompta == 'CREANCES-DETTES') if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; - } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From 3aca9bdb9e62973d0f3217589c5d6d8384cb7f48 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 2 Jun 2021 12:02:27 +0200 Subject: [PATCH 147/739] Fix warehouse id --- htdocs/expedition/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 264089ac48a..a4597fee291 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2211,7 +2211,8 @@ if ($action == 'create') // only show lot numbers from src warehouse when shipping from multiple warehouses $line->fetch($detail_batch->fk_expeditiondet); } - print '
'; + $entrepot_id = !empty($detail_batch->entrepot_id)?$detail_batch->entrepot_id:$lines[$i]->entrepot_id; + print ''; print ''; } // add a 0 qty lot row to be able to add a lot From a4d213a0c9e115c94876f471ad6c751db145957a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 12:29:05 +0200 Subject: [PATCH 148/739] Update doc --- README-FR.md | 20 ++++++++++++++++---- README.md | 5 +++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README-FR.md b/README-FR.md index 77bb5a3e27a..81fdff13047 100644 --- a/README-FR.md +++ b/README-FR.md @@ -8,10 +8,12 @@ Il est simple d'utilisation et modulaire, vous permettant de n'activez que les f ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg) + ## LICENCE Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure. + ## INSTALLER DOLIBARR ### Configuration simple @@ -52,6 +54,7 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg - Suivez les instructions de l'installateur + ## METTRE A JOUR DOLIBARR Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: @@ -64,9 +67,11 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci: *Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/* + ## CE QUI EST NOUVEAU -Voir fichier ChangeLog. +See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. + ## CE QUE DOLIBARR PEUT FAIRE @@ -82,15 +87,17 @@ Voir fichier ChangeLog. - Calendrier/Agenda partagé (avec export ical, vcal) - Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...) - Gestion de contrats de services -- Gestion de stock +- Gestion de stock et inventaires - Gestion des expéditions - Gestion des demandes de congès - Gestion des notes de frais +- Gestion de recrutement - GED (Gestion Electronique de Documents) - EMailings de masse - Réalisation de sondages +- Gestion d'adhérents - Point de vente/Caisse enregistreuse -- … +- … (près de 100 modules disponibles en standard, près de 1000 autre sur la place de marché d'extensions) ### Autres modules @@ -135,31 +142,36 @@ Voir fichier ChangeLog. Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com). + ## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE Voici un liste de fonctionnalités pas encore gérées par Dolibarr: -- Dolibarr ne contient pas de module de Gestion de la paie. +- Dolibarr ne contient pas de module de génération de feuille de paie. - Les tâches du module de gestion de projets n'ont pas de dépendances entre elle. - Dolibarr n'embarque pas de Webmail intégré nativement. - Dolibarr ne fait pas le café (pas encore). + ## DOCUMENTATION La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org). + ## CONTRIBUER Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]. + ## CREDITS Dolibarr est le résultat du travail de nombreux contributeurs depuis des années et utilise des librairies d'autres contributeurs. Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) + ## ACTUALITES ET RESEAUX SOCIAUX Suivez le projet Dolibarr project sur les réseaux francophones diff --git a/README.md b/README.md index 0a3aeecb9f4..531a19e0be9 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Customer & Supplier Orders management - Invoices and payment management - Shipping management -- Warehouse/Stock management +- Warehouse/Stock management/Inventory - Manufacturing Orders - Bank accounts management - Direct debit orders management (European SEPA) @@ -117,11 +117,12 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Interventions management - Employee's leave requests management - Expense reports +- Recruitment management - Timesheets - Electronic Document Management (EDM) - Foundations members management - Point of Sale (POS) -- … +- … (around 100 modules available by default, + 1000 on the addon market place) ### Other application/modules From b5680a91d0cfc7699cd8dffc79f48136f26172ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 13:03:20 +0200 Subject: [PATCH 149/739] css --- htdocs/user/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 693590ff7d2..ba737dfbc62 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -933,13 +933,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } if (!empty($arrayfields['u.office_phone']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['u.user_mobile']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } From db5bcd1b99a8bd4e4043d7bb0cb06cb86e9a0d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 13:41:08 +0200 Subject: [PATCH 150/739] Fix css --- htdocs/user/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index ba737dfbc62..bd82824cb05 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -992,7 +992,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Salary if (!empty($arrayfields['u.salary']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } From 431691cec4a4d4bf879e5366de218adbd6a3b35d Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 2 Jun 2021 15:18:45 +0200 Subject: [PATCH 151/739] Fix propal/index.php error on thirdparty display --- htdocs/comm/propal/index.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 359084ddabe..3973071d1f0 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -150,7 +150,7 @@ print '
'; */ $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, date_cloture as datec"; -$sql .= ", s.nom as socname, s.rowid as socid, s.canvas, s.client"; +$sql .= ", s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) { @@ -185,6 +185,8 @@ if ($resql) { $companystatic->name = $obj->socname; $companystatic->client = $obj->client; $companystatic->canvas = $obj->canvas; + $companystatic->email = $obj->email; + $companystatic->code_compta = $obj->code_compta; $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); @@ -223,7 +225,7 @@ if ($resql) { * Open (validated) proposals */ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { - $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client"; + $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; $sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."propal as p"; @@ -260,6 +262,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { $companystatic->name = $obj->socname; $companystatic->client = $obj->client; $companystatic->canvas = $obj->canvas; + $companystatic->email = $obj->email; + $companystatic->code_compta = $obj->code_compta; $filename = dol_sanitizeFileName($obj->ref); $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref); From da7d821a3e18fa283cf79abe1d6a660c41b131dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 15:32:39 +0200 Subject: [PATCH 152/739] css --- htdocs/holiday/month_report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 62991a6e0ee..966dd7e8dee 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -413,7 +413,7 @@ if ($num == 0) { print '
'; } if (!empty($arrayfields['cp.description']['checked'])) { - print ''; + print ''; } print ''; From 1468761073884ccc039a2fdbc25e01051712343b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 16:29:38 +0200 Subject: [PATCH 153/739] Fix select --- htdocs/holiday/month_report.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index b83d957b27f..922c313840b 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -138,13 +138,21 @@ $sql .= " FROM ".MAIN_DB_PREFIX."holiday cp"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " WHERE cp.rowid > 0"; -$sql .= " AND cp.statut = 3"; // 3 = Approved +$sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; $sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')"; -if (!empty($search_ref)) $sql .= natural_search('cp.ref', $search_ref); -if (!empty($search_employee)) $sql .= " AND cp.fk_user = '".$db->escape($search_employee)."'"; -if (!empty($search_type)) $sql .= ' AND cp.fk_type IN ('.$db->escape($search_type).')'; -if (!empty($search_description)) $sql .= natural_search('cp.description', $search_description); +if (!empty($search_ref)) { + $sql .= natural_search('cp.ref', $search_ref); +} +if (!empty($search_employee) && $search_employee > 0) { + $sql .= " AND cp.fk_user = ".((int) $search_employee); +} +if (!empty($search_type) && $search_type != '-1') { + $sql .= ' AND cp.fk_type IN ('.$db->escape($search_type).')'; +} +if (!empty($search_description)) { + $sql .= natural_search('cp.description', $search_description); +} $sql .= $db->order($sortfield, $sortorder); From 38423ba2600303665faf18626f2a89c0f6e93504 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 2 Jun 2021 16:31:31 +0200 Subject: [PATCH 154/739] Fix wrong hook context --- htdocs/product/stock/stockatdate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 91159984a35..8d355e5c1dc 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -45,7 +45,7 @@ if ($user->socid) { $result = restrictedArea($user, 'produit|service'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('stockreplenishlist')); +$hookmanager->initHooks(array('stockatdate')); //checks if a product has been ordered From 456356ded7ac9b5271fe3d6b2e63e1fb2e818979 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jun 2021 18:45:48 +0200 Subject: [PATCH 155/739] Fix migration --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index c9736e429c4..25a6a6b09e8 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -67,6 +67,13 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 154, 'SAT/24-2019', 'Catalogo y codigo agrupador fiscal del 2019', 1); +UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'auguria'; +UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'bureau2crea'; +UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'amarok'; +UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo'; +DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo'); + + -- For v14 ALTER TABLE llx_product_lot ADD COLUMN eol_date datetime NULL; From ef032f9fa0f27eafaa8007fa7a8c4ed04857811a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 08:33:44 +0200 Subject: [PATCH 156/739] fix warning --- htdocs/core/lib/project.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index ffa06ebd508..9c33744ceb0 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2693,6 +2693,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide // define progress color according to time spend vs workload $progressBarClass = 'progress-bar-info'; + $progressCalculated = 0; if ($task->planned_workload) { $progressCalculated = round(100 * floatval($task->duration_effective) / floatval($task->planned_workload), 2); From c3d58ad044cbeb5e39979ff5963e624c4ec3b60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 08:36:50 +0200 Subject: [PATCH 157/739] fix warning --- htdocs/user/group/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index edd34dfe9b8..302d697c563 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2011 Herve Prot - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +34,7 @@ $langs->load("users"); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_group = GETPOST('search_group'); $optioncss = GETPOST('optioncss', 'alpha'); +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) // Defini si peux lire/modifier utilisateurs et permisssions $caneditperms = ($user->admin || $user->rights->user->user->creer); From aa1ade5224f0925ff5c9b4188b46278edbbe7509 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 3 Jun 2021 09:13:48 +0200 Subject: [PATCH 158/739] Fix #17791 : fix for SKR03 --- .../mysql/data/llx_accounting_account_de.sql | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_de.sql b/htdocs/install/mysql/data/llx_accounting_account_de.sql index ddb0ab18356..d1b6b00f800 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_de.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_de.sql @@ -2725,20 +2725,20 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3852, 'SKR04', 'Anlagevermögen', 170, 0, 'Geleistete Anzahlungen auf immaterielle Vermögensgegenstände'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3853, 'SKR04', 'Anlagevermögen', 179, 0, 'Anzahlungen auf Geschäfts- oder Firmenwert'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3854, 'SKR04', 'Anlagevermögen', 200, 0, 'Grundstücke, grundstücksgleiche Rechte und Bauten einschließlich der Bauten auf fremden Grundstück'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3855, 'SKR04', 'Anlagevermögen', 210, 3854, Grundstücksgleiche Rechte ohne Bauten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3856, 'SKR04', 'Anlagevermögen', 215, 3854, Unbebaute Grundstücke'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3857, 'SKR04', 'Anlagevermögen', 220, 3854, Grundstücksgleiche Rechte (Erbbaurecht, Dauerwohnrecht, unbebaute Grundstücke)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3858, 'SKR04', 'Anlagevermögen', 225, 3854, Grundstücke mit Substanzverkehr'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3859, 'SKR04', 'Anlagevermögen', 229, 3854, Grundstücksanteil des häuslichen Arbeitszimmers'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3860, 'SKR04', 'Anlagevermögen', 230, 3854, Bauten auf eigenen Grundstücken und grundstücksgleichen Rechten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3861, 'SKR04', 'Anlagevermögen', 235, 3854, Grundstückswerte eigener bebauter Grundstücke'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3862, 'SKR04', 'Anlagevermögen', 240, 3854, Geschäftsbauten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3863, 'SKR04', 'Anlagevermögen', 250, 3854, Fabrikbauten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3864, 'SKR04', 'Anlagevermögen', 260, 3854, Andere Bauten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3865, 'SKR04', 'Anlagevermögen', 270, 3854, Garagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3866, 'SKR04', 'Anlagevermögen', 280, 3854, Außenanlagen für Geschäfts-, Fabrik- und andere Bauten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3867, 'SKR04', 'Anlagevermögen', 285, 3854, Hof- und Wegbefestigungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3868, 'SKR04', 'Anlagevermögen', 290, 3854, Einrichtungen für Geschäfts-. Fabrik- und andere Bauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3855, 'SKR04', 'Anlagevermögen', 210, 3854, 'Grundstücksgleiche Rechte ohne Bauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3856, 'SKR04', 'Anlagevermögen', 215, 3854,'Unbebaute Grundstücke'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3857, 'SKR04', 'Anlagevermögen', 220, 3854, 'Grundstücksgleiche Rechte (Erbbaurecht, Dauerwohnrecht, unbebaute Grundstücke)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3858, 'SKR04', 'Anlagevermögen', 225, 3854, 'Grundstücke mit Substanzverkehr'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3859, 'SKR04', 'Anlagevermögen', 229, 3854, 'Grundstücksanteil des häuslichen Arbeitszimmers'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3860, 'SKR04', 'Anlagevermögen', 230, 3854, 'Bauten auf eigenen Grundstücken und grundstücksgleichen Rechten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3861, 'SKR04', 'Anlagevermögen', 235, 3854, 'Grundstückswerte eigener bebauter Grundstücke'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3862, 'SKR04', 'Anlagevermögen', 240, 3854, 'Geschäftsbauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3863, 'SKR04', 'Anlagevermögen', 250, 3854, 'Fabrikbauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3864, 'SKR04', 'Anlagevermögen', 260, 3854, 'Andere Bauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3865, 'SKR04', 'Anlagevermögen', 270, 3854, 'Garagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3866, 'SKR04', 'Anlagevermögen', 280, 3854, 'Außenanlagen für Geschäfts-, Fabrik- und andere Bauten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3867, 'SKR04', 'Anlagevermögen', 285, 3854, 'Hof- und Wegbefestigungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3868, 'SKR04', 'Anlagevermögen', 290, 3854, 'Einrichtungen für Geschäfts-. Fabrik- und andere Bauten'); --INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3869, 'SKR04', 'Anlagevermögen', 300, 3854, Wohnbauten'); --INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3870, 'SKR04', 'Anlagevermögen', 305, 3854, Garagen'); --INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3871, 'SKR04', 'Anlagevermögen', 310, 3854, Außenanlagen'); From 583acfbad4c18c8ba748485c584f24678521bed9 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 3 Jun 2021 09:29:12 +0200 Subject: [PATCH 159/739] Fix #17791 : fix at account --- htdocs/accountancy/admin/account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 6f510ad3706..ba5bb2105d2 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -165,7 +165,7 @@ if (empty($reshook)) { } $offsetforchartofaccount += ($conf->entity * 100000000); - $result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); + $result = run_sql($sqlfile, 0, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); if ($result > 0) { setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); From 8f7daf7f5719355c7f6a928e637fc45da568eb9e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 3 Jun 2021 09:32:58 +0200 Subject: [PATCH 160/739] Fix 17791 : fix for at account --- htdocs/accountancy/admin/account.php | 2 +- .../mysql/data/llx_accounting_account_at.sql | 642 +++++++++--------- 2 files changed, 322 insertions(+), 322 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index ba5bb2105d2..6f510ad3706 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -165,7 +165,7 @@ if (empty($reshook)) { } $offsetforchartofaccount += ($conf->entity * 100000000); - $result = run_sql($sqlfile, 0, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); + $result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); if ($result > 0) { setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); diff --git a/htdocs/install/mysql/data/llx_accounting_account_at.sql b/htdocs/install/mysql/data/llx_accounting_account_at.sql index c20d5877dc2..402e6893e6b 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_at.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_at.sql @@ -22,324 +22,324 @@ -- Descriptif des plans comptables autrichiens standard -- ADD 4100000 to rowid # Do no remove this comment -- -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','0','GROUP0','110','0','Patentrechte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 2, 'AT-BASE','0','GROUP0','120','0','Software'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3, 'AT-BASE','0','GROUP0','121','0','ERP System'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 4, 'AT-BASE','0','GROUP0','122','0','Homepage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 5, 'AT-BASE','0','GROUP0','125','0','Software Fremdentwicklung_noch nicht aktivieren'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 6, 'AT-BASE','0','GROUP0','160','0','Umgründungsmehrwert'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 7, 'AT-BASE','0','GROUP0','250','0','Mieterinvestitionen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 8, 'AT-BASE','0','GROUP0','400','0','Maschinen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 9, 'AT-BASE','0','GROUP0','600','0','Betriebs u. Geschäftsausstattung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 10, 'AT-BASE','0','GROUP0','601','0','Ausstellungsstücke'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 11, 'AT-BASE','0','GROUP0','602','0','Leihstellungsstücke'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 12, 'AT-BASE','0','GROUP0','603','0','Getriebeprüfstand_hinten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 13, 'AT-BASE','0','GROUP0','604','0','Wuchtstand_links_AQ'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 14, 'AT-BASE','0','GROUP0','605','0','Messlabor(Messraum)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 15, 'AT-BASE','0','GROUP0','606','0','PAK-System'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 16, 'AT-BASE','0','GROUP0','607','0','Server'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 17, 'AT-BASE','0','GROUP0','608','0','EDV-Ausstattung (Hardware)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 18, 'AT-BASE','0','GROUP0','609','0','Werkstattausstattung (Werkzeug)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 19, 'AT-BASE','0','GROUP0','610','0','Wuchtprüfstand neu_noch nicht in Betrieb genommen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 20, 'AT-BASE','0','GROUP0','611','0','Messequipment/Ausstattung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 21, 'AT-BASE','0','GROUP0','630','0','PKW'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 22, 'AT-BASE','0','GROUP0','640','0','LKW'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 23, 'AT-BASE','0','GROUP0','680','0','GWG-Geschäftsausstattung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 24, 'AT-BASE','0','GROUP0','710','0','Anlagen in Bau'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 25, 'AT-BASE','1','GROUP1','1100','0','Rohstoffe'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 26, 'AT-BASE','1','GROUP1','1200','0','Bezogenen Teile'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 27, 'AT-BASE','1','GROUP1','1300','0','Hilfsstoffe und Betriebsstoffe'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 28, 'AT-BASE','1','GROUP1','1400','0','fertige Erzeugnisse'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 29, 'AT-BASE','1','GROUP1','1500','0','unfertige Erzeugnisse'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 30, 'AT-BASE','1','GROUP1','1600','0','Waren'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 31, 'AT-BASE','1','GROUP1','1700','0','Noch nicht abrechenbare Leist.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 32, 'AT-BASE','1','GROUP1','1701','0','Bestandsveränderung laufend'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 33, 'AT-BASE','1','GROUP1','1800','0','Vorrat Verpackungsmaterial'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 34, 'AT-BASE','1','GROUP1','1810','0','Vorrat Werbematerial'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 35, 'AT-BASE','2','GROUP2','2000','0','Lieferforderungen Inland I'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 36, 'AT-BASE','2','GROUP2','2080','0','Einzelwertb. Ford. Inland'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 37, 'AT-BASE','2','GROUP2','2292','0','geleistete Anzahlungen (20%)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 38, 'AT-BASE','2','GROUP2','2293','0','gel. Anzahlungen i.g.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 39, 'AT-BASE','2','GROUP2','2301','0','Forderung Forschungsprämie'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 40, 'AT-BASE','2','GROUP2','2302','0','Forderungen gelieferte (noch nicht fakturierte Waren)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 41, 'AT-BASE','2','GROUP2','2303','0','Vorauszahlung Leasing Server'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 42, 'AT-BASE','2','GROUP2','2306','0','Kaution Pfauengarten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 43, 'AT-BASE','2','GROUP2','2307','0','Kaution Werkstatt'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 44, 'AT-BASE','2','GROUP2','2308','0','Kaution Parkplatz PKW'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 45, 'AT-BASE','2','GROUP2','2309','0','Kaution Werkstatt'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 46, 'AT-BASE','2','GROUP2','2310','0','Kaution Studentenwohnheim'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 47, 'AT-BASE','2','GROUP2','2311','0','Kaution China'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 48, 'AT-BASE','2','GROUP2','2312','0','Vorauszahlung Xerox'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 49, 'AT-BASE','2','GROUP2','2313','0','Verrechnung Bildungsscheck'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 50, 'AT-BASE','2','GROUP2','2315','0','Aktivierung Körperschaftsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 51, 'AT-BASE','2','GROUP2','2500','0','Vorsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 52, 'AT-BASE','2','GROUP2','2501','0','Vorsteuer aus i. g. Erwerb'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 53, 'AT-BASE','2','GROUP2','2502','0','Vorsteuer reverse charge syst.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 54, 'AT-BASE','2','GROUP2','2503','0','Vorsteuer Reverse Charge § 19/1d'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 55, 'AT-BASE','2','GROUP2','2508','0','Vorsteuer sonstige Leistungen EU'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 56, 'AT-BASE','2','GROUP2','2509','0','EUSt Forderung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 57, 'AT-BASE','2','GROUP2','2510','0','Einfuhrumsatzsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 58, 'AT-BASE','2','GROUP2','2531','0','Vorsteuer Frankreich'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 59, 'AT-BASE','2','GROUP2','2532','0','Vorsteuer Niederlande'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 60, 'AT-BASE','2','GROUP2','2533','0','Vorsteuer GB'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 61, 'AT-BASE','2','GROUP2','2534','0','Vorsteuer Belgien'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 62, 'AT-BASE','2','GROUP2','2535','0','Vorsteuer GB'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 63, 'AT-BASE','2','GROUP2','2901','0','Leasingvorauszahlung Vito'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 64, 'AT-BASE','3','GROUP3','3020','0','Rückstellung für Körperschaftsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 65, 'AT-BASE','3','GROUP3','3060','0','Rst. für Beratungskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 66, 'AT-BASE','3','GROUP3','3064','0','Rst. für Sonderzahlungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 67, 'AT-BASE','3','GROUP3','3072','0','Rst. für nicht konsum. Urlaube'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 68, 'AT-BASE','3','GROUP3','3214','0','Raika 40-00.800.185'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 69, 'AT-BASE','3','GROUP3','3286','0','Darlehen Dipl. Ing. REICH GMBH'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 70, 'AT-BASE','3','GROUP3','3287','0','Darlehen Dr.Höfler'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 71, 'AT-BASE','3','GROUP3','3288','0','Darlehen DI Mayrhofer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 72, 'AT-BASE','3','GROUP3','3289','0','Darlehen AWS'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 73, 'AT-BASE','3','GROUP3','3292','0','Anzahlungen von Kunden 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 74, 'AT-BASE','3','GROUP3','3294','0','Anzahlungen von Kunden Drittland'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 75, 'AT-BASE','3','GROUP3','3300','0','Lieferverbindlichkeiten I'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 76, 'AT-BASE','3','GROUP3','3481','0','Verrechnungskto DI Mayrhofer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 77, 'AT-BASE','3','GROUP3','3500','0','Umsatzsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 78, 'AT-BASE','3','GROUP3','3501','0','Umsatzsteuer aus i. g. Erwerb'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 79, 'AT-BASE','3','GROUP3','3502','0','USt § 19/Art 19 (reverse Charge)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 80, 'AT-BASE','3','GROUP3','3503','0','Umsatzsteuer Reverse Charge § 19/1d'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 81, 'AT-BASE','3','GROUP3','3508','0','Umsatzsteuer sonstige Leistung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 82, 'AT-BASE','3','GROUP3','3531','0','FA-Zahllast Dezember'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 83, 'AT-BASE','3','GROUP3','3533','0','Umsatzsteuer 2012'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 84, 'AT-BASE','3','GROUP3','3535','0','Umsatzsteuer 2013'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 85, 'AT-BASE','3','GROUP3','3536','0','Umsatzsteuer 2014'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 86, 'AT-BASE','3','GROUP3','3537','0','Umsatzsteuer 2015'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 87, 'AT-BASE','3','GROUP3','3632','0','Verrechnungskonto EUSt'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 88, 'AT-BASE','3','GROUP3','3892','0','Verbindlichkeiten Anzahlungsrechn.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 89, 'AT-BASE','3','GROUP3','3898','0','Abgrenzung Sonderzahlungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 90, 'AT-BASE','4','GROUP4','4000','0','Erlöse Lieferungen 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 91, 'AT-BASE','4','GROUP4','4001','0','Erlöse i.g. Lieferung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 92, 'AT-BASE','4','GROUP4','4002','0','Erlöse Dienstleistungen EU'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 93, 'AT-BASE','4','GROUP4','4003','0','Erlöse Dienstleistungen 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 94, 'AT-BASE','4','GROUP4','4004','0','Erlöse Software 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 95, 'AT-BASE','4','GROUP4','4005','0','Erlöse Software EU'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 96, 'AT-BASE','4','GROUP4','4006','0','Evidenz Kfd. Reverse Charge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 97, 'AT-BASE','4','GROUP4','4050','0','Erlöse 0 % Drittland'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 98, 'AT-BASE','4','GROUP4','4051','0','Erlöse Dienstleistungen Drittland'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 99, 'AT-BASE','4','GROUP4','4052','0','Erlöse Software Drittland'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 100, 'AT-BASE','4','GROUP4','4069','0','Erlöse § 19/1d Schrott'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 101, 'AT-BASE','4','GROUP4','4400','0','Kundenskonto 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 102, 'AT-BASE','4','GROUP4','4405','0','Kundenskonto 0 % Ausfuhrlieferungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 103, 'AT-BASE','4','GROUP4','4410','0','Skontoaufwand i.g. Lieferung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 104, 'AT-BASE','4','GROUP4','4413','0','Kundenskonto sonstige Leistung EU'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 105, 'AT-BASE','4','GROUP4','4420','0','Kundenskonto EU-Land A x %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 106, 'AT-BASE','4','GROUP4','4450','0','Kundenrabatt 20%'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 107, 'AT-BASE','4','GROUP4','4500','0','Bestandsveränderungen fertige Erzeugnisse'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 108, 'AT-BASE','4','GROUP4','4510','0','Best.Veränd.Halbf.Erzeugnisse'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 109, 'AT-BASE','4','GROUP4','4519','0','Bestandsveränderung laufend'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 110, 'AT-BASE','4','GROUP4','4520','0','Best.Veränd.n.n.abger.Leist.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 111, 'AT-BASE','4','GROUP4','4530','0','Gelieferte (noch nicht fakturierte Waren)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 112, 'AT-BASE','4','GROUP4','4580','0','Aktivierte Eigenleistung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 113, 'AT-BASE','4','GROUP4','4630','0','Erträge aus d.Abgang v.Anlagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 114, 'AT-BASE','4','GROUP4','4801','0','Zuwendungen a.öffentl. Mitteln'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 115, 'AT-BASE','4','GROUP4','4831','0','sonstige betriebliche Erträge (nicht steuerbar)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 116, 'AT-BASE','4','GROUP4','4840','0','Sonstige Erlöse 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 117, 'AT-BASE','4','GROUP4','4850','0','Erl. Aufwandersätze'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 118, 'AT-BASE','4','GROUP4','4881','0','Versicherungsvergütungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 119, 'AT-BASE','4','GROUP4','4885','0','Zuschreibungen zum Umlaufvermögen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 120, 'AT-BASE','4','GROUP4','4950','0','Privatanteil 20 %'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 121, 'AT-BASE','4','GROUP4','4991','0','Sachbezüge 20%'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 122, 'AT-BASE','5','GROUP5','5000','0','Handelswareneinsatz'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 123, 'AT-BASE','5','GROUP5','5001','0','Materialeinkauf Fremdfertigung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 124, 'AT-BASE','5','GROUP5','5002','0','Wareneinkauf Verkauf'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 125, 'AT-BASE','5','GROUP5','5020','0','Materialeinkauf'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 126, 'AT-BASE','5','GROUP5','5090','0','Bezugskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 127, 'AT-BASE','5','GROUP5','5100','0','Verbrauch Rohstoffe'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 128, 'AT-BASE','5','GROUP5','5199','0','Aufwand für TW-AFA Vorräte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 129, 'AT-BASE','5','GROUP5','5200','0','Verbrauch bezogenen Teile'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 130, 'AT-BASE','5','GROUP5','5300','0','Verbrauch Hilfsstoffe'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 131, 'AT-BASE','5','GROUP5','5400','0','Hilfsstoffverbrauch'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 132, 'AT-BASE','5','GROUP5','5440','0','Inventurveränderung Fremdbarb. + GK'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 133, 'AT-BASE','5','GROUP5','5441','0','GWG Fremdbarb. + GK'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 134, 'AT-BASE','5','GROUP5','5450','0','Verpackungsmaterial'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 135, 'AT-BASE','5','GROUP5','5800','0','Fremdleistungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 136, 'AT-BASE','5','GROUP5','5880','0','Lieferantenskonti'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 137, 'AT-BASE','5','GROUP5','5900','0','Skontoertrag ig.E. 0% (m.VST)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 138, 'AT-BASE','5','GROUP5','5920','0','Skontoertrag ig.E. 20% (m.VST)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 139, 'AT-BASE','6','GROUP6','6000','0','Löhne'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 140, 'AT-BASE','6','GROUP6','6001','0','Rückerstattung AUVA Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 141, 'AT-BASE','6','GROUP6','6010','0','Lehrlingsentschädigung Arb.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 142, 'AT-BASE','6','GROUP6','6020','0','Nichtleistungslöhne'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 143, 'AT-BASE','6','GROUP6','6100','0','Leihpersonal Aufwand'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 144, 'AT-BASE','6','GROUP6','6150','0','Sonderzahlungen Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 145, 'AT-BASE','6','GROUP6','6200','0','Gehälter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 146, 'AT-BASE','6','GROUP6','6201','0','Förderung AMS'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 147, 'AT-BASE','6','GROUP6','6202','0','Rückerstattung AUVA Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 148, 'AT-BASE','6','GROUP6','6210','0','Veränderung Mehrarbeitsvergütung RSt Ang'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 149, 'AT-BASE','6','GROUP6','6211','0','Veränderung Mehrarbeitsvergütung RSt Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 150, 'AT-BASE','6','GROUP6','6230','0','Sonderzahlungen Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 151, 'AT-BASE','6','GROUP6','6231','0','Dotierung RST Sonderzahlungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 152, 'AT-BASE','6','GROUP6','6255','0','Geschäftsführerbezüge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 153, 'AT-BASE','6','GROUP6','6256','0','Geschäftsführersachbezüge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 154, 'AT-BASE','6','GROUP6','6300','0','Sonderzahlung aliquot vorläufig'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 155, 'AT-BASE','6','GROUP6','6310','0','Dotierung Urlaubsrückstellung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 156, 'AT-BASE','6','GROUP6','6311','0','Veränderung Urlaubsrückstellung Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 157, 'AT-BASE','6','GROUP6','6402','0','Betriebliche Vorsorgekassa Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 158, 'AT-BASE','6','GROUP6','6407','0','Betriebliche Vorsorgekassa Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 159, 'AT-BASE','6','GROUP6','6416','0','Veränderung Pensionsrückstellung (Angestellte)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 160, 'AT-BASE','6','GROUP6','6435','0','sonstige Beiträge für die Altersversorgung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 161, 'AT-BASE','6','GROUP6','6500','0','Gesetzlicher Sozialaufwand'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 162, 'AT-BASE','6','GROUP6','6600','0','Gesetzlicher Sozialaufwand Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 163, 'AT-BASE','6','GROUP6','6605','0','Gesetzlicher Sozialaufwand Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 164, 'AT-BASE','6','GROUP6','6610','0','Dienstgeberbeitrag Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 165, 'AT-BASE','6','GROUP6','6611','0','Dienstgeberbeitrag Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 166, 'AT-BASE','6','GROUP6','6620','0','Zuschlag zum DB'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 167, 'AT-BASE','6','GROUP6','6621','0','Zuschlag zum DB Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 168, 'AT-BASE','6','GROUP6','6630','0','Ausgleichstaxe'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 169, 'AT-BASE','6','GROUP6','6690','0','Lohnsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 170, 'AT-BASE','6','GROUP6','6693','0','Kommunalsteuer Arbeiter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 171, 'AT-BASE','6','GROUP6','6694','0','Kommunalsteuer Angestellte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 172, 'AT-BASE','6','GROUP6','6700','0','Freiwilliger Sozialaufwand'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 173, 'AT-BASE','6','GROUP6','6710','0','Arbeitskleidung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 174, 'AT-BASE','6','GROUP6','6720','0','Fahrspesen Dienstnehmer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 175, 'AT-BASE','6','GROUP6','6730','0','Weihnachtsgeschenke Arbeitnehmer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 176, 'AT-BASE','6','GROUP6','6740','0','Betriebsveranstaltungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 177, 'AT-BASE','6','GROUP6','6750','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 178, 'AT-BASE','6','GROUP6','6760','0','Vergleichszahlung Dienstnehmer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 179, 'AT-BASE','7','GROUP7','7030','0','Abschreibung G W G'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 180, 'AT-BASE','7','GROUP7','7070','0','Buchwert ausgeschiedener Anlagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 181, 'AT-BASE','7','GROUP7','7080','0','Planmäßige AFA immat.WG.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 182, 'AT-BASE','7','GROUP7','7081','0','Planmäßige Abschreibung für Sachanlagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 183, 'AT-BASE','7','GROUP7','7100','0','Nicht abzugsfähige Vorsteuer (VStK)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 184, 'AT-BASE','7','GROUP7','7110','0','Gebühren und Abgaben_Zoll'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 185, 'AT-BASE','7','GROUP7','7111','0','Kammerumlage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 186, 'AT-BASE','7','GROUP7','7200','0','Instandhaltung Gebäude'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 187, 'AT-BASE','7','GROUP7','7201','0','Instandhaltung Außenanlagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 188, 'AT-BASE','7','GROUP7','7202','0','Instandh. - Maschinen u. Anl.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 189, 'AT-BASE','7','GROUP7','7204','0','Instandhaltung und Betriebskosten Betriebs und Geschäftsgebäude'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 190, 'AT-BASE','7','GROUP7','7205','0','Verbrauchsmaterial Werkstatt'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 191, 'AT-BASE','7','GROUP7','7210','0','Müllentsorgung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 192, 'AT-BASE','7','GROUP7','7211','0','Entsorgungskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 193, 'AT-BASE','7','GROUP7','7230','0','Reinigungsmaterial (div. Verbrauchsmaterial)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 194, 'AT-BASE','7','GROUP7','7231','0','Berufsbekleidung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 195, 'AT-BASE','7','GROUP7','7235','0','Reinigung durch Dritte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 196, 'AT-BASE','7','GROUP7','7240','0','LKW-Betriebskosten Vito G 437 MB'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 197, 'AT-BASE','7','GROUP7','7241','0','Leasing Mercedes Vito G 437 MB'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 198, 'AT-BASE','7','GROUP7','7250','0','KFZ Betriebskosten allgemein'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 199, 'AT-BASE','7','GROUP7','7251','0','KFZ Leasing allgemein'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 200, 'AT-BASE','7','GROUP7','7252','0','KFZ Versicherungen allgemein'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 201, 'AT-BASE','7','GROUP7','7253','0','Wachdienst'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 202, 'AT-BASE','7','GROUP7','7254','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 203, 'AT-BASE','7','GROUP7','7255','0','Aufwand Leihwagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 204, 'AT-BASE','7','GROUP7','7256','0','PKW-Betriebskosten VW Golf G 854 SH Versuchsfahrzeug'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 205, 'AT-BASE','7','GROUP7','7257','0','Leasing VW Golf G 854 SH'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 206, 'AT-BASE','7','GROUP7','7258','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 207, 'AT-BASE','7','GROUP7','7285','0','Strom'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 208, 'AT-BASE','7','GROUP7','7286','0','Betriebskosten/Beheizung Mietobjekte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 209, 'AT-BASE','7','GROUP7','7300','0','Transporte durch Dritte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 210, 'AT-BASE','7','GROUP7','7330','0','Reise und Fahrtspesen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 211, 'AT-BASE','7','GROUP7','7331','0','Kilometergelder'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 212, 'AT-BASE','7','GROUP7','7360','0','Reisediäten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 213, 'AT-BASE','7','GROUP7','7380','0','Telefon'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 214, 'AT-BASE','7','GROUP7','7381','0','Internet'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 215, 'AT-BASE','7','GROUP7','7382','0','Wartung Homepage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 216, 'AT-BASE','7','GROUP7','7390','0','Postgebühren'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 217, 'AT-BASE','7','GROUP7','7400','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 218, 'AT-BASE','7','GROUP7','7401','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 219, 'AT-BASE','7','GROUP7','7402','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 220, 'AT-BASE','7','GROUP7','7403','0','Miete Büro Linz'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 221, 'AT-BASE','7','GROUP7','7404','0','Miete Gradnerstraße'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 222, 'AT-BASE','7','GROUP7','7410','0','Maschinen u. Gerätemieten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 223, 'AT-BASE','7','GROUP7','7411','0','Wartungskosten BuG Ausstattung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 224, 'AT-BASE','7','GROUP7','7420','0','Mobilien-Leasing '); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 225, 'AT-BASE','7','GROUP7','7421','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 226, 'AT-BASE','7','GROUP7','7422','0','Leasing Server'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 227, 'AT-BASE','7','GROUP7','7423','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 228, 'AT-BASE','7','GROUP7','7424','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 229, 'AT-BASE','7','GROUP7','7480','0','Lizenzgebühren'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 230, 'AT-BASE','7','GROUP7','7540','0','Provisionen an Dritte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 231, 'AT-BASE','7','GROUP7','7600','0','Büromaterial'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 232, 'AT-BASE','7','GROUP7','7601','0','EDV-Material'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 233, 'AT-BASE','7','GROUP7','7610','0','Drucksorten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 234, 'AT-BASE','7','GROUP7','7620','0','Fachliteratur und Zeitungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 235, 'AT-BASE','7','GROUP7','7630','0','Gästeunt. u. Zeitschriften'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 236, 'AT-BASE','7','GROUP7','7650','0','Werbeaufwand/Inserate'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 237, 'AT-BASE','7','GROUP7','7651','0','Anbahnung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 238, 'AT-BASE','7','GROUP7','7652','0','Aufwand Messen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 239, 'AT-BASE','7','GROUP7','7653','0','Konto frei'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 240, 'AT-BASE','7','GROUP7','7654','0','Inserate'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 241, 'AT-BASE','7','GROUP7','7670','0','Bewirtungskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 242, 'AT-BASE','7','GROUP7','7690','0','Trinkgelder u. Spenden'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 243, 'AT-BASE','7','GROUP7','7691','0','Spenden an begünstigte Institutionen/Sponsoring'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 244, 'AT-BASE','7','GROUP7','7696','0','Säumnis- und Verspätungszuschläge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 245, 'AT-BASE','7','GROUP7','7700','0','Betriebsversicherungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 246, 'AT-BASE','7','GROUP7','7701','0','Transportversicherungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 247, 'AT-BASE','7','GROUP7','7710','0','Pflichtversich. Unternehmer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 248, 'AT-BASE','7','GROUP7','7749','0','Aufwand Japan'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 249, 'AT-BASE','7','GROUP7','7750','0','Steuerberatung (Lohnverrechnung, Buchhaltung)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 250, 'AT-BASE','7','GROUP7','7751','0','Patentkosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 251, 'AT-BASE','7','GROUP7','7752','0','Rechtsberatung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 252, 'AT-BASE','7','GROUP7','7753','0','Unternehmensberatung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 253, 'AT-BASE','7','GROUP7','7754','0','Aufwand tectos China'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 254, 'AT-BASE','7','GROUP7','7755','0','Wartung (Betreuung EDV)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 255, 'AT-BASE','7','GROUP7','7756','0','Lizenzgebühren Abaqus'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 256, 'AT-BASE','7','GROUP7','7757','0','Lizenzgebühren Sonstige'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 257, 'AT-BASE','7','GROUP7','7758','0','Sonstige Beratungskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 258, 'AT-BASE','7','GROUP7','7759','0','EDV-Beratung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 259, 'AT-BASE','7','GROUP7','7760','0','Mitgliedsbeiträge/freiwillige Beiträge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 260, 'AT-BASE','7','GROUP7','7761','0','Prüfung Jahresabschluss'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 261, 'AT-BASE','7','GROUP7','7770','0','Aus- und Fortbildung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 262, 'AT-BASE','7','GROUP7','7775','0','Forschung und Entwicklung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 263, 'AT-BASE','7','GROUP7','7776','0','Messentwicklung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 264, 'AT-BASE','7','GROUP7','7777','0','Produktentwicklung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 265, 'AT-BASE','7','GROUP7','7785','0','Freiwillige Verbandsbeiträge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 266, 'AT-BASE','7','GROUP7','7790','0','Spesen des Geldverkehrs'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 267, 'AT-BASE','7','GROUP7','7791','0','Kursdifferenzen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 268, 'AT-BASE','7','GROUP7','7800','0','Betriebsbedingte Schadensfälle'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 269, 'AT-BASE','7','GROUP7','7801','0','Ausgaben nicht absetzbar'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 270, 'AT-BASE','7','GROUP7','7802','0','Strafen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 271, 'AT-BASE','7','GROUP7','7805','0','Forderungsverluste 20'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 272, 'AT-BASE','7','GROUP7','7806','0','Abschreibungen auf Forderungen (EU)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 273, 'AT-BASE','7','GROUP7','7807','0','Abschreibungen auf Forderungen (Drittland)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 274, 'AT-BASE','7','GROUP7','7810','0','Zuweisung an Einzel-WB Forderungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 275, 'AT-BASE','7','GROUP7','7811','0','Zuweisung pauschale Wertberichtigungen zu Exportforderungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 276, 'AT-BASE','7','GROUP7','7812','0','Abschreibungen auf Vorräte'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 277, 'AT-BASE','7','GROUP7','7820','0','Buchwert abgegangener Sachanlagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 278, 'AT-BASE','7','GROUP7','7840','0','Gründungskosten'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 279, 'AT-BASE','7','GROUP7','7850','0','Sonstiger Aufwand'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 280, 'AT-BASE','7','GROUP7','7851','0','Sonstiger Aufwand Gewinnanteil Reich'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 281, 'AT-BASE','7','GROUP7','7930','0','Aufw. Gewährleistungsverpfl.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 282, 'AT-BASE','7','GROUP7','7940','0','Aufwand aus Vorperioden'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 283, 'AT-BASE','8','GROUP8','8020','0','Gewinnüberrg. v. Organgesell.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 284, 'AT-BASE','8','GROUP8','8060','0','Zinserträge'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 285, 'AT-BASE','8','GROUP8','8090','0','Ertr.a.Ant.a.and. Unternehmen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 286, 'AT-BASE','8','GROUP8','8100','0','Habenzinsen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 287, 'AT-BASE','8','GROUP8','8280','0','Zinsen f. Kredite u. Darlehen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 288, 'AT-BASE','8','GROUP8','8286','0','Kursgewinne/Kursverluste'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 289, 'AT-BASE','8','GROUP8','8288','0','Zinsen auf Lieferantenkredite'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 290, 'AT-BASE','8','GROUP8','8291','0','Sonst. Zinsen und ähnliche Aufwendungen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 291, 'AT-BASE','8','GROUP8','8500','0','Körperschaftsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 292, 'AT-BASE','8','GROUP8','8505','0','Kapitalertragsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 293, 'AT-BASE','8','GROUP8','8510','0','Körperschaftsteuervorauszahl.'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 294, 'AT-BASE','8','GROUP8','8511','0','Dotierung KöSt-Rückstellung'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 295, 'AT-BASE','8','GROUP8','8512','0','Aktivierung Körperschaftsteuer'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 296, 'AT-BASE','8','GROUP8','8513','0','Köst Vorperioden'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 297, 'AT-BASE','8','GROUP8','8520','0','Forschungsprämie'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 298, 'AT-BASE','8','GROUP8','8595','0','Ertrag aus der Aktivierung latenter Steuern'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 299, 'AT-BASE','8','GROUP8','8610','0','Auflösung sonstiger unversteuerter Rücklagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 300, 'AT-BASE','8','GROUP8','8700','0','Auflösung gebundener Kapitalrücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 301, 'AT-BASE','8','GROUP8','8710','0','Auflösung Rücklage für eigene Anteile'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 302, 'AT-BASE','8','GROUP8','8720','0','Auflösung nicht gebundene Kapitalrücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 303, 'AT-BASE','8','GROUP8','8750','0','Auflösung gesetzliche Rücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 304, 'AT-BASE','8','GROUP8','8760','0','Auflösung satzungsmäßige Rücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 305, 'AT-BASE','8','GROUP8','8770','0','Auflösung andere (freie) Rücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 306, 'AT-BASE','8','GROUP8','8810','0','Zuweisung sonstige unversteuerte Rücklagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 307, 'AT-BASE','8','GROUP8','8820','0','Zuweisung Inv. Rücklage'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 308, 'AT-BASE','8','GROUP8','8890','0','Zuw.Bew.Res.GWG'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 309, 'AT-BASE','8','GROUP8','8900','0','Zuweisung gesetzliche Rücklagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 310, 'AT-BASE','8','GROUP8','8910','0','Zuweisung satzungsmäßige Rücklagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 311, 'AT-BASE','8','GROUP8','8920','0','Zuweisung andere (freie) Rücklagen'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 312, 'AT-BASE','9','GROUP9','9390','0','Bilanzgewinn'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 313, 'AT-BASE','9','GROUP9','9391','0','Bilanzverlust'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 314, 'AT-BASE','9','GROUP9','9700','0','Wachdienst'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 315, 'AT-BASE','9','GROUP9','9991','0','Gewinnvortrag'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 316, 'AT-BASE','9','GROUP9','9993','0','Verlustvortrag'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 317, 'AT-BASE','9','GROUP9','9994','0','Verlustvortrag'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 318, 'AT-BASE','5','GROUP5','50200','0','Materialeinkauf'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 319, 'AT-BASE','6','GROUP6','60000','0','kalk. Löhne u Gehälter'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 320, 'AT-BASE','6','GROUP6','64160','0','Veränderung Pensionsrückstellung (Angestellte)'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 321, 'AT-BASE','6','GROUP6','66300','0','Leistungserfassung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','GROUP0','110','0','Patentrechte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 2, 'AT-BASE','GROUP0','120','0','Software'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3, 'AT-BASE','GROUP0','121','0','ERP System'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 4, 'AT-BASE','GROUP0','122','0','Homepage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 5, 'AT-BASE','GROUP0','125','0','Software Fremdentwicklung_noch nicht aktivieren'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 6, 'AT-BASE','GROUP0','160','0','Umgründungsmehrwert'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 7, 'AT-BASE','GROUP0','250','0','Mieterinvestitionen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 8, 'AT-BASE','GROUP0','400','0','Maschinen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 9, 'AT-BASE','GROUP0','600','0','Betriebs u. Geschäftsausstattung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 10, 'AT-BASE','GROUP0','601','0','Ausstellungsstücke'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 11, 'AT-BASE','GROUP0','602','0','Leihstellungsstücke'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 12, 'AT-BASE','GROUP0','603','0','Getriebeprüfstand_hinten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 13, 'AT-BASE','GROUP0','604','0','Wuchtstand_links_AQ'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 14, 'AT-BASE','GROUP0','605','0','Messlabor(Messraum)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 15, 'AT-BASE','GROUP0','606','0','PAK-System'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 16, 'AT-BASE','GROUP0','607','0','Server'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 17, 'AT-BASE','GROUP0','608','0','EDV-Ausstattung (Hardware)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 18, 'AT-BASE','GROUP0','609','0','Werkstattausstattung (Werkzeug)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 19, 'AT-BASE','GROUP0','610','0','Wuchtprüfstand neu_noch nicht in Betrieb genommen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 20, 'AT-BASE','GROUP0','611','0','Messequipment/Ausstattung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 21, 'AT-BASE','GROUP0','630','0','PKW'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 22, 'AT-BASE','GROUP0','640','0','LKW'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 23, 'AT-BASE','GROUP0','680','0','GWG-Geschäftsausstattung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 24, 'AT-BASE','GROUP0','710','0','Anlagen in Bau'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 25, 'AT-BASE','GROUP1','1100','0','Rohstoffe'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 26, 'AT-BASE','GROUP1','1200','0','Bezogenen Teile'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 27, 'AT-BASE','GROUP1','1300','0','Hilfsstoffe und Betriebsstoffe'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 28, 'AT-BASE','GROUP1','1400','0','fertige Erzeugnisse'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 29, 'AT-BASE','GROUP1','1500','0','unfertige Erzeugnisse'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 30, 'AT-BASE','GROUP1','1600','0','Waren'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 31, 'AT-BASE','GROUP1','1700','0','Noch nicht abrechenbare Leist.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 32, 'AT-BASE','GROUP1','1701','0','Bestandsveränderung laufend'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 33, 'AT-BASE','GROUP1','1800','0','Vorrat Verpackungsmaterial'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 34, 'AT-BASE','GROUP1','1810','0','Vorrat Werbematerial'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 35, 'AT-BASE','GROUP2','2000','0','Lieferforderungen Inland I'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 36, 'AT-BASE','GROUP2','2080','0','Einzelwertb. Ford. Inland'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 37, 'AT-BASE','GROUP2','2292','0','geleistete Anzahlungen (20%)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 38, 'AT-BASE','GROUP2','2293','0','gel. Anzahlungen i.g.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 39, 'AT-BASE','GROUP2','2301','0','Forderung Forschungsprämie'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 40, 'AT-BASE','GROUP2','2302','0','Forderungen gelieferte (noch nicht fakturierte Waren)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 41, 'AT-BASE','GROUP2','2303','0','Vorauszahlung Leasing Server'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 42, 'AT-BASE','GROUP2','2306','0','Kaution Pfauengarten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 43, 'AT-BASE','GROUP2','2307','0','Kaution Werkstatt'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 44, 'AT-BASE','GROUP2','2308','0','Kaution Parkplatz PKW'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 45, 'AT-BASE','GROUP2','2309','0','Kaution Werkstatt'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 46, 'AT-BASE','GROUP2','2310','0','Kaution Studentenwohnheim'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 47, 'AT-BASE','GROUP2','2311','0','Kaution China'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 48, 'AT-BASE','GROUP2','2312','0','Vorauszahlung Xerox'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 49, 'AT-BASE','GROUP2','2313','0','Verrechnung Bildungsscheck'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 50, 'AT-BASE','GROUP2','2315','0','Aktivierung Körperschaftsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 51, 'AT-BASE','GROUP2','2500','0','Vorsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 52, 'AT-BASE','GROUP2','2501','0','Vorsteuer aus i. g. Erwerb'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 53, 'AT-BASE','GROUP2','2502','0','Vorsteuer reverse charge syst.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 54, 'AT-BASE','GROUP2','2503','0','Vorsteuer Reverse Charge § 19/1d'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 55, 'AT-BASE','GROUP2','2508','0','Vorsteuer sonstige Leistungen EU'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 56, 'AT-BASE','GROUP2','2509','0','EUSt Forderung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 57, 'AT-BASE','GROUP2','2510','0','Einfuhrumsatzsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 58, 'AT-BASE','GROUP2','2531','0','Vorsteuer Frankreich'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 59, 'AT-BASE','GROUP2','2532','0','Vorsteuer Niederlande'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 60, 'AT-BASE','GROUP2','2533','0','Vorsteuer GB'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 61, 'AT-BASE','GROUP2','2534','0','Vorsteuer Belgien'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 62, 'AT-BASE','GROUP2','2535','0','Vorsteuer GB'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 63, 'AT-BASE','GROUP2','2901','0','Leasingvorauszahlung Vito'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 64, 'AT-BASE','GROUP3','3020','0','Rückstellung für Körperschaftsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 65, 'AT-BASE','GROUP3','3060','0','Rst. für Beratungskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 66, 'AT-BASE','GROUP3','3064','0','Rst. für Sonderzahlungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 67, 'AT-BASE','GROUP3','3072','0','Rst. für nicht konsum. Urlaube'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 68, 'AT-BASE','GROUP3','3214','0','Raika 40-00.800.185'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 69, 'AT-BASE','GROUP3','3286','0','Darlehen Dipl. Ing. REICH GMBH'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 70, 'AT-BASE','GROUP3','3287','0','Darlehen Dr.Höfler'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 71, 'AT-BASE','GROUP3','3288','0','Darlehen DI Mayrhofer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 72, 'AT-BASE','GROUP3','3289','0','Darlehen AWS'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 73, 'AT-BASE','GROUP3','3292','0','Anzahlungen von Kunden 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 74, 'AT-BASE','GROUP3','3294','0','Anzahlungen von Kunden Drittland'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 75, 'AT-BASE','GROUP3','3300','0','Lieferverbindlichkeiten I'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 76, 'AT-BASE','GROUP3','3481','0','Verrechnungskto DI Mayrhofer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 77, 'AT-BASE','GROUP3','3500','0','Umsatzsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 78, 'AT-BASE','GROUP3','3501','0','Umsatzsteuer aus i. g. Erwerb'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 79, 'AT-BASE','GROUP3','3502','0','USt § 19/Art 19 (reverse Charge)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 80, 'AT-BASE','GROUP3','3503','0','Umsatzsteuer Reverse Charge § 19/1d'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 81, 'AT-BASE','GROUP3','3508','0','Umsatzsteuer sonstige Leistung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 82, 'AT-BASE','GROUP3','3531','0','FA-Zahllast Dezember'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 83, 'AT-BASE','GROUP3','3533','0','Umsatzsteuer 2012'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 84, 'AT-BASE','GROUP3','3535','0','Umsatzsteuer 2013'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 85, 'AT-BASE','GROUP3','3536','0','Umsatzsteuer 2014'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 86, 'AT-BASE','GROUP3','3537','0','Umsatzsteuer 2015'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 87, 'AT-BASE','GROUP3','3632','0','Verrechnungskonto EUSt'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 88, 'AT-BASE','GROUP3','3892','0','Verbindlichkeiten Anzahlungsrechn.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 89, 'AT-BASE','GROUP3','3898','0','Abgrenzung Sonderzahlungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 90, 'AT-BASE','GROUP4','4000','0','Erlöse Lieferungen 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 91, 'AT-BASE','GROUP4','4001','0','Erlöse i.g. Lieferung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 92, 'AT-BASE','GROUP4','4002','0','Erlöse Dienstleistungen EU'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 93, 'AT-BASE','GROUP4','4003','0','Erlöse Dienstleistungen 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 94, 'AT-BASE','GROUP4','4004','0','Erlöse Software 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 95, 'AT-BASE','GROUP4','4005','0','Erlöse Software EU'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 96, 'AT-BASE','GROUP4','4006','0','Evidenz Kfd. Reverse Charge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 97, 'AT-BASE','GROUP4','4050','0','Erlöse 0 % Drittland'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 98, 'AT-BASE','GROUP4','4051','0','Erlöse Dienstleistungen Drittland'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 99, 'AT-BASE','GROUP4','4052','0','Erlöse Software Drittland'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 100, 'AT-BASE','GROUP4','4069','0','Erlöse § 19/1d Schrott'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 101, 'AT-BASE','GROUP4','4400','0','Kundenskonto 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 102, 'AT-BASE','GROUP4','4405','0','Kundenskonto 0 % Ausfuhrlieferungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 103, 'AT-BASE','GROUP4','4410','0','Skontoaufwand i.g. Lieferung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 104, 'AT-BASE','GROUP4','4413','0','Kundenskonto sonstige Leistung EU'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 105, 'AT-BASE','GROUP4','4420','0','Kundenskonto EU-Land A x %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 106, 'AT-BASE','GROUP4','4450','0','Kundenrabatt 20%'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 107, 'AT-BASE','GROUP4','4500','0','Bestandsveränderungen fertige Erzeugnisse'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 108, 'AT-BASE','GROUP4','4510','0','Best.Veränd.Halbf.Erzeugnisse'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 109, 'AT-BASE','GROUP4','4519','0','Bestandsveränderung laufend'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 110, 'AT-BASE','GROUP4','4520','0','Best.Veränd.n.n.abger.Leist.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 111, 'AT-BASE','GROUP4','4530','0','Gelieferte (noch nicht fakturierte Waren)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 112, 'AT-BASE','GROUP4','4580','0','Aktivierte Eigenleistung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 113, 'AT-BASE','GROUP4','4630','0','Erträge aus d.Abgang v.Anlagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 114, 'AT-BASE','GROUP4','4801','0','Zuwendungen a.öffentl. Mitteln'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 115, 'AT-BASE','GROUP4','4831','0','sonstige betriebliche Erträge (nicht steuerbar)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 116, 'AT-BASE','GROUP4','4840','0','Sonstige Erlöse 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 117, 'AT-BASE','GROUP4','4850','0','Erl. Aufwandersätze'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 118, 'AT-BASE','GROUP4','4881','0','Versicherungsvergütungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 119, 'AT-BASE','GROUP4','4885','0','Zuschreibungen zum Umlaufvermögen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 120, 'AT-BASE','GROUP4','4950','0','Privatanteil 20 %'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 121, 'AT-BASE','GROUP4','4991','0','Sachbezüge 20%'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 122, 'AT-BASE','GROUP5','5000','0','Handelswareneinsatz'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 123, 'AT-BASE','GROUP5','5001','0','Materialeinkauf Fremdfertigung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 124, 'AT-BASE','GROUP5','5002','0','Wareneinkauf Verkauf'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 125, 'AT-BASE','GROUP5','5020','0','Materialeinkauf'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 126, 'AT-BASE','GROUP5','5090','0','Bezugskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 127, 'AT-BASE','GROUP5','5100','0','Verbrauch Rohstoffe'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 128, 'AT-BASE','GROUP5','5199','0','Aufwand für TW-AFA Vorräte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 129, 'AT-BASE','GROUP5','5200','0','Verbrauch bezogenen Teile'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 130, 'AT-BASE','GROUP5','5300','0','Verbrauch Hilfsstoffe'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 131, 'AT-BASE','GROUP5','5400','0','Hilfsstoffverbrauch'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 132, 'AT-BASE','GROUP5','5440','0','Inventurveränderung Fremdbarb. + GK'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 133, 'AT-BASE','GROUP5','5441','0','GWG Fremdbarb. + GK'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 134, 'AT-BASE','GROUP5','5450','0','Verpackungsmaterial'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 135, 'AT-BASE','GROUP5','5800','0','Fremdleistungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 136, 'AT-BASE','GROUP5','5880','0','Lieferantenskonti'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 137, 'AT-BASE','GROUP5','5900','0','Skontoertrag ig.E. 0% (m.VST)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 138, 'AT-BASE','GROUP5','5920','0','Skontoertrag ig.E. 20% (m.VST)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 139, 'AT-BASE','GROUP6','6000','0','Löhne'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 140, 'AT-BASE','GROUP6','6001','0','Rückerstattung AUVA Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 141, 'AT-BASE','GROUP6','6010','0','Lehrlingsentschädigung Arb.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 142, 'AT-BASE','GROUP6','6020','0','Nichtleistungslöhne'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 143, 'AT-BASE','GROUP6','6100','0','Leihpersonal Aufwand'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 144, 'AT-BASE','GROUP6','6150','0','Sonderzahlungen Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 145, 'AT-BASE','GROUP6','6200','0','Gehälter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 146, 'AT-BASE','GROUP6','6201','0','Förderung AMS'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 147, 'AT-BASE','GROUP6','6202','0','Rückerstattung AUVA Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 148, 'AT-BASE','GROUP6','6210','0','Veränderung Mehrarbeitsvergütung RSt Ang'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 149, 'AT-BASE','GROUP6','6211','0','Veränderung Mehrarbeitsvergütung RSt Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 150, 'AT-BASE','GROUP6','6230','0','Sonderzahlungen Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 151, 'AT-BASE','GROUP6','6231','0','Dotierung RST Sonderzahlungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 152, 'AT-BASE','GROUP6','6255','0','Geschäftsführerbezüge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 153, 'AT-BASE','GROUP6','6256','0','Geschäftsführersachbezüge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 154, 'AT-BASE','GROUP6','6300','0','Sonderzahlung aliquot vorläufig'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 155, 'AT-BASE','GROUP6','6310','0','Dotierung Urlaubsrückstellung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 156, 'AT-BASE','GROUP6','6311','0','Veränderung Urlaubsrückstellung Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 157, 'AT-BASE','GROUP6','6402','0','Betriebliche Vorsorgekassa Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 158, 'AT-BASE','GROUP6','6407','0','Betriebliche Vorsorgekassa Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 159, 'AT-BASE','GROUP6','6416','0','Veränderung Pensionsrückstellung (Angestellte)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 160, 'AT-BASE','GROUP6','6435','0','sonstige Beiträge für die Altersversorgung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 161, 'AT-BASE','GROUP6','6500','0','Gesetzlicher Sozialaufwand'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 162, 'AT-BASE','GROUP6','6600','0','Gesetzlicher Sozialaufwand Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 163, 'AT-BASE','GROUP6','6605','0','Gesetzlicher Sozialaufwand Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 164, 'AT-BASE','GROUP6','6610','0','Dienstgeberbeitrag Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 165, 'AT-BASE','GROUP6','6611','0','Dienstgeberbeitrag Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 166, 'AT-BASE','GROUP6','6620','0','Zuschlag zum DB'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 167, 'AT-BASE','GROUP6','6621','0','Zuschlag zum DB Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 168, 'AT-BASE','GROUP6','6630','0','Ausgleichstaxe'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 169, 'AT-BASE','GROUP6','6690','0','Lohnsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 170, 'AT-BASE','GROUP6','6693','0','Kommunalsteuer Arbeiter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 171, 'AT-BASE','GROUP6','6694','0','Kommunalsteuer Angestellte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 172, 'AT-BASE','GROUP6','6700','0','Freiwilliger Sozialaufwand'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 173, 'AT-BASE','GROUP6','6710','0','Arbeitskleidung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 174, 'AT-BASE','GROUP6','6720','0','Fahrspesen Dienstnehmer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 175, 'AT-BASE','GROUP6','6730','0','Weihnachtsgeschenke Arbeitnehmer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 176, 'AT-BASE','GROUP6','6740','0','Betriebsveranstaltungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 177, 'AT-BASE','GROUP6','6750','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 178, 'AT-BASE','GROUP6','6760','0','Vergleichszahlung Dienstnehmer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 179, 'AT-BASE','GROUP7','7030','0','Abschreibung G W G'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 180, 'AT-BASE','GROUP7','7070','0','Buchwert ausgeschiedener Anlagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 181, 'AT-BASE','GROUP7','7080','0','Planmäßige AFA immat.WG.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 182, 'AT-BASE','GROUP7','7081','0','Planmäßige Abschreibung für Sachanlagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 183, 'AT-BASE','GROUP7','7100','0','Nicht abzugsfähige Vorsteuer (VStK)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 184, 'AT-BASE','GROUP7','7110','0','Gebühren und Abgaben_Zoll'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 185, 'AT-BASE','GROUP7','7111','0','Kammerumlage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 186, 'AT-BASE','GROUP7','7200','0','Instandhaltung Gebäude'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 187, 'AT-BASE','GROUP7','7201','0','Instandhaltung Außenanlagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 188, 'AT-BASE','GROUP7','7202','0','Instandh. - Maschinen u. Anl.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 189, 'AT-BASE','GROUP7','7204','0','Instandhaltung und Betriebskosten Betriebs und Geschäftsgebäude'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 190, 'AT-BASE','GROUP7','7205','0','Verbrauchsmaterial Werkstatt'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 191, 'AT-BASE','GROUP7','7210','0','Müllentsorgung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 192, 'AT-BASE','GROUP7','7211','0','Entsorgungskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 193, 'AT-BASE','GROUP7','7230','0','Reinigungsmaterial (div. Verbrauchsmaterial)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 194, 'AT-BASE','GROUP7','7231','0','Berufsbekleidung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 195, 'AT-BASE','GROUP7','7235','0','Reinigung durch Dritte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 196, 'AT-BASE','GROUP7','7240','0','LKW-Betriebskosten Vito G 437 MB'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 197, 'AT-BASE','GROUP7','7241','0','Leasing Mercedes Vito G 437 MB'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 198, 'AT-BASE','GROUP7','7250','0','KFZ Betriebskosten allgemein'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 199, 'AT-BASE','GROUP7','7251','0','KFZ Leasing allgemein'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 200, 'AT-BASE','GROUP7','7252','0','KFZ Versicherungen allgemein'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 201, 'AT-BASE','GROUP7','7253','0','Wachdienst'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 202, 'AT-BASE','GROUP7','7254','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 203, 'AT-BASE','GROUP7','7255','0','Aufwand Leihwagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 204, 'AT-BASE','GROUP7','7256','0','PKW-Betriebskosten VW Golf G 854 SH Versuchsfahrzeug'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 205, 'AT-BASE','GROUP7','7257','0','Leasing VW Golf G 854 SH'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 206, 'AT-BASE','GROUP7','7258','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 207, 'AT-BASE','GROUP7','7285','0','Strom'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 208, 'AT-BASE','GROUP7','7286','0','Betriebskosten/Beheizung Mietobjekte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 209, 'AT-BASE','GROUP7','7300','0','Transporte durch Dritte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 210, 'AT-BASE','GROUP7','7330','0','Reise und Fahrtspesen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 211, 'AT-BASE','GROUP7','7331','0','Kilometergelder'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 212, 'AT-BASE','GROUP7','7360','0','Reisediäten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 213, 'AT-BASE','GROUP7','7380','0','Telefon'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 214, 'AT-BASE','GROUP7','7381','0','Internet'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 215, 'AT-BASE','GROUP7','7382','0','Wartung Homepage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 216, 'AT-BASE','GROUP7','7390','0','Postgebühren'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 217, 'AT-BASE','GROUP7','7400','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 218, 'AT-BASE','GROUP7','7401','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 219, 'AT-BASE','GROUP7','7402','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 220, 'AT-BASE','GROUP7','7403','0','Miete Büro Linz'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 221, 'AT-BASE','GROUP7','7404','0','Miete Gradnerstraße'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 222, 'AT-BASE','GROUP7','7410','0','Maschinen u. Gerätemieten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 223, 'AT-BASE','GROUP7','7411','0','Wartungskosten BuG Ausstattung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 224, 'AT-BASE','GROUP7','7420','0','Mobilien-Leasing '); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 225, 'AT-BASE','GROUP7','7421','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 226, 'AT-BASE','GROUP7','7422','0','Leasing Server'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 227, 'AT-BASE','GROUP7','7423','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 228, 'AT-BASE','GROUP7','7424','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 229, 'AT-BASE','GROUP7','7480','0','Lizenzgebühren'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 230, 'AT-BASE','GROUP7','7540','0','Provisionen an Dritte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 231, 'AT-BASE','GROUP7','7600','0','Büromaterial'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 232, 'AT-BASE','GROUP7','7601','0','EDV-Material'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 233, 'AT-BASE','GROUP7','7610','0','Drucksorten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 234, 'AT-BASE','GROUP7','7620','0','Fachliteratur und Zeitungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 235, 'AT-BASE','GROUP7','7630','0','Gästeunt. u. Zeitschriften'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 236, 'AT-BASE','GROUP7','7650','0','Werbeaufwand/Inserate'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 237, 'AT-BASE','GROUP7','7651','0','Anbahnung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 238, 'AT-BASE','GROUP7','7652','0','Aufwand Messen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 239, 'AT-BASE','GROUP7','7653','0','Konto frei'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 240, 'AT-BASE','GROUP7','7654','0','Inserate'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 241, 'AT-BASE','GROUP7','7670','0','Bewirtungskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 242, 'AT-BASE','GROUP7','7690','0','Trinkgelder u. Spenden'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 243, 'AT-BASE','GROUP7','7691','0','Spenden an begünstigte Institutionen/Sponsoring'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 244, 'AT-BASE','GROUP7','7696','0','Säumnis- und Verspätungszuschläge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 245, 'AT-BASE','GROUP7','7700','0','Betriebsversicherungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 246, 'AT-BASE','GROUP7','7701','0','Transportversicherungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 247, 'AT-BASE','GROUP7','7710','0','Pflichtversich. Unternehmer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 248, 'AT-BASE','GROUP7','7749','0','Aufwand Japan'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 249, 'AT-BASE','GROUP7','7750','0','Steuerberatung (Lohnverrechnung, Buchhaltung)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 250, 'AT-BASE','GROUP7','7751','0','Patentkosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 251, 'AT-BASE','GROUP7','7752','0','Rechtsberatung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 252, 'AT-BASE','GROUP7','7753','0','Unternehmensberatung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 253, 'AT-BASE','GROUP7','7754','0','Aufwand tectos China'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 254, 'AT-BASE','GROUP7','7755','0','Wartung (Betreuung EDV)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 255, 'AT-BASE','GROUP7','7756','0','Lizenzgebühren Abaqus'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 256, 'AT-BASE','GROUP7','7757','0','Lizenzgebühren Sonstige'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 257, 'AT-BASE','GROUP7','7758','0','Sonstige Beratungskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 258, 'AT-BASE','GROUP7','7759','0','EDV-Beratung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 259, 'AT-BASE','GROUP7','7760','0','Mitgliedsbeiträge/freiwillige Beiträge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 260, 'AT-BASE','GROUP7','7761','0','Prüfung Jahresabschluss'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 261, 'AT-BASE','GROUP7','7770','0','Aus- und Fortbildung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 262, 'AT-BASE','GROUP7','7775','0','Forschung und Entwicklung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 263, 'AT-BASE','GROUP7','7776','0','Messentwicklung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 264, 'AT-BASE','GROUP7','7777','0','Produktentwicklung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 265, 'AT-BASE','GROUP7','7785','0','Freiwillige Verbandsbeiträge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 266, 'AT-BASE','GROUP7','7790','0','Spesen des Geldverkehrs'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 267, 'AT-BASE','GROUP7','7791','0','Kursdifferenzen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 268, 'AT-BASE','GROUP7','7800','0','Betriebsbedingte Schadensfälle'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 269, 'AT-BASE','GROUP7','7801','0','Ausgaben nicht absetzbar'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 270, 'AT-BASE','GROUP7','7802','0','Strafen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 271, 'AT-BASE','GROUP7','7805','0','Forderungsverluste 20'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 272, 'AT-BASE','GROUP7','7806','0','Abschreibungen auf Forderungen (EU)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 273, 'AT-BASE','GROUP7','7807','0','Abschreibungen auf Forderungen (Drittland)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 274, 'AT-BASE','GROUP7','7810','0','Zuweisung an Einzel-WB Forderungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 275, 'AT-BASE','GROUP7','7811','0','Zuweisung pauschale Wertberichtigungen zu Exportforderungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 276, 'AT-BASE','GROUP7','7812','0','Abschreibungen auf Vorräte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 277, 'AT-BASE','GROUP7','7820','0','Buchwert abgegangener Sachanlagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 278, 'AT-BASE','GROUP7','7840','0','Gründungskosten'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 279, 'AT-BASE','GROUP7','7850','0','Sonstiger Aufwand'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 280, 'AT-BASE','GROUP7','7851','0','Sonstiger Aufwand Gewinnanteil Reich'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 281, 'AT-BASE','GROUP7','7930','0','Aufw. Gewährleistungsverpfl.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 282, 'AT-BASE','GROUP7','7940','0','Aufwand aus Vorperioden'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 283, 'AT-BASE','GROUP8','8020','0','Gewinnüberrg. v. Organgesell.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 284, 'AT-BASE','GROUP8','8060','0','Zinserträge'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 285, 'AT-BASE','GROUP8','8090','0','Ertr.a.Ant.a.and. Unternehmen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 286, 'AT-BASE','GROUP8','8100','0','Habenzinsen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 287, 'AT-BASE','GROUP8','8280','0','Zinsen f. Kredite u. Darlehen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 288, 'AT-BASE','GROUP8','8286','0','Kursgewinne/Kursverluste'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 289, 'AT-BASE','GROUP8','8288','0','Zinsen auf Lieferantenkredite'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 290, 'AT-BASE','GROUP8','8291','0','Sonst. Zinsen und ähnliche Aufwendungen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 291, 'AT-BASE','GROUP8','8500','0','Körperschaftsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 292, 'AT-BASE','GROUP8','8505','0','Kapitalertragsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 293, 'AT-BASE','GROUP8','8510','0','Körperschaftsteuervorauszahl.'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 294, 'AT-BASE','GROUP8','8511','0','Dotierung KöSt-Rückstellung'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 295, 'AT-BASE','GROUP8','8512','0','Aktivierung Körperschaftsteuer'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 296, 'AT-BASE','GROUP8','8513','0','Köst Vorperioden'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 297, 'AT-BASE','GROUP8','8520','0','Forschungsprämie'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 298, 'AT-BASE','GROUP8','8595','0','Ertrag aus der Aktivierung latenter Steuern'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 299, 'AT-BASE','GROUP8','8610','0','Auflösung sonstiger unversteuerter Rücklagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 300, 'AT-BASE','GROUP8','8700','0','Auflösung gebundener Kapitalrücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 301, 'AT-BASE','GROUP8','8710','0','Auflösung Rücklage für eigene Anteile'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 302, 'AT-BASE','GROUP8','8720','0','Auflösung nicht gebundene Kapitalrücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 303, 'AT-BASE','GROUP8','8750','0','Auflösung gesetzliche Rücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 304, 'AT-BASE','GROUP8','8760','0','Auflösung satzungsmäßige Rücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 305, 'AT-BASE','GROUP8','8770','0','Auflösung andere (freie) Rücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 306, 'AT-BASE','GROUP8','8810','0','Zuweisung sonstige unversteuerte Rücklagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 307, 'AT-BASE','GROUP8','8820','0','Zuweisung Inv. Rücklage'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 308, 'AT-BASE','GROUP8','8890','0','Zuw.Bew.Res.GWG'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 309, 'AT-BASE','GROUP8','8900','0','Zuweisung gesetzliche Rücklagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 310, 'AT-BASE','GROUP8','8910','0','Zuweisung satzungsmäßige Rücklagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 311, 'AT-BASE','GROUP8','8920','0','Zuweisung andere (freie) Rücklagen'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 312, 'AT-BASE','GROUP9','9390','0','Bilanzgewinn'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 313, 'AT-BASE','GROUP9','9391','0','Bilanzverlust'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 314, 'AT-BASE','GROUP9','9700','0','Wachdienst'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 315, 'AT-BASE','GROUP9','9991','0','Gewinnvortrag'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 316, 'AT-BASE','GROUP9','9993','0','Verlustvortrag'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 317, 'AT-BASE','GROUP9','9994','0','Verlustvortrag'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 318, 'AT-BASE','GROUP5','50200','0','Materialeinkauf'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 319, 'AT-BASE','GROUP6','60000','0','kalk. Löhne u Gehälter'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 320, 'AT-BASE','GROUP6','64160','0','Veränderung Pensionsrückstellung (Angestellte)'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 321, 'AT-BASE','GROUP6','66300','0','Leistungserfassung'); From fa71402a9b74393bb76e3d3df922880794a6d027 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 3 Jun 2021 09:34:49 +0200 Subject: [PATCH 161/739] Fix 17791 : fix for at account --- htdocs/install/mysql/data/llx_accounting_account_at.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_at.sql b/htdocs/install/mysql/data/llx_accounting_account_at.sql index 402e6893e6b..f05dc2572c2 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_at.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_at.sql @@ -22,7 +22,7 @@ -- Descriptif des plans comptables autrichiens standard -- ADD 4100000 to rowid # Do no remove this comment -- -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','GROUP0','110','0','Patentrechte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','0','GROUP0','110','0','Patentrechte'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 2, 'AT-BASE','GROUP0','120','0','Software'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3, 'AT-BASE','GROUP0','121','0','ERP System'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 4, 'AT-BASE','GROUP0','122','0','Homepage'); From 71856984a3555e0e90ed8b80b0f8139730c170a8 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 3 Jun 2021 09:35:31 +0200 Subject: [PATCH 162/739] Fix #17791 : fix for at account --- htdocs/install/mysql/data/llx_accounting_account_at.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_at.sql b/htdocs/install/mysql/data/llx_accounting_account_at.sql index f05dc2572c2..402e6893e6b 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_at.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_at.sql @@ -22,7 +22,7 @@ -- Descriptif des plans comptables autrichiens standard -- ADD 4100000 to rowid # Do no remove this comment -- -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','0','GROUP0','110','0','Patentrechte'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 1, 'AT-BASE','GROUP0','110','0','Patentrechte'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 2, 'AT-BASE','GROUP0','120','0','Software'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 3, 'AT-BASE','GROUP0','121','0','ERP System'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label) VALUES (__ENTITY__, 4, 'AT-BASE','GROUP0','122','0','Homepage'); From 093705a1b552d18450c968001e4eafa4d65c127e Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 3 Jun 2021 11:32:41 +0200 Subject: [PATCH 163/739] FIX : field name is search_status and not search_statut --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index cb8da24052b..cbd9b76e45e 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -106,7 +106,7 @@ $search_month_end = GETPOST('search_month_end', 'int'); $search_year_end = GETPOST('search_year_end', 'int'); $search_employee = GETPOST('search_employee', 'int'); $search_valideur = GETPOST('search_valideur', 'int'); -$search_status = GETPOST('search_statut', 'int'); +$search_status = GETPOST('search_status', 'int'); $search_type = GETPOST('search_type', 'int'); // Initialize technical objects From c534b7fcce8808189b9ef108aa69f9697e584a08 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Thu, 3 Jun 2021 14:36:47 +0200 Subject: [PATCH 164/739] FIX delete object actionComm --- htdocs/core/actions_massactions.inc.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 99f1271ff0b..3cbcd30af7f 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018-2021 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019-2021 Frédéric France @@ -1241,8 +1241,13 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' } if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - else $result = $objecttmp->delete($user); - + else { + if (get_class($objecttmp) === "ActionComm") { + $result = $objecttmp->delete(); + } else { + $result = $objecttmp->delete($user); + } + } if ($result <= 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); From ee55a5568f1985c33c865dedfc6a833350cdb8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 15:14:31 +0200 Subject: [PATCH 165/739] fix warning --- htdocs/core/tpl/commonfields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 4b7821c2dad..f9da77c5894 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -74,7 +74,7 @@ foreach ($object->fields as $key => $val) { if ($val['type'] == 'text') { print ' wordbreak'; } - if ($val['cssview']) { + if (!empty($val['cssview'])) { print ' '.$val['cssview']; } print '">'; From e83e399cb6f069125aa6392b955767af341cab06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 15:19:54 +0200 Subject: [PATCH 166/739] fix warning --- htdocs/compta/paiement.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 12a6eb97d13..9c99fab4657 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -8,7 +8,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -465,7 +465,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date payment print ''; From 0b28587e658e12ec1ab8b018c8e5c74771d28441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 15:28:47 +0200 Subject: [PATCH 167/739] fix warnings --- htdocs/compta/paiement.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 12a6eb97d13..b6a63b32466 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -598,7 +598,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print "\n"; - $total = 0; + $total_ttc = 0; $totalrecu = 0; $totalrecucreditnote = 0; $totalrecudeposits = 0; @@ -754,15 +754,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Warning print ''; print "\n"; - $total += $objp->total; $total_ttc += $objp->total_ttc; $totalrecu += $paiement; $totalrecucreditnote += $creditnotes; From ca66cdad01f5a86728684d11da652b65fd8e3078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 3 Jun 2021 21:47:10 +0200 Subject: [PATCH 168/739] debug intracomm report transport mode --- htdocs/comm/card.php | 13 +++++++++++-- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 15 +++++++++++---- htdocs/fourn/facture/card.php | 12 ++++++------ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 589559ea426..fc7378ecd93 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -184,6 +184,15 @@ if (empty($reshook)) { } } + // transport mode + if ($action == 'settransportmode' && $user->rights->societe->creer) { + $object->fetch($id); + $result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha')); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + // Bank account if ($action == 'setbankaccount' && $user->rights->societe->creer) { $object->fetch($id); @@ -580,9 +589,9 @@ if ($object->id > 0) { print '
'; print ''; // ancre pour retourner sur la ligne + print ''; // Show product and description $product_static->type = $line->fk_product_type; @@ -1049,17 +1066,15 @@ if ($action == 'create') // Qty print ''.$line->qty; - print 'id.'\' />'; - print ''; + print ''; + print ''; print ''; print ''; - - - $quantityDelivered = $object->receptions[$line->id]; + $quantityDelivered = $objectsrc->receptions[$line->id]; print $quantityDelivered; print ''; print ''.$formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id).''.$formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $entrepot_id).'
".dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."".dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."'.($obj->salary ? price($obj->salary) : '').''.($obj->salary ? price($obj->salary) : '').''.num_open_day($date_start_inmonth, $date_end_inmonth, 0, 1, $halfdayinmonth).''.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).''.dol_escape_htmltag(dolGetFirstLineOfText($obj->description)).'
'.$langs->trans('Date').''; - $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datepayment = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $datepayment = ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datepayment); print $form->selectDate($datepayment, '', '', '', 0, "add_paiement", 1, 1, 0, '', '', $facture->date); print '
 
'; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
"; - if ($amounts[$invoice->id] && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])) - || $multicurrency_amounts[$invoice->id] && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) { + if (!empty($amounts[$invoice->id]) && (abs($amounts[$invoice->id]) > abs($amountsresttopay[$invoice->id])) + || !empty($multicurrency_amounts[$invoice->id]) && (abs($multicurrency_amounts[$invoice->id]) > abs($multicurrency_amountsresttopay[$invoice->id]))) { print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay")); } print '
'; print ''; if ($action == 'edittransportmode') { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'fk_transport_mode', 1); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->transport_mode_id, 'transport_mode_id', 1); } else { - $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_transport_mode, 'none'); + $form->formSelectTransportMode($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->transport_mode_id, 'none'); } print ""; print ''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3f4b2dd9ee6..33cfa7c8b32 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2566,7 +2566,7 @@ abstract class CommonObject /** * Change the transport mode methods * - * @param int $id Id of new payment method + * @param int $id Id of transport mode * @return int >0 if OK, <0 if KO */ public function setTransportMode($id) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1f90b5f4fdc..dda350865af 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5289,9 +5289,9 @@ class Form global $langs; if ($htmlname != "none") { print '
'; - print ''; + print ''; print ''; - $this->selectTransportMode($selected, $htmlname, 2, $addempty, 0, 0, $active); + $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active); print ''; print '
'; } else { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 637f29e87b8..81533dae324 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -214,6 +214,11 @@ class FactureFournisseur extends CommonInvoice public $mode_reglement_id; public $mode_reglement_code; + /** + * @var int transport mode id + */ + public $transport_mode_id; + public $extraparams = array(); /** @@ -670,6 +675,7 @@ class FactureFournisseur extends CommonInvoice $sql .= ' s.nom as socnom, s.rowid as socid,'; $sql .= ' t.fk_incoterms, t.location_incoterms,'; $sql .= " i.libelle as label_incoterms,"; + $sql .= ' t.fk_transport_mode,'; $sql .= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; @@ -742,14 +748,15 @@ class FactureFournisseur extends CommonInvoice $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; $this->label_incoterms = $obj->label_incoterms; + $this->transport_mode_id = $obj->fk_transport_mode; // Multicurrency - $this->fk_multicurrency = $obj->fk_multicurrency; + $this->fk_multicurrency = $obj->fk_multicurrency; $this->multicurrency_code = $obj->multicurrency_code; - $this->multicurrency_tx = $obj->multicurrency_tx; + $this->multicurrency_tx = $obj->multicurrency_tx; $this->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->extraparams = (array) json_decode($obj->extraparams, true); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 0bc26ea8f2b..a796ff81a0e 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1875,10 +1875,10 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; } else { - $cond_reglement_id = $societe->cond_reglement_supplier_id; - $mode_reglement_id = $societe->mode_reglement_supplier_id; + $cond_reglement_id = $societe->cond_reglement_supplier_id; + $mode_reglement_id = $societe->mode_reglement_supplier_id; $transport_mode_id = $societe->transport_mode_supplier_id; - $fk_account = $societe->fk_account; + $fk_account = $societe->fk_account; $datetmp = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $dateinvoice = ($datetmp == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datetmp); $datetmp = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']); @@ -2889,12 +2889,12 @@ if ($action == 'create') { // Intracomm report if (!empty($conf->intracommreport->enabled)) { $langs->loadLangs(array("intracommreport")); - print ''; - print ''; From 350a4215445077fcb747e793f418adb95189a729 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 08:41:26 +0200 Subject: [PATCH 169/739] Update card.php --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a796ff81a0e..a8a4cb63258 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2894,7 +2894,7 @@ if ($action == 'create') { print $langs->trans('IntracommReportTransportMode'); print ''; if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - print ''; + print ''; } print '
'; + print '
'; + print ''; if ($action != 'editmode' && ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer)) { - print ''; + print ''; } print '
'; print $langs->trans('IntracommReportTransportMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit().'
'; print '
id.'">'.img_edit().'id.'">'.img_edit().'
'; print ''; From 3ae3137eaf9759d98a7422504496867984556f7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 08:57:48 +0200 Subject: [PATCH 170/739] Missing picto --- htdocs/fourn/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index e7f19d0671a..c02a311f633 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -881,10 +881,10 @@ if ($resql) { 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) { - $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier"); + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisSupplier"); } if ($user->rights->fournisseur->commande->supprimer) { - $arrayofmassactions['predelete'] = img_picto('', 'delete').$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); From 621aa9e6f368118e42ca9dffe9daaeb607ea542b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 09:27:33 +0200 Subject: [PATCH 171/739] Fix typo --- htdocs/fourn/paiement/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 6a38ae2033d..4da69cfc0c1 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -254,10 +254,10 @@ if ($optioncss != '') { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } -if ($saerch_day) { +if ($search_day) { $param .= '&search_day='.urlencode($search_day); } -if ($saerch_month) { +if ($search_month) { $param .= '&search_month='.urlencode($search_month); } if ($search_year) { From 402d90554a8c421c048a941f493a787ff2e0d11d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 10:04:56 +0200 Subject: [PATCH 172/739] Clean code --- htdocs/accountancy/closure/index.php | 2 +- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/expensereport/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- htdocs/cashdesk/index_verif.php | 2 +- htdocs/public/agenda/agendaexport.php | 2 -- htdocs/public/project/index.php | 2 +- htdocs/public/project/new.php | 3 +-- 8 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 390c288b606..bcb3d7901f5 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy")); $socid = GETPOST('socid', 'int'); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index d33f5e12312..9580e8bca37 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy")); // Security check if (empty($conf->accounting->enabled)) { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index b4e85fd517a..baeefa1bbfb 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy")); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index a69debeb0c0..c1a3ffe23a6 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "main", "accountancy")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy")); // Security check if (empty($conf->accounting->enabled)) { diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 47a1d90b76c..94e0e7009cf 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php'; require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Auth.class.php'; // Load translation files required by the page -$langs->loadLangs(array("main", "admin", "cashdesk")); +$langs->loadLangs(array("admin", "cashdesk")); $username = GETPOST("txtUsername"); $password = GETPOST("pwdPassword"); diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 2aaeb12de23..cc255b185ed 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -212,9 +212,7 @@ if ($format == 'ical') { if ($format == 'rss') { $shortfilename .= '.rss'; $filename .= '.rss'; } - if ($shortfilename == 'dolibarrcalendar') { - $langs->load("main"); $langs->load("errors"); llxHeaderVierge(); print '
'.$langs->trans("ErrorWrongValueForParameterX", 'format').'
'; diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index ce48db9e729..013f290dc6a 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -72,7 +72,7 @@ $hookmanager->initHooks(array('newpayment')); global $dolibarr_main_instance_unique_id; // Load translation files -$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data +$langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox", "paypal", "stripe")); // File with generic data // Security check // No check on module enabled. Done later according to $validpaymentmethod diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 048df9c41b3..e4a8b495d7c 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -60,13 +60,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; // Init vars $errmsg = ''; -$num = 0; $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); // Load translation files -$langs->loadLangs(array("main", "members", "companies", "install", "other")); +$langs->loadLangs(array("members", "companies", "install", "other")); // Security check if (empty($conf->projet->enabled)) { From 8c9bec3e3bdc7b62a02b987d10e814b375dc531a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 10:29:30 +0200 Subject: [PATCH 173/739] Code comment --- htdocs/expedition/class/expedition.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index f7c5a1d32a8..ea5bd17fdfb 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -468,11 +468,11 @@ class Expedition extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Create the detail (eat-by date) of the expedition line + * Create the detail of the expedition line. Create 1 record into expeditiondet for each warehouse and n record for each lot in this warehouse into expeditiondet_batch. * - * @param object $line_ext full line informations + * @param object $line_ext Objet with full information of line. $line_ext->detail_batch must be an array of ExpeditionLineBatch * @param array $array_options extrafields array - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ public function create_line_batch($line_ext, $array_options = 0) { @@ -496,7 +496,7 @@ class Expedition extends CommonObject // create shipment batch lines for stockLocation foreach ($tab as $detbatch) { if ($detbatch->entrepot_id == $stockLocation) { - if (!($detbatch->create($line_id) > 0)) { // Create an expeditionlinebatch + if (!($detbatch->create($line_id) > 0)) { // Create an ExpeditionLineBatch $error++; } } From 174c6f8a455da035abceef8b7a31fefc59f9ba60 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 10:33:13 +0200 Subject: [PATCH 174/739] Update mouvementstock.class.php --- htdocs/product/stock/class/mouvementstock.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ec2dfbc257e..ecdfdacbf44 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -355,7 +355,9 @@ class MouvementStock extends CommonObject $qtyisnotenough = 0; foreach ($product->stock_warehouse[$entrepot_id]->detail_batch as $batchcursor => $prodbatch) { - if ($batch !== $batchcursor) continue; // Do a strict comparison because $batchcursar can be an integer + if ((string) $batch != (string) $batchcursor) { // Lot '59' must be different than lot '59c' + continue; + } $foundforbatch = 1; if ($prodbatch->qty < abs($qty)) $qtyisnotenough = $prodbatch->qty; break; From e73dad30bb9a238a46d31e07449343f23225ebec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 11:53:12 +0200 Subject: [PATCH 175/739] Warning --- htdocs/comm/mailing/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 86aff8a36e0..bbbebfad767 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -48,6 +48,7 @@ $confirm = GETPOST('confirm', 'alpha'); $urlfrom = GETPOST('urlfrom'); $object = new Mailing($db); + $result = $object->fetch($id); $extrafields = new ExtraFields($db); @@ -78,7 +79,7 @@ $listofmethods['mail'] = 'PHP mail function'; $listofmethods['smtps'] = 'SMTP/SMTPS socket library'; // Security check -if (!$user->rights->mailing->lire || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { accessforbidden(); } From 1136e7dec537e58c0c4d6503b97465ae22e9750a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 11:57:59 +0200 Subject: [PATCH 176/739] Update inventory.php --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 212f0404bd9..eee7217eef3 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -254,7 +254,7 @@ if (empty($reshook)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); } - if (GETPOST('qtytoadd') < 0) { + if (price2num(GETPOST('qtytoadd'), 'MS') < 0) { $error++; setEventMessages($langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv("RealQty")), null, 'errors'); } From e26f0f155fdcc5c51e2c9a2ad9bc45ef7f5ec1c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:00:54 +0200 Subject: [PATCH 177/739] Update inventory.php --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index eee7217eef3..644e7ba2025 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -660,7 +660,7 @@ if ($object->id > 0) { // Real quantity print ''; if ($object->status == $object::STATUS_VALIDATED) { - $qty_view = GETPOST("id_".$obj->rowid) && GETPOST("id_".$obj->rowid) >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view; + $qty_view = GETPOST("id_".$obj->rowid) && price2num(GETPOST("id_".$obj->rowid), 'MS') >= 0 ? GETPOST("id_".$obj->rowid) : $obj->qty_view; $totalfound += price2num($qty_view, 'MS'); print ''; print ''; From c77dee0922b4b66225f08bd653acc7802f1e85ce Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 4 Jun 2021 12:27:50 +0200 Subject: [PATCH 178/739] changes to fetch after send --- htdocs/comm/mailing/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 73f31f34f01..0d321c08c09 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -408,7 +408,7 @@ if (empty($reshook)) { dol_syslog($db->error()); dol_print_error($db); } - + $object->fetch($id); $action = ''; } } @@ -677,7 +677,6 @@ if (empty($reshook)) { $form = new Form($db); $htmlother = new FormOther($db); -$object->fetch($id); $help_url = 'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'; llxHeader( '', From e5ab721660ce528c5b53e76da76570d34f1b67a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:30:46 +0200 Subject: [PATCH 179/739] Fix sanitize --- htdocs/holiday/month_report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index eef3ca0dcbe..698d71e5dc7 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -154,7 +154,7 @@ if (!empty($search_employee) && $search_employee > 0) { $sql .= " AND cp.fk_user = ".((int) $search_employee); } if (!empty($search_type) && $search_type != '-1') { - $sql .= ' AND cp.fk_type IN ('.$db->escape($search_type).')'; + $sql .= ' AND cp.fk_type IN ('.$db->sanitize($search_type).')'; } if (!empty($search_description)) { $sql .= natural_search('cp.description', $search_description); From 01f5a5fb18fc722d644cb6e8f1f631eab26f0fd6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Thu, 27 May 2021 16:03:17 +0200 Subject: [PATCH 180/739] Fix update receipt eatby --- htdocs/fourn/commande/dispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 13989286e33..de09bb80ea4 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -464,7 +464,7 @@ if ($action == 'updateline' && $user->rights->fournisseur->commande->receptionne $product = $supplierorderdispatch->fk_product; $price = price2num(GETPOST('price'), '', 2); $comment = $supplierorderdispatch->comment; - $eatby = $supplierorderdispatch->fk_product; + $eatby = $supplierorderdispatch->eatby; $sellby = $supplierorderdispatch->sellby; $batch = $supplierorderdispatch->batch; From 34955b1cf9d9aab738b299850cd44a38ba5c40a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:48:18 +0200 Subject: [PATCH 181/739] Fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_product.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 25a6a6b09e8..3fb671fa9b2 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -418,7 +418,7 @@ UPDATE llx_propal SET fk_user_signature = fk_user_cloture WHERE fk_user_signatur UPDATE llx_propal SET date_signature = date_cloture WHERE date_signature IS NULL AND date_cloture IS NOT NULL; -ALTER TABLE llx_product ADD COLUMN batch_mask VARCHAR(32) NULL; +ALTER TABLE llx_product ADD COLUMN batch_mask VARCHAR(32) DEFAULT NULL; ALTER TABLE llx_product ADD COLUMN lifetime INTEGER NULL; ALTER TABLE llx_product ADD COLUMN qc_frequency INTEGER NULL; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 73b4473a5a4..4aad3393137 100644 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -59,7 +59,7 @@ create table llx_product tobuy tinyint DEFAULT 1, -- Product you buy onportal tinyint DEFAULT 0, -- If it is a product you sell and you want to sell it on portal (module website must be on) tobatch tinyint DEFAULT 0 NOT NULL, -- Is it a product that need a batch management (eat-by or lot management) - batch_mask varchar(32), -- If the product has batch feature, you may want to use a batch mask per product + batch_mask varchar(32) DEFAULT NULL, -- If the product has batch feature, you may want to use a batch mask per product fk_product_type integer DEFAULT 0, -- Type of product: 0 for regular product, 1 for service, 9 for other (used by external module) duration varchar(6), seuil_stock_alerte float DEFAULT NULL, @@ -95,7 +95,7 @@ create table llx_product canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, -- see dictionnary c_product_nature lifetime integer DEFAULT NULL, - qc_frequency integer DEFAULT NULL, + qc_frequency integer DEFAULT NULL, -- Quality control periodicity hidden tinyint DEFAULT 0, -- Not used. Deprecated. import_key varchar(14), -- Import key model_pdf varchar(255), -- model save dodument used From 292d5f6a154b97ae939be55b174ebc999e88d777 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:55:03 +0200 Subject: [PATCH 182/739] Update card.php --- htdocs/compta/facture/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 02fb8467e21..c3ba878cdbf 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2232,11 +2232,10 @@ if (empty($reshook)) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { - // Add batchinfo if the detailline has batchinfo - - if (!empty($lines[$i]->detail_batch) && ! empty($conf->global->INCUDE_BATCHINFO_ON_INVOICE)) { + // Add batchinfo if the detail_batch array is defined + if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { foreach ($lines[$i]->detail_batch as $batchline) { - $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; + $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } } From 43be7cf996e5c221264d3a6bcf1d1dc99ef01d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:56:40 +0200 Subject: [PATCH 183/739] Update card.php --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c3ba878cdbf..9f91c462a40 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -67,7 +67,7 @@ if (!empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals','productbatch')); +$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); if (!empty($conf->incoterm->enabled)) { $langs->load('incoterm'); } @@ -2234,6 +2234,7 @@ if (empty($reshook)) { } else { // Add batchinfo if the detail_batch array is defined if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { + $langs->load('productbatch'); foreach ($lines[$i]->detail_batch as $batchline) { $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; } From 8b5922a0df094f64ec602610b0c66f9804aa8408 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 12:57:43 +0200 Subject: [PATCH 184/739] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9f91c462a40..be9e23afecc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2233,7 +2233,7 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'errors'); } else { // Add batchinfo if the detail_batch array is defined - if (!empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { + if (!empty($conf->productbatch->enabled) && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { $langs->load('productbatch'); foreach ($lines[$i]->detail_batch as $batchline) { $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; From 27018bd4b43d1e73efe0161c1124ee7aa0ec8985 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 14:25:32 +0200 Subject: [PATCH 185/739] Fix group by --- htdocs/compta/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 56404aed78b..5180a9e7141 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -551,7 +551,7 @@ if (!$sall) $sql .= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final, f.situation_cycle_ref, f.situation_counter,'; $sql .= ' f.fk_user_author, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva,'; $sql .= ' f.multicurrency_total_tva, f.multicurrency_total_ttc,'; - $sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; + $sql .= ' s.rowid, s.nom, s.name_alias, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql .= ' typent.code,'; $sql .= ' state.code_departement, state.nom,'; $sql .= ' country.code,'; From 2182e7fd54e299f7db7edd9bc5cecce82b6240c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 14:36:52 +0200 Subject: [PATCH 186/739] Look and feel v14 --- htdocs/compta/facture/invoicetemplate_list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 52dac1c462a..5f7e277076c 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -50,8 +50,7 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search - -$socid = GETPOST('socid', 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); $socid = GETPOST('socid', 'int'); @@ -394,7 +393,7 @@ if ($resql) { if ($search_payment_term != '') { $param .= '&search_payment_term='.urlencode($search_payment_term); } - if ($search_recurring != '' && $search_recurrning != '-1') { + if ($search_recurring != '' && $search_recurring != '-1') { $param .= '&search_recurring='.urlencode($search_recurring); } if ($search_frequency > 0) { @@ -570,7 +569,7 @@ if ($resql) { if (!empty($arrayfields['s.nom']['checked'])) { print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder); } - if (!empty($arrayfields['f.total_total']['checked'])) { + if (!empty($arrayfields['f.total_ht']['checked'])) { print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); } if (!empty($arrayfields['f.total_tva']['checked'])) { @@ -789,12 +788,13 @@ if ($resql) { } } // Action column - print ''; + print ''; if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { if ($invoicerectmp->isMaxNbGenReached()) { print $langs->trans("MaxNumberOfGenerationReached"); } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; + print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"'); print $langs->trans("CreateBill").''; } else { print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); From 0147ffa737073733b603947ddd6aa2a7b15880f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 14:38:22 +0200 Subject: [PATCH 187/739] Fix css --- .../triggers/interface_50_modLdap_Ldapsynchro.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 81054338b88..d4db5ebccfc 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -138,8 +138,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $container = $usergroup->_load_ldap_dn($oldinfo, 1); $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } @@ -157,12 +156,11 @@ class InterfaceLdapsynchro extends DolibarrTriggers $oldinfo = $usergroup->_load_ldap_info(); $olddn = $usergroup->_load_ldap_dn($oldinfo); - // Verify if entry exist + // Verify if an entry exists $container = $usergroup->_load_ldap_dn($oldinfo, 1); $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; $records = $ldap->search($container, $search); - if (count($records) && $records['count'] == 0) - { + if (count($records) && $records['count'] == 0) { $olddn = ''; } From 56bb2bbd14e788b6f2cb643cd9506de6741124f7 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Fri, 4 Jun 2021 17:10:26 +0200 Subject: [PATCH 188/739] On dict, test $obj->code if empty before translation --- htdocs/admin/dict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2bd55c6c66a..f0b6ab5ec2b 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2015,13 +2015,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; $transfound = 0; $transkey = ''; - if (in_array($fieldlist[$field], array('label', 'libelle')) and !empty($obj->code)) // For label + if (in_array($fieldlist[$field], array('label', 'libelle'))) // For label { // Special case for labels - if ($tabname == MAIN_DB_PREFIX.'c_civility') { + if ($tabname == MAIN_DB_PREFIX.'c_civility' && !empty($obj->code)) { $transkey = "Civility".strtoupper($obj->code); } - if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { + if ($tabname == MAIN_DB_PREFIX.'c_payment_term' && !empty($obj->code)) { $langs->load("bills"); $transkey = "PaymentConditionShort".strtoupper($obj->code); } From 3fb1fb63b471b3f6a639a4dab7d6ce74ef68d7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 4 Jun 2021 22:16:25 +0200 Subject: [PATCH 189/739] test zapier --- dev/examples/zapier/creates/thirdparty.js | 4 ++-- dev/examples/zapier/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/examples/zapier/creates/thirdparty.js b/dev/examples/zapier/creates/thirdparty.js index 3e20fd10e41..2abeef6ae4c 100644 --- a/dev/examples/zapier/creates/thirdparty.js +++ b/dev/examples/zapier/creates/thirdparty.js @@ -6,7 +6,7 @@ const createThirdparty = async (z, bundle) => { const response = await z.request({ method: 'POST', url: apiurl, - body: JSON.stringify({ + body: { name: bundle.inputData.name, name_alias: bundle.inputData.name_alias, ref_ext: bundle.inputData.ref_ext, @@ -24,7 +24,7 @@ const createThirdparty = async (z, bundle) => { code_client: bundle.inputData.code_client, code_fournisseur: bundle.inputData.code_fournisseur, sens: 'fromzapier' - }) + } }); const result = z.JSON.parse(response.content); // api returns an integer when ok, a json when ko diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json index cc0768a27ef..4d5c5daa867 100644 --- a/dev/examples/zapier/package.json +++ b/dev/examples/zapier/package.json @@ -15,7 +15,7 @@ "npm": ">=5.6.0" }, "dependencies": { - "zapier-platform-core": "11.0.0" + "zapier-platform-core": "11.0.1" }, "devDependencies": { "mocha": "^5.2.0", From 3440024efebf877b219d66c55917d7ad4e0201f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 4 Jun 2021 22:35:05 +0200 Subject: [PATCH 190/739] test zapier --- dev/examples/zapier/triggers/thirdparty.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dev/examples/zapier/triggers/thirdparty.js b/dev/examples/zapier/triggers/thirdparty.js index 4656f836e74..0fecd4434ce 100644 --- a/dev/examples/zapier/triggers/thirdparty.js +++ b/dev/examples/zapier/triggers/thirdparty.js @@ -56,6 +56,12 @@ const getThirdparty = (z, bundle) => { fournisseur: bundle.cleanedRequest.fournisseur, code_client: bundle.cleanedRequest.code_client, code_fournisseur: bundle.cleanedRequest.code_fournisseur, + idprof1: bundle.cleanedRequest.idprof1, + idprof2: bundle.cleanedRequest.idprof2, + idprof3: bundle.cleanedRequest.idprof3, + idprof4: bundle.cleanedRequest.idprof4, + idprof5: bundle.cleanedRequest.idprof5, + idprof6: bundle.cleanedRequest.idprof6, authorId: bundle.cleanedRequest.authorId, createdAt: bundle.cleanedRequest.createdAt, action: bundle.cleanedRequest.action @@ -170,7 +176,13 @@ module.exports = { {key: 'client', label: 'Customer/Prospect 0/1/2/3'}, {key: 'fournisseur', label: 'Supplier 0/1'}, {key: 'code_client', label: 'Customer code'}, - {key: 'code_fournisseur', label: 'Supplier code'} + {key: 'code_fournisseur', label: 'Supplier code'}, + {key: 'idprof1', label: 'Id Prof 1'}, + {key: 'idprof2', label: 'Id Prof 2'}, + {key: 'idprof3', label: 'Id Prof 3'}, + {key: 'idprof4', label: 'Id Prof 4'}, + {key: 'idprof5', label: 'Id Prof 5'}, + {key: 'idprof6', label: 'Id Prof 6'} ] } }; From c94946b934758236a82f3668ffcf969912b823a8 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 4 Jun 2021 23:14:31 +0200 Subject: [PATCH 191/739] Fix #17743 - token was hashed with membersubscription #Fix #17743 - token was hashed with membersubscription for retro-compatibility we must try to hash token wth both "membre" ans "membersubscription" to verify unique secure key d'or member --- htdocs/public/payment/newpayment.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 377077531ae..f19aef7f79c 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -281,6 +281,9 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if ($tmpsource && $REF) { $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$tmpsource.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical + if ($SECUREKEY != $token) { + $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // for retro-compatibility (token may have been hashed with membersubscription in external module) + } } else { $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); } From d327de4e80b0e0bf60e9256bd5f186f7ee00e792 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jun 2021 23:39:52 +0200 Subject: [PATCH 192/739] Doc --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 531a19e0be9..34162fd5682 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You can freely use, study, modify or distribute it according to its licence. You can use it as a standalone application or as a web application to access it from the Internet or a LAN. -Dolibarr has a large community ready to help you, free forums and [officially preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org) +Dolibarr has a large community ready to help you, free forums and [preferred partners ready to offer commercial support should you need it](https://partners.dolibarr.org) ![ScreenShot](https://www.dolibarr.org/medias/dolibarr_screenshot1_1920x1080.jpg) @@ -122,7 +122,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Electronic Document Management (EDM) - Foundations members management - Point of Sale (POS) -- … (around 100 modules available by default, + 1000 on the addon market place) +- … (around 100 modules available by default, 1000+ on the addon market place) ### Other application/modules From 420bf440ef32c98f08a9b6c6f50284336edf93a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 00:53:07 +0200 Subject: [PATCH 193/739] Update newpayment.php --- htdocs/public/payment/newpayment.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index f19aef7f79c..a0e6a1854fd 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -278,11 +278,13 @@ if ($tmpsource == 'membersubscription') { } $valid = true; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + $token = ''; + $tokenoldcompat = ''; if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if ($tmpsource && $REF) { $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$tmpsource.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical - if ($SECUREKEY != $token) { - $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // for retro-compatibility (token may have been hashed with membersubscription in external module) + if ($tmpsource != $source) { + $tokenoldcompat = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // for retro-compatibility (token may have been hashed with membersubscription in external module) } } else { $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); @@ -290,7 +292,7 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { } else { $token = $conf->global->PAYMENT_SECURITY_TOKEN; } - if ($SECUREKEY != $token) { + if ($SECUREKEY != $token && $SECUREKEY != $tokenoldcompat) { if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) { $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility } else { From 246cb09ba58a02b8479d21a48f9a5916c256fa29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 00:56:28 +0200 Subject: [PATCH 194/739] Update newpayment.php --- htdocs/public/payment/newpayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index a0e6a1854fd..b71dd2df499 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -292,7 +292,7 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { } else { $token = $conf->global->PAYMENT_SECURITY_TOKEN; } - if ($SECUREKEY != $token && $SECUREKEY != $tokenoldcompat) { + if ($SECUREKEY != $token && (empty($tokenoldcompat) || $SECUREKEY != $tokenoldcompat)) { if (empty($conf->global->PAYMENT_SECURITY_ACCEPT_ANY_TOKEN)) { $valid = false; // PAYMENT_SECURITY_ACCEPT_ANY_TOKEN is for backward compatibility } else { From 6ae4a75ac2405562adbda1a045f5571b6b19cae5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 01:04:09 +0200 Subject: [PATCH 195/739] Update fournisseur.commande.class.php --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9b643ff1464..be13ad412aa 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -749,8 +749,8 @@ class CommandeFournisseur extends CommonOrder $statusLong = $langs->transnoentitiesnoconv($this->statuts[$status]).$billedtext; $statusShort = $langs->transnoentitiesnoconv($this->statutshort[$status]); - $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed, 'obj'=>$this); - $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $object); // Note that $action and $object may have been modified by hook + $parameters = array('status' => $status, 'mode' => $mode, 'billed' => $billed); + $reshook = $hookmanager->executeHooks('LibStatut', $parameters, $this); // Note that $action and $object may have been modified by hook if ($reshook > 0) { return $hookmanager->resPrint; } From f0118183c848cbf5443bc394fa8c0cdad20e4d0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 01:11:05 +0200 Subject: [PATCH 196/739] Clean code --- .../class/fournisseur.commande.class.php | 2 + htdocs/public/payment/newpayment.php | 185 +++++++++--------- 2 files changed, 94 insertions(+), 93 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index d094916ef38..06f893026a5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -156,6 +156,8 @@ class CommandeFournisseur extends CommonOrder public $user_approve_id; public $user_approve_id2; // Used when SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED is set + public $refuse_note; + public $extraparams = array(); /** diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 377077531ae..49093e0913e 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -907,7 +907,6 @@ print ''.$langs->trans("T $found = false; $error = 0; -$var = false; $object = null; @@ -923,17 +922,17 @@ if (!$source) { } // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Amount - print ''.$langs->trans("Amount"); + print ''.$langs->trans("Amount"); if (empty($amount)) { print ' ('.$langs->trans("ToComplete").')'; } - print ''; + print ''; if (empty($amount) || !is_numeric($amount)) { print ''; print ''; @@ -948,8 +947,8 @@ if (!$source) { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -995,14 +994,14 @@ if ($source == 'order') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("ThirdParty"); - print ''.$order->thirdparty->name.''; + print ''.$langs->trans("ThirdParty"); + print ''.$order->thirdparty->name.''; print ''."\n"; // Object @@ -1010,8 +1009,8 @@ if ($source == 'order') { if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; } - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''; @@ -1024,11 +1023,11 @@ if ($source == 'order') { print ''."\n"; // Amount - print ''.$langs->trans("Amount"); + print ''.$langs->trans("Amount"); if (empty($amount)) { print ' ('.$langs->trans("ToComplete").')'; } - print ''; + print ''; if (empty($amount) || !is_numeric($amount)) { print ''; print ''; @@ -1043,8 +1042,8 @@ if ($source == 'order') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1119,14 +1118,14 @@ if ($source == 'invoice') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("ThirdParty"); - print ''.$invoice->thirdparty->name.''; + print ''.$langs->trans("ThirdParty"); + print ''.$invoice->thirdparty->name.''; print ''."\n"; // Object @@ -1134,8 +1133,8 @@ if ($source == 'invoice') { if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; } - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''; @@ -1148,11 +1147,11 @@ if ($source == 'invoice') { print ''."\n"; // Amount - print ''.$langs->trans("PaymentAmount"); + print ''.$langs->trans("PaymentAmount"); if (empty($amount) && empty($object->paye)) { print ' ('.$langs->trans("ToComplete").')'; } - print ''; + print ''; if ($object->type == $object::TYPE_CREDIT_NOTE) { print ''.$langs->trans("CreditNote").''; } elseif (empty($object->paye)) { @@ -1174,8 +1173,8 @@ if ($source == 'invoice') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1290,14 +1289,14 @@ if ($source == 'contractline') { } // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("ThirdParty"); - print ''.$contract->thirdparty->name.''; + print ''.$langs->trans("ThirdParty"); + print ''.$contract->thirdparty->name.''; print ''."\n"; // Object @@ -1319,8 +1318,8 @@ if ($source == 'contractline') { if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; } - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''; @@ -1349,17 +1348,17 @@ if ($source == 'contractline') { $duration = $contractline->product->duration_value.' '.$dur[$contractline->product->duration_unit]; } } - print ''.$label.''; - print ''.($duration ? $duration : $qty).''; + print ''.$label.''; + print ''.($duration ? $duration : $qty).''; print ''; print ''."\n"; // Amount - print ''.$langs->trans("Amount"); + print ''.$langs->trans("Amount"); if (empty($amount)) { print ' ('.$langs->trans("ToComplete").')'; } - print ''; + print ''; if (empty($amount) || !is_numeric($amount)) { print ''; print ''; @@ -1374,8 +1373,8 @@ if ($source == 'contractline') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1451,14 +1450,14 @@ if ($source == 'member' || $source == 'membersubscription') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("Member"); - print ''; + print ''.$langs->trans("Member"); + print ''; if ($member->morphy == 'mor' && !empty($member->societe)) { print $member->societe; } else { @@ -1472,29 +1471,29 @@ if ($source == 'member' || $source == 'membersubscription') { if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; } - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''."\n"; if ($object->datefin > 0) { - print ''.$langs->trans("DateEndSubscription"); - print ''.dol_print_date($member->datefin, 'day'); + print ''.$langs->trans("DateEndSubscription"); + print ''.dol_print_date($member->datefin, 'day'); print ''."\n"; } if ($member->last_subscription_date || $member->last_subscription_amount) { // Last subscription date - print ''.$langs->trans("LastSubscriptionDate"); - print ''.dol_print_date($member->last_subscription_date, 'day'); + print ''.$langs->trans("LastSubscriptionDate"); + print ''.dol_print_date($member->last_subscription_date, 'day'); print ''."\n"; // Last subscription amount - print ''.$langs->trans("LastSubscriptionAmount"); - print ''.price($member->last_subscription_amount); + print ''.$langs->trans("LastSubscriptionAmount"); + print ''.price($member->last_subscription_amount); print ''."\n"; if (empty($amount) && !GETPOST('newamount', 'alpha')) { @@ -1513,8 +1512,8 @@ if ($source == 'member' || $source == 'membersubscription') { $amountbytype = $adht->amountByType(1); // Last member type - print ''.$langs->trans("LastMemberType"); - print ''.dol_escape_htmltag($member->type); + print ''.$langs->trans("LastMemberType"); + print ''.dol_escape_htmltag($member->type); print "\n"; // Set the new member type @@ -1526,25 +1525,25 @@ if ($source == 'member' || $source == 'membersubscription') { // Set amount for the subscription $amount = (!empty($amountbytype[$member->typeid])) ? $amountbytype[$member->typeid] : $member->last_subscription_amount; - print ''.$langs->trans("NewSubscription"); - print ''; + print ''.$langs->trans("NewSubscription"); + print ''; print $form->selectarray("typeid", $adht->liste_array(1), $member->typeid, 0, 0, 0, 'onchange="window.location.replace(\''.$urlwithroot.'/public/payment/newpayment.php?source='.urlencode($source).'&ref='.urlencode($ref).'&amount='.urlencode($amount).'&typeid=\' + this.value + \'&securekey='.urlencode($SECUREKEY).'\');"', 0, 0, 0, '', '', 1); print "\n"; } elseif ($action == dopayment) { - print ''.$langs->trans("NewMemberType"); - print ''.dol_escape_htmltag($member->type); + print ''.$langs->trans("NewMemberType"); + print ''.dol_escape_htmltag($member->type); print ''; print "\n"; } } else { - print ''.$langs->trans("MemberType"); - print ''.dol_escape_htmltag($member->type); + print ''.$langs->trans("MemberType"); + print ''.dol_escape_htmltag($member->type); print "\n"; } } // Amount - print ''.$langs->trans("Amount"); + print ''.$langs->trans("Amount"); if (empty($amount)) { if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { print ' ('.$langs->trans("ToComplete"); @@ -1556,7 +1555,7 @@ if ($source == 'member' || $source == 'membersubscription') { print ')'; } } - print ''; + print ''; $valtoshow = ''; if (empty($amount) || !is_numeric($amount)) { $valtoshow = price2num(GETPOST("newamount", 'alpha'), 'MT'); @@ -1601,8 +1600,8 @@ if ($source == 'member' || $source == 'membersubscription') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1677,14 +1676,14 @@ if ($source == 'donation') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("ThirdParty"); - print ''; + print ''.$langs->trans("ThirdParty"); + print ''; if ($don->morphy == 'mor' && !empty($don->societe)) { print $don->societe; } else { @@ -1698,14 +1697,14 @@ if ($source == 'donation') { if (GETPOST('desc', 'alpha')) { $text = ''.$langs->trans(GETPOST('desc', 'alpha')).''; } - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''."\n"; // Amount - print ''.$langs->trans("Amount"); + print ''.$langs->trans("Amount"); if (empty($amount)) { if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { print ' ('.$langs->trans("ToComplete"); @@ -1717,7 +1716,7 @@ if ($source == 'donation') { print ')'; } } - print ''; + print ''; $valtoshow = ''; if (empty($amount) || !is_numeric($amount)) { $valtoshow = price2num(GETPOST("newamount", 'alpha'), 'MT'); @@ -1757,8 +1756,8 @@ if ($source == 'donation') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1811,29 +1810,29 @@ if ($source == 'conferencesubscription') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("Attendee"); - print ''; + print ''.$langs->trans("Attendee"); + print ''; print $thirdparty->name; print ''; print ''."\n"; // Object $text = ''.$langs->trans("PaymentConferenceAttendee").''; - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''."\n"; // Amount - print ''.$langs->trans("Amount"); - print ''; + print ''.$langs->trans("Amount"); + print ''; $valtoshow = $amount; print ''.price($valtoshow).''; print ''; @@ -1845,8 +1844,8 @@ if ($source == 'conferencesubscription') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; @@ -1897,29 +1896,29 @@ if ($source == 'boothlocation') { $fulltag = dol_string_unaccent($fulltag); // Creditor - print ''.$langs->trans("Creditor"); - print ''.$creditor.''; + print ''.$langs->trans("Creditor"); + print ''.$creditor.''; print ''; print ''."\n"; // Debitor - print ''.$langs->trans("Attendee"); - print ''; + print ''.$langs->trans("Attendee"); + print ''; print $thirdparty->name; print ''; print ''."\n"; // Object $text = ''.$langs->trans("PaymentBoothLocation").''; - print ''.$langs->trans("Designation"); - print ''.$text; + print ''.$langs->trans("Designation"); + print ''.$text; print ''; print ''; print ''."\n"; // Amount - print ''.$langs->trans("Amount"); - print ''; + print ''.$langs->trans("Amount"); + print ''; $valtoshow = $amount; print ''.price($valtoshow).''; print ''; @@ -1931,8 +1930,8 @@ if ($source == 'boothlocation') { print ''."\n"; // Tag - print ''.$langs->trans("PaymentCode"); - print ''.$fulltag.''; + print ''.$langs->trans("PaymentCode"); + print ''.$fulltag.''; print ''; print ''; print ''."\n"; From 3e53ab5bfe13144ce3deee0e7fe345dac8fe31d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 01:17:16 +0200 Subject: [PATCH 197/739] Fix scrutinizer --- htdocs/user/class/api_users.class.php | 6 ++---- htdocs/user/class/user.class.php | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index e760997f3c8..9fa84042c3a 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -248,8 +248,8 @@ class Users extends DolibarrApi * * @url GET /info * - * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) - * @return array|mixed Data without useless information + * @param int $includepermissions Set this to 1 to have the array of permissions loaded (not done by default for performance purpose) + * @return array|mixed Data without useless information * * @throws RestException 401 Insufficient rights * @throws RestException 404 User or group not found @@ -371,11 +371,9 @@ class Users extends DolibarrApi if ($field == 'pass') { if ($this->useraccount->id != DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->user->password)) { throw new RestException(401, 'You are not allowed to modify password of other users'); - continue; } if ($this->useraccount->id == DolibarrApiAccess::$user->id && empty(DolibarrApiAccess::$user->rights->user->self->password)) { throw new RestException(401, 'You are not allowed to modify your own password'); - continue; } } if (DolibarrApiAccess::$user->admin) { // If user for API is admin diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b8e63ea8f19..910edce8c17 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -299,6 +299,11 @@ class User extends CommonObject */ public $nb_rights; + /** + * @var array To store list of groups of user (used by API /info for example) + */ + public $user_group_list; + /** * @var array Cache array of already loaded permissions */ From 39adaec7eb9616c543d709ab539461dec48a27af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 01:29:24 +0200 Subject: [PATCH 198/739] Fix var not found --- htdocs/compta/bank/class/account.class.php | 8 +++++++- htdocs/compta/charges/index.php | 10 ++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 8c29a9ffc36..e629d7620f0 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -177,6 +177,10 @@ class Account extends CommonObject * @var int ID */ public $fk_accountancy_journal; + /** + * @var string Label of journal + */ + public $accountancy_journal; /** * Currency code @@ -281,6 +285,7 @@ class Account extends CommonObject 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), 'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125), 'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130), + 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Accountancy journal ID', 'enabled'=>1, 'visible'=>-1, 'position'=>132), 'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140), 'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145), @@ -294,7 +299,6 @@ class Account extends CommonObject 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), - 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Fk accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>190), ); // END MODULEBUILDER PROPERTIES @@ -311,9 +315,11 @@ class Account extends CommonObject */ const TYPE_SAVINGS = 0; + const STATUS_OPEN = 0; const STATUS_CLOSED = 1; + /** * Constructor * diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index f171546f6c1..be7c88c0a1a 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -227,9 +227,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { $accountstatic->id = $obj->bid; $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; - $accountstatic->accountancy_number = $obj->account_number; - $accountstatic->accountancy_journal = $obj->accountancy_journal; + $accountstatic->account_number = $obj->account_number; + $accountstatic->fk_accountancy_journal = $obj->fk_accountancy_journal; $accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); } else { print ' '; @@ -348,9 +349,10 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { $accountstatic->id = $obj->bid; $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; - $accountstatic->accountancy_number = $obj->account_number; - $accountstatic->accountancy_journal = $obj->accountancy_journal; + $accountstatic->account_number = $obj->account_number; + $accountstatic->fk_accountancy_journal = $obj->fk_accountancy_journal; $accountstatic->label = $obj->blabel; + print $accountstatic->getNomUrl(1); } else { print ' '; From b6ba1de3b39acb2835f9fa5e4fc9fbc760631e7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 02:18:45 +0200 Subject: [PATCH 199/739] Fix remove use of captcha on backoffice for ticket creation --- htdocs/core/class/html.formticket.class.php | 2 +- htdocs/ticket/card.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 23c220d43df..b10ac80416f 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -259,7 +259,7 @@ class FormTicket $doleditor->Create(); print ''; - if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { + if ($public && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; print ''; print ''; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 5e2ef1e804b..96a5ad0c120 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -53,6 +53,7 @@ $ref = GETPOST('ref', 'alpha'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); +$backtopage = GETPOST('$backtopage', 'alpha'); $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); @@ -152,7 +153,7 @@ if (empty($reshook)) { } // Action to add an action (not a message) - if (GETPOST('add', 'alpha') && $user->rights->ticket->write) { + if (GETPOST('add', 'alpha') && !empty($user->rights->ticket->write)) { $error = 0; if (!GETPOST("subject", 'alphanohtml')) { From 865bf3b8493c4273f0e0f6e30fa05aa8ddc7c843 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 02:42:49 +0200 Subject: [PATCH 200/739] CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- htdocs/theme/md/style.css.php | 9 +++++++-- htdocs/ticket/class/actions_ticket.class.php | 8 +++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 4468c36a7da..70e5229ba28 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -348,7 +348,7 @@ a.butStatus { padding-right: 5px; background-color: transparent; color: var(--colortext) !important; - border: 2px solid var( --butactionbg); + border: 2px solid var( --butactionbg) !important; margin: 0 0.45em !important; } @@ -3894,7 +3894,7 @@ table.noborder.paymenttable { } .paymenttable tr td:first-child, .margintable tr td:first-child { - padding-left: 2px; + //padding-left: 2px; } .paymenttable, .margintable tr td { height: 22px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index f1fb649f4af..7dd19673b5e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3902,14 +3902,19 @@ tr.liste_sub_total, tr.liste_sub_total td { } .paymenttable, .margintable { + margin: 0px 0px 0px 0px !important; +} +.paymenttable, .margintable:not(.margintablenotop) { border-top-width: px !important; border-top-color: rgb() !important; border-top-style: solid !important; - margin: 0px 0px 0px 0px !important; +} +.margintable.margintablenotop { + border-top-width: 0; } .paymenttable tr td:first-child, .margintable tr td:first-child { - padding-left: 2px; + //padding-left: 2px; } .paymenttable, .margintable tr td { height: 22px; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index eb6193d58f1..b787a437899 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -192,7 +192,7 @@ class ActionsTicket // Initial message print '
'; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; + print '
'; print ''; } // Date end if (!empty($arrayfields['d.date_fin']['checked'])) { print ''; } // Date valid From c1757bdbd8b0476274ba452e774857fb51a8c754 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 06:28:38 +0200 Subject: [PATCH 219/739] Remove warning --- htdocs/compta/paiement/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b6835765c00..ee847603954 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -71,6 +71,7 @@ $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); $search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" +$search_status = GETPOST('search_status', 'intcomma'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -142,11 +143,13 @@ if (empty($reshook)) { $search_date_endmonth = ''; $search_date_endyear = ''; $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; + $search_status = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -348,10 +351,12 @@ if ($search_all) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$massactionbutton = ''; if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } +$moreforfilter = ''; print '
'; print '
'; print $langs->trans("InitialMessage"); print ''; @@ -391,7 +391,7 @@ class ActionsTicket { global $langs; - print '
'; + print '

'; + print ''; + print ''; + print '
'; } /** From 466bc2625663f7b775dc8302e37cf21129b873d9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Jun 2021 07:16:43 +0200 Subject: [PATCH 201/739] Fix with search_date_startxxx --- htdocs/fourn/paiement/list.php | 42 ++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 6b932ae2019..39ad7131b24 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -49,13 +49,19 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 've $socid = GETPOST('socid', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_company = GETPOST('search_company', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_company = GETPOST('search_company', 'alpha'); $search_payment_type = GETPOST('search_payment_type'); -$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); +$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); $search_bank_account = GETPOST('search_bank_account', 'int'); -$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' +$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); @@ -135,6 +141,12 @@ if (empty($reshook)) { if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; $search_company = ''; @@ -259,11 +271,23 @@ if ($optioncss != '') { if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); } -if ($search_date_start) { - $param.= '&search_date_start='.urlencode($search_date_start); +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } -if ($search_date_end) { - $param.= '&search_date_end='.urlencode($search_date_end); +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); } if ($search_company) { $param .= '&search_company='.urlencode($search_company); From a92bd31ce14d46b5786ad5fc303d5452a5af3b5e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Jun 2021 07:39:15 +0200 Subject: [PATCH 202/739] Fix search_datexxx --- htdocs/compta/paiement/list.php | 68 +++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c06f8ee9cb5..b6835765c00 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan @@ -58,12 +58,18 @@ $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST("search_ref", "alpha"); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_company = GETPOST("search_company", 'alpha'); -$search_paymenttype = GETPOST("search_paymenttype"); -$search_account = GETPOST("search_account", "int"); -$search_payment_num = GETPOST('search_payment_num', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_company = GETPOST("search_company", 'alpha'); +$search_paymenttype = GETPOST("search_paymenttype"); +$search_account = GETPOST("search_account", "int"); +$search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -129,8 +135,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; - $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; @@ -276,13 +287,40 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } -$param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); -$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); -$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); -$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); -$param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); -$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); -$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); + +if (GETPOST("orphelins")) { + $param .= '&orphelins=1'; +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); +} +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_company) { + $param .= '&search_company='.urlencode($search_company); +} +if ($search_amount != '') { + $param .= '&search_amount='.urlencode($search_amount); +} +if ($search_payment_num) { + $param .= '&search_payment_num='.urlencode($search_payment_num); +} if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } From f6bc1c64144a51d2bb92e34acba8757926819a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 5 Jun 2021 09:37:38 +0200 Subject: [PATCH 203/739] add trigger contact --- dev/examples/zapier/index.js | 2 ++ ...face_99_modZapier_ZapierTriggers.class.php | 19 +++++++++++++++++++ htdocs/societe/class/api_contacts.class.php | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/dev/examples/zapier/index.js b/dev/examples/zapier/index.js index d1897673b39..d96df72e11f 100644 --- a/dev/examples/zapier/index.js +++ b/dev/examples/zapier/index.js @@ -2,6 +2,7 @@ const triggerAction = require('./triggers/action'); const triggerOrder = require('./triggers/order'); const triggerThirdparty = require('./triggers/thirdparty'); +const triggerContact = require('./triggers/contact'); const triggerTicket = require('./triggers/ticket'); const triggerUser = require('./triggers/user'); @@ -62,6 +63,7 @@ const App = { [triggerAction.key]: triggerAction, [triggerOrder.key]: triggerOrder, [triggerThirdparty.key]: triggerThirdparty, + [triggerContact.key]: triggerContact, [triggerTicket.key]: triggerTicket, [triggerUser.key]: triggerUser, }, diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 4e808d5bf15..7d6f346449d 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -174,8 +174,27 @@ class InterfaceZapierTriggers extends DolibarrTriggers // Contacts case 'CONTACT_CREATE': + $resql = $this->db->query($sql); + while ($resql && $obj = $this->db->fetch_array($resql)) { + $cleaned = cleanObjectDatas(dol_clone($object)); + $json = json_encode($cleaned); + // call the zapierPostWebhook() function + zapierPostWebhook($obj['url'], $json); + } + $logtriggeraction = true; + break; case 'CONTACT_MODIFY': + $resql = $this->db->query($sql); + while ($resql && $obj = $this->db->fetch_array($resql)) { + $cleaned = cleanObjectDatas(dol_clone($object)); + $json = json_encode($cleaned); + // call the zapierPostWebhook() function + zapierPostWebhook($obj['url'], $json); + } + $logtriggeraction = true; + break; case 'CONTACT_DELETE': + break; case 'CONTACT_ENABLEDISABLE': break; // Products diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index f62fb894bd0..f87ca111164 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -75,7 +75,7 @@ class Contacts extends DolibarrApi throw new RestException(401, 'No permission to read contacts'); } - if ($id == 0) { + if ($id === 0) { $result = $this->contact->initAsSpecimen(); } else { $result = $this->contact->fetch($id); From 1d1c85ca98831ad4fb0bc8c406f779851cbebf28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 5 Jun 2021 09:38:33 +0200 Subject: [PATCH 204/739] add trigger contact --- dev/examples/zapier/triggers/contact.js | 175 ++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 dev/examples/zapier/triggers/contact.js diff --git a/dev/examples/zapier/triggers/contact.js b/dev/examples/zapier/triggers/contact.js new file mode 100644 index 00000000000..6db4d7f5053 --- /dev/null +++ b/dev/examples/zapier/triggers/contact.js @@ -0,0 +1,175 @@ +const subscribeHook = (z, bundle) => { + // `z.console.log()` is similar to `console.log()`. + z.console.log('suscribing hook!'); + + // bundle.targetUrl has the Hook URL this app should call when an action is created. + const data = { + url: bundle.targetUrl, + event: bundle.event, + module: 'contact', + action: bundle.inputData.action + }; + + const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; + + // You can build requests and our client will helpfully inject all the variables + // you need to complete. You can also register middleware to control this. + const options = { + url: url, + method: 'POST', + body: data, + }; + + // You may return a promise or a normal data structure from any perform method. + return z.request(options).then((response) => JSON.parse(response.content)); +}; + +const unsubscribeHook = (z, bundle) => { + // bundle.subscribeData contains the parsed response JSON from the subscribe + // request made initially. + z.console.log('unsuscribing hook!'); + + // You can build requests and our client will helpfully inject all the variables + // you need to complete. You can also register middleware to control this. + const options = { + url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, + method: 'DELETE', + }; + + // You may return a promise or a normal data structure from any perform method. + return z.request(options).then((response) => JSON.parse(response.content)); +}; + +const getContact = (z, bundle) => { + // bundle.cleanedRequest will include the parsed JSON object (if it's not a + // test poll) and also a .querystring property with the URL's query string. + const contact = { + id: bundle.cleanedRequest.id, + name: bundle.cleanedRequest.name, + name_alias: bundle.cleanedRequest.name_alias, + firstname: bundle.cleanedRequest.firstname, + address: bundle.cleanedRequest.address, + zip: bundle.cleanedRequest.zip, + town: bundle.cleanedRequest.town, + email: bundle.cleanedRequest.email, + client: bundle.cleanedRequest.client, + fournisseur: bundle.cleanedRequest.fournisseur, + code_client: bundle.cleanedRequest.code_client, + code_fournisseur: bundle.cleanedRequest.code_fournisseur, + idprof1: bundle.cleanedRequest.idprof1, + idprof2: bundle.cleanedRequest.idprof2, + idprof3: bundle.cleanedRequest.idprof3, + idprof4: bundle.cleanedRequest.idprof4, + idprof5: bundle.cleanedRequest.idprof5, + idprof6: bundle.cleanedRequest.idprof6, + authorId: bundle.cleanedRequest.authorId, + createdAt: bundle.cleanedRequest.createdAt, + action: bundle.cleanedRequest.action + }; + + return [contact]; +}; + +const getFallbackRealContact = (z, bundle) => { + // For the test poll, you should get some real data, to aid the setup process. + const module = bundle.inputData.module; + const options = { + url: bundle.authData.url + '/api/index.php/contacts/0', + }; + + return z.request(options).then((response) => [JSON.parse(response.content)]); +}; + +// const getModulesChoices = (z/*, bundle*/) => { +// // For the test poll, you should get some real data, to aid the setup process. +// const options = { +// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', +// }; + +// return z.request(options).then((response) => JSON.parse(response.content)); +// }; +// const getModulesChoices = () => { +// return { +// orders: "Order", +// invoices: "Invoice", +// contacts: "Contact", +// contacts: "Contacts" +// }; +// }; + +// const getActionsChoices = (z, bundle) => { +// // For the test poll, you should get some real data, to aid the setup process. +// const module = bundle.inputData.module; +// const options = { +// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, +// }; + +// return z.request(options).then((response) => JSON.parse(response.content)); +// }; + +// We recommend writing your triggers separate like this and rolling them +// into the App definition at the end. +module.exports = { + key: 'contact', + + // You'll want to provide some helpful display labels and descriptions + // for users. Zapier will put them into the UX. + noun: 'Contact', + display: { + label: 'New Contact', + description: 'Triggers when a new thirdpaty action is done in Dolibarr.' + }, + + // `operation` is where the business logic goes. + operation: { + + // `inputFields` can define the fields a user could provide, + // we'll pass them in as `bundle.inputData` later. + inputFields: [ + { + key: 'action', + required: true, + type: 'string', + helpText: 'Which action of contact this should trigger on.', + choices: { + create: "Create", + modify: "Modify", + validate: "Validate", + } + } + ], + + type: 'hook', + + performSubscribe: subscribeHook, + performUnsubscribe: unsubscribeHook, + + perform: getContact, + performList: getFallbackRealContact, + + // In cases where Zapier needs to show an example record to the user, but we are unable to get a live example + // from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of + // returned records, and have obviously dummy values that we can show to any user. + sample: { + id: 1, + createdAt: 1472069465, + lastname: 'DOE', + firstname: 'John', + authorId: 1, + action: 'create' + }, + + // If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom + // field definitions. The result will be used to augment the sample. + // outputFields: () => { return []; } + // Alternatively, a static field definition should be provided, to specify labels for the fields + outputFields: [ + {key: 'id', type: "integer", label: 'ID'}, + {key: 'createdAt', label: 'Created At'}, + {key: 'lastname', label: 'Lastname'}, + {key: 'firstname', label: 'Firstname'}, + {key: 'authorId', type: "integer", label: 'Author ID'}, + {key: 'action', label: 'Action'} + ] + } +}; From e79be6f4872b3eedeb06c9bc8617250a672a6d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 5 Jun 2021 09:41:14 +0200 Subject: [PATCH 205/739] add trigger contact --- dev/examples/zapier/triggers/contact.js | 12 +----------- dev/examples/zapier/triggers/thirdparty.js | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/dev/examples/zapier/triggers/contact.js b/dev/examples/zapier/triggers/contact.js index 6db4d7f5053..547755d241d 100644 --- a/dev/examples/zapier/triggers/contact.js +++ b/dev/examples/zapier/triggers/contact.js @@ -52,16 +52,6 @@ const getContact = (z, bundle) => { zip: bundle.cleanedRequest.zip, town: bundle.cleanedRequest.town, email: bundle.cleanedRequest.email, - client: bundle.cleanedRequest.client, - fournisseur: bundle.cleanedRequest.fournisseur, - code_client: bundle.cleanedRequest.code_client, - code_fournisseur: bundle.cleanedRequest.code_fournisseur, - idprof1: bundle.cleanedRequest.idprof1, - idprof2: bundle.cleanedRequest.idprof2, - idprof3: bundle.cleanedRequest.idprof3, - idprof4: bundle.cleanedRequest.idprof4, - idprof5: bundle.cleanedRequest.idprof5, - idprof6: bundle.cleanedRequest.idprof6, authorId: bundle.cleanedRequest.authorId, createdAt: bundle.cleanedRequest.createdAt, action: bundle.cleanedRequest.action @@ -117,7 +107,7 @@ module.exports = { noun: 'Contact', display: { label: 'New Contact', - description: 'Triggers when a new thirdpaty action is done in Dolibarr.' + description: 'Triggers when a new contact action is done in Dolibarr.' }, // `operation` is where the business logic goes. diff --git a/dev/examples/zapier/triggers/thirdparty.js b/dev/examples/zapier/triggers/thirdparty.js index 0fecd4434ce..76194acbc9a 100644 --- a/dev/examples/zapier/triggers/thirdparty.js +++ b/dev/examples/zapier/triggers/thirdparty.js @@ -118,7 +118,7 @@ module.exports = { noun: 'Thirdparty', display: { label: 'New Thirdparty', - description: 'Triggers when a new thirdpaty action is done in Dolibarr.' + description: 'Triggers when a new thirdparty action is done in Dolibarr.' }, // `operation` is where the business logic goes. From 69d70d5ea8c3680691477547b44b75d144ed8c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 5 Jun 2021 10:09:44 +0200 Subject: [PATCH 206/739] update connector version add trigger contact --- dev/examples/zapier/package.json | 4 ++-- dev/examples/zapier/triggers/contact.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json index 4d5c5daa867..a9d519dec69 100644 --- a/dev/examples/zapier/package.json +++ b/dev/examples/zapier/package.json @@ -1,6 +1,6 @@ { "name": "dolibarr", - "version": "1.13.0", + "version": "1.14.0", "description": "An app for connecting Dolibarr to the Zapier platform.", "repository": "Dolibarr/dolibarr", "homepage": "https://www.dolibarr.org/", @@ -11,7 +11,7 @@ "test": "mocha --recursive" }, "engines": { - "node": "8.10.0", + "node": "14.0.0", "npm": ">=5.6.0" }, "dependencies": { diff --git a/dev/examples/zapier/triggers/contact.js b/dev/examples/zapier/triggers/contact.js index 547755d241d..2ba3bd226f8 100644 --- a/dev/examples/zapier/triggers/contact.js +++ b/dev/examples/zapier/triggers/contact.js @@ -52,6 +52,9 @@ const getContact = (z, bundle) => { zip: bundle.cleanedRequest.zip, town: bundle.cleanedRequest.town, email: bundle.cleanedRequest.email, + phone_pro: bundle.cleanedRequest.phone_pro, + phone_perso: bundle.cleanedRequest.phone_perso, + phone_mobile: bundle.cleanedRequest.phone_mobile, authorId: bundle.cleanedRequest.authorId, createdAt: bundle.cleanedRequest.createdAt, action: bundle.cleanedRequest.action @@ -158,6 +161,9 @@ module.exports = { {key: 'createdAt', label: 'Created At'}, {key: 'lastname', label: 'Lastname'}, {key: 'firstname', label: 'Firstname'}, + {key: 'phone', label: 'Phone pro'}, + {key: 'phone_perso', label: 'Phone perso'}, + {key: 'phone_mobile', label: 'Phone mobile'}, {key: 'authorId', type: "integer", label: 'Author ID'}, {key: 'action', label: 'Action'} ] From 7a93365836d0a6ad7450d3d3de193fbb1a470f8c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 11:07:38 +0200 Subject: [PATCH 207/739] Fix bad name of var --- htdocs/core/lib/pdf.lib.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d1c793c621c..6095abff8ee 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1325,31 +1325,31 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $translatealsoifmodified = (!empty($conf->global->MAIN_MULTILANG_TRANSLATE_EVEN_IF_MODIFIED)); // By default if value was modified manually, we keep it (no translation because we don't have it) // TODO Instead of making a compare to see if param was modified, check that content contains reference translation. If yes, add the added part to the new translation - // ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion). + // ($textwasnotmodified is replaced with $textwasmodifiedorcompleted and we add completion). // Set label // If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation. //var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit; - $textwasmodified = ($label == $prodser->label); - if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) { + $textwasnotmodified = ($label == $prodser->label); + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasnotmodified || $translatealsoifmodified)) { $label = $prodser->multilangs[$outputlangs->defaultlang]["label"]; } // Set desc // Manage HTML entities description test because $prodser->description is store with htmlentities but $desc no - $textwasmodified = false; + $textwasnotmodified = false; if (!empty($desc) && dol_textishtml($desc) && !empty($prodser->description) && dol_textishtml($prodser->description)) { - $textwasmodified = (strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML5), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML5)) !== false); + $textwasnotmodified = (strpos(dol_html_entity_decode($desc, ENT_QUOTES | ENT_HTML5), dol_html_entity_decode($prodser->description, ENT_QUOTES | ENT_HTML5)) !== false); } else { - $textwasmodified = ($desc == $prodser->description); + $textwasnotmodified = ($desc == $prodser->description); } - if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasmodified || $translatealsoifmodified)) { + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && ($textwasnotmodified || $translatealsoifmodified)) { $desc = $prodser->multilangs[$outputlangs->defaultlang]["description"]; } // Set note - $textwasmodified = ($note == $prodser->note); - if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasmodified || $translatealsoifmodified)) { + $textwasnotmodified = ($note == $prodser->note_public); + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasnotmodified || $translatealsoifmodified)) { $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; } } From ddbfb5d73484954ff29a3d9e4bb67ddf948a6b89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 11:14:06 +0200 Subject: [PATCH 208/739] Fix translation of note of product --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6095abff8ee..880c63970f7 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1349,8 +1349,8 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // Set note $textwasnotmodified = ($note == $prodser->note_public); - if (!empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && ($textwasnotmodified || $translatealsoifmodified)) { - $note = $prodser->multilangs[$outputlangs->defaultlang]["note"]; + if (!empty($prodser->multilangs[$outputlangs->defaultlang]["other"]) && ($textwasnotmodified || $translatealsoifmodified)) { + $note = $prodser->multilangs[$outputlangs->defaultlang]["other"]; } } } elseif ($object->element == 'facture' || $object->element == 'facturefourn') { From be97d66f5ba5e725dee3117dc90c9a29d1b15c72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 12:58:14 +0200 Subject: [PATCH 209/739] Look and feel v14 --- htdocs/langs/en_US/partnership.lang | 4 ++- .../admin/partnership_extrafields.php | 2 +- htdocs/partnership/admin/setup.php | 35 +++++++++++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index df9619533de..72868ab6ddf 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -32,10 +32,12 @@ ListOfPartnerships=List of partnership PartnershipSetup=Partnership setup PartnershipAbout=About Partnership PartnershipAboutPage=Partnership about page -partnershipforthirdpartyormember=Partnership is for a 'thirdparty' or for a 'member' +partnershipforthirdpartyormember=Partner status must be set on a 'thirdparty' or a 'member' PARTNERSHIP_IS_MANAGED_FOR=Partnership managed for PARTNERSHIP_BACKLINKS_TO_CHECK=Backlinks to check PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL=Nb of days before cancel status of partnership when subscription is expired +ReferingWebsiteCheck=Check of website referring +ReferingWebsiteCheckDesc=You can enable a feature to check that your partners has added a backlink to your website domains on their own website. # # Object diff --git a/htdocs/partnership/admin/partnership_extrafields.php b/htdocs/partnership/admin/partnership_extrafields.php index 7d819b3bbcb..f178bc893cd 100644 --- a/htdocs/partnership/admin/partnership_extrafields.php +++ b/htdocs/partnership/admin/partnership_extrafields.php @@ -98,7 +98,7 @@ llxHeader('', $title, $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'object_partnership'); +print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'title_setup'); $head = partnershipAdminPrepareHead(); diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index d681274106c..79c8c469eec 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -139,22 +139,22 @@ print ''; print ''; print ''; +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; - print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print ''; - print ''; print ''; print ''; print ''; @@ -163,7 +163,7 @@ print ''; if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { print ''; print ''; @@ -171,6 +171,25 @@ if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { print ''; } +print '
'.$langs->trans("Setting").''.$langs->trans("Value").''.$langs->trans("Examples").''.$langs->trans("Setting").''.$langs->trans("Value").''.$langs->trans("Examples").'
'.$langs->trans("PARTNERSHIP_IS_MANAGED_FOR").''; print ''; +print ajax_combobox('select_PARTNERSHIP_IS_MANAGED_FOR'); print ''.$langs->trans("partnershipforthirdpartyormember").'
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; - $dnbdays = '7'; + $dnbdays = '15'; $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; print ''; print '
'; +print '
'; + +print '
'; + + +print_fiche_titre($langs->trans("ReferingWebsiteCheck"), '', ''); + +print ''.$langs->trans("ReferingWebsiteCheckDesc").'
'; +print '
'; + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; print ''; print ''; print ''; print ''; - print '
'.$langs->trans("Setting").''.$langs->trans("Value").''.$langs->trans("Examples").'
'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").''; @@ -181,8 +200,10 @@ print ''.$dbacklinks.'
'; +print '
'; + + print '
'; print ''; print '
'; From 4695bbbd600c9d75eaae3dbfc9c6ad9a88c6babe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 12:59:19 +0200 Subject: [PATCH 210/739] Trans --- htdocs/langs/en_US/partnership.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 72868ab6ddf..7decec2a003 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -35,7 +35,7 @@ PartnershipAboutPage=Partnership about page partnershipforthirdpartyormember=Partner status must be set on a 'thirdparty' or a 'member' PARTNERSHIP_IS_MANAGED_FOR=Partnership managed for PARTNERSHIP_BACKLINKS_TO_CHECK=Backlinks to check -PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL=Nb of days before cancel status of partnership when subscription is expired +PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL=Nb of days before cancelling status of a partnership when a subscription has expired ReferingWebsiteCheck=Check of website referring ReferingWebsiteCheckDesc=You can enable a feature to check that your partners has added a backlink to your website domains on their own website. From 36accba5c96df8c726357b3ea8cb92a2aed9cb11 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 5 Jun 2021 14:43:40 +0200 Subject: [PATCH 211/739] Fix date_start of last subscription --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index eeede7b3810..1d8ed358c73 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1402,7 +1402,7 @@ class Adherent extends CommonObject $this->first_subscription_amount = $obj->subscription; } $this->last_subscription_date = $this->db->jdate($obj->datec); - $this->last_subscription_date_start = $this->db->jdate($obj->datef); + $this->last_subscription_date_start = $this->db->jdate($obj->dateh); $this->last_subscription_date_end = $this->db->jdate($obj->datef); $this->last_subscription_amount = $obj->subscription; From 1e657b86212a25d006eaecbbdc7ed2fe3dd1129f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 15:14:10 +0200 Subject: [PATCH 212/739] Fix value of showoncombobox --- htdocs/adherents/class/adherent.class.php | 6 +-- htdocs/adherents/partnership.php | 44 +++++-------------- htdocs/bom/class/bom.class.php | 2 +- htdocs/core/lib/company.lib.php | 6 +-- .../class/conferenceorbooth.class.php | 4 +- htdocs/fichinter/class/fichinter.class.php | 2 +- htdocs/hrm/class/establishment.class.php | 2 +- .../template/class/myobject.class.php | 6 +-- htdocs/mrp/class/mo.class.php | 2 +- htdocs/product/class/product.class.php | 4 +- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/projet/class/project.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- .../workstation/class/workstation.class.php | 2 +- htdocs/zapier/class/hook.class.php | 9 ++-- 16 files changed, 35 insertions(+), 62 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a663cea85d2..18d8746cca7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -296,15 +296,15 @@ class Adherent extends CommonObject 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), 'ref_ext' => array('type' => 'varchar(128)', 'label' => 'Ref ext', 'enabled' => 1, 'visible' => 0, 'position' => 20), 'civility' => array('type' => 'varchar(6)', 'label' => 'Civility', 'enabled' => 1, 'visible' => -1, 'position' => 25), - 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => -1, 'position' => 30), - 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => -1, 'position' => 35), + 'lastname' => array('type' => 'varchar(50)', 'label' => 'Lastname', 'enabled' => 1, 'visible' => -1, 'position' => 30, 'showoncombobox'=>1), + 'firstname' => array('type' => 'varchar(50)', 'label' => 'Firstname', 'enabled' => 1, 'visible' => -1, 'position' => 35, 'showoncombobox'=>1), 'login' => array('type' => 'varchar(50)', 'label' => 'Login', 'enabled' => 1, 'visible' => -1, 'position' => 40), 'gender' => array('type' => 'varchar(10)', 'label' => 'Gender', 'enabled' => 1, 'visible' => -1, 'position' => 250), 'pass' => array('type' => 'varchar(50)', 'label' => 'Pass', 'enabled' => 1, 'visible' => -1, 'position' => 45), 'pass_crypted' => array('type' => 'varchar(128)', 'label' => 'Pass crypted', 'enabled' => 1, 'visible' => -1, 'position' => 50), 'fk_adherent_type' => array('type' => 'integer', 'label' => 'Fk adherent type', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 55), 'morphy' => array('type' => 'varchar(3)', 'label' => 'MorPhy', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 60), - 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => -1, 'position' => 65), + 'societe' => array('type' => 'varchar(128)', 'label' => 'Societe', 'enabled' => 1, 'visible' => -1, 'position' => 65, 'showoncombobox'=>2), 'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => -1, 'position' => 70), 'address' => array('type' => 'text', 'label' => 'Address', 'enabled' => 1, 'visible' => -1, 'position' => 75), 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index 3cd70de3228..5bdf758e84f 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -44,43 +44,14 @@ //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("companies","members","partnership", "other")); @@ -150,6 +121,12 @@ if (($action == 'update' || $action == 'edit') && $object->status != $object::ST if (empty($memberid) && $object) { $memberid = $object->fk_member; } + + +// Security check +$result = restrictedArea($user, 'adherent', $memberid, '', '', 'socid', 'rowid', 0); + + /* * Actions */ @@ -271,10 +248,9 @@ $object->fields['fk_member']['visible'] = 0; if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1; $object->fields['note_public']['visible'] = 1; + /* * View - * - * Put here all code to build page */ $form = new Form($db); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 9fe0543c4cf..220c724ad89 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -96,7 +96,7 @@ class BOM extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'), diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 99bcd2c3921..61332d8041b 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -963,9 +963,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') $contactstatic->fields = array( 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), - 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20), - 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30), - 'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>40), + 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'index'=>1, 'position'=>20), + 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30), + 'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40), 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))), ); diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index bb8649106b9..ae35f3eb892 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -110,8 +110,8 @@ class ConferenceOrBooth extends ActionComm 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1::eventorganization', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,), - 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',), - 'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',), + 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), + 'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'3',), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_user_author' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 1c1c1ab37be..e2ac86f55bd 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -57,7 +57,7 @@ class Fichinter extends CommonObject 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'datet' =>array('type'=>'date', 'label'=>'Datet', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'duree' =>array('type'=>'double', 'label'=>'Duree', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>1), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index c63ab29a14a..c2fa520442b 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -133,7 +133,7 @@ class Establishment extends CommonObject 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), - 'label' =>array('type'=>'varchar(128)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>22), + 'label' =>array('type'=>'varchar(128)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>2, 'position'=>22), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>30), 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>35), diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index e69c5bc333d..76c6bb691f5 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -101,9 +101,9 @@ class MyObject extends CommonObject */ public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>1), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>10), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index d48d4959fd1..115844c916d 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -103,7 +103,7 @@ class Mo extends CommonObject 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM", 'css'=>'minwidth100 maxwidth300', 'csslist'=>'nowraponall'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'picto'=>'product'), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>1, 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400'), diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f76a6fec0ad..6aee9af9c60 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -433,8 +433,8 @@ class Product extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>5), - 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), - 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>1), + 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'position'=>15), + 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>3), 'fk_barcode_type' => array('type'=>'integer', 'label'=>'BarcodeType', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>-1,), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index dc15e092155..35791bfd158 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -127,7 +127,7 @@ class Entrepot extends CommonObject 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35, 'searchall'=>1), - 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>1, 'searchall'=>1), + 'lieu' =>array('type'=>'varchar(64)', 'label'=>'LocationSummary', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'showoncombobox'=>2, 'searchall'=>1), 'fk_parent' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:1:statut=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ParentWarehouse', 'enabled'=>1, 'visible'=>-2, 'position'=>41), 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-2, 'position'=>45, 'searchall'=>1), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ca42e8a3fd1..851703ce96b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -224,7 +224,7 @@ class Project extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>15, 'searchall'=>1), - 'title' =>array('type'=>'varchar(255)', 'label'=>'ProjectLabel', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>17, 'showoncombobox'=>1, 'searchall'=>1), + 'title' =>array('type'=>'varchar(255)', 'label'=>'ProjectLabel', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>17, 'showoncombobox'=>2, 'searchall'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>19), 'fk_soc' =>array('type'=>'integer', 'label'=>'Thirdparty', 'enabled'=>1, 'visible'=>0, 'position'=>20), 'dateo' =>array('type'=>'date', 'label'=>'DateStart', 'enabled'=>1, 'visible'=>1, 'position'=>30), diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 86cd99e7180..2f180bcc8ec 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -102,7 +102,7 @@ class RecruitmentJobPosition extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'1', 'autofocusoncreate'=>1), + 'label' => array('type'=>'varchar(255)', 'label'=>'JobLabel', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth500', 'csslist'=>'tdoverflowmax300', 'showoncombobox'=>'2', 'autofocusoncreate'=>1), 'qty' => array('type'=>'integer', 'label'=>'NbOfEmployeesExpected', 'enabled'=>'1', 'position'=>45, 'notnull'=>1, 'visible'=>1, 'default'=>'1', 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500', 'picto'=>'project'), 'fk_user_recruiter' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'ResponsibleOfRecruitement', 'enabled'=>'1', 'position'=>54, 'notnull'=>1, 'visible'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7554ad2fbe2..97723f83f37 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -162,7 +162,7 @@ class Societe extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), 'nom' =>array('type'=>'varchar(128)', 'label'=>'Nom', 'enabled'=>1, 'visible'=>-1, 'position'=>35, 'showoncombobox'=>1), - 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>1), + 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>2), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>45), 'code_client' =>array('type'=>'varchar(24)', 'label'=>'CustomerCode', 'enabled'=>1, 'visible'=>-1, 'position'=>55), diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index d81bab42eab..5cb6baf3565 100755 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -101,7 +101,7 @@ class Workstation extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'1',), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'2',), 'type' => array('type'=>'varchar(8)', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 9197942b5c0..ba04f504da6 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -121,8 +121,7 @@ class Hook extends CommonObject 'position' => 30, 'searchall' => 1, 'css' => 'minwidth200', - 'help' => 'Hook url', - 'showoncombobox' => 1, + 'help' => 'Hook url' ), 'module' => array( 'type' => 'varchar(128)', @@ -132,8 +131,7 @@ class Hook extends CommonObject 'position' => 30, 'searchall' => 1, 'css' => 'minwidth200', - 'help' => 'Hook module', - 'showoncombobox' => 1, + 'help' => 'Hook module' ), 'action' => array( 'type' => 'varchar(128)', @@ -143,8 +141,7 @@ class Hook extends CommonObject 'position' => 30, 'searchall' => 1, 'css' => 'minwidth200', - 'help' => 'Hook action trigger', - 'showoncombobox' => 1, + 'help' => 'Hook action trigger' ), 'event' => array( 'type' => 'varchar(255)', From 7074f8d048a733e24c999049986573833aab64e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 5 Jun 2021 15:23:29 +0200 Subject: [PATCH 213/739] add creates --- dev/examples/zapier/creates/contact.js | 74 ++++++++++++++++++++++++++ dev/examples/zapier/creates/member.js | 74 ++++++++++++++++++++++++++ dev/examples/zapier/index.js | 4 ++ 3 files changed, 152 insertions(+) create mode 100644 dev/examples/zapier/creates/contact.js create mode 100644 dev/examples/zapier/creates/member.js diff --git a/dev/examples/zapier/creates/contact.js b/dev/examples/zapier/creates/contact.js new file mode 100644 index 00000000000..bcb849ad63d --- /dev/null +++ b/dev/examples/zapier/creates/contact.js @@ -0,0 +1,74 @@ +/*jshint esversion: 6 */ +// create a particular contact by name +const createContact = async (z, bundle) => { + const apiurl = bundle.authData.url + '/api/index.php/contacts'; + + const response = await z.request({ + method: 'POST', + url: apiurl, + body: { + name: bundle.inputData.name, + name_alias: bundle.inputData.name_alias, + ref_ext: bundle.inputData.ref_ext, + ref_int: bundle.inputData.ref_int, + address: bundle.inputData.address, + zip: bundle.inputData.zip, + town: bundle.inputData.town, + country_code: bundle.inputData.country_code, + country_id: bundle.inputData.country_id, + country: bundle.inputData.country, + phone: bundle.inputData.phone, + email: bundle.inputData.email, + sens: 'fromzapier' + } + }); + const result = z.JSON.parse(response.content); + // api returns an integer when ok, a json when ko + return result.response || {id: response}; +}; + +module.exports = { + key: 'contact', + noun: 'Contact', + + display: { + label: 'Create Contact', + description: 'Creates a contact.' + }, + + operation: { + inputFields: [ + {key: 'name', required: true}, + {key: 'name_alias', required: false}, + {key: 'address', required: false}, + {key: 'zip', required: false}, + {key: 'town', required: false}, + {key: 'email', required: false} + ], + perform: createContact, + + sample: { + id: 1, + name: 'DUPOND', + name_alias: 'DUPOND Ltd', + address: 'Rue des Canaries', + zip: '34090', + town: 'MONTPELLIER', + phone: '0123456789', + fax: '2345678901', + email: 'robot@domain.com' + }, + + outputFields: [ + {key: 'id', type: "integer", label: 'ID'}, + {key: 'name', label: 'Name'}, + {key: 'name_alias', label: 'Name alias'}, + {key: 'address', label: 'Address'}, + {key: 'zip', label: 'Zip'}, + {key: 'town', label: 'Town'}, + {key: 'phone', label: 'Phone'}, + {key: 'fax', label: 'Fax'}, + {key: 'email', label: 'Email'} + ] + } +}; diff --git a/dev/examples/zapier/creates/member.js b/dev/examples/zapier/creates/member.js new file mode 100644 index 00000000000..152f1129e79 --- /dev/null +++ b/dev/examples/zapier/creates/member.js @@ -0,0 +1,74 @@ +/*jshint esversion: 6 */ +// create a particular member by name +const createMember = async (z, bundle) => { + const apiurl = bundle.authData.url + '/api/index.php/members'; + + const response = await z.request({ + method: 'POST', + url: apiurl, + body: { + name: bundle.inputData.name, + name_alias: bundle.inputData.name_alias, + ref_ext: bundle.inputData.ref_ext, + ref_int: bundle.inputData.ref_int, + address: bundle.inputData.address, + zip: bundle.inputData.zip, + town: bundle.inputData.town, + country_code: bundle.inputData.country_code, + country_id: bundle.inputData.country_id, + country: bundle.inputData.country, + phone: bundle.inputData.phone, + email: bundle.inputData.email, + sens: 'fromzapier' + } + }); + const result = z.JSON.parse(response.content); + // api returns an integer when ok, a json when ko + return result.response || {id: response}; +}; + +module.exports = { + key: 'member', + noun: 'Member', + + display: { + label: 'Create Member', + description: 'Creates a member.' + }, + + operation: { + inputFields: [ + {key: 'name', required: true}, + {key: 'name_alias', required: false}, + {key: 'address', required: false}, + {key: 'zip', required: false}, + {key: 'town', required: false}, + {key: 'email', required: false} + ], + perform: createMember, + + sample: { + id: 1, + name: 'DUPOND', + name_alias: 'DUPOND Ltd', + address: 'Rue des Canaries', + zip: '34090', + town: 'MONTPELLIER', + phone: '0123456789', + fax: '2345678901', + email: 'robot@domain.com' + }, + + outputFields: [ + {key: 'id', type: "integer", label: 'ID'}, + {key: 'name', label: 'Name'}, + {key: 'name_alias', label: 'Name alias'}, + {key: 'address', label: 'Address'}, + {key: 'zip', label: 'Zip'}, + {key: 'town', label: 'Town'}, + {key: 'phone', label: 'Phone'}, + {key: 'fax', label: 'Fax'}, + {key: 'email', label: 'Email'} + ] + } +}; diff --git a/dev/examples/zapier/index.js b/dev/examples/zapier/index.js index d96df72e11f..94046969045 100644 --- a/dev/examples/zapier/index.js +++ b/dev/examples/zapier/index.js @@ -9,6 +9,8 @@ const triggerUser = require('./triggers/user'); const searchThirdparty = require('./searches/thirdparty'); const createThirdparty = require('./creates/thirdparty'); +const createContact = require('./creates/contact'); +const createMember = require('./creates/member'); const { config: authentication, @@ -76,6 +78,8 @@ const App = { // If you want your creates to show up, you better include it here! creates: { [createThirdparty.key]: createThirdparty, + [createContact.key]: createContact, + [createMember.key]: createMember, } }; From fb0d2cdddcc2be2f9bf1f4e47066224b8747452e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 15:27:49 +0200 Subject: [PATCH 214/739] Debug v14 --- htdocs/core/class/html.form.class.php | 5 ++++- htdocs/partnership/class/partnership.class.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0944918f815..1dd6712dba6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6840,9 +6840,12 @@ class Form $obj = $this->db->fetch_object($resql); $label = ''; $tmparray = explode(',', $fieldstoshow); + $oldvalueforshowoncombobox = 0; foreach ($tmparray as $key => $val) { $val = preg_replace('/t\./', '', $val); - $label .= (($label && $obj->$val) ? ' - ' : '').$obj->$val; + $label .= (($label && $obj->$val) ? ($oldvalueforshowoncombobox != $objecttmp->fields[$val]['showoncombobox'] ? ' - ' : ' ') : ''); + $label .= $obj->$val; + $oldvalueforshowoncombobox = $objecttmp->fields[$val]['showoncombobox']; } if (empty($outputmode)) { if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 77ae16d9d2d..f33a19f312e 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -198,9 +198,9 @@ class Partnership extends CommonObject ); if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { - $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1,); + $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member'); } else { - $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1,); + $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'societe'); } if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { From 273c4c288038d5b60a5c5e931c65640e8c37724a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 15:28:41 +0200 Subject: [PATCH 215/739] Fix typo --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6e4cc60ce53..933d8e14197 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1250,7 +1250,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // ($textwasmodified is replaced with $textwasmodifiedorcompleted and we add completion). // Set label - // If we want another language, and if label is same than default language (we did force it to a specific value), we can use translation. + // If we want another language, and if label is same than default language (we did not force it to a specific value), we can use translation. //var_dump($outputlangs->defaultlang.' - '.$langs->defaultlang.' - '.$label.' - '.$prodser->label);exit; $textwasmodified = ($label == $prodser->label); if (!empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && ($textwasmodified || $translatealsoifmodified)) { From 70af18148b9324d91c257c10b6a5177c5a4b2986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 17:48:30 +0200 Subject: [PATCH 216/739] Debug modulebuilder v14 --- htdocs/core/lib/functions.lib.php | 7 ++++--- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 ++ htdocs/modulebuilder/template/myobject_card.php | 3 +-- htdocs/partnership/partnership_card.php | 5 ++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 61a3869fe1a..b018b4d2fb0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9671,7 +9671,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st /** * Function dolGetButtonAction * - * @param string $label label of button no html : use in alt attribute for accessibility $html is not empty + * @param string $label label of button without HTML : use in alt attribute for accessibility $html is not empty * @param string $html optional : content with html * @param string $actionType default, delete, danger * @param string $url the url for link @@ -9689,8 +9689,9 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = } $attr = array( - 'class' => $class - ,'href' => empty($url) ? '' : $url + 'class' => $class, + 'href' => empty($url) ? '' : $url, + 'title' => $label ); if (empty($html)) { diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 3fb671fa9b2..cc4b791725d 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -450,6 +450,8 @@ CREATE TABLE llx_partnership( model_pdf varchar(255) ) ENGINE=innodb; +ALTER TABLE llx_partnership ADD COLUMN last_check_backlink datetime NULL; + ALTER TABLE llx_partnership ADD INDEX idx_partnership_rowid (rowid); ALTER TABLE llx_partnership ADD INDEX idx_partnership_ref (ref); ALTER TABLE llx_partnership ADD INDEX idx_partnership_fk_soc (fk_soc); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 1f9da9c80ae..739596b5653 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -505,8 +505,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); - //print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', 0); - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index b31ced3556f..f724ace839d 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -639,8 +639,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); - //print dolGetButtonAction($langs->trans('Accept'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', 0); - print ''.$langs->trans("Validate").''; + print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); } } @@ -657,7 +656,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Refuse if ($permissiontoadd) { if ($object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { - print ''.$langs->trans("Refuse").''."\n"; + print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd); } } From 92b6425ce0832639c7e3f19e31199405f5634d27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Jun 2021 18:20:07 +0200 Subject: [PATCH 217/739] Debug v14 --- htdocs/adherents/partnership.php | 6 ++- htdocs/langs/en_US/partnership.lang | 2 +- .../modulebuilder/template/myobject_card.php | 4 +- htdocs/partnership/partnership_card.php | 10 ++-- htdocs/societe/partnership.php | 48 +++++-------------- 5 files changed, 24 insertions(+), 46 deletions(-) diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index 5bdf758e84f..28b041240a3 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -510,20 +510,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?rowid='.$memberid.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?rowid='.$memberid.'&action=edit&token='.newToken(), '', $permissiontoadd); } // Show if ($permissiontoadd) { - print dolGetButtonAction($langs->trans('ShowPartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); } // Cancel + /* if ($permissiontoadd) { if ($object->status == $object::STATUS_ACCEPTED) { print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); } } + */ } print ''."\n"; } diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 7decec2a003..6d0c7dc0ac9 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -50,7 +50,7 @@ DatePartnershipEnd=End date ReasonDecline=Decline reason ReasonDeclineOrCancel=Decline reason PartnershipAlreadyExist=Partnership already exist -ShowPartnership=Show partnership +ManagePartnership=Manage partnership BacklinkNotFoundOnPartnerWebsite=Backlink not found on partner website ConfirmClosePartnershipAsk=Are you sure you want to cancel this partnership? diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 739596b5653..7111b59b582 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -489,7 +489,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle'); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft @@ -502,7 +502,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Validate if ($object->status == $object::STATUS_DRAFT) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index f724ace839d..72e0bc22bdd 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -623,20 +623,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send if (empty($user->socid)) { - print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle'); + print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); } // Back to draft if ($object->status != $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Accept if ($object->status == $object::STATUS_DRAFT) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes&token='.newToken(), '', $permissiontoadd); } else { $langs->load("errors"); print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); @@ -655,7 +655,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Refuse if ($permissiontoadd) { - if ($object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { + if ($object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) { print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd); } } diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index 0a5205799a9..6a45c657126 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -44,42 +44,13 @@ //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("companies","partnership", "other")); @@ -153,6 +124,11 @@ if (($action == 'update' || $action == 'edit') && $object->status != $object::ST if (empty($socid) && $object) { $socid = $object->fk_soc; } + +// Security check +$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); + + /* * Actions */ @@ -276,8 +252,6 @@ $object->fields['note_public']['visible'] = 1; /* * View - * - * Put here all code to build page */ $form = new Form($db); @@ -528,20 +502,22 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$socid.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$socid.'&action=edit&token='.newtoken(), '', $permissiontoadd); } // Show if ($permissiontoadd) { - print dolGetButtonAction($langs->trans('ShowPartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); } // Cancel + /* if ($permissiontoadd) { if ($object->status == $object::STATUS_ACCEPTED) { print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); } } + */ } print ''."\n"; } From 51bce78e6e5048c40e052c9d4e4c35d36792ec44 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 06:05:47 +0200 Subject: [PATCH 218/739] NEW Add field date start/end from/to in expense report list --- htdocs/expensereport/list.php | 119 +++++++++++++++++++++++++++------- 1 file changed, 95 insertions(+), 24 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ce1dc4e3c09..1f3468d06fc 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -107,12 +107,23 @@ $search_amount_vat = GETPOST('search_amount_vat', 'alpha'); $search_amount_ttc = GETPOST('search_amount_ttc', 'alpha'); $search_status = (GETPOST('search_status', 'intcomma') != '' ?GETPOST('search_status', 'intcomma') : GETPOST('statut', 'intcomma')); -$year_start = GETPOST('year_start', 'int'); -$month_start = GETPOST('month_start', 'int'); -$day_start = GETPOST('day_start', 'int'); -$year_end = GETPOST('year_end', 'int'); -$month_end = GETPOST('month_end', 'int'); -$day_end = GETPOST('day_end', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_startendday = GETPOST('search_date_startendday', 'int'); +$search_date_startendmonth = GETPOST('search_date_startendmonth', 'int'); +$search_date_startendyear = GETPOST('search_date_startendyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_startend = dol_mktime(23, 59, 59, $search_date_startendmonth, $search_date_startendday, $search_date_startendyear); + +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_endendday = GETPOST('search_date_endendday', 'int'); +$search_date_endendmonth = GETPOST('search_date_endendmonth', 'int'); +$search_date_endendyear = GETPOST('search_date_endendyear', 'int'); +$search_date_end = dol_mktime(0, 0, 0, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Use tzserver +$search_date_endend = dol_mktime(23, 59, 59, $search_date_endendmonth, $search_date_endendday, $search_date_endendyear); $optioncss = GETPOST('optioncss', 'alpha'); @@ -197,11 +208,22 @@ if (empty($reshook)) { $search_amount_vat = ""; $search_amount_ttc = ""; $search_status = ""; - $month_start = ""; - $year_start = ""; - $month_end = ""; - $year_end = ""; - $day_end = ""; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_startendday = ''; + $search_date_startendmonth = ''; + $search_date_startendyear = ''; + $search_date_start = ''; + $search_date_startend = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_endendday = ''; + $search_date_endendmonth = ''; + $search_date_endendyear = ''; + $search_date_end = ''; + $search_date_endend = ''; $toselect = ''; $search_array_options = array(); } @@ -277,9 +299,19 @@ if (!empty($search_ref)) { $sql .= natural_search('d.ref', $search_ref); } // Date Start -$sql .= dolSqlDateFilter("d.date_debut", $day_start, $month_start, $year_start); +if ($search_date_start) { + $sql .= " AND d.date_debut >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_startend) { + $sql .= " AND d.date_debut <= '".$db->idate($search_date_startend)."'"; +} // Date End -$sql .= dolSqlDateFilter("d.date_fin", $day_end, $month_end, $year_end); +if ($search_date_end) { + $sql .= " AND d.date_fin >= '".$db->idate($search_date_end)."'"; +} +if ($search_date_endend) { + $sql .= " AND d.date_fin <= '".$db->idate($search_date_endend)."'"; +} if ($search_amount_ht != '') { $sql .= natural_search('d.total_ht', $search_amount_ht, 1); @@ -342,6 +374,44 @@ if ($resql) { if ($search_ref) { $param .= "&search_ref=".urlencode($search_ref); } + // Start date + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); + } + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + } + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); + } + if ($search_date_startendday) { + $param .= '&search_date_startendday='.urlencode($search_date_startendday); + } + if ($search_date_startendmonth) { + $param .= '&search_date_startendmonth='.urlencode($search_date_startendmonth); + } + if ($search_date_startendyear) { + $param .= '&search_date_startendyear='.urlencode($search_date_startendyear); + } + // End date + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); + } + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + } + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_endendday) { + $param .= '&search_date_endendday='.urlencode($search_date_endendday); + } + if ($search_date_endendmonth) { + $param .= '&search_date_endendmonth='.urlencode($search_date_endendmonth); + } + if ($search_date_endendyear) { + $param .= '&search_date_endendyear='.urlencode($search_date_endendyear); + } if ($search_user) { $param .= "&search_user=".urlencode($search_user); } @@ -489,22 +559,23 @@ if ($resql) { // Date start if (!empty($arrayfields['d.date_debut']['checked'])) { print '
'; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - - print ''; - $formother->select_year($year_start, 'year_start', 1, $min_year, $max_year); + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_startend ? $search_date_startend : -1, 'search_date_startend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year_end, 'year_end', 1, $min_year, $max_year); + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_endend ? $search_date_endend : -1, 'search_date_endend', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print '
'; From 678f24f2b3f33079c0757ac674880e10e141832d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 09:57:59 +0200 Subject: [PATCH 220/739] try to fix search --- dev/examples/zapier/searches/thirdparty.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dev/examples/zapier/searches/thirdparty.js b/dev/examples/zapier/searches/thirdparty.js index 8f72b9270e5..009780ea7fb 100644 --- a/dev/examples/zapier/searches/thirdparty.js +++ b/dev/examples/zapier/searches/thirdparty.js @@ -22,7 +22,7 @@ module.exports = { } ], - perform: (z, bundle) => { + perform: async (z, bundle) => { const url = bundle.authData.url + '/api/index.php/thirdparties/'; // Put the search value in a query param. The details of how to build @@ -32,8 +32,18 @@ module.exports = { sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" } }; - - return z.request(url, options).then(response => JSON.parse(response.content)); + const response = await z.request({ + url: url, + skipThrowForStatus: true, + params: { + sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" + } + }); + //z.console.log(response); + if (response.status != 200) { + return []; + } + return response.json; }, // In cases where Zapier needs to show an example record to the user, but we are unable to get a live example From 3c51eac66ff9ffaab68fb1a91e15ae966831c514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 10:07:01 +0200 Subject: [PATCH 221/739] try to fix search --- dev/examples/zapier/searches/thirdparty.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/examples/zapier/searches/thirdparty.js b/dev/examples/zapier/searches/thirdparty.js index 009780ea7fb..93c32975992 100644 --- a/dev/examples/zapier/searches/thirdparty.js +++ b/dev/examples/zapier/searches/thirdparty.js @@ -34,6 +34,7 @@ module.exports = { }; const response = await z.request({ url: url, + // this parameter avoid throwing errors and let us manage them skipThrowForStatus: true, params: { sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" From efb5ec2901e577705022be02d16d8d35228d6f3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 10:32:04 +0200 Subject: [PATCH 222/739] search by name or email --- dev/examples/zapier/searches/thirdparty.js | 18 +++++++++++++++++- htdocs/core/lib/functions2.lib.php | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dev/examples/zapier/searches/thirdparty.js b/dev/examples/zapier/searches/thirdparty.js index 93c32975992..2a6d2c6e207 100644 --- a/dev/examples/zapier/searches/thirdparty.js +++ b/dev/examples/zapier/searches/thirdparty.js @@ -19,6 +19,12 @@ module.exports = { type: 'string', label: 'Name', helpText: 'Name to limit to the search to (i.e. The company or %company%).' + }, + { + key: 'email', + type: 'string', + label: 'Email', + helpText: 'Email to limit to the search to.' } ], @@ -32,12 +38,22 @@ module.exports = { sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" } }; + let filter = ''; + if (bundle.inputData.name) { + filter = "t.nom like \'%"+bundle.inputData.name+"%\'"; + } + if (bundle.inputData.email) { + if (bundle.inputData.name) { + filter += " and "; + } + filter += "t.email like \'"+bundle.inputData.email+"\'"; + } const response = await z.request({ url: url, // this parameter avoid throwing errors and let us manage them skipThrowForStatus: true, params: { - sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" + sqlfilters: filter } }); //z.console.log(response); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e279ced2a3d..d963763d788 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1043,7 +1043,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $regType = array(); if (preg_match('/\{(t+)\}/i', $mask, $regType)) { $masktype = $regType[1]; - $masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdpaty typent_code (where n is length in mask) + $masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdparty typent_code (where n is length in mask) $masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } else { $masktype = ''; From 6348b777e132cbddea422d15d7ec72c694916c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 12:12:12 +0200 Subject: [PATCH 223/739] add contact search --- dev/examples/zapier/index.js | 2 + dev/examples/zapier/searches/contact.js | 95 ++++++++++++++++++++++ dev/examples/zapier/searches/thirdparty.js | 5 -- 3 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 dev/examples/zapier/searches/contact.js diff --git a/dev/examples/zapier/index.js b/dev/examples/zapier/index.js index 94046969045..044415a7ddd 100644 --- a/dev/examples/zapier/index.js +++ b/dev/examples/zapier/index.js @@ -7,6 +7,7 @@ const triggerTicket = require('./triggers/ticket'); const triggerUser = require('./triggers/user'); const searchThirdparty = require('./searches/thirdparty'); +const searchContact = require('./searches/contact'); const createThirdparty = require('./creates/thirdparty'); const createContact = require('./creates/contact'); @@ -73,6 +74,7 @@ const App = { // If you want your searches to show up, you better include it here! searches: { [searchThirdparty.key]: searchThirdparty, + [searchContact.key]: searchContact, }, // If you want your creates to show up, you better include it here! diff --git a/dev/examples/zapier/searches/contact.js b/dev/examples/zapier/searches/contact.js new file mode 100644 index 00000000000..b52b8d3e367 --- /dev/null +++ b/dev/examples/zapier/searches/contact.js @@ -0,0 +1,95 @@ +module.exports = { + key: 'contact', + + // You'll want to provide some helpful display labels and descriptions + // for users. Zapier will put them into the UX. + noun: 'Contact', + display: { + label: 'Find a Contact', + description: 'Search for contact.' + }, + + // `operation` is where we make the call to your API to do the search + operation: { + // This search only has one search field. Your searches might have just one, or many + // search fields. + inputFields: [ + { + key: 'lastname', + type: 'string', + label: 'Lastname', + helpText: 'Lastname to limit to the search to (i.e. The company or %company%).' + }, + { + key: 'email', + type: 'string', + label: 'Email', + helpText: 'Email to limit to the search to.' + } + ], + + perform: async (z, bundle) => { + const url = bundle.authData.url + '/api/index.php/contacts/'; + + // Put the search value in a query param. The details of how to build + // a search URL will depend on how your API works. + let filter = ''; + if (bundle.inputData.lastname) { + filter = "t.lastname like \'%"+bundle.inputData.name+"%\'"; + } + if (bundle.inputData.email) { + if (bundle.inputData.lastname) { + filter += " and "; + } + filter += "t.email like \'"+bundle.inputData.email+"\'"; + } + const response = await z.request({ + url: url, + // this parameter avoid throwing errors and let us manage them + skipThrowForStatus: true, + params: { + sqlfilters: filter + } + }); + //z.console.log(response); + if (response.status != 200) { + return []; + } + return response.json; + }, + + // In cases where Zapier needs to show an example record to the user, but we are unable to get a live example + // from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of + // returned records, and have obviously dummy values that we can show to any user. + sample: { + id: 1, + createdAt: 1472069465, + name: 'DOE', + firstname: 'John', + authorId: 1, + directions: '1. Boil Noodles\n2.Serve with sauce', + style: 'italian' + }, + + // If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom + // field definitions. The result will be used to augment the sample. + // outputFields: () => { return []; } + // Alternatively, a static field definition should be provided, to specify labels for the fields + outputFields: [ + { + key: 'id', + type: "integer", + label: 'ID' + }, + {key: 'createdAt', type: "integer", label: 'Created At'}, + {key: 'name', label: 'Name'}, + {key: 'firstname', label: 'Firstname'}, + {key: 'directions', label: 'Directions'}, + {key: 'authorId', type: "integer", label: 'Author ID'}, + { + key: 'style', + label: 'Style' + } + ] + } +}; diff --git a/dev/examples/zapier/searches/thirdparty.js b/dev/examples/zapier/searches/thirdparty.js index 2a6d2c6e207..e1e6878f5b3 100644 --- a/dev/examples/zapier/searches/thirdparty.js +++ b/dev/examples/zapier/searches/thirdparty.js @@ -33,11 +33,6 @@ module.exports = { // Put the search value in a query param. The details of how to build // a search URL will depend on how your API works. - const options = { - params: { - sqlfilters: "t.nom like \'%"+bundle.inputData.name+"%\'" - } - }; let filter = ''; if (bundle.inputData.name) { filter = "t.nom like \'%"+bundle.inputData.name+"%\'"; From 1aca7efce3d739b079ed8fa0249830fe841b76d3 Mon Sep 17 00:00:00 2001 From: ATM john Date: Sun, 6 Jun 2021 13:15:03 +0200 Subject: [PATCH 224/739] Fix childtablesoncascade doc --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f2c61bc86a3..1d0509d7483 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -440,7 +440,7 @@ abstract class CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will + * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will * call method deleteByParentField(parentId,ParentFkFieldName) to fetch and delete child object */ protected $childtablesoncascade = array(); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index f10cead50fd..9687485eb10 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -84,7 +84,7 @@ class Societe extends CommonObject /** * @var array List of child tables. To know object to delete on cascade. - * if name like with @ClassNAme:FilePathClass;ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object + * if name like with @ClassNAme:FilePathClass:ParentFkFieldName' it will call method deleteByParentField (with parentId as parameters) and FieldName to fetch and delete child object */ protected $childtablesoncascade = array( "societe_prices", From a1bb7129dab6ebb2f457ed32efa0025354bebb36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Jun 2021 15:29:49 +0200 Subject: [PATCH 225/739] Debug v14 --- htdocs/adherents/partnership.php | 10 ++++--- htdocs/core/lib/member.lib.php | 30 ++++++++++++++++++-- htdocs/core/modules/modPartnership.class.php | 4 +-- htdocs/cron/list.php | 3 +- htdocs/langs/en_US/partnership.lang | 3 ++ htdocs/partnership/admin/setup.php | 5 ++-- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index 28b041240a3..3dab1f86064 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -449,6 +449,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $formconfirm; + // TODO Replace this card into a list of all partnerships. + + // Object card // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; @@ -498,6 +501,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); + + + // Buttons for actions if ($action != 'presend') { @@ -509,10 +515,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if (empty($reshook)) { - if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?rowid='.$memberid.'&action=edit&token='.newToken(), '', $permissiontoadd); - } - // Show if ($permissiontoadd) { print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 484f34c265c..fc274e0d624 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -63,6 +63,33 @@ function member_prepare_head(Adherent $object) $h++; } + $tabtoadd = (!empty(getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR')) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') ? 'member' : 'thirdparty'; + + if ($tabtoadd == 'member') { + if (!empty($user->rights->partnership->read)) { + $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0; + $head[$h][0] = DOL_URL_ROOT.'/adherents/partnership.php?rowid='.$object->id; + $head[$h][1] = $langs->trans("Partnership"); + $head[$h][2] = 'partnership'; + if ($nbPartnership > 0) { + $head[$h][1] .= ''.$nbPartnership.''; + } + $h++; + } + } else { + if (!empty($user->rights->partnership->read)) { + $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0; + $head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Partnership"); + $head[$h][2] = 'partnership'; + if ($nbPartnership > 0) { + $head[$h][1] .= ''.$nbPartnership.''; + } + $h++; + } + } + + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab @@ -70,9 +97,6 @@ function member_prepare_head(Adherent $object) complete_head_from_modules($conf, $langs, $object, $head, $h, 'member'); $nbNote = 0; - if (!empty($object->note)) { - $nbNote++; - } if (!empty($object->note_private)) { $nbNote++; } diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index d12cd610238..889f18cde73 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -180,10 +180,8 @@ class modPartnership extends DolibarrModules $tabtoadd = (!empty(getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR')) && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') ? 'member' : 'thirdparty'; if ($tabtoadd == 'member') { - $this->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/adherents/partnership.php?rowid=__ID__'); $fk_mainmenu = "members"; } else { - $this->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/societe/partnership.php?socid=__ID__'); $fk_mainmenu = "companies"; } @@ -258,7 +256,7 @@ class modPartnership extends DolibarrModules $this->cronjobs = array( 0 => array('priority'=>60, 'label'=>'CancelPartnershipForExpiredMembers', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doCancelStatusOfMemberPartnership', 'parameters'=>'', 'comment'=>'Cancel status of partnership when subscription is expired + x days.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>1, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart), - 1 => array('priority'=>61, 'label'=>'CheckDolibarrBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Warning of partnership if Dolibarr backlink not found on partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart), + 1 => array('priority'=>61, 'label'=>'PartnershipCheckBacklink', 'jobtype'=>'method', 'class'=>'/partnership/class/partnershiputils.class.php', 'objectname'=>'PartnershipUtils', 'method'=>'doWarningOfPartnershipIfDolibarrBacklinkNotfound', 'parameters'=>'', 'comment'=>'Warning of partnership if Dolibarr backlink not found on partner website.', 'frequency'=>1, 'unitfrequency'=>86400, 'status'=>0, 'test'=>'$conf->partnership->enabled', 'datestart'=>$datestart), ); // Permissions provided by this module diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 80371b14889..4d829258b2b 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2019 Laurent Destailleur + * Copyright (C) 2013-2021 Laurent Destailleur * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -24,7 +24,6 @@ * \brief Lists Jobs */ - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/cron/class/cronjob.class.php'; diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 6d0c7dc0ac9..04fe88b3442 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -20,6 +20,9 @@ ModulePartnershipName=Partnership management PartnershipDescription=Module Partnership management PartnershipDescriptionLong= Module Partnership management +CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions +PartnershipCheckBacklink=Partnership: Check referring backlink + # # Menu # diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 79c8c469eec..7fa0ef62b5e 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -193,11 +193,10 @@ print ''; print ''; print ''; -print ''; +print ''; print ''; print '
'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").''; -$dbacklinks = 'dolibarr.org|dolibarr.fr|dolibarr.es'; -$backlinks = (!empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK)) ? $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK : $dbacklinks; +$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK); print ''; print ''.$dbacklinks.'dolibarr.org|dolibarr.fr|dolibarr.es
'; From 9f177a0c63c07269497f3894e68db37441f3787f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Jun 2021 16:36:41 +0200 Subject: [PATCH 226/739] Debug v14 --- htdocs/adherents/partnership.php | 388 ++++-------------- htdocs/admin/dict.php | 4 +- htdocs/core/modules/modPartnership.class.php | 21 +- .../install/mysql/migration/13.0.0-14.0.0.sql | 14 +- .../mysql/tables/llx_c_partnership_type.sql | 35 ++ htdocs/langs/en_US/partnership.lang | 2 + .../partnership/class/partnership.class.php | 27 +- htdocs/partnership/partnership_card.php | 51 +-- htdocs/societe/partnership.php | 346 +++------------- 9 files changed, 200 insertions(+), 688 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_c_partnership_type.sql diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index 3dab1f86064..cf0e11d70e0 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -57,8 +57,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; $langs->loadLangs(array("companies","members","partnership", "other")); // Get parameters -$id = GETPOST('id', 'int'); -$memberid = GETPOST('rowid', 'int'); +$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); @@ -68,9 +67,9 @@ $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); //$lineid = GETPOST('lineid', 'int'); -$member = new Adherent($db); -if ($memberid > 0) { - $member->fetch($memberid); +$object = new Adherent($db); +if ($id > 0) { + $object->fetch($id); } // Initialize technical objects @@ -112,19 +111,13 @@ if (empty($conf->partnership->enabled)) accessforbidden(); if (empty($permissiontoread)) accessforbidden(); if ($action == 'edit' && empty($permissiontoadd)) accessforbidden(); -$partnershipid = $object->fetch(0, "", $memberid); -if (empty($action) && empty($partnershipid)) { - $action = 'create'; -} -if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) accessforbidden(); - -if (empty($memberid) && $object) { - $memberid = $object->fk_member; +if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) { + accessforbidden(); } // Security check -$result = restrictedArea($user, 'adherent', $memberid, '', '', 'socid', 'rowid', 0); +$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0); /* @@ -143,102 +136,7 @@ $date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GET if (empty($reshook)) { $error = 0; - $backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($memberid > 0 ? $memberid : '__ID__'); - - $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record - - if ($action == 'add' && $permissiontoread) { - $error = 0; - - $db->begin(); - - $now = dol_now(); - - if (!$error) { - $old_start_date = $object->date_partnership_start; - - $object->fk_member = $memberid; - $object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start; - $object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end; - $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_creation = $now; - $object->fk_user_creat = $user->id; - $object->entity = $conf->entity; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - } - } - - if (!$error) { - $result = $object->create($user); - if ($result < 0) { - $error++; - if ($result == -4) { - setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } - - if ($error) { - $db->rollback(); - $action = 'create'; - } else { - $db->commit(); - } - } elseif ($action == 'update' && $permissiontoread) { - $error = 0; - - $db->begin(); - - $now = dol_now(); - - if (!$error) { - $object->oldcopy = clone $object; - - $old_start_date = $object->date_partnership_start; - - $object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start; - $object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end; - $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->fk_user_creat = $user->id; - $object->fk_user_modif = $user->id; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - } - } - - if (!$error) { - $result = $object->update($user); - if ($result < 0) { - $error++; - if ($result == -4) { - setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } - - if ($error) { - $db->rollback(); - $action = 'edit'; - } else { - $db->commit(); - } - } elseif ($action == 'confirm_close' || $action == 'update_extras') { - include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - - header("Location: ".$_SERVER['PHP_SELF']."?rowid=".$memberid); - exit; - } + $backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($id > 0 ? $id : '__ID__'); // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; @@ -261,11 +159,11 @@ llxHeader('', $title); $form = new Form($db); -if ($memberid) { +if ($id > 0) { $langs->load("members"); - $member = new Adherent($db); - $result = $member->fetch($memberid); + $object = new Adherent($db); + $result = $object->fetch($id); if (!empty($conf->notification->enabled)) { $langs->load("mails"); @@ -273,13 +171,13 @@ if ($memberid) { $adht->fetch($object->typeid); - $head = member_prepare_head($member); + $head = member_prepare_head($object); print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($member, 'rowid', $linkback); + dol_banner_tab($object, 'rowid', $linkback); print '
'; @@ -288,21 +186,21 @@ if ($memberid) { // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$member->login.' '; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' '; } // Type print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("MemberNature").''.$member->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; print ''; // Company - print ''.$langs->trans("Company").''.$member->company.''; + print ''.$langs->trans("Company").''.$object->company.''; // Civility - print ''.$langs->trans("UserTitle").''.$member->getCivilityLabel().' '; + print ''.$langs->trans("UserTitle").''.$object->getCivilityLabel().' '; print ''; print ''; @@ -310,200 +208,13 @@ if ($memberid) { print '
'; print dol_get_fiche_end(); - - $params = ''; - - print '
'; } else { dol_print_error('', 'Parameter rowid not defined'); } -// Part to create -if ($action == 'create') { - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', ''); - - $backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid; - - print '
'; - print ''; - print ''; - print ''; - print ''; - - if ($backtopage) { - print ''; - } - if ($backtopageforcancel) { - print ''; - } - - print dol_get_fiche_head(array(), ''); - - print ''."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - - print '
'."\n"; - - print dol_get_fiche_end(); - - print '
'; - print ''; - print '  '; - // print ''; // Cancel for create does not post form if we don't know the backtopage - print '
'; - - print '
'; -} - -// Part to edit record -if (($partnershipid || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("Partnership"), '', ''); - - $backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid; - - print '
'; - print ''; - print ''; - print ''; - print ''; - if ($backtopage) { - print ''; - } - if ($backtopageforcancel) { - print ''; - } - - print dol_get_fiche_head(); - - print ''."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print '
'; - print '   '; - print '
'; - - print '
'; -} // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), '', ''); - - $res = $object->fetch_optionals(); - - // $head = partnershipPrepareHead($object); - // print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto); - - $linkback = ''; - dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref'); - - $formconfirm = ''; - - // Close confirmation - if ($action == 'close') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1); - } - // Reopon confirmation - if ($action == 'reopen') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1); - } - - // Refuse confirmatio - if ($action == 'refuse') { - //Form to close proposal (signed or not) - $formquestion = array( - array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace) - ); - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250); - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; - - - // TODO Replace this card into a list of all partnerships. - - - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; - - print '
'; - print '
'; - print '
'; - print ''."\n"; - - // Common attributes - //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field - //unset($object->fields['fk_project']); // Hide field already shown in banner - //unset($object->fields['fk_member']); // Hide field already shown in banner - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - - // End of subscription date - $fadherent = new Adherent($db); - $fadherent->fetch($object->fk_member); - print ''; - - // Other attributes. Fields from hook formObjectOptions and Extrafields. - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'.$langs->trans("SubscriptionEndDate").''; - if ($fadherent->datefin) { - print dol_print_date($fadherent->datefin, 'day'); - if ($fadherent->hasDelay()) { - print " ".img_warning($langs->trans("Late")); - } - } else { - if (!$adht->subscription) { - print $langs->trans("SubscriptionNotRecorded"); - if ($fadherent->statut > 0) { - print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled - } - } else { - print $langs->trans("SubscriptionNotReceived"); - if ($fadherent->statut > 0) { - print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled - } - } - } - print '
'; - print '
'; - - print '
'; - - print dol_get_fiche_end(); - - - - // Buttons for actions if ($action != 'presend') { @@ -517,20 +228,65 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Show if ($permissiontoadd) { - print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); + print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_member='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/adherents/partnership.php?id='.$object->id), '', $permissiontoadd); } - - // Cancel - /* - if ($permissiontoadd) { - if ($object->status == $object::STATUS_ACCEPTED) { - print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); - } - } - */ } print '
'."\n"; } + + + //$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php'; + $morehtmlright = ''; + + print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, ''); + + $memberid = $object->id; + + + // TODO Replace this card with the list of all partnerships. + + $object = new Partnership($db); + $partnershipid = $object->fetch(0, "", $memberid); + + if ($partnershipid > 0) { + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_member']); // Hide field already shown in banner + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + // End of subscription date + $fadherent = new Adherent($db); + $fadherent->fetch($object->fk_member); + print ''; + + print '
'.$langs->trans("SubscriptionEndDate").''; + if ($fadherent->datefin) { + print dol_print_date($fadherent->datefin, 'day'); + if ($fadherent->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } else { + if (!$adht->subscription) { + print $langs->trans("SubscriptionNotRecorded"); + if ($fadherent->statut > 0) { + print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled + } + } else { + print $langs->trans("SubscriptionNotReceived"); + if ($fadherent->statut > 0) { + print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled + } + } + } + print '
'; + print '
'; + } } // End of page diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index d03574d473b..650c0016f9a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0, 43, 0); +$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0,43, 0, 25, 0); // Name of SQL tables of dictionaries $tabname = array(); @@ -608,7 +608,7 @@ $tabcomplete = array( 'c_prospectcontactlevel'=>array('picto'=>'company'), 'c_stcommcontact'=>array('picto'=>'company'), 'c_product_nature'=>array('picto'=>'product'), - 'c_productbatch_qcstatus'=>array('picto'=>'batch'), + 'c_productbatch_qcstatus'=>array('picto'=>'lot'), ); diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 889f18cde73..d7041eca754 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -212,30 +212,27 @@ class modPartnership extends DolibarrModules // 'user' to add a tab in user view // Dictionaries - $this->dictionaries = array(); - /* Example: $this->dictionaries=array( 'langs'=>'partnership@partnership', // List of tables we want to see into dictonnary editor - 'tabname'=>array(MAIN_DB_PREFIX."table1", MAIN_DB_PREFIX."table2", MAIN_DB_PREFIX."table3"), + 'tabname'=>array(MAIN_DB_PREFIX."c_partnership_type"), // Label of tables - 'tablib'=>array("Table1", "Table2", "Table3"), + 'tablib'=>array("PartnershipType"), // Request to select fields - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'c_partnership_type as f WHERE f.entity = '.$conf->entity), // Sort order - 'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"), + 'tabsqlsort'=>array("label ASC"), // List of fields (result of select to show dictionary) - 'tabfield'=>array("code,label", "code,label", "code,label"), + 'tabfield'=>array("code,label"), // List of fields (list of fields to edit a record) - 'tabfieldvalue'=>array("code,label", "code,label", "code,label"), + 'tabfieldvalue'=>array("code,label"), // List of fields (list of fields for insert) - 'tabfieldinsert'=>array("code,label", "code,label", "code,label"), + 'tabfieldinsert'=>array("code,label"), // Name of columns with primary key (try to always name it 'rowid') - 'tabrowid'=>array("rowid", "rowid", "rowid"), + 'tabrowid'=>array("rowid"), // Condition to show each dictionary - 'tabcond'=>array($conf->partnership->enabled, $conf->partnership->enabled, $conf->partnership->enabled) + 'tabcond'=>array($conf->partnership->enabled) ); - */ // Boxes/Widgets // Add here list of php file(s) stored in partnership/core/boxes that contains a class to show a widget. diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index cc4b791725d..741d92a88a1 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -173,7 +173,9 @@ CREATE TABLE llx_workstation_workstation_usergroup( fk_workstation integer ) ENGINE=innodb; -CREATE TABLE llx_c_producbatch_qcstatus( +DROP TABLE llx_c_producbatch_qcstatus; -- delete table with bad name + +CREATE TABLE llx_c_productbatch_qcstatus( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, entity integer NOT NULL DEFAULT 1, code varchar(16) NOT NULL, @@ -532,3 +534,13 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUE INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('CONTACT_MODIFY','Contact address update','Executed when a contact is updated','contact',51); +create table llx_c_partnership_type +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, + code varchar(32) NOT NULL, + label varchar(64) NOT NULL, + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + + diff --git a/htdocs/install/mysql/tables/llx_c_partnership_type.sql b/htdocs/install/mysql/tables/llx_c_partnership_type.sql new file mode 100644 index 00000000000..23d5a89e16c --- /dev/null +++ b/htdocs/install/mysql/tables/llx_c_partnership_type.sql @@ -0,0 +1,35 @@ +-- ======================================================================== +-- Copyright (C) 2021 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Defini les types de contact d'un element sert de reference pour +-- la table llx_element_contact +-- +-- element est le nom de la table utilisant le type de contact. +-- i.e. contact, facture, projet, societe (sans le llx_ devant). +-- Libelle est un texte decrivant le type de contact. +-- active precise si cette valeur est 'active' ou 'archive'. +-- +-- ======================================================================== + +create table llx_c_partnership_type +( + rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 1 NOT NULL, + code varchar(32) NOT NULL, + label varchar(64) NOT NULL, + active tinyint DEFAULT 1 NOT NULL +)ENGINE=innodb; + diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 04fe88b3442..3a653e29967 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -20,6 +20,7 @@ ModulePartnershipName=Partnership management PartnershipDescription=Module Partnership management PartnershipDescriptionLong= Module Partnership management +AddPartnership=Add partnership CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions PartnershipCheckBacklink=Partnership: Check referring backlink @@ -56,6 +57,7 @@ PartnershipAlreadyExist=Partnership already exist ManagePartnership=Manage partnership BacklinkNotFoundOnPartnerWebsite=Backlink not found on partner website ConfirmClosePartnershipAsk=Are you sure you want to cancel this partnership? +PartnershipType=Partnership type # # Template Mail diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index f33a19f312e..d04d0c335eb 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -105,7 +105,7 @@ class Partnership extends CommonObject /** * @var int rowid * @deprecated - * @see id + * @see $id */ public $rowid; @@ -180,6 +180,7 @@ class Partnership extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1), + //'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnershiptype.class.php', 'label' => 'Type', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'position' => 20), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -353,15 +354,16 @@ class Partnership extends CommonObject * * @param int $id Id of object to load * @param string $ref Ref of object - * @param int $fk_soc_or_member fk_soc or fk_member + * @param int $fk_soc fk_soc + * @param int $fk_member fk_member * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id, $ref = null, $fk_soc_or_member = null) + public function fetch($id, $ref = null, $fk_member = null, $fk_soc = null) { global $conf; // Check parameters - if (empty($id) && empty($ref) && empty($fk_soc_or_member)) { + if (empty($id) && empty($ref) && empty($fk_member) && empty($fk_soc)) { return -1; } @@ -375,7 +377,7 @@ class Partnership extends CommonObject $sql .= ' FROM '.MAIN_DB_PREFIX.'partnership as p'; if ($id) { - $sql .= " WHERE p.rowid=".$id; + $sql .= " WHERE p.rowid=".((int) $id); } else { $sql .= " WHERE p.entity IN (0,".getEntity('partnership').")"; // Dont't use entity if you use rowid } @@ -384,14 +386,13 @@ class Partnership extends CommonObject $sql .= " AND p.ref='".$this->db->escape($ref)."'"; } - if ($fk_soc_or_member) { - $sql .= ' AND'; - if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') - $sql .= ' p.fk_member = '; - else $sql .= ' p.fk_soc = '; - $sql .= $fk_soc_or_member; - $sql .= ' ORDER BY p.date_partnership_end DESC'; + if ($fk_member > 0) { + $sql .= ' AND p.fk_member = '.((int) $fk_member); } + if ($fk_soc > 0) { + $sql .= ' AND p.fk_soc = '.((int) $fk_soc); + } + $sql .= ' ORDER BY p.date_partnership_end DESC'; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); @@ -420,8 +421,6 @@ class Partnership extends CommonObject $this->import_key = $obj->import_key; $this->model_pdf = $obj->model_pdf; - $this->lines = array(); - // Retrieve all extrafield // fetch optionals attributes and labels $this->fetch_optionals(); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 72e0bc22bdd..21c5cbdf68b 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -44,41 +44,12 @@ //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "other")); @@ -164,21 +135,11 @@ if (empty($reshook)) { $fk_partner = ($managedfor == 'member') ? GETPOST('fk_member', 'int') : GETPOST('fk_soc', 'int'); $obj_partner = ($managedfor == 'member') ? $object->fk_member : $object->fk_soc; - if ($action == 'add' || ($action == 'update' && $obj_partner != $fk_partner)) { - $fpartnership = new Partnership($db); - - $partnershipid = $fpartnership->fetch(0, "", $fk_partner); - if ($partnershipid > 0) { - setEventMessages($langs->trans('PartnershipAlreadyExist').' : '.$fpartnership->getNomUrl(0, '', 1), '', 'errors'); - $action = ($action == 'add') ? 'create' : 'edit'; - } - } - - $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record - // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record + // Action accept object if ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) { $result = $object->accept($user); @@ -275,8 +236,6 @@ if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fiel /* * View - * - * Put here all code to build page */ $form = new Form($db); diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index 6a45c657126..d109421fe8d 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -48,6 +48,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; @@ -70,11 +71,12 @@ $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $socid = GETPOST('socid', 'int'); if (!empty($user->socid)) { $socid = $user->socid; + $id = $socid; } -$societe = new Societe($db); -if ($socid > 0) { - $societe->fetch($socid); +$object = new Societe($db); +if ($id > 0) { + $object->fetch($id); } // Initialize technical objects @@ -115,18 +117,13 @@ if (empty($conf->partnership->enabled)) accessforbidden(); if (empty($permissiontoread)) accessforbidden(); if ($action == 'edit' && empty($permissiontoadd)) accessforbidden(); -$partnershipid = $object->fetch(0, "", $socid); -if (empty($action) && empty($partnershipid)) { - $action = 'create'; +if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) { + accessforbidden(); } -if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) accessforbidden(); -if (empty($socid) && $object) { - $socid = $object->fk_soc; -} // Security check -$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); +$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); /* @@ -145,102 +142,7 @@ $date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GET if (empty($reshook)) { $error = 0; - $backtopage = dol_buildpath('/partnership/partnership.php', 1).'?socid='.($socid > 0 ? $socid : '__ID__'); - - $triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record - - if ($action == 'add' && $permissiontoread) { - $error = 0; - - $db->begin(); - - $now = dol_now(); - - if (!$error) { - $old_start_date = $object->date_partnership_start; - - $object->fk_soc = $socid; - $object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start; - $object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end; - $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_creation = $now; - $object->fk_user_creat = $user->id; - $object->entity = $conf->entity; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - } - } - - if (!$error) { - $result = $object->create($user); - if ($result < 0) { - $error++; - if ($result == -4) { - setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } - - if ($error) { - $db->rollback(); - $action = 'create'; - } else { - $db->commit(); - } - } elseif ($action == 'update' && $permissiontoread) { - $error = 0; - - $db->begin(); - - $now = dol_now(); - - if (!$error) { - $object->oldcopy = clone $object; - - $old_start_date = $object->date_partnership_start; - - $object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start; - $object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end; - $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->fk_user_creat = $user->id; - $object->fk_user_modif = $user->id; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost(null, $object); - if ($ret < 0) { - $error++; - } - } - - if (!$error) { - $result = $object->update($user); - if ($result < 0) { - $error++; - if ($result == -4) { - setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - } - - if ($error) { - $db->rollback(); - $action = 'edit'; - } else { - $db->commit(); - } - } elseif ($action == 'confirm_close' || $action == 'update_extras') { - include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - - header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid); - exit; - } + $backtopage = dol_buildpath('/partnership/partnership.php', 1).'?id='.($id > 0 ? $id : '__ID__'); // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; @@ -250,6 +152,7 @@ $object->fields['fk_soc']['visible'] = 0; if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1; $object->fields['note_public']['visible'] = 1; + /* * View */ @@ -262,25 +165,22 @@ llxHeader('', $title); $form = new Form($db); -if ($socid) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - +if ($id > 0) { $langs->load("companies"); - $societe = new Societe($db); - $result = $societe->fetch($socid); + $object = new Societe($db); + $result = $object->fetch($id); if (!empty($conf->notification->enabled)) { $langs->load("mails"); } - $head = societe_prepare_head($societe); + $head = societe_prepare_head($object); print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($societe, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -310,7 +210,8 @@ if ($socid) { if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } - print ''; + print ''; + print ''; } print ''; @@ -318,178 +219,12 @@ if ($socid) { print '
'; print dol_get_fiche_end(); - - $params = ''; - - print '
'; } else { - dol_print_error('', 'Parameter socid not defined'); -} - -// Part to create -if ($action == 'create') { - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', ''); - - $backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?socid='.$socid; - - print '
'; - print ''; - print ''; - print ''; - print ''; - - if ($backtopage) { - print ''; - } - if ($backtopageforcancel) { - print ''; - } - - print dol_get_fiche_head(array(), ''); - - print ''."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - - print '
'."\n"; - - print dol_get_fiche_end(); - - print '
'; - print ''; - print '  '; - // print ''; // Cancel for create does not post form if we don't know the backtopage - print '
'; - - print '
'; -} - -// Part to edit record -if (($partnershipid || $ref) && $action == 'edit') { - print load_fiche_titre($langs->trans("Partnership"), '', ''); - - $backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?socid='.$socid; - - print '
'; - print ''; - print ''; - print ''; - print ''; - if ($backtopage) { - print ''; - } - if ($backtopageforcancel) { - print ''; - } - - print dol_get_fiche_head(); - - print ''."\n"; - - // Common attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; - - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; - - print '
'; - - print dol_get_fiche_end(); - - print '
'; - print '   '; - print '
'; - - print '
'; + dol_print_error('', 'Parameter id not defined'); } // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - print load_fiche_titre($langs->trans("PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv("Partnership")), '', ''); - - $res = $object->fetch_optionals(); - - // $head = partnershipPrepareHead($object); - // print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto); - - $linkback = ''; - dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref'); - - $formconfirm = ''; - - // Close confirmation - if ($action == 'close') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1); - } - // Reopon confirmation - if ($action == 'reopen') { - // Create an array for form - $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1); - } - - // Refuse confirmatio - if ($action == 'refuse') { - //Form to close proposal (signed or not) - $formquestion = array( - array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace) - ); - - // if (!empty($conf->notification->enabled)) { - // require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; - // $notify = new Notify($db); - // $formquestion = array_merge($formquestion, array( - // array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)), - // )); - // } - - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250); - } - - // Call Hook formConfirm - $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } - - // Print form confirm - print $formconfirm; - - - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; - - print '
'; - print '
'; - print '
'; - print ''."\n"; - - // Common attributes - //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field - //unset($object->fields['fk_project']); // Hide field already shown in banner - //unset($object->fields['fk_soc']); // Hide field already shown in banner - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - - // Other attributes. Fields from hook formObjectOptions and Extrafields. - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
'; - print '
'; - - print '
'; - - print dol_get_fiche_end(); - // Buttons for actions if ($action != 'presend') { @@ -501,26 +236,43 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if (empty($reshook)) { - if ($object->status == $object::STATUS_DRAFT) { - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?socid='.$socid.'&action=edit&token='.newtoken(), '', $permissiontoadd); - } - // Show if ($permissiontoadd) { - print dolGetButtonAction($langs->trans('ManagePartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd); + print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/societe/partnership.php?id='.$object->id), '', $permissiontoadd); } - - // Cancel - /* - if ($permissiontoadd) { - if ($object->status == $object::STATUS_ACCEPTED) { - print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd); - } - } - */ } print '
'."\n"; } + + + //$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php'; + $morehtmlright = ''; + + print load_fiche_titre($langs->trans("PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, ''); + + $socid = $object->id; + + + // TODO Replace this card with the list of all partnerships. + + $object = new Partnership($db); + $partnershipid = $object->fetch(0, '', 0, $socid); + + if ($partnershipid > 0) { + print '
'; + print '
'; + print '
'; + print ''."\n"; + + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_member']); // Hide field already shown in banner + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + + print '
'; + print '
'; + } } // End of page From 46a06f8e9512bbff7c48e51ceee11af025a58082 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Jun 2021 16:37:45 +0200 Subject: [PATCH 227/739] Fix phpcs --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 650c0016f9a..b8bf1a5998a 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin')); // Put here declaration of dictionaries properties // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. -$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0,43, 0, 25, 0); +$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 43, 0, 25, 0); // Name of SQL tables of dictionaries $tabname = array(); From cc24013d42b5b515c3087713f0bcfa54a381804d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:13:18 +0200 Subject: [PATCH 228/739] Update partnership_agenda.php --- htdocs/partnership/partnership_agenda.php | 55 ++--------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 51f417399df..799aadd24cd 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -22,63 +22,14 @@ * \brief Tab of events on Partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page From 83cd127f0b28b6aa154bfb1b400a0a5377e060d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:14:02 +0200 Subject: [PATCH 229/739] Update partnership_card.php --- htdocs/partnership/partnership_card.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 21c5cbdf68b..4fc4b08adb1 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -22,27 +22,6 @@ * \brief Page to create/edit/view partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; From 5fecaa2a5bde91cc98f164609ff79c42c4f8d082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:15:36 +0200 Subject: [PATCH 230/739] Update partnership_contact.php --- htdocs/partnership/partnership_contact.php | 35 +++------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 632047acf25..1c416cf690c 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -22,41 +22,14 @@ * \brief Tab for contacts linked to Partnership */ + // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "companies", "other", "mails")); From 4ac3576a7493936d759352a2f38da568e1a7c3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:16:27 +0200 Subject: [PATCH 231/739] Update partnership_document.php --- htdocs/partnership/partnership_document.php | 55 ++------------------- 1 file changed, 3 insertions(+), 52 deletions(-) diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index d6f89c07d00..e7fae7ee7ff 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -22,64 +22,15 @@ * \brief Tab for documents linked to Partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "companies", "other", "mails")); From 0eb61a6063472efcf244d2541bd8756d6929c1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:17:50 +0200 Subject: [PATCH 232/739] Update partnership_list.php --- htdocs/partnership/partnership_list.php | 67 ++++--------------------- 1 file changed, 9 insertions(+), 58 deletions(-) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 1ae90d0d4cf..457d0345c31 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -22,57 +22,8 @@ * \brief List page for partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -80,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // load partnership libraries -require_once __DIR__.'/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; // for other modules //dol_include_once('/othermodule/class/otherobject.class.php'); @@ -88,12 +39,12 @@ require_once __DIR__.'/class/partnership.class.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "members", "other")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershiplist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -113,9 +64,9 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Initialize technical objects -$object = new Partnership($db); -$extrafields = new ExtraFields($db); -$adherent = new Adherent($db); +$object = new Partnership($db); +$extrafields = new ExtraFields($db); +$adherent = new Adherent($db); $diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('partnershiplist')); // Note that conf->hooks_modules contains array From b1ff123155e9672c377adf18bde07be089667365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:19:20 +0200 Subject: [PATCH 233/739] Update partnership_note.php --- htdocs/partnership/partnership_note.php | 59 +++---------------------- 1 file changed, 5 insertions(+), 54 deletions(-) diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index 29a59f67ef4..b9607e5aeb6 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -22,69 +22,20 @@ * \brief Tab for notes on Partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; -dol_include_once('/partnership/class/partnership.class.php'); -dol_include_once('/partnership/lib/partnership.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "companies")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects From 594cd90c4b1dd97d419a272b14eb0fb03d2fa411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:22:20 +0200 Subject: [PATCH 234/739] Update partnershipindex.php --- htdocs/partnership/partnershipindex.php | 68 +++++-------------------- 1 file changed, 12 insertions(+), 56 deletions(-) diff --git a/htdocs/partnership/partnershipindex.php b/htdocs/partnership/partnershipindex.php index 8076f105dbb..536729a473d 100644 --- a/htdocs/partnership/partnershipindex.php +++ b/htdocs/partnership/partnershipindex.php @@ -25,35 +25,7 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; @@ -100,8 +72,7 @@ print '
'; /* BEGIN MODULEBUILDER DRAFT MYOBJECT // Draft MyObject -if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) -{ +if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) { $langs->load("orders"); $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; @@ -116,8 +87,7 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) if ($socid) $sql.= " AND c.fk_soc = ".$socid; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $total = 0; $num = $db->num_rows($resql); @@ -126,12 +96,9 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) print ''.$langs->trans("DraftMyObjects").($num?''.$num.'':'').''; $var = true; - if ($num > 0) - { + if ($num > 0) { $i = 0; - while ($i < $num) - { - + while ($i < $num) { $obj = $db->fetch_object($resql); print ''; @@ -150,23 +117,16 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) $i++; $total += $obj->total_ttc; } - if ($total>0) - { - + if ($total>0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else - { - + } else { print ''.$langs->trans("NoOrder").''; } print "
"; $db->free($resql); - } - else - { + } else { dol_print_error($db); } } @@ -181,8 +141,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject -if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) -{ +if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) { $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."partnership_myobject as s"; //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -193,8 +152,7 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) $sql .= $db->plimit($max, 0); $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $num = $db->num_rows($resql); $i = 0; @@ -205,10 +163,8 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) print ''; print ''.$langs->trans("DateModificationShort").''; print ''; - if ($num) - { - while ($i < $num) - { + if ($num) { + while ($i < $num) { $objp = $db->fetch_object($resql); $myobjectstatic->id=$objp->rowid; From ccc35326a52f85b7a0710345cc1593b588b667a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:25:44 +0200 Subject: [PATCH 235/739] Update partnershiputils.class.php --- htdocs/partnership/class/partnershiputils.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 992fca2703e..aef1bf18e49 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -28,10 +28,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; -dol_include_once('partnership/lib/partnership.lib.php'); -dol_include_once('/partnership/class/partnership.class.php'); +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; -require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; /** * Class with cron tasks of Partnership module From 8a359c9009edc7c0e2363253d8474244b4788560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:34:03 +0200 Subject: [PATCH 236/739] Update partnership.class.php --- htdocs/partnership/class/partnership.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index d04d0c335eb..125dacb1e53 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -354,8 +354,8 @@ class Partnership extends CommonObject * * @param int $id Id of object to load * @param string $ref Ref of object - * @param int $fk_soc fk_soc * @param int $fk_member fk_member + * @param int $fk_soc fk_soc * @return int >0 if OK, <0 if KO, 0 if not found */ public function fetch($id, $ref = null, $fk_member = null, $fk_soc = null) From e11656a3e3daa847875f2c99fca54fe1906e1adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:44:06 +0200 Subject: [PATCH 237/739] add member search --- dev/examples/zapier/index.js | 2 + dev/examples/zapier/searches/member.js | 88 ++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 dev/examples/zapier/searches/member.js diff --git a/dev/examples/zapier/index.js b/dev/examples/zapier/index.js index 044415a7ddd..9567c120bb0 100644 --- a/dev/examples/zapier/index.js +++ b/dev/examples/zapier/index.js @@ -8,6 +8,7 @@ const triggerUser = require('./triggers/user'); const searchThirdparty = require('./searches/thirdparty'); const searchContact = require('./searches/contact'); +const searchMember = require('./searches/member'); const createThirdparty = require('./creates/thirdparty'); const createContact = require('./creates/contact'); @@ -75,6 +76,7 @@ const App = { searches: { [searchThirdparty.key]: searchThirdparty, [searchContact.key]: searchContact, + [searchMember.key]: searchMember, }, // If you want your creates to show up, you better include it here! diff --git a/dev/examples/zapier/searches/member.js b/dev/examples/zapier/searches/member.js new file mode 100644 index 00000000000..f1a84061146 --- /dev/null +++ b/dev/examples/zapier/searches/member.js @@ -0,0 +1,88 @@ +module.exports = { + key: 'member', + + // You'll want to provide some helpful display labels and descriptions + // for users. Zapier will put them into the UX. + noun: 'Member', + display: { + label: 'Find a Member', + description: 'Search for member.' + }, + + // `operation` is where we make the call to your API to do the search + operation: { + // This search only has one search field. Your searches might have just one, or many + // search fields. + inputFields: [ + { + key: 'lastname', + type: 'string', + label: 'Lastname', + helpText: 'Lastname to limit to the search to (i.e. The company or %company%).' + }, + { + key: 'email', + type: 'string', + label: 'Email', + helpText: 'Email to limit to the search to.' + } + ], + + perform: async (z, bundle) => { + const url = bundle.authData.url + '/api/index.php/members/'; + + // Put the search value in a query param. The details of how to build + // a search URL will depend on how your API works. + let filter = ''; + if (bundle.inputData.lastname) { + filter = "t.lastname like \'%" + bundle.inputData.name + "%\'"; + } + if (bundle.inputData.email) { + if (bundle.inputData.lastname) { + filter += " and "; + } + filter += "t.email like \'" + bundle.inputData.email + "\'"; + } + const response = await z.request({ + url: url, + // this parameter avoid throwing errors and let us manage them + skipThrowForStatus: true, + params: { + sqlfilters: filter + } + }); + //z.console.log(response); + if (response.status != 200) { + return []; + } + return response.json; + }, + + // In cases where Zapier needs to show an example record to the user, but we are unable to get a live example + // from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of + // returned records, and have obviously dummy values that we can show to any user. + sample: { + id: 1, + createdAt: 1472069465, + name: 'DOE', + firstname: 'John', + authorId: 1, + }, + + // If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom + // field definitions. The result will be used to augment the sample. + // outputFields: () => { return []; } + // Alternatively, a static field definition should be provided, to specify labels for the fields + outputFields: [ + { + key: 'id', + type: "integer", + label: 'ID' + }, + { key: 'createdAt', type: "integer", label: 'Created At' }, + { key: 'name', label: 'Name' }, + { key: 'firstname', label: 'Firstname' }, + { key: 'authorId', type: "integer", label: 'Author ID' }, + ] + } +}; From 8401fa3ce778bf31fbecf5ceff48b2a0b8f03333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 17:57:48 +0200 Subject: [PATCH 238/739] add trigger member --- dev/examples/zapier/index.js | 2 + dev/examples/zapier/triggers/member.js | 171 ++++++++++++++++++ ...face_99_modZapier_ZapierTriggers.class.php | 22 ++- 3 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 dev/examples/zapier/triggers/member.js diff --git a/dev/examples/zapier/index.js b/dev/examples/zapier/index.js index 9567c120bb0..fdd1ed29a53 100644 --- a/dev/examples/zapier/index.js +++ b/dev/examples/zapier/index.js @@ -5,6 +5,7 @@ const triggerThirdparty = require('./triggers/thirdparty'); const triggerContact = require('./triggers/contact'); const triggerTicket = require('./triggers/ticket'); const triggerUser = require('./triggers/user'); +const triggerMember = require('./triggers/member'); const searchThirdparty = require('./searches/thirdparty'); const searchContact = require('./searches/contact'); @@ -70,6 +71,7 @@ const App = { [triggerContact.key]: triggerContact, [triggerTicket.key]: triggerTicket, [triggerUser.key]: triggerUser, + [triggerMember.key]: triggerMember, }, // If you want your searches to show up, you better include it here! diff --git a/dev/examples/zapier/triggers/member.js b/dev/examples/zapier/triggers/member.js new file mode 100644 index 00000000000..3385cdca625 --- /dev/null +++ b/dev/examples/zapier/triggers/member.js @@ -0,0 +1,171 @@ +const subscribeHook = (z, bundle) => { + // `z.console.log()` is similar to `console.log()`. + z.console.log('suscribing hook!'); + + // bundle.targetUrl has the Hook URL this app should call when an action is created. + const data = { + url: bundle.targetUrl, + event: bundle.event, + module: 'member', + action: bundle.inputData.action + }; + + const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; + + // You can build requests and our client will helpfully inject all the variables + // you need to complete. You can also register middleware to control this. + const options = { + url: url, + method: 'POST', + body: data, + }; + + // You may return a promise or a normal data structure from any perform method. + return z.request(options).then((response) => JSON.parse(response.content)); +}; + +const unsubscribeHook = (z, bundle) => { + // bundle.subscribeData contains the parsed response JSON from the subscribe + // request made initially. + z.console.log('unsuscribing hook!'); + + // You can build requests and our client will helpfully inject all the variables + // you need to complete. You can also register middleware to control this. + const options = { + url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, + method: 'DELETE', + }; + + // You may return a promise or a normal data structure from any perform method. + return z.request(options).then((response) => JSON.parse(response.content)); +}; + +const getMember = (z, bundle) => { + // bundle.cleanedRequest will include the parsed JSON object (if it's not a + // test poll) and also a .querystring property with the URL's query string. + const member = { + id: bundle.cleanedRequest.id, + name: bundle.cleanedRequest.name, + name_alias: bundle.cleanedRequest.name_alias, + firstname: bundle.cleanedRequest.firstname, + address: bundle.cleanedRequest.address, + zip: bundle.cleanedRequest.zip, + town: bundle.cleanedRequest.town, + email: bundle.cleanedRequest.email, + phone_pro: bundle.cleanedRequest.phone_pro, + phone_perso: bundle.cleanedRequest.phone_perso, + phone_mobile: bundle.cleanedRequest.phone_mobile, + authorId: bundle.cleanedRequest.authorId, + createdAt: bundle.cleanedRequest.createdAt, + action: bundle.cleanedRequest.action + }; + + return [member]; +}; + +const getFallbackRealMember = (z, bundle) => { + // For the test poll, you should get some real data, to aid the setup process. + const module = bundle.inputData.module; + const options = { + url: bundle.authData.url + '/api/index.php/members/0', + }; + + return z.request(options).then((response) => [JSON.parse(response.content)]); +}; + +// const getModulesChoices = (z/*, bundle*/) => { +// // For the test poll, you should get some real data, to aid the setup process. +// const options = { +// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', +// }; + +// return z.request(options).then((response) => JSON.parse(response.content)); +// }; +// const getModulesChoices = () => { +// return { +// orders: "Order", +// invoices: "Invoice", +// members: "Member", +// members: "Members" +// }; +// }; + +// const getActionsChoices = (z, bundle) => { +// // For the test poll, you should get some real data, to aid the setup process. +// const module = bundle.inputData.module; +// const options = { +// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, +// }; + +// return z.request(options).then((response) => JSON.parse(response.content)); +// }; + +// We recommend writing your triggers separate like this and rolling them +// into the App definition at the end. +module.exports = { + key: 'member', + + // You'll want to provide some helpful display labels and descriptions + // for users. Zapier will put them into the UX. + noun: 'Member', + display: { + label: 'New Member', + description: 'Triggers when a new member action is done in Dolibarr.' + }, + + // `operation` is where the business logic goes. + operation: { + + // `inputFields` can define the fields a user could provide, + // we'll pass them in as `bundle.inputData` later. + inputFields: [ + { + key: 'action', + required: true, + type: 'string', + helpText: 'Which action of member this should trigger on.', + choices: { + create: "Create", + modify: "Modify", + validate: "Validate", + } + } + ], + + type: 'hook', + + performSubscribe: subscribeHook, + performUnsubscribe: unsubscribeHook, + + perform: getMember, + performList: getFallbackRealMember, + + // In cases where Zapier needs to show an example record to the user, but we are unable to get a live example + // from the API, Zapier will fallback to this hard-coded sample. It should reflect the data structure of + // returned records, and have obviously dummy values that we can show to any user. + sample: { + id: 1, + createdAt: 1472069465, + lastname: 'DOE', + firstname: 'John', + authorId: 1, + action: 'create' + }, + + // If the resource can have fields that are custom on a per-user basis, define a function to fetch the custom + // field definitions. The result will be used to augment the sample. + // outputFields: () => { return []; } + // Alternatively, a static field definition should be provided, to specify labels for the fields + outputFields: [ + {key: 'id', type: "integer", label: 'ID'}, + {key: 'createdAt', label: 'Created At'}, + {key: 'lastname', label: 'Lastname'}, + {key: 'firstname', label: 'Firstname'}, + {key: 'phone', label: 'Phone pro'}, + {key: 'phone_perso', label: 'Phone perso'}, + {key: 'phone_mobile', label: 'Phone mobile'}, + {key: 'authorId', type: "integer", label: 'Author ID'}, + {key: 'action', label: 'Action'} + ] + } +}; diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index 7d6f346449d..8025f0c0293 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -339,10 +339,28 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'LINEFICHINTER_DELETE': // Members - // case 'MEMBER_CREATE': + case 'MEMBER_CREATE': + $resql = $this->db->query($sql); + while ($resql && $obj = $this->db->fetch_array($resql)) { + $cleaned = cleanObjectDatas(dol_clone($object)); + $json = json_encode($cleaned); + // call the zapierPostWebhook() function + zapierPostWebhook($obj['url'], $json); + } + $logtriggeraction = true; + break; + case 'MEMBER_MODIFY': + $resql = $this->db->query($sql); + while ($resql && $obj = $this->db->fetch_array($resql)) { + $cleaned = cleanObjectDatas(dol_clone($object)); + $json = json_encode($cleaned); + // call the zapierPostWebhook() function + zapierPostWebhook($obj['url'], $json); + } + $logtriggeraction = true; + break; // case 'MEMBER_VALIDATE': // case 'MEMBER_SUBSCRIPTION': - // case 'MEMBER_MODIFY': // case 'MEMBER_NEW_PASSWORD': // case 'MEMBER_RESILIATE': // case 'MEMBER_DELETE': From a47df8246899ee2500b44373c94db12eef46ba27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 19:14:42 +0200 Subject: [PATCH 239/739] fix warning --- htdocs/societe/partnership.php | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index d109421fe8d..912307a5675 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -22,27 +22,6 @@ * \brief Page to create/edit/view partnership */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -80,8 +59,8 @@ if ($id > 0) { } // Initialize technical objects -$object = new Partnership($db); -$extrafields = new ExtraFields($db); +$object = new Partnership($db); +$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('partnershipthirdparty', 'globalcard')); // Note that conf->hooks_modules contains array @@ -112,7 +91,7 @@ $usercanclose = $user->rights->partnership->write; // Used by the include of $upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; -if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') accessforbidden(); +if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') accessforbidden(); if (empty($conf->partnership->enabled)) accessforbidden(); if (empty($permissiontoread)) accessforbidden(); if ($action == 'edit' && empty($permissiontoadd)) accessforbidden(); From d54d4da8cd6ee03b0d4948d4ed095df13f3922fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 19:18:02 +0200 Subject: [PATCH 240/739] Update setup.php --- htdocs/partnership/admin/setup.php | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 7fa0ef62b5e..3f933c2bc94 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -23,32 +23,7 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; global $langs, $user; @@ -160,7 +135,7 @@ print ''.$langs->trans("partnershipforthirdparty print ''; -if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { +if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { print ''.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; print ''; $dnbdays = '15'; From f3a3ce90e12a017aa245eb0bcb7a7d30f815353c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 21:18:23 +0200 Subject: [PATCH 241/739] Update partnership_card.php --- htdocs/partnership/partnership_card.php | 32 ------------------------- 1 file changed, 32 deletions(-) diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 4fc4b08adb1..29789072773 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -225,22 +225,6 @@ $title = $langs->trans("Partnership"); $help_url = ''; llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', 'object_'.$object->picto); @@ -373,22 +357,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToRefuse'), $text, 'confirm_refuse', $formquestion, '', 1, 250); } - // Confirmation of action xxxx - if ($action == 'xxx') { - $formquestion = array(); - /* - $forcecombo=0; - if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy - $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) - ); - */ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); - } - // Call Hook formConfirm $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From ffb1b232d4540d6bc34b9d6787495c9729461583 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 21:27:48 +0200 Subject: [PATCH 242/739] Fix Withdraw - link is missing in llx_bank_url when the debit is rejected --- .../compta/paiement/class/paiement.class.php | 26 ++++++++++++++----- .../class/rejetprelevement.class.php | 14 +++++++--- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 221ff3de042..76709332f06 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -2,13 +2,14 @@ /* Copyright (C) 2002-2004 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2012 Cédric Salvador - * Copyright (C) 2014 Raphaël Doursenaud - * Copyright (C) 2014 Marcos García - * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Thibault FOUCART - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2021 OpenDsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -748,6 +749,17 @@ class Paiement extends CommonObject ); } + // Add link 'InvoiceRefused' in bank_url + if (! $error && $label == '(InvoiceRefused)') { + $result=$acc->add_url_line( + $bank_line_id, + $this->id_prelevement, + DOL_URL_ROOT.'/compta/prelevement/card.php?id=', + $this->num_prelevement, + 'withdraw' + ); + } + if (! $error && ! $notrigger) { // Appel des triggers diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 740a1e47784..f1e6eab552a 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2013 Juanjo Menent +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2021 OpenDsi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,6 +96,10 @@ class RejetPrelevement $bankaccount = $conf->global->PRELEVEMENT_ID_BANKACCOUNT; $facs = $this->getListInvoices(1); + require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php'; + $lipre = new LignePrelevement($this->db, $user); + $lipre->fetch($id); + $this->db->begin(); // Insert refused line into database @@ -154,6 +159,9 @@ class RejetPrelevement $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal $pai->num_paiement = $fac->ref; + $pai->num_payment = $fac->ref; + $pai->id_prelevement = $this->bon_id; + $pai->num_prelevement = $lipre->bon_ref; if ($pai->create($this->user) < 0) // we call with no_commit { From a586afd8b33d2cd8fd1cfdfe8a9df7c099ad0904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 21:35:39 +0200 Subject: [PATCH 243/739] clean code --- htdocs/admin/knowledgemanagement.php | 28 +--------- htdocs/admin/knowledgerecord_extrafields.php | 27 +-------- .../class/knowledgerecord.class.php | 2 +- .../knowledgemanagementindex.php | 30 +--------- .../knowledgerecord_agenda.php | 55 +------------------ .../knowledgerecord_card.php | 55 +------------------ .../knowledgerecord_contact.php | 34 +----------- .../knowledgerecord_document.php | 55 +------------------ .../knowledgerecord_list.php | 53 +----------------- .../knowledgerecord_note.php | 55 +------------------ .../lib/knowledgemanagement.lib.php | 6 +- ...nowledgemanagement_knowledgerecord.lib.php | 10 ++-- .../partnership/class/partnership.class.php | 2 +- 13 files changed, 31 insertions(+), 381 deletions(-) diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 5bc994bb086..b8434773f67 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -23,32 +23,8 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; + global $langs, $user; // Libraries diff --git a/htdocs/admin/knowledgerecord_extrafields.php b/htdocs/admin/knowledgerecord_extrafields.php index 823366e1fbe..d6c94e4ceeb 100644 --- a/htdocs/admin/knowledgerecord_extrafields.php +++ b/htdocs/admin/knowledgerecord_extrafields.php @@ -27,32 +27,7 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php'; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 4d46794aaf8..85d8a1bcb9e 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -17,7 +17,7 @@ */ /** - * \file class/knowledgerecord.class.php + * \file htdocs/knowledgemanagement/class/knowledgerecord.class.php * \ingroup knowledgemanagement * \brief This file is a CRUD class file for KnowledgeRecord (Create/Read/Update/Delete) */ diff --git a/htdocs/knowledgemanagement/knowledgemanagementindex.php b/htdocs/knowledgemanagement/knowledgemanagementindex.php index 86ea3f10e08..f4fc767e9d5 100644 --- a/htdocs/knowledgemanagement/knowledgemanagementindex.php +++ b/htdocs/knowledgemanagement/knowledgemanagementindex.php @@ -25,35 +25,7 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index 5144b736b98..7853aa7e2ff 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -22,63 +22,14 @@ * \brief Tab of events on KnowledgeRecord */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); -dol_include_once('/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; // Load translation files required by the page diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index f4e949a8603..b33ecb652f7 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -22,63 +22,14 @@ * \brief Page to create/edit/view knowledgerecord */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); -dol_include_once('/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "other")); diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index e5af4a54611..1eb80efafa1 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -23,40 +23,12 @@ */ // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); -dol_include_once('/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "companies", "other", "mails")); diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 5261fde7118..4a572ee22bb 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -22,64 +22,15 @@ * \brief Tab for documents linked to KnowledgeRecord */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); -dol_include_once('/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "companies", "other", "mails")); diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index bd4c8829be5..c886d6931a0 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -22,64 +22,15 @@ * \brief List page for knowledgerecord */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; // load knowledgemanagement libraries -require_once __DIR__.'/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; // for other modules //dol_include_once('/othermodule/class/otherobject.class.php'); diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 31c15ff2064..bcf9fb9b801 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -22,60 +22,11 @@ * \brief Tab for notes on KnowledgeRecord */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies -//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET -//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification - // Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../main.inc.php")) { - $res = @include "../main.inc.php"; -} -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} +require '../main.inc.php'; -dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); -dol_include_once('/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; +require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "companies")); diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index ba81dd49057..0b07e7b46e8 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -35,18 +35,18 @@ function knowledgemanagementAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/admin/knowledgemanagement.php", 1); + $head[$h][0] = DOL_URL_ROOT.'/admin/knowledgemanagement.php'; $head[$h][1] = $langs->trans("Setup"); $head[$h][2] = 'setup'; $h++; - $head[$h][0] = dol_buildpath("admin/knowledgerecord_extrafields.php", 1); + $head[$h][0] = DOL_URL_ROOT.'/admin/knowledgerecord_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'extra'; $h++; - /*$head[$h][0] = dol_buildpath("/knowledgemanagement/admin/about.php", 1); + /*$head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/admin/about.php'; $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'about'; $h++;*/ diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php index 1da21a3e413..e70b4654d19 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php @@ -16,7 +16,7 @@ */ /** - * \file lib/knowledgemanagement_knowledgerecord.lib.php + * \file htdocs/knowledgemanagementlib/knowledgemanagement_knowledgerecord.lib.php * \ingroup knowledgemanagement * \brief Library files with common functions for KnowledgeRecord */ @@ -36,7 +36,7 @@ function knowledgerecordPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/knowledgemanagement/knowledgerecord_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_card.php?id='.$object->id; $head[$h][1] = $langs->trans("KnowledgeRecord"); $head[$h][2] = 'card'; $h++; @@ -49,7 +49,7 @@ function knowledgerecordPrepareHead($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = dol_buildpath('/knowledgemanagement/knowledgerecord_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); @@ -63,7 +63,7 @@ function knowledgerecordPrepareHead($object) $upload_dir = $conf->knowledgemanagement->dir_output."/knowledgerecord/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/knowledgemanagement/knowledgerecord_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { $head[$h][1] .= ''.($nbFiles + $nbLinks).''; @@ -71,7 +71,7 @@ function knowledgerecordPrepareHead($object) $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/knowledgemanagement/knowledgerecord_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/knowledgemanagement/knowledgerecord_agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index f33a19f312e..78eb60a3ab3 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -197,7 +197,7 @@ class Partnership extends CommonObject 'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>64, 'notnull'=>0, 'visible'=>-2,), ); - if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { + if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { $this->fields['fk_member'] = array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'member'); } else { $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'societe'); From a06fb441d300617b3f9c2a7a24c0b8bf5335f835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 6 Jun 2021 21:40:47 +0200 Subject: [PATCH 244/739] clean code --- .../knowledgemanagementindex.php | 18 +++++++----------- .../knowledgerecord_note.php | 6 +++--- .../lib/knowledgemanagement.lib.php | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/htdocs/knowledgemanagement/knowledgemanagementindex.php b/htdocs/knowledgemanagement/knowledgemanagementindex.php index f4fc767e9d5..8add69ae86d 100644 --- a/htdocs/knowledgemanagement/knowledgemanagementindex.php +++ b/htdocs/knowledgemanagement/knowledgemanagementindex.php @@ -19,7 +19,7 @@ */ /** - * \file knowledgemanagement/knowledgemanagementindex.php + * \file htdocs/knowledgemanagement/knowledgemanagementindex.php * \ingroup knowledgemanagement * \brief Home page of knowledgemanagement top menu */ @@ -148,13 +148,12 @@ END MODULEBUILDER DRAFT MYOBJECT */ print '
'; -$NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; -$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; +$NBMAX = (empty($conf->global->MAIN_SIZE_SHORTLIST_LIMIT) ? 25 : $conf->global->MAIN_SIZE_SHORTLIST_LIMIT); +$max = $NBMAX; /* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT // Last modified myobject -if (! empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read) -{ +if (! empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemanagement->read) { $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_myobject as s"; //if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -165,8 +164,7 @@ if (! empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemana $sql .= $db->plimit($max, 0); $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $num = $db->num_rows($resql); $i = 0; @@ -177,10 +175,8 @@ if (! empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemana print ''; print ''.$langs->trans("DateModificationShort").''; print ''; - if ($num) - { - while ($i < $num) - { + if ($num) { + while ($i < $num) { $objp = $db->fetch_object($resql); $myobjectstatic->id=$objp->rowid; diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index bcf9fb9b801..a6a9974a9c8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -17,7 +17,7 @@ */ /** - * \file knowledgerecord_note.php + * \file htdocs/knowledgemanagement/knowledgerecord_note.php * \ingroup knowledgemanagement * \brief Tab for notes on KnowledgeRecord */ @@ -33,9 +33,9 @@ $langs->loadLangs(array("knowledgemanagement", "companies")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects diff --git a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php index 0b07e7b46e8..12db6245087 100644 --- a/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php +++ b/htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php @@ -16,7 +16,7 @@ */ /** - * \file knowledgemanagement/lib/knowledgemanagement.lib.php + * \file htdocs/knowledgemanagement/lib/knowledgemanagement.lib.php * \ingroup knowledgemanagement * \brief Library files with common functions for KnowledgeManagement */ From a63d3364b4bdd72b40c0fbe5739747d4b18d2cc9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 6 Jun 2021 22:51:27 +0200 Subject: [PATCH 245/739] Fix links in box last MO --- htdocs/core/boxes/box_mos.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/htdocs/core/boxes/box_mos.php b/htdocs/core/boxes/box_mos.php index 43d1cd411e4..d7f7a8f72ae 100644 --- a/htdocs/core/boxes/box_mos.php +++ b/htdocs/core/boxes/box_mos.php @@ -86,12 +86,15 @@ class box_mos extends ModeleBoxes if ($user->rights->mrp->read) { $sql = "SELECT p.ref as product_ref"; + $sql .= ", p.rowid as productid"; + $sql .= ", p.tosell"; + $sql .= ", p.tobuy"; + $sql .= ", p.tobatch"; $sql .= ", c.rowid"; $sql .= ", c.date_creation"; $sql .= ", c.tms"; $sql .= ", c.ref"; $sql .= ", c.status"; - //$sql.= ", c.fk_user_valid"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= ", ".MAIN_DB_PREFIX."mrp_mo as c"; $sql .= " WHERE c.fk_product = p.rowid"; @@ -110,9 +113,12 @@ class box_mos extends ModeleBoxes $datem = $this->db->jdate($objp->tms); $mostatic->id = $objp->rowid; $mostatic->ref = $objp->ref; - $mostatic->id = $objp->socid; $mostatic->status = $objp->status; + $productstatic->id = $objp->productid; $productstatic->ref = $objp->product_ref; + $productstatic->status = $objp->tosell; + $productstatic->status_buy = $objp->tobuy; + $productstatic->status_batch = $objp->tobatch; $this->info_box_contents[$line][] = array( 'td' => 'class="nowraponall"', @@ -126,17 +132,6 @@ class box_mos extends ModeleBoxes 'asis' => 1, ); - if (!empty($conf->global->MRP_BOX_LAST_MOS_SHOW_VALIDATE_USER)) { - if ($objp->fk_user_valid > 0) { - $userstatic->fetch($objp->fk_user_valid); - } - $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', - 'text' => (($objp->fk_user_valid > 0) ? $userstatic->getNomUrl(1) : ''), - 'asis' => 1, - ); - } - $this->info_box_contents[$line][] = array( 'td' => 'class="center nowraponall"', 'text' => dol_print_date($datem, 'day', 'tzuserrel'), From 242f8b2544833f8d8d70ab6dd300782511717e21 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 01:23:34 +0200 Subject: [PATCH 246/739] Debug v14 --- htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 5 +++-- htdocs/core/boxes/box_graph_new_vs_close_ticket.php | 2 +- htdocs/core/boxes/box_graph_ticket_by_severity.php | 9 +++++---- htdocs/langs/en_US/ticket.lang | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php index 18ce00d0af3..baa822dcf29 100644 --- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php +++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php @@ -168,8 +168,9 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes $totalnb += $value['data']; } $px1->SetData($data); - $px1->setShowLegend(2); - $px1->SetType(array('bar')); + //$px1->setShowLegend(2); + $px1->setShowLegend(0); + $px1->SetType(array('bars')); $px1->SetLegend(array($langs->trans('BoxNumberOfTicketByDay'))); $px1->SetMaxValue($px1->GetCeilMaxValue()); $px1->SetHeight(192); diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php index bd835d6cc07..5b17c335f3f 100644 --- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php +++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php @@ -149,7 +149,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes } $stringtoprint .= '
'; $this->info_box_contents[][]=array( - 'td' => 'center', + 'td' => 'class="center"', 'text' => $stringtoprint ); } else { diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index ce769da4752..787e9cebb33 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -30,7 +30,6 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_graph_ticket_by_severity extends ModeleBoxes { - public $boxcode = "box_ticket_by_severity"; public $boximg = "ticket"; public $boxlabel; @@ -168,16 +167,18 @@ class box_graph_ticket_by_severity extends ModeleBoxes $mesg = $px1->isGraphKo(); $totalnb = 0; if (!$mesg) { - $px1->SetDataColor(array_values($colorseriesstat)); + //$px1->SetDataColor(array_values($colorseriesstat)); $data = array(); $legend = array(); foreach ($dataseries as $value) { $data[] = array($value['label'], $value['data']); $totalnb += $value['data']; } + $px1->SetData($data); - $px1->setShowLegend(2); - $px1->SetType(array('pie')); + //$px1->setShowLegend(2); + $px1->setShowLegend(0); + $px1->SetType(array('bars')); $px1->SetLegend($legend); $px1->SetMaxValue($px1->GetCeilMaxValue()); //$px1->SetHeight($HEIGHT); diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 50fa8c970ae..0f87504a0a5 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -304,7 +304,7 @@ BoxLastModifiedTicket=Latest modified tickets BoxLastModifiedTicketDescription=Latest %s modified tickets BoxLastModifiedTicketContent= BoxLastModifiedTicketNoRecordedTickets=No recent modified tickets -BoxTicketType=Number of open tickets by type +BoxTicketType=Distribution of open tickets by type BoxTicketSeverity=Number of open tickets by severity BoxNoTicketSeverity=No tickets opened BoxTicketLastXDays=Number of new tickets by days the last %s days From d6cbb9007ff6234c2f757c46724258b961c3ad17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 01:43:24 +0200 Subject: [PATCH 247/739] Debug ticket form to add a local file --- htdocs/core/class/html.formticket.class.php | 10 ++++++---- htdocs/core/lib/functions.lib.php | 3 ++- htdocs/public/ticket/view.php | 11 +++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index b10ac80416f..f4e076640c4 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1099,6 +1099,8 @@ class FormTicket print ''; } + $uselocalbrowser = false; + // Intro // External users can't send message email if ($user->rights->ticket->write && !$user->socid) { @@ -1109,15 +1111,15 @@ class FormTicket print ''; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $uselocalbrowser = true; - $doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); + $doleditor = new DolEditor('mail_intro', $mail_intro, '100%', 90, 'dolibarr_details', '', false, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); $doleditor->Create(); print ''; } // MESSAGE + $defaultmessage = ""; if (is_object($arraydefaultmessage) && $arraydefaultmessage->content) { $defaultmessage = $arraydefaultmessage->content; @@ -1147,7 +1149,7 @@ class FormTicket //$toolbarname = 'dolibarr_details'; $toolbarname = 'dolibarr_notes'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70); + $doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70); $doleditor->Create(); print ''; @@ -1159,7 +1161,7 @@ class FormTicket print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelp"), 1, 'help'); print ''; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); + $doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 150, 'dolibarr_details', '', false, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); $doleditor->Create(); print ''; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b018b4d2fb0..165d9c503a4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3499,7 +3499,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building', 'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype', - 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'cron', 'cubes', 'multicurrency', + 'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes', + 'multicurrency', 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'dynamicprice', 'edit', 'ellipsis-h', 'email', 'eraser', 'establishment', 'expensereport', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 2f70ded9914..3fec075160b 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -234,6 +234,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Ref print ''.$langs->trans("Ref").''; + print img_picto('', 'ticket', 'class="pictofixedwidth"'); print dol_escape_htmltag($object->dao->ref); print ''; @@ -244,7 +245,9 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Subject print ''.$langs->trans("Subject").''; + print ''; print dol_escape_htmltag($object->dao->subject); + print ''; print ''; // Statut @@ -259,6 +262,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Category print ''.$langs->trans("Category").''; + print img_picto('', 'category', 'class="pictofixedwidth"'); print dol_escape_htmltag($object->dao->category_label); print ''; @@ -278,8 +282,10 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a $langs->load("users"); $fuser = new User($db); $fuser->fetch($object->dao->fk_user_create); + print img_picto('', 'user', 'class="pictofixedwidth"'); print $fuser->getFullName($langs); } else { + print img_picto('', 'email', 'class="pictofixedwidth"'); print dol_escape_htmltag($object->dao->origin_email); } @@ -304,6 +310,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($object->dao->fk_user_assign > 0) { $fuser = new User($db); $fuser->fetch($object->dao->fk_user_assign); + print img_picto('', 'user', 'class="pictofixedwidth"'); print $fuser->getFullName($langs, 1); } print ''; @@ -320,7 +327,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print '
'; if ($action == 'presend') { - print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); + print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'conversation'); $formticket = new FormTicket($db); @@ -364,7 +371,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a } // Message list - print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'object_conversation'); + print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'conversation'); $object->viewTicketMessages(false, true, $object->dao); } else { print ''; From beca3c8ad30bc307c228e8a746bcfdc0c774cd95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 01:51:56 +0200 Subject: [PATCH 248/739] Debug v14 --- htdocs/public/ticket/list.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 1e1eb08dd5e..3c5dfffba17 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -561,14 +561,19 @@ if ($action == "view_ticketlist") { // Ref if (!empty($arrayfields['t.ref']['checked'])) { print ''; + print ''; + print img_picto('', 'ticket', 'class="paddingrightonly"'); print $obj->ref; + print ''; print ''; } // Subject if (!empty($arrayfields['t.subject']['checked'])) { print ''; - print ''.$obj->subject.''; + print ''; + print $obj->subject; + print ''; print ''; } @@ -602,13 +607,14 @@ if ($action == "view_ticketlist") { // Message author if (!empty($arrayfields['t.fk_user_create']['checked'])) { - print ''; + print ''; if ($obj->fk_user_create > 0) { $user_create->firstname = (!empty($obj->user_create_firstname) ? $obj->user_create_firstname : ''); $user_create->name = (!empty($obj->user_create_lastname) ? $obj->user_create_lastname : ''); $user_create->id = (!empty($obj->fk_user_create) ? $obj->fk_user_create : ''); print $user_create->getFullName($langs); } else { + print img_picto('', 'email', 'class="paddingrightonly"'); print $langs->trans('Email'); } print ''; @@ -617,10 +623,11 @@ if ($action == "view_ticketlist") { // Assigned author if (!empty($arrayfields['t.fk_user_assign']['checked'])) { print ''; - if ($obj->fk_user_assig > 0) { + if ($obj->fk_user_assign > 0) { $user_assign->firstname = (!empty($obj->user_assign_firstname) ? $obj->user_assign_firstname : ''); $user_assign->lastname = (!empty($obj->user_assign_lastname) ? $obj->user_assign_lastname : ''); $user_assign->id = (!empty($obj->fk_user_assign) ? $obj->fk_user_assign : ''); + print img_picto('', 'user', 'class="paddingrightonly"'); print $user_assign->getFullName($langs); } print ''; From 2dbf9537b3be79350d0e2855230270b24c0de505 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 7 Jun 2021 08:59:47 +0200 Subject: [PATCH 249/739] Update llx_c_chargesociales.sql --- .../mysql/data/llx_c_chargesociales.sql | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_chargesociales.sql b/htdocs/install/mysql/data/llx_c_chargesociales.sql index a7e12df0d31..afc8afea2f8 100644 --- a/htdocs/install/mysql/data/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/data/llx_c_chargesociales.sql @@ -50,20 +50,20 @@ insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays -- -- Belgique -- -insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 201, 'ONSS', 1,1,'TAXBEONSS'); -insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 210, 'Precompte professionnel', 1,1,'TAXBEPREPRO'); -insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 220, 'Prime existence', 1,1,'TAXBEPRIEXI'); -insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values ('2', 230, 'Precompte immobilier', 1,1,'TAXBEPREIMMO'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (2, 201, 'ONSS', 1,1,'TAXBEONSS'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (2, 210, 'Precompte professionnel', 1,1,'TAXBEPREPRO'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (2, 220, 'Prime existence', 1,1,'TAXBEPRIEXI'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (2, 230, 'Precompte immobilier', 1,1,'TAXBEPREIMMO'); -- -- Austria -- -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4101, 'Krankenversicherung', 1,1,'TAXATKV' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4102, 'Unfallversicherung', 1,1,'TAXATUV' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4103, 'Pensionsversicherung', 1,1,'TAXATPV' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4104, 'Arbeitslosenversicherung', 1,1,'TAXATAV' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4105, 'Insolvenzentgeltsicherungsfond', 1,1,'TAXATIESG' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4106, 'Wohnbauförderung', 1,1,'TAXATWF' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4107, 'Arbeiterkammerumlage', 1,1,'TAXATAK' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4108, 'Mitarbeitervorsorgekasse', 1,1,'TAXATMVK' ,'41'); -insert into llx_c_chargesociales (id, libelle, deductible, active, code, fk_pays) values (4109, 'Familienlastenausgleichsfond', 1,1,'TAXATFLAF' ,'41'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4101, 'Krankenversicherung', 1,1,'TAXATKV'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4102, 'Unfallversicherung', 1,1,'TAXATUV'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4103, 'Pensionsversicherung', 1,1,'TAXATPV'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4104, 'Arbeitslosenversicherung', 1,1,'TAXATAV'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4105, 'Insolvenzentgeltsicherungsfond', 1,1,'TAXATIESG'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4106, 'Wohnbauförderung', 1,1,'TAXATWF'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4107, 'Arbeiterkammerumlage', 1,1,'TAXATAK'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4108, 'Mitarbeitervorsorgekasse', 1,1,'TAXATMVK'); +insert into llx_c_chargesociales (fk_pays, id, libelle, deductible, active, code) values (41, 4109, 'Familienlastenausgleichsfond', 1,1,'TAXATFLAF'); From e74c57167ee9971cebe6d55d2dd10ac4bf98a62c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 7 Jun 2021 09:39:05 +0200 Subject: [PATCH 250/739] Update README.md --- README.md | 85 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 34162fd5682..736925bec72 100644 --- a/README.md +++ b/README.md @@ -97,41 +97,68 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) ### Main application/modules (all optional) -- Customers, Prospects (Leads) and/or Suppliers directory + Contacts -- Members/Membership management -- Products and/or Services catalog -- Commercial proposals management -- Customer & Supplier Orders management -- Invoices and payment management -- Shipping management -- Warehouse/Stock management/Inventory -- Manufacturing Orders -- Bank accounts management -- Direct debit orders management (European SEPA) -- Accounting management -- Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Opportunities or Leads management -- Projects & Tasks management -- Ticket System -- Contracts management -- Interventions management -- Employee's leave requests management -- Expense reports -- Recruitment management -- Timesheets -- Electronic Document Management (EDM) -- Foundations members management -- Point of Sale (POS) -- … (around 100 modules available by default, 1000+ on the addon market place) +- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts +- Members/Membership/Foundation management + + Product Management +- Products and/or Services catalog +- Stock / Warehouse management + Inventory +- Barcodes +- Batches / Lots / Serials +- Product Variants +- Bill of Materials +- Manufacturing Orders + + Customer/Sales Management +- Customers/Prospects + Contacts management +- Opportunities or Leads management +- Commercial proposals management +- Customer Orders management +- Contracts/Subscription management +- Interventions management +- Ticket System +- Shipping management +- Customer Invoices/Credit notes and payment management +- Point of Sale (POS) + + Supplier/Purchase Management +- Suppliers/Vendors + Contacts +- Supplier (price) requests +- Purchase Order management +- Delivery/Receiption +- Supplier Invoices/credit notes and payment management + + Finance / Accounting +- Invoices / Payments +- Bank accounts management +- Direct debit orders management (European SEPA) +- Accounting management +- Donations management +- Loan management +- Margins +- Reports + + +- Shared calendar/agenda (with ical and vcal export for third party tools integration) +- Projects & Tasks management +- Ticket System + +- Employee's leave requests management +- Expense reports +- Recruitment management +- Timesheets + +- (around 100 modules available by default, 1000+ on the addon market place) + ### Other application/modules +- Electronic Document Management (EDM) - Bookmarks management -- Donations management - Reporting - Surveys - Data export/import -- Barcodes support +- Barcodes - Margin calculations - LDAP connectivity - ClickToDial integration @@ -139,7 +166,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - RSS integration - Skype integration - Payment platforms integration (PayPal, Stripe, Paybox...) -- … +- ### Other general features From 80af5e2216dd3a91ed20c9ca3e4a9c4a78600e4e Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Jun 2021 10:05:24 +0200 Subject: [PATCH 251/739] keep where but remove join --- htdocs/compta/stats/cabyprodserv.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7b8f1101004..fce5a9740a2 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -231,8 +231,6 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; if ($selected_cat === -2) { // Without any category $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } elseif ($selected_cat) { // Into a specific category - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON (cp.fk_product = p.rowid) INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON (cp.fk_categorie = c.rowid)"; } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; @@ -263,10 +261,13 @@ if ($modecompta == 'CREANCES-DETTES') } } + $sql .= " AND (p.rowid IN "; + $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; $sql .= " AND "; if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; + $sql .= "))"; } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; From 4f6a5cf5f7694c9a9eb5c000a13b0c8c99b96484 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 10:08:31 +0200 Subject: [PATCH 252/739] Debug v14 --- htdocs/adherents/class/adherent.class.php | 40 +++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 18d8746cca7..b7852280ddf 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -260,9 +260,9 @@ class Adherent extends CommonObject public $datefin; - // From member table - // Fields loaded by fetch_subscriptions() + // Fields loaded by fetch_subscriptions() from member table + public $first_subscription_date; public $first_subscription_amount; @@ -277,6 +277,12 @@ class Adherent extends CommonObject public $subscriptions = array(); + + // Fields loaded by fetchPartnerships() from partnership table + + public $partnerships = array(); + + /** * @var Adherent To contains a clone of this when we need to save old properties of object */ @@ -1439,11 +1445,12 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Function to get member subscriptions data - * first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount - * last_subscription_date, last_subscription_date_start, last_subscription_date_end, last_subscription_amount + * Function to get member subscriptions data: + * subscriptions, + * first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount + * last_subscription_date, last_subscription_date_start, last_subscription_date_end, last_subscription_amount * - * @return int <0 si KO, >0 si OK + * @return int <0 if KO, >0 if OK */ public function fetch_subscriptions() { @@ -1503,6 +1510,27 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Function to get partnerships array + * + * @param string $mode 'member' or 'thirdparty' + * @return int <0 if KO, >0 if OK + */ + public function fetchPartnerships($mode) + { + // phpcs:enable + global $langs; + + require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php'; + + + $this->partnerships[] = array(); + + return 1; + } + + /** * Insert subscription into database and eventually add links to banks, mailman, etc... * From 98aa374185cb8996d9a4194695f77db35cddbeeb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 7 Jun 2021 08:10:05 +0000 Subject: [PATCH 253/739] Fixing style errors. --- htdocs/compta/stats/cabyprodserv.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index fce5a9740a2..f7c215270d4 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -268,7 +268,6 @@ if ($modecompta == 'CREANCES-DETTES') if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; $sql .= "))"; - } if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; $sql .= " AND f.entity IN (".getEntity('invoice').")"; From af913cd29f1412481858ca796508520bded4e414 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 7 Jun 2021 10:10:42 +0200 Subject: [PATCH 254/739] remove and --- htdocs/compta/stats/cabyprodserv.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index fce5a9740a2..da9927c2e20 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -263,8 +263,6 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " AND (p.rowid IN "; $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE "; - $sql .= " AND "; - if ($subcat) $sql .= "cp.fk_categorie IN (".$listofcatsql.")"; else $sql .= "cp.fk_categorie = ".$selected_cat; $sql .= "))"; From 0144d6c0fdba1c38f9c60535cd6911b83c32ea73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 11:30:46 +0200 Subject: [PATCH 255/739] Inventory is now stable feature --- htdocs/core/menus/standard/eldy.lib.php | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2232b3333dd..7f6121fb07d 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1598,21 +1598,19 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } // Inventory - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - if (!empty($conf->stock->enabled)) { - $langs->load("stocks"); - if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); - } - } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); - } + if (!empty($conf->stock->enabled)) { + $langs->load("stocks"); + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); + } + } else { + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); } } } From cac63ddd3fcd64e39df0431c562cb78684be52ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Jun 2021 12:16:11 +0200 Subject: [PATCH 256/739] Add missing translation --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index cbc94b4481c..598eec1fdca 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -3,6 +3,7 @@ Language_am_ET=Ethiopian Language_ar_AR=Arabic Language_ar_EG=Arabic (Egypt) Language_ar_SA=Arabic +Language_ar_TN=Arabic (Tunisia) Language_az_AZ=Azerbaijani Language_bn_BD=Bengali Language_bn_IN=Bengali (India) From e64c27e1c308f1157f24442020aad31f22a2f111 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 8 Jun 2021 10:27:33 +0200 Subject: [PATCH 257/739] FIX : need to add payment sum to getlibstatus function in object linked block --- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index a02a0fc1682..1e18eb6bfeb 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -85,7 +85,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) } } print ''; - print ''.$objectlink->getLibStatut(3).''; + print ''.$objectlink->getLibStatut(3, $objectlink->getSommePaiement()).''; print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } From b1c3a7cf4864ff8568569c0f1926c2f6cd590c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 10:38:34 +0200 Subject: [PATCH 258/739] avoid fatal error --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 60e5d4eb52a..8f5ac173d7f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3208,7 +3208,7 @@ if ($action == 'create') $facids = $facturestatic->list_qualified_avoir_invoices($soc->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit; } $optionsav = ""; @@ -3656,7 +3656,7 @@ if ($action == 'create') $result = $object->fetch($id, $ref); if ($result <= 0) { - dol_print_error($db, $object->error); + dol_print_error($db, $object->error, $object->errors); exit(); } From 37433ffee7cfa54ba9d6e268e95a599635bf25c1 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 8 Jun 2021 11:39:04 +0200 Subject: [PATCH 259/739] verify vat change to update multiprice --- htdocs/product/price.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index dd56aa42318..27d39779338 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -349,6 +349,7 @@ if (empty($reshook)) $newprice = price2num($newprice, 'MU'); $newprice_min = price2num($val['price_min'], 'MU'); + $newvattx = price2num($val['vat_tx'], 'MU'); if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) { setEventMessages($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), null, 'errors'); @@ -356,11 +357,10 @@ if (empty($reshook)) break; } - if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type']) + if ($object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code']); else $res = 0; - if ($res < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); From 7e95c5ec207ee1c07349dbdb8e846671c4837f28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jun 2021 11:40:50 +0200 Subject: [PATCH 260/739] Clean code --- htdocs/product/card.php | 87 +++++++++++++++-------------- htdocs/product/composition/card.php | 12 +++- htdocs/product/stock/product.php | 12 +++- htdocs/variants/combinations.php | 19 +++++-- 4 files changed, 79 insertions(+), 51 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 61568a5510a..1b732cd721e 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1974,14 +1974,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print '
'; - print ''; + print '
'; // Type if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); print ''; } @@ -1996,7 +1996,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; } print '
'; print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); - print ''; + print ''; print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); print '
id.'">'.img_edit($langs->trans('Edit'), 1).'
'; - print ''; + print ''; if ($action == 'editbarcodetype' || $action == 'editbarcode') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); @@ -2022,7 +2022,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'id.'">'.img_edit($langs->trans('Edit'), 1).''; } print ''; - print ''; + print ''; if ($action == 'editbarcode') { $tmpcode = GETPOSTISSET('barcode') ? GETPOST('barcode') : $object->barcode; if (empty($tmpcode) && !empty($modBarCodeProduct->code_auto)) { @@ -2042,10 +2042,25 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''."\n"; } + // Batch number management (to batch) + if (!empty($conf->productbatch->enabled)) { + if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + print ''.$langs->trans("ManageLotSerial").''; + print $object->getLibStatut(0, 2); + print ''; + if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') + || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { + print ''.$langs->trans("ManageLotMask").''; + print $object->batch_mask; + print ''; + } + } + } + // Accountancy sell code print ''; print $langs->trans("ProductAccountancySellCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_sell)) { $accountingaccount = new AccountingAccount($db); @@ -2062,7 +2077,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($mysoc->isInEEC()) { print ''; print $langs->trans("ProductAccountancySellIntraCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_sell_intra)) { $accountingaccount2 = new AccountingAccount($db); @@ -2079,7 +2094,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Accountancy sell code export print ''; print $langs->trans("ProductAccountancySellExportCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_sell_export)) { $accountingaccount3 = new AccountingAccount($db); @@ -2095,7 +2110,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Accountancy buy code print ''; print $langs->trans("ProductAccountancyBuyCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_buy)) { $accountingaccount4 = new AccountingAccount($db); @@ -2112,7 +2127,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($mysoc->isInEEC()) { print ''; print $langs->trans("ProductAccountancyBuyIntraCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_buy_intra)) { $accountingaccount5 = new AccountingAccount($db); @@ -2129,7 +2144,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Accountancy buy code export print ''; print $langs->trans("ProductAccountancyBuyExportCode"); - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (!empty($object->accountancy_code_buy_export)) { $accountingaccount6 = new AccountingAccount($db); @@ -2142,26 +2157,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ''; - // Batch number management (to batch) - if (!empty($conf->productbatch->enabled)) { - if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print ''.$langs->trans("ManageLotSerial").''; - print $object->getLibStatut(0, 2); - print ''; - if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') - || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { - print ''.$langs->trans("ManageLotMask").''; - print $object->batch_mask; - print ''; - } - } - } - // Description - print ''.$langs->trans("Description").''.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).''; + print ''.$langs->trans("Description").''.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).''; // Public URL - print ''.$langs->trans("PublicUrl").''; + print ''.$langs->trans("PublicUrl").''; print dol_print_url($object->url); print ''; @@ -2184,7 +2184,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $prodstatic->fetch($combination->fk_product_parent); // Parent product - print ''.$langs->trans("ParentProduct").''; + print ''.$langs->trans("ParentProduct").''; print $prodstatic->getNomUrl(1); print ''; } @@ -2195,11 +2195,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; print '
'; - print ''; + print '
'; if ($object->isService()) { // Duration - print ''; } else { // Nature - print ''; // Brut Weight - print ''; } } @@ -2285,10 +2286,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Custom code if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { - print ''; + print ''; // Origin country code - print ''; - print ''; + print ''.$object->lifetime.''; + print ''; } // Other attributes - $parameters = array('colspan' => ' colspan="'.(2 + (($showphoto || $showbarcode) ? 1 : 0)).'"', 'cols' => (2 + (($showphoto || $showbarcode) ? 1 : 0))); + $parameters = array(); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Categories if ($conf->categorie->enabled) { - print '"; } @@ -2315,7 +2316,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Note private if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { print ' '."\n"; - print ''."\n"; + print ''."\n"; print ' '."\n"; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index c9499bf415b..e1250f10cb3 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -200,7 +200,7 @@ print dol_get_fiche_head($head, 'subproduct', $titre, -1, $picto); if ($id > 0 || !empty($ref)) { /* - * Fiche en mode edition + * Product card */ if ($user->rights->produit->lire || $user->rights->service->lire) { $linkback = ''.$langs->trans("BackToList").''; @@ -218,6 +218,16 @@ if ($id > 0 || !empty($ref)) { print '
'.$langs->trans("Duration").''.$object->duration_value.' '; + print '
'.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); } elseif ($object->duration_value > 0) { @@ -2210,12 +2210,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; + print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; print $object->getLibFinished(); print '
'.$langs->trans("Weight").''; + print '
'.$langs->trans("Weight").''; if ($object->weight != '') { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); } else { @@ -2225,7 +2225,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Brut Length - print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; + print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; if ($object->length != '' || $object->width != '' || $object->height != '') { print $object->length; if ($object->width) { @@ -2242,7 +2242,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { // Brut Surface - print '
'.$langs->trans("Surface").''; + print '
'.$langs->trans("Surface").''; if ($object->surface != '') { print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); } else { @@ -2252,7 +2252,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { // Brut Volume - print '
'.$langs->trans("Volume").''; + print '
'.$langs->trans("Volume").''; if ($object->volume != '') { print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); } else { @@ -2263,12 +2263,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { // Net Measure - print '
'.$langs->trans("NetMeasure").''; + print '
'.$langs->trans("NetMeasure").''; if ($object->net_measure != '') { print $object->net_measure." ".measuringUnitString($object->net_measure_units); } else { print ' '; } + print '
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("Origin").''.getCountry($object->country_id, 0, $db); + print '
'.$langs->trans("Origin").''.getCountry($object->country_id, 0, $db); if (!empty($object->state_id)) { print ' - '.getState($object->state_id, 0, $db); } @@ -2297,17 +2298,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Quality Control if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { - print '
'.$langs->trans("LifeTime").''.$object->lifetime.'
'.$langs->trans("QCFrequency").''.$object->qc_frequency.'
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").''.$object->qc_frequency.'
'.$langs->trans("Categories").''; + print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); print "
'.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private) ? $object->note_private : dol_nl2br($object->note_private, 1, true)).'
'.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private) ? $object->note_private : dol_nl2br($object->note_private, 1, true)).'
'; + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print ''; + } + // Nature if ($object->type != Product::TYPE_SERVICE) { print ''; @@ -558,6 +558,10 @@ function show_stats_for_company($product, $socid) print ''; print ''; } + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product); // Note that $action and $object may have been modified by some hooks + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + print $hookmanager->resPrint; return $nblines++; } From 5131ab5199b39605745544bae20429a98883476c Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 8 Jun 2021 12:36:08 +0200 Subject: [PATCH 264/739] Fix php 7 warning : Only variables should be passed by reference --- htdocs/core/modules/modFournisseur.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index d39d67775f5..39b2f3d3237 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -489,7 +489,8 @@ class modFournisseur extends DolibarrModules case 'sellist': $tmp = ''; $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift(array_keys($tmpparam['options'])); + $array_keys = array_keys($tmpparam['options']); + if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp = array_shift($array_keys); if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter = "List:".$tmp; break; } From 1aeb91eb9a3ab439f66fb5717e3dff8de8a95b38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jun 2021 13:44:11 +0200 Subject: [PATCH 265/739] FIX entry menus that has been lost in v13 Look and feel v14 --- htdocs/compta/stats/cabyprodserv.php | 6 ++- htdocs/compta/stats/casoc.php | 9 +++-- htdocs/compta/stats/index.php | 12 ++++-- htdocs/compta/stats/supplier_turnover.php | 30 +++++++++++--- .../stats/supplier_turnover_by_prodserv.php | 6 ++- .../stats/supplier_turnover_by_thirdparty.php | 14 ++++--- htdocs/core/menus/standard/eldy.lib.php | 39 ++++++++++++++----- 7 files changed, 82 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index d48a931ca2c..83eb9ce68b9 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -391,7 +391,8 @@ if ($modecompta == 'CREANCES-DETTES') { // Category filter print ''; print ''; print '\n"; // Loop on each record - $sign = 1; $cash = $bank = $cheque = $other = 0; - $totalarray = array(); + $totalqty = 0; $cachebankaccount = array(); + $transactionspertype = array(); $amountpertype = array(); + + $totalarray = array(); while ($i < $num) { $objp = $db->fetch_object($resql); + $totalqty += $objp->qty; + + if (empty($cachebankaccount[$objp->bankid])) { $bankaccounttmp = new Account($db); $bankaccounttmp->fetch($objp->bankid); @@ -243,25 +250,42 @@ if ($resql) { $totalarray['nbfield']++; } - // Bank account - print '\n"; @@ -327,21 +351,21 @@ if ($resql) { print '
'; print '

'; - print $langs->trans("Cash").': '.price($cash).''; + print $langs->trans("Cash").' '.($transactionspertype['CASH']?'('.$transactionspertype['CASH'].')':'').': '.price($cash).''; if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) { print ' <> '.$langs->trans("Declared").': '.price($object->cash).''; } print "
"; //print '
'; - print $langs->trans("PaymentTypeCHQ").': '.price($cheque).''; + print $langs->trans("PaymentTypeCHQ").' '.($transactionspertype['CHQ']?'('.$transactionspertype['CHQ'].')':'').': '.price($cheque).''; if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) { print ' <> '.$langs->trans("Declared").': '.price($object->cheque).''; } print "
"; //print '
'; - print $langs->trans("PaymentTypeCB").': '.price($bank).''; + print $langs->trans("PaymentTypeCB").' '.($transactionspertype['CB']?'('.$transactionspertype['CB'].')':'').': '.price($bank).''; if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) { print ' <> '.$langs->trans("Declared").': '.price($object->card).''; } @@ -349,11 +373,11 @@ if ($resql) { // print '
'; if ($other) { - print ''.$langs->trans("Other").': '.price($other).""; + print ''.$langs->trans("Other").' '.($transactionspertype['OTHER']?'('.$transactionspertype['OTHER'].')':'').': '.price($other).""; print '
'; } - print $langs->trans("Total").': '.price($cash + $cheque + $bank + $other).''; + print $langs->trans("Total").' ('.$totalqty.' '.$langs->trans("Articles").') : '.price($cash + $cheque + $bank + $other).''; print '

'; print '
'; From cfa268e0d30147011abaeb6e37f629e019f261d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 04:13:57 +0200 Subject: [PATCH 276/739] Fix we must add total vat on cash fence receipts (Ticket Z) --- htdocs/compta/cashcontrol/report.php | 35 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 15345584f73..fb6e75c68c4 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -120,10 +120,9 @@ $sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CB; $sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; $sql.=")"; */ -$sql = "SELECT f.rowid as facid, f.ref, f.datef as do, pf.amount as amount, b.fk_account as bankid, cp.code, SUM(fd.qty) as qty"; -$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b,"; -$sql .= " ".MAIN_DB_PREFIX."facturedet as fd"; -$sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid AND fd.fk_facture = f.rowid"; +$sql = "SELECT f.rowid as facid, f.ref, f.datef as do, pf.amount as amount, b.fk_account as bankid, cp.code"; +$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b"; +$sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid"; $sql .= " AND f.module_source = '".$db->escape($posmodule)."'"; $sql .= " AND f.pos_source = '".$db->escape($terminalid)."'"; $sql .= " AND f.paye = 1"; @@ -145,7 +144,6 @@ if ($syear && !$smonth) { } else { dol_print_error('', 'Year not defined'); } -$sql .= " GROUP BY f.rowid, f.ref, f.datef, pf.amount, b.fk_account, cp.code"; $resql = $db->query($sql); if ($resql) { @@ -161,8 +159,8 @@ if ($resql) { print $langs->trans("CashControl")." - ".$langs->trans("Draft"); } print ""; - print $langs->trans("DateCreationShort").": ".dol_print_date($object->date_creation, 'dayhour'); - print '
'.$mysoc->name; + print $mysoc->name; + print '
'.$langs->trans("DateCreationShort").": ".dol_print_date($object->date_creation, 'dayhour'); $userauthor = $object->fk_user_valid; if (empty($userauthor)) { $userauthor = $object->fk_user_creat; @@ -201,7 +199,9 @@ if ($resql) { $cash = $bank = $cheque = $other = 0; $totalqty = 0; + $totalvat = 0; $cachebankaccount = array(); + $cacheinvoiceid = array(); $transactionspertype = array(); $amountpertype = array(); @@ -209,9 +209,7 @@ if ($resql) { while ($i < $num) { $objp = $db->fetch_object($resql); - $totalqty += $objp->qty; - - + // Load bankaccount if (empty($cachebankaccount[$objp->bankid])) { $bankaccounttmp = new Account($db); $bankaccounttmp->fetch($objp->bankid); @@ -223,14 +221,13 @@ if ($resql) { $invoicetmp->fetch($objp->facid); - /*if ($first == "yes") - { - print '
'; - print ''; - print ''; - print ''; - $first = "no"; - }*/ + if (empty($cacheinvoiceid[$objp->facid])) { + $cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments + foreach($invoicetmp->lines as $line) { + $totalqty += $line->qty; + $totalvat += $line->total_tva; + } + } print ''; @@ -378,6 +375,8 @@ if ($resql) { } print $langs->trans("Total").' ('.$totalqty.' '.$langs->trans("Articles").') : '.price($cash + $cheque + $bank + $other).''; + print '
'.$langs->trans("TotalVAT").' : '.price($totalvat).''; + // TODO Add total localtaxes. print ''; print ''; From a4f3792cec80c7f5bcc9d52f7f4a7fb79143239e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 9 Jun 2021 07:42:05 +0200 Subject: [PATCH 277/739] FIX Missing link to language file --- htdocs/user/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 40ff6625163..9b747d9c713 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -92,7 +92,7 @@ $result = restrictedArea($user, 'user', $id, 'user', $feature2); if ($user->id <> $id && !$canreaduser) accessforbidden(); // Load translation files required by page -$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks')); +$langs->loadLangs(array('users', 'companies', 'ldap', 'admin', 'hrm', 'stocks', 'other')); $object = new User($db); $extrafields = new ExtraFields($db); From a141d722ad3477f3e1afa501c727278911e6f4e0 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Wed, 9 Jun 2021 08:39:06 +0200 Subject: [PATCH 278/739] Adding hooks on product stat in order to allow to expand stat on other modules stickler-ci test corrections --- htdocs/core/lib/product.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index e87e63666ef..4b249a1cc9a 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -559,11 +559,12 @@ function show_stats_for_company($product, $socid) print ''; } $parameters = array('socid'=>$socid); - $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product,$nblines); // Note that $action and $object may have been modified by some hooks + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product, $nblines); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print $hookmanager->resPrint; + return $nblines++; } From 7317aad41f76c944b21618df2caf3346788520e8 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 9 Jun 2021 11:08:38 +0200 Subject: [PATCH 279/739] FIX: projet time spent: also restrict to X months back for update and delete --- htdocs/projet/class/task.class.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 1b64f0d9a66..e974532f545 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1465,6 +1465,17 @@ class Task extends CommonObject if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; @@ -1530,6 +1541,17 @@ class Task extends CommonObject $error = 0; + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; From c62c668c68e9456cd36864de6ecbf3c5d95af2e0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 9 Jun 2021 09:29:22 +0000 Subject: [PATCH 280/739] Fixing style errors. --- htdocs/projet/class/task.class.php | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f46869382a5..05ce98b8896 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1158,16 +1158,16 @@ class Task extends CommonObject $this->timespent_datehour = $this->timespent_date; } - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); @@ -1531,16 +1531,16 @@ class Task extends CommonObject $this->timespent_note = trim($this->timespent_note); } - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); @@ -1608,16 +1608,16 @@ class Task extends CommonObject $error = 0; - if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); - if ($this->timespent_date < $restrictBefore) { - $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); - $this->errors[] = $this->error; - return -1; - } - } + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } $this->db->begin(); From 4b6fb7dd47eec16fba08c9e0da51d3ec1a974864 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 9 Jun 2021 12:26:28 +0200 Subject: [PATCH 281/739] FIX : auto rounding on "_FORMATED_" tags --- htdocs/core/lib/functions.lib.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4d450768fe7..51b7442defe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6453,11 +6453,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; - $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? ($object->total_ht ? price($object->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, 0, -1, $conf->currency) : ($object->total_tva ? price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency) : null)) : ''; - if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; - if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? ($object->total_ttc ? price($object->total_ttc, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? ($object->total_ht ? price($object->total_ht, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, -1, -1, $conf->currency) : ($object->total_tva ? price($object->total_tva, 0, $outputlangs, 0, 0, -1, $conf->currency) : null)) : ''; + if ($onlykey != 2 || $mysoc->useLocalTax(1)) $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? ($object->total_localtax1 ? price($object->total_localtax1, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; + if ($onlykey != 2 || $mysoc->useLocalTax(2)) $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? ($object->total_localtax2 ? price($object->total_localtax2, 0, $outputlangs, 0, -1, -1, $conf->currency) : null) : ''; // TODO Add keys for foreign multicurrency From 5d9aa40065c68cb5f837570b1d229f119ffeca81 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 9 Jun 2021 12:40:34 +0200 Subject: [PATCH 282/739] FIX: holiday list: bad right for mass deletion --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 18df214f4c6..7e77ef45d35 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -381,7 +381,7 @@ if ($resql) //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); - if ($user->rights->holiday->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($user->rights->holiday->delete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); From c375668ab6d87612490377787ac5a233196ef11d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 12:41:53 +0200 Subject: [PATCH 283/739] Clean code --- htdocs/admin/system/security.php | 2 +- htdocs/core/lib/geturl.lib.php | 7 +++++-- test/phpunit/SecurityTest.php | 11 ++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index e972581beaa..5214808985d 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -277,7 +277,7 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') { print '
'; -print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? ''.$langs->trans("Undefined").'' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."
"; +print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? ''.$langs->trans("Undefined").'   ('.$langs->trans("Example").': static-ips-of-server - '.$langs->trans("Note").': common loopback ip like 127.*.*.*, [::1] are already added)' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."
"; print '
'; print 'MAIN_ALLOW_SVG_FILES_AS_IMAGES = '.(empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES) ? '0   ('.$langs->trans("Recommanded").': 0)' : $conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)."
"; diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index 9feddb6f7f5..f87e7b7b4cd 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -24,7 +24,9 @@ /** * Function to get a content from an URL (use proxy if proxy defined). * Support Dolibarr setup for timeout and proxy. - * Enhancement of CURL to add an anti SSRF protection. + * Enhancement of CURL to add an anti SSRF protection: + * - you can set MAIN_SECURITY_ANTI_SSRF_SERVER_IP to set static ip of server + * - common local lookup ips like 127.*.*.* are automatically added * * @param string $url URL to call. * @param string $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE' @@ -199,12 +201,13 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = } } if ($localurl == 1) { // Only local url allowed (dangerous, may allow to get metadata on server or make internal port scanning) + // Deny ips NOT like 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 0.0.0.0/8, 169.254.0.0/16, 127.0.0.0/8 et 240.0.0.0/4, ::1/128, ::/128, ::ffff:0:0/96, fe80::/10... if (filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { $info['http_code'] = 400; $info['content'] = 'Error bad hostname '.$iptocheck.'. Must be a local URL.'; break; } - if (!empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) && !in_array($iptocheck, explode(',', '127.0.0.1,::1,'.$conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP))) { + if (!empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) && !in_array($iptocheck, explode(',', $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP))) { $info['http_code'] = 400; $info['content'] = 'Error bad hostname IP (IP is not a local IP defined into list MAIN_SECURITY_SERVER_IP). Must be a local URL in allowed list.'; break; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 944d4f4cbe5..f889a6c542b 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -703,17 +703,22 @@ class SecurityTest extends PHPUnit\Framework\TestCase $url = 'http://127.0.0.1'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL + + $url = 'http://127.0.2.1'; + $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL + print __METHOD__." url=".$url."\n"; + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL $url = 'https://169.254.0.1'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL $url = 'http://[::1]'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because localtest.me is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL /*$url = 'localtest.me'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL From 14e3d04e25eceb52baafa43202f69759bf08717e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:02:17 +0200 Subject: [PATCH 284/739] Add more info on security page --- htdocs/admin/system/security.php | 14 ++++++++++++++ htdocs/langs/en_US/admin.lang | 6 ++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 5214808985d..b076cd020be 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -245,8 +245,22 @@ if (empty($dolibarr_main_restrict_ip)) { print ''.$langs->trans("None").''; //print ' ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')'; } + print '
'; +if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) { + print '$dolibarr_main_db_pass: '; + if (!empty($dolibarr_main_db_pass) && !preg_match('/^crypted:/', $dolibarr_main_db_pass)) { + print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").'   ('.$langs->trans("Recommanded").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')'; + //print ' ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')'; + } else { + print img_picto('', 'tick').' '.$langs->trans(""); + } + + print '
'; +} + + // Menu security diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b7618f64739..5ae901dc7b2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -221,8 +221,8 @@ NotCompatible=This module does not seem compatible with your Dolibarr %s (Min %s CompatibleAfterUpdate=This module requires an update to your Dolibarr %s (Min %s - Max %s). SeeInMarkerPlace=See in Market place SeeSetupOfModule=See setup of module %s +SetOptionTo=Set option %s to %s Updated=Updated -Nouveauté=Novelty AchatTelechargement=Buy / Download GoModuleSetupArea=To deploy/install a new module, go to the Module setup area: %s. DoliStoreDesc=DoliStore, the official market place for Dolibarr ERP/CRM external modules @@ -2141,4 +2141,6 @@ ModuleUpdateAvailable=An update is available NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. -RandomlySelectedIfSeveral=Randomly selected if several pictures are available \ No newline at end of file +RandomlySelectedIfSeveral=Randomly selected if several pictures are available +DatabasePasswordObfuscated=Database password obfucated in conf file +DatabasePasswordNotObfuscated=Database password obfucated in conf file From a78d29bb710cd913c6de7853a4c3f1a35645b3a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:05:32 +0200 Subject: [PATCH 285/739] Fix trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 5ae901dc7b2..2939d93b0c6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1191,7 +1191,7 @@ SetupDescription4=%s -> %s

This software is a suite of m SetupDescription5=Other Setup menu entries manage optional parameters. AuditedSecurityEvents=Security events that are audited NoSecurityEventsAreAduited=No security events are audited. You can enable them from menu %s -Audit=Audit +Audit=Security events InfoDolibarr=About Dolibarr InfoBrowser=About Browser InfoOS=About OS From 997674aebc8af3e4d3042096ff3f9ab8f86b82cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:15:47 +0200 Subject: [PATCH 286/739] Fix trans --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2939d93b0c6..ef97369f040 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2142,5 +2142,5 @@ NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. RandomlySelectedIfSeveral=Randomly selected if several pictures are available -DatabasePasswordObfuscated=Database password obfucated in conf file -DatabasePasswordNotObfuscated=Database password obfucated in conf file +DatabasePasswordObfuscated=Database password is obfuscated in conf file +DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file From 458ef9f8daacc73830ae7f481dc10e05a8682061 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:31:00 +0200 Subject: [PATCH 287/739] Fix security test --- htdocs/admin/system/security.php | 4 ++-- htdocs/filefunc.inc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b076cd020be..85ad40775d2 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -250,11 +250,11 @@ print '
'; if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) { print '$dolibarr_main_db_pass: '; - if (!empty($dolibarr_main_db_pass) && !preg_match('/^crypted:/', $dolibarr_main_db_pass)) { + if (!empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) { print img_picto('', 'warning').' '.$langs->trans("DatabasePasswordNotObfuscated").'   ('.$langs->trans("Recommanded").': '.$langs->trans("SetOptionTo", $langs->transnoentitiesnoconv("MainDbPasswordFileConfEncrypted"), yn(1)).')'; //print ' ('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')'; } else { - print img_picto('', 'tick').' '.$langs->trans(""); + print img_picto('', 'tick').' '.$langs->trans("DatabasePasswordObfuscated"); } print '
'; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 2c7795b9ac8..777fde21885 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -349,7 +349,7 @@ if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_ if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) { $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); - $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted + $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this so we can use it later to know the password was initially crypted } else { $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); } From e915e3403c8030d3dc8c98f064f309af09d966b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:36:37 +0200 Subject: [PATCH 288/739] Trans --- htdocs/langs/fr_FR/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index e9b5ddf5c4e..ecaa4b6e600 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1584,7 +1584,7 @@ NotInstalled=Non installé. NotSlowedDownByThis=Non ralenti par cela. NotRiskOfLeakWithThis=Pas de risque de fuite de données avec cela. ApplicativeCache=Cache applicatif -MemcachedNotAvailable=Aucun cache applicatif trouvé. Vous pouvez accélérer les performances de Dolibarr en installant un serveur de cache Memcached et un module de cache applicatif exploitant ce serveur.
Plus d'info icihttps://wiki.dolibarr.org/index.php/Module_MemCached.
Notez que de nombreux hébergeurs low-cost ne fournissent pas de tels serveurs de cache dans leur infrastructure. +MemcachedNotAvailable=Aucun cache applicatif trouvé. Vous pouvez accélérer les performances de Dolibarr en installant un serveur de cache Memcached et un module de cache applicatif exploitant ce serveur.
Plus d'info ici https://wiki.dolibarr.org/index.php/Module_MemCached.
Notez que de nombreux hébergeurs low-cost ne fournissent pas de tels serveurs de cache dans leur infrastructure. MemcachedModuleAvailableButNotSetup=Le module memcached pour le cache applicatif a été trouvé mais la configuration de ce module n'est pas complète. MemcachedAvailableAndSetup=Le module memcached dédié à l'utilisation du serveur de cache memcached est activé. OPCodeCache=Cache OPCode From d4ca6bf42a358b96982ce8f29adab250956ff1ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 13:56:03 +0200 Subject: [PATCH 289/739] Clean code --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 85ad40775d2..3e01a99cb61 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -228,7 +228,7 @@ print '
'; print '
'; print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder'); -print '$dolibarr_main_prod: '.$dolibarr_main_prod; +print '$dolibarr_main_prod: '.($dolibarr_main_prod ? $dolibarr_main_prod : '0'); if (empty($dolibarr_main_prod)) { print '   '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1); } From 0a23cf029d8460dea8c802ad0014e830d23c3b30 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Wed, 9 Jun 2021 14:13:50 +0200 Subject: [PATCH 290/739] using strlen instead of count --- htdocs/core/class/CSMSFile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index a02f00fbac9..1ea2434a27f 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -75,7 +75,7 @@ class CSMSFile return -1; } - dol_syslog("CSMSFile::CSMSFile: MAIN_SMS_SENDMODE=".$conf->global->MAIN_SMS_SENDMODE." charset=".$conf->file->character_set_client." from=".$from.", to=".$to.", msg length=".count($msg), LOG_DEBUG); + dol_syslog("CSMSFile::CSMSFile: MAIN_SMS_SENDMODE=".$conf->global->MAIN_SMS_SENDMODE." charset=".$conf->file->character_set_client." from=".$from.", to=".$to.", msg length=".strlen($msg), LOG_DEBUG); dol_syslog("CSMSFile::CSMSFile: deferred=".$deferred." priority=".$priority." class=".$class, LOG_DEBUG); // Action according to choosed sending method From fb46ece9061a87bc289e1998d234a559a5c32565 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 15:36:47 +0200 Subject: [PATCH 291/739] Fix yogosha 6347 --- htdocs/accountancy/admin/categories_list.php | 2 +- .../class/accountancycategory.class.php | 4 +- .../class/accountingaccount.class.php | 4 +- .../accountancy/class/bookkeeping.class.php | 4 +- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/adherents/class/adherent.class.php | 6 +-- .../adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/class/api_members.class.php | 6 +-- htdocs/adherents/class/subscription.class.php | 8 ++-- htdocs/api/class/api_setup.class.php | 10 ++-- htdocs/asset/class/asset_type.class.php | 4 +- htdocs/bom/class/bom.class.php | 4 +- htdocs/bookmarks/bookmarks.lib.php | 2 +- htdocs/bookmarks/list.php | 2 +- htdocs/categories/class/categorie.class.php | 6 +-- htdocs/comm/action/class/actioncomm.class.php | 4 +- htdocs/comm/action/index.php | 4 +- htdocs/comm/action/pertype.php | 2 +- htdocs/comm/action/peruser.php | 4 +- htdocs/comm/contact.php | 8 ---- htdocs/comm/propal/class/propal.class.php | 10 ++-- htdocs/comm/propal/index.php | 8 ++-- htdocs/comm/propal/list.php | 12 ++--- htdocs/comm/prospect/index.php | 8 ++-- htdocs/commande/class/commande.class.php | 10 ++-- htdocs/commande/customer.php | 3 -- htdocs/commande/index.php | 8 ++-- htdocs/commande/list.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/class/account.class.php | 4 +- .../bank/class/api_bankaccounts.class.php | 2 +- htdocs/compta/bank/line.php | 2 +- htdocs/compta/bank/releve.php | 2 +- htdocs/compta/bank/various_payment/list.php | 10 ++-- htdocs/compta/clients.php | 20 +++----- .../facture/class/api_invoices.class.php | 2 +- .../facture/class/facture-rec.class.php | 16 +++---- htdocs/compta/facture/class/facture.class.php | 6 +-- htdocs/compta/facture/list.php | 12 ++--- htdocs/compta/index.php | 6 +-- .../compta/localtax/class/localtax.class.php | 2 +- htdocs/compta/localtax/index.php | 4 +- htdocs/compta/paiement/cheque/card.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/tovalidate.php | 2 +- .../class/bonprelevement.class.php | 2 +- .../class/rejetprelevement.class.php | 6 +-- htdocs/compta/prelevement/fiche-rejet.php | 6 +-- htdocs/compta/recap-compta.php | 2 +- htdocs/compta/resultat/clientfourn.php | 2 +- htdocs/compta/sociales/list.php | 6 +-- htdocs/compta/stats/cabyuser.php | 2 +- htdocs/compta/stats/index.php | 2 +- htdocs/compta/stats/supplier_turnover.php | 4 +- .../stats/supplier_turnover_by_thirdparty.php | 2 +- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/compta/tva/list.php | 6 +-- htdocs/contact/class/contact.class.php | 16 +++---- htdocs/contact/list.php | 12 ++--- htdocs/contrat/class/contrat.class.php | 8 ++-- htdocs/contrat/index.php | 2 +- htdocs/contrat/list.php | 8 ++-- htdocs/contrat/services_list.php | 2 +- htdocs/core/class/commonobject.class.php | 26 +++++----- htdocs/core/class/discount.class.php | 2 +- htdocs/core/class/extrafields.class.php | 6 +-- htdocs/core/class/html.form.class.php | 12 ++--- .../core/class/html.formaccounting.class.php | 2 +- .../class/html.formintervention.class.php | 4 +- htdocs/core/class/html.formmail.class.php | 6 +-- .../class/html.formsocialcontrib.class.php | 2 +- htdocs/core/class/infobox.class.php | 8 ++-- htdocs/core/class/menubase.class.php | 4 +- htdocs/core/class/notify.class.php | 10 ++-- htdocs/core/lib/agenda.lib.php | 4 +- htdocs/core/lib/company.lib.php | 8 ++-- htdocs/core/lib/fourn.lib.php | 2 +- htdocs/core/lib/invoice.lib.php | 8 ++-- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/lib/ticket.lib.php | 2 +- htdocs/core/lib/usergroups.lib.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 6 +-- .../core/modules/mailings/pomme.modules.php | 2 +- .../modules/mailings/thirdparties.modules.php | 6 +-- .../thirdparties_services_expired.modules.php | 2 +- .../movement/doc/pdf_standard.modules.php | 4 +- .../doc/doc_generic_project_odt.modules.php | 2 +- .../task/doc/doc_generic_task_odt.modules.php | 2 +- .../modules/rapport/pdf_paiement.class.php | 2 +- .../stock/doc/pdf_standard.modules.php | 2 +- .../class/actions_datapolicy.class.php | 2 +- htdocs/don/class/api_donations.class.php | 2 +- htdocs/don/class/don.class.php | 8 ++-- htdocs/ecm/class/ecmfiles.class.php | 2 +- .../conferenceorboothattendee_list.php | 2 +- htdocs/expedition/card.php | 2 +- .../expedition/class/api_shipments.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 6 +-- .../class/expeditionbatch.class.php | 2 +- htdocs/expedition/list.php | 8 ++-- htdocs/expedition/shipment.php | 2 +- .../class/expensereport.class.php | 28 +++++------ htdocs/fichinter/card-rec.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 4 +- .../class/api_supplier_invoices.class.php | 2 +- .../fourn/class/api_supplier_orders.class.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 12 ++--- .../fourn/class/fournisseur.product.class.php | 8 ++-- htdocs/fourn/commande/index.php | 6 +-- htdocs/fourn/commande/list.php | 8 ++-- htdocs/fourn/contact.php | 2 +- htdocs/fourn/facture/list.php | 4 +- htdocs/fourn/index.php | 4 +- htdocs/fourn/product/list.php | 4 +- htdocs/fourn/recap-fourn.php | 2 +- htdocs/holiday/class/holiday.class.php | 4 +- htdocs/hrm/class/establishment.class.php | 8 ++-- htdocs/hrm/index.php | 4 +- htdocs/install/upgrade2.php | 18 +++---- htdocs/intracommreport/list.php | 4 +- .../knowledgemanagementindex.php | 2 +- htdocs/loan/class/loan.class.php | 6 +-- htdocs/margin/agentMargins.php | 4 +- htdocs/margin/tabs/productMargins.php | 2 +- .../template/class/api_mymodule.class.php | 4 +- .../modulebuilder/template/mymoduleindex.php | 2 +- htdocs/mrp/class/api_mos.class.php | 4 +- .../class/opensurveysondage.class.php | 6 +-- .../class/partnershiputils.class.php | 4 +- htdocs/partnership/partnershipindex.php | 2 +- htdocs/product/ajax/products.php | 4 +- .../product/actions_card_product.class.php | 8 ++-- .../service/actions_card_service.class.php | 18 +++---- htdocs/product/class/api_products.class.php | 4 +- htdocs/product/class/product.class.php | 48 +++++++++---------- htdocs/product/class/productbatch.class.php | 6 +-- .../class/propalmergepdfproduct.class.php | 4 +- .../class/price_global_variable.class.php | 2 +- .../price_global_variable_updater.class.php | 8 ++-- htdocs/product/index.php | 6 +-- htdocs/product/list.php | 2 +- htdocs/product/popuprop.php | 2 +- htdocs/product/reassort.php | 2 +- htdocs/product/reassortlot.php | 2 +- htdocs/product/stats/bom.php | 7 ++- htdocs/product/stats/commande.php | 4 +- htdocs/product/stats/commande_fournisseur.php | 4 +- htdocs/product/stats/contrat.php | 2 +- htdocs/product/stats/facture.php | 2 +- htdocs/product/stats/facture_fournisseur.php | 2 +- htdocs/product/stats/mo.php | 2 +- htdocs/product/stats/propal.php | 2 +- htdocs/product/stats/supplier_proposal.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/product/stock/class/entrepot.class.php | 6 +-- htdocs/product/stock/product.php | 2 +- htdocs/product/stock/stockatdate.php | 4 +- htdocs/projet/activity/index.php | 2 +- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/projet/class/project.class.php | 20 ++++---- htdocs/projet/class/projectstats.class.php | 4 +- htdocs/projet/class/task.class.php | 14 +++--- htdocs/projet/index.php | 2 +- htdocs/projet/list.php | 6 +-- htdocs/projet/tasks/list.php | 9 +--- htdocs/projet/tasks/time.php | 2 +- .../public/emailing/mailing-unsubscribe.php | 2 +- htdocs/reception/card.php | 4 +- htdocs/reception/index.php | 6 +-- htdocs/reception/list.php | 4 +- htdocs/recruitment/recruitmentindex.php | 2 +- htdocs/resource/class/dolresource.class.php | 6 +-- htdocs/salaries/class/salary.class.php | 6 +-- htdocs/salaries/list.php | 4 +- htdocs/salaries/payments.php | 2 +- htdocs/societe/class/api_contacts.class.php | 2 +- .../societe/class/api_thirdparties.class.php | 6 +-- .../class/companybankaccount.class.php | 4 +- htdocs/societe/class/societe.class.php | 8 ++-- htdocs/societe/list.php | 10 ++-- htdocs/societe/notify/card.php | 12 ++--- htdocs/societe/paymentmodes.php | 4 +- .../class/supplier_proposal.class.php | 6 +-- htdocs/supplier_proposal/index.php | 4 +- htdocs/supplier_proposal/list.php | 2 +- htdocs/takepos/floors.php | 2 +- htdocs/takepos/invoice.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 4 +- htdocs/ticket/class/ticket.class.php | 5 +- htdocs/user/class/api_users.class.php | 2 +- htdocs/user/class/user.class.php | 6 +-- htdocs/user/class/usergroup.class.php | 12 ++--- htdocs/user/list.php | 2 +- htdocs/webservices/server_invoice.php | 2 +- htdocs/webservices/server_order.php | 2 +- .../webservices/server_productorservice.php | 6 +-- .../webservices/server_supplier_invoice.php | 2 +- htdocs/webservices/server_thirdparty.php | 6 +-- 199 files changed, 507 insertions(+), 533 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index c5091ef4207..9a8a84893fe 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -444,7 +444,7 @@ if ($search_country_id > 0) { } else { $sql .= " WHERE "; } - $sql .= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)"; + $sql .= " (a.fk_country = ".((int) $search_country_id)." OR a.fk_country = 0)"; } // If sort order is "country", we use country_code instead diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index d8e1598d1ac..aa200c770e4 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -675,7 +675,7 @@ class AccountancyCategory // extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; $sql .= " WHERE c.active = 1"; $sql .= " AND c.entity = ".$conf->entity; - $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; + $sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)"; $sql .= " AND cat.rowid = t.fk_accounting_category"; $sql .= " AND t.entity = ".$conf->entity; $sql .= " ORDER BY cat.position ASC"; @@ -806,7 +806,7 @@ class AccountancyCategory // extends CommonObject if ($categorytype >= 0) { $sql .= " AND c.category_type = 1"; } - $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; + $sql .= " AND (c.fk_country = ".((int) $mysoc->country_id)." OR c.fk_country = 0)"; $sql .= " ORDER BY c.position ASC"; $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 28601380ac1..99a0dc0dc48 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -602,7 +602,7 @@ class AccountingAccount extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account "; $sql .= "SET ".$fieldtouse." = '0'"; - $sql .= " WHERE rowid = ".$this->db->escape($id); + $sql .= " WHERE rowid = ".((int) $id); dol_syslog(get_class($this)."::accountDeactivate ".$fieldtouse." sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); @@ -640,7 +640,7 @@ class AccountingAccount extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account"; $sql .= " SET ".$fieldtouse." = '1'"; - $sql .= " WHERE rowid = ".$this->db->escape($id); + $sql .= " WHERE rowid = ".((int) $id); dol_syslog(get_class($this)."::account_activate ".$fieldtouse." sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 3594bb26fc8..97ad7767be5 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -294,7 +294,7 @@ class BookKeeping extends CommonObject $sql = "SELECT count(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; - $sql .= " AND fk_doc = ".$this->fk_doc; + $sql .= " AND fk_doc = ".((int) $this->fk_doc); if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { // DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries. $sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines @@ -312,7 +312,7 @@ class BookKeeping extends CommonObject $sqlnum = "SELECT piece_num"; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sqlnum .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; // For example doc_type = 'bank' - $sqlnum .= " AND fk_doc = ".$this->fk_doc; + $sqlnum .= " AND fk_doc = ".((int) $this->fk_doc); if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ... $sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 76984d55fba..32670b15575 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1320,7 +1320,7 @@ function getSourceDocRef($val, $typerecord) if ($typerecord == 'payment') { $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; - $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"]; + $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".((int) $val["paymentid"]); $ref = $langs->transnoentitiesnoconv("Invoice"); } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4c0c602cbc1..91f01d19f89 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -598,8 +598,8 @@ class Adherent extends CommonObject if ($this->user_id) { // Add link to user $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; - $sql .= " fk_member = ".$this->id; - $sql .= " WHERE rowid = ".$this->user_id; + $sql .= " fk_member = ".((int) $this->id); + $sql .= " WHERE rowid = ".((int) $this->user_id); dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { @@ -728,7 +728,7 @@ class Adherent extends CommonObject if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) { $sql2 = "SELECT libelle as label"; $sql2 .= " FROM ".MAIN_DB_PREFIX."adherent_type"; - $sql2 .= " WHERE rowid = ".$this->typeid; + $sql2 .= " WHERE rowid = ".((int) $this->typeid); $resql2 = $this->db->query($sql2); if ($resql2) { while ($obj = $this->db->fetch_object($resql2)) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0104f8f36e8..1cb9fcdb12c 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -362,7 +362,7 @@ class AdherentType extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; $sql .= "SET "; - $sql .= "statut = ".$this->status.","; + $sql .= "statut = ".((int) $this->status).","; $sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',"; diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 5573961456f..d57a01510d4 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -228,12 +228,12 @@ class Members extends DolibarrApi } $sql .= ' WHERE t.entity IN ('.getEntity('adherent').')'; if (!empty($typeid)) { - $sql .= ' AND t.fk_adherent_type='.$typeid; + $sql .= ' AND t.fk_adherent_type='.((int) $typeid); } // Select members of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category); - $sql .= " AND c.fk_member = t.rowid "; + $sql .= " AND c.fk_categorie = ".((int) $category); + $sql .= " AND c.fk_member = t.rowid"; } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 1285b12b2d0..bb5cdd20bd5 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -267,14 +267,14 @@ class Subscription extends CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; - $sql .= " fk_type = ".$this->fk_type.","; - $sql .= " fk_adherent = ".$this->fk_adherent.","; + $sql .= " fk_type = ".((int) $this->fk_type).","; + $sql .= " fk_adherent = ".((int) $this->fk_adherent).","; $sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " subscription = ".price2num($this->amount).","; $sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datec='".$this->db->idate($this->datec)."',"; - $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null'); + $sql .= " fk_bank = ".($this->fk_bank ? ((int) $this->fk_bank) : 'null'); $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -341,7 +341,7 @@ class Subscription extends CommonObject } if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 15d31140874..1f59762c865 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -200,7 +200,7 @@ class Setup extends DolibarrApi $sql = "SELECT id, code, type, libelle as label, module"; $sql .= " FROM ".MAIN_DB_PREFIX."c_paiement as t"; $sql .= " WHERE t.entity IN (".getEntity('c_paiement').")"; - $sql .= " AND t.active = ".$active; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { @@ -1055,7 +1055,7 @@ class Setup extends DolibarrApi $sql = "SELECT rowid AS id, zip, town, fk_county, fk_pays AS fk_country"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ziptown as t"; - $sql .= " AND t.active = ".$active; + $sql .= " AND t.active = ".((int) $active); if ($zipcode) { $sql .= " AND t.zip LIKE '%".$this->db->escape($zipcode)."%'"; } @@ -1125,7 +1125,7 @@ class Setup extends DolibarrApi $sql = "SELECT rowid as id, code, sortorder, libelle as label, libelle_facture as descr, type_cdr, nbjour, decalage, module"; $sql .= " FROM ".MAIN_DB_PREFIX."c_payment_term as t"; $sql .= " WHERE t.entity IN (".getEntity('c_payment_term').")"; - $sql .= " AND t.active = ".$active; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { @@ -1183,7 +1183,7 @@ class Setup extends DolibarrApi $sql = "SELECT rowid as id, code, libelle as label, description, tracking, module"; $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; $sql .= " WHERE t.entity IN (".getEntity('c_shipment_mode').")"; - $sql .= " AND t.active = ".$active; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { @@ -1307,7 +1307,7 @@ class Setup extends DolibarrApi $sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t"; $sql .= " WHERE t.entity IN (".getEntity('c_socialnetworks').")"; - $sql .= " AND t.active = ".$active; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index 36c654c28ba..335cd63115a 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -332,7 +332,7 @@ class AssetType extends CommonObject /** * Return array of Asset objects for asset type this->id (or all if this->id not defined) * - * @param string $excludefilter Filter to exclude. This parameter must not be provided by input of users + * @param string $excludefilter Filter string to exclude. This parameter must not be provided by input of users * @param int $mode 0=Return array of asset instance * 1=Return array of asset instance without extra data * 2=Return array of asset id only @@ -347,7 +347,7 @@ class AssetType extends CommonObject $sql = "SELECT a.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."asset as a"; $sql .= " WHERE a.entity IN (".getEntity('asset').")"; - $sql .= " AND a.fk_asset_type = ".$this->id; + $sql .= " AND a.fk_asset_type = ".((int) $this->id); if (!empty($excludefilter)) { $sql .= ' AND ('.$excludefilter.')'; } diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 220c724ad89..728bdef6cf6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -614,8 +614,8 @@ class BOM extends CommonObject $sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " status = ".self::STATUS_VALIDATED.","; $sql .= " date_valid='".$this->db->idate($now)."',"; - $sql .= " fk_user_valid = ".$user->id; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " fk_user_valid = ".((int) $user->id); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::validate()", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 199944165b4..a977ae57fbc 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -80,7 +80,7 @@ function printDropdownBookmarksList() // Menu with list of bookmarks $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; - $sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)"; + $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)"; $sql .= " AND entity IN (".getEntity('bookmarks').")"; $sql .= " ORDER BY position"; if ($resql = $db->query($sql)) { diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 7d644d3a103..17be6be9cef 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -98,7 +98,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b LEFT JOIN ".MAIN_DB_PREFIX."user $sql .= " WHERE 1=1"; $sql .= " AND b.entity IN (".getEntity('bookmark').")"; if (!$user->admin) { - $sql .= " AND (b.fk_user = ".$user->id." OR b.fk_user is NULL OR b.fk_user = 0)"; + $sql .= " AND (b.fk_user = ".((int) $user->id)." OR b.fk_user is NULL OR b.fk_user = 0)"; } $sql .= $db->order($sortfield.", position", $sortorder); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5f30a96c9c1..b98cff5b3a5 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -774,7 +774,7 @@ class Categorie extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]); $sql .= " WHERE fk_categorie = ".$this->id; - $sql .= " AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".$obj->id; + $sql .= " AND fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".((int) $obj->id); dol_syslog(get_class($this).'::del_type', LOG_DEBUG); if ($this->db->query($sql)) { @@ -1303,7 +1303,7 @@ class Categorie extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."categorie as c "; $sql .= " WHERE c.entity IN (".getEntity('category').")"; $sql .= " AND c.type = ".((int) $type); - $sql .= " AND c.fk_parent = ".$this->fk_parent; + $sql .= " AND c.fk_parent = ".((int) $this->fk_parent); $sql .= " AND c.label = '".$this->db->escape($this->label)."'"; dol_syslog(get_class($this)."::already_exists", LOG_DEBUG); @@ -1552,7 +1552,7 @@ class Categorie extends CommonObject // Generation requete recherche $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; - $sql .= " WHERE type = ".$this->MAP_ID[$type]; + $sql .= " WHERE type = ".((int) $this->MAP_ID[$type]); $sql .= " AND entity IN (".getEntity('category').")"; if ($nom) { if (!$exact) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3943a37e5a7..38acaac0fc9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1896,7 +1896,7 @@ class ActionComm extends CommonObject $userforfilter = new User($this->db); $result = $userforfilter->fetch('', $logint); if ($result > 0) { - $sql .= " AND ar.fk_element = ".$userforfilter->id; + $sql .= " AND ar.fk_element = ".((int) $userforfilter->id); } elseif ($result < 0 || $condition == '=') { $sql .= " AND ar.fk_element = 0"; } @@ -2410,7 +2410,7 @@ class ActionComm extends CommonObject // Delete also very old past events (we do not keep more than 1 month record in past) $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder"; $sql .= " WHERE dateremind < '".$this->db->idate($now - (3600 * 24 * 32))."'"; - $sql .= " AND status = ".$actionCommReminder::STATUS_DONE; + $sql .= " AND status = ".((int) $actionCommReminder::STATUS_DONE); $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 459ede423b1..465f1be8701 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -741,10 +741,10 @@ if ($status == 'todo') { if ($filtert > 0 || $usergroup > 0) { $sql .= " AND ("; if ($filtert > 0) { - $sql .= "ar.fk_element = ".$filtert; + $sql .= "ar.fk_element = ".((int) $filtert); } if ($usergroup > 0) { - $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup; + $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup); } $sql .= ")"; } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 32eaccdcce1..b39d6c3141d 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -616,7 +616,7 @@ if ($filtert > 0 || $usergroup > 0) { $sql .= "ar.fk_element = ".$filtert; } if ($usergroup > 0) { - $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup; + $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup); } $sql .= ")"; } diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 76330d39453..10d9871c4c9 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -637,7 +637,7 @@ if ($filtert > 0 || $usergroup > 0) { $sql .= "ar.fk_element = ".$filtert; } if ($usergroup > 0) { - $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup; + $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup); } $sql .= ")"; } @@ -899,7 +899,7 @@ while ($currentdaytoshow < $lastdaytoshow) { } $sql .= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user').")"; if ($usergroup > 0) { - $sql .= " AND ug.fk_usergroup = ".$usergroup; + $sql .= " AND ug.fk_usergroup = ".((int) $usergroup); } //print $sql; $resql = $db->query($sql); diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 9945ca0e186..1d74cba61cd 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -104,23 +104,15 @@ if ($type == "f") { if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } - -if (dol_strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=".$db->escape($stcomm); -} - if (!empty($search_lastname)) { $sql .= " AND p.name LIKE '%".$db->escape($search_lastname)."%'"; } - if (!empty($search_firstname)) { $sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'"; } - if (!empty($search_company)) { $sql .= " AND s.nom LIKE '%".$db->escape($search_company)."%'"; } - if (!empty($contactname)) { // acces a partir du module de recherche $sql .= " AND (p.name LIKE '%".$db->escape($contactname)."%' OR lower(p.firstname) LIKE '%".$db->escape($contactname)."%') "; $sortfield = "p.name"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c544f5f7fe9..6c670c82364 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2463,12 +2463,12 @@ class Propal extends CommonObject $error = 0; $sql = "UPDATE ".MAIN_DB_PREFIX."propal"; - $sql .= " SET fk_statut = ".$status.","; + $sql .= " SET fk_statut = ".((int) $status).","; if (!empty($note)) { $sql .= " note_private = '".$this->db->escape($note)."',"; } $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); @@ -4305,7 +4305,7 @@ class PropaleLigne extends CommonObjectLine } $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); if (!empty($this->rang)) { - $sql .= ", rang=".$this->rang; + $sql .= ", rang=".((int) $this->rang); } $sql .= ", date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null"); $sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null"); @@ -4317,7 +4317,7 @@ class PropaleLigne extends CommonObjectLine $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); @@ -4365,7 +4365,7 @@ class PropaleLigne extends CommonObjectLine $sql .= " total_ht=".price2num($this->total_ht, 'MT').""; $sql .= ",total_tva=".price2num($this->total_tva, 'MT').""; $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT').""; - $sql .= " WHERE rowid = ".$this->rowid; + $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog("PropaleLigne::update_total", LOG_DEBUG); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 3973071d1f0..7ff3e405499 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -88,7 +88,7 @@ if (!empty($conf->propal->enabled)) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND p.fk_soc = ".$socid; + $sql .= " AND p.fk_soc = ".((int) $socid); } $resql = $db->query($sql); @@ -160,7 +160,7 @@ $sql .= " WHERE c.entity IN (".getEntity($propalstatic->element).")"; $sql .= " AND c.fk_soc = s.rowid"; //$sql.= " AND c.fk_statut > 2"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -318,7 +318,7 @@ if (! empty($conf->propal->enabled)) $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_statut = 1"; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY c.rowid DESC"; @@ -393,7 +393,7 @@ if (! empty($conf->propal->enabled)) $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_statut = 2 "; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY c.rowid DESC"; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ceb945d1e72..95d461eac39 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -593,27 +593,27 @@ if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); + $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } if ($search_categ_cus == -2) { $sql .= " AND cc.fk_categorie IS NULL"; } if ($search_fk_cond_reglement > 0) { - $sql .= " AND p.fk_cond_reglement = ".$db->escape($search_fk_cond_reglement); + $sql .= " AND p.fk_cond_reglement = ".((int) $search_fk_cond_reglement); } if ($search_fk_shipping_method > 0) { - $sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method); + $sql .= " AND p.fk_shipping_method = ".((int) $search_fk_shipping_method); } if ($search_fk_input_reason > 0) { - $sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason); + $sql .= " AND p.fk_input_reason = ".((int) $search_fk_input_reason); } if ($search_fk_mode_reglement > 0) { - $sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement); + $sql .= " AND p.fk_mode_reglement = ".((int) $search_fk_mode_reglement); } if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category); + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 8883e0af6f3..d2f60c36212 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -87,7 +87,7 @@ $sql .= " WHERE s.fk_stcomm = st.id"; $sql .= " AND s.client IN (2, 3)"; $sql .= " AND s.entity IN (".getEntity($companystatic->element).")"; if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " GROUP BY st.id"; $sql .= " ORDER BY st.id"; @@ -129,7 +129,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { $sql .= " AND p.fk_soc = s.rowid"; $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $resql = $db->query($sql); @@ -191,7 +191,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { $sql .= " AND p.fk_statut = 1"; $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); @@ -250,7 +250,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " WHERE s.fk_stcomm = 1"; $sql .= " AND s.entity IN (".getEntity($companystatic->element).")"; if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } $sql .= " ORDER BY s.tms ASC"; $sql .= $db->plimit(15, 0); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c0851dfee1d..c19cc6c379f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2539,7 +2539,7 @@ class Commande extends CommonOrder $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; $sql .= " SET date_commande = ".($date ? "'".$this->db->idate($date)."'" : 'null'); - $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT; + $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".((int) self::STATUS_DRAFT); dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); @@ -4559,14 +4559,14 @@ class OrderLine extends CommonOrderLine } $sql .= " , fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "null"); $sql .= " , buy_price_ht='".price2num($this->pa_ht)."'"; - $sql .= " , info_bits=".$this->info_bits; - $sql .= " , special_code=".$this->special_code; + $sql .= " , info_bits=".((int) $this->info_bits); + $sql .= " , special_code=".((int) $this->special_code); $sql .= " , date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null"); $sql .= " , date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null"); $sql .= " , product_type=".$this->product_type; $sql .= " , fk_parent_line=".(!empty($this->fk_parent_line) ? $this->fk_parent_line : "null"); if (!empty($this->rang)) { - $sql .= ", rang=".$this->rang; + $sql .= ", rang=".((int) $this->rang); } $sql .= " , fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); @@ -4576,7 +4576,7 @@ class OrderLine extends CommonOrderLine $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - $sql .= " WHERE rowid = ".$this->rowid; + $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 6dfa898a024..62f8c4772f6 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -89,9 +89,6 @@ $sql .= " AND s.entity IN (".getEntity('societe').")"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } -if (dol_strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=".$stcomm; -} if (GETPOST("search_nom")) { $sql .= natural_search("s.nom", GETPOST("search_nom")); } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 48f1f600126..73f40668cea 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -166,7 +166,7 @@ $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; //$sql.= " AND c.fk_statut > 2"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -250,7 +250,7 @@ if (!empty($conf->commande->enabled)) { $sql .= " AND c.entity IN (".getEntity('commande').")"; $sql .= " AND c.fk_statut = ".Commande::STATUS_VALIDATED; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -337,9 +337,9 @@ if (!empty($conf->commande->enabled)) { } $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; - $sql .= " AND c.fk_statut = ".Commande::STATUS_ACCEPTED; + $sql .= " AND c.fk_statut = ".((int) Commande::STATUS_ACCEPTED); if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f42b7c08de9..98bbd00b351 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -473,7 +473,7 @@ if ($search_user > 0) { $sql .= ' WHERE c.fk_soc = s.rowid'; $sql .= ' AND c.entity IN ('.getEntity('commande').')'; if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 0a9784fce75..666621cbdd6 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1181,7 +1181,7 @@ if ($resql) { $sqlforbalance .= " ".MAIN_DB_PREFIX."bank as b"; $sqlforbalance .= " WHERE b.fk_account = ba.rowid"; $sqlforbalance .= " AND ba.entity IN (".getEntity('bank_account').")"; - $sqlforbalance .= " AND b.fk_account = ".$search_account; + $sqlforbalance .= " AND b.fk_account = ".((int) $search_account); $sqlforbalance .= " AND (b.datev < '".$db->idate($db->jdate($objp->dv))."' OR (b.datev = '".$db->idate($db->jdate($objp->dv))."' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))"; $resqlforbalance = $db->query($sqlforbalance); //print $sqlforbalance; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e629d7620f0..0d97ed69a07 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1070,7 +1070,7 @@ class Account extends CommonObject if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account"; - $sql .= " WHERE rowid = ".$this->rowid; + $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog(get_class($this)."::delete", LOG_DEBUG); $result = $this->db->query($sql); @@ -2090,7 +2090,7 @@ class AccountLine extends CommonObject $sql .= " amount = ".price2num($this->amount).","; $sql .= " datev='".$this->db->idate($this->datev)."',"; $sql .= " dateo='".$this->db->idate($this->dateo)."'"; - $sql .= " WHERE rowid = ".$this->rowid; + $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 10357155295..fd7ed1838f2 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -77,7 +77,7 @@ class BankAccounts extends DolibarrApi $sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')'; // Select accounts of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_account = t.rowid "; + $sql .= " AND c.fk_categorie = ".((int) $category)." AND c.fk_account = t.rowid"; } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index c84f52ffee1..2c33085aa6d 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -173,7 +173,7 @@ if ($user->rights->banque->modifier && $action == "update") { $sql .= " datev = '".$db->idate($dateval)."',"; } } - $sql .= " fk_account = ".$actarget->id; + $sql .= " fk_account = ".((int) $actarget->id); $sql .= " WHERE rowid = ".((int) $acline->id); $result = $db->query($sql); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index f45d2a64af4..167c809a8b1 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -606,7 +606,7 @@ if (empty($numref)) { $sql .= ", ".MAIN_DB_PREFIX."bank_class as cl"; $sql .= " WHERE ct.rowid = cl.fk_categ"; $sql .= " AND ct.entity = ".$conf->entity; - $sql .= " AND cl.lineid = ".$objp->rowid; + $sql .= " AND cl.lineid = ".((int) $objp->rowid); $resc = $db->query($sql); if ($resc) { diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index f78e004f571..dda68a096a1 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -250,19 +250,19 @@ if ($search_amount_cred) { $sql .= natural_search("v.amount", $search_amount_cred, 1); } if ($search_bank_account > 0) { - $sql .= " AND b.fk_account=".$db->escape($search_bank_account); + $sql .= " AND b.fk_account = ".((int) $search_bank_account); } if ($search_bank_entry > 0) { - $sql .= " AND b.fk_account=".$db->escape($search_bank_account); + $sql .= " AND b.fk_account = ".((int) $search_bank_account); } if ($search_accountancy_account > 0) { - $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account); + $sql .= " AND v.accountancy_code = ".((int) $search_accountancy_account); } if ($search_accountancy_subledger > 0) { - $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); + $sql .= " AND v.subledger_account = ".((int) $search_accountancy_subledger); } if ($typeid > 0) { - $sql .= " AND v.fk_typepayment=".$typeid; + $sql .= " AND v.fk_typepayment=".((int) $typeid); } if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 60924dae644..b0a4716b7e1 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -71,7 +71,7 @@ llxHeader(); $thirdpartystatic = new Societe($db); if ($action == 'note') { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($note)."' WHERE rowid=".$socid; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET note='".$db->escape($note)."' WHERE rowid=".((int) $socid); $result = $db->query($sql); } @@ -107,29 +107,21 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (dol_strlen($stcomm)) { - $sql .= " AND s.fk_stcomm=".$stcomm; + $sql .= " AND s.fk_stcomm=".((int) $stcomm); } -if ($socname) { - $sql .= natural_search("s.nom", $socname); - $sortfield = "s.nom"; - $sortorder = "ASC"; -} -if ($_GET["search_nom"]) { +if (GETPOST("search_nom")) { $sql .= natural_search("s.nom", GETPOST("search_nom")); } -if ($_GET["search_compta"]) { +if (GETPOST("search_compta")) { $sql .= natural_search("s.code_compta", GETPOST("search_compta")); } -if ($_GET["search_code_client"]) { +if (GETPOST("search_code_client")) { $sql .= natural_search("s.code_client", GETPOST("search_code_client")); } -if (dol_strlen($begin)) { - $sql .= natural_search("s.nom", $begin); -} if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } -$sql .= " ORDER BY $sortfield $sortorder "; +$sql .= " ORDER BY $sortfield $sortorder"; $sql .= $db->plimit($conf->liste_limit + 1, $offset); //print $sql; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 84b4df207a5..3dfa5f70603 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -217,7 +217,7 @@ class Invoices extends DolibarrApi } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 286b5a1ccea..7d2ffe9e022 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -470,9 +470,9 @@ class FactureRec extends CommonInvoice $error = 0; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; - $sql .= " fk_soc = ".$this->fk_soc; + $sql .= " fk_soc = ".((int) $this->fk_soc); // TODO Add missing fields - $sql .= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1136,12 +1136,12 @@ class FactureRec extends CommonInvoice $sql .= ", qty=".price2num($qty); $sql .= ", tva_tx=".price2num($txtva); $sql .= ", vat_src_code='".$this->db->escape($vat_src_code)."'"; - $sql .= ", localtax1_tx=".$txlocaltax1; + $sql .= ", localtax1_tx=".((float) $txlocaltax1); $sql .= ", localtax1_type='".$this->db->escape($localtaxes_type[0])."'"; - $sql .= ", localtax2_tx=".$txlocaltax2; + $sql .= ", localtax2_tx=".((float) $txlocaltax2); $sql .= ", localtax2_type='".$this->db->escape($localtaxes_type[2])."'"; $sql .= ", fk_product=".(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : "null"); - $sql .= ", product_type=".$product_type; + $sql .= ", product_type=".((int) $product_type); $sql .= ", remise_percent='".price2num($remise_percent)."'"; $sql .= ", subprice='".price2num($pu_ht)."'"; $sql .= ", total_ht='".price2num($total_ht)."'"; @@ -2124,11 +2124,11 @@ class FactureLigneRec extends CommonInvoiceLine $sql .= ", total_localtax2=".price2num($this->total_localtax2); $sql .= ", total_ttc=".price2num($this->total_ttc); } - $sql .= ", rang=".$this->rang; - $sql .= ", special_code=".$this->special_code; + $sql .= ", rang=".((int) $this->rang); + $sql .= ", special_code=".((int) $this->special_code); $sql .= ", fk_unit=".($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : "null"); $sql .= ", fk_contract_line=".($this->fk_contract_line ? $this->fk_contract_line : "null"); - $sql .= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".((int) $this->id); $this->db->begin(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 6dd67d4d931..40a14eb1711 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4105,7 +4105,7 @@ class Facture extends CommonInvoice $sql .= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait $sql .= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement if ($socid > 0) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " ORDER BY f.ref"; @@ -5594,7 +5594,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", buy_price_ht=".(($this->pa_ht || $this->pa_ht === 0 || $this->pa_ht === '0') ? price2num($this->pa_ht) : "null"); // $this->pa_ht should always be defined (set to 0 or to sell price depending on option) $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); if (!empty($this->rang)) { - $sql .= ", rang=".$this->rang; + $sql .= ", rang=".((int) $this->rang); } $sql .= ", situation_percent=".$this->situation_percent; $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit); @@ -5606,7 +5606,7 @@ class FactureLigne extends CommonInvoiceLine $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - $sql .= " WHERE rowid = ".$this->rowid; + $sql .= " WHERE rowid = ".((int) $this->rowid); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index fb4089fabec..a375bc677f2 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -546,7 +546,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category); + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid > 0) { $sql .= ' AND s.rowid = '.((int) $socid); @@ -634,7 +634,7 @@ if ($search_login) { $sql .= natural_search(array('u.login', 'u.firstname', 'u.lastname'), $search_login); } if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); + $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } if ($search_categ_cus == -2) { $sql .= " AND cc.fk_categorie IS NULL"; @@ -659,10 +659,10 @@ if ($search_status != '-1' && $search_status != '') { } if ($search_paymentmode > 0) { - $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); + $sql .= " AND f.fk_mode_reglement = ".((int) $search_paymentmode); } if ($search_paymentterms > 0) { - $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); + $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentterms); } if ($search_module_source) { $sql .= natural_search("f.module_source", $search_module_source); @@ -692,10 +692,10 @@ if ($option == 'late') { $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; } if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } if ($search_user > 0) { - $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; + $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".((int) $search_user); } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index e33ddc35610..18519955bf6 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -138,7 +138,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); @@ -283,7 +283,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND ff.fk_soc = ".$socid; + $sql .= " AND ff.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); @@ -593,7 +593,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $sql .= " AND c.fk_statut = ".Commande::STATUS_CLOSED; $sql .= " AND c.facture = 0"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index dc133977202..115dce99c9e 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -170,7 +170,7 @@ class Localtax extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; - $sql .= " localtaxtype=".$this->ltt.","; + $sql .= " localtaxtype=".((int) $this->ltt).","; $sql .= " tms='".$this->db->idate($this->tms)."',"; $sql .= " datep='".$this->db->idate($this->datep)."',"; $sql .= " datev='".$this->db->idate($this->datev)."',"; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 86fa3fe52f0..f9ea0ac02d9 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -584,7 +584,7 @@ $sql .= "SELECT SUM(amount) as mm, date_format(f.datev,'%Y-%m') as dm, 'claimed' $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f"; $sql .= " WHERE f.entity = ".$conf->entity; $sql .= " AND (f.datev >= '".$db->idate($date_start)."' AND f.datev <= '".$db->idate($date_end)."')"; -$sql .= " AND localtaxtype=".$localTaxType; +$sql .= " AND localtaxtype=".((int) $localTaxType); $sql .= " GROUP BY dm"; $sql .= " UNION "; @@ -593,7 +593,7 @@ $sql .= "SELECT SUM(amount) as mm, date_format(f.datep,'%Y-%m') as dm, 'paid' as $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f"; $sql .= " WHERE f.entity = ".$conf->entity; $sql .= " AND (f.datep >= '".$db->idate($date_start)."' AND f.datep <= '".$db->idate($date_end)."')"; -$sql .= " AND localtaxtype=".$localTaxType; +$sql .= " AND localtaxtype=".((int) $localTaxType); $sql .= " GROUP BY dm"; $sql .= " ORDER BY dm ASC, mode ASC"; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 04eee81ced0..32f81532ecf 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -606,7 +606,7 @@ if ($action == 'new') { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid"; $sql .= " WHERE ba.entity IN (".getEntity('bank_account').")"; $sql .= " AND b.fk_type= 'CHQ'"; - $sql .= " AND b.fk_bordereau = ".$object->id; + $sql .= " AND b.fk_bordereau = ".((int) $object->id); $sql .= $db->order($sortfield, $sortorder); $resql = $db->query($sql); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 0c4a6d9c478..f4d6c9e2686 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -104,7 +104,7 @@ if ($search_ref) { $sql .= natural_search("bc.ref", $search_ref); } if ($search_account > 0) { - $sql .= " AND bc.fk_bank_account=".$search_account; + $sql .= " AND bc.fk_bank_account = ".((int) $search_account); } if ($search_amount) { $sql .= natural_search("bc.amount", price2num($search_amount)); diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 4e464243df6..6b811bc2d13 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -78,7 +78,7 @@ if ($socid) { } $sql .= " WHERE p.entity IN (".getEntity('invoice').')'; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " AND p.statut = 0"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index dbf2d67778a..f69c7b476a2 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -203,7 +203,7 @@ class BonPrelevement extends CommonObject $sql = "SELECT rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes"; $sql .= " WHERE fk_prelevement_bons = ".$this->id; - $sql .= " AND fk_soc =".$client_id; + $sql .= " AND fk_soc =".((int) $client_id); $sql .= " AND code_banque = '".$this->db->escape($code_banque)."'"; $sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'"; $sql .= " AND number = '".$this->db->escape($number)."'"; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 0faea8a159c..dcf3c1a8bc5 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -329,7 +329,7 @@ class RejetPrelevement $sql = "SELECT pr.date_rejet as dr, motif, afacturer"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_rejet as pr"; - $sql .= " WHERE pr.fk_prelevement_lignes =".$rowid; + $sql .= " WHERE pr.fk_prelevement_lignes =".((int) $rowid); $resql = $this->db->query($sql); if ($resql) { @@ -345,11 +345,11 @@ class RejetPrelevement return 0; } else { - dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0"); + dol_syslog("RejetPrelevement::Fetch Erreur rowid=".$rowid." numrows=0"); return -1; } } else { - dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid"); + dol_syslog("RejetPrelevement::Fetch Erreur rowid=".$rowid); return -2; } } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 928be9c4245..8711f663d55 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -170,15 +170,15 @@ $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql .= " , ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr"; -$sql .= " WHERE p.rowid=".$object->id; +$sql .= " WHERE p.rowid=".((int) $object->id); $sql .= " AND pl.fk_prelevement_bons = p.rowid"; $sql .= " AND p.entity = ".$conf->entity; $sql .= " AND pl.fk_soc = s.rowid"; $sql .= " AND pl.statut = 3 "; $sql .= " AND pr.fk_prelevement_lignes = pl.rowid"; -if ($socid) { +/*if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); -} +}*/ $sql .= " ORDER BY pl.amount DESC"; // Count total nb of records diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 3abdf04ae1b..d98a6aab251 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -189,7 +189,7 @@ if ($id > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_creat = u.rowid"; $sql .= " WHERE pf.fk_paiement = p.rowid"; $sql .= " AND p.entity = ".$conf->entity; - $sql .= " AND pf.fk_facture = ".$fac->id; + $sql .= " AND pf.fk_facture = ".((int) $fac->id); $sql .= " ORDER BY p.datep ASC, p.rowid ASC"; $resqlp = $db->query($sql); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index bd871fd3ea3..5aca25466a3 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -403,7 +403,7 @@ if ($modecompta == 'BOOKKEEPING') { } $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " GROUP BY name, socid"; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index db754390e5e..a4deec56715 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -218,7 +218,7 @@ if ($search_amount) { $sql .= natural_search("cs.amount", $search_amount, 1); } if ($search_status != '' && $search_status >= 0) { - $sql .= " AND cs.paye = ".$db->escape($search_status); + $sql .= " AND cs.paye = ".((int) $search_status); } $sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); //$sql.= dolSqlDateFilter("cs.periode", 0, 0, $year); @@ -230,8 +230,8 @@ if ($year > 0) { $sql .= "OR (cs.periode IS NULL AND date_format(cs.date_ech, '%Y') = '".$db->escape($year)."')"; $sql .= ")"; } -if ($search_typeid) { - $sql .= " AND cs.fk_type=".$db->escape($search_typeid); +if ($search_typeid > 0) { + $sql .= " AND cs.fk_type = ".((int) $search_typeid); } $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname"; if (!empty($conf->projet->enabled)) { diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 63798baf62f..8e3169f1e8c 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -262,7 +262,7 @@ if ($modecompta == 'CREANCES-DETTES') { } $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " GROUP BY u.rowid, u.lastname, u.firstname"; $sql .= " ORDER BY u.rowid"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 05bbbab99d3..e7ec8c61db7 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -681,7 +681,7 @@ print ''; AND p.facture =0"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " GROUP BY p.rowid"; diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index 0afcb72da2d..7273e8ed529 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -197,7 +197,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " AND f.type IN (0,2)"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } } elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc"; @@ -208,7 +208,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " AND pf.fk_facturefourn = f.rowid"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } } elseif ($modecompta == "BOOKKEEPING") { $pcgverid = $conf->global->CHARTOFACCOUNTS; diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index a97e15d1499..0ea8418381d 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -301,7 +301,7 @@ if ($search_country > 0) { } $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays"; $sql .= " ORDER BY s.rowid"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index daed5b19f5e..45d3d2e74b4 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -207,7 +207,7 @@ class Tva extends CommonObject $sql .= " amount=".price2num($this->amount).","; $sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " note='".$this->db->escape($this->note)."',"; - $sql .= " fk_user_creat=".$this->fk_user_creat.","; + $sql .= " fk_user_creat=".((int) $this->fk_user_creat).","; $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? $this->fk_user_modif : $user->id).""; $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 17237732cea..69ce8ae8ae5 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -171,16 +171,16 @@ if (!empty($search_datepayment_end)) { $sql .= ' AND t.datep <= "'.$db->idate($search_datepayment_end).'"'; } if (!empty($search_type) && $search_type > 0) { - $sql .= ' AND t.fk_typepayment='.$search_type; + $sql .= ' AND t.fk_typepayment = '.((int) $search_type); } if (!empty($search_account) && $search_account > 0) { - $sql .= ' AND t.fk_account='.$search_account; + $sql .= ' AND t.fk_account = '.((int) $search_account); } if (!empty($search_amount)) { $sql .= natural_search('t.amount', price2num(trim($search_amount)), 1); } if ($search_status != '' && $search_status >= 0) { - $sql .= " AND t.paye = ".$db->escape($search_status); + $sql .= " AND t.paye = ".((int) $search_status); } $sql .= " GROUP BY t.rowid, t.amount, t.label, t.datev, t.datep, t.paye, t.fk_typepayment, t.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, t.num_payment, pst.code"; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 78e4ffae99b..e1f987ac2f4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -591,11 +591,11 @@ class Contact extends CommonObject if (isset($this->stcomm_id)) { $sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0"); } - $sql .= ", statut = ".$this->db->escape($this->statut); + $sql .= ", statut = ".((int) $this->statut); $sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL"); $sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL"); - $sql .= ", entity = ".$this->db->escape($this->entity); - $sql .= " WHERE rowid=".$this->db->escape($id); + $sql .= ", entity = ".((int) $this->entity); + $sql .= " WHERE rowid=".((int) $id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $result = $this->db->query($sql); @@ -1221,7 +1221,7 @@ class Contact extends CommonObject $obj = $this->db->fetch_object($resql); $sqldel = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; - $sqldel .= " WHERE rowid = ".$obj->rowid; + $sqldel .= " WHERE rowid = ".((int) $obj->rowid); dol_syslog(__METHOD__, LOG_DEBUG); $result = $this->db->query($sqldel); if (!$result) { @@ -1324,7 +1324,7 @@ class Contact extends CommonObject $sql = "SELECT c.rowid, c.datec as datec, c.fk_user_creat,"; $sql .= " c.tms as tms, c.fk_user_modif"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; - $sql .= " WHERE c.rowid = ".$this->db->escape($id); + $sql .= " WHERE c.rowid = ".((int) $id); $resql = $this->db->query($sql); if ($resql) { @@ -1770,10 +1770,10 @@ class Contact extends CommonObject $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; - $sql .= " WHERE sc.fk_soc =".$this->socid; + $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; - $sql .= " AND tc.element='".$this->db->escape($element)."'"; - $sql .= " AND tc.active=1"; + $sql .= " AND tc.element = '".$this->db->escape($element)."'"; + $sql .= " AND tc.active = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 74e3c704739..5ef0a10deb5 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -392,7 +392,7 @@ if (!$user->rights->societe->client->voir && !$socid) { //restriction $sql .= " AND (sc.fk_user = ".$user->id." OR p.fk_soc IS NULL)"; } if (!empty($userid)) { // propre au commercial - $sql .= " AND p.fk_user_creat=".$db->escape($userid); + $sql .= " AND p.fk_user_creat=".((int) $userid); } if ($search_level) { $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3); @@ -414,19 +414,19 @@ if ($search_priv != '0' && $search_priv != '1') { } if ($search_categ > 0) { - $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ); + $sql .= " AND cc.fk_categorie = ".((int) $search_categ); } if ($search_categ == -2) { $sql .= " AND cc.fk_categorie IS NULL"; } if ($search_categ_thirdparty > 0) { - $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_thirdparty); + $sql .= " AND cs.fk_categorie = ".((int) $search_categ_thirdparty); } if ($search_categ_thirdparty == -2) { $sql .= " AND cs.fk_categorie IS NULL"; } if ($search_categ_supplier > 0) { - $sql .= " AND cs2.fk_categorie = ".$db->escape($search_categ_supplier); + $sql .= " AND cs2.fk_categorie = ".((int) $search_categ_supplier); } if ($search_categ_supplier == -2) { $sql .= " AND cs2.fk_categorie IS NULL"; @@ -495,10 +495,10 @@ if (count($search_roles) > 0) { $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))"; } if ($search_no_email != '' && $search_no_email >= 0) { - $sql .= " AND p.no_email = ".$db->escape($search_no_email); + $sql .= " AND p.no_email = ".((int) $search_no_email); } if ($search_status != '' && $search_status >= 0) { - $sql .= " AND p.statut = ".$db->escape($search_status); + $sql .= " AND p.statut = ".((int) $search_status); } if ($search_import_key) { $sql .= natural_search("p.import_key", $search_import_key); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 186e4ee5761..0275baeb3a9 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3066,9 +3066,9 @@ class ContratLigne extends CommonObjectLine // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET"; - $sql .= " fk_contrat=".$this->fk_contrat.","; + $sql .= " fk_contrat=".((int) $this->fk_contrat).","; $sql .= " fk_product=".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : 'null').","; - $sql .= " statut=".$this->statut.","; + $sql .= " statut=".((int) $this->statut).","; $sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " description='".$this->db->escape($this->description)."',"; $sql .= " date_commande=".($this->date_commande != '' ? "'".$this->db->idate($this->date_commande)."'" : "null").","; @@ -3373,11 +3373,11 @@ class ContratLigne extends CommonObjectLine $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".ContratLigne::STATUS_CLOSED.","; + $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = ".((int) ContratLigne::STATUS_CLOSED).","; $sql .= " date_cloture = '".$this->db->idate($date_end)."',"; $sql .= " fk_user_cloture = ".$user->id.","; $sql .= " commentaire = '".$this->db->escape($comment)."'"; - $sql .= " WHERE rowid = ".$this->id." AND statut = ".ContratLigne::STATUS_OPEN; + $sql .= " WHERE rowid = ".$this->id." AND statut = ".((int) ContratLigne::STATUS_OPEN); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index aed4cba2fe1..a5e3da943b7 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -250,7 +250,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $resql = $db->query($sql); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index cf19f1178f6..ccb36830844 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -265,10 +265,10 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')'; } if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid) { - $sql .= " AND s.rowid = ".$db->escape($socid); + $sql .= " AND s.rowid = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -296,13 +296,13 @@ if ($search_town) { $sql .= natural_search(array('s.town'), $search_town); } if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_user > 0) { - $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; + $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user); } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index a0ecc6b4be8..8368bffbab2 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -257,7 +257,7 @@ if ($search_product_category > 0) { $sql .= " WHERE c.entity = ".$conf->entity; $sql .= " AND c.rowid = cd.fk_contrat"; if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } $sql .= " AND c.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9e312bee679..f3c68711edd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -531,7 +531,7 @@ abstract class CommonObject $sql .= " WHERE entity IN (".getEntity($element).")"; if ($id > 0) { - $sql .= " AND rowid = ".$db->escape($id); + $sql .= " AND rowid = ".((int) $id); } elseif ($ref) { $sql .= " AND ref = '".$db->escape($ref)."'"; } elseif ($ref_ext) { @@ -542,7 +542,7 @@ abstract class CommonObject return -1; } if ($ref || $ref_ext) { - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity = ".((int) $conf->entity); } dol_syslog(get_class()."::isExistingObject", LOG_DEBUG); @@ -1278,7 +1278,7 @@ abstract class CommonObject } $sql .= " AND tc.active=1"; if ($status >= 0) { - $sql .= " AND ec.statut = ".$status; + $sql .= " AND ec.statut = ".((int) $status); } $sql .= " ORDER BY t.lastname ASC"; @@ -1926,7 +1926,7 @@ abstract class CommonObject if ($format == 'text') { $sql .= $field." = '".$this->db->escape($value)."'"; } elseif ($format == 'int') { - $sql .= $field." = ".$this->db->escape($value); + $sql .= $field." = ".((int) $value); } elseif ($format == 'date') { $sql .= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); } @@ -3709,19 +3709,19 @@ abstract class CommonObject $sql .= " WHERE "; if ($justsource || $justtarget) { if ($justsource) { - $sql .= "fk_source = ".$sourceid." AND sourcetype = '".$this->db->escape($sourcetype)."'"; + $sql .= "fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; if ($withtargettype) { $sql .= " AND targettype = '".$this->db->escape($targettype)."'"; } } elseif ($justtarget) { - $sql .= "fk_target = ".$targetid." AND targettype = '".$this->db->escape($targettype)."'"; + $sql .= "fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; if ($withsourcetype) { $sql .= " AND sourcetype = '".$this->db->escape($sourcetype)."'"; } } } else { - $sql .= "(fk_source = ".$sourceid." AND sourcetype = '".$this->db->escape($sourcetype)."')"; - $sql .= " ".$clause." (fk_target = ".$targetid." AND targettype = '".$this->db->escape($targettype)."')"; + $sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')"; + $sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')"; } $sql .= ' ORDER BY '.$orderby; @@ -4106,12 +4106,12 @@ abstract class CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; - $sql .= " SET ".$fieldstatus." = ".$status; + $sql .= " SET ".$fieldstatus." = ".((int) $status); // If status = 1 = validated, update also fk_user_valid if ($status == 1 && $elementTable == 'expensereport') { $sql .= ", fk_user_valid = ".$user->id; } - $sql .= " WHERE rowid=".$elementId; + $sql .= " WHERE rowid=".((int) $elementId); dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); if ($this->db->query($sql)) { @@ -7122,11 +7122,11 @@ abstract class CommonObject $sql .= ' as main'; } if ($selectkey == 'rowid' && empty($value)) { - $sql .= " WHERE ".$selectkey."=0"; + $sql .= " WHERE ".$selectkey." = 0"; } elseif ($selectkey == 'rowid') { - $sql .= " WHERE ".$selectkey."=".$this->db->escape($value); + $sql .= " WHERE ".$selectkey." = ".((int) $value); } else { - $sql .= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; + $sql .= " WHERE ".$selectkey." = '".$this->db->escape($value)."'"; } //$sql.= ' AND entity = '.$conf->entity; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 32d7faa1557..aaf0f315c1b 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -292,7 +292,7 @@ class DiscountAbsolute $sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except"; $sql .= " WHERE (fk_facture_line IS NOT NULL"; // Not used as absolute simple discount $sql .= " OR fk_facture IS NOT NULL)"; // Not used as credit note and not used as deposit - $sql .= " AND fk_facture_source = ".$this->fk_facture_source; + $sql .= " AND fk_facture_source = ".((int) $this->fk_facture_source); //$sql.=" AND rowid != ".$this->id; dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index dc3726f2634..2f8b0871a83 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1722,11 +1722,11 @@ class ExtraFields $sql .= ' as main'; } if ($selectkey == 'rowid' && empty($value)) { - $sql .= " WHERE ".$selectkey."=0"; + $sql .= " WHERE ".$selectkey." = 0"; } elseif ($selectkey == 'rowid') { - $sql .= " WHERE ".$selectkey."=".$this->db->escape($value); + $sql .= " WHERE ".$selectkey." = ".((int) $value); } else { - $sql .= " WHERE ".$selectkey."='".$this->db->escape($value)."'"; + $sql .= " WHERE ".$selectkey." = '".$this->db->escape($value)."'"; } //$sql.= ' AND entity = '.$conf->entity; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1dd6712dba6..e084757fe28 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2497,18 +2497,18 @@ class Form } if ($finished == 0) { - $sql .= " AND p.finished = ".$finished; + $sql .= " AND p.finished = ".((int) $finished); } elseif ($finished == 1) { - $sql .= " AND p.finished = ".$finished; + $sql .= " AND p.finished = ".((int) $finished); if ($status >= 0) { - $sql .= " AND p.tosell = ".$status; + $sql .= " AND p.tosell = ".((int) $status); } } elseif ($status >= 0) { - $sql .= " AND p.tosell = ".$status; + $sql .= " AND p.tosell = ".((int) $status); } // Filter by product type if (strval($filtertype) != '') { - $sql .= " AND p.fk_product_type = ".$filtertype; + $sql .= " AND p.fk_product_type = ".((int) $filtertype); } elseif (empty($conf->product->enabled)) { // when product module is disabled, show services only $sql .= " AND p.fk_product_type = 1"; } elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only @@ -3828,7 +3828,6 @@ class Form $sql = "SELECT id, code, libelle as label, type, active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_paiement"; $sql .= " WHERE entity IN (".getEntity('c_paiement').")"; - //if ($active >= 0) $sql.= " AND active = ".$active; $resql = $this->db->query($sql); if ($resql) { @@ -4061,7 +4060,6 @@ class Form $sql = "SELECT rowid, code, label, active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_transport_mode"; $sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; - //if ($active >= 0) $sql.= " AND active = ".$active; $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index a57e39f1779..fbfde88198b 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -242,7 +242,7 @@ class FormAccounting extends Form $sql .= " WHERE c.active = 1"; $sql .= " AND c.category_type = 0"; if (empty($allcountries)) { - $sql .= " AND c.fk_country = ".$mysoc->country_id; + $sql .= " AND c.fk_country = ".((int) $mysoc->country_id); } $sql .= " ORDER BY c.label ASC"; } else { diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index aa0259ba288..7058e80b1d7 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -77,14 +77,14 @@ class FormIntervention if ($socid == '0') { $sql .= " AND (f.fk_soc = 0 OR f.fk_soc IS NULL)"; } else { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } } dol_syslog(get_class($this)."::select_intervention", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $out .= ''; if ($showempty) { $out .= ''; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a9da488907d..00c1c4236c4 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1275,10 +1275,10 @@ class FormMail extends Form $sql .= " AND entity IN (".getEntity('c_email_templates').")"; $sql .= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) { - $sql .= " AND active = ".$active; + $sql .= " AND active = ".((int) $active); } if ($label) { - $sql .= " AND label ='".$db->escape($label)."'"; + $sql .= " AND label = '".$db->escape($label)."'"; } if (!($id > 0) && $languagetosearch) { $sql .= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')"; @@ -1434,7 +1434,7 @@ class FormMail extends Form $sql .= " AND entity IN (".getEntity('c_email_templates').")"; $sql .= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own. if ($active >= 0) { - $sql .= " AND active = ".$active; + $sql .= " AND active = ".((int) $active); } //if (is_object($outputlangs)) $sql.= " AND (lang = '".$this->db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')"; // Return all languages $sql .= $this->db->order("position,lang,label", "ASC"); diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index 8a40eed9da8..3455b572888 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -76,7 +76,7 @@ class FormSocialContrib $sql = "SELECT c.id, c.libelle as type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql .= " WHERE c.active = 1"; - $sql .= " AND c.fk_pays = ".$mysoc->country_id; + $sql .= " AND c.fk_pays = ".((int) $mysoc->country_id); $sql .= " ORDER BY c.libelle ASC"; } else { $sql = "SELECT c.id, c.libelle as type"; diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index 076dace54f0..545d3c12274 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -105,7 +105,7 @@ class InfoBox $sql .= " WHERE b.box_id = d.rowid"; $sql .= " AND b.entity IN (0,".$conf->entity.")"; if ($zone >= 0) { - $sql .= " AND b.position = ".$zone; + $sql .= " AND b.position = ".((int) $zone); } if (is_object($user)) { $sql .= " AND b.fk_user IN (0,".$user->id.")"; @@ -116,7 +116,7 @@ class InfoBox } else { // available $sql = "SELECT d.rowid as box_id, d.file, d.note, d.tms"; $sql .= " FROM ".MAIN_DB_PREFIX."boxes_def as d"; - $sql .= " WHERE d.entity IN (0,".$conf->entity.")"; + $sql .= " WHERE d.entity IN (0, ".$conf->entity.")"; } dol_syslog(get_class()."::listBoxes get default box list for mode=".$mode." userid=".(is_object($user) ? $user->id : '')."", LOG_DEBUG); @@ -254,8 +254,8 @@ class InfoBox // Delete all lines $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND fk_user = ".$userid; - $sql .= " AND position = ".$zone; + $sql .= " AND fk_user = ".((int) $userid); + $sql .= " AND position = ".((int) $zone); dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); $result = $db->query($sql); diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 65fdaff9645..6f024c91b0b 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -352,10 +352,10 @@ class Menubase $sql .= " type='".$this->db->escape($this->type)."',"; $sql .= " mainmenu='".$this->db->escape($this->mainmenu)."',"; $sql .= " leftmenu='".$this->db->escape($this->leftmenu)."',"; - $sql .= " fk_menu=".$this->fk_menu.","; + $sql .= " fk_menu=".((int) $this->fk_menu).","; $sql .= " fk_mainmenu=".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").","; $sql .= " fk_leftmenu=".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").","; - $sql .= " position=".($this->position > 0 ? $this->position : 0).","; + $sql .= " position=".($this->position > 0 ? ((int) $this->position) : 0).","; $sql .= " url='".$this->db->escape($this->url)."',"; $sql .= " target='".$this->db->escape($this->target)."',"; $sql .= " titre='".$this->db->escape($this->title)."',"; diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 345ec5b38e3..6b32799bc89 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -176,7 +176,7 @@ class Notify $sqlnotifcode = ''; if ($notifcode) { if (is_numeric($notifcode)) { - $sqlnotifcode = " AND n.fk_action = ".$notifcode; // Old usage + $sqlnotifcode = " AND n.fk_action = ".((int) $notifcode); // Old usage } else { $sqlnotifcode = " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage } @@ -195,7 +195,7 @@ class Notify $sql .= $sqlnotifcode; $sql .= " AND s.entity IN (".getEntity('societe').")"; if ($socid > 0) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); @@ -233,7 +233,7 @@ class Notify $sql .= $sqlnotifcode; $sql .= " AND c.entity IN (".getEntity('user').")"; if ($userid > 0) { - $sql .= " AND c.rowid = ".$userid; + $sql .= " AND c.rowid = ".((int) $userid); } dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG); @@ -380,11 +380,11 @@ class Notify $sql .= " AND n.fk_soc = s.rowid"; $sql .= " AND c.statut = 1"; if (is_numeric($notifcode)) { - $sql .= " AND n.fk_action = ".$notifcode; // Old usage + $sql .= " AND n.fk_action = ".((int) $notifcode); // Old usage } else { $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage } - $sql .= " AND s.rowid = ".$object->socid; + $sql .= " AND s.rowid = ".((int) $object->socid); $sql .= "\nUNION\n"; } diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 939e6514c13..ef635b259ff 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -168,7 +168,7 @@ function show_array_actions_to_do($max = 5) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " ORDER BY a.datep DESC, a.id DESC"; $sql .= $db->plimit($max, 0); @@ -284,7 +284,7 @@ function show_array_last_actions_done($max = 5) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " ORDER BY a.datep2 DESC"; $sql .= $db->plimit($max, 0); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 61332d8041b..5abc6bfc2ac 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -227,7 +227,7 @@ function societe_prepare_head(Societe $object) if (empty($conf->stripe->enabled)) { $sql .= " AND n.stripe_card_ref IS NULL"; } else { - $sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".$servicestatus."))"; + $sql .= " AND (n.stripe_card_ref IS NULL OR (n.stripe_card_ref IS NOT NULL AND n.status = ".((int) $servicestatus)."))"; } $resql = $db->query($sql); @@ -1448,7 +1448,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin if (is_object($objcon) && $objcon->id > 0) { $force_filter_contact = true; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; - $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".$objcon->id; + $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); } if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) { @@ -1457,7 +1457,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as er"; $sql .= " ON er.resource_type = 'dolresource'"; $sql .= " AND er.element_id = a.id"; - $sql .= " AND er.resource_id = ".$filterobj->id; + $sql .= " AND er.resource_id = ".((int) $filterobj->id); } elseif (is_object($filterobj) && get_class($filterobj) == 'Project') { /* Nothing */ } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { @@ -1940,7 +1940,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE s.parent = ".$object->id; + $sql .= " WHERE s.parent = ".((int) $object->id); $sql .= " AND s.entity IN (".getEntity('societe').")"; $sql .= " ORDER BY s.nom"; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 68910357269..efc9f60147c 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -59,7 +59,7 @@ function facturefourn_prepare_head($object) $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql .= " WHERE pfd.fk_facture_fourn = ".$object->id; + $sql .= " WHERE pfd.fk_facture_fourn = ".((int) $object->id); $sql .= " AND pfd.ext_payment_id IS NULL"; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 16891214ca5..0cbb89ae47b 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -734,7 +734,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); @@ -950,7 +950,7 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity IN (".getEntity('facture_fourn').")"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -1062,7 +1062,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); @@ -1250,7 +1250,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND ff.fk_soc = ".$socid; + $sql .= " AND ff.fk_soc = ".((int) $socid); } // Add where from hooks $parameters = array(); diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 880019d7b97..0814c0f4825 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -246,7 +246,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; - $sql .= " AND obj.fk_".$origin." = ".$origin_id; + $sql .= " AND obj.fk_".$origin." = ".((int) $origin_id); $sql .= " AND obj.rowid = ed.fk_origin_line"; $sql .= " AND ed.fk_expedition = e.rowid"; if ($filter) { diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 4d9d4bb2fa2..0ba7f56c615 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -336,7 +336,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if (is_object($objcon) && $objcon->id > 0) { $force_filter_contact = true; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm"; - $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".$objcon->id; + $sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id); } if (is_object($filterobj) && get_class($filterobj) == 'Societe') { diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 6d01fcfee0a..cd9ae5ad297 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -110,7 +110,7 @@ function user_prepare_head($object) $nbNote = 0; $sql = "SELECT COUNT(n.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."notify_def as n"; - $sql .= " WHERE fk_user = ".$object->id; + $sql .= " WHERE fk_user = ".((int) $object->id); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 5fbfc05a9fb..3b7cc0d1184 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1371,7 +1371,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if ($command) { $sql .= " AND command = '".$this->db->escape($command)."'"; } - $sql .= " AND entity = ".$entity; // Must be exact entity + $sql .= " AND entity = ".((int) $entity); // Must be exact entity $now = dol_now(); @@ -1612,7 +1612,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql = "SELECT count(*)"; $sql .= " FROM ".MAIN_DB_PREFIX."const"; $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'"; - $sql .= " AND entity = ".$entity; + $sql .= " AND entity = ".((int) $entity); $result = $this->db->query($sql); if ($result) { @@ -2197,7 +2197,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; $sql .= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->db->escape($this->const_name)."_".strtoupper($key)."'"; - $sql .= " AND entity = ".$entity; + $sql .= " AND entity = ".((int) $entity); dol_syslog(get_class($this)."::delete_const_".$key."", LOG_DEBUG); if (!$this->db->query($sql)) { diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 03334e62322..a2a54c02c55 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -171,7 +171,7 @@ class mailing_pomme extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.email <> ''"; // u.email IS NOT NULL est implicite dans ce test $sql .= " AND u.entity IN (0,".$conf->entity.")"; - $sql .= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + $sql .= " AND u.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; if (GETPOSTISSET("filter") && GETPOST("filter") == '1') { $sql .= " AND u.statut=1"; } diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index b3b88224df6..f764c3f5f71 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -77,7 +77,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; } else { $addFilter = ""; if (GETPOSTISSET("filter_client") && GETPOST("filter_client") <> '-1') { @@ -112,7 +112,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; $sql .= " AND cs.fk_soc = s.rowid"; $sql .= " AND c.rowid = cs.fk_categorie"; $sql .= " AND c.rowid=".((int) GETPOST('filter', 'int')); @@ -122,7 +122,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_fournisseur as cs, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; $sql .= " AND cs.fk_soc = s.rowid"; $sql .= " AND c.rowid = cs.fk_categorie"; $sql .= " AND c.rowid=".((int) GETPOST('filter', 'int')); diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 7b5d4f38737..4c848b69ac0 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -110,7 +110,7 @@ class mailing_thirdparties_services_expired extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= ", ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; - $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; + $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; $sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''"; $sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$this->db->escape($product)."'"; $sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'"; diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 82d930a1aac..872890958ff 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -529,8 +529,8 @@ class pdf_stdandard extends ModelePDFMovement if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active $sql = "SELECT label"; $sql .= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql .= " WHERE fk_product=".$objp->rowid; - $sql .= " AND lang='".$this->db->escape($langs->getDefaultLang())."'"; + $sql .= " WHERE fk_product = ".((int) $objp->rowid); + $sql .= " AND lang = '".$this->db->escape($langs->getDefaultLang())."'"; $sql .= " LIMIT 1"; $result = $this->db->query($sql); diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index d007b421fd7..da95e841728 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -742,7 +742,7 @@ class doc_generic_project_odt extends ModelePDFProjects $sql .= ", u.lastname, u.firstname, t.thm"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE t.fk_task =".$task->id; + $sql .= " WHERE t.fk_task =".((int) $task->id); $sql .= " AND t.fk_user = u.rowid"; $sql .= " ORDER BY t.task_date DESC"; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 2d263aae6c0..0662e1a5a76 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -657,7 +657,7 @@ class doc_generic_task_odt extends ModelePDFTask $sql .= ", u.lastname, u.firstname"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; $sql .= " , ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE t.fk_task =".$object->id; + $sql .= " WHERE t.fk_task =".((int) $object->id); $sql .= " AND t.fk_user = u.rowid"; $sql .= " ORDER BY t.task_date DESC"; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index b69ebdeb828..9f85aca1aff 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -209,7 +209,7 @@ class pdf_paiement $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if (!empty($socid)) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } // If global param PAYMENTS_REPORT_GROUP_BY_MOD is set, payement are ordered by paiement_code if (!empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) { diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index a57b996086b..b0cc07dcb62 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -315,7 +315,7 @@ class pdf_standard extends ModelePDFStock $sql .= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE ps.fk_product = p.rowid"; $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) - $sql .= " AND ps.fk_entrepot = ".$object->id; + $sql .= " AND ps.fk_entrepot = ".((int) $object->id); $sql .= $this->db->order($sortfield, $sortorder); //dol_syslog('List products', LOG_DEBUG); diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index cbcaceec743..7a3ba77fb5a 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -121,7 +121,7 @@ class ActionsDatapolicy if ($object->update($object->id, $user, 0)) { // On supprime les contacts associé - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$object->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".((int) $object->id); $this->db->query($sql); setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array()); diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 3ae04c64833..cfd9e8ccd8b 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -123,7 +123,7 @@ class Donations extends DolibarrApi $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($thirdparty_ids) { - $sql .= " AND t.fk_soc = ".$thirdparty_ids." "; + $sql .= " AND t.fk_soc = ".((int) $thirdparty_ids)." "; } // Add sql filters diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 56062868d86..181b3fc0ca3 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -476,8 +476,8 @@ class Don extends CommonObject $sql .= ",address='".$this->db->escape($this->address)."'"; $sql .= ",zip='".$this->db->escape($this->zip)."'"; $sql .= ",town='".$this->db->escape($this->town)."'"; - $sql .= ",fk_country = ".($this->country_id > 0 ? $this->country_id : '0'); - $sql .= ",public=".$this->public; + $sql .= ",fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) : '0'); + $sql .= ",public=".((int) $this->public); $sql .= ",fk_projet=".($this->fk_project > 0 ? $this->fk_project : 'null'); $sql .= ",note_private=".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ",note_public=".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); @@ -486,8 +486,8 @@ class Don extends CommonObject $sql .= ",email='".$this->db->escape(trim($this->email))."'"; $sql .= ",phone='".$this->db->escape(trim($this->phone))."'"; $sql .= ",phone_mobile='".$this->db->escape(trim($this->phone_mobile))."'"; - $sql .= ",fk_statut=".$this->statut; - $sql .= " WHERE rowid = ".$this->id; + $sql .= ",fk_statut=".((int) $this->statut); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::Update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index b292dd33429..035a7aee9c6 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -425,7 +425,7 @@ class EcmFiles extends CommonObject //$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique } elseif ($src_object_type && $src_object_id) { // Warning: May return several record, and only first one is returned ! - $sql .= " AND t.src_object_type ='".$this->db->escape($src_object_type)."' AND t.src_object_id = ".$this->db->escape($src_object_id); + $sql .= " AND t.src_object_type = '".$this->db->escape($src_object_type)."' AND t.src_object_id = ".((int) $src_object_id); $sql .= " AND t.entity = ".$conf->entity; } else { $sql .= ' AND t.rowid = '.((int) $id); // rowid already unique diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index e282da6a4d9..6ece0bc115e 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -234,7 +234,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".$confOrBooth->id; +$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as a on a.id=t.fk_actioncomm AND a.id=".((int) $confOrBooth->id); if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index ae643ee688a..02ac007d30f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1982,7 +1982,7 @@ if ($action == 'create') { //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; - $sql .= " AND obj.fk_".$origin." = ".$origin_id; + $sql .= " AND obj.fk_".$origin." = ".((int) $origin_id); $sql .= " AND obj.rowid = ed.fk_origin_line"; $sql .= " AND ed.fk_expedition = e.rowid"; //if ($filter) $sql.= $filter; diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index dcd619da76e..2a4b6765b4e 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -140,7 +140,7 @@ class Shipments extends DolibarrApi } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index ea5bd17fdfb..ee7324a22c4 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2125,7 +2125,7 @@ class Expedition extends CommonObject if (!empty($this->shipping_method_id)) { $sql = "SELECT em.code, em.tracking"; $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; - $sql .= " WHERE em.rowid = ".$this->shipping_method_id; + $sql .= " WHERE em.rowid = ".((int) $this->shipping_method_id); $resql = $this->db->query($sql); if ($resql) { @@ -2981,8 +2981,8 @@ class ExpeditionLigne extends CommonObjectLine // update line $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql .= " fk_entrepot = ".($this->entrepot_id > 0 ? $this->entrepot_id : 'null'); - $sql .= " , qty = ".$qty; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " , qty = ".((float) price2num($qty, 'MS')); + $sql .= " WHERE rowid = ".((int) $this->id); if (!$this->db->query($sql)) { $this->errors[] = $this->db->lasterror()." - sql=$sql"; diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 736cfba6e42..03066869450 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -186,7 +186,7 @@ class ExpeditionLineBatch extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as eb"; if ($fk_product > 0) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.batch = eb.batch AND pl.fk_product = ".$fk_product; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.batch = eb.batch AND pl.fk_product = ".((int) $fk_product); } $sql .= " WHERE fk_expeditiondet=".(int) $id_line_expdet; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a1070d02ef1..5a110d33f2a 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -282,7 +282,7 @@ if ($search_user > 0) { } $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid > 0) { $sql .= ' AND s.rowid = '.$socid; @@ -292,7 +292,7 @@ if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no $sql .= " AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND e.fk_soc = ".$socid; + $sql .= " AND e.fk_soc = ".((int) $socid); } if ($search_status <> '' && $search_status >= 0) { $sql .= " AND e.fk_statut = ".((int) $search_status); @@ -322,7 +322,7 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; } if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } if ($search_user > 0) { // The contact on a shipment is also the contact of the order. @@ -353,7 +353,7 @@ if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); + $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } if ($search_categ_cus == -2) { $sql .= " AND cc.fk_categorie IS NULL"; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 8f5903dd988..42b8630bd3c 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -626,7 +626,7 @@ if ($id > 0 || !empty($ref)) { $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units'; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - $sql .= " WHERE cd.fk_commande = ".$object->id; + $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; //print $sql; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 34bef81e5a2..6cd3531f82d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -990,9 +990,9 @@ class ExpenseReport extends CommonObject $total_ttc = $total_ht + $total_tva; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " total_ht = ".$total_ht; - $sql .= " , total_ttc = ".$total_ttc; - $sql .= " , total_tva = ".$total_tva; + $sql .= " total_ht = ".price2num($total_ht, 'MT'); + $sql .= " , total_ttc = ".price2num($total_ttc, 'MT'); + $sql .= " , total_tva = ".price2num($total_tva, 'MT'); $sql .= " WHERE rowid = ".((int) $id); $result = $this->db->query($sql); if ($result) : @@ -2811,30 +2811,30 @@ class ExpenseReportLine // Update line in database $sql = "UPDATE ".MAIN_DB_PREFIX."expensereport_det SET"; $sql .= " comments='".$this->db->escape($this->comments)."'"; - $sql .= ",value_unit=".$this->db->escape($this->value_unit); - $sql .= ",qty=".$this->db->escape($this->qty); + $sql .= ",value_unit = ".((float) $this->value_unit); + $sql .= ",qty=".((float) $this->qty); $sql .= ",date='".$this->db->idate($this->date)."'"; - $sql .= ",total_ht=".$this->db->escape($this->total_ht).""; - $sql .= ",total_tva=".$this->db->escape($this->total_tva).""; - $sql .= ",total_ttc=".$this->db->escape($this->total_ttc).""; - $sql .= ",tva_tx=".$this->db->escape($this->vatrate); + $sql .= ",total_ht=".((float) price2num($this->total_ht, 'MT')).""; + $sql .= ",total_tva=".((float) price2num($this->total_tva, 'MT')).""; + $sql .= ",total_ttc=".((float) price2num($this->total_ttc, 'MT')).""; + $sql .= ",tva_tx=".((float) $this->vatrate); $sql .= ",vat_src_code='".$this->db->escape($this->vat_src_code)."'"; $sql .= ",rule_warning_message='".$this->db->escape($this->rule_warning_message)."'"; $sql .= ",fk_c_exp_tax_cat=".$this->db->escape($this->fk_c_exp_tax_cat); - $sql .= ",fk_ecm_files=".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null'); + $sql .= ",fk_ecm_files=".($this->fk_ecm_files > 0 ? ((int) $this->fk_ecm_files) : 'null'); if ($this->fk_c_type_fees) { - $sql .= ",fk_c_type_fees=".$this->db->escape($this->fk_c_type_fees); + $sql .= ",fk_c_type_fees = ".((int) $this->fk_c_type_fees); } else { $sql .= ",fk_c_type_fees=null"; } if ($this->fk_project > 0) { - $sql .= ",fk_projet=".$this->db->escape($this->fk_project); + $sql .= ",fk_projet=".((int) $this->fk_project); } else { $sql .= ",fk_projet=null"; } - $sql .= " WHERE rowid = ".$this->db->escape($this->rowid ? $this->rowid : $this->id); + $sql .= " WHERE rowid = ".((int) ($this->rowid ? $this->rowid : $this->id)); - dol_syslog("ExpenseReportLine::update sql=".$sql); + dol_syslog("ExpenseReportLine::update"); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index fb031d81583..44ff46b233c 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -388,7 +388,7 @@ if ($action == 'create') { $sql = 'SELECT l.rowid, l.description, l.duree'; $sql .= " FROM ".MAIN_DB_PREFIX."fichinterdet as l"; - $sql .= " WHERE l.fk_fichinter= ".$object->id; + $sql .= " WHERE l.fk_fichinter= ".((int) $object->id); //$sql.= " AND l.fk_product is null "; $sql .= " ORDER BY l.rang"; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index e2ac86f55bd..2e9d8a4a9b1 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -379,8 +379,8 @@ class Fichinter extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET "; $sql .= "description = '".$this->db->escape($this->description)."'"; - $sql .= ", duree = ".$this->duration; - $sql .= ", fk_projet = ".$this->fk_project; + $sql .= ", duree = ".((int) $this->duration); + $sql .= ", fk_projet = ".((int) $this->fk_project); $sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); $sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); $sql .= ", fk_user_modif = ".$user->id; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 34939bb599a..df1bf36b723 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -155,7 +155,7 @@ class SupplierInvoices extends DolibarrApi } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 09c9209629f..d4eedcd0fd9 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -171,7 +171,7 @@ class SupplierOrders extends DolibarrApi } // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e2196d5595d..d9ca371c133 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3058,7 +3058,7 @@ class CommandeFournisseur extends CommonOrder if ($this->methode_commande_id > 0) { $sql = "SELECT rowid, code, libelle as label"; $sql .= " FROM ".MAIN_DB_PREFIX.'c_input_method'; - $sql .= " WHERE active=1 AND rowid = ".$this->db->escape($this->methode_commande_id); + $sql .= " WHERE active=1 AND rowid = ".((int) $this->methode_commande_id); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 81533dae324..a48d00c820b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3401,7 +3401,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); - if ($this->fk_remise_except) $sql.= ", fk_remise_except=".$this->fk_remise_except; + if ($this->fk_remise_except) $sql.= ", fk_remise_except=".((int) $this->fk_remise_except); else $sql.= ", fk_remise_except=null"; $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; $sql .= ", tva_tx = ".price2num($this->tva_tx); @@ -3414,10 +3414,10 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", total_localtax1= ".price2num($this->total_localtax1); $sql .= ", total_localtax2= ".price2num($this->total_localtax2); $sql .= ", total_ttc = ".price2num($this->total_ttc); - $sql .= ", fk_product = ".$fk_product; - $sql .= ", product_type = ".$this->product_type; - $sql .= ", info_bits = ".$this->info_bits; - $sql .= ", fk_unit = ".$fk_unit; + $sql .= ", fk_product = ".((int) $fk_product); + $sql .= ", product_type = ".((int) $this->product_type); + $sql .= ", info_bits = ".((int) $this->info_bits); + $sql .= ", fk_unit = ".((int) $fk_unit); // Multicurrency $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; @@ -3425,7 +3425,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql .= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; - $sql .= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 21b4ec377a2..2172af578e9 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -789,14 +789,14 @@ class ProductFournisseur extends Product $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; $sql .= " AND pfp.entity = ".$conf->entity; // only current entity - $sql .= " AND pfp.fk_product = ".$prodid; + $sql .= " AND pfp.fk_product = ".((int) $prodid); $sql .= " AND pfp.fk_soc = s.rowid"; $sql .= " AND s.status = 1"; // only enabled society if ($qty > 0) { - $sql .= " AND pfp.quantity <= ".$qty; + $sql .= " AND pfp.quantity <= ".((float) $qty); } if ($socid > 0) { - $sql .= ' AND pfp.fk_soc = '.$socid; + $sql .= ' AND pfp.fk_soc = '.((int) $socid); } dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG); @@ -1001,7 +1001,7 @@ class ProductFournisseur extends Product $sql .= " WHERE pfp.entity IN (".getEntity('productprice').")"; $sql .= " AND pfpl.fk_user = u.rowid"; $sql .= " AND pfp.rowid = pfpl.fk_product_fournisseur"; - $sql .= " AND pfpl.fk_product_fournisseur = ".$product_fourn_price_id; + $sql .= " AND pfpl.fk_product_fournisseur = ".((int) $product_fourn_price_id); if (empty($sortfield)) { $sql .= " ORDER BY pfpl.datec"; } else { diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index eef851c6d73..1ea5db20b59 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -183,7 +183,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $sql .= " AND c.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing $sql .= " AND c.fk_statut = 0"; if (!empty($socid)) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -290,7 +290,7 @@ $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity = ".$conf->entity; //$sql.= " AND c.fk_statut > 2"; if (!empty($socid)) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -359,7 +359,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX $sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.fk_statut = 1"; -if ($socid) $sql.= " AND c.fk_soc = ".$socid; +if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY c.rowid DESC"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d8959ada7c0..25f71f85eb4 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -651,7 +651,7 @@ $sql .= $hookmanager->resPrint; $sql .= ' WHERE cf.fk_soc = s.rowid'; $sql .= ' AND cf.entity IN ('.getEntity('supplier_order').')'; if ($socid > 0) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -672,10 +672,10 @@ if ($search_request_author) { $sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_request_author); } if ($search_billed != '' && $search_billed >= 0) { - $sql .= " AND cf.billed = ".$db->escape($search_billed); + $sql .= " AND cf.billed = ".((int) $search_billed); } if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } //Required triple check because statut=0 means draft filter if (GETPOST('statut', 'intcomma') !== '') { @@ -705,7 +705,7 @@ if ($search_company) { $sql .= natural_search('s.nom', $search_company); } if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale); + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } if ($search_user > 0) { $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".$db->escape($search_user); diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index 82c8df6ac66..3196ffed7ac 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -94,7 +94,7 @@ if ($contactname) { } if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " ORDER BY $sortfield $sortorder "; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0c4f21ae4be..8578f82137d 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -451,10 +451,10 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($search_product_category > 0) { - $sql .= " AND cp.fk_categorie = ".$search_product_category; + $sql .= " AND cp.fk_categorie = ".((int) $search_product_category); } if ($socid > 0) { - $sql .= ' AND s.rowid = '.$socid; + $sql .= ' AND s.rowid = '.((int) $socid); } if ($search_ref) { if (is_numeric($search_ref)) { diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index 4a761ea8b70..8d124f46350 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -172,7 +172,7 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S $sql .= " AND ff.entity = ".$conf->entity; $sql .= " AND ff.fk_statut = 0"; if ($socid) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $resql = $db->query($sql); @@ -243,7 +243,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } $sql .= " ORDER BY s.tms DESC"; $sql .= $db->plimit($max, 0); diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index ed137fd5d86..5ecec959614 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -174,10 +174,10 @@ if ($snom) { $sql .= natural_search('p.label', $snom); } if ($catid) { - $sql .= " AND cp.fk_categorie = ".$catid; + $sql .= " AND cp.fk_categorie = ".((int) $catid); } if ($fourn_id > 0) { - $sql .= " AND ppf.fk_soc = ".$fourn_id; + $sql .= " AND ppf.fk_soc = ".((int) $fourn_id); } // Add WHERE filters from hooks diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index adeaf7b1447..353083bd717 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -134,7 +134,7 @@ if ($socid > 0) { $sql .= " ".MAIN_DB_PREFIX."paiementfourn as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON p.fk_user_author = u.rowid"; $sql .= " WHERE pf.fk_paiementfourn = p.rowid"; - $sql .= " AND pf.fk_facturefourn = ".$fac->id; + $sql .= " AND pf.fk_facturefourn = ".((int) $fac->id); $resqlp = $db->query($sql); if ($resqlp) { diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 55dd1c4bafb..7e3585bd5bc 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1477,7 +1477,7 @@ class Holiday extends CommonObject if ($num > 0) { // Update for user $sql = "UPDATE ".MAIN_DB_PREFIX."holiday_users SET"; - $sql .= " nb_holiday = ".$nbHoliday; + $sql .= " nb_holiday = ".((int) $nbHoliday); $sql .= " WHERE fk_user = ".(int) $userID." AND fk_type = ".(int) $fk_type; $result = $this->db->query($sql); if (!$result) { @@ -1487,7 +1487,7 @@ class Holiday extends CommonObject } else { // Insert for user $sql = "INSERT INTO ".MAIN_DB_PREFIX."holiday_users(nb_holiday, fk_user, fk_type) VALUES ("; - $sql .= $nbHoliday; + $sql .= ((int) $nbHoliday); $sql .= ", ".(int) $userID.", ".(int) $fk_type.")"; $result = $this->db->query($sql); if (!$result) { diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index c2fa520442b..2cac4a1352b 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -264,10 +264,10 @@ class Establishment extends CommonObject $sql .= ", zip = '".$this->db->escape($this->zip)."'"; $sql .= ", town = '".$this->db->escape($this->town)."'"; $sql .= ", fk_country = ".($this->country_id > 0 ? $this->country_id : 'null'); - $sql .= ", status = ".$this->db->escape($this->status); - $sql .= ", fk_user_mod = ".$user->id; - $sql .= ", entity = ".$this->entity; - $sql .= " WHERE rowid = ".$this->id; + $sql .= ", status = ".((int) $this->status); + $sql .= ", fk_user_mod = ".((int) $user->id); + $sql .= ", entity = ".((int) $this->entity); + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 50fd4c3f521..2315edc100c 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -190,7 +190,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { $sql .= ' AND x.fk_user IN ('.$db->sanitize(join(',', $childids)).')'; } //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; + //if (!empty($socid)) $sql.= " AND x.fk_soc = ".((int) $socid); $sql .= $db->order("x.tms", "DESC"); $sql .= $db->plimit($max, 0); @@ -271,7 +271,7 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) $sql .= ' AND x.fk_user_author IN ('.$db->sanitize(join(',', $childids)).')'; } //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; + //if (!empty($socid)) $sql.= " AND x.fk_soc = ".((int) $socid); $sql .= $db->order("x.tms", "DESC"); $sql .= $db->plimit($max, 0); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index f94e461398b..23acc7d4a1b 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1183,7 +1183,7 @@ function migrate_contracts_date2($db, $langs, $conf) print $langs->trans('MigrationContractsInvalidDateFix', $obj->cref, $obj->date_contrat, $obj->datemin)."
\n"; $sql = "UPDATE ".MAIN_DB_PREFIX."contrat"; $sql .= " SET date_contrat='".$db->idate($datemin)."'"; - $sql .= " WHERE rowid=".$obj->cref; + $sql .= " WHERE rowid = ".((int) $obj->cref); $resql2 = $db->query($sql); if (!$resql2) { dol_print_error($db); @@ -1275,8 +1275,8 @@ function migrate_contracts_open($db, $langs, $conf) print $langs->trans('MigrationReopenThisContract', $obj->cref)."
\n"; $sql = "UPDATE ".MAIN_DB_PREFIX."contrat"; - $sql .= " SET statut=1"; - $sql .= " WHERE rowid=".$obj->cref; + $sql .= " SET statut = 1"; + $sql .= " WHERE rowid = ".((int) $obj->cref); $resql2 = $db->query($sql); if (!$resql2) { dol_print_error($db); @@ -2835,8 +2835,8 @@ function migrate_project_task_time($db, $langs, $conf) $newtime = $hour + $min; $sql2 = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; - $sql2 .= " task_duration = ".$newtime; - $sql2 .= " WHERE rowid = ".$obj->rowid; + $sql2 .= " task_duration = ".((int) $newtime); + $sql2 .= " WHERE rowid = ".((int) $obj->rowid); $resql2 = $db->query($sql2); if (!$resql2) { @@ -2865,7 +2865,7 @@ function migrate_project_task_time($db, $langs, $conf) if ($oldtime > 0) { foreach ($totaltime as $taskid => $total_duration) { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET"; - $sql .= " duration_effective = ".$total_duration; + $sql .= " duration_effective = ".((int) $total_duration); $sql .= " WHERE rowid = ".((int) $taskid); $resql = $db->query($sql); @@ -2945,7 +2945,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'"; $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'"; - $sqlUpdate .= " WHERE rowid = ".$obj->shipping_id; + $sqlUpdate .= " WHERE rowid = ".((int) $obj->shipping_id); $result = $db->query($sqlUpdate); if (!$result) { @@ -3407,8 +3407,8 @@ function migrate_categorie_association($db, $langs, $conf) $obj = $db->fetch_object($resql); $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."categorie SET "; - $sqlUpdate .= "fk_parent = ".$obj->fk_categorie_mere; - $sqlUpdate .= " WHERE rowid = ".$obj->fk_categorie_fille; + $sqlUpdate .= "fk_parent = ".((int) $obj->fk_categorie_mere); + $sqlUpdate .= " WHERE rowid = ".((int) $obj->fk_categorie_fille); $result = $db->query($sqlUpdate); if (!$result) { diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 1ba796026c6..686bd16d5de 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -237,8 +237,8 @@ if (dol_strlen($search_type) && $search_type != '-1') { if ($search_ref) $sql .= natural_search('i.ref', $search_ref); if ($search_label) $sql .= natural_search('i.label', $search_label); if ($search_barcode) $sql .= natural_search('i.barcode', $search_barcode); -if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".$db->escape($search_tosell); -if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".$db->escape($search_tobuy); +if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".((int) $search_tosell); +if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".((int) $search_tobuy); if (dol_strlen($canvas) > 0) $sql.= " AND i.canvas = '".$db->escape($canvas)."'"; */ diff --git a/htdocs/knowledgemanagement/knowledgemanagementindex.php b/htdocs/knowledgemanagement/knowledgemanagementindex.php index 86ea3f10e08..0402ab07710 100644 --- a/htdocs/knowledgemanagement/knowledgemanagementindex.php +++ b/htdocs/knowledgemanagement/knowledgemanagementindex.php @@ -113,7 +113,7 @@ if (! empty($conf->knowledgemanagement->enabled) && $user->rights->knowledgemana $sql.= " AND c.fk_statut = 0"; $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index b628de1b68b..b5c0ffc0add 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -356,12 +356,12 @@ class Loan extends CommonObject $sql .= " capital='".price2num($this->db->escape($this->capital))."',"; $sql .= " datestart='".$this->db->idate($this->datestart)."',"; $sql .= " dateend='".$this->db->idate($this->dateend)."',"; - $sql .= " nbterm=".$this->nbterm.","; - $sql .= " rate=".$this->db->escape($this->rate).","; + $sql .= " nbterm=".((float) $this->nbterm).","; + $sql .= " rate=".((float) $this->rate).","; $sql .= " accountancy_account_capital = '".$this->db->escape($this->account_capital)."',"; $sql .= " accountancy_account_insurance = '".$this->db->escape($this->account_insurance)."',"; $sql .= " accountancy_account_interest = '".$this->db->escape($this->account_interest)."',"; - $sql .= " fk_projet=".(empty($this->fk_project) ? 'NULL' : $this->fk_project).","; + $sql .= " fk_projet=".(empty($this->fk_project) ? 'NULL' : ((int) $this->fk_project)).","; $sql .= " fk_user_modif = ".$user->id.","; $sql .= " insurance_amount = '".price2num($this->db->escape($this->insurance_amount))."'"; $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 1ac670c4a7f..5f8c7320cd1 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -171,9 +171,9 @@ $sql .= ' AND s.entity IN ('.getEntity('societe').')'; $sql .= " AND d.fk_facture = f.rowid"; if ($agentid > 0) { if (!empty($conf->global->AGENT_CONTACT_TYPE)) { - $sql .= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))"; + $sql .= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".((int) $agentid).") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".((int) $agentid)."))"; } else { - $sql .= " AND sc.fk_user = ".$agentid; + $sql .= " AND sc.fk_user = ".((int) $agentid); } } if (!empty($startdate)) { diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 6f2337d1baf..a5e6e6af6e9 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -158,7 +158,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " AND f.fk_statut > 0"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND d.fk_facture = f.rowid"; - $sql .= " AND d.fk_product =".$object->id; + $sql .= " AND d.fk_product = ".((int) $object->id); if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index bc52cf7378f..faeb22a095b 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -145,14 +145,14 @@ class MyModuleApi extends DolibarrApi $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($restrictonsocid && $socid) { - $sql .= " AND t.fk_soc = ".$socid; + $sql .= " AND t.fk_soc = ".((int) $socid); } if ($restrictonsocid && $search_sale > 0) { $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale } // Insert sale filter if ($restrictonsocid && $search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 2d262aeeb36..990a6d91bfa 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -113,7 +113,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $sql.= " AND c.fk_statut = 0"; $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/mrp/class/api_mos.class.php b/htdocs/mrp/class/api_mos.class.php index a2558fe6252..0ece243dc39 100644 --- a/htdocs/mrp/class/api_mos.class.php +++ b/htdocs/mrp/class/api_mos.class.php @@ -137,14 +137,14 @@ class Mos extends DolibarrApi $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($restrictonsocid && $socid) { - $sql .= " AND t.fk_soc = ".$socid; + $sql .= " AND t.fk_soc = ".((int) $socid); } if ($restrictonsocid && $search_sale > 0) { $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale } // Insert sale filter if ($restrictonsocid && $search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } if ($sqlfilters) { if (!DolibarrApi::_checkFilters($sqlfilters)) { diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index e11fb65184a..e35abff84bb 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -321,9 +321,9 @@ class Opensurveysondage extends CommonObject $sql .= " date_fin=".(dol_strlen($this->date_fin) != 0 ? "'".$this->db->idate($this->date_fin)."'" : 'null').","; $sql .= " status=".(isset($this->status) ? "'".$this->db->escape($this->status)."'" : "null").","; $sql .= " format=".(isset($this->format) ? "'".$this->db->escape($this->format)."'" : "null").","; - $sql .= " mailsonde=".(isset($this->mailsonde) ? $this->db->escape($this->mailsonde) : "null").","; - $sql .= " allow_comments=".$this->db->escape($this->allow_comments).","; - $sql .= " allow_spy=".$this->db->escape($this->allow_spy); + $sql .= " mailsonde=".(isset($this->mailsonde) ? ((int) $this->mailsonde) : "null").","; + $sql .= " allow_comments=".((int) $this->allow_comments).","; + $sql .= " allow_spy=".((int) $this->allow_spy); $sql .= " WHERE id_sondage='".$this->db->escape($this->id_sondage)."'"; $this->db->begin(); diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 992fca2703e..04f5db251e5 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -102,7 +102,7 @@ class PartnershipUtils $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as dty on (dty.rowid = d.fk_adherent_type)"; $sql .= " WHERE fk_member > 0"; $sql .= " AND (d.datefin < '".$this->db->idate($datetotest)."' AND dty.subscription = 1)"; - $sql .= " AND p.status = ".$partnership::STATUS_ACCEPTED; // Only accepted not yet canceled + $sql .= " AND p.status = ".((int) $partnership::STATUS_ACCEPTED); // Only accepted not yet canceled $sql .= $this->db->order('d.rowid', 'ASC'); // Limit is managed into loop later @@ -263,7 +263,7 @@ class PartnershipUtils $sql .= " WHERE 1 = 1"; $sql .= " AND p.".$fk_partner." > 0"; - $sql .= " AND p.status = ".$partnership::STATUS_ACCEPTED; // Only accepted not yet canceled + $sql .= " AND p.status = ".((int) $partnership::STATUS_ACCEPTED); // Only accepted not yet canceled $sql .= " AND (p.last_check_backlink IS NULL OR p.last_check_backlink <= '".$this->db->idate($now - 7 * 24 * 3600)."')"; // Every week, check that website contains a link to dolibarr. $sql .= $this->db->order('p.rowid', 'ASC'); // Limit is managed into loop later diff --git a/htdocs/partnership/partnershipindex.php b/htdocs/partnership/partnershipindex.php index 8076f105dbb..ce7a17b8fce 100644 --- a/htdocs/partnership/partnershipindex.php +++ b/htdocs/partnership/partnershipindex.php @@ -113,7 +113,7 @@ if (! empty($conf->partnership->enabled) && $user->rights->partnership->read) $sql.= " AND c.fk_statut = 0"; $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 901e2b387e3..ac2e70e3287 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -122,8 +122,8 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { // Price by qty if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { // If we need a particular price related to qty $sql = "SELECT price, unitprice, quantity, remise_percent"; - $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty "; - $sql .= " WHERE rowid=".$price_by_qty_rowid.""; + $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty"; + $sql .= " WHERE rowid = ".((int) $price_by_qty_rowid); $result = $db->query($sql); if ($result) { diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 3bda877af62..d155abdc2c2 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -349,11 +349,11 @@ class ActionsCardProduct } } - if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0) { - $sql .= " AND p.tosell = ".$this->db->escape($_GET["tosell"]); + if (GETPOSTISSET("tosell")) { + $sql .= " AND p.tosell = ".((int) GETPOST("tosell", "int")); } - if (isset($_GET["canvas"]) && dol_strlen($_GET["canvas"]) > 0) { - $sql .= " AND p.canvas = '".$this->db->escape($_GET["canvas"])."'"; + if (GETPOSTISSET("canvas")) { + $sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'"; } $sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->plimit($limit + 1, $offset); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 53e0df73212..c4296dc63a8 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -298,29 +298,29 @@ class ActionsCardService $sql .= " AND (p.ref LIKE '%".$this->db->escape($sall)."%' OR p.label LIKE '%".$this->db->escape($sall)."%' OR p.description LIKE '%".$this->db->escape($sall)."%' OR p.note LIKE '%".$this->db->escape($sall)."%')"; } if ($sref) { - $sql .= " AND p.ref LIKE '%".$sref."%'"; + $sql .= " AND p.ref LIKE '%".$this->db->escape($sref)."%'"; } if ($search_barcode) { - $sql .= " AND p.barcode LIKE '%".$search_barcode."%'"; + $sql .= " AND p.barcode LIKE '%".$this->db->escape($search_barcode)."%'"; } if ($snom) { $sql .= " AND p.label LIKE '%".$this->db->escape($snom)."%'"; } - if (isset($_GET["tosell"]) && dol_strlen($_GET["tosell"]) > 0) { - $sql .= " AND p.tosell = ".$this->db->escape($_GET["tosell"]); + if (GETPOSTISSET("tosell")) { + $sql .= " AND p.tosell = ".((int) GETPOST("tosell", 'int')); } - if (isset($_GET["canvas"]) && dol_strlen($_GET["canvas"]) > 0) { - $sql .= " AND p.canvas = '".$this->db->escape($_GET["canvas"])."'"; + if (GETPOSTISSET("canvas")) { + $sql .= " AND p.canvas = '".$this->db->escape(GETPOST("canvas"))."'"; } if ($catid) { - $sql .= " AND cp.fk_categorie = ".$catid; + $sql .= " AND cp.fk_categorie = ".((int) $catid); } if ($fourn_id > 0) { - $sql .= " AND p.rowid = pfp.fk_product AND pfp.fk_soc = ".$fourn_id; + $sql .= " AND p.rowid = pfp.fk_product AND pfp.fk_soc = ".((int) $fourn_id); } // Insert categ filter if ($search_categ) { - $sql .= " AND cp.fk_categorie = ".$this->db->escape($search_categ); + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } $sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->plimit($limit + 1, $offset); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b4e860a1069..2e0d21b0456 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -206,8 +206,8 @@ class Products extends DolibarrApi // Select products of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category); - $sql .= " AND c.fk_product = t.rowid "; + $sql .= " AND c.fk_categorie = ".((int) $category); + $sql .= " AND c.fk_product = t.rowid"; } if ($mode == 1) { // Show only products diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6aee9af9c60..1afd1e74e23 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1055,16 +1055,16 @@ class Product extends CommonObject $sql .= " SET label = '".$this->db->escape($this->label)."'"; if ($updatetype && ($this->isProduct() || $this->isService())) { - $sql .= ", fk_product_type = ".$this->type; + $sql .= ", fk_product_type = ".((int) $this->type); } $sql .= ", ref = '".$this->db->escape($this->ref)."'"; $sql .= ", ref_ext = ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", default_vat_code = ".($this->default_vat_code ? "'".$this->db->escape($this->default_vat_code)."'" : "null"); - $sql .= ", tva_tx = ".$this->tva_tx; - $sql .= ", recuperableonly = ".$this->tva_npr; - $sql .= ", localtax1_tx = ".$this->localtax1_tx; - $sql .= ", localtax2_tx = ".$this->localtax2_tx; + $sql .= ", tva_tx = ".((float) $this->tva_tx); + $sql .= ", recuperableonly = ".((int) $this->tva_npr); + $sql .= ", localtax1_tx = ".((float) $this->localtax1_tx); + $sql .= ", localtax2_tx = ".((float) $this->localtax2_tx); $sql .= ", localtax1_type = ".($this->localtax1_type != '' ? "'".$this->db->escape($this->localtax1_type)."'" : "'0'"); $sql .= ", localtax2_type = ".($this->localtax2_type != '' ? "'".$this->db->escape($this->localtax2_type)."'" : "'0'"); @@ -2391,8 +2391,8 @@ class Product extends CommonObject $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price"; $sql .= " WHERE entity IN (".getEntity('productprice').")"; - $sql .= " AND price_level=".$i; - $sql .= " AND fk_product = ".$this->id; + $sql .= " AND price_level=".((int) $i); + $sql .= " AND fk_product = ".((int) $this->id); $sql .= " ORDER BY date_price DESC, rowid DESC"; $sql .= " LIMIT 1"; $resql = $this->db->query($sql); @@ -2501,7 +2501,7 @@ class Product extends CommonObject $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price"; $sql .= " WHERE entity IN (".getEntity('productprice').")"; - $sql .= " AND price_level=".$i; + $sql .= " AND price_level=".((int) $i); $sql .= " AND fk_product = ".$this->id; $sql .= " ORDER BY date_price DESC, rowid DESC"; $sql .= " LIMIT 1"; @@ -2613,7 +2613,7 @@ class Product extends CommonObject $sql .= " AND mp.fk_product =".$this->id; $sql .= " AND mp.role ='".$this->db->escape($role)."'"; if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -2739,7 +2739,7 @@ class Product extends CommonObject } //$sql.= " AND pr.fk_statut != 0"; if ($socid > 0) { - $sql .= " AND p.fk_soc = ".$socid; + $sql .= " AND p.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -2814,7 +2814,7 @@ class Product extends CommonObject } //$sql.= " AND pr.fk_statut != 0"; if ($socid > 0) { - $sql .= " AND p.fk_soc = ".$socid; + $sql .= " AND p.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -2869,7 +2869,7 @@ class Product extends CommonObject $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if ($filtrestatut <> '') { $sql .= " AND c.fk_statut in (".$this->db->sanitize($filtrestatut).")"; @@ -2971,7 +2971,7 @@ class Product extends CommonObject $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if ($filtrestatut != '') { $sql .= " AND c.fk_statut in (".$this->db->sanitize($filtrestatut).")"; // Peut valoir 0 @@ -3033,7 +3033,7 @@ class Product extends CommonObject $sql .= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND e.fk_soc = ".$socid; + $sql .= " AND e.fk_soc = ".((int) $socid); } if ($filtrestatut <> '') { $sql .= " AND c.fk_statut IN (".$this->db->sanitize($filtrestatut).")"; @@ -3114,7 +3114,7 @@ class Product extends CommonObject $sql .= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND cf.fk_soc = ".$socid; + $sql .= " AND cf.fk_soc = ".((int) $socid); } if ($filtrestatut <> '') { $sql .= " AND cf.fk_statut IN (".$this->db->sanitize($filtrestatut).")"; @@ -3170,7 +3170,7 @@ class Product extends CommonObject $sql .= " AND m.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND m.fk_soc = ".$socid; + $sql .= " AND m.fk_soc = ".((int) $socid); } if ($filtrestatut <> '') { $sql .= " AND m.status IN (".$this->db->sanitize($filtrestatut).")"; @@ -3265,7 +3265,7 @@ class Product extends CommonObject } //$sql.= " AND c.statut != 0"; if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -3339,7 +3339,7 @@ class Product extends CommonObject } //$sql.= " AND f.fk_statut != 0"; if ($socid > 0) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -3413,7 +3413,7 @@ class Product extends CommonObject } //$sql.= " AND f.fk_statut != 0"; if ($socid > 0) { - $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.fk_soc = ".((int) $socid); } $result = $this->db->query($sql); @@ -3655,7 +3655,7 @@ class Product extends CommonObject $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND p.fk_soc = ".$socid; + $sql .= " AND p.fk_soc = ".((int) $socid); } $sql .= $morefilter; $sql .= " GROUP BY date_format(p.datep,'%Y%m')"; @@ -3758,7 +3758,7 @@ class Product extends CommonObject $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $sql .= $morefilter; $sql .= " GROUP BY date_format(c.date_commande,'%Y%m')"; @@ -3809,7 +3809,7 @@ class Product extends CommonObject $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $sql .= $morefilter; $sql .= " GROUP BY date_format(c.date_commande,'%Y%m')"; @@ -3863,7 +3863,7 @@ class Product extends CommonObject $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $sql .= $morefilter; $sql .= " GROUP BY date_format(c.date_contrat,'%Y%m')"; @@ -3916,7 +3916,7 @@ class Product extends CommonObject $sql .= " AND d.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid > 0) { - $sql .= " AND d.fk_soc = ".$socid; + $sql .= " AND d.fk_soc = ".((int) $socid); } $sql .= $morefilter; $sql .= " GROUP BY date_format(d.date_valid,'%Y%m')"; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 10704f2f53e..529284af464 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -384,7 +384,7 @@ class Productbatch extends CommonObject $sql .= " t.qty,"; $sql .= " t.import_key"; $sql .= " FROM ".MAIN_DB_PREFIX.self::$_table_element." as t"; - $sql .= " WHERE fk_product_stock=".$fk_product_stock; + $sql .= " WHERE fk_product_stock=".((int) $fk_product_stock); if (!empty($eatby)) { array_push($where, " eatby = '".$this->db->idate($eatby)."'"); // deprecated @@ -454,10 +454,10 @@ class Productbatch extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX."product_batch as t"; if ($fk_product > 0) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.fk_product = ".$fk_product." AND pl.batch = t.batch"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lot as pl ON pl.fk_product = ".((int) $fk_product)." AND pl.batch = t.batch"; // TODO May add extrafields to ? } - $sql .= " WHERE fk_product_stock=".$fk_product_stock; + $sql .= " WHERE fk_product_stock=".((int) $fk_product_stock); if ($with_qty) { $sql .= " AND t.qty <> 0"; } diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index a1d92cc492a..0b5ea0cc2a6 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -408,10 +408,10 @@ class Propalmergepdfproduct extends CommonObject if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_merge_pdf_product"; - $sql .= " WHERE fk_product=".$product_id; + $sql .= " WHERE fk_product = ".((int) $product_id); if ($conf->global->MAIN_MULTILANGS && !empty($lang_id)) { - $sql .= " AND lang='".$this->db->escape($lang_id)."'"; + $sql .= " AND lang = '".$this->db->escape($lang_id)."'"; } dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index 5286b932ca7..0404f0bd97a 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -182,7 +182,7 @@ class PriceGlobalVariable $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; $sql .= " code = ".(isset($this->code) ? "'".$this->db->escape($this->code)."'" : "''").","; $sql .= " description = ".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "''").","; - $sql .= " value = ".$this->value; + $sql .= " value = ".((float) $this->value); $sql .= " WHERE rowid = ".$this->id; $this->db->begin(); diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 172c004a2d7..4272beb44bc 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -200,12 +200,12 @@ class PriceGlobalVariableUpdater // Update request $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; - $sql .= " type = ".$this->type.","; + $sql .= " type = ".((int) $this->type).","; $sql .= " description = ".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "''").","; $sql .= " parameters = ".(isset($this->parameters) ? "'".$this->db->escape($this->parameters)."'" : "''").","; - $sql .= " fk_variable = ".$this->fk_variable.","; - $sql .= " update_interval = ".$this->update_interval.","; - $sql .= " next_update = ".$this->next_update.","; + $sql .= " fk_variable = ".((int) $this->fk_variable).","; + $sql .= " update_interval = ".((int) $this->update_interval).","; + $sql .= " next_update = ".((int) $this->next_update).","; $sql .= " last_status = ".(isset($this->last_status) ? "'".$this->db->escape($this->last_status)."'" : "''"); $sql .= " WHERE rowid = ".$this->id; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 0e709f54f99..4aaaf3a0fa7 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -287,7 +287,7 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE p.entity IN (".getEntity($product_static->element, 1).")"; if ($type != '') { - $sql .= " AND p.fk_product_type = ".$type; + $sql .= " AND p.fk_product_type = ".((int) $type); } // Add where from hooks $parameters = array(); @@ -445,8 +445,8 @@ function activitytrim($product_type) $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.rowid = fd.fk_facture"; $sql .= " AND pf.fk_facture = f.rowid"; - $sql .= " AND pf.fk_paiement= p.rowid"; - $sql .= " AND fd.product_type=".$product_type; + $sql .= " AND pf.fk_paiement = p.rowid"; + $sql .= " AND fd.product_type = ".((int) $product_type); $sql .= " AND p.datep >= '".$db->idate(dol_get_first_day($yearofbegindate), 1)."'"; $sql .= " GROUP BY annee, mois "; $sql .= " ORDER BY annee, mois "; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index eb3fc71d53a..0c922fab0dd 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -451,7 +451,7 @@ if (dol_strlen($canvas) > 0) { $sql .= " AND p.canvas = '".$db->escape($canvas)."'"; } if ($catid > 0) { - $sql .= " AND cp.fk_categorie = ".$catid; + $sql .= " AND cp.fk_categorie = ".((int) $catid); } if ($catid == -2) { $sql .= " AND cp.fk_categorie IS NULL"; diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 5aa54b0963c..8ffae0bee8c 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -211,7 +211,7 @@ if ($mode && $mode != '-1') { if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active $sql = "SELECT label"; $sql .= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql .= " WHERE fk_product=".$prodid; + $sql .= " WHERE fk_product = ".((int) $prodid); $sql .= " AND lang='".$db->escape($langs->getDefaultLang())."'"; $sql .= " LIMIT 1"; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 342acb49b6e..f8db6915409 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -190,7 +190,7 @@ if ($fourn_id > 0) { } // Insert categ filter if ($search_categ) { - $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql .= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 38b16cea44a..ea9901a3794 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -179,7 +179,7 @@ if ($fourn_id > 0) { } // Insert categ filter if ($search_categ) { - $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); + $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } if ($search_warehouse) { $sql .= natural_search("e.ref", $search_warehouse); diff --git a/htdocs/product/stats/bom.php b/htdocs/product/stats/bom.php index 505bc8ed060..8db7c63d83e 100644 --- a/htdocs/product/stats/bom.php +++ b/htdocs/product/stats/bom.php @@ -138,7 +138,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b"; $sql .= " WHERE "; $sql .= " b.entity IN (".getEntity('bom').")"; - $sql .= " AND b.fk_product =".$product->id; + $sql .= " AND b.fk_product = ".((int) $product->id); $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -184,9 +184,8 @@ if ($id > 0 || !empty($ref)) { $sql .= " SUM(bl.qty) as qty_toconsume"; $sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as b"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."bom_bomline as bl ON bl.fk_bom=b.rowid"; - $sql .= " WHERE "; - $sql .= " b.entity IN (".getEntity('bom').")"; - $sql .= " AND bl.fk_product=".$product->id; + $sql .= " WHERE b.entity IN (".getEntity('bom').")"; + $sql .= " AND bl.fk_product = ".((int) $product->id); $sql .= " GROUP BY b.rowid, b.ref, b.date_valid, b.status"; $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 9ba4dee7081..623306536b7 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -151,7 +151,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('commande').")"; $sql .= " AND d.fk_commande = c.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(c.date_commande) IN ('.$db->sanitize($search_month).')'; } @@ -159,7 +159,7 @@ if ($id > 0 || !empty($ref)) { $sql .= ' AND YEAR(c.date_commande) IN ('.$db->sanitize($search_year).')'; } if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 6037f608b58..e42905811a8 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -152,7 +152,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity = ".$conf->entity; $sql .= " AND d.fk_commande = c.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(c.date_commande) IN ('.$db->sanitize($search_month).')'; } @@ -160,7 +160,7 @@ if ($id > 0 || !empty($ref)) { $sql .= ' AND YEAR(c.date_commande) IN ('.$db->sanitize($search_year).')'; } if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($socid) { $sql .= " AND c.fk_soc = ".((int) $socid); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index f91e74edf50..f71c907a430 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -142,7 +142,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE c.rowid = cd.fk_contrat"; $sql .= " AND c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('contract').")"; - $sql .= " AND cd.fk_product =".$product->id; + $sql .= " AND cd.fk_product = ".((int) $product->id); if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; } diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 0681aa9b5ca..b8a83e847c2 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -168,7 +168,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; $sql .= " AND d.fk_facture = f.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(f.datef) IN ('.$db->sanitize($search_month).')'; } diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 69ef83ae5a7..2ad05313762 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -151,7 +151,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.entity IN (".getEntity('facture_fourn').")"; $sql .= " AND d.fk_facture_fourn = f.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(f.datef) IN ('.$db->sanitize($search_month).')'; } diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php index fefb89592e7..81bb29650db 100644 --- a/htdocs/product/stats/mo.php +++ b/htdocs/product/stats/mo.php @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { $sql .= ", ".MAIN_DB_PREFIX."mrp_production as cd"; $sql .= " WHERE c.rowid = cd.fk_mo"; $sql .= " AND c.entity IN (".getEntity('mo').")"; - $sql .= " AND cd.fk_product =".$product->id; + $sql .= " AND cd.fk_product = ".((int) $product->id); if ($socid) { $sql .= " AND s.rowid = ".((int) $socid); } diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 96303ac598d..f2a26d4af73 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -153,7 +153,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE p.fk_soc = s.rowid"; $sql .= " AND p.entity IN (".getEntity('propal').")"; $sql .= " AND d.fk_propal = p.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(p.datep) IN ('.$db->sanitize($search_month).')'; } diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php index 1b236ed3999..3de03aa73c1 100644 --- a/htdocs/product/stats/supplier_proposal.php +++ b/htdocs/product/stats/supplier_proposal.php @@ -152,7 +152,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE p.fk_soc = s.rowid"; $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")"; $sql .= " AND d.fk_supplier_proposal = p.rowid"; - $sql .= " AND d.fk_product =".$product->id; + $sql .= " AND d.fk_product = ".((int) $product->id); if (!empty($search_month)) { $sql .= ' AND MONTH(p.datep) IN ('.$db->sanitize($search_month).')'; } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 91284944397..55ab129edee 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -645,7 +645,7 @@ if ($action == 'create') { $sql .= " WHERE ps.fk_product = p.rowid"; $sql .= " AND ps.reel <> 0"; // We do not show if stock is 0 (no product in this warehouse) - $sql .= " AND ps.fk_entrepot = ".$object->id; + $sql .= " AND ps.fk_entrepot = ".((int) $object->id); if ($separatedPMP) { $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 35791bfd158..c7516066e7f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -293,17 +293,17 @@ class Entrepot extends CommonObject $this->town = trim($this->town); $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); - $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; + $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot"; $sql .= " SET ref = '".$this->db->escape($this->label)."'"; $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL"); $sql .= ", fk_project = ".(($this->fk_project > 0) ? $this->fk_project : "NULL"); $sql .= ", description = '".$this->db->escape($this->description)."'"; - $sql .= ", statut = ".$this->statut; + $sql .= ", statut = ".((int) $this->statut); $sql .= ", lieu = '".$this->db->escape($this->lieu)."'"; $sql .= ", address = '".$this->db->escape($this->address)."'"; $sql .= ", zip = '".$this->db->escape($this->zip)."'"; $sql .= ", town = '".$this->db->escape($this->town)."'"; - $sql .= ", fk_pays = ".$this->country_id; + $sql .= ", fk_pays = ".((int) $this->country_id); $sql .= ", phone = '".$this->db->escape($this->phone)."'"; $sql .= ", fax = '".$this->db->escape($this->fax)."'"; $sql .= " WHERE rowid = ".((int) $id); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 0220df610e4..ef1393dfb63 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -951,7 +951,7 @@ if (!$variants) { $sql .= " WHERE ps.reel != 0"; $sql .= " AND ps.fk_entrepot = e.rowid"; $sql .= " AND e.entity IN (".getEntity('stock').")"; - $sql .= " AND ps.fk_product = ".$object->id; + $sql .= " AND ps.fk_product = ".((int) $object->id); $sql .= " ORDER BY e.ref"; $entrepotstatic = new Entrepot($db); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 52addeba637..77923d9e7c9 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -136,10 +136,10 @@ if ($date && $dateIsValid) { // Avoid heavy sql if mandatory date is not defined $sql .= " AND w.statut IN (".$db->sanitize(implode(',', $warehouseStatus)).")"; } if ($productid > 0) { - $sql .= " AND ps.fk_product = ".$productid; + $sql .= " AND ps.fk_product = ".((int) $productid); } if ($fk_warehouse > 0) { - $sql .= " AND ps.fk_entrepot = ".$fk_warehouse; + $sql .= " AND ps.fk_entrepot = ".((int) $fk_warehouse); } $sql .= " GROUP BY fk_product, fk_entrepot"; //print $sql; diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 0191cc74ef8..60484eb4f17 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -425,7 +425,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_SH $sql .= " AND ect.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listoftaskcontacttype))).") AND ect.element_id = t.rowid AND ect.fk_socpeople = ".$user->id; } if ($socid) { - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; } $sql .= " AND p.fk_statut=1"; $sql .= " GROUP BY p.ref, p.title, p.rowid, p.fk_statut, p.fk_opp_status, p.public, t.label, t.rowid, t.planned_workload, t.duration_effective, t.progress, t.dateo, t.datee"; diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index b0b94264fb0..38f525626ba 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -146,7 +146,7 @@ class Projects extends DolibarrApi } // Select projects of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_project = t.rowid "; + $sql .= " AND c.fk_categorie = ".((int) $category)." AND c.fk_project = t.rowid "; } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 851703ce96b..e381aaabfb3 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -486,7 +486,7 @@ class Project extends CommonObject $sql .= ", title = '".$this->db->escape($this->title)."'"; $sql .= ", description = '".$this->db->escape($this->description)."'"; $sql .= ", fk_soc = ".($this->socid > 0 ? $this->socid : "null"); - $sql .= ", fk_statut = ".$this->statut; + $sql .= ", fk_statut = ".((int) $this->statut); $sql .= ", fk_opp_status = ".((is_numeric($this->opp_status) && $this->opp_status > 0) ? $this->opp_status : 'null'); $sql .= ", opp_percent = ".((is_numeric($this->opp_percent) && $this->opp_percent != '') ? $this->opp_percent : 'null'); $sql .= ", public = ".($this->public ? 1 : 0); @@ -1777,13 +1777,13 @@ class Project extends CommonObject if ($tableName == "actioncomm") { $sql .= " SET fk_project=".$this->id; - $sql .= " WHERE id=".$elementSelectId; + $sql .= " WHERE id=".((int) $elementSelectId); } elseif ($tableName == "entrepot") { $sql .= " SET fk_project=".$this->id; - $sql .= " WHERE rowid=".$elementSelectId; + $sql .= " WHERE rowid=".((int) $elementSelectId); } else { $sql .= " SET fk_projet=".$this->id; - $sql .= " WHERE rowid=".$elementSelectId; + $sql .= " WHERE rowid=".((int) $elementSelectId); } dol_syslog(get_class($this)."::update_element", LOG_DEBUG); @@ -1813,10 +1813,10 @@ class Project extends CommonObject if ($tableName == "actioncomm") { $sql .= " SET fk_project=NULL"; - $sql .= " WHERE id=".$elementSelectId; + $sql .= " WHERE id=".((int) $elementSelectId); } else { $sql .= " SET ".$projectfield."=NULL"; - $sql .= " WHERE rowid=".$elementSelectId; + $sql .= " WHERE rowid=".((int) $elementSelectId); } dol_syslog(get_class($this)."::remove_element", LOG_DEBUG); @@ -1888,10 +1888,10 @@ class Project extends CommonObject $sql .= " AND (ptt.task_date >= '".$this->db->idate($datestart)."' "; $sql .= " AND ptt.task_date <= '".$this->db->idate(dol_time_plus_duree($datestart, 1, 'w') - 1)."')"; if ($taskid) { - $sql .= " AND ptt.fk_task=".$taskid; + $sql .= " AND ptt.fk_task=".((int) $taskid); } if (is_numeric($userid)) { - $sql .= " AND ptt.fk_user=".$userid; + $sql .= " AND ptt.fk_user=".((int) $userid); } //print $sql; @@ -1951,10 +1951,10 @@ class Project extends CommonObject $sql .= " AND (ptt.task_date >= '".$this->db->idate($datestart)."' "; $sql .= " AND ptt.task_date <= '".$this->db->idate(dol_time_plus_duree($datestart, 1, 'm') - 1)."')"; if ($task_id) { - $sql .= " AND ptt.fk_task=".$taskid; + $sql .= " AND ptt.fk_task=".((int) $taskid); } if (is_numeric($userid)) { - $sql .= " AND ptt.fk_user=".$userid; + $sql .= " AND ptt.fk_user=".((int) $userid); } //print $sql; diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 42c5ae2135f..1845e303704 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -68,7 +68,7 @@ class ProjectStats extends Stats $sql .= ", ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= $this->buildWhere(); // For external user, no check is done on company permission because readability is managed by public status of project and assignement. - //if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; + //if ($socid > 0) $sql.= " AND t.fk_soc = ".((int) $socid); // No check is done on company permission because readability is managed by public status of project and assignement. //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; $sql .= " AND t.fk_opp_status = cls.rowid"; @@ -133,7 +133,7 @@ class ProjectStats extends Stats // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); // For external user, no check is done on company permission because readability is managed by public status of project and assignement. - //if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; + //if ($socid > 0) $sql.= " AND t.fk_soc = ".((int) $socid); // No check is done on company permission because readability is managed by public status of project and assignement. //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; $sql .= " GROUP BY year"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 9f81218ba8d..bd25398776e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -854,7 +854,7 @@ class Task extends CommonObject $sql .= " AND p.rowid = ec.element_id"; $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; $sql .= " AND ctc.element = 'project'"; - $sql .= " AND ec.fk_socpeople = ".$filteronprojuser; + $sql .= " AND ec.fk_socpeople = ".((int) $filteronprojuser); $sql .= " AND ec.statut = 4"; $sql .= " AND ctc.source = 'internal'"; } @@ -863,12 +863,12 @@ class Task extends CommonObject $sql .= " AND p.rowid = ec2.element_id"; $sql .= " AND ctc2.rowid = ec2.fk_c_type_contact"; $sql .= " AND ctc2.element = 'project_task'"; - $sql .= " AND ec2.fk_socpeople = ".$filterontaskuser; + $sql .= " AND ec2.fk_socpeople = ".((int) $filterontaskuser); $sql .= " AND ec2.statut = 4"; $sql .= " AND ctc2.source = 'internal'"; } if ($socid) { - $sql .= " AND p.fk_soc = ".$socid; + $sql .= " AND p.fk_soc = ".((int) $socid); } if ($projectid) { $sql .= " AND p.rowid IN (".$this->db->sanitize($projectid).")"; @@ -1525,10 +1525,10 @@ class Task extends CommonObject $sql .= " task_date = '".$this->db->idate($this->timespent_date)."',"; $sql .= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; $sql .= " task_date_withhour = ".(empty($this->timespent_withhour) ? 0 : 1).","; - $sql .= " task_duration = ".$this->timespent_duration.","; - $sql .= " fk_user = ".$this->timespent_fk_user.","; + $sql .= " task_duration = ".((int) $this->timespent_duration).","; + $sql .= " fk_user = ".((int) $this->timespent_fk_user).","; $sql .= " note = ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); - $sql .= " WHERE rowid = ".$this->timespent_id; + $sql .= " WHERE rowid = ".((int) $this->timespent_id); dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); if ($this->db->query($sql)) { @@ -2082,7 +2082,7 @@ class Task extends CommonObject // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; if ($socid) { - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id.") OR (s.rowid IS NULL))"; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index d8c875d2933..aa9d9a8a437 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -213,7 +213,7 @@ if ($mine || empty($user->rights->projet->all->lire)) { $sql .= " AND p.rowid IN (".$db->sanitize($projectsListId).")"; // If we have this test true, it also means projectset is not 2 } if ($socid) { - $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; } $sql .= " ORDER BY p.tms DESC"; $sql .= $db->plimit($max, 0); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index aa1229ccb42..c95ae10e79a 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -402,12 +402,12 @@ if ($search_status >= 0) { if ($search_status == 99) { $sql .= " AND p.fk_statut <> 2"; } else { - $sql .= " AND p.fk_statut = ".$db->escape($search_status); + $sql .= " AND p.fk_statut = ".((int) $search_status); } } if ($search_opp_status) { if (is_numeric($search_opp_status) && $search_opp_status > 0) { - $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); + $sql .= " AND p.fk_opp_status = ".((int) $search_opp_status); } if ($search_opp_status == 'all') { $sql .= " AND (p.fk_opp_status IS NOT NULL AND p.fk_opp_status <> -1)"; @@ -423,7 +423,7 @@ if ($search_opp_status) { } } if ($search_public != '') { - $sql .= " AND p.public = ".$db->escape($search_public); + $sql .= " AND p.public = ".((int) $search_public); } // For external user, no check is done on company permission because readability is managed by public status of project and assignement. //if ($socid > 0) $sql.= " AND s.rowid = ".((int) $socid); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index e842b409eae..bbb7b1e51f9 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -39,6 +39,7 @@ $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +$optioncss = GETPOST('optioncss', 'aZ09'); $id = GETPOST('id', 'int'); @@ -382,12 +383,9 @@ if ($search_projectstatus >= 0) { if ($search_projectstatus == 99) { $sql .= " AND p.fk_statut <> 2"; } else { - $sql .= " AND p.fk_statut = ".$db->escape($search_projectstatus); + $sql .= " AND p.fk_statut = ".((int) $search_projectstatus); } } -if ($search_public != '') { - $sql .= " AND p.public = ".$db->escape($search_public); -} if ($search_project_user > 0) { $sql .= " AND ecp.fk_c_type_contact IN (".$db->sanitize(join(',', array_keys($listofprojectcontacttype))).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; } @@ -512,9 +510,6 @@ if ($search_projectstatus != '') { if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all', 'none'))) { $param .= '&search_opp_status='.urlencode($search_opp_status); } -if ($search_public != '') { - $param .= '&search_public='.urlencode($search_public); -} if ($search_project_user != '') { $param .= '&search_project_user='.urlencode($search_project_user); } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 01622a41945..a9316bcedcd 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1043,7 +1043,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { $sql .= " ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; if (empty($projectidforalltimes)) { - $sql .= " AND t.fk_task =".$object->id; + $sql .= " AND t.fk_task =".((int) $object->id); } else { $sql .= " AND pt.fk_projet IN (".$db->sanitize($projectidforalltimes).")"; } diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index 9c39dafa18d..6648bafd07a 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -127,7 +127,7 @@ if (!empty($tag) && ($unsuscrib == '1')) { // Update status of mail in recipient mailing list table $statut = '3'; - $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".$statut." WHERE tag='".$db->escape($tag)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles SET statut=".((int) $statut)." WHERE tag = '".$db->escape($tag)."'"; $resql = $db->query($sql); if (!$resql) { diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index cd34b0f916f..531fdf9c23a 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1699,10 +1699,10 @@ if ($action == 'create') { //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; - $sql .= " AND obj.fk_commande = ".$origin_id; + $sql .= " AND obj.fk_commande = ".((int) $origin_id); $sql .= " AND obj.rowid = ed.fk_commandefourndet"; $sql .= " AND ed.fk_reception = e.rowid"; - $sql .= " AND ed.fk_reception !=".$object->id; + $sql .= " AND ed.fk_reception !=".(int) $object->id); //if ($filter) $sql.= $filter; $sql .= " ORDER BY obj.fk_product"; diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index 9eadc3be41a..7cb26dee0ca 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -94,7 +94,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= $clause." e.fk_statut = 0"; $sql .= " AND e.entity IN (".getEntity('reception').")"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $resql = $db->query($sql); @@ -160,7 +160,7 @@ if (!$user->rights->societe->client->voir && !$socid) { } $sql .= " AND e.fk_statut = 1"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } $sql .= " ORDER BY e.date_delivery DESC"; $sql .= $db->plimit($max, 0); @@ -219,7 +219,7 @@ $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; $sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")"; if ($socid > 0) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 7295b3df75a..a6ecd37cc6d 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -454,10 +454,10 @@ if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no $sql .= " AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND e.fk_soc = ".$socid; + $sql .= " AND e.fk_soc = ".((int) $socid); } if ($search_status <> '' && $search_status >= 0) { - $sql .= " AND e.fk_statut = ".$search_status; + $sql .= " AND e.fk_statut = ".((int) $search_status); } if ($search_billed != '' && $search_billed >= 0) { $sql .= ' AND e.billed = '.((int) $search_billed); diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php index 7e369fe6bb2..d3f97e6f3d1 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/recruitmentindex.php @@ -255,7 +255,7 @@ if (! empty($conf->recruitment->enabled) && $user->rights->recruitment->read) $sql.= " AND c.fk_statut = 0"; $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND c.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 4979a883d9c..91f68951842 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -200,7 +200,7 @@ class Dolresource extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource"; if ($id) { - $sql .= " WHERE t.rowid = ".$this->db->escape($id); + $sql .= " WHERE t.rowid = ".((int) $id); } else { $sql .= " WHERE t.ref = '".$this->db->escape($ref)."'"; } @@ -415,7 +415,7 @@ class Dolresource extends CommonObject dol_syslog(get_class($this), LOG_DEBUG); if ($this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_resources"; - $sql .= " WHERE element_type='resource' AND resource_id =".$this->db->escape($rowid); + $sql .= " WHERE element_type='resource' AND resource_id = ".((int) $rowid); dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { @@ -831,7 +831,7 @@ class Dolresource extends CommonObject // Links beetween objects are stored in this table $sql = 'SELECT rowid, resource_id, resource_type, busy, mandatory'; $sql .= ' FROM '.MAIN_DB_PREFIX.'element_resources'; - $sql .= " WHERE element_id=".$element_id." AND element_type='".$this->db->escape($element)."'"; + $sql .= " WHERE element_id=".((int) $element_id)." AND element_type='".$this->db->escape($element)."'"; if ($resource_type) { $sql .= " AND resource_type LIKE '%".$this->db->escape($resource_type)."%'"; } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e7f1af66e0c..2f87fdd99d2 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -132,14 +132,13 @@ class Salary extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."salary SET"; - $sql .= " tms='".$this->db->idate(dol_now())."',"; - $sql .= " fk_user=".$this->fk_user.","; + $sql .= " fk_user=".((int) $this->fk_user).","; /*$sql .= " datep='".$this->db->idate($this->datep)."',"; $sql .= " datev='".$this->db->idate($this->datev)."',";*/ $sql .= " amount=".price2num($this->amount).","; $sql .= " fk_projet=".((int) $this->fk_project).","; - $sql .= " fk_typepayment=".$this->type_payment.","; + $sql .= " fk_typepayment=".((int) $this->type_payment).","; $sql .= " label='".$this->db->escape($this->label)."',"; $sql .= " datesp='".$this->db->idate($this->datesp)."',"; $sql .= " dateep='".$this->db->idate($this->dateep)."',"; @@ -147,7 +146,6 @@ class Salary extends CommonObject $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); - $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 382e05e4f0d..b4abbb04a26 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -273,10 +273,10 @@ if ($search_account > 0) { $sql .= " AND s.fk_account=".((int) $search_account); } if ($search_status != '' && $search_status >= 0) { - $sql .= " AND s.paye = ".$db->escape($search_status); + $sql .= " AND s.paye = ".((int) $search_status); } if ($search_type_id) { - $sql .= " AND s.fk_typepayment=".$search_type_id; + $sql .= " AND s.fk_typepayment=".((int) $search_type_id); } $sql .= " GROUP BY u.rowid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary, u.fk_soc, u.statut,"; $sql .= " s.rowid, s.fk_account, s.paye, s.fk_user, s.amount, s.salary, s.label, s.datesp, s.dateep, s.fk_typepayment, s.fk_bank,"; diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index f0602e88a5c..7af7fa4d986 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -218,7 +218,7 @@ if ($search_fk_bank) $sql .= " AND s.fk_bank=".((int) $search_fk_bank); if ($search_chq_number) $sql .= natural_search(array('s.num_payment'), $search_chq_number); if ($search_type_id > 0) { - $sql .= " AND s.fk_typepayment=".$search_type_id; + $sql .= " AND s.fk_typepayment=".((int) $search_type_id); } $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index f62fb894bd0..f8cd7f9d7ea 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -210,7 +210,7 @@ class Contacts extends DolibarrApi // Select contacts of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category); + $sql .= " AND c.fk_categorie = ".((int) $category); $sql .= " AND c.fk_socpeople = t.rowid "; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 253a35e710c..0257b692b62 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -178,11 +178,11 @@ class Thirdparties extends DolibarrApi // Select thirdparties of given category if ($category > 0) { if (!empty($mode) && $mode != 4) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category)." AND c.fk_soc = t.rowid"; + $sql .= " AND c.fk_categorie = ".((int) $category)." AND c.fk_soc = t.rowid"; } elseif (!empty($mode) && $mode == 4) { - $sql .= " AND cc.fk_categorie = ".$this->db->escape($category)." AND cc.fk_soc = t.rowid"; + $sql .= " AND cc.fk_categorie = ".((int) $category)." AND cc.fk_soc = t.rowid"; } else { - $sql .= " AND ((c.fk_categorie = ".$this->db->escape($category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".$this->db->escape($category)." AND cc.fk_soc = t.rowid))"; + $sql .= " AND ((c.fk_categorie = ".((int) $category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".((int) $category)." AND cc.fk_soc = t.rowid))"; } } diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 3e410019b22..6c52359979e 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -156,10 +156,10 @@ class CompanyBankAccount extends Account $sql .= ",cle_rib='".$this->db->escape($this->cle_rib)."'"; $sql .= ",bic='".$this->db->escape($this->bic)."'"; $sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'"; - $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; + $sql .= ",domiciliation = '".$this->db->escape($this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; - $sql .= ",default_rib = ".$this->default_rib; + $sql .= ",default_rib = ".((int) $this->default_rib); if ($conf->prelevement->enabled) { $sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'"; $sql .= ",rum = '".$this->db->escape($this->rum)."'"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 97723f83f37..149801a65e2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1386,7 +1386,7 @@ class Societe extends CommonObject $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null"); $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; - $sql .= ",status = ".$this->status; + $sql .= ",status = ".((int) $this->status); // Local taxes $sql .= ",localtax1_assuj = ".($this->localtax1_assuj != '' ? "'".$this->db->escape($this->localtax1_assuj)."'" : "null"); @@ -1449,7 +1449,7 @@ class Societe extends CommonObject $sql .= ",webservices_key = ".(!empty($this->webservices_key) ? "'".$this->db->escape($this->webservices_key)."'" : "null"); //Incoterms - $sql .= ", fk_incoterms = ".$this->fk_incoterms; + $sql .= ", fk_incoterms = ".((int) $this->fk_incoterms); $sql .= ", location_incoterms = ".(!empty($this->location_incoterms) ? "'".$this->db->escape($this->location_incoterms)."'" : "null"); if ($customer) { @@ -3941,8 +3941,8 @@ class Societe extends CommonObject } $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; - $sql .= " SET fk_soc=".$this->id; - $sql .= " WHERE rowid=".$member->id; + $sql .= " SET fk_soc = ".((int) $this->id); + $sql .= " WHERE rowid = ".((int) $member->id); $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bf39dbc608c..5935ac43b70 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -288,7 +288,7 @@ if ($action == "change") { // Change customer for TakePOS $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; $placeid = $invoice->create($user); - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid); $db->query($sql); } @@ -526,13 +526,13 @@ if (!$user->rights->fournisseur->lire) { if ($search_sale == -2) { $sql .= " AND sc.fk_user IS NULL"; } elseif ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$db->escape($search_sale); + $sql .= " AND sc.fk_user = ".((int) $search_sale); } if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); + $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); } if ($search_categ_sup > 0) { - $sql .= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); + $sql .= " AND cs.fk_categorie = ".((int) $search_categ_sup); } if ($search_categ_cus == -2) { $sql .= " AND cc.fk_categorie IS NULL"; @@ -667,7 +667,7 @@ $parameters = array('socid' => $socid); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook if (empty($reshook)) { if ($socid) { - $sql .= " AND s.rowid = ".$socid; + $sql .= " AND s.rowid = ".((int) $socid); } } $sql .= $hookmanager->resPrint; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 55ae070363a..7e4a1084ec1 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -34,8 +34,8 @@ $langs->loadLangs(array("companies", "mails", "admin", "other", "errors")); $socid = GETPOST("socid", 'int'); $action = GETPOST('action', 'aZ09'); -$contactid = GETPOST('contactid'); // May be an int or 'thirdparty' -$actionid = GETPOST('actionid'); +$contactid = GETPOST('contactid', 'alpha'); // May be an int or 'thirdparty' +$actionid = GETPOST('actionid', 'int'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Security check @@ -98,10 +98,10 @@ if (empty($reshook)) { $db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; - $sql .= " WHERE fk_soc=".$socid." AND fk_contact=".$contactid." AND fk_action=".$actionid; + $sql .= " WHERE fk_soc=".((int) $socid)." AND fk_contact=".((int) $contactid)." AND fk_action=".((int) $actionid); if ($db->query($sql)) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; - $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; + $sql .= " VALUES ('".$db->idate($now)."',".((int) $socid).",".((int) $contactid).",".((int) $actionid).")"; if (!$db->query($sql)) { $error++; @@ -230,7 +230,7 @@ if ($result > 0) { $sql .= " ".MAIN_DB_PREFIX."socpeople c"; $sql .= " WHERE a.rowid = n.fk_action"; $sql .= " AND c.rowid = n.fk_contact"; - $sql .= " AND c.fk_soc = ".$object->id; + $sql .= " AND c.fk_soc = ".((int) $object->id); $resql = $db->query($sql); if ($resql) { @@ -399,7 +399,7 @@ if ($result > 0) { $sql .= " ".MAIN_DB_PREFIX."notify as n "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as c ON n.fk_contact = c.rowid"; $sql .= " WHERE a.rowid = n.fk_action"; - $sql .= " AND n.fk_soc = ".$object->id; + $sql .= " AND n.fk_soc = ".((int) $object->id); $sql .= $db->order($sortfield, $sortorder); // Count total nb of records diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index ed392c0c0a1..2d2869fd1cc 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -977,8 +977,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX."societe_rib"; $sql .= " WHERE type in ('card')"; - $sql .= " AND fk_soc = ".$object->id; - $sql .= " AND status = ".$servicestatus; + $sql .= " AND fk_soc = ".((int) $object->id); + $sql .= " AND status = ".((int) $servicestatus); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 47793509bab..5906db24ee7 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -3211,7 +3211,7 @@ class SupplierProposalLine extends CommonObjectLine $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposaldet SET"; $sql .= " description='".$this->db->escape($this->desc)."'"; $sql .= " , label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null"); - $sql .= " , product_type=".$this->product_type; + $sql .= " , product_type=".((int) $this->product_type); $sql .= " , date_start=".($this->date_start ? "'".$this->db->idate($this->date_start)."'" : "null"); $sql .= " , date_end=".($this->date_end ? "'".$this->db->idate($this->date_end)."'" : "null"); $sql .= " , tva_tx='".price2num($this->tva_tx)."'"; @@ -3233,11 +3233,11 @@ class SupplierProposalLine extends CommonObjectLine $sql .= " , fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null"); $sql .= " , buy_price_ht=".price2num($this->pa_ht); if (strlen($this->special_code)) { - $sql .= " , special_code=".$this->special_code; + $sql .= " , special_code=".((int) $this->special_code); } $sql .= " , fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null"); if (!empty($this->rang)) { - $sql .= ", rang=".$this->rang; + $sql .= ", rang=".((int) $this->rang); } $sql .= " , ref_fourn=".(!empty($this->ref_fourn) ? "'".$this->db->escape($this->ref_fourn)."'" : "null"); $sql .= " , fk_unit=".($this->fk_unit ? $this->fk_unit : 'null'); diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 75eba410d0f..85f5f96c1af 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -173,7 +173,7 @@ if (!empty($conf->supplier_proposal->enabled)) { $sql .= " AND c.entity = ".$conf->entity; $sql .= " AND c.fk_statut = 0"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; @@ -231,7 +231,7 @@ $sql .= " WHERE c.fk_soc = s.rowid"; $sql .= " AND c.entity = ".$conf->entity; //$sql.= " AND c.fk_statut > 2"; if ($socid) { - $sql .= " AND c.fk_soc = ".$socid; + $sql .= " AND c.fk_soc = ".((int) $socid); } if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 3b9a7892310..5fcafb2fdc4 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -382,7 +382,7 @@ if ($search_sale > 0) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); } if ($search_user > 0) { - $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".$search_user; + $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='supplier_proposal' AND tc.source='internal' AND c.element_id = sp.rowid AND c.fk_socpeople = ".((int) $search_user); } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 92d7e8288e1..0aa45028ddd 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -70,7 +70,7 @@ if (empty($user->rights->takepos->run)) { */ if ($action == "getTables") { - $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables where floor = ".((int) $floor); $resql = $db->query($sql); $rows = array(); while ($row = $db->fetch_array($resql)) { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6582ec96172..60276c545ca 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -478,7 +478,7 @@ if (($action == "addline" || $action == "freezone") && $placeid == 0) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid); $db->query($sql); } } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 7f2d2cf1be0..e104d425bf4 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -262,7 +262,7 @@ class Tickets extends DolibarrApi $sql .= " AND t.fk_soc = sc.fk_soc"; } if ($socid > 0) { - $sql .= " AND t.fk_soc = ".$socid; + $sql .= " AND t.fk_soc = ".((int) $socid); } if ($search_sale > 0) { $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale @@ -270,7 +270,7 @@ class Tickets extends DolibarrApi // Insert sale filter if ($search_sale > 0) { - $sql .= " AND sc.fk_user = ".$search_sale; + $sql .= " AND sc.fk_user = ".((int) $search_sale); } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 61a6d15d9a1..f4e92ecab18 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1829,19 +1829,22 @@ class Ticket extends CommonObject public function searchSocidByEmail($email, $type = '0', $filters = array(), $clause = 'AND') { $thirdparties = array(); + $case = 0; + $exact = 0; // Generation requete recherche $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; $sql .= " WHERE entity IN (".getEntity('ticket', 1).")"; if (!empty($type)) { if ($type == 1 || $type == 2) { - $sql .= " AND client = ".$type; + $sql .= " AND client = ".((int) $type); } elseif ($type == 3) { $sql .= " AND fournisseur = 1"; } } if (!empty($email)) { if (!$exact) { + $regs = array(); if (preg_match('/^([\*])?[^*]+([\*])?$/', $email, $regs) && count($regs) > 1) { $email = str_replace('*', '%', $email); } else { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 9fa84042c3a..e0cbd849092 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -93,7 +93,7 @@ class Users extends DolibarrApi // Select products of given category if ($category > 0) { - $sql .= " AND c.fk_categorie = ".$this->db->escape($category); + $sql .= " AND c.fk_categorie = ".((int) $category); $sql .= " AND c.fk_user = t.rowid"; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 910edce8c17..ec09aafeef5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1418,10 +1418,10 @@ class User extends CommonObject $result = $this->create($user, 1); if ($result > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET fk_socpeople=".$contact->id; + $sql .= " SET fk_socpeople=".((int) $contact->id); $sql .= ", civility='".$this->db->escape($contact->civility_code)."'"; if ($contact->socid > 0) { - $sql .= ", fk_soc=".$contact->socid; + $sql .= ", fk_soc=".((int) $contact->socid); } $sql .= " WHERE rowid=".((int) $this->id); @@ -1517,7 +1517,7 @@ class User extends CommonObject if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET fk_soc=".$member->fk_soc; + $sql .= " SET fk_soc=".((int) $member->fk_soc); $sql .= " WHERE rowid=".((int) $this->id); dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index cacaeb54fc1..083b1bcc18c 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -194,7 +194,7 @@ class UserGroup extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g,"; $sql .= " ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE ug.fk_usergroup = g.rowid"; - $sql .= " AND ug.fk_user = ".$userid; + $sql .= " AND ug.fk_user = ".((int) $userid); if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && !$user->entity) { $sql .= " AND g.entity IS NOT NULL"; } else { @@ -359,7 +359,7 @@ class UserGroup extends CommonObject //print "$module-$perms-$subperms"; $sql = "SELECT id"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; - $sql .= " WHERE entity = ".$entity; + $sql .= " WHERE entity = ".((int) $entity); if (!empty($whereforadd) && $whereforadd != 'allmodules') { $sql .= " AND ".$whereforadd; } @@ -438,8 +438,8 @@ class UserGroup extends CommonObject // les caracteristiques module, perms et subperms de ce droit. $sql = "SELECT module, perms, subperms"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; - $sql .= " WHERE id = '".$this->db->escape($rid)."'"; - $sql .= " AND entity = ".$entity; + $sql .= " WHERE id = ".((int) $rid); + $sql .= " AND entity = ".((int) $entity); $result = $this->db->query($sql); if ($result) { @@ -454,8 +454,8 @@ class UserGroup extends CommonObject dol_print_error($this->db); } - // Where pour la liste des droits a supprimer - $wherefordel = "id=".$this->db->escape($rid); + // Where for the list of permissions to delete + $wherefordel = "id = ".((int) $rid); // Suppression des droits induits if ($subperms == 'lire' || $subperms == 'read') { $wherefordel .= " OR (module='".$this->db->escape($module)."' AND perms='".$this->db->escape($perms)."' AND subperms IS NOT NULL)"; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index bd82824cb05..62372df637a 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -423,7 +423,7 @@ if ($search_categ == -2) { $sql .= " AND cu.fk_categorie IS NULL"; } if ($search_warehouse > 0) { - $sql .= " AND u.fk_warehouse = ".$db->escape($search_warehouse); + $sql .= " AND u.fk_warehouse = ".((int) $search_warehouse); } if ($mode == 'employee' && empty($user->rights->salaries->readall)) { $sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")"; diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index d1382ac7c62..3fa61960b8c 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -425,7 +425,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; if ($idthirdparty != 'all') { - $sql .= " AND f.fk_soc = ".$db->escape($idthirdparty); + $sql .= " AND f.fk_soc = ".((int) $idthirdparty); } $resql = $db->query($sql); diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 8f3d5af17e6..73769d43cec 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -537,7 +537,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) $sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c'; $sql .= " WHERE c.entity = ".$conf->entity; if ($idthirdparty != 'all') { - $sql .= " AND c.fk_soc = ".$db->escape($idthirdparty); + $sql .= " AND c.fk_soc = ".((int) $idthirdparty); } diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 95b7246d021..35997d16d6e 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -916,13 +916,13 @@ function getListOfProductsOrServices($authentication, $filterproduct) $sql .= " WHERE entity=".$conf->entity; foreach ($filterproduct as $key => $val) { if ($key == 'type' && $val >= 0) { - $sql .= " AND fk_product_type = ".$db->escape($val); + $sql .= " AND fk_product_type = ".((int) $val); } if ($key == 'status_tosell') { - $sql .= " AND tosell = ".$db->escape($val); + $sql .= " AND tosell = ".((int) $val); } if ($key == 'status_tobuy') { - $sql .= " AND tobuy = ".$db->escape($val); + $sql .= " AND tobuy = ".((int) $val); } } $resql = $db->query($sql); diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 2a17ea15265..6803133d527 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -358,7 +358,7 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) //$sql.=" WHERE f.fk_soc = s.rowid AND nom = '".$db->escape($idthirdparty)."'"; $sql .= " WHERE f.entity = ".$conf->entity; if ($idthirdparty != 'all') { - $sql .= " AND f.fk_soc = ".$db->escape($idthirdparty); + $sql .= " AND f.fk_soc = ".((int) $idthirdparty); } $resql = $db->query($sql); diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index c256e975217..dbf2f3dd125 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -707,13 +707,13 @@ function getListOfThirdParties($authentication, $filterthirdparty) $sql .= " AND s.name LIKE '%".$db->escape($val)."%'"; } if ($key == 'client' && (int) $val > 0) { - $sql .= " AND s.client = ".$db->escape($val); + $sql .= " AND s.client = ".((int) $val); } if ($key == 'supplier' && (int) $val > 0) { - $sql .= " AND s.fournisseur = ".$db->escape($val); + $sql .= " AND s.fournisseur = ".((int) $val); } if ($key == 'category' && (int) $val > 0) { - $sql .= " AND s.rowid IN (SELECT fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") "; + $sql .= " AND s.rowid IN (SELECT fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie = ".((int) $val).") "; } } dol_syslog("Function: getListOfThirdParties", LOG_DEBUG); From 2681d581075c69544b67cb1bd491b848896f46ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 16:37:15 +0200 Subject: [PATCH 292/739] FIx CVE ID: CVE-2021-33816 --- htdocs/core/class/utils.class.php | 2 +- htdocs/website/index.php | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index a4f6bb11706..bdd6cc2b83a 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -594,7 +594,7 @@ class Utils * Execute a CLI command. * * @param string $command Command line to execute. - * @param string $outputfile Output file (used only when method is 2). For exemple $conf->admin->dir_temp.'/out.tmp'; + * @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp'; * @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method * @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK. */ diff --git a/htdocs/website/index.php b/htdocs/website/index.php index fe1bdce10d4..9361aae865f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1998,8 +1998,12 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' || // Security analysis $phpfullcodestring = dolKeepOnlyPhpCode($objectpage->content); - //print dol_escape_htmltag($phpfullcodestring);exit; - $forbiddenphpcommands = array("exec", "passthru", "system", "shell_exec", "proc_open", "eval", "dol_eval"); + + // First check forbidden commands + $forbiddenphpcommands = array(); + if (empty($conf->global->WEBSITE_PHP_ALLOW_EXEC)) { // If option is not on, we disallow functions to execute commands + $forbiddenphpcommands = array("exec", "passthru", "shell_exec", "system", "proc_open", "popen", "eval", "dol_eval", "executeCLI"); + } if (empty($conf->global->WEBSITE_PHP_ALLOW_WRITE)) { // If option is not on, we disallow functions to write files $forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "unlink", "mkdir", "rmdir", "symlink", "touch", "umask")); } @@ -2015,6 +2019,23 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' || } } } + // This char can be used to execute RCE for example using with echo `ls` + $forbiddenphpchars = array(); + if (empty($conf->global->WEBSITE_PHP_ALLOW_DANGEROUS_CHARS)) { // If option is not on, we disallow functions to execute commands + $forbiddenphpchars = array("`"); + } + foreach ($forbiddenphpchars as $forbiddenphpchar) { + if (preg_match('/'.$forbiddenphpchar.'/ms', $phpfullcodestring)) { + $error++; + setEventMessages($langs->trans("DynamicPHPCodeContainsAForbiddenInstruction", $forbiddenphpchar), null, 'errors'); + if ($action == 'updatesource') { + $action = 'editsource'; + } + if ($action == 'updatecontent') { + $action = 'editcontent'; + } + } + } if (empty($user->rights->website->writephp)) { if ($phpfullcodestringold != $phpfullcodestring) { From 0b7b12685fac454c450430dfdb100dc72f3778c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 16:41:43 +0200 Subject: [PATCH 293/739] Clean code --- htdocs/core/lib/functions2.lib.php | 51 ------------------------------ 1 file changed, 51 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e279ced2a3d..37f78563c02 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -2679,57 +2679,6 @@ if (!function_exists('dolEscapeXML')) { } -/** - * Return automatic or manual in current language - * - * @param string $automaticmanual Value to test (1, 'automatic', 'true' or 0, 'manual', 'false') - * @param integer $case 1=Yes/No, 0=yes/no, 2=Disabled checkbox, 3=Disabled checkbox + Automatic/Manual - * @param int $color 0=texte only, 1=Text is formated with a color font style ('ok' or 'error'), 2=Text is formated with 'ok' color. - * @return string HTML string - */ -function autoOrManual($automaticmanual, $case = 1, $color = 0) -{ - global $langs; - $result = 'unknown'; - $classname = ''; - if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') { // A mettre avant test sur no a cause du == 0 - $result = $langs->trans('automatic'); - if ($case == 1 || $case == 3) { - $result = $langs->trans("Automatic"); - } - if ($case == 2) { - $result = ''; - } - if ($case == 3) { - $result = ' '.$result; - } - - $classname = 'ok'; - } elseif ($automaticmanual == 0 || strtolower($automaticmanual) == 'manual' || strtolower($automaticmanual) == 'false') { - $result = $langs->trans("manual"); - if ($case == 1 || $case == 3) { - $result = $langs->trans("Manual"); - } - if ($case == 2) { - $result = ''; - } - if ($case == 3) { - $result = ' '.$result; - } - - if ($color == 2) { - $classname = 'ok'; - } else { - $classname = 'error'; - } - } - if ($color) { - return ''.$result.''; - } - return $result; -} - - /** * Convert links to local wrapper to medias files into a string into a public external URL readable on internet * From c37c3713928a6d2216ceaa2b04e21f436081a7c3 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 9 Jun 2021 17:18:01 +0200 Subject: [PATCH 294/739] FIX clone invoice with acount line --- .../triggers/interface_90_modSociete_ContactRoles.class.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index 0ee3cdb73ab..b15113c9c08 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -84,11 +84,7 @@ class InterfaceContactRoles extends DolibarrTriggers if (is_array($TContact) && ! empty($TContact)) { $TContactAlreadyLinked = array(); if ($object->id > 0) { - $cloneFrom = dol_clone($object, 1); - - if (! empty($cloneFrom->id)) { - $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(- 1, 'external'), $cloneFrom->liste_contact(- 1, 'internal')); - } + $TContactAlreadyLinked = array_merge($object->liste_contact(- 1, 'external'), $object->liste_contact(- 1, 'internal')); } foreach ($TContact as $i => $infos) { From f1c94ac659175c78fc5034dab2d0510eadf4a567 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 17:44:42 +0200 Subject: [PATCH 295/739] NEW Reduce scope of dol_eval function. --- htdocs/core/lib/functions.lib.php | 19 +++++++++++++ test/phpunit/SecurityTest.php | 44 +++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 165d9c503a4..61f268d7871 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7995,6 +7995,25 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1) global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object global $soc; // For backward compatibility + // Replace dangerous char (used for RCE), we allow only PHP variable testing. + if (strpos($s, '`') !== false) { + return 'Bad string syntax to evaluate: '.$s; + } + + // We block using of php exec or php file functions + $forbiddenphpcommands = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI("); + $forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen(", "file_put_contents(", "fputs(", "fputscsv(", "fwrite(", "fpassthru(", "unlink(", "mkdir(", "rmdir(", "symlink(", "touch(", "umask(")); + $forbiddenphpcommands = array_merge($forbiddenphpcommands, array('function(', '$$', 'call_user_func(', '_SESSION', '_COOKIE')); + do { + $oldstringtoclean = $s; + $s = str_ireplace($forbiddenphpcommands, '__forbiddenstring__', $s); + //$s = preg_replace('/\$[a-zA-Z0-9_\->\$]+\(/i', '', $s); // Remove $function( call and $mycall->mymethod( + } while ($oldstringtoclean != $s); + + if (strpos($s, '__forbiddenstring__') !== false) { + return 'Bad string syntax to evaluate: '.$s; + } + //print $s."
\n"; if ($returnvalue) { if ($hideerrors) { diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index f889a6c542b..b1a32249ffc 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -777,4 +777,48 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=dol_sanitizeFileName('bad file --evilparam'); $this->assertEquals('bad file _evilparam', $result); } + + /** + * testDolEval + * + * @return void + */ + public function testDolEval() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=dol_eval('1==1', 1, 0); + print "result = ".$result."\n"; + $this->assertTrue($result); + + $result=dol_eval('1==2', 1, 0); + print "result = ".$result."\n"; + $this->assertFalse($result); + + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; + $result=dol_eval('(($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref: "Parent project not found"', 1, 1); + print "result = ".$result."\n"; + $this->assertEquals('Parent project not found', $result); + + $result=dol_eval('$a=function() { }; $a;', 1, 1); + print "result = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + + $result=dol_eval('$a=exec("ls");', 1, 1); + print "result = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + + $result=dol_eval('$a="test"; $$a;', 1, 0); + print "result = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + + $result=dol_eval('`ls`', 1, 0); + print "result = ".$result."\n"; + $this->assertContains('Bad string syntax to evaluate', $result); + } } From f472ff4fd9aac82fc75b2c454d357bb90c1eec49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 17:47:27 +0200 Subject: [PATCH 296/739] Add phpunit for dol_eval --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 61f268d7871..1857be0146c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8003,7 +8003,8 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1) // We block using of php exec or php file functions $forbiddenphpcommands = array("exec(", "passthru(", "shell_exec(", "system(", "proc_open(", "popen(", "eval(", "dol_eval(", "executeCLI("); $forbiddenphpcommands = array_merge($forbiddenphpcommands, array("fopen(", "file_put_contents(", "fputs(", "fputscsv(", "fwrite(", "fpassthru(", "unlink(", "mkdir(", "rmdir(", "symlink(", "touch(", "umask(")); - $forbiddenphpcommands = array_merge($forbiddenphpcommands, array('function(', '$$', 'call_user_func(', '_SESSION', '_COOKIE')); + $forbiddenphpcommands = array_merge($forbiddenphpcommands, array('function(', '$$', 'call_user_func(')); + $forbiddenphpcommands = array_merge($forbiddenphpcommands, array('global', '_ENV', '_SESSION', '_COOKIE', '_GET', '_POST', '_REQUEST')); do { $oldstringtoclean = $s; $s = str_ireplace($forbiddenphpcommands, '__forbiddenstring__', $s); From 16f1210e8afddd451ead51fce9fadff0cf360c83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 17:50:21 +0200 Subject: [PATCH 297/739] Fix phpcs --- htdocs/compta/cashcontrol/report.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/product/card.php | 8 ++++---- htdocs/reception/card.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index fb6e75c68c4..de597a608dc 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -223,7 +223,7 @@ if ($resql) { if (empty($cacheinvoiceid[$objp->facid])) { $cacheinvoiceid[$objp->facid] = $objp->facid; // First time this invoice is found into list of invoice x payments - foreach($invoicetmp->lines as $line) { + foreach ($invoicetmp->lines as $line) { $totalqty += $line->qty; $totalvat += $line->total_tva; } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index d04d0c335eb..125dacb1e53 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -354,8 +354,8 @@ class Partnership extends CommonObject * * @param int $id Id of object to load * @param string $ref Ref of object - * @param int $fk_soc fk_soc * @param int $fk_member fk_member + * @param int $fk_soc fk_soc * @return int >0 if OK, <0 if KO, 0 if not found */ public function fetch($id, $ref = null, $fk_member = null, $fk_soc = null) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 1b732cd721e..5067b9ce838 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2050,10 +2050,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { - print '
'; - } + print ''; + } } } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 531fdf9c23a..c9a638e7cde 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1702,7 +1702,7 @@ if ($action == 'create') { $sql .= " AND obj.fk_commande = ".((int) $origin_id); $sql .= " AND obj.rowid = ed.fk_commandefourndet"; $sql .= " AND ed.fk_reception = e.rowid"; - $sql .= " AND ed.fk_reception !=".(int) $object->id); + $sql .= " AND ed.fk_reception !=".((int) $object->id); //if ($filter) $sql.= $filter; $sql .= " ORDER BY obj.fk_product"; From c00bef83a8d919aeb624c9cf23adf653d28aacf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 18:05:56 +0200 Subject: [PATCH 298/739] Fix php unit --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a48d00c820b..377f09028df 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3417,7 +3417,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", fk_product = ".((int) $fk_product); $sql .= ", product_type = ".((int) $this->product_type); $sql .= ", info_bits = ".((int) $this->info_bits); - $sql .= ", fk_unit = ".((int) $fk_unit); + $sql .= ", fk_unit = ".($fk_unit > 0 ? (int) $fk_unit : 'null'); // Multicurrency $sql .= " , multicurrency_subprice=".price2num($this->multicurrency_subprice).""; From e4d3fd4861d6f384dd575bb61efcc67814bc3f63 Mon Sep 17 00:00:00 2001 From: prolyfix Date: Wed, 9 Jun 2021 23:09:31 +0200 Subject: [PATCH 299/739] bug resolution: exception when a user test the send mail functionality, an exception is thrown: $object is null in the method_exists's function. and thus not allowed. Adding is_object resolve the problem --- htdocs/core/actions_sendmails.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index b4e583387c9..83a823edeb2 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -345,7 +345,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $subject = make_substitutions($subject, $substitutionarray); $message = make_substitutions($message, $substitutionarray); - if (method_exists($object, 'makeSubstitution')) { + if (is_object($object) && method_exists($object, 'makeSubstitution')) { $subject = $object->makeSubstitution($subject); $message = $object->makeSubstitution($message); } From f3d54aada5df4794466b5010c12486218bc4178d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 23:48:28 +0200 Subject: [PATCH 300/739] Clean code --- htdocs/adherents/class/adherent.class.php | 2 -- htdocs/societe/class/societe.class.php | 24 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 91f01d19f89..5a69c30abdb 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1510,7 +1510,6 @@ class Adherent extends CommonObject } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Function to get partnerships array * @@ -1519,7 +1518,6 @@ class Adherent extends CommonObject */ public function fetchPartnerships($mode) { - // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 149801a65e2..e20643fb589 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -740,6 +740,12 @@ class Societe extends CommonObject public $multicurrency_code; + // Fields loaded by fetchPartnerships() + + public $partnerships = array(); + + + /** * @var Account|string Default BAN account */ @@ -4806,4 +4812,22 @@ class Societe extends CommonObject return -1; } } + + /** + * Function to get partnerships array + * + * @param string $mode 'member' or 'thirdparty' + * @return int <0 if KO, >0 if OK + */ + public function fetchPartnerships($mode) + { + global $langs; + + require_once DOL_DOCUMENT_ROOT.'/parntership/class/partnership.class.php'; + + + $this->partnerships[] = array(); + + return 1; + } } From 9b7795dc44ebabda3eaf0944a531f445471f7d86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 23:55:56 +0200 Subject: [PATCH 301/739] Debug v14 --- htdocs/partnership/admin/setup.php | 2 +- .../class/partnershiputils.class.php | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 7fa0ef62b5e..97e21647b81 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -177,7 +177,7 @@ print ''; print '
'; -print_fiche_titre($langs->trans("ReferingWebsiteCheck"), '', ''); +print load_fiche_titre($langs->trans("ReferingWebsiteCheck"), '', ''); print ''.$langs->trans("ReferingWebsiteCheckDesc").'
'; print '
'; diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 04f5db251e5..7cf01c2957c 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -27,12 +27,11 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - -dol_include_once('partnership/lib/partnership.lib.php'); -dol_include_once('/partnership/class/partnership.class.php'); - -require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; +require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + /** * Class with cron tasks of Partnership module */ @@ -273,6 +272,7 @@ class PartnershipUtils $numofexpiredmembers = $this->db->num_rows($resql); $somethingdoneonpartnership = 0; $ifetchpartner = 0; + $websitenotfound = ''; while ($ifetchpartner < $numofexpiredmembers) { $ifetchpartner++; @@ -393,11 +393,10 @@ class PartnershipUtils /** * Action to check if Dolibarr backlink not found on partner website * - * CAN BE A CRON TASK - * @param $website Partner's website - * @return int 0 if KO, 1 if OK + * @param $website Website Partner's website + * @return int 0 if KO, 1 if OK */ - public function checkDolibarrBacklink($website = null) + private function checkDolibarrBacklink($website = null) { global $conf, $langs, $user; @@ -406,7 +405,7 @@ class PartnershipUtils $webcontent = ''; // $website = 'https://nextgestion.com/'; // For Test - $tmpgeturl = getURLContent($website); + $tmpgeturl = getURLContent($website, 'GET', '', 1, array(), array('http', 'https'), 0); if ($tmpgeturl['curl_error_no']) { $error++; dol_syslog('Error getting '.$website.': '.$tmpgeturl['curl_error_msg']); From 7b31ef0ff3ba416fd0c8c4c5c20a3000365adcd4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 00:00:49 +0200 Subject: [PATCH 302/739] Fix warnings --- htdocs/comm/action/list.php | 3 ++- htdocs/comm/action/rapport/index.php | 3 ++- htdocs/compta/prelevement/line.php | 3 ++- htdocs/modulebuilder/template/myobject_list.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 8c6fc94e31f..8bf35df622d 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -106,7 +106,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if ($page == -1 || $page == null) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index a90bc1cf5a3..9b6238ca0de 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -43,7 +43,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if ($page == -1 || $page == null) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index bc3a06c2e6d..5aa7344eea5 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -51,7 +51,8 @@ $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortorder = GETPOST('sortorder', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if ($page == -1 || $page == null) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; } $offset = $limit * $page; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 05cce2ba934..e2c817c12cc 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -105,8 +105,9 @@ $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 067f37e22e46864822507906a03449dd3373cf93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 00:09:38 +0200 Subject: [PATCH 303/739] Clean code --- .../contact/canvas/actions_contactcard_common.class.php | 6 +----- .../canvas/default/tpl/contactcard_create.tpl.php | 5 ----- htdocs/contact/card.php | 4 +--- htdocs/contact/class/contact.class.php | 9 ++++----- htdocs/contact/perso.php | 4 ++-- htdocs/core/class/commondocgenerator.class.php | 1 - htdocs/datapolicy/class/actions_datapolicy.class.php | 1 - htdocs/install/upgrade2.php | 2 +- htdocs/webservices/server_contact.php | 4 +--- 9 files changed, 10 insertions(+), 26 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 0e80df07676..f63f25b2a18 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -283,10 +283,7 @@ abstract class ActionsContactCardCommon // phpcs:enable global $langs, $mysoc; - $this->object->old_name = GETPOST("old_name"); - $this->object->old_firstname = GETPOST("old_firstname"); - - $this->object->socid = GETPOST("socid"); + $this->object->socid = GETPOST("socid", 'int'); $this->object->lastname = GETPOST("name"); $this->object->firstname = GETPOST("firstname"); $this->object->civility_id = GETPOST("civility_id"); @@ -301,7 +298,6 @@ abstract class ActionsContactCardCommon $this->object->phone_mobile = GETPOST("phone_mobile"); $this->object->fax = GETPOST("fax"); $this->object->email = GETPOST("email"); - $this->object->jabberid = GETPOST("jabberid"); $this->object->priv = GETPOST("priv"); $this->object->note = GETPOST("note", "restricthtml"); $this->object->canvas = GETPOST("canvas"); diff --git a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php index bd5cf24e195..a6c134d0a9a 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_create.tpl.php @@ -109,11 +109,6 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
- - - - - diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index b877909cc58..d185815b51a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -297,7 +297,7 @@ if (empty($reshook)) { $object->old_lastname = (string) GETPOST("old_lastname", 'alpha'); $object->old_firstname = (string) GETPOST("old_firstname", 'alpha'); - $result = $object->delete(); + $result = $object->delete(); // TODO Add $user as first param if ($result > 0) { if ($backtopage) { header("Location: ".$backtopage); @@ -443,8 +443,6 @@ if (empty($reshook)) { } } - $object->old_lastname = ''; - $object->old_firstname = ''; $action = 'view'; } else { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e1f987ac2f4..86d38c5b3e1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -545,8 +545,6 @@ class Contact extends CommonObject $this->phone_pro = trim($this->phone_pro); $this->phone_perso = trim($this->phone_perso); $this->phone_mobile = trim($this->phone_mobile); - $this->jabberid = trim($this->jabberid); - $this->skype = trim($this->skype); $this->photo = trim($this->photo); $this->fax = trim($this->fax); $this->zip = (empty($this->zip) ? '' : trim($this->zip)); @@ -1190,10 +1188,11 @@ class Contact extends CommonObject } /** - * Efface le contact de la base + * Delete a contact from database + * // TODO Add $user as first param * - * @param int $notrigger Disable all trigger - * @return int <0 if KO, >0 if OK + * @param int $notrigger Disable all trigger + * @return int <0 if KO, >0 if OK */ public function delete($notrigger = 0) { diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 628c73b0afc..261ffebf29c 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -60,8 +60,8 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->societe->contact $result = $object->update_perso($id, $user); if ($result > 0) { - $object->old_name = ''; - $object->old_firstname = ''; + $object->oldcopy = clone $object; + // Logo/Photo save $dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 30ea40fbbb2..6e91d9d175b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -321,7 +321,6 @@ abstract class CommonDocGenerator $array_key.'_statut' => $object->statut, $array_key.'_code' => $object->code, $array_key.'_email' => $object->email, - $array_key.'_jabberid' => $object->jabberid, // deprecated $array_key.'_phone_pro' => $object->phone_pro, $array_key.'_phone_perso' => $object->phone_perso, $array_key.'_phone_mobile' => $object->phone_mobile, diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 7a3ba77fb5a..e54086149fe 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -196,7 +196,6 @@ class ActionsDatapolicy echo $object->phone_pro.';'; echo $object->phone_perso.';'; echo $object->phone_mobile.';'; - echo $object->jabberid.';'; echo dol_print_date($object->birth).';'; exit; } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicy') { diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 23acc7d4a1b..e814e69574a 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4710,7 +4710,7 @@ function migrate_contacts_socialnetworks() $db->begin(); print '
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); + print '
'.$langs->trans("Nature").''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 5908785e1cb..0220df610e4 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -596,8 +596,18 @@ if ($id > 0 || $ref) { print ''; + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print ''; + } + if ($conf->productbatch->enabled) { - print ''; } diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index a7ad432b3ba..0d9de5d857f 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -356,15 +356,25 @@ if (!empty($id) || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = " fk_product_type = ".$object->type; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', ''); print '
'; print '
'; - print '
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); + print '
'.$langs->trans("ManageLotSerial").''; + print '
'.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0, 2); print '
'; + print '
'; + + // Type + if (!empty($conf->product->enabled) && !empty($conf->service->enabled)) { + $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); + print ''; + } // TVA - print '\n"; - - - print "
'; + print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print ''; + print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); + print '
'.$langs->trans("DefaultTaxRate").''; + print '
'.$langs->trans("DefaultTaxRate").''; $positiverates = ''; if (price2num($object->tva_tx)) { @@ -415,9 +425,6 @@ if (!empty($id) || !empty($ref)) { } print "
\n"; print ''; From 0ea0966b09c32b8605b3384b1daff44d9259f479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 12:01:05 +0200 Subject: [PATCH 261/739] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 8f5ac173d7f..54994eaf187 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3123,7 +3123,7 @@ if ($action == 'create') // Type de facture $facids = $facturestatic->list_replacable_invoices($soc->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit(); } $options = ""; From 4e530c2486c7c4255c9b20a6e1ddf7816afdfd66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 12:05:45 +0200 Subject: [PATCH 262/739] Update card.php --- htdocs/fourn/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 80491d5edfe..530a0d22766 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1867,7 +1867,7 @@ if ($action == 'create') // Type invoice $facids = $facturestatic->list_replacable_supplier_invoices($societe->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit(); } $options = ""; @@ -1933,7 +1933,7 @@ if ($action == 'create') $facids = $facturestatic->list_qualified_avoir_supplier_invoices($societe->id); if ($facids < 0) { - dol_print_error($db, $facturestatic); + dol_print_error($db, $facturestatic->error, $facturestatic->errors); exit; } $optionsav = ""; From 207dc1df5528cf74dea92f82930645bf1da30d6f Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 12:34:26 +0200 Subject: [PATCH 263/739] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 9825b2dac2c..a63871689b4 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -362,7 +362,7 @@ function show_stats_for_company($product, $socid) { global $conf, $langs, $user, $db; $form = new Form($db); - + $hookmanager->initHooks(array('productstats')); $nblines = 0; print '
'; - print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); + print img_picto('', 'category', 'class="paddingrightonly"'); + print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category")); print ' '; print $langs->trans("SubCats").'? '; print ''; - print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1); + print img_picto('', 'company', 'class="paddingrightonly"'); + print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty")); print ''; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index af3f2bc8a53..10f7956c6b7 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -405,7 +405,8 @@ print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; $first = "no"; }*/ @@ -232,8 +246,8 @@ if ($resql) { // Bank account print '
'; -print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', true); +print img_picto('', 'category', 'class="paddingrightonly"'); +print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', 0, $langs->trans("Category")); print ' '; print $langs->trans("SubCats").'? '; print ''; print '
'; -print ''; +print ''; print ''; -print ''; +print ''; print ''; -print ''; +print ''; print ''; print $form->select_country($search_country, 'search_country'); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index b93d3c507b3..05bbbab99d3 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -149,9 +149,11 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("Turnover"); $calcmode = $langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; - $calcmode = str_replace('{link1}', '', $calcmode); - $calcmode = str_replace('{link2}', '', $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; + $calcmode = str_replace('{link1}', '', $calcmode); + $calcmode = str_replace('{link2}', '', $calcmode); + } $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -164,8 +166,10 @@ if ($modecompta == "CREANCES-DETTES") { } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); - //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //if (!empty($conf->accounting->enabled)) { //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; + //} $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesCAIn"); $description .= $langs->trans("DepositsAreIncluded"); diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index bb341c6a3a5..0afcb72da2d 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -128,23 +128,31 @@ llxHeader(); $form = new Form($db); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta == "BOOKKEEPING") { + $modecompta = "CREANCES-DETTES"; +} +if ($modecompta == "BOOKKEEPINGCOLLECTED") { + $modecompta = "RECETTES-DEPENSES"; +} + // Affiche en-tete du rapport if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeDebt"); - $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; - $calcmode = str_replace('{link1}', '', $calcmode); - $calcmode = str_replace('{link2}', '', $calcmode); + if (!empty($conf->accounting->enabled)) { + $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; + $calcmode = str_replace('{link1}', '', $calcmode); + $calcmode = str_replace('{link2}', '', $calcmode); + } $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverDue"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverIn"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("PurchaseTurnover"); @@ -154,9 +162,19 @@ if ($modecompta == "CREANCES-DETTES") { $calcmode = str_replace('{link2}', '', $calcmode); $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesPurchaseTurnoverOfExpenseAccounts"); - $builddate = dol_now(); + //$exportlink=$langs->trans("NotYetAvailable"); +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { + $name = $langs->trans("PurchaseTurnoverCollected"); + $calcmode = $langs->trans("CalcModeBookkeeping"); + $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')'; + $calcmode = str_replace('{link1}', '', $calcmode); + $calcmode = str_replace('{link2}', '', $calcmode); + $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); + $description = $langs->trans("RulesPurchaseTurnoverCollectedOfExpenseAccounts"); //$exportlink=$langs->trans("NotYetAvailable"); } + +$builddate = dol_now(); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period .= ' - '; $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 1af51249433..4e92325a323 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -345,7 +345,8 @@ if ($modecompta == 'CREANCES-DETTES') { // Category filter print '
'; - print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); + print img_picto('', 'category', 'class="paddingrightonly"'); + print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category")); print ' '; print $langs->trans("SubCats").'? '; print ''; - print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1); + print img_picto('', 'company', 'class="paddingrightonly"'); + print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty")); print ''; diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index b1b1f219f53..a97e15d1499 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -200,18 +200,19 @@ if ($modecompta == "CREANCES-DETTES") { $calcmode = $langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description = $langs->trans("RulesPurchaseTurnoverDue"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeEngagement"); //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description = $langs->trans("RulesPurchaseTurnoverIn"); - $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "BOOKKEEPING") { + // TODO } elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { + // TODO } +$builddate = dol_now(); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); $period .= ' - '; $period .= $form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver'); @@ -344,7 +345,8 @@ print ''; print ''; print ''; print ''; print ''; print ''."\n"; From fa4786a3f64083895c257863c8d2b5ed463c0776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jun 2021 16:19:21 +0200 Subject: [PATCH 269/739] Fix permission --- htdocs/adherents/document.php | 2 +- htdocs/asset/document.php | 2 +- htdocs/bom/bom_document.php | 2 +- htdocs/comm/action/document.php | 2 +- htdocs/comm/propal/document.php | 2 +- htdocs/commande/document.php | 2 +- htdocs/compta/bank/account_statement_document.php | 2 +- htdocs/compta/bank/document.php | 2 +- htdocs/compta/bank/various_payment/document.php | 2 +- htdocs/compta/deplacement/document.php | 2 +- htdocs/compta/facture/document.php | 2 +- htdocs/compta/sociales/document.php | 2 +- htdocs/compta/tva/document.php | 2 +- htdocs/contact/document.php | 2 +- htdocs/contrat/document.php | 2 +- htdocs/don/document.php | 2 +- htdocs/expedition/document.php | 2 +- htdocs/expensereport/document.php | 2 +- htdocs/fichinter/document.php | 2 +- htdocs/fourn/commande/document.php | 2 +- htdocs/holiday/document.php | 2 +- htdocs/loan/document.php | 2 +- htdocs/modulebuilder/template/myobject_document.php | 4 ++-- htdocs/mrp/mo_document.php | 2 +- htdocs/product/stock/productlot_document.php | 1 - htdocs/projet/document.php | 2 +- htdocs/projet/tasks/document.php | 2 +- htdocs/recruitment/recruitmentcandidature_document.php | 2 +- htdocs/recruitment/recruitmentjobposition_document.php | 2 +- htdocs/resource/document.php | 2 +- htdocs/salaries/document.php | 2 +- htdocs/societe/document.php | 2 +- htdocs/supplier_proposal/document.php | 2 +- htdocs/ticket/document.php | 2 +- htdocs/user/document.php | 2 +- 35 files changed, 35 insertions(+), 36 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index f2a7c6f3f55..98c0e026139 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -182,7 +182,7 @@ if ($id > 0) { print dol_get_fiche_end(); $modulepart = 'member'; - $permission = $user->rights->adherent->creer; + $permissiontoadd = $user->rights->adherent->creer; $permtoedit = $user->rights->adherent->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 91e46269994..b4ee3a0a175 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -128,7 +128,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'asset'; - $permission = $user->rights->asset->write; + $permissiontoadd = $user->rights->asset->write; $permtoedit = $user->rights->asset->write; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index e59b22c45b2..9952423da99 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -147,7 +147,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'bom'; - $permission = $user->rights->bom->write; + $permissiontoadd = $user->rights->bom->write; $permtoedit = $user->rights->bom->write; $param = '&id='.$object->id; diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 7465e613611..eb1ac59cfe0 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -287,7 +287,7 @@ if ($object->id > 0) { $modulepart = 'actions'; - $permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create; + $permissiontoadd = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 2b21c545c63..a60f892274c 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -189,7 +189,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'propal'; - $permission = $user->rights->propal->creer; + $permissiontoadd = $user->rights->propal->creer; $permtoedit = $user->rights->propal->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index c289112ee9f..f8cc503e0ec 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -184,7 +184,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'commande'; - $permission = $user->rights->commande->creer; + $permissiontoadd = $user->rights->commande->creer; $permtoedit = $user->rights->commande->creer; $param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity); include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 4f317c1a9ed..03209ad7673 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) { $modulepart = 'bank'; - $permission = $user->rights->banque->modifier; + $permissiontoadd = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id.'&num='.urlencode($numref); $moreparam = '&num='.urlencode($numref); diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index f97dbca114b..ec46002b031 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) { $modulepart = 'bank'; - $permission = $user->rights->banque->modifier; + $permissiontoadd = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index ce793f7e6ee..1b5fd5fd383 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -150,7 +150,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'banque'; - $permission = $user->rights->banque->modifier; + $permissiontoadd = $user->rights->banque->modifier; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index bd4437715d8..cdb4b5f0f0f 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -126,7 +126,7 @@ if ($object->id) { print ''; $modulepart = 'deplacement'; - $permission = $user->rights->deplacement->creer; + $permissiontoadd = $user->rights->deplacement->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 16cdee4ac53..5196216c57c 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -181,7 +181,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'facture'; - $permission = $user->rights->facture->creer; + $permissiontoadd = $user->rights->facture->creer; $permtoedit = $user->rights->facture->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 3335174d86f..1fbfdfa296a 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -164,7 +164,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'tax'; - $permission = $user->rights->tax->charges->creer; + $permissiontoadd = $user->rights->tax->charges->creer; $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index eee1abcd2f5..e2f0dcec96d 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -150,7 +150,7 @@ if ($object->id) { print dol_get_fiche_end(); - $permission = $user->rights->tax->charges->creer; + $permissiontoadd = $user->rights->tax->charges->creer; $permtoedit = $user->rights->tax->charges->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index e980b0ee94c..3005c6b7827 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -182,7 +182,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'contact'; - $permission = $user->rights->societe->contact->creer; + $permissiontoadd = $user->rights->societe->contact->creer; $permtoedit = $user->rights->societe->contact->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 1dd87fd75e3..0d66204f81d 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -192,7 +192,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'contract'; - $permission = $user->rights->contrat->creer; + $permissiontoadd = $user->rights->contrat->creer; $permtoedit = $user->rights->contrat->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 0bd4edbc77b..374306bc7b0 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -188,7 +188,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'don'; - $permission = $user->rights->don->creer; + $permissiontoadd = $user->rights->don->creer; $permtoedit = $user->rights->don->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index c392187d607..200a4b67aac 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -177,7 +177,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_end(); $modulepart = 'expedition'; - $permission = $user->rights->expedition->creer; + $permissiontoadd = $user->rights->expedition->creer; $permtoedit = $user->rights->expedition->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 147f0842e4c..d7ecea8fcc9 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -154,7 +154,7 @@ if ($object->id) { $modulepart = 'expensereport'; - $permission = $user->rights->expensereport->creer; + $permissiontoadd = $user->rights->expensereport->creer; $permtoedit = $user->rights->expensereport->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index 576e6be0e5e..71f52212978 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -170,7 +170,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'ficheinter'; - $permission = $user->rights->ficheinter->creer; + $permissiontoadd = $user->rights->ficheinter->creer; $permtoedit = $user->rights->ficheinter->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 5bb8baf4879..c38751fc138 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -178,7 +178,7 @@ if ($object->id > 0) { $modulepart = 'commande_fournisseur'; - $permission = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); + $permissiontoadd = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permtoedit = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index d1be99b0446..063a3330ffd 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -349,7 +349,7 @@ if ($object->id) { $modulepart = 'holiday'; - $permission = $user->rights->holiday->write; + $permissiontoadd = $user->rights->holiday->write; $permtoedit = $user->rights->holiday->write; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 85c958dd545..97c0ea56b15 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -160,7 +160,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'loan'; - $permission = $user->rights->loan->write; + $permissiontoadd = $user->rights->loan->write; $permtoedit = $user->rights->loan->write; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index e3fa6390e93..2db325b8b41 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -233,8 +233,8 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'mymodule'; - //$permission = $user->rights->mymodule->myobject->write; - $permission = 1; + //$permissiontoadd = $user->rights->mymodule->myobject->write; + $permissiontoadd = 1; //$permtoedit = $user->rights->mymodule->myobject->write; $permtoedit = 1; $param = '&id='.$object->id; diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 96041171da6..101d26223f5 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -179,7 +179,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'mrp'; - $permission = $user->rights->mrp->write; + $permissiontoadd = $user->rights->mrp->write; $permtoedit = $user->rights->mrp->write; $param = '&id='.$object->id; diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 820ad4d38bb..08b565c90a0 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -193,7 +193,6 @@ if ($object->id) { print dol_get_fiche_end(); - $permission = ($user->rights->produit->creer); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 6bb905d6696..b088dcf7141 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -165,7 +165,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'project'; - $permission = ($userWrite > 0); + $permissiontoadd = ($userWrite > 0); $permtoedit = ($userWrite > 0); include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 575f949bb75..d9c49001dfc 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -324,7 +324,7 @@ if ($object->id > 0) { $param .= '&withproject=1'; } $modulepart = 'project_task'; - $permission = $user->rights->projet->creer; + $permissiontoadd = $user->rights->projet->creer; $permtoedit = $user->rights->projet->creer; $relativepathwithnofile = dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index 24b9f6d4e67..2e8c29cf2fe 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -212,7 +212,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'recruitment'; - $permission = $user->rights->recruitment->recruitmentjobposition->write; + $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; $permtoedit = $user->rights->recruitment->recruitmentjobposition->write; $param = '&id='.$object->id; diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index e8ede6f0bdd..43d80901f3d 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -211,7 +211,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'recruitment'; - $permission = $user->rights->recruitment->recruitmentjobposition->write; + $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; $permtoedit = $user->rights->recruitment->recruitmentjobposition->write; $param = '&id='.$object->id; diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 6f4c714fac4..fec869d5620 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -139,7 +139,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'dolresource'; - $permission = $user->rights->resource->write; + $permissiontoadd = $user->rights->resource->write; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 5950fc88798..ea21b49159c 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -149,7 +149,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'salaries'; - $permission = $user->rights->salaries->write; + $permissiontoadd = $user->rights->salaries->write; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 653069882e0..0b8376e4f88 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -176,7 +176,7 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'societe'; - $permission = $user->rights->societe->creer; + $permissiontoadd = $user->rights->societe->creer; $permtoedit = $user->rights->societe->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index eaf02981966..580c0f0974e 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -163,7 +163,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); $modulepart = 'supplier_proposal'; - $permission = $user->rights->supplier_proposal->creer; + $permissiontoadd = $user->rights->supplier_proposal->creer; $permtoedit = $user->rights->supplier_proposal->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 8edd2787c44..d534e8a1123 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -203,7 +203,7 @@ if ($object->id) { //$object->ref = $object->track_id; // For compatibility we use track ID for directory $modulepart = 'ticket'; - $permission = $user->rights->ticket->write; + $permissiontoadd = $user->rights->ticket->write; $permtoedit = $user->rights->ticket->write; $param = '&id='.$object->id; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 297243f36ef..8cf6c2b2a81 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -176,7 +176,7 @@ if ($object->id) { $modulepart = 'user'; - $permission = $user->rights->user->user->creer; + $permissiontoadd = $user->rights->user->user->creer; $permtoedit = $user->rights->user->user->creer; $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; From af6bbe23cad2c28c33fb65adc6d58eadbc083a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 8 Jun 2021 17:39:13 +0200 Subject: [PATCH 270/739] add warning if outstanding limit is exceeded --- htdocs/comm/propal/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b5bd94f0c2e..8b5f757ad0e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2294,6 +2294,7 @@ if ($action == 'create') { print $langs->trans('OutstandingBill'); print ''; From 4b8dfc1abe8744df3f8a42c107894f58da948266 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 18:11:59 +0200 Subject: [PATCH 271/739] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index b22207c5dda..e87e63666ef 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -558,9 +558,10 @@ function show_stats_for_company($product, $socid) print ''; print ''; } - $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product); // Note that $action and $object may have been modified by some hooks + $parameters = array('socid'=>$socid); + $reshook = $hookmanager->executeHooks('addmoreproductstat', $parameters, $product,$nblines); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - + print $hookmanager->resPrint; return $nblines++; From 6733d278d8775cab97e49afb47348c595e00510b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:13:18 +0200 Subject: [PATCH 272/739] NEW: project time spent: conf to prevent recording time after X months --- htdocs/core/lib/project.lib.php | 50 ++++++++++++++++++++++++++---- htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/en_US/projects.lang | 1 + htdocs/projet/admin/project.php | 15 +++++++++ htdocs/projet/class/task.class.php | 12 +++++++ 5 files changed, 73 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index aaa1e144202..d48d37a9539 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1076,6 +1076,13 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 to start break , -1 no break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + //dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0)); for ($i = 0; $i < $numlines; $i++) { @@ -1307,6 +1314,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr $disabledtask = 1; } + if ($restrictBefore && $preselectedday < $restrictBefore) { + $disabledtask = 1; + } + // Form to add new time print ''; +print ''; + +print ''; +print ''; + +print ''; +print ''; print '
'; -print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_SUPPLIER, $selected_cat, 'search_categ', true); +print img_picto('', 'category', 'class="paddingrightonly"'); +print $formother->select_categories(Categorie::TYPE_SUPPLIER, $selected_cat, 'search_categ', 0, $langs->trans("Category")); print ' '; print $langs->trans("SubCats").'? '; print ''; print '
'; -print ''; +print ''; print ''; -print ''; +print ''; print ''; -print ''; +print ''; print ''; print $form->select_country($search_country, 'search_country'); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7f6121fb07d..80ea1d5ea7b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1373,7 +1373,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $modecompta = 'CREANCES-DETTES'; if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + $modecompta = 'BOOKKEEPING'; // Not yet implemented. } if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { @@ -1384,7 +1384,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } $modecompta = 'RECETTES-DEPENSES'; - //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if (!empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. + } if ($modecompta && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled))) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); @@ -1410,7 +1412,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); */ - $newmenu->add("/compta/stats/index.php?leftmenu=report", $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); /* $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); @@ -1419,14 +1420,32 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); } */ - $newmenu->add("/compta/stats/casoc.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report", $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report", $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); + + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); + + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + //Achats - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report", $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + $modecompta = 'CREANCES-DETTES'; + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + + /* + $modecompta = 'RECETTES-DEPENSES'; + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + */ + // Journals $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); From 2e6650924560ee5eca40da063cf0b0b4aebdff01 Mon Sep 17 00:00:00 2001 From: MOREAU FRANCK Date: Tue, 8 Jun 2021 15:47:20 +0200 Subject: [PATCH 266/739] Adding hooks on product stat in order to allow to expand stat on other modules --- htdocs/core/lib/product.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index a63871689b4..b22207c5dda 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -360,7 +360,7 @@ function product_lot_admin_prepare_head() */ function show_stats_for_company($product, $socid) { - global $conf, $langs, $user, $db; + global $conf, $langs, $user, $db, $hookmanager; $form = new Form($db); $hookmanager->initHooks(array('productstats')); $nblines = 0; From 6eab0f56619eb204b594857ce783cd25f2def604 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jun 2021 15:49:26 +0200 Subject: [PATCH 267/739] Fix css --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 48ad9783367..ceb945d1e72 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1419,7 +1419,7 @@ if ($resql) { if (!empty($arrayfields['pr.ref']['checked'])) { // Project ref - print ''; + print ''; if ($obj->project_id > 0) { print $projectstatic->getNomUrl(1); } From facf594b2da40a8462b7b744c4a8040896daed9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jun 2021 16:01:26 +0200 Subject: [PATCH 268/739] FIX Date of invoice generated from membership must be current date --- htdocs/adherents/class/adherent.class.php | 3 ++- htdocs/public/payment/newpayment.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b7852280ddf..4c0c602cbc1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1740,7 +1740,8 @@ class Adherent extends CommonObject } } $invoice->socid = $this->fk_soc; - $invoice->date = $datesubscription; + //$invoice->date = $datesubscription; + $invoice->date = dol_now(); // Possibility to add external linked objects with hooks $invoice->linked_objects['subscription'] = $subscriptionid; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 3a7f9a4ed9f..fb95432256d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1419,6 +1419,8 @@ if ($source == 'contractline') { // Payment on member subscription if ($source == 'member' || $source == 'membersubscription') { + $newsource = 'member'; + $found = true; $langs->load("members"); @@ -1478,7 +1480,7 @@ if ($source == 'member' || $source == 'membersubscription') { } print '
'.$langs->trans("Designation"); print ''.$text; - print ''; + print ''; print ''; print '
'; $arrayoutstandingbills = $soc->getOutstandingBills(); + print ($arrayoutstandingbills['opened'] > $soc->outstanding_limit ? img_warning() : ''); print price($arrayoutstandingbills['opened']).' / '; print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); print '
'; $tableCell = $form->selectDate($preselectedday, $lines[$i]->id, 1, 1, 2, "addtime", 0, 0, $disabledtask); @@ -1451,6 +1462,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; @@ -1708,6 +1726,12 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $cssweekend = 'weekend'; } + $disabledtaskday = $disabledtask; + + if (! $disabledtask && $restrictBefore && $tmpday < $restrictBefore) { + $disabledtaskday = 1; + } + $tableCell = ''; //$tableCell .= 'idw='.$idw.' '.$conf->global->MAIN_START_WEEK.' '.$numstartworkingday.'-'.$numendworkingday; $placeholder = ''; @@ -1717,7 +1741,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ //$placeholder=' placeholder="00:00"'; //$tableCell.='+'; } - $tableCell .= ''; @@ -1812,6 +1836,13 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } + $restrictBefore = null; + + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + } + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; @@ -1954,10 +1985,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $tableCell = ''; $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; - foreach ($TFirstDay as &$fday) { - $fday--; - } - foreach ($TWeek as $weekNb) + + $firstdaytoshowarray = dol_getdate($firstdaytoshow); + $year = $firstdaytoshowarray['year']; + $month = $firstdaytoshowarray['mon']; + foreach ($TWeek as $weekIndex => $weekNb) { $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]; $totalforeachweek[$weekNb] += $weekWorkLoad; @@ -1966,6 +1998,12 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin'); $alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb); + $disabledtaskweek = $disabledtask; + $firstdayofweek = dol_mktime(0, 0, 0, $month, $TFirstDay[$weekIndex], $year); + + if (! $disabledtask && $restrictBefore && $firstdayofweek < $restrictBefore) { + $disabledtaskweek = 1; + } $tableCell = ''; $placeholder = ''; @@ -1976,7 +2014,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //$tableCell.='+'; } - $tableCell .= ''; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f5770bad737..446f01a5446 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -81,6 +81,7 @@ NumberOfBytes=Number of Bytes SearchString=Search string NotAvailableWhenAjaxDisabled=Not available when Ajax disabled AllowToSelectProjectFromOtherCompany=On document of a third party, can choose a project linked to another third party +TimesheetPreventAfterFollowingMonths=Prevent recording time spent after the following number of months JavascriptDisabled=JavaScript disabled UsePreviewTabs=Use preview tabs ShowPreview=Show preview diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 2aedbd53377..9fea85e7d1e 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -139,6 +139,7 @@ NoTasks=No tasks for this project LinkedToAnotherCompany=Linked to other third party TaskIsNotAssignedToUser=Task not assigned to user. Use button '%s' to assign task now. ErrorTimeSpentIsEmpty=Time spent is empty +TimeRecordingRestrictedToNMonthsBack=Time recording is restricted to %s months back ThisWillAlsoRemoveTasks=This action will also delete all tasks of project (%s tasks at the moment) and all inputs of time spent. IfNeedToUseOtherObjectKeepEmpty=If some objects (invoice, order, ...), belonging to another third party, must be linked to the project to create, keep this empty to have the project being multi third parties. CloneTasks=Clone tasks diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index f36aae34c4f..143f75b72ab 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -242,6 +242,11 @@ elseif ($action == 'setdoc') $projectToSelect = GETPOST('projectToSelect', 'alpha'); dolibarr_set_const($db, 'PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY', $projectToSelect, 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value } + if (GETPOST('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) + { + $timesheetFreezeDuration = GETPOST('timesheetFreezeDuration', 'alpha'); + dolibarr_set_const($db, 'PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS', intval($timesheetFreezeDuration), 'chaine', 0, '', $conf->entity); //Allow to disable this configuration if empty value + } } @@ -839,6 +844,16 @@ print ''; print '
'.$langs->trans("TimesheetPreventAfterFollowingMonths").''; +print ' '; +print ''; +print '
'; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index b4733de05ae..1b64f0d9a66 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1095,6 +1095,18 @@ class Task extends CommonObject if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note); if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date; + if (! empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); + + if ($this->timespent_date < $restrictBefore) { + $this->error = $langs->trans('TimeRecordingRestrictedToNMonthsBack', $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS); + $this->errors[] = $this->error; + return -1; + } + } + + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; From 71dbb8733d5516b02b0d8c1e418f69059fbc6ebf Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 8 Jun 2021 20:18:31 +0200 Subject: [PATCH 273/739] fix: #17827 --- htdocs/projet/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index b088dcf7141..df31724d07c 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -164,7 +164,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - $modulepart = 'project'; + $modulepart = 'projet'; $permissiontoadd = ($userWrite > 0); $permtoedit = ($userWrite > 0); include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; From 27f803cab0e73b2fb2bf69a7fe67be604b8acc54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 03:35:22 +0200 Subject: [PATCH 274/739] Fix receipt of cash fence must contains more legal information --- .../cashcontrol/class/cashcontrol.class.php | 19 +-- htdocs/compta/cashcontrol/report.php | 108 ++++++++++-------- 2 files changed, 71 insertions(+), 56 deletions(-) diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index a59816eebd7..59580cb7c46 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -93,10 +93,12 @@ class CashControl extends CommonObject 'year_close' =>array('type'=>'integer', 'label'=>'Year close', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'css'=>'center'), 'month_close' =>array('type'=>'integer', 'label'=>'Month close', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'css'=>'center'), 'day_close' =>array('type'=>'integer', 'label'=>'Day close', 'enabled'=>1, 'visible'=>1, 'position'=>60, 'css'=>'center'), - 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>490), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>502), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>505), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>510), + 'fk_user_creat' =>array('type'=>'integer:User', 'label'=>'userCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>600), + 'fk_user_valid' =>array('type'=>'integer:User', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>602), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>0, 'position'=>700), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated')), ); @@ -115,21 +117,24 @@ class CashControl extends CommonObject public $cheque; public $card; - /** - * @var integer|string $date_valid - */ - public $date_valid; - /** * @var integer|string date_creation */ public $date_creation; + public $fk_user_creat; /** * @var integer|string $date_modification */ public $date_modification; + /** + * @var integer|string $date_valid + */ + public $date_valid; + public $fk_user_valid; + + const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_CLOSED = 1; // For the moment CLOSED = VALIDATED diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 653161ca3bc..12dff9d460a 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -26,7 +26,7 @@ /** * \file htdocs/compta/cashcontrol/report.php * \ingroup cashdesk|takepos - * \brief List of bank transactions + * \brief List of sales from POS */ if (!defined('NOREQUIREMENU')) { @@ -36,6 +36,8 @@ if (!defined('NOBROWSERNOTIF')) { define('NOBROWSERNOTIF', '1'); // Disable browser notification } +$_GET['optioncss'] = "print"; + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; @@ -48,10 +50,8 @@ $langs->loadLangs(array("bills", "banks")); $id = GETPOST('id', 'int'); -$_GET['optioncss'] = "print"; - -$cashcontrol = new CashControl($db); -$cashcontrol->fetch($id); +$object = new CashControl($db); +$object->fetch($id); //$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit; $sortorder = 'ASC'; @@ -67,19 +67,19 @@ $arrayfields = array( 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), ); -$syear = $cashcontrol->year_close; -$smonth = $cashcontrol->month_close; -$sday = $cashcontrol->day_close; +$syear = $object->year_close; +$smonth = $object->month_close; +$sday = $object->day_close; -$posmodule = $cashcontrol->posmodule; -$terminalid = $cashcontrol->posnumber; +$posmodule = $object->posmodule; +$terminalid = $object->posnumber; // Security check if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); } -if (!$user->rights->cashdesk->run && !$user->rights->takepos->run) { +if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) { accessforbidden(); } @@ -106,8 +106,8 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON bu.url_id = f.rowid"; $sql.= " WHERE b.fk_account = ba.rowid"; // Define filter on invoice -$sql.= " AND f.module_source = '".$db->escape($cashcontrol->posmodule)."'"; -$sql.= " AND f.pos_source = '".$db->escape($cashcontrol->posnumber)."'"; +$sql.= " AND f.module_source = '".$db->escape($object->posmodule)."'"; +$sql.= " AND f.pos_source = '".$db->escape($object->posnumber)."'"; $sql.= " AND f.entity IN (".getEntity('facture').")"; // Define filter on data if ($syear && ! $smonth) $sql.= " AND dateo BETWEEN '".$db->idate(dol_get_first_day($syear, 1))."' AND '".$db->idate(dol_get_last_day($syear, 12))."'"; @@ -151,19 +151,33 @@ if ($resql) { $i = 0; print "\n"; - print "

"; - if ($cashcontrol->status != $cashcontrol::STATUS_DRAFT) { - print $langs->trans("CashControl")." ".$cashcontrol->id; + print '
'; + print '

'; + if ($object->status != $object::STATUS_DRAFT) { + print $langs->trans("CashControl")." ".$object->id; } else { print $langs->trans("CashControl")." - ".$langs->trans("Draft"); } - print "
".$langs->trans("DateCreationShort").": ".dol_print_date($cashcontrol->date_creation, 'dayhour'); - print "

"; + print "

"; + print $langs->trans("DateCreationShort").": ".dol_print_date($object->date_creation, 'dayhour'); + print '
'.$mysoc->name; + $userauthor = $object->fk_user_valid; + if (empty($userauthor)) { + $userauthor = $object->fk_user_creat; + } + + $uservalid = new User($db); + if ($userauthor > 0) { + $uservalid->fetch($userauthor); + print '
'.$langs->trans("Author").': '.$uservalid->getFullName($langs); + } + print '
'.$langs->trans("Period").': '.$object->year_close.($object->month_close ? '-'.$object->month_close : '').($object->day_close ? '-'.$object->day_close : ''); + print '
'; $invoicetmp = new Facture($db); print "

"; - print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash")." : ".price($cashcontrol->opening); + print $langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").' : '.price($object->opening).''; print "

"; print '
'; @@ -206,7 +220,7 @@ if ($resql) { { print '
'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").''.price($cashcontrol->opening).''.price($object->opening).'
'; print $bankaccount->getNomUrl(1); - if ($cashcontrol->posmodule == "takepos") { - $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber; + if ($object->posmodule == "takepos") { + $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$object->posnumber; } else { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'; } @@ -305,48 +319,44 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; print "
"; + print ""; - //$cash = $amountpertype['LIQ'] + $cashcontrol->opening; - $cash = price2num($cash + $cashcontrol->opening, 'MT'); + //$cash = $amountpertype['LIQ'] + $object->opening; + $cash = price2num($cash + $object->opening, 'MT'); - print '

'; - print $langs->trans("Cash").": ".price($cash); - if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cash != $cashcontrol->cash) { - print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->cash).''; + print '
'; + print '

'; + + print $langs->trans("Cash").': '.price($cash).''; + if ($object->status == $object::STATUS_VALIDATED && $cash != $object->cash) { + print ' <> '.$langs->trans("Declared").': '.price($object->cash).''; } - print "

"; + print "
"; //print '
'; - print $langs->trans("PaymentTypeCHQ").": ".price($cheque); - if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $cheque != $cashcontrol->cheque) { - print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->cheque).''; + print $langs->trans("PaymentTypeCHQ").': '.price($cheque).''; + if ($object->status == $object::STATUS_VALIDATED && $cheque != $object->cheque) { + print ' <> '.$langs->trans("Declared").': '.price($object->cheque).''; } - print "

"; + print "
"; //print '
'; - print $langs->trans("PaymentTypeCB").": ".price($bank); - if ($cashcontrol->status == $cashcontrol::STATUS_VALIDATED && $bank != $cashcontrol->card) { - print ' <> '.$langs->trans("Declared").': '.price($cashcontrol->card).''; + print $langs->trans("PaymentTypeCB").': '.price($bank).''; + if ($object->status == $object::STATUS_VALIDATED && $bank != $object->card) { + print ' <> '.$langs->trans("Declared").': '.price($object->card).''; } - print "

"; + print "
"; // print '
'; if ($other) { - print '
'.$langs->trans("Other").": ".price($other)."

"; + print ''.$langs->trans("Other").': '.price($other).""; + print '
'; } - print "

"; - //save totals to DB - /* - $sql = "UPDATE ".MAIN_DB_PREFIX."pos_cash_fence "; - $sql .= "SET"; - $sql .= " cash='".$db->escape($cash)."'"; - $sql .= ", card='".$db->escape($bank)."'"; - $sql .= " where rowid = ".((int) $id); - $db->query($sql); - */ + print $langs->trans("Total").': '.price($cash + $cheque + $bank + $other).''; - print "

"; + print ''; + print ''; print ''; From f17e7a6979a9373183943d0afb906a69f41f0df3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Jun 2021 03:54:19 +0200 Subject: [PATCH 275/739] Add more info --- htdocs/compta/cashcontrol/report.php | 50 ++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 12dff9d460a..15345584f73 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -120,9 +120,10 @@ $sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CB; $sql.=" OR b.fk_account=".$conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE; $sql.=")"; */ -$sql = "SELECT f.rowid as facid, f.ref, f.datef as do, pf.amount as amount, b.fk_account as bankid, cp.code"; -$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b"; -$sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid"; +$sql = "SELECT f.rowid as facid, f.ref, f.datef as do, pf.amount as amount, b.fk_account as bankid, cp.code, SUM(fd.qty) as qty"; +$sql .= " FROM ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as cp, ".MAIN_DB_PREFIX."bank as b,"; +$sql .= " ".MAIN_DB_PREFIX."facturedet as fd"; +$sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id = p.fk_paiement AND p.fk_bank = b.rowid AND fd.fk_facture = f.rowid"; $sql .= " AND f.module_source = '".$db->escape($posmodule)."'"; $sql .= " AND f.pos_source = '".$db->escape($terminalid)."'"; $sql .= " AND f.paye = 1"; @@ -144,6 +145,7 @@ if ($syear && !$smonth) { } else { dol_print_error('', 'Year not defined'); } +$sql .= " GROUP BY f.rowid, f.ref, f.datef, pf.amount, b.fk_account, cp.code"; $resql = $db->query($sql); if ($resql) { @@ -196,15 +198,20 @@ if ($resql) { print "
'; - print $bankaccount->getNomUrl(1); if ($object->posmodule == "takepos") { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$object->posnumber; } else { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'; } + + // Bank account + print ''; + print $bankaccount->getNomUrl(1); if ($objp->code == 'CHQ') { $cheque += $objp->amount; + if (empty($transactionspertype[$objp->code])) { + $transactionspertype[$objp->code] = 0; + } + $transactionspertype[$objp->code] += 1; } elseif ($objp->code == 'CB') { $bank += $objp->amount; + if (empty($transactionspertype[$objp->code])) { + $transactionspertype[$objp->code] = 0; + } + $transactionspertype[$objp->code] += 1; } else { if ($conf->global->$var1 == $bankaccount->id) { $cash += $objp->amount; // } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount; //elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount; + if (empty($transactionspertype['CASH'])) { + $transactionspertype['CASH'] = 0; + } + $transactionspertype['CASH'] += 1; } else { $other += $objp->amount; + if (empty($transactionspertype['OTHER'])) { + $transactionspertype['OTHER'] = 0; + } + $transactionspertype['OTHER'] += 1; } } print "
'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").''.price($object->opening).'
'.$langs->trans("ManageLotMask").''; - print $object->batch_mask; - print '
'.$langs->trans("ManageLotMask").''; + print $object->batch_mask; + print '
trans("IM"); ?>
trans("ContactVisibility"); ?> control->tpl['select_visibility']; ?>
'; $sql = 'SELECT rowid, socialnetworks'; - $sql .= ', jabberid, skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'socpeople WHERE '; + $sql .= ', jabberid, skype, twitter, facebook, linkedin, instagram, snapchat, googleplus, youtube, whatsapp FROM '.MAIN_DB_PREFIX.'socpeople WHERE'; $sql .= " jabberid IS NOT NULL OR jabberid <> ''"; $sql .= " OR skype IS NOT NULL OR skype <> ''"; $sql .= " OR twitter IS NOT NULL OR twitter <> ''"; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index a28371443d5..37d86dcded9 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -492,8 +492,7 @@ function getContactsForThirdParty($authentication, $idthirdparty) $sql .= " c.fk_pays as country_id,"; $sql .= " c.fk_departement as state_id,"; $sql .= " c.birthday,"; - $sql .= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid,"; - //$sql.= " c.priv, c.note, c.default_lang, c.canvas,"; + $sql .= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email,"; $sql .= " co.label as country, co.code as country_code,"; $sql .= " d.nom as state, d.code_departement as state_code,"; $sql .= " u.rowid as user_id, u.login as user_login,"; @@ -545,7 +544,6 @@ function getContactsForThirdParty($authentication, $idthirdparty) 'phone_mobile' => $contact->phone_mobile ? $contact->phone_mobile : '', 'email' => $contact->email ? $contact->email : '', - 'jabberid' => $contact->jabberid ? $contact->jabberid : '', 'priv' => $contact->priv ? $contact->priv : '', 'mail' => $contact->mail ? $contact->mail : '', From 3cc478b1335ad6f4e422d770125b73c332b6f035 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 00:13:23 +0200 Subject: [PATCH 304/739] Fix use of get url --- htdocs/blockedlog/class/authority.class.php | 22 +++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 4ec3fc6d07e..7240aaf0151 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -71,7 +71,7 @@ class BlockedLogAuthority $this->blockchain = ''; - if (is_array($bocks)) { + if (is_array($blocks)) { foreach ($blocks as &$b) { $this->blockchain .= $b->signature; } @@ -299,16 +299,18 @@ class BlockedLogAuthority $signature = $block_static->getSignature(); - foreach ($blocks as &$block) { - $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; + if (is_array($blocks)) { + foreach ($blocks as &$block) { + $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; - $res = file_get_contents($url); - echo $block->signature.' '.$url.' '.$res.'
'; - if ($res === 'blockalreadyadded' || $res === 'blockadded') { - $block->setCertified(); - } else { - $this->error = $langs->trans('ImpossibleToContactAuthority ', $url); - return -1; + $res = getURLContent($url); + echo $block->signature.' '.$url.' '.$res.'
'; + if ($res === 'blockalreadyadded' || $res === 'blockadded') { + $block->setCertified(); + } else { + $this->error = $langs->trans('ImpossibleToContactAuthority ', $url); + return -1; + } } } From 9afe8e54a7d164153339e3306d5eb9661067977d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 00:41:15 +0200 Subject: [PATCH 305/739] Fix --- htdocs/compta/facture/index.php | 4 ++-- htdocs/core/lib/invoice.lib.php | 24 +++++++++++++++--------- htdocs/fourn/facture/index.php | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/index.php b/htdocs/compta/facture/index.php index 0b2f4538636..66a2fccaf08 100644 --- a/htdocs/compta/facture/index.php +++ b/htdocs/compta/facture/index.php @@ -59,8 +59,8 @@ print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill'); print '
'; print '
'; - -print getCustomerInvoicePieChart($socid); +print getNumberInvoicesPieChart('customers'); +//print getCustomerInvoicePieChart($socid); print '
'; print getCustomerInvoiceDraftTable($max, $socid); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 0cbb89ae47b..43cff7d3c3e 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -458,8 +458,9 @@ function getPurchaseInvoicePieChart($socid = 0) /** * Return an HTML table that contains a pie chart of the number of customers or supplier invoices - * @param string $mode Can be customer or fourn - * @return string A HTML table that contains a pie chart of customers or supplier invoices + * + * @param string $mode Can be 'customers' or 'suppliers' + * @return string A HTML table that contains a pie chart of customers or supplier invoices */ function getNumberInvoicesPieChart($mode) { @@ -487,13 +488,17 @@ function getNumberInvoicesPieChart($mode) $sql .= ", sum(".$db->ifsql("f.date_lim_reglement > '".date_format($datenowadd30, 'Y-m-d')."'", 1, 0).") as nbnotlate30"; if ($mode == 'customers') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - } elseif ($mode == 'fourn') { + } elseif ($mode == 'fourn' || $mode == 'suppliers') { $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; } else { return ''; } $sql .= " WHERE f.type <> 2"; $sql .= " AND f.fk_statut = 1"; + if (isset($user->socid) && $user->socid > 0) { + $sql .= " AND f.fk_soc = ".((int) $user->socid); + } + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -519,14 +524,15 @@ function getNumberInvoicesPieChart($mode) $result = '
'; $result .= ''; $result .= ''; - $result .= ''; - } elseif ($mode == 'fourn') { - $result .= $langs->trans("SupplierInvoice").''; + $result .= $langs->trans("CustomerInvoice"); + } elseif ($mode == 'fourn' || $mode == 'suppliers') { + $result .= $langs->trans("SupplierInvoice"); } else { return ''; } + $result .= ''; $result .= ''; $dolgraph = new DolGraph(); @@ -539,13 +545,13 @@ function getNumberInvoicesPieChart($mode) $dolgraph->setWidth('300'); if ($mode == 'customers') { $dolgraph->draw('idgraphcustomerinvoices'); - } elseif ($mode == 'fourn') { + } elseif ($mode == 'fourn' || $mode == 'suppliers') { $dolgraph->draw('idgraphfourninvoices'); } else { return ''; } $result .= ''; - $result .= ''; + $result .= ''; $result .= ''; $result .= '
'.$langs->trans("Statistics").' - '; + $result .= ''.$langs->trans("Statistics").' - '; if ($mode == 'customers') { - $result .= $langs->trans("CustomerInvoice").'
'.$dolgraph->show($total ? 0 : 1).''.$dolgraph->show($total ? 0 : 1).'
'; $result .= '
'; diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index e76426f54c2..c695eed9285 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -58,8 +58,8 @@ print load_fiche_titre($langs->trans("SupplierInvoicesArea"), '', 'supplier_invo print '
'; print '
'; - -print getPurchaseInvoicePieChart($socid); +print getNumberInvoicesPieChart('suppliers'); +//print getPurchaseInvoicePieChart($socid); print '
'; print getDraftSupplierTable($maxDraftCount, $socid); From c40bc085b2dd309bd09118172d4084599eafd651 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 00:55:10 +0200 Subject: [PATCH 306/739] Fix v14 --- htdocs/core/lib/invoice.lib.php | 40 +++++++++++++++++++-------------- htdocs/langs/en_US/bills.lang | 1 + 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 43cff7d3c3e..b6618b5df26 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -505,6 +505,7 @@ function getNumberInvoicesPieChart($mode) $i = 0; $total = 0; $dataseries = array(); + while ($i < $num) { $obj = $db->fetch_object($resql); $dataseries = array(array($langs->trans('InvoiceLate30Days'),$obj->nblate30) @@ -520,21 +521,22 @@ function getNumberInvoicesPieChart($mode) } $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11); - if ($conf->use_javascript_ajax) { - $result = '
'; - $result .= ''; - $result .= ''; - $result .= ''; - $result .= ''; + $result = '
'; + $result .= '
'.$langs->trans("Statistics").' - '; - if ($mode == 'customers') { - $result .= $langs->trans("CustomerInvoice"); - } elseif ($mode == 'fourn' || $mode == 'suppliers') { - $result .= $langs->trans("SupplierInvoice"); - } else { - return ''; - } - $result .= '
'; + $result .= ''; + $result .= ''; + $result .= ''; + + if ($conf->use_javascript_ajax) { $dolgraph = new DolGraph(); $dolgraph->SetData($dataseries); $dolgraph->SetDataColor(array_values($colorseries)); @@ -551,11 +553,15 @@ function getNumberInvoicesPieChart($mode) return ''; } $result .= ''; - $result .= ''; + $result .= ''; $result .= ''; - $result .= '
'.$langs->trans("Statistics").' - '; + if ($mode == 'customers') { + $result .= $langs->trans("CustomerInvoice"); + } elseif ($mode == 'fourn' || $mode == 'suppliers') { + $result .= $langs->trans("SupplierInvoice"); + } else { + return ''; + } + $result .= '
'.$dolgraph->show($total ? 0 : 1).''.$dolgraph->show($total ? 0 : $langs->trans("NoOpenInvoice")).'
'; - $result .= '
'; + } else { + // Print text lines } + + $result .= '
'; + $result .= '
'; + return $result; } else { dol_print_error($db); diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 940da4e35b4..0c660de8e22 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -259,6 +259,7 @@ DateMaxPayment=Payment due on DateInvoice=Invoice date DatePointOfTax=Point of tax NoInvoice=No invoice +NoOpenInvoice=No open invoice ClassifyBill=Classify invoice SupplierBillsToPay=Unpaid vendor invoices CustomerBillsUnpaid=Unpaid customer invoices From ea0db5a574db32eab922845e924b2577eccc1eab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 01:10:35 +0200 Subject: [PATCH 307/739] Fix popup of invoice --- htdocs/core/lib/functions.lib.php | 8 ++++++-- htdocs/core/lib/invoice.lib.php | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1857be0146c..dd4d8cba1f2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3515,7 +3515,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', - 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', + 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'question', 'refresh', 'salary', 'shipment', + 'supplier_invoice', 'supplier_invoicea', 'supplier_invoicer', 'supplier_invoiced', + 'technic', 'ticket', 'error', 'warning', 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', @@ -3536,7 +3538,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotofa = array( 'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'search-dollar', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', 'asset'=>'money-check-alt', 'autofill'=>'fill', - 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', + 'bank_account'=>'university', + 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'billd'=>'file-medical', + 'supplier_invoice'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'supplier_invoicer'=>'file-invoice-dollar', 'supplier_invoiced'=>'file-medical', 'bom'=>'shapes', 'chart'=>'chart-line', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'collab'=>'people-arrows', 'conversation'=>'comments', 'country'=>'globe-americas', 'cron'=>'business-time', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index b6618b5df26..c328d659b93 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -854,8 +854,8 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) { global $conf, $db, $langs, $user; - $sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, s.nom as socname, s.rowid as socid, s.canvas, s.client,"; - $sql .= " f.datec"; + $sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.type, f.total_ht, f.total_tva, f.total_ttc, f.datec,"; + $sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) { @@ -904,6 +904,10 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0) $objectstatic->ref = $obj->ref; $objectstatic->paye = $obj->paye; $objectstatic->statut = $obj->status; + $objectstatic->total_ht = $obj->total_ht; + $objectstatic->total_tva = $obj->total_tva; + $objectstatic->total_ttc = $obj->total_ttc; + $objectstatic->type = $obj->type; $companystatic->id = $obj->socid; $companystatic->name = $obj->socname; @@ -952,8 +956,8 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) { global $conf, $db, $langs, $user; - $sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, s.nom as socname, s.rowid as socid, s.canvas, s.client,"; - $sql .= " f.datec"; + $sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.datec,"; + $sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) { @@ -1002,6 +1006,10 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0) $objectstatic->ref = $obj->ref; $objectstatic->paye = $obj->paye; $objectstatic->statut = $obj->status; + $objectstatic->total_ht = $obj->total_ht; + $objectstatic->total_tva = $obj->total_tva; + $objectstatic->total_ttc = $obj->total_ttc; + $objectstatic->type = $obj->type; $companystatic->id = $obj->socid; $companystatic->name = $obj->socname; From 4c89a1146c1553c8cdda1693057e7e06617f9a5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 01:13:50 +0200 Subject: [PATCH 308/739] Fix popup --- htdocs/compta/index.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 18519955bf6..8db217747ef 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -267,7 +267,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $langs->load("boxes"); $facstatic = new FactureFournisseur($db); - $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye"; + $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle, ff.total_ht, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, ff.ref_supplier"; $sql .= ", s.nom as name"; $sql .= ", s.rowid as socid"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.email"; @@ -290,7 +290,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $reshook = $hookmanager->executeHooks('printFieldListWhereSupplierLastModified', $parameters); $sql .= $hookmanager->resPrint; - $sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye,"; + $sql .= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.type, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.tms, ff.paye, ff.ref_supplier,"; $sql .= " s.nom, s.rowid, s.code_fournisseur, s.code_compta_fournisseur, s.email"; $sql .= " ORDER BY ff.tms DESC "; $sql .= $db->plimit($max, 0); @@ -332,6 +332,8 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $facstatic->total_ttc = $obj->total_ttc; $facstatic->statut = $obj->status; $facstatic->paye = $obj->paye; + $facstatic->type = $obj->type; + $facstatic->ref_supplier = $obj->ref_supplier; $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; From ae6d2ba9b51013747c650926e445a7b914b067e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 01:56:20 +0200 Subject: [PATCH 309/739] Fix missing user creation/modif of template invoice --- .../compta/facture/invoicetemplate_list.php | 51 +++++++++++++++++-- htdocs/compta/facture/list.php | 2 +- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 5f7e277076c..af6678ffd71 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -137,9 +137,11 @@ $arrayfields = array( 'f.nb_gen_done'=>array('label'=>"NbOfGenerationDoneShort", 'checked'=>1), 'f.date_last_gen'=>array('label'=>"DateLastGenerationShort", 'checked'=>1), 'f.date_when'=>array('label'=>"NextDateToExecutionShort", 'checked'=>1), - 'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>100), - 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.fk_user_author'=>array('label'=>"UserCreation", 'checked'=>0, 'position'=>500), + 'f.fk_user_modif'=>array('label'=>"UserModification", 'checked'=>0, 'position'=>505), + 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>520), + 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>525), + 'status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; @@ -240,6 +242,7 @@ if (!empty($conf->projet->enabled)) { } $companystatic = new Societe($db); $invoicerectmp = new FactureRec($db); +$tmpuser = new User($db); $now = dol_now(); $tmparray = dol_getdate($now); @@ -252,7 +255,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray[' $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,"; $sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,"; -$sql .= " f.datec, f.tms,"; +$sql .= " f.datec, f.fk_user_author, f.tms, f.fk_user_modif,"; $sql .= " f.fk_cond_reglement, f.fk_mode_reglement"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -274,7 +277,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } if ($search_ref) { $sql .= natural_search('f.titre', $search_ref); @@ -534,6 +537,16 @@ if ($resql) { $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // User creation + if (!empty($arrayfields['f.fk_user_author']['checked'])) { + print ''; + print ''; + } + // User modification + if (!empty($arrayfields['f.fk_user_modif']['checked'])) { + print ''; + print ''; + } // Date creation if (!empty($arrayfields['f.datec']['checked'])) { print ''; @@ -602,6 +615,12 @@ if ($resql) { if (!empty($arrayfields['f.date_when']['checked'])) { print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder); } + if (!empty($arrayfields['f.fk_user_author']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder); + } + if (!empty($arrayfields['f.fk_user_modif']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder); + } if (!empty($arrayfields['f.datec']['checked'])) { print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder); } @@ -754,6 +773,28 @@ if ($resql) { $totalarray['nbfield']++; } } + if (!empty($arrayfields['f.fk_user_author']['checked'])) { + print ''; + if ($objp->fk_user_author > 0) { + $tmpuser->fetch($objp->fk_user_author); + print $tmpuser->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['f.fk_user_modif']['checked'])) { + print ''; + if ($objp->fk_user_author > 0) { + $tmpuser->fetch($objp->fk_user_author); + print $tmpuser->getNomUrl(1); + } + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['f.datec']['checked'])) { print ''; print dol_print_date($db->jdate($objp->datec), 'dayhour'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index a375bc677f2..de6c3f66065 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -240,7 +240,7 @@ $arrayfields = array( 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)), 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), - 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>502), 'f.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'position'=>510, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES))), 'f.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'position'=>511, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES))), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), From 5f925d9e3b183f32bf8ea0d455b2d66edcf9c53f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 02:10:58 +0200 Subject: [PATCH 310/739] Fix total -> total_ht --- htdocs/compta/facture/invoicetemplate_list.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index af6678ffd71..19da4b97f63 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -654,6 +654,9 @@ if ($resql) { $invoicerectmp->nb_gen_max = $objp->nb_gen_max; $invoicerectmp->nb_gen_done = $objp->nb_gen_done; $invoicerectmp->ref = $objp->title; + $invoicerectmp->total_ht = $objp->total_ht; + $invoicerectmp->total_tva = $objp->total_tva; + $invoicerectmp->total_ttc = $objp->total_ttc; print ''; @@ -673,7 +676,7 @@ if ($resql) { } } if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($objp->total).''."\n"; + print ''.price($objp->total_ht).''."\n"; if (!$i) { $totalarray['nbfield']++; } From 53af424a3dc082ace87de3ba16804b4fe5acc7dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 02:12:29 +0200 Subject: [PATCH 311/739] Fix total tva --- htdocs/compta/facture/invoicetemplate_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 19da4b97f63..c60690ce96b 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -686,7 +686,7 @@ if ($resql) { $totalarray['val']['f.total_ht'] += $objp->total_ht; } if (!empty($arrayfields['f.total_tva']['checked'])) { - print ''.price($objp->total_vat).''."\n"; + print ''.price($objp->total_tva).''."\n"; if (!$i) { $totalarray['nbfield']++; } From 3d26ad4cf8f67c8f7d94defc87f3f4a6d66a74c4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Jun 2021 05:59:29 +0200 Subject: [PATCH 312/739] NEW Add field date from/to in supplier invoice list --- htdocs/fourn/facture/list.php | 158 +++++++++++++++++++++++----------- 1 file changed, 106 insertions(+), 52 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8578f82137d..72ca65bc409 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1,17 +1,18 @@ - * Copyright (C) 2004-2019 Laurent Destailleur - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2013-2019 Philippe Grand - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Marcos García - * Copyright (C) 2015-2007 Juanjo Menent - * Copyright (C) 2015 Abbes Bahfir - * Copyright (C) 2015-2016 Ferran Marcet - * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2018-2020 Frédéric France +/* Copyright (C) 2002-2006 Rodolphe Quiedeville + * Copyright (C) 2004-2019 Laurent Destailleur + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2013-2019 Philippe Grand + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Marcos García + * Copyright (C) 2015-2007 Juanjo Menent + * Copyright (C) 2015 Abbes Bahfir + * Copyright (C) 2015-2016 Ferran Marcet + * Copyright (C) 2017 Josep Lluís Amador + * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2019-2021 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,12 +102,22 @@ $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$day = GETPOST('day', 'int'); -$month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); -$day_lim = GETPOST('day_lim', 'int'); -$month_lim = GETPOST('month_lim', 'int'); -$year_lim = GETPOST('year_lim', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); +$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); +$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); +$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int'); +$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int'); +$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int'); +$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth,$search_datelimit_startday, $search_datelimit_startyear); +$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth,$search_datelimit_endday, $search_datelimit_endyear); $toselect = GETPOST('toselect', 'array'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); @@ -257,12 +268,22 @@ if (empty($reshook)) { $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; - $year = ""; - $month = ""; - $day = ""; - $year_lim = ""; - $month_lim = ""; - $day_lim = ""; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_datelimit_startday = ''; + $search_datelimit_startmonth = ''; + $search_datelimit_startyear = ''; + $search_datelimit_endday = ''; + $search_datelimit_endmonth = ''; + $search_datelimit_endyear = ''; + $search_datelimit_start = ''; + $search_datelimit_end = ''; $toselect = ''; $search_array_options = array(); $filter = ''; @@ -548,8 +569,18 @@ if ($search_paymentmode > 0) { if ($search_paymentcond > 0) { $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond); } -$sql .= dolSqlDateFilter("f.datef", $day, $month, $year); -$sql .= dolSqlDateFilter("f.date_lim_reglement", $day_lim, $month_lim, $year_lim); +if ($search_date_start) { + $sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; +} +if ($search_date_end) { + $sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +} +if ($search_datelimit_start) { + $sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'"; +} +if ($search_datelimit_end) { + $sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'"; +} if ($option == 'late') { $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'"; } @@ -669,23 +700,41 @@ if ($resql) { if ($search_all) { $param .= '&search_all='.urlencode($search_all); } - if ($day) { - $param .= '&day='.urlencode($day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($month) { - $param .= '&month='.urlencode($month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($year) { - $param .= '&year='.urlencode($year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); } - if ($day_lim) { - $param .= '&day_lim='.urlencode($day_lim); + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); } - if ($month_lim) { - $param .= '&month_lim='.urlencode($month_lim); + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); } - if ($year_lim) { - $param .= '&year_lim='.urlencode($year_lim); + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_datelimit_startday) { + $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + } + if ($search_datelimit_startmonth) { + $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + } + if ($search_datelimit_startyear) { + $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + } + if ($search_datelimit_endday) { + $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + } + if ($search_datelimit_endmonth) { + $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + } + if ($search_datelimit_endyear) { + $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -956,23 +1005,28 @@ if ($resql) { } // Date invoice if (!empty($arrayfields['f.datef']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Date due if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year_lim ? $year_lim : -1, 'year_lim', 1, 20, 5); - print '
'; + print ''; + print '
'; + /* + print $langs->trans('From').' '; + print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to').' ';*/ + print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("Before")); + print '
'.$langs->trans("Alert"); + print '
'; print ''; } // Project From 17bdd0b5bcc0bbe78028a1115c101bc4ae5fc818 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 10 Jun 2021 04:03:51 +0000 Subject: [PATCH 313/739] Fixing style errors. --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 72ca65bc409..04dd46035b3 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -116,8 +116,8 @@ $search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); $search_datelimit_endday = GETPOST('search_datelimit_endday', 'int'); $search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int'); $search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int'); -$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth,$search_datelimit_startday, $search_datelimit_startyear); -$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth,$search_datelimit_endday, $search_datelimit_endyear); +$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear); +$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear); $toselect = GETPOST('toselect', 'array'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); From b216c81c60305513415c7c9b1086d55df75eac0f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Jun 2021 06:22:03 +0200 Subject: [PATCH 314/739] FIX Customer invoice list - Pagination lost search_date_xxx information --- htdocs/compta/facture/list.php | 74 ++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f655de32646..94326852d31 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -13,7 +13,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019 Alexandre Spangaro + * Copyright (C) 2019-2021 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,12 +105,30 @@ $search_country = GETPOST("search_country", 'int'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_date_valid_start = dol_mktime(0, 0, 0, GETPOST('search_date_valid_startmonth', 'int'), GETPOST('search_date_valid_startday', 'int'), GETPOST('search_date_valid_startyear', 'int')); -$search_date_valid_end = dol_mktime(23, 59, 59, GETPOST('search_date_valid_endmonth', 'int'), GETPOST('search_date_valid_endday', 'int'), GETPOST('search_date_valid_endyear', 'int')); -$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int')); -$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int')); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_valid_startday = GETPOST('search_date_valid_startday', 'int'); +$search_date_valid_startmonth = GETPOST('search_date_valid_startmonth', 'int'); +$search_date_valid_startyear = GETPOST('search_date_valid_startyear', 'int'); +$search_date_valid_endday = GETPOST('search_date_valid_endday', 'int'); +$search_date_valid_endmonth = GETPOST('search_date_valid_endmonth', 'int'); +$search_date_valid_endyear = GETPOST('search_date_valid_endyear', 'int'); +$search_date_valid_start = dol_mktime(0, 0, 0, $search_date_valid_startmonth, $search_date_valid_startday, $search_date_valid_startyear); +$search_date_valid_end = dol_mktime(23, 59, 59, $search_date_valid_endmonth, $search_date_valid_endday, $search_date_valid_endyear); +$search_datelimit_startday = GETPOST('search_datelimit_startday', 'int'); +$search_datelimit_startmonth = GETPOST('search_datelimit_startmonth', 'int'); +$search_datelimit_startyear = GETPOST('search_datelimit_startyear', 'int'); +$search_datelimit_endday = GETPOST('search_datelimit_endday', 'int'); +$search_datelimit_endmonth = GETPOST('search_datelimit_endmonth', 'int'); +$search_datelimit_endyear = GETPOST('search_datelimit_endyear', 'int'); +$search_datelimit_start = dol_mktime(0, 0, 0, $search_datelimit_startmonth, $search_datelimit_startday, $search_datelimit_startyear); +$search_datelimit_end = dol_mktime(23, 59, 59, $search_datelimit_endmonth, $search_datelimit_endday, $search_datelimit_endyear); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); @@ -273,10 +291,28 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_type = ''; $search_country = ''; $search_type_thirdparty = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; $search_date_end = ''; + $search_date_valid_startday = ''; + $search_date_valid_startmonth = ''; + $search_date_valid_startyear = ''; + $search_date_valid_endday = ''; + $search_date_valid_endmonth = ''; + $search_date_valid_endyear = ''; $search_date_valid_start = ''; $search_date_valid_end = ''; + $search_datelimit_startday = ''; + $search_datelimit_startmonth = ''; + $search_datelimit_startyear = ''; + $search_datelimit_endday = ''; + $search_datelimit_endmonth = ''; + $search_datelimit_endyear = ''; $search_datelimit_start = ''; $search_datelimit_end = ''; $option = ''; @@ -623,12 +659,24 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); - if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); - if ($search_date_valid_start) $param .= '&search_date_valid_start='.urlencode($search_date_valid_start); - if ($search_date_valid_end) $param .= '&search_date_valid_end='.urlencode($search_date_valid_end); - if ($search_datelimit_start) $param .= '&search_datelimit_start='.urlencode($search_datelimit_start); - if ($search_datelimit_end) $param .= '&search_datelimit_end='.urlencode($search_datelimit_end); + if ($search_date_startday) $param .= '&search_date_startday='.urlencode($search_date_startday); + if ($search_date_startmonth) $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); + if ($search_date_startyear) $param .= '&search_date_startyear='.urlencode($search_date_startyear); + if ($search_date_endday) $param .= '&search_date_endday='.urlencode($search_date_endday); + if ($search_date_endmonth) $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); + if ($search_date_endyear) $param .= '&search_date_endyear='.urlencode($search_date_endyear); + if ($search_date_valid_startday) $param .= '&search_date_valid_startday='.urlencode($search_date_valid_startday); + if ($search_date_valid_startmonth) $param .= '&search_date_valid_startmonth='.urlencode($search_date_valid_startmonth); + if ($search_date_valid_startyear) $param .= '&search_date_valid_startyear='.urlencode($search_date_valid_startyear); + if ($search_date_valid_endday) $param .= '&search_date_valid_endday='.urlencode($search_date_valid_endday); + if ($search_date_valid_endmonth) $param .= '&search_date_valid_endmonth='.urlencode($search_date_valid_endmonth); + if ($search_date_valid_endyear) $param .= '&search_date_valid_endyear='.urlencode($search_date_valid_endyear); + if ($search_datelimit_startday) $param .= '&search_datelimit_startday='.urlencode($search_datelimit_startday); + if ($search_datelimit_startmonth) $param .= '&search_datelimit_startmonth='.urlencode($search_datelimit_startmonth); + if ($search_datelimit_startyear) $param .= '&search_datelimit_startyear='.urlencode($search_datelimit_startyear); + if ($search_datelimit_endday) $param .= '&search_datelimit_endday='.urlencode($search_datelimit_endday); + if ($search_datelimit_endmonth) $param .= '&search_datelimit_endmonth='.urlencode($search_datelimit_endmonth); + if ($search_datelimit_endyear) $param .= '&search_datelimit_endyear='.urlencode($search_datelimit_endyear); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref); From 08186fdff155b6b261bba852cc6002e1554df5cf Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 10 Jun 2021 06:28:09 +0200 Subject: [PATCH 315/739] Fix warning - search_societe is already present --- htdocs/compta/facture/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 94326852d31..a704280a9f4 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -530,7 +530,6 @@ if ($search_zip) $sql .= natural_search("s.zip", $search_zip); if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql .= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql .= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql .= natural_search('f.localtax1', $search_montant_localtax1, 1); From c0c773dd1d285fa27278bf2fba60c737e3bd4420 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Jun 2021 11:32:09 +0200 Subject: [PATCH 316/739] css --- htdocs/public/demo/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index e39a332d3fb..bbb4a85aadf 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -118,7 +118,7 @@ if (empty($reshook)) { 'mailmanspip', 'notification', 'oauth', 'syslog', 'user', 'webservices', 'workflow', // Extended modules 'memcached', 'numberwords', 'zipautofillfr'); - $alwayshiddenuncheckedmodules = array('collab', 'dav', 'debugbar', 'emailcollector', 'ftp', 'hrm', 'modulebuilder', 'printing', 'webservicesclient', 'zappier', + $alwayshiddenuncheckedmodules = array('cashdesk', 'collab', 'dav', 'debugbar', 'emailcollector', 'ftp', 'hrm', 'modulebuilder', 'printing', 'webservicesclient', 'zappier', // Extended modules 'awstats', 'bittorrent', 'bootstrap', 'cabinetmed', 'cmcic', 'concatpdf', 'customfield', 'datapolicy', 'deplacement', 'dolicloud', 'filemanager', 'lightbox', 'mantis', 'monitoring', 'moretemplates', 'multicompany', 'nltechno', 'numberingpack', 'openstreetmap', 'ovh', 'phenix', 'phpsysinfo', 'pibarcode', 'postnuke', 'dynamicprices', 'receiptprinter', 'selectbank', 'skincoloreditor', 'submiteverywhere', 'survey', 'thomsonphonebook', 'topten', 'tvacerfa', 'voyage', 'webcalendar', 'webmail'); @@ -352,13 +352,13 @@ foreach ($demoprofiles as $profilearray) { if (empty($profilearray['url'])) { print ''; // Scan directories @@ -168,7 +168,7 @@ class doc_generic_contract_odt extends ModelePDFContract // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index d696ac06fdd..dcaee5eadbc 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -85,7 +85,7 @@ class mod_contract_magre extends ModelNumRefContracts $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index af1900803c8..d5ac288b52a 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -83,7 +83,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 797530a6c13..163392ead88 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -182,7 +182,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 0303dfde3dc..79bbcbdb481 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -80,7 +80,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index 195667692f1..482b8c06431 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -82,7 +82,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index eb48373a443..ffba0717332 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -158,7 +158,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte .= $conf->global->FACTURE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -181,7 +181,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 70fde36f549..32e06f285a9 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -76,7 +76,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -84,17 +84,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index fa5dd49f0fa..91025817a9d 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -84,7 +84,7 @@ class mod_arctic extends ModeleNumRefFicheinter // Setting the prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index b8cb33f550e..000c7881561 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -85,7 +85,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 5ff5a1f767a..9a14e96bc28 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -154,7 +154,7 @@ class doc_generic_member_odt extends ModelePDFMember $texte .= $conf->global->MEMBER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -171,7 +171,7 @@ class doc_generic_member_odt extends ModelePDFMember // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 374ae5b4337..860e07d7d36 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -158,7 +158,7 @@ class doc_generic_mo_odt extends ModelePDFMo $texte .= $conf->global->MRP_MO_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/mrp/mod_mo_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php index 3d70ded1ba2..14292f7f896 100644 --- a/htdocs/core/modules/mrp/mod_mo_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -80,7 +80,7 @@ class mod_mo_advanced extends ModeleNumRefMos // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 10926805721..dca32b26505 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 19a752d5be7..d038acd7ee5 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -161,7 +161,7 @@ class doc_generic_product_odt extends ModelePDFProduct $texte .= $conf->global->PRODUCT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 0a302c0fb6b..5936476e079 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -116,7 +116,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Parametrage du prefix customers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ProductCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -124,7 +124,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Parametrage du prefix suppliers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("ServiceCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index c580d8915c9..0bbb124d14b 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -80,7 +80,7 @@ class mod_lot_advanced extends ModeleNumRefBatch // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index 74f36a55fe6..8117b9e6c6e 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -80,7 +80,7 @@ class mod_sn_advanced extends ModeleNumRefBatch // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index da95e841728..c085f1eeaac 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -449,7 +449,7 @@ class doc_generic_project_odt extends ModelePDFProjects $texte .= $conf->global->PROJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 3ab4079c1b7..480d19396c3 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -83,7 +83,7 @@ class mod_project_universal extends ModeleNumRefProjects // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 0662e1a5a76..a04e2e9c14a 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -416,7 +416,7 @@ class doc_generic_task_odt extends ModelePDFTask $texte .= $conf->global->PROJECT_TASK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 011ac381254..3a6ef89f3fb 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -83,7 +83,7 @@ class mod_task_universal extends ModeleNumRefTask // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 4a292d4a97b..e7eade5de02 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -160,7 +160,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $conf->global->PROPALE_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -209,7 +209,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/propale/mod_propale_saphir.php b/htdocs/core/modules/propale/mod_propale_saphir.php index 5fb7eeaa6fb..ce78f341319 100644 --- a/htdocs/core/modules/propale/mod_propale_saphir.php +++ b/htdocs/core/modules/propale/mod_propale_saphir.php @@ -85,7 +85,7 @@ class mod_propale_saphir extends ModeleNumRefPropales // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 13a05b3378d..d70ecca00ad 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -153,7 +153,7 @@ class doc_generic_reception_odt extends ModelePdfReception $texte .= $conf->global->RECEPTION_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index bcab451ab9e..0d0ced20eb4 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -61,7 +61,7 @@ class mod_reception_moonstone extends ModelNumRefReception $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 1822a5b8c95..9045ed0b281 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -141,7 +141,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte .= ''; $texte .= ''; $texte .= '  '; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; @@ -167,7 +167,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 9ddf77abe44..705564e7e8e 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -132,7 +132,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix customers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -140,7 +140,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode // Parametrage du prefix suppliers $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 2819adea021..e2d474d2dd2 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -155,7 +155,7 @@ class doc_generic_stock_odt extends ModelePDFStock $texte .= $conf->global->STOCK_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -179,7 +179,7 @@ class doc_generic_stock_odt extends ModelePDFStock // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 3cf0a4a209e..57d5798c29e 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -93,7 +93,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").')'; $texte .= ':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -101,19 +101,19 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; if ($conf->global->MAIN_FEATURE_LEVEL >= 2) { // Parametrage du prefix des replacement $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; } // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 9e9799f44c6..b7fd399edef 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $texte .= $conf->global->SUPPLIER_ORDER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index a609eeade08..c691b1448ef 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -85,7 +85,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 8f3b7ad36df..19e632a6264 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -82,7 +82,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 4b761f8099b..7e300c68643 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -162,7 +162,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index adf53aed4e6..3b8754d9928 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -85,7 +85,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index e6487db6ed1..d103dbe3b0b 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -79,7 +79,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index eb90baef7e5..d1d3763fb2e 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -150,7 +150,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $texte .= $conf->global->TICKET_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -167,7 +167,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 1a528359221..f60b1f16481 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -81,7 +81,7 @@ class mod_ticket_universal extends ModeleNumRefTicket // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index fb24e2782c9..035a99fe744 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -159,7 +159,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $conf->global->USER_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories @@ -199,7 +199,7 @@ class doc_generic_user_odt extends ModelePDFUser // Add input to upload a new template file. $texte .= '
'.$langs->trans("UploadNewTemplate").' '; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= '
'; $texte .= ''; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 45a9469753e..04d9957458b 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -162,7 +162,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $conf->global->USERGROUP_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/core/modules/workstation/mod_workstation_advanced.php b/htdocs/core/modules/workstation/mod_workstation_advanced.php index 4e23219581c..bf783542c75 100755 --- a/htdocs/core/modules/workstation/mod_workstation_advanced.php +++ b/htdocs/core/modules/workstation/mod_workstation_advanced.php @@ -80,7 +80,7 @@ class mod_workstation_advanced extends ModeleNumRefWorkstation // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 12ee32a496f..cd24a3a881a 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -190,13 +190,13 @@ if (!function_exists('ftp_connect')) { print ''; print ''.$langs->trans("User").''; - print ''; + print ''; print 'myftplogin'; print ''; print ''; print ''.$langs->trans("Password").''; - print ''; + print ''; print 'myftppassword'; print ''; diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php index 14c3b334ee1..48efbfbc8eb 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_advanced.php @@ -79,7 +79,7 @@ class mod_knowledgerecord_advanced extends ModeleNumRefKnowledgeRecord // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 3e389c1757f..d64c80c9355 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -157,7 +157,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $texte .= $conf->global->MYMODULE_MYOBJECT_ADDON_PDF_ODT_PATH; $texte .= ''; $texte .= '
'; - $texte .= ''; + $texte .= ''; $texte .= '
'; // Scan directories diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php index 9c685e65d9a..72b46b96416 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_advanced.php @@ -79,7 +79,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index 1c7a98739d7..ff5198c006a 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -1007,7 +1007,7 @@ if (empty($testligneamodifier)) { print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; for ($i = 0; $i < $nbcolonnes; $i++) { diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index 0b293d19a35..a536bb59600 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -79,7 +79,7 @@ class mod_partnership_advanced extends ModeleNumRefPartnership // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index fdd42bd34d7..d90ea7090f7 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -213,17 +213,17 @@ if ($action == 'create_variable' || $action == 'edit_variable') { //Code print ''; print ''.$langs->trans("Variable").''; - print ''; + print ''; print ''; //Description print ''; print ''.$langs->trans("Description").''; - print ''; + print ''; print ''; //Value print ''; print ''.$langs->trans("Value").''; - print ''; + print ''; print ''; print ''; @@ -310,7 +310,7 @@ if ($action == 'create_updater' || $action == 'edit_updater') { //Description print ''; print ''.$langs->trans("Description").''; - print ''; + print ''; print ''; //Type print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c3c91b40537..170853b9c2b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1117,7 +1117,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK; $inherited_mask_sn = $conf->global->SN_ADVANCED_MASK; print ''; - print $form->textwithpicto('', $tooltip, 1, 1); + print $form->textwithpicto('', $tooltip, 1, 1); print ''."\n"; } if (!GETPOSTISSET("no_email") && !empty($object->email)) { - $result=$object->getNoEmail(); - if ($result<0) { + $result = $object->getNoEmail(); + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } print ''; print ''; - print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1)).''; + print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == -1)).''; print ''; } @@ -1078,8 +1078,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''."\n"; } if (!GETPOSTISSET("no_email") && !empty($object->email)) { - $result=$object->getNoEmail(); - if ($result<0) { + $result = $object->getNoEmail(); + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1313,8 +1313,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Unsubscribe opt-out if (!empty($conf->mailing->enabled)) { - $result=$object->getNoEmail(); - if ($result<0) { + $result = $object->getNoEmail(); + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } print ''.$langs->trans("No_Email").''.yn($object->no_email).''; diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php index 5b17c335f3f..f2e2170a1b8 100644 --- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php +++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php @@ -89,7 +89,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes $data = array(); $totalnb = 0; $sql = "SELECT COUNT(t.datec) as nb"; - $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; $sql .= " WHERE CAST(t.datec AS DATE) = CURRENT_DATE"; $sql .= " AND t.fk_statut <> 8"; $sql .= " GROUP BY CAST(t.datec AS DATE)"; @@ -107,7 +107,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes dol_print_error($this->db); } $sql = "SELECT COUNT(t.date_close) as nb"; - $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; $sql .= " WHERE CAST(t.date_close AS DATE) = CURRENT_DATE"; $sql .= " AND t.fk_statut = 8"; $sql .= " GROUP BY CAST(t.date_close AS DATE)"; @@ -148,7 +148,7 @@ class box_graph_new_vs_close_ticket extends ModeleBoxes $stringtoprint .= $px1->show($totalnb ? 0 : 1); } $stringtoprint .= ''; - $this->info_box_contents[][]=array( + $this->info_box_contents[][] = array( 'td' => 'class="center"', 'text' => $stringtoprint ); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index c328d659b93..3838829f8cd 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -508,16 +508,16 @@ function getNumberInvoicesPieChart($mode) while ($i < $num) { $obj = $db->fetch_object($resql); - $dataseries = array(array($langs->trans('InvoiceLate30Days'),$obj->nblate30) - ,array($langs->trans('InvoiceLate15Days'),$obj->nblate15-$obj->nblate30) - ,array($langs->trans('InvoiceLateMinus15Days'),$obj->nblatenow-$obj->nblate15) - ,array($langs->trans('InvoiceNotLate'),$obj->nbnotlatenow-$obj->nbnotlate15) - ,array($langs->trans('InvoiceNotLate15Days'),$obj->nbnotlate15-$obj->nbnotlate30) - ,array($langs->trans('InvoiceNotLate30Days'),$obj->nbnotlate30)); + $dataseries = array(array($langs->trans('InvoiceLate30Days'), $obj->nblate30) + ,array($langs->trans('InvoiceLate15Days'), $obj->nblate15 - $obj->nblate30) + ,array($langs->trans('InvoiceLateMinus15Days'), $obj->nblatenow - $obj->nblate15) + ,array($langs->trans('InvoiceNotLate'), $obj->nbnotlatenow - $obj->nbnotlate15) + ,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30) + ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30)); $i++; } foreach ($dataseries as $key=>$value) { - $total+=$value[1]; + $total += $value[1]; } $colorseries = array($badgeStatus8, $badgeStatus1, $badgeStatus3, $badgeStatus4, $badgeStatus11, '-'.$badgeStatus11); @@ -615,7 +615,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; $sql .= " cc.rowid, cc.code"; if (!$user->rights->societe->client->voir && !$socid) { - $sql.= ", sc.fk_soc, sc.fk_user"; + $sql .= ", sc.fk_soc, sc.fk_user"; } // Add Group from hooks diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f5840712807..0c825672f65 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -714,7 +714,7 @@ class FactureFournisseur extends CommonInvoice $this->remise = $obj->remise; $this->close_code = $obj->close_code; $this->close_note = $obj->close_note; - $this->tva = $obj->tva; + $this->tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; $this->total_ht = $obj->total_ht; @@ -729,7 +729,7 @@ class FactureFournisseur extends CommonInvoice $this->fk_project = $obj->fk_project; $this->cond_reglement_id = $obj->fk_cond_reglement; $this->cond_reglement_code = $obj->cond_reglement_code; - $this->cond_reglement = $obj->cond_reglement_label; // deprecated + $this->cond_reglement = $obj->cond_reglement_label; // deprecated $this->cond_reglement_label = $obj->cond_reglement_label; $this->cond_reglement_doc = $obj->cond_reglement_doc; $this->fk_account = $obj->fk_account; @@ -3234,8 +3234,8 @@ class SupplierInvoiceLine extends CommonObjectLine $this->ref_supplier = $obj->ref_supplier; $this->product_desc = $obj->product_desc; - $this->subprice = $obj->pu_ht; - $this->pu_ht = $obj->pu_ht; + $this->subprice = $obj->pu_ht; + $this->pu_ht = $obj->pu_ht; $this->pu_ttc = $obj->pu_ttc; $this->tva_tx = $obj->tva_tx; $this->localtax1_tx = $obj->localtax1_tx; @@ -3245,7 +3245,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->qty = $obj->qty; $this->remise_percent = $obj->remise_percent; - $this->fk_remise_except = $obj->fk_remise_except; + $this->fk_remise_except = $obj->fk_remise_except; $this->tva = $obj->total_tva; // deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; @@ -3401,8 +3401,8 @@ class SupplierInvoiceLine extends CommonObjectLine $sql .= ", pu_ttc = ".price2num($this->pu_ttc); $sql .= ", qty = ".price2num($this->qty); $sql .= ", remise_percent = ".price2num($this->remise_percent); - if ($this->fk_remise_except) $sql.= ", fk_remise_except=".((int) $this->fk_remise_except); - else $sql.= ", fk_remise_except=null"; + if ($this->fk_remise_except) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); + else $sql .= ", fk_remise_except=null"; $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; $sql .= ", tva_tx = ".price2num($this->tva_tx); $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); @@ -3633,7 +3633,7 @@ class SupplierInvoiceLine extends CommonObjectLine if ($discount->fk_facture_line > 0) { if (empty($noerrorifdiscountalreadylinked)) { $this->error = $langs->trans("ErrorDiscountAlreadyUsed", $discount->id); - dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } @@ -3641,20 +3641,20 @@ class SupplierInvoiceLine extends CommonObjectLine $result = $discount->link_to_invoice($this->rowid, 0); if ($result < 0) { $this->error = $discount->error; - dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } } } else { $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); - dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } } else { $this->error = $discount->error; - dol_syslog(get_class($this) . "::insert Error " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 4005be154a1..25567b137db 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -134,8 +134,8 @@ print ''; if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR == 'member') { print ''.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; print ''; - $dnbdays = '15'; - $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; + $dnbdays = '15'; + $backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; print ''; print ''; print ''.$dnbdays.''; @@ -164,7 +164,7 @@ print ''; print ''.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").''; print ''; -$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK); +$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK); print ''; print ''; print 'dolibarr.org|dolibarr.fr|dolibarr.es'; diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 7cf01c2957c..0588b9e5df2 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -37,9 +37,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; */ class PartnershipUtils { - public $db; //!< To store db handler - public $error; //!< To return error code (or message) - public $errors=array(); //!< To return several error codes (or messages) + public $db; //!< To store db handler + public $error; //!< To return error code (or message) + public $errors = array(); //!< To return several error codes (or messages) /** @@ -71,19 +71,19 @@ class PartnershipUtils } $partnership = new Partnership($this->db); - $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call + $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call $langs->loadLangs(array("partnership", "member")); - $error = 0; - $erroremail = ''; - $this->output = ''; - $this->error = ''; + $error = 0; + $erroremail = ''; + $this->output = ''; + $this->error = ''; $partnershipsprocessed = array(); - $gracedelay=$conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL; + $gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL; if ($gracedelay < 1) { - $this->error='BadValueForDelayBeforeCancelCheckSetup'; + $this->error = 'BadValueForDelayBeforeCancelCheckSetup'; return -1; } @@ -116,7 +116,7 @@ class PartnershipUtils $obj = $this->db->fetch_object($resql); if ($obj) { - if (! empty($partnershipsprocessed[$obj->rowid])) continue; + if (!empty($partnershipsprocessed[$obj->rowid])) continue; if ($somethingdoneonpartnership >= $MAXPERCALL) { dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING); @@ -142,7 +142,7 @@ class PartnershipUtils else $this->errors = $object->errors; } } else { - $partnershipsprocessed[$object->id]=$object->ref; + $partnershipsprocessed[$object->id] = $object->ref; // Send an email to inform member $labeltemplate = '(SendingEmailOnPartnershipCanceled)'; @@ -152,21 +152,21 @@ class PartnershipUtils // Send deployment email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $formmail=new FormMail($this->db); + $formmail = new FormMail($this->db); // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); - $outputlangs->loadLangs(array('main','member','partnership')); + $outputlangs->loadLangs(array('main', 'member', 'partnership')); } - $arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate); + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate); - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); @@ -179,7 +179,7 @@ class PartnershipUtils $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); $result = $cmail->sendfile(); - if (! $result || $cmail->error) { + if (!$result || $cmail->error) { $erroremail .= ($erroremail ? ', ' : '').$cmail->error; $this->errors[] = $cmail->error; if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; @@ -193,18 +193,18 @@ class PartnershipUtils $this->error = $this->db->lasterror(); } - if (! $error) { + if (!$error) { $this->db->commit(); $this->output = $numofexpiredmembers.' expired partnership members found'."\n"; - if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail; + if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; } else { $this->db->rollback(); $this->output = "Rollback after error\n"; - $this->output.= $numofexpiredmembers.' expired partnership members found'."\n"; - if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail; + $this->output .= $numofexpiredmembers.' expired partnership members found'."\n"; + if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; } - return ($error ? 1: 0); + return ($error ? 1 : 0); } @@ -222,19 +222,19 @@ class PartnershipUtils $managedfor = $conf->global->PARTNERSHIP_IS_MANAGED_FOR; $partnership = new Partnership($this->db); - $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call + $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call $langs->loadLangs(array("partnership", "member")); - $error = 0; - $erroremail = ''; - $this->output = ''; - $this->error = ''; + $error = 0; + $erroremail = ''; + $this->output = ''; + $this->error = ''; $partnershipsprocessed = array(); - $gracedelay=$conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL; + $gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL; if ($gracedelay < 1) { - $this->error='BadValueForDelayBeforeCancelCheckSetup'; + $this->error = 'BadValueForDelayBeforeCancelCheckSetup'; return -1; } @@ -269,16 +269,16 @@ class PartnershipUtils $resql = $this->db->query($sql); if ($resql) { - $numofexpiredmembers = $this->db->num_rows($resql); + $numofexpiredmembers = $this->db->num_rows($resql); $somethingdoneonpartnership = 0; - $ifetchpartner = 0; + $ifetchpartner = 0; $websitenotfound = ''; while ($ifetchpartner < $numofexpiredmembers) { $ifetchpartner++; $obj = $this->db->fetch_object($resql); if ($obj) { - if (! empty($partnershipsprocessed[$obj->rowid])) continue; + if (!empty($partnershipsprocessed[$obj->rowid])) continue; if ($somethingdoneonpartnership >= $MAXPERCALL) { dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING); @@ -318,21 +318,21 @@ class PartnershipUtils // Send deployment email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $formmail=new FormMail($this->db); + $formmail = new FormMail($this->db); // Define output language $outputlangs = $langs; $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); - $outputlangs->loadLangs(array('main','member','partnership')); + $outputlangs->loadLangs(array('main', 'member', 'partnership')); } - $arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate); + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate); - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs); @@ -343,7 +343,7 @@ class PartnershipUtils $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); $result = $cmail->sendfile(); - if (! $result || $cmail->error) { + if (!$result || $cmail->error) { $erroremail .= ($erroremail ? ', ' : '').$cmail->error; $this->errors[] = $cmail->error; if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; @@ -360,7 +360,7 @@ class PartnershipUtils $object->reason_decline_or_cancel = ''; } - $partnershipsprocessed[$object->id]=$object->ref; + $partnershipsprocessed[$object->id] = $object->ref; $object->last_check_backlink = $this->db->idate($now); @@ -372,22 +372,22 @@ class PartnershipUtils $this->error = $this->db->lasterror(); } - if (! $error) { + if (!$error) { $this->db->commit(); $this->output = $numofexpiredmembers.' partnership checked'."\n"; - if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\n"; - if ($emailnotfound) $this->output.='. Email not found for some partner : '.$emailnotfound."\n"; - if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n"; + if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; + if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; + if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; } else { $this->db->rollback(); $this->output = "Rollback after error\n"; - $this->output.= $numofexpiredmembers.' partnership checked'."\n"; - if ($erroremail) $this->output.='. Got errors when sending some email : '.$erroremail."\n"; - if ($emailnotfound) $this->output.='. Email not found for some partner : '.$emailnotfound."\n"; - if ($websitenotfound) $this->output.='. Website not found for some partner : '.$websitenotfound."\n"; + $this->output .= $numofexpiredmembers.' partnership checked'."\n"; + if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; + if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; + if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; } - return ($error ? 1: 0); + return ($error ? 1 : 0); } /** diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index c8bb93ccb7d..79f51be6ca9 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -82,7 +82,7 @@ if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = ''; // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. + reset($object->fields); // Reset is required to avoid key() to return null. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. } if (!$sortorder) { @@ -136,8 +136,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; +$permissiontoread = $user->rights->partnership->read; +$permissiontoadd = $user->rights->partnership->write; $permissiontodelete = $user->rights->partnership->delete; // Security check @@ -305,13 +305,13 @@ foreach ($search as $key => $val) { } } else { if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { if (preg_match('/_dtstart$/', $key)) { - $sql .= " AND t." . $columnName . " >= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'"; } if (preg_match('/_dtend$/', $key)) { - $sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'"; + $sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'"; } } } @@ -538,7 +538,7 @@ foreach ($object->fields as $key => $val) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); - } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { + } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1); } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print ''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 170853b9c2b..1b04a77083c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -315,11 +315,11 @@ if (empty($reshook)) { $object->type = $type; $object->status = GETPOST('statut'); - $object->status_buy = GETPOST('statut_buy'); + $object->status_buy = GETPOST('statut_buy'); $object->status_batch = GETPOST('status_batch'); $object->batch_mask = GETPOST('batch_mask'); - $object->barcode_type = GETPOST('fk_barcode_type'); + $object->barcode_type = GETPOST('fk_barcode_type'); $object->barcode = GETPOST('barcode'); // Set barcode_type_xxx from barcode_type id $stdobject = new GenericObject($db); @@ -1620,10 +1620,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $tooltip .= $langs->trans("GenericMaskCodes5"); print ''.$langs->trans("ManageLotMask").''; if ($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') { - $mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK; + $mask = !empty($object->batch_mask) ? $object->batch_mask : $conf->global->LOT_ADVANCED_MASK; } if ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced') { - $mask = ! empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK; + $mask = !empty($object->batch_mask) ? $object->batch_mask : $conf->global->SN_ADVANCED_MASK; } $inherited_mask_lot = $conf->global->LOT_ADVANCED_MASK; $inherited_mask_sn = $conf->global->SN_ADVANCED_MASK; @@ -2011,7 +2011,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $formbarcode = new FormBarCode($db); } - $fk_barcode_type=''; + $fk_barcode_type = ''; if ($action == 'editbarcodetype') { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); $fk_barcode_type = $object->barcode_type; @@ -2057,7 +2057,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0, 2); print ''; - if ((($object->status_batch == '1' &&$conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') + if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced') || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) { print ''.$langs->trans("ManageLotMask").''; print $object->batch_mask; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 55ab129edee..876ced9892c 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -169,7 +169,7 @@ if (empty($reshook)) { // Modification entrepot if ($action == 'update' && !$cancel) { if ($object->fetch($id)) { - $object->label = GETPOST("libelle"); + $object->label = GETPOST("libelle"); $object->fk_parent = GETPOST("fk_parent"); $object->fk_project = GETPOST('projectid'); $object->description = GETPOST("desc"); @@ -179,8 +179,8 @@ if (empty($reshook)) { $object->zip = GETPOST("zipcode"); $object->town = GETPOST("town"); $object->country_id = GETPOST("country_id"); - $object->phone = GETPOST("phone"); - $object->fax = GETPOST("fax"); + $object->phone = GETPOST("phone"); + $object->fax = GETPOST("fax"); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); @@ -648,7 +648,7 @@ if ($action == 'create') { $sql .= " AND ps.fk_entrepot = ".((int) $object->id); if ($separatedPMP) { - $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity; + $sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity; } $sql .= $db->order($sortfield, $sortorder); diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 8b0c774cc6a..28cf3f821cf 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -28,7 +28,9 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +if (!empty($conf->accounting->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +} // Load translation files required by the page $langs->loadLangs(array("compta", "salaries", "bills", "hrm")); @@ -52,8 +54,12 @@ if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST( $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "s.datep,s.rowid"; -if (!$sortorder) $sortorder = "DESC,DESC"; +if (!$sortfield) { + $sortfield = "s.datep,s.rowid"; +} +if (!$sortorder) { + $sortorder = "DESC,DESC"; +} // Initialize technical objects $object = new PaymentSalary($db); @@ -66,8 +72,12 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); -if (!$sortfield) $sortfield = "s.datep,s.rowid"; -if (!$sortorder) $sortorder = "DESC,DESC"; +if (!$sortfield) { + $sortfield = "s.datep,s.rowid"; +} +if (!$sortorder) { + $sortorder = "DESC,DESC"; +} $search_ref = GETPOST('search_ref', 'int'); $search_ref_salary = GETPOST('search_ref_salary', 'int'); @@ -89,7 +99,9 @@ if (!GETPOST('search_type_id', 'int')) { $filterarray = explode('-', $newfiltre); foreach ($filterarray as $val) { $part = explode(':', $val); - if ($part[0] == 's.fk_typepayment') $search_type_id = $part[1]; + if ($part[0] == 's.fk_typepayment') { + $search_type_id = $part[1]; + } } } else { $search_type_id = GETPOST('search_type_id', 'int'); @@ -133,7 +145,9 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} if (empty($reshook)) { // Selection of new fields @@ -203,21 +217,47 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.ro $sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = sal.fk_user"; $sql .= " AND s.entity IN (".getEntity('payment_salaries').")"; -if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")"; +if (empty($user->rights->salaries->readall)) { + $sql .= " AND s.fk_user IN (".$db->sanitize(join(',', $childids)).")"; +} // Search criteria -if ($search_ref) $sql .= " AND s.rowid=".((int) $search_ref); -if ($search_ref_salary) $sql .= " AND sal.rowid=".((int) $search_ref_salary); -if ($search_user) $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); -if ($search_label) $sql .= natural_search(array('sal.label'), $search_label); -if ($search_date_start) $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'"; -if ($search_date_end) $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'"; -if ($search_dateep_start) $sql .= " AND sal.dateep >= '".$db->idate($search_dateep_start)."'"; -if ($search_dateep_end) $sql .= " AND sal.dateep <= '".$db->idate($search_dateep_end)."'"; -if ($search_amount) $sql .= natural_search("s.amount", $search_amount, 1); -if ($search_account > 0) $sql .= " AND b.fk_account=".((int) $search_account); -if ($search_fk_bank) $sql .= " AND s.fk_bank=".((int) $search_fk_bank); -if ($search_chq_number) $sql .= natural_search(array('s.num_payment'), $search_chq_number); +if ($search_ref) { + $sql .= " AND s.rowid=".((int) $search_ref); +} +if ($search_ref_salary) { + $sql .= " AND sal.rowid=".((int) $search_ref_salary); +} +if ($search_user) { + $sql .= natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); +} +if ($search_label) { + $sql .= natural_search(array('sal.label'), $search_label); +} +if ($search_date_start) { + $sql .= " AND s.datep >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND s.datep <= '".$db->idate($search_date_end)."'"; +} +if ($search_dateep_start) { + $sql .= " AND sal.dateep >= '".$db->idate($search_dateep_start)."'"; +} +if ($search_dateep_end) { + $sql .= " AND sal.dateep <= '".$db->idate($search_dateep_end)."'"; +} +if ($search_amount) { + $sql .= natural_search("s.amount", $search_amount, 1); +} +if ($search_account > 0) { + $sql .= " AND b.fk_account=".((int) $search_account); +} +if ($search_fk_bank) { + $sql .= " AND s.fk_bank=".((int) $search_fk_bank); +} +if ($search_chq_number) { + $sql .= natural_search(array('s.num_payment'), $search_chq_number); +} if ($search_type_id > 0) { $sql .= " AND s.fk_typepayment=".((int) $search_type_id); @@ -238,7 +278,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; } else { - if ($limit) $sql .= $db->plimit($limit + 1, $offset); + if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); + } $resql = $db->query($sql); if (!$resql) { @@ -257,21 +299,51 @@ llxHeader('', $title, $help_url); $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -if ($search_type_id) $param .= '&search_type_id='.urlencode($search_type_id); -if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); -if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); -if ($search_ref_salary) $param .= '&search_ref_salary='.urlencode($search_ref_salary); -if ($search_user) $param .= '&search_user='.urlencode($search_user); -if ($search_label) $param .= '&search_label='.urlencode($search_label); -if ($search_fk_bank) $param .= '&search_fk_bank='.urlencode($search_fk_bank); -if ($search_chq_number) $param .= '&search_chq_number='.urlencode($search_chq_number); -if ($search_account) $param .= '&search_account='.urlencode($search_account); -if ($search_date_start) $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int')); -if ($search_dateep_start) $param .= '&search_dateep_startday='.urlencode(GETPOST('search_dateep_startday', 'int')).'&search_dateep_startmonth='.urlencode(GETPOST('search_dateep_startmonth', 'int')).'&search_dateep_startyear='.urlencode(GETPOST('search_dateep_startyear', 'int')); -if ($search_date_end) $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int')); -if ($search_dateep_end) $param .= '&search_dateep_endday='.urlencode(GETPOST('search_dateep_endday', 'int')).'&search_dateep_endmonth='.urlencode(GETPOST('search_dateep_endmonth', 'int')).'&search_dateep_endyear='.urlencode(GETPOST('search_dateep_endyear', 'int')); +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +if ($search_type_id) { + $param .= '&search_type_id='.urlencode($search_type_id); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_ref_salary) { + $param .= '&search_ref_salary='.urlencode($search_ref_salary); +} +if ($search_user) { + $param .= '&search_user='.urlencode($search_user); +} +if ($search_label) { + $param .= '&search_label='.urlencode($search_label); +} +if ($search_fk_bank) { + $param .= '&search_fk_bank='.urlencode($search_fk_bank); +} +if ($search_chq_number) { + $param .= '&search_chq_number='.urlencode($search_chq_number); +} +if ($search_account) { + $param .= '&search_account='.urlencode($search_account); +} +if ($search_date_start) { + $param .= '&search_date_startday='.urlencode(GETPOST('search_date_startday', 'int')).'&search_date_startmonth='.urlencode(GETPOST('search_date_startmonth', 'int')).'&search_date_startyear='.urlencode(GETPOST('search_date_startyear', 'int')); +} +if ($search_dateep_start) { + $param .= '&search_dateep_startday='.urlencode(GETPOST('search_dateep_startday', 'int')).'&search_dateep_startmonth='.urlencode(GETPOST('search_dateep_startmonth', 'int')).'&search_dateep_startyear='.urlencode(GETPOST('search_dateep_startyear', 'int')); +} +if ($search_date_end) { + $param .= '&search_date_endday='.urlencode(GETPOST('search_date_endday', 'int')).'&search_date_endmonth='.urlencode(GETPOST('search_date_endmonth', 'int')).'&search_date_endyear='.urlencode(GETPOST('search_date_endyear', 'int')); +} +if ($search_dateep_end) { + $param .= '&search_dateep_endday='.urlencode(GETPOST('search_dateep_endday', 'int')).'&search_dateep_endmonth='.urlencode(GETPOST('search_dateep_endmonth', 'int')).'&search_dateep_endyear='.urlencode(GETPOST('search_dateep_endyear', 'int')); +} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -281,11 +353,15 @@ $arrayofmassactions = array( //'buildsepa'=>$langs->trans("BuildSepa"), // TODO ); //if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); -if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); +} $massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '
'; -if ($optioncss != '') print ''; +if ($optioncss != '') { + print ''; +} print ''; print ''; print ''; @@ -294,7 +370,9 @@ print ''; print ''; $url = DOL_URL_ROOT.'/salaries/card.php?action=create'; -if (!empty($socid)) $url .= '&socid='.$socid; +if (!empty($socid)) { + $url .= '&socid='.$socid; +} $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->salaries->write); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -413,7 +491,10 @@ print ''."\n"; $needToFetchEachLine = 0; if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { - if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + if (preg_match('/\$object/', $val)) { + $needToFetchEachLine++; + } + // There is at least one compute field that use $object } } @@ -424,7 +505,10 @@ $total = 0; $totalarray = array(); while ($i < ($limit ? min($num, $limit) : $num)) { $obj = $db->fetch_object($resql); - if (empty($obj)) break; // Should not happen + if (empty($obj)) { + break; + } + // Should not happen // Store properties in $object $object->setVarsFromFetchObj($obj); @@ -449,22 +533,32 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Ref print "".$paymentsalstatic->getNomUrl(1)."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } print "".$salstatic->getNomUrl(1)."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Label payment print "".dol_trunc($obj->label, 40)."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Date end period print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Date payment print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Date value /*print ''.dol_print_date($db->jdate($obj->datev), 'day')."\n"; @@ -472,15 +566,21 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Employee print "".$userstatic->getNomUrl(1)."\n"; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Chq number print ''.$obj->num_payment.''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } // Account if (!empty($conf->banque->enabled)) { @@ -489,7 +589,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $accountlinestatic->id = $obj->fk_bank; print $accountlinestatic->getNomUrl(1); print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } print ''; if ($obj->fk_bank > 0) { @@ -514,15 +616,23 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($accountstatic->id > 0) { print $accountstatic->getNomUrl(1); } - } else print ' '; + } else { + print ' '; + } print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } // Amount print ''.price($obj->amount).''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'totalttcfield'; + } $totalarray['val']['totalttcfield'] += $obj->amount; // Extra fields @@ -535,11 +645,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) $selected = 1; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } print ''; } print ''; - if (!$i) $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } print ''."\n"; @@ -553,7 +667,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; // If no record found if ($num == 0) { $colspan = 1; - foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { + $colspan++; + } + } print ''.$langs->trans("NoRecordFound").''; } diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index 912307a5675..9cb065d2c3b 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("companies","partnership", "other")); +$langs->loadLangs(array("companies", "partnership", "other")); // Get parameters $id = GETPOST('id', 'int'); @@ -82,19 +82,27 @@ foreach ($object->fields as $key => $val) { // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontoread = $user->rights->partnership->read; +$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php -$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; +$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; -if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') accessforbidden(); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($action == 'edit' && empty($permissiontoadd)) accessforbidden(); +if (!empty($conf->global->PARTNERSHIP_IS_MANAGED_FOR) && $conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'thirdparty') { + accessforbidden(); +} +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($action == 'edit' && empty($permissiontoadd)) { + accessforbidden(); +} if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) { accessforbidden(); @@ -128,7 +136,9 @@ if (empty($reshook)) { } $object->fields['fk_soc']['visible'] = 0; -if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1; +if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) { + $object->fields['reason_decline_or_cancel']['visible'] = 1; +} $object->fields['note_public']['visible'] = 1; From afa1e117c5a371003b32271b4d7286f100e7e4e5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 14 Jun 2021 13:37:39 +0000 Subject: [PATCH 417/739] Fixing style errors. --- htdocs/salaries/payments.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index 28cf3f821cf..bfc795ebcef 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -550,9 +550,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Date end period print ''.dol_print_date($db->jdate($obj->dateep), 'day')."\n"; - if (!$i) { - $totalarray['nbfield']++; - } + if (!$i) { + $totalarray['nbfield']++; + } // Date payment print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; @@ -668,7 +668,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; if ($num == 0) { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - $colspan++; + $colspan++; } } print ''.$langs->trans("NoRecordFound").''; From 33553f33476efd363b93cf6c5257943b560b59a0 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 14 Jun 2021 17:01:59 +0200 Subject: [PATCH 418/739] FIX : same thing on supplier orders --- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 1b85082616a..1e5ed8c724c 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -65,7 +65,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?> - getLibStatut(3); ?> + getLibStatut(3, $objectlink->getSommePaiement()); ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> Date: Mon, 14 Jun 2021 17:08:16 +0200 Subject: [PATCH 419/739] FIX : method exists --- htdocs/compta/facture/tpl/linkedobjectblock.tpl.php | 5 ++++- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 1e18eb6bfeb..1b81446c243 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -85,7 +85,10 @@ foreach ($linkedObjectBlock as $key => $objectlink) } } print ''; - print ''.$objectlink->getLibStatut(3, $objectlink->getSommePaiement()).''; + print ''; + if(method_exists($objectlink, 'getSommePaiement')) print $objectlink->getLibStatut(3, $objectlink->getSommePaiement()); + else print $objectlink->getLibStatut(3); + print ''; print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 1e5ed8c724c..5bb6e45a8c8 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -65,7 +65,10 @@ foreach ($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?> - getLibStatut(3, $objectlink->getSommePaiement()); ?> + getLibStatut(3, $objectlink->getSommePaiement()); + else echo $objectlink->getLibStatut(3); + ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> Date: Mon, 14 Jun 2021 15:10:24 +0000 Subject: [PATCH 420/739] Fixing style errors. --- htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 5bb6e45a8c8..20969cddf22 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -66,9 +66,9 @@ foreach ($linkedObjectBlock as $key => $objectlink) } } ?> getLibStatut(3, $objectlink->getSommePaiement()); + if(method_exists($objectlink, 'getSommePaiement')) echo $objectlink->getLibStatut(3, $objectlink->getSommePaiement()); else echo $objectlink->getLibStatut(3); - ?> + ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> Date: Mon, 14 Jun 2021 18:45:02 +0200 Subject: [PATCH 421/739] Clean code --- htdocs/admin/user.php | 1 + htdocs/fourn/commande/card.php | 31 +++++++++++++++++++++++-------- htdocs/fourn/commande/list.php | 5 +++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 83649d46a28..6d8cfe21f00 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -109,6 +109,7 @@ if ($action == 'set_default') { } } + /* * View */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 44a712969c1..6e89abbf953 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -66,6 +66,11 @@ $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'purchaseordercard'; // To manage different context of search + +$backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); + $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); $cancel = GETPOST('cancel', 'alpha'); @@ -151,12 +156,16 @@ if ($reshook < 0) { } if (empty($reshook)) { - if ($cancel) { - if (!empty($backtopage)) { - header("Location: ".$backtopage); - exit; + $backurlforlist = DOL_URL_ROOT.'/fourn/commande/list.php'.($socid > 0 ? '&socid='.((int) $socid) : ''); + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/fourn/commande/card.php?id='.($id > 0 ? $id : '__ID__'); + } } - $action = ''; } include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once @@ -1573,10 +1582,16 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''."\n"; print ''; print ''; print ''; + if ($backtopage) { + print ''; + } + if ($backtopageforcancel) { + print ''; + } + if (!empty($currency_tx)) { print ''; } @@ -1592,9 +1607,9 @@ if ($action == 'create') { print ''.$langs->trans('Supplier').''; print ''; - if ($socid > 0) { + if ($societe->id > 0) { print $societe->getNomUrl(1); - print ''; + print ''; } else { print img_picto('', 'company').$form->select_company((empty($socid) ? '' : $socid), 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 25f71f85eb4..c644f9e35a5 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -892,8 +892,9 @@ if ($resql) { $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $url = DOL_URL_ROOT.'/fourn/commande/card.php?action=create'; - if (!empty($socid)) { - $url .= '&socid='.$socid; + if ($socid > 0) { + $url .= '&socid='.((int) $socid); + $url .= '&backtopage='.urlencode(DOL_URL_ROOT.'/fourn/commande/list.php?socid='.((int) $socid)); } $newcardbutton = dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer)); From a79afeaf02fe23c0e8d2c9c46c2a45248dabff7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 19:58:12 +0200 Subject: [PATCH 422/739] Add info to allow debug of email collector --- .../class/emailcollector.class.php | 2 +- htdocs/langs/en_US/main.lang | 1 + htdocs/projet/class/project.class.php | 1 + htdocs/projet/list.php | 18 +++++++++++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index b01f1883d53..ec5e33d8bb3 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1539,7 +1539,7 @@ class EmailCollector extends CommonObject // Make Operation dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id); - dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); + dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object $actioncode = 'EMAIL_IN'; // If we scan the Sent box, we use the code for out email diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 39517ca2e1b..86c38e39b8b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1117,3 +1117,4 @@ UpdateForAllLines=Update for all lines OnHold=On hold Civility=Civility InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. +EmailMsgID=Email MsgID diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c6e9799afa7..54e0f87a358 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -206,6 +206,7 @@ class Project extends CommonObject 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModification', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>220), + 'email_msgid'=>array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'enabled'=>1, 'visible'=>-1, 'position'=>250, 'help'=>'EmailMsgIDWhenSourceisEmail'), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500) ); // END MODULEBUILDER PROPERTIES diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 4438a9ce217..96c960e58d1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -25,7 +25,7 @@ /** * \file htdocs/projet/list.php - * \ingroup projet + * \ingroup project * \brief Page to list projects */ @@ -300,6 +300,7 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; / $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. $sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat"; $sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time"; +$sql .= ", p.email_msgid"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; $sql .= ", cls.code as opp_status_code"; // Add fields from extrafields @@ -668,6 +669,12 @@ if (!empty($arrayfields['p.tms']['checked'])) print ''; print ''; } +if (!empty($arrayfields['p.email_msgid']['checked'])) +{ + // Email msg id + print ''; + print ''; +} if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; @@ -710,6 +717,7 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); +if (!empty($arrayfields['p.email_msgid']['checked'])) print_liste_field_titre($arrayfields['p.email_msgid']['label'], $_SERVER["PHP_SELF"], "p.email_msgid", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -948,6 +956,14 @@ while ($i < min($num, $limit)) print ''; if (!$i) $totalarray['nbfield']++; } + // Email MsgID + if (!empty($arrayfields['p.email_msgid']['checked'])) + { + print ''; + print $obj->email_msgid; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Status if (!empty($arrayfields['p.fk_statut']['checked'])) { From d154ec2344f67756552f0e35b98595341cea9c36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 20:06:52 +0200 Subject: [PATCH 423/739] FIX Collector to create lead was broken --- htdocs/comm/action/class/actioncomm.class.php | 4 ++++ htdocs/projet/class/project.class.php | 4 +++- htdocs/ticket/class/ticket.class.php | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f7e0ef6acb1..d094fb0bab4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -683,6 +683,10 @@ class ActionComm extends CommonObject { global $langs; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } + $sql = "SELECT a.id,"; $sql .= " a.id as ref,"; $sql .= " a.entity,"; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 54e0f87a358..c5dd1045f03 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -526,7 +526,9 @@ class Project extends CommonObject { global $conf; - if (empty($id) && empty($ref)) return -1; + if (empty($id) && empty($ref) && empty($ref_ext) && empty($email_msgid)) { + return -1; + } $sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,"; $sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5f95c7f0dc5..20d63cea600 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -529,7 +529,7 @@ class Ticket extends CommonObject global $langs; // Check parameters - if (!$id && !$track_id && !$ref && !$email_msgid) { + if (empty($id) && empty($ref) && empty($track_id) && empty($email_msgid)) { $this->error = 'ErrorWrongParameters'; dol_print_error(get_class($this)."::fetch ".$this->error); return -1; From 7e7800c1103967fa119f4846bcf2d5503798cb5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 14 Jun 2021 20:37:21 +0200 Subject: [PATCH 424/739] Fix phpcs --- htdocs/projet/list.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 502f2bed071..cd532ecd048 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1304,8 +1304,7 @@ while ($i < min($num, $limit)) { } } // Email MsgID - if (!empty($arrayfields['p.email_msgid']['checked'])) - { + if (!empty($arrayfields['p.email_msgid']['checked'])) { print ''; print $obj->email_msgid; print ''; From 41549af751b2551480dd02a4581474ea09f05897 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:45:11 +0200 Subject: [PATCH 425/739] Update llx_00_c_country.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Iles Salomon -> Solomon Islands Somalie -> Somalia South Africa Iles Géorgie du Sud et Sandwich du Sud -> South Georgia and the South Sandwich Islands Sri Lanka = Sri Lanka Soudan -> Sudan Suriname = Suriname Iles Svalbard et Jan Mayen -> Svalbard and Jan Mayen Swaziland = Swaziland & new also: Eswatini Syrie -> Syria --- htdocs/install/mysql/data/llx_00_c_country.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index 1e2e8b69c39..6cf703829a5 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -231,16 +231,16 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (19 INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (200,'SL','SLE','Sierra Leone',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (201,'SK','SVK','Slovakia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (202,'SI','SVN','Slovenia',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Iles Salomon',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (203,'SB','SLB','Solomon Islands',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (204,'SO','SOM','Somalia',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (205,'ZA','ZAF','South Africa',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (206,'GS','SGS','Iles Géorgie du Sud et Sandwich du Sud',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (206,'GS','SGS','South Georgia and the South Sandwich Islands ',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (207,'LK','LKA','Sri Lanka',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (208,'SD','SDN','Soudan',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (208,'SD','SDN','Sudan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (209,'SR','SUR','Suriname',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (210,'SJ','SJM','Iles Svalbard et Jan Mayen',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (211,'SZ','SWZ','Swaziland',1,0); -INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (212,'SY','SYR','Syrie',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (210,'SJ','SJM','Svalbard and Jan Mayen',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (211,'SZ','SWZ','Swaziland / Eswatini',1,0); +INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (212,'SY','SYR','Syria',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (213,'TW','TWN','Taïwan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (214,'TJ','TJK','Tadjikistan',1,0); INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (215,'TZ','TZA','Tanzanie',1,0); From 0b4105880e1c3d89c7ad080ea20ec0be305a93f2 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:59:37 +0200 Subject: [PATCH 426/739] Update ChangeLog --- ChangeLog | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 95a4a7a3ae6..5808fbf313f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,19 +16,12 @@ NEW: A lot of fix into english text after a small proofreading campaign (still n NEW: All main menu entries are using the picto of the module NEW: Add a copy to clipboard button on some fields NEW: Add an example of scheduled job to send email reminder for unpaid invoices -NEW: Accountancy - Add FEC import -NEW: Accountancy - Add a confirmation form with options on export -NEW: Accountancy - Add select date from/to in already bind customer and supplier list -NEW: Accountancy - Format FEC - Add new field DateLimitReglmt -NEW: Accountancy - In ledger & journals, show link on bank transaction -NEW: Accountancy - Possibility to filter on journals in balance -NEW: Accountancy - Add a page to list subledger accounts -NEW: add the Channel column into the list of orders NEW: Add a check to avoid an invoice date in the future NEW: Add some color and picto for the direction of movement +NEW: add the column "Channel" into the list of orders NEW: Add the column "alias" of company in the list of proposal, order, invoice NEW: Add the column "Office phone" and "User mobile" in user list -NEW: Add the column "Price level"in thirdparty list +NEW: Add the column "Price level" in thirdparty list NEW: Add some company information in the dropdown login menu NEW: Add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug" NEW: Add contact tag and bulk email status on the thirdparty + contact create form @@ -92,13 +85,22 @@ NEW: When a doc file is shared, link is visible from the main page of doc. NEW: #16378 More E-Mail Contact substitution Values for better salutation NEW: option to keep the "Automatically create a total payment" checkbox empty on the tax creation page + Accountancy +NEW: Accountancy - Add FEC import +NEW: Accountancy - Add a confirmation form with options on export +NEW: Accountancy - Add select date from/to in already bind customer and supplier list +NEW: Accountancy - Format FEC - Add new field DateLimitReglmt +NEW: Accountancy - In ledger & journals, show link on bank transaction +NEW: Accountancy - Possibility to filter on journals in balance +NEW: Accountancy - Add a page to list subledger accounts + ECM/GED -NEW: Add db fields note_public and note_private for ECM module -NEW: Can filter files in GED on status Shared/Not shared +NEW: add DB fields note_public and note_private for ECM module +NEW: Can filter files in ECM/GED on status Shared/Not shared Members NEW: #17292 default subscription amount by adherent type -NEW: Option to automatically create a login/user when a new subscription of a member is done online +NEW: option to automatically create a login/user when a new subscription of a member is done online NEW: option to select membership type on the online payment page for membership subscription or renewal Projects/Tasks @@ -122,17 +124,17 @@ NEW: option for TakePOS to show the total price without tax NEW: more permissions in TakePOS (can edit added line, can modify once order sent to kitchen) Third-Parties -NEW: Can set a Warehouse on a Thirdparty +NEW: can set a warehouse on a Thirdparty Tickets NEW: can use captcha on public page to create a ticket #16347 NEW: can set if a ticket group is visible on public interface or not Warehouse -NEW: Can make massive stock transfers from a CSV file -NEW: Stock movement list - Add more complete date field -NEW: Can set a Warehouse on a Thirdparty +NEW: can make massive stock transfers from a CSV file +NEW: Stock movement list - add more complete date field NEW: can set a warehouse in a proposal +NEW: can set a warehouse on a Thirdparty Website Module NEW: #17113 Can upload a favicon in website module @@ -147,10 +149,10 @@ NEW: start new experimental module Knowledge Management NEW: start new experimental module Workstations Management new Options -NEW: Add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared -NEW: Add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared -NEW: Add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs -NEW: Add option SOCIETE_DISABLE_WORKFORCE to hide staff field +NEW: add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared +NEW: add option SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared +NEW: add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs +NEW: add option SOCIETE_DISABLE_WORKFORCE to hide staff field For developers: @@ -164,10 +166,7 @@ NEW: Add experimental repair script to switch to dynamic row format and utf8mb4 NEW: add form confirm hook on company card NEW: Add function showValueWithClipboardCPButton() to add a copy/paste NEW: Add hook addSectionECMAuto method to add custom diretory into ECM auto files -NEW: Add native compression in rest apis -NEW: Product Variants API, add variant stock to response by parameter NEW: Upgrade Stripe PHP lib to 7.67.0 -NEW: Add link to OpenAPI specifications xml file in REST API module setup: swagger.json file can be included into external tools like redoc NEW: Support sepa_debit in stripe paymentmethods list NEW: Update doleditor.class.php for easily activate SCAYT NEW: Add triggers in the function add_object_linked(), updateObjectLinked() and deleteObjectLinked() @@ -181,8 +180,11 @@ NEW: unit selection on object edit line NEW: #13739 #17390 Product API route added to get product stock and product with or without variants APIs -NEW: API Add option $includeifobjectisused to get a product -NEW: API Get the list of product ids only +NEW: API add option $includeifobjectisused to get a product +NEW: API get the list of product ids only +NEW: add native compression in REST APIs +NEW: Product Variants API, add variant stock to response by parameter +NEW: add link to OpenAPI specifications XML file in REST API module setup: swagger.json file can be included into external tools like redoc WARNING: From 3b9936f7e21934f31b78114171e0b5f6b4602494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 15 Jun 2021 01:18:17 +0200 Subject: [PATCH 427/739] Fix responsive --- htdocs/admin/accountant.php | 8 +++--- htdocs/admin/boxes.php | 2 +- htdocs/admin/company.php | 36 ++++++++++++++----------- htdocs/admin/company_socialnetworks.php | 7 +++-- htdocs/admin/ihm.php | 4 +-- htdocs/admin/menus/index.php | 4 +-- htdocs/admin/security.php | 21 ++++++++++----- htdocs/admin/translation.php | 17 +++--------- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/treeview.lib.php | 7 +++-- htdocs/theme/eldy/global.inc.php | 4 +++ htdocs/theme/md/style.css.php | 4 +++ 12 files changed, 63 insertions(+), 53 deletions(-) diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 56c9605c460..1e924699cd5 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -144,23 +144,23 @@ print ''."\n"; print ''; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; print ''; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Web print ''; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Code diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index ae33ef3b6fa..56971457f76 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -422,7 +422,7 @@ foreach ($boxactivated as $key => $box) { $hasnext = ($key < (count($boxactivated) - 1)); $hasprevious = ($key != 0); print ''.($key + 1).''; - print ''; + print ''; print ($hasnext ? ''.img_down().' ' : ''); print ($hasprevious ? ''.img_up().'' : ''); print ''; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 0c6da346285..804ed9934bf 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -418,7 +418,7 @@ print ''; print img_picto('', 'globe-americas', 'class="paddingrightonly"'); -print $form->select_country($mysoc->country_id, 'country_id'); +print $form->select_country($mysoc->country_id, 'country_id', '', 0); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } @@ -441,25 +441,25 @@ print ''."\n"; // Phone print ''; print img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Fax print ''; print img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Email print ''; print img_picto('', 'object_email', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Web print ''; print img_picto('', 'globe', '', false, 0, 0, '', 'paddingright'); -print ''; +print ''; print ''."\n"; // Barcode @@ -467,19 +467,19 @@ if (!empty($conf->barcode->enabled)) { print ''; print ''; print ''; - print ''; + print ''; print ''; } // Logo print ''; -print '
'; -print ''; +print '
'; +print ''; print '
'; if (!empty($mysoc->logo_small)) { if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { print '
'; - print ''; + print ''; print '
'; } elseif (!empty($mysoc->logo)) { if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { @@ -487,10 +487,12 @@ if (!empty($mysoc->logo_small)) { } $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality); print '
'; - print ''; + print ''; print '
'; } - print ''; + print ''; } elseif (!empty($mysoc->logo)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { print '
'; @@ -508,8 +510,8 @@ print ''; // Logo (squarred) print ''; -print '
'; -print ''; +print '
'; +print ''; print '
'; if (!empty($mysoc->logo_squarred_small)) { if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) { @@ -551,20 +553,21 @@ print ''; print '
'; // IDs of the company (country-specific) +print '
'; print ''; -print ''; +print ''; $langs->load("companies"); // Managing Director(s) print ''; +print ''; // GDPR contact print ''; +print 'global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'">'; // Capital print ''; - - // VAT - print ''; - - // Unit price - print ''; - - // Unit price with tax - print ''; - - // Quantity - print ''; - - //print ''; - //print ''; - - // Picture - print ''; - - print ''; - - print ''; } - $i++; - } - } + $tredited = 'tredited'; + include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; + include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; - // Add a new line - if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) - && $action != 'editline' - && $user->rights->expensereport->creer) { + print ''; + + print ''; + + // Select date + print ''; + + // Select project + if (!empty($conf->projet->enabled)) { + print ''; + } + + // Select type + print ''; + + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { + print ''; + } + + // Add comments + print ''; + + // VAT + print ''; + + // Unit price + print ''; + + // Unit price with tax + print ''; + + // Quantity + print ''; + + //print ''; + //print ''; + + // Picture + print ''; + + print ''; + + print ''; + } + + $i++; + } + } + + // Add a new line + if (($object->status == ExpenseReport::STATUS_DRAFT || $object->status == ExpenseReport::STATUS_REFUSED) + && $action != 'editline' + && $user->rights->expensereport->creer) { $colspan = 11; - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - $colspan++; - } - if (!empty($conf->projet->enabled)) { - $colspan++; - } - if ($action != 'editline') { - $colspan++; - } + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { + $colspan++; + } + if (!empty($conf->projet->enabled)) { + $colspan++; + } + if ($action != 'editline') { + $colspan++; + } $nbFiles = $nbLinks = 0; $arrayoffiles = array(); - if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); - $arrayoffiles = dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$'); - $nbFiles = count($arrayoffiles); - $nbLinks = Link::count($db, $object->element, $object->id); - } + if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); + $arrayoffiles = dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$'); + $nbFiles = count($arrayoffiles); + $nbLinks = Link::count($db, $object->element, $object->id); + } // Add line with link to add new file or attach to an existing file print ''; @@ -2334,11 +2333,11 @@ if ($action == 'create') { print ''.$langs->trans("UploadANewFileNow"); print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; - if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); - print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); - print ''; - } + if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { + print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); + print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); + print ''; + } print ''."\n"; print ''."\n"; print ''; - include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; + include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; print ''; print ''; print ''; - if (!empty($conf->projet->enabled)) { - print ''; - } + if (!empty($conf->projet->enabled)) { + print ''; + } print ''; - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; - } + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { + print ''; + } print ''; print ''; print ''; @@ -2415,23 +2414,23 @@ if ($action == 'create') { print ''; // Select project - if (!empty($conf->projet->enabled)) { - print ''; - } + if (!empty($conf->projet->enabled)) { + print ''; + } // Select type print ''; - if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { - print ''; - } + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { + print ''; + } // Add comments print ''; @@ -2465,15 +2464,15 @@ if ($action == 'create') { // Picture print ''; - if ($action != 'editline') { - print ''; - print ''; - } + if ($action != 'editline') { + print ''; + print ''; + } print ''; print ''; - } // Fin si c'est payé/validé + } // Fin si c'est payé/validé print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'; -print '
'; print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print ''; -print 'global->MAIN_INFO_GDPR) ? $conf->global->MAIN_INFO_GDPR : ''))).'">
'; @@ -656,6 +659,7 @@ print ''; - print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; - //print $line->fk_ecm_files; - print ''; - print ''; - print ''; - print '
'; - print '
'; + print $form->selectDate($line->date, 'date'); + print ''; + $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; + print $formexpensereport->selectTypeExpenseReport($line->fk_c_type_fees, 'fk_c_type_fees'); + print ''; + $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->rowid, 'date' => $line->dates); + print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); + print ''; + print ''; + print ''; + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $line->vatrate), $mysoc, '', 0, 0, '', false, 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''.$langs->trans('AmountHT').''.$langs->trans('AmountTTC').''; + //print $line->fk_ecm_files; + print ''; + print ''; + print ''; + print '
'; + print '
'.$langs->trans('Date').''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''.$langs->trans('Type').''.$langs->trans('CarCategory').''.$langs->trans('CarCategory').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''; - $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); - print ''; + $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + print ''; print $formexpensereport->selectTypeExpenseReport($fk_c_type_fees, 'fk_c_type_fees', 1); print ''; - $params = array('fk_expense' => $object->id); - print $form->selectExpenseCategories('', 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params, 0); - print ''; + $params = array('fk_expense' => $object->id); + print $form->selectExpenseCategories('', 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params, 0); + print ''; @@ -2441,9 +2440,9 @@ if ($action == 'create') { // Select VAT print ''; $defaultvat = -1; - if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) { - $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; - } + if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) { + $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; + } print $form->load_tva('vatrate', ($vatrate != '' ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); print '
'; print '
'; @@ -2501,11 +2500,15 @@ if ($action == 'create') { print ''; print dol_get_fiche_end(); - } - } else { - dol_print_error($db); } + } else { + dol_print_error($db); } +} else { + print 'Record not found'; + + llxFooter(); + exit(1); } /* diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 640f4c17b5d..42be03263a8 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -18,6 +18,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { $modulepart = 'expensereport'; $maxheightmini = 48; $relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/'; $filei = 0; + // Loop on each attached file foreach ($arrayoffiles as $file) { $urlforhref = array(); $filei++; @@ -77,7 +78,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { } if (empty($urlforhref) || empty($thumbshown)) { - print ''; + print ''; } else { print ''; } @@ -85,7 +86,12 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { print $thumbshown ? $thumbshown : img_mime($minifile); - print '
'; + print '
'; + if (empty($urlforhref) || empty($thumbshown)) { + print ''; + } else { + print ''; + } } print '
'; $checked = ''; @@ -106,7 +112,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { if (!empty($filenamelinked) && $filenamelinked == $file['relativename']) { $checked = ' checked'; } - print '
'; + print '
'; print ''; print '
'; From bbb2cdfbdf19823d9a86d25c00b2960f68389437 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jun 2021 19:24:32 +0200 Subject: [PATCH 525/739] Prepare 13.0.4 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index e6c0ef4a176..a24a404262e 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.4'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('EURO')) define('EURO', chr(128)); From 5d6b26ddb7474f991138df7b5472ee2a3ed5529d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jun 2021 19:45:13 +0200 Subject: [PATCH 526/739] Fix css --- htdocs/public/members/new.php | 8 ++++++-- htdocs/public/onlinesign/newonlinesign.php | 5 +++++ htdocs/public/payment/newpayment.php | 5 +++++ htdocs/public/payment/paymentko.php | 5 +++++ htdocs/public/payment/paymentok.php | 5 +++++ htdocs/public/recruitment/view.php | 5 +++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index cddfd0524b1..46aac8dce3b 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -119,14 +119,18 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ if ($urllogo) { print '
'; print '
'; - print ''; + print ''; print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { print ''; } print '
'; } + if (!empty($conf->global->MEMBER_IMAGE_PUBLIC_REGISTRATION)) { + print '
'; + print ''; + print '
'; + } print '
'; print '
'; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 56690f78a42..c656b04fef9 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -189,6 +189,11 @@ if ($urllogo) } print '
'; } +if (!empty($conf->global->PROPOSAL_IMAGE_PUBLIC_SIGN)) { + print '
'; + print ''; + print '
'; +} // Output introduction text $text = ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index bda291b8d8a..9cecbc90885 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -792,6 +792,11 @@ if ($urllogo) } print '
'; } +if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) { + print '
'; + print ''; + print '
'; +} diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index b99c4a39392..218cf77215b 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -242,6 +242,11 @@ if ($urllogo) } print '
'; } +if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) { + print '
'; + print ''; + print '
'; +} print '

'; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index f4b9f0feb5b..60d763593fe 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -182,6 +182,11 @@ if ($urllogo) } print '
'; } +if (!empty($conf->global->MAIN_IMAGE_PUBLIC_PAYMENT)) { + print '
'; + print ''; + print '
'; +} print '


'; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index b8858b921e9..d1546dc4a02 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -216,6 +216,11 @@ if ($urllogo) } print '
'; } +if (!empty($conf->global->RECRUITMENT_IMAGE_PUBLIC_PAYMENT)) { + print '
'; + print ''; + print '
'; +} // Output introduction text $text = ''; From 414b5e612fae0eae285dffab5d164b1ac5bc4bc5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jun 2021 22:11:16 +0200 Subject: [PATCH 527/739] Better info on upload size limit --- htdocs/core/class/html.formfile.class.php | 3 ++- htdocs/langs/en_US/main.lang | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 47506d5cbfa..83258f9c1cd 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -218,9 +218,10 @@ class FormFile if (!empty($conf->global->MAIN_UPLOAD_DOC)) { if ($perm) { + $menudolibarrsetupmax = $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("Security"); $langs->load('other'); $out .= ' '; - $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1); + $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetupAt", $menudolibarrsetupmax, $max, $maxphptoshowparam, $maxphptoshow), 1); } } else { $out .= ' ('.$langs->trans("UploadDisabled").')'; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 23b1fb9413e..863b94af564 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -730,6 +730,7 @@ MenuMembers=Members MenuAgendaGoogle=Google agenda MenuTaxesAndSpecialExpenses=Taxes | Special expenses ThisLimitIsDefinedInSetup=Dolibarr limit (Menu home-setup-security): %s Kb, PHP limit: %s Kb +ThisLimitIsDefinedInSetupAt=Dolibarr limit (Menu %s): %s Kb, PHP limit (Param %s): %s Kb NoFileFound=No documents uploaded CurrentUserLanguage=Current language CurrentTheme=Current theme From 4a3da84098979afc2dd5655f3727d9df70fcf308 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 19 Jun 2021 23:52:52 +0200 Subject: [PATCH 528/739] Clean code --- htdocs/core/ajax/ajaxdirpreview.php | 11 +++---- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 36 ++++++++++++++--------- htdocs/core/lib/functions.lib.php | 30 ++++++++++--------- htdocs/core/tpl/filemanager.tpl.php | 5 ++-- htdocs/website/index.php | 7 +++-- 6 files changed, 53 insertions(+), 38 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index cf619f70de6..09292dd4991 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -54,8 +54,8 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; - $sortfield = GETPOST("sortfield", 'alpha'); - $sortorder = GETPOST("sortorder", 'alpha'); + $sortfield = GETPOST("sortfield", 'aZ09comma'); + $sortorder = GETPOST("sortorder", 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; @@ -82,8 +82,8 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call //exit; } } -} else // For no ajax call -{ +} else { + // For no ajax call $rootdirfordoc = $conf->ecm->dir_output; $ecmdir = new EcmDirectory($db); @@ -376,7 +376,7 @@ if ($type == 'directory') { // When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param // When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath //var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url); - $formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm); + $formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm, '', $sortfield, $sortorder); } } @@ -430,6 +430,7 @@ if ($useajax || $action == 'delete') { } if ($useajax) { + print ''."\n"; print ''; + jQuery(document).ready(function () { + jQuery(".button_'.$name.'").click(function () { + console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js(DOL_URL_ROOT.$url).'") + var $dialog = $(\'
\').html(\'\') + .dialog({ + autoOpen: false, + modal: true, + height: (window.innerHeight - 150), + width: \'80%\', + title: "'.dol_escape_js($label).'" + }); + $dialog.dialog(\'open\'); + }); + }); + '; return $out; } diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index d8bbe0c7cc0..41e7c937d6a 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -128,7 +128,7 @@ $nameforformuserfile = 'formuserfileecm'; print '
'; -// To attach new file +// For to attach a new file if ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || !empty($section)) { if ((empty($section) || $section == -1) && ($module != 'medias')) { ?> @@ -141,10 +141,11 @@ if ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE } $sectiondir = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha'); + print ''."\n"; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $formfile = new FormFile($db); - $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir); + print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, 0, 0, 0, 1); } else { print ' '; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 9361aae865f..531a4a11d9f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -403,8 +403,10 @@ if ($sortfield) { if ($sortorder) { $backtopage .= '&sortorder='.urlencode($sortorder); } -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; +include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit' action when submitting new file. + $backtopage = $savbacktopage; +//var_dump($backtopage); var_dump($action); if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; If action were renamefile, we set it to 'file_manager' $action = 'file_manager'; @@ -2647,7 +2649,7 @@ if (!GETPOST('hide_websitemenu')) { $out .= ' jQuery("#website").change(function () {'; $out .= ' console.log("We select "+jQuery("#website option:selected").val());'; $out .= ' if (jQuery("#website option:selected").val() == \'-2\') {'; - $out .= ' window.location.href = "'.$urltocreatenewwebsite.'";'; + $out .= ' window.location.href = "'.dol_escape_js($urltocreatenewwebsite).'";'; $out .= ' } else {'; $out .= ' window.location.href = "'.$_SERVER["PHP_SEFL"].'?website="+jQuery("#website option:selected").val();'; $out .= ' }'; @@ -4039,6 +4041,7 @@ if ($action == 'editfile' || $action == 'file_manager' || $action == 'convertimg print '

'; //print '
'.$langs->trans("FeatureNotYetAvailable").''; + $module = 'medias'; if (empty($url)) { $url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param From bf460526c055e5c44cb1f376614e0d3f16145eca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 00:27:24 +0200 Subject: [PATCH 529/739] Add warning when submiting file larger than post_max_size. --- htdocs/core/actions_linkedfiles.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 750ed2b2d9a..e0bb6174948 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -26,6 +26,9 @@ //var_dump($upload_dir); //var_dump($upload_dirold); +if (GETPOST('uploadform', 'int') && empty($_FILES)) { + print "Error: The PHP parameter 'post_max_size' is too low. All POST parameters and FILES were set to empty.\n"; +} // Submit file/link if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC) && (!isset($permissiontoadd) || $permissiontoadd)) { From 0e80784de973f632de90eddf257394704e02aa6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 00:32:25 +0200 Subject: [PATCH 530/739] Add warning to help understand bug of post_max_size. --- htdocs/core/actions_linkedfiles.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index e0bb6174948..3e2438f63d3 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -26,8 +26,14 @@ //var_dump($upload_dir); //var_dump($upload_dirold); -if (GETPOST('uploadform', 'int') && empty($_FILES)) { - print "Error: The PHP parameter 'post_max_size' is too low. All POST parameters and FILES were set to empty.\n"; + +// Protection to understand what happen when submitting files larger than post_max_size +if (GETPOST('uploadform', 'int') && empty($_POST) && empty($_FILES)) { + dol_syslog("The PHP parameter 'post_max_size' is too low. All POST parameters and FILES were set to empty."); + $langs->loadLangs(array("errors", "install")); + print $langs->trans("ErrorFileSizeTooLarge").' '; + print $langs->trans("ErrorGoBackAndCorrectParameters"); + die; } // Submit file/link From 8df981504931e1808476c48b47a22486404c347c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 01:04:16 +0200 Subject: [PATCH 531/739] Add warning to help understand bug of post_max_size. --- htdocs/core/class/html.formfile.class.php | 4 +++- htdocs/core/tpl/filemanager.tpl.php | 3 ++- htdocs/website/index.php | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9fde21d24de..7a1f2101ee7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -77,7 +77,7 @@ class FormFile * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') * @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be) - * @param int $usewithoutform 0=Default, 1=Disable
and style to use in existing area + * @param int $usewithoutform 0=Default, 1=Disable and to use in existing form area, 2=Disable the tag only * @param int $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept. * @param int $disablemulti 0=Default, 1=Disable multiple file upload * @param int $nooutput 0=Output result with print, 1=Return result @@ -129,6 +129,8 @@ class FormFile $url .= (strpos($url, '?') === false ? '?' : '&').'uploadform=1'; $out .= ''."\n"; + } + if (empty($usewithoutform) || $usewithoutform == 2) { $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 41e7c937d6a..57a95c48ece 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -16,6 +16,7 @@ * * Output code for the filemanager * $module must be defined ('ecm', 'medias', ...) + * $formalreadyopen can be set to 1 to avoid to open the to submit files a second time */ // Protection to avoid direct call of template @@ -145,7 +146,7 @@ if ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE print ''."\n"; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $formfile = new FormFile($db); - print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, 0, 0, 0, 1); + print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, empty($formalreadyopen) ? 0 : $formalreadyopen, 0, 0, 1); } else { print ' '; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 531a4a11d9f..aa2b357a794 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2506,7 +2506,8 @@ $moreheadjs .= ''."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("WebsiteSetup"), $helpurl, '', 0, 0, $arrayofjs, $arrayofcss, '', '', ''."\n".'
'); print "\n"; -print ''; +print ''."\n"; +print ''; print ''; print ''; @@ -4043,6 +4044,7 @@ if ($action == 'editfile' || $action == 'file_manager' || $action == 'convertimg $module = 'medias'; + $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php if (empty($url)) { $url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param } From 597bdee0bc39263eb37b809c66a754152b6331c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 01:39:07 +0200 Subject: [PATCH 532/739] Trans --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4d28f2160c6..efe674e7ca8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2144,3 +2144,4 @@ YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You s RandomlySelectedIfSeveral=Randomly selected if several pictures are available DatabasePasswordObfuscated=Database password is obfuscated in conf file DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file +APIsAreNotEnabled=APIs modules are not enabled \ No newline at end of file From 2efd432946455daf5dd026d874a2f272cecded16 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 01:54:55 +0200 Subject: [PATCH 533/739] Fix list of security events enabled --- htdocs/admin/system/security.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 3e01a99cb61..dcf980cf907 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -329,6 +329,7 @@ $securityevent = new Events($db); $eventstolog = $securityevent->eventstolog; print ''.$langs->trans("AuditedSecurityEvents").': '; +$out = ''; if (!empty($eventstolog) && is_array($eventstolog)) { // Loop on each event type $i = 0; @@ -338,18 +339,22 @@ if (!empty($eventstolog) && is_array($eventstolog)) { $value = empty($conf->global->$key) ? '' : $conf->global->$key; if ($value) { if ($i > 0) { - print ', '; + $out .= ', '; } - print ''.$key.''; + $out .= ''.$key.''; $i++; } } } - print '
'; -} else { + print $out; +} + +if (empty($out)) { print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Audit")).'
'; } +print '
'; + // Modules/Applications From 4b6427f92041f76d4262babe53c4772d646bd202 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 01:55:56 +0200 Subject: [PATCH 534/739] Fix menu entry --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index dcf980cf907..a838a107d82 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -350,7 +350,7 @@ if (!empty($eventstolog) && is_array($eventstolog)) { } if (empty($out)) { - print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Audit")).'
'; + print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security")).'
'; } print '
'; From 6e27ae6029b18c00667daf26bb8b37f271d9b6c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 01:56:26 +0200 Subject: [PATCH 535/739] Fix path --- htdocs/admin/system/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index a838a107d82..0b2f2678521 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -350,7 +350,7 @@ if (!empty($eventstolog) && is_array($eventstolog)) { } if (empty($out)) { - print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security")).'
'; + print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Security").' - '.$langs->transnoentities("Audit")).'
'; } print '
'; From ce818d4f449833312b23eaa86519419e0a957e62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 03:41:45 +0200 Subject: [PATCH 536/739] Debug doc templates of ODF --- .../mrp/doc/doc_generic_mo_odt.modules.php | 11 ++++++----- .../doc/doc_generic_myobject_odt.modules.php | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 860e07d7d36..57c175a0112 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -175,7 +175,7 @@ class doc_generic_mo_odt extends ModelePDFMo $texte .= '
'; // Show list of found files foreach ($listoffiles as $file) { - $texte .= '- '.$file['name'].' '.img_picto('', 'listlight').'
'; + $texte .= '- '.$file['name'].' '.img_picto('', 'listlight').'
'; } $texte .= '
'; } @@ -284,7 +284,7 @@ class doc_generic_mo_odt extends ModelePDFMo //print "file=".$file; //print "conf->societe->dir_temp=".$conf->societe->dir_temp; - dol_mkdir($conf->bom->dir_temp); + dol_mkdir($conf->mrp->dir_temp); // If CUSTOMER contact defined on order, we use it @@ -379,14 +379,15 @@ class doc_generic_mo_odt extends ModelePDFMo foreach ($tmparray as $key => $value) { try { - if (preg_match('/logo$/', $key)) { // Image + if (preg_match('/logo$/', $key)) { + // Image if (file_exists($value)) { $odfHandler->setImage($key, $value); } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { + // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index d64c80c9355..3836381e5cc 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -86,7 +86,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $this->marge_basse = 0; $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION + $this->option_tva = 0; // Gere option tva $this->option_modereg = 0; // Affiche mode reglement $this->option_condreg = 0; // Affiche conditions reglement $this->option_codeproduitservice = 0; // Affiche code produit-service @@ -135,7 +135,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); @@ -173,7 +174,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if ($nbofiles) { $texte .= ''; } @@ -195,7 +196,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject /** * Function to build a document on disk using the generic odt module. * - * @param Commande $object Object source to build document + * @param MyObject $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -229,11 +230,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->commande->dir_output) { + if ($conf->mymodule->dir_output) { // If $object is id instead of object if (!is_object($object)) { $id = $object; - $object = new Commande($this->db); + $object = new MyObject($this->db); $result = $object->fetch($id); if ($result < 0) { dol_print_error($this->db, $object->error); @@ -241,7 +242,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } } - $dir = $conf->commande->multidir_output[isset($object->entity) ? $object->entity : 1]; + $object->fetch_thirdparty(); + + $dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; @@ -331,7 +334,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->commande->dir_temp, + 'PATH_TO_TMP' => $conf->mymodule->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' From 1a6647e6909df223b9899b4c0d512d5cd24de80f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 04:10:25 +0200 Subject: [PATCH 537/739] Debug v14 --- htdocs/core/class/html.formfile.class.php | 6 +++--- htdocs/core/modules/mrp/modules_mo.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7a1f2101ee7..04b104ff0f1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -356,7 +356,7 @@ class FormFile * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * - * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:nameofsubmodule', 'mymodule_temp', ...) + * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:myobject', 'mymodule_temp', ...) * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) @@ -678,7 +678,7 @@ class FormFile $res = include_once $file; } - $class = 'ModelePDF'.$submodulepart; + $class = 'ModelePDF'.ucfirst($submodulepart); if (class_exists($class)) { $modellist = call_user_func($class.'::liste_modeles', $this->db); @@ -740,7 +740,7 @@ class FormFile if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && !empty($conf->global->MAIN_MULTILANGS) && !$forcenomultilang && (!empty($modellist) || $showempty)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($this->db); - $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); + $defaultlang = ($codelang && $codelang != 'auto') ? $codelang : $langs->getDefaultLang(); $morecss = 'maxwidth150'; if ($conf->browser->layout == 'phone') { $morecss = 'maxwidth100'; diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php index 82a1a9f3b56..454df89bcde 100644 --- a/htdocs/core/modules/mrp/modules_mo.php +++ b/htdocs/core/modules/mrp/modules_mo.php @@ -52,7 +52,7 @@ abstract class ModelePDFMo extends CommonDocGenerator // phpcs:enable global $conf; - $type = 'mo'; + $type = 'mrp'; $list = array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; From e3e2dfd7648fe5cd03714ce888be9b43026eb4ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 05:11:46 +0200 Subject: [PATCH 538/739] Fix generation of ODT (test if temporary directory is writable) --- .../core/class/commondocgenerator.class.php | 6 +-- htdocs/core/class/commonobject.class.php | 44 ++++++++++--------- .../barcode/doc/phpbarcode.modules.php | 5 +++ .../barcode/doc/tcpdfbarcode.modules.php | 6 +++ .../bom/doc/doc_generic_bom_odt.modules.php | 6 ++- .../doc/doc_generic_order_odt.modules.php | 6 ++- .../doc/doc_generic_contract_odt.modules.php | 6 ++- .../doc/doc_generic_shipment_odt.modules.php | 6 ++- .../doc/doc_generic_invoice_odt.modules.php | 6 ++- .../doc/doc_generic_member_odt.class.php | 6 ++- .../mrp/doc/doc_generic_mo_odt.modules.php | 16 +++++-- .../doc/doc_generic_product_odt.modules.php | 6 ++- .../doc/doc_generic_project_odt.modules.php | 5 +++ .../task/doc/doc_generic_task_odt.modules.php | 5 +++ .../doc/doc_generic_proposal_odt.modules.php | 6 ++- .../doc/doc_generic_reception_odt.modules.php | 6 ++- .../societe/doc/doc_generic_odt.modules.php | 5 +++ .../doc/doc_generic_stock_odt.modules.php | 6 ++- ...doc_generic_supplier_order_odt.modules.php | 8 +++- ..._generic_supplier_proposal_odt.modules.php | 6 ++- .../doc/doc_generic_ticket_odt.modules.php | 16 ++++--- .../user/doc/doc_generic_user_odt.modules.php | 6 ++- .../doc/doc_generic_usergroup_odt.modules.php | 6 ++- .../doc/doc_generic_myobject_odt.modules.php | 6 ++- htdocs/mrp/lib/mrp_mo.lib.php | 2 +- htdocs/mrp/mo_card.php | 17 ++++--- 26 files changed, 162 insertions(+), 57 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 6e91d9d175b..2a5e3391eb9 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -489,7 +489,7 @@ abstract class CommonDocGenerator $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $remain_to_pay, 'MT') ); - if (method_exists($object, 'getTotalDiscount')) { + if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) { $resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs); $resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount()); } else { @@ -532,10 +532,10 @@ abstract class CommonDocGenerator } // @GS: Calculate total up and total discount percentage - // Note that this added fields correspond to nothing in Dolibarr (Dolibarr manage discount on lines not globally) + // Note that this added fields does not match a field into database in Dolibarr (Dolibarr manage discount on lines not as a global property of object) $resarray['object_total_up'] = $totalUp; $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); - if (method_exists($object, 'getTotalDiscount')) { + if (method_exists($object, 'getTotalDiscount') && in_array(get_class($object), array('Proposal', 'Commande', 'Facture', 'SupplierProposal', 'CommandeFournisseur', 'FactureFournisseur'))) { $totalDiscount = $object->getTotalDiscount(); } else { $totalDiscount = 0; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c927b833c71..eeae94ff880 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4334,37 +4334,41 @@ abstract class CommonObject /** * Function that returns the total amount HT of discounts applied for all lines. * - * @return float + * @return float|string Total amout of discount */ public function getTotalDiscount() { - $total_discount = 0.00; + if (!empty($this->table_element_line) ) { + $total_discount = 0.00; - $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element."det"; - $sql .= " WHERE ".$this->fk_element." = ".$this->id; + $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line; + $sql .= " WHERE ".$this->fk_element." = ".$this->id; - dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); + dol_syslog(get_class($this).'::getTotalDiscount', LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); - $pu_ht = $obj->pu_ht; - $qty = $obj->qty; - $total_ht = $obj->total_ht; + $pu_ht = $obj->pu_ht; + $qty = $obj->qty; + $total_ht = $obj->total_ht; - $total_discount_line = floatval(price2num(($pu_ht * $qty) - $total_ht, 'MT')); - $total_discount += $total_discount_line; + $total_discount_line = floatval(price2num(($pu_ht * $qty) - $total_ht, 'MT')); + $total_discount += $total_discount_line; - $i++; + $i++; + } } + + //print $total_discount; exit; + return price2num($total_discount); } - //print $total_discount; exit; - return price2num($total_discount); + return null; } diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index 56c2a12fee6..fe36f7604c2 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -186,6 +186,11 @@ class modPhpbarcode extends ModeleBarCode global $conf, $filebarcode; dol_mkdir($conf->barcode->dir_temp); + if (!is_writable($conf->barcode->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->barcode->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } $file = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index 90b7cd4f543..df9ec39546d 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -158,6 +158,12 @@ class modTcpdfbarcode extends ModeleBarCode global $conf, $_GET; dol_mkdir($conf->barcode->dir_temp); + if (!is_writable($conf->barcode->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->barcode->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } + $file = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png'; $tcpdfEncoding = $this->getTcpdfEncodingType($encoding); diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 30d93aedfa0..ce85203930f 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -278,7 +278,11 @@ class doc_generic_bom_odt extends ModelePDFBom //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->bom->dir_temp); - + if (!is_writable($conf->bom->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->bom->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 603394b9797..e7fe92ba9f9 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -290,7 +290,11 @@ class doc_generic_order_odt extends ModelePDFCommandes //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->commande->dir_temp); - + if (!is_writable($conf->commande->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->commande->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 2b3e2905907..c8d1748124a 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -278,7 +278,11 @@ class doc_generic_contract_odt extends ModelePDFContract //print "conf->contrat->dir_temp=".$conf->contrat->dir_temp; dol_mkdir($conf->contrat->dir_temp); - + if (!is_writable($conf->contrat->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->contrat->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on contract, we use it $usecontact = false; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 163392ead88..2eaca54b697 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -290,7 +290,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->expedition->dir_temp); - + if (!is_writable($conf->expedition->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->expedition->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If SHIPMENT contact defined on invoice, we use it $usecontact = false; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ffba0717332..98269a0f019 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -291,7 +291,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->facture->dir_temp); - + if (!is_writable($conf->facture->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->facture->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If BILLING contact defined on invoice, we use it $usecontact = false; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 9a14e96bc28..120efe93cf7 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -279,7 +279,11 @@ class doc_generic_member_odt extends ModelePDFMember //print "conf->adherent->dir_temp=".$conf->adherent->dir_temp; dol_mkdir($conf->adherent->dir_temp); - + if (!is_writable($conf->adherent->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->adherent->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on member, we use it $usecontact = false; diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 57c175a0112..ac920d69269 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -285,7 +285,11 @@ class doc_generic_mo_odt extends ModelePDFMo //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->mrp->dir_temp); - + if (!is_writable($conf->mrp->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->mrp->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; @@ -342,11 +346,13 @@ class doc_generic_mo_odt extends ModelePDFMo dol_syslog($e->getMessage(), LOG_INFO); return -1; } + // After construction $odfHandler->contentXml contains content and // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by // [!-- BEGIN lines --]*[!-- END lines --] //print html_entity_decode($odfHandler->__toString()); //print exit; + /* // Make substitutions into odt of freetext @@ -394,6 +400,7 @@ class doc_generic_mo_odt extends ModelePDFMo dol_syslog($e->getMessage(), LOG_INFO); } } + // Replace tags of lines try { $foundtagforlines = 1; @@ -404,6 +411,7 @@ class doc_generic_mo_odt extends ModelePDFMo $foundtagforlines = 0; dol_syslog($e->getMessage(), LOG_INFO); } + if ($foundtagforlines) { $linenumber = 0; foreach ($object->lines as $line) { @@ -446,14 +454,14 @@ class doc_generic_mo_odt extends ModelePDFMo $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - + */ // Write new file if (!empty($conf->global->MAIN_ODT_AS_PDF)) { try { $odfHandler->exportAsAttachedPDF($file); } catch (Exception $e) { $this->error = $e->getMessage(); - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog('Error in exportAsAttachedPDF: '.$e->getMessage(), LOG_INFO); return -1; } } else { @@ -461,7 +469,7 @@ class doc_generic_mo_odt extends ModelePDFMo $odfHandler->saveToDisk($file); } catch (Exception $e) { $this->error = $e->getMessage(); - dol_syslog($e->getMessage(), LOG_INFO); + dol_syslog('Error in saveToDisk: '.$e->getMessage(), LOG_INFO); return -1; } } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index d038acd7ee5..b2d45a7ab6e 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -302,7 +302,11 @@ class doc_generic_product_odt extends ModelePDFProduct //print "conf->product->dir_temp=".$conf->product->dir_temp; dol_mkdir($conf->product->dir_temp); - + if (!is_writable($conf->product->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->product->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on product, we use it $usecontact = false; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index c085f1eeaac..52d56812d68 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -574,6 +574,11 @@ class doc_generic_project_odt extends ModelePDFProjects //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->projet->dir_temp); + if (!is_writable($conf->projet->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->projet->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If PROJECTLEADER contact defined on project, we use it $usecontact = false; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index a04e2e9c14a..961dab003e1 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -524,6 +524,11 @@ class doc_generic_task_odt extends ModelePDFTask //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->projet->dir_temp); + if (!is_writable($conf->task->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->task->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } $socobject = $project->thirdparty; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e7eade5de02..e892e9a7252 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -318,7 +318,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales //print "conf->propal->dir_temp=".$conf->propal->dir_temp; dol_mkdir($conf->propal->multidir_temp[$object->entity]); - + if (!is_writable($conf->propal->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->propal->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on proposal, we use it $usecontact = false; diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index d70ecca00ad..a6701fe8bcd 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -282,7 +282,11 @@ class doc_generic_reception_odt extends ModelePdfReception //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->reception->dir_temp); - + if (!is_writable($conf->reception->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->reception->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If BILLING contact defined on invoice, we use it $usecontact = false; diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 9045ed0b281..900c7e465df 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -266,6 +266,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc //exit; dol_mkdir($conf->societe->multidir_temp[$object->entity]); + if (!is_writable($conf->societe->multidir_temp[$object->entity])) { + $this->error = "Failed to write in temp directory ".$conf->societe->multidir_temp[$object->entity]; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // Open and load template require_once ODTPHP_PATH.'odf.php'; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index e2d474d2dd2..ccd66610f55 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -291,7 +291,11 @@ class doc_generic_stock_odt extends ModelePDFStock //print "conf->product->dir_temp=".$conf->product->dir_temp; dol_mkdir($conf->product->dir_temp); - + if (!is_writable($conf->product->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->product->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on stock, we use it $usecontact = false; diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index b7fd399edef..285ea50bebe 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -280,8 +280,12 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders //print "file=".$file; //print "conf->societe->dir_temp=".$conf->societe->dir_temp; - dol_mkdir($conf->commande->dir_temp); - + dol_mkdir($conf->fournisseur->commande->dir_temp); + if (!is_writable($conf->fournisseur->commande->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->fournisseur->commande->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 7e300c68643..ead5664c04a 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -315,7 +315,11 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal //print "conf->propal->dir_temp=".$conf->propal->dir_temp; dol_mkdir($conf->supplier_proposal->dir_temp); - + if (!is_writable($conf->supplier_proposal->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->supplier_proposal->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If BILLING contact defined on invoice, we use it $usecontact = false; diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index d1d3763fb2e..1bb48b82b42 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -222,7 +222,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket // Load translation files required by the page $outputlangs->loadLangs(array("main", "companies", "bills", "dict")); - if ($conf->user->dir_output) { + if ($conf->ticket->dir_output) { // If $object is id instead of object if (!is_object($object)) { $id = $object; @@ -236,7 +236,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $object->fetch_thirdparty(); - $dir = $conf->user->dir_output; + $dir = $conf->ticket->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (!preg_match('/specimen/i', $objectref)) { $dir .= "/".$objectref; @@ -274,10 +274,14 @@ class doc_generic_ticket_odt extends ModelePDFTicket //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; - //print "conf->user->dir_temp=".$conf->user->dir_temp; - - dol_mkdir($conf->user->dir_temp); + //print "conf->ticket->dir_temp=".$conf->ticket->dir_temp; + dol_mkdir($conf->ticket->dir_temp); + if (!is_writable($conf->ticket->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->ticket->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on user, we use it $usecontact = false; @@ -306,7 +310,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->user->dir_temp, + 'PATH_TO_TMP' => $conf->ticket->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 035a99fe744..80bbd0f2905 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -309,7 +309,11 @@ class doc_generic_user_odt extends ModelePDFUser //print "conf->user->dir_temp=".$conf->user->dir_temp; dol_mkdir($conf->user->dir_temp); - + if (!is_writable($conf->user->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->user->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on user, we use it $usecontact = false; diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 04d9957458b..9ea1a27f045 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -299,7 +299,11 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup //print "conf->user->dir_temp=".$conf->user->dir_temp; dol_mkdir($conf->user->dir_temp); - + if (!is_writable($conf->user->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->user->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on user, we use it $usecontact = false; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 3836381e5cc..a74de9d7f9b 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -284,7 +284,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject //print "conf->societe->dir_temp=".$conf->societe->dir_temp; dol_mkdir($conf->mymodule->dir_temp); - + if (!is_writable($conf->mymodule->dir_temp)) { + $this->error = "Failed to write in temp directory ".$conf->mymodule->dir_temp; + dol_syslog('Error in write_file: '.$this->error, LOG_ERR); + return -1; + } // If CUSTOMER contact defined on order, we use it $usecontact = false; diff --git a/htdocs/mrp/lib/mrp_mo.lib.php b/htdocs/mrp/lib/mrp_mo.lib.php index 62f74ce016e..8fe07df89c1 100644 --- a/htdocs/mrp/lib/mrp_mo.lib.php +++ b/htdocs/mrp/lib/mrp_mo.lib.php @@ -78,7 +78,7 @@ function moPrepareHead($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->mrp->dir_output."/mo/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->mrp->dir_output."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); $head[$h][0] = dol_buildpath("/mrp/mo_document.php", 1).'?id='.$object->id; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 093604df9a1..fad22645cd5 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -138,6 +138,16 @@ if (empty($reshook)) { // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + if ($action == 'set_thirdparty' && $permissiontoadd) { + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MO_MODIFY'); + } + if ($action == 'classin' && $permissiontoadd) { + $object->setProject(GETPOST('projectid', 'int')); + } + // Actions to send emails $triggersendname = 'MO_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_MO_TO'; @@ -147,13 +157,6 @@ if (empty($reshook)) { // Action to move up and down lines of object //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once - if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MO_MODIFY'); - } - if ($action == 'classin' && $permissiontoadd) { - $object->setProject(GETPOST('projectid', 'int')); - } - // Action close produced if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd) { $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED'); From e61d60e12546085957194dc2b221b71b8aa8860f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 10:49:05 +0200 Subject: [PATCH 539/739] internationalization --- .../supplier_order/doc/pdf_cornas.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 245897e1956..dc898c98cb5 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -148,13 +148,13 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; //Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 1; // Support add of a watermark on drafts From fa3e75c68a4fa5b353db18b06e02889618984c88 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 10:58:20 +0200 Subject: [PATCH 540/739] internationalization --- .../doc/doc_generic_myobject_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index a74de9d7f9b..b7ea52d939d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -85,13 +85,13 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From 33ffb8b943e40f49a8bcceded6b21017e889ab7e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:01:38 +0200 Subject: [PATCH 541/739] internationalization --- htdocs/core/modules/bank/doc/pdf_ban.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 1bbf2e14cc0..a87817cdc73 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -72,9 +72,9 @@ class pdf_ban extends ModeleBankAccountDoc $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_logo = 1; // Display logo FAC_PDF_LOGO + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; // Display product-service code // Retrieves transmitter $this->emetteur = $mysoc; From e5f43cc67890430c43150fb42aaef8bb3ce14926 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:03:28 +0200 Subject: [PATCH 542/739] internationalization --- htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index f1ebc5bf64f..49e311f1c89 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -75,9 +75,9 @@ class pdf_sepamandate extends ModeleBankAccountDoc $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_codeproduitservice = 1; // Affiche code produit-service + $this->option_logo = 1; // Display logo FAC_PDF_LOGO + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_codeproduitservice = 1; //Display product-service code // Retrieves transmitter $this->emetteur = $mysoc; From f4199ca99ee4a14de5184e54ee06f089db318445 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:06:04 +0200 Subject: [PATCH 543/739] internationalization --- .../doc/doc_generic_order_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index e7fe92ba9f9..239ec7639ec 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Philippe Grand + * Copyright (C) 2018-2021 Philippe Grand * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -85,13 +85,13 @@ class doc_generic_order_odt extends ModelePDFCommandes $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From d3a9b03c89fd20870892b5b235d5746eb41c5502 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:08:53 +0200 Subject: [PATCH 544/739] internationalization --- .../doc/doc_generic_contract_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index c8d1748124a..b1e441175d9 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -84,13 +84,13 @@ class doc_generic_contract_odt extends ModelePDFContract $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva CONTRACT_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat CONTRACT_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From e2ef205036fe641326a0620557e18635a053071d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:11:41 +0200 Subject: [PATCH 545/739] internationalization --- .../doc/doc_generic_shipment_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2eaca54b697..8a2b6b2b121 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Philippe Grand + * Copyright (C) 2018-2021 Philippe Grand * Copyright (C) 2018-2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -86,13 +86,13 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva EXPEDITION_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option EXPEDITION_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From 0d60323e4101df3d7861889069f8ca25d14038cf Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:13:31 +0200 Subject: [PATCH 546/739] internationalization --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 42999248026..aed43ea40ac 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -139,7 +139,7 @@ class pdf_espadon extends ModelePdfExpedition $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; + $this->option_logo = 1; // Display logo // Get source company $this->emetteur = $mysoc; From f8187eb70e86436bf671fba5cbdaf09a80e43b7e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:16:03 +0200 Subject: [PATCH 547/739] internationalization --- .../expensereport/doc/pdf_standard.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 1815321ab18..b1f48450d0d 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016-2019 Philippe Grand + * Copyright (C) 2016-2021 Philippe Grand * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters @@ -151,13 +151,13 @@ class pdf_standard extends ModeleExpenseReport $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 1; // Support add of a watermark on drafts From 5977fe23e72ca138e30e21fcdd026c4a1485ca78 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:18:07 +0200 Subject: [PATCH 548/739] internationalization --- .../doc/doc_generic_invoice_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 98269a0f019..0d360269d46 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -85,13 +85,13 @@ class doc_generic_invoice_odt extends ModelePDFFactures $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From e5083d18af86f8610ae5ba114011dc990df46b22 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:20:20 +0200 Subject: [PATCH 549/739] internationalization --- .../member/doc/doc_generic_member_odt.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 120efe93cf7..939c78f32e3 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -81,13 +81,13 @@ class doc_generic_member_odt extends ModelePDFMember $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva MEMBER_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From 9acbb984a1f9c54a45e5f93af0110f7565572264 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:22:17 +0200 Subject: [PATCH 550/739] internationalization --- htdocs/core/modules/movement/doc/pdf_standard.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index 872890958ff..e029c4d5d66 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -137,12 +137,12 @@ class pdf_stdandard extends ModelePDFMovement $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_codestockservice = 0; // Affiche code stock-service - $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Display logo + $this->option_codestockservice = 0; // Display stock-service code + $this->option_multilang = 1; // Available in several languages $this->option_freetext = 0; // Support add of a personalised text - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From ddaa9ecfc1a5b85a336b97761bba6ce284bfe3a2 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:24:36 +0200 Subject: [PATCH 551/739] internationalization --- .../mrp/doc/doc_generic_mo_odt.modules.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index ac920d69269..e93ecd1af0a 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Philippe Grand + * Copyright (C) 2018-2021 Philippe Grand * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -85,18 +85,18 @@ class doc_generic_mo_odt extends ModelePDFMo $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From 93512fd501c21180233b419e9d35265a9086947f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:26:25 +0200 Subject: [PATCH 552/739] internationalization --- .../doc/doc_generic_product_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index b2d45a7ab6e..1acf50dd95a 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -83,18 +83,18 @@ class doc_generic_product_odt extends ModelePDFProduct $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva PRODUCT_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option PRODUCT_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From 9ccc9d0d3d44dff8addf1244ee9fd4d125dabb3f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:27:49 +0200 Subject: [PATCH 553/739] internationalization --- htdocs/core/modules/product/doc/pdf_standard.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 99b6ff69236..815fc4d1c66 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -137,12 +137,12 @@ class pdf_standard extends ModelePDFProduct $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Display logo + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages $this->option_freetext = 0; // Support add of a personalised text - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From 12079447618448e0956bcaa655f30f96808fd5b9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:29:47 +0200 Subject: [PATCH 554/739] internationalization --- .../doc/doc_generic_project_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 52d56812d68..233180630b0 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -120,18 +120,18 @@ class doc_generic_project_odt extends ModelePDFProjects $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->pays_code) { $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini From 748c10c2f9722c9560745f0f2e2f6f5b5d4a7c11 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:32:25 +0200 Subject: [PATCH 555/739] internationalization --- .../task/doc/doc_generic_task_odt.modules.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 961dab003e1..566c7f07a2e 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -121,21 +121,21 @@ class doc_generic_task_odt extends ModelePDFTask $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 0; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 0; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->pays_code) { - $this->emetteur->pays_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini + $this->emetteur->pays_code = substr($langs->defaultlang, -2); // By default, if was not defined } } From 14af45057cfb8f5796f9159b8908f70191520995 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:35:37 +0200 Subject: [PATCH 556/739] internationalization --- .../doc/doc_generic_proposal_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index e892e9a7252..9c7e0af4df0 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -82,18 +82,18 @@ class doc_generic_proposal_odt extends ModelePDFPropales $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva PROPALE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From b07d2f257a9f00633ac65598e0f318279c15eeb6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:37:51 +0200 Subject: [PATCH 557/739] internationalization --- .../doc/doc_generic_reception_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index a6701fe8bcd..93dbc4995b4 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -80,18 +80,18 @@ class doc_generic_reception_odt extends ModelePdfReception $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva RECEPTION_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option RECEPTION_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From 057e78d8c37a8eb2920a88cefd6977f583f35f04 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:40:54 +0200 Subject: [PATCH 558/739] internationalization --- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 0e4474b6b8c..f7ba7a42842 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -32,7 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_squille extends ModelePdfReception { - public $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe object that emits + */ + public $emetteur; /** @@ -58,7 +62,7 @@ class pdf_squille extends ModelePdfReception $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; + $this->option_logo = 1; // Display logo // Get source company $this->emetteur = $mysoc; From a4e63a1a26288292cd5bd0f3d6d126ad7b5fce99 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:43:05 +0200 Subject: [PATCH 559/739] internationalization --- htdocs/core/modules/societe/doc/doc_generic_odt.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 900c7e465df..fdafb22e96b 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -76,12 +76,12 @@ class doc_generic_odt extends ModeleThirdPartyDoc $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo + $this->option_logo = 1; // Display logo // Retrieves transmitter $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini + $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined } } From d60d15883f3be08591971cff40c4687fc3dbcb0b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:46:22 +0200 Subject: [PATCH 560/739] internationalization --- .../stock/doc/doc_generic_stock_odt.modules.php | 16 ++++++++-------- .../modules/stock/doc/pdf_standard.modules.php | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index ccd66610f55..5ca5019588a 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -82,18 +82,18 @@ class doc_generic_stock_odt extends ModelePDFStock $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva STOCK_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option STOCK_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index b0cc07dcb62..ebc109151d6 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -137,12 +137,12 @@ class pdf_standard extends ModelePDFStock $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_codestockservice = 0; // Affiche code stock-service - $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Display logo + $this->option_codestockservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages $this->option_freetext = 0; // Support add of a personalised text - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From c06fcd36fb33f699f39378ea13c4ab91224c2ec8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:48:30 +0200 Subject: [PATCH 561/739] internationalization --- .../doc/doc_generic_supplier_order_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index 285ea50bebe..3a2775bef82 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -86,13 +86,13 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From e33db2876a0e8cad33500034a919bfa54748b58b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:51:02 +0200 Subject: [PATCH 562/739] internationalization --- .../doc_generic_supplier_proposal_odt.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index ead5664c04a..717818448ec 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -84,13 +84,13 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva PROPALE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option PROPALE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts From 1480123f7d2418a814192ec953d07adadc33043b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:53:21 +0200 Subject: [PATCH 563/739] internationalization --- .../supplier_proposal/doc/pdf_aurore.modules.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index cbcec7cfdd9..5bd9b8cf339 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -145,13 +145,13 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->marge_haute = isset($conf->global->MAIN_PDF_MARGIN_TOP) ? $conf->global->MAIN_PDF_MARGIN_TOP : 10; $this->marge_basse = isset($conf->global->MAIN_PDF_MARGIN_BOTTOM) ? $conf->global->MAIN_PDF_MARGIN_BOTTOM : 10; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Affiche mode reglement - $this->option_condreg = 1; // Affiche conditions reglement - $this->option_codeproduitservice = 1; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 1; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION + $this->option_modereg = 1; // Display payment mode + $this->option_condreg = 1; // Display payment terms + $this->option_codeproduitservice = 1; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 1; // Displays if there has been a discount $this->option_credit_note = 1; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 1; //Support add of a watermark on drafts From dbee213db195d1137364164602f98a37ae8330cb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:54:51 +0200 Subject: [PATCH 564/739] internationalization --- .../modules/ticket/doc/doc_generic_ticket_odt.modules.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 1bb48b82b42..2e6172d4181 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -81,13 +81,13 @@ class doc_generic_ticket_odt extends ModelePDFTicket $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva USER_TVAOPTION - $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option USER_TVAOPTION + $this->option_multilang = 1; // Available in several languages $this->option_freetext = 0; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From fb13d74467ef522a6b8d84ae4b346d4681349b57 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:56:49 +0200 Subject: [PATCH 565/739] internationalization --- .../user/doc/doc_generic_user_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 80bbd0f2905..b0d98a525df 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -81,18 +81,18 @@ class doc_generic_user_odt extends ModelePDFUser $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva USER_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option USER_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From ae293d61c6ad63ece0d8f181b6160b5ba70bd541 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 11:59:02 +0200 Subject: [PATCH 566/739] internationalization --- .../doc/doc_generic_usergroup_odt.modules.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 9ea1a27f045..5a1bca6377d 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -84,18 +84,18 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva USERGROUP_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option USERGROUP_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From 5bde0dbc16f59b95cda7ffbf681109c20e5d2072 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 12:00:27 +0200 Subject: [PATCH 567/739] internationalization --- .../modules/mymodule/doc/doc_generic_myobject_odt.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index b7ea52d939d..f3228915592 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Philippe Grand + * Copyright (C) 2018-2021 Philippe Grand * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -96,7 +96,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From ebe7b696a6614ac321fbf9f747f4c9466fc5fad9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 20 Jun 2021 12:02:52 +0200 Subject: [PATCH 568/739] internationalization --- ...eric_recruitmentjobposition_odt.modules.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index 47867e40c5f..06b24ec8b65 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -3,7 +3,7 @@ * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2019 Philippe Grand + * Copyright (C) 2018-2021 Philippe Grand * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -85,18 +85,18 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi $this->marge_haute = 0; $this->marge_basse = 0; - $this->option_logo = 1; // Affiche logo - $this->option_tva = 0; // Gere option tva COMMANDE_TVAOPTION - $this->option_modereg = 0; // Affiche mode reglement - $this->option_condreg = 0; // Affiche conditions reglement - $this->option_codeproduitservice = 0; // Affiche code produit-service - $this->option_multilang = 1; // Dispo en plusieurs langues - $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_logo = 1; // Display logo + $this->option_tva = 0; // Manage the vat option COMMANDE_TVAOPTION + $this->option_modereg = 0; // Display payment mode + $this->option_condreg = 0; // Display payment terms + $this->option_codeproduitservice = 0; // Display product-service code + $this->option_multilang = 1; // Available in several languages + $this->option_escompte = 0; // Displays if there has been a discount $this->option_credit_note = 0; // Support credit notes $this->option_freetext = 1; // Support add of a personalised text $this->option_draft_watermark = 0; // Support add of a watermark on drafts - // Recupere emetteur + // Get source company $this->emetteur = $mysoc; if (!$this->emetteur->country_code) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined From a9dd5e87641739f23603d9531e0885dd9f7760b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 12:52:04 +0200 Subject: [PATCH 569/739] Fix css hidoneprint --- htdocs/core/class/html.formother.class.php | 2 +- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 46858191c7b..d352b996ef2 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1177,7 +1177,7 @@ class FormOther $selectboxlist .= ''; $selectboxlist .= ''; $selectboxlist .= ''; - $selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone', 0, 'hidden selected', 0, 1); + $selectboxlist .= Form::selectarray('boxcombo', $arrayboxtoactivatelabel, -1, $langs->trans("ChooseBoxToAdd").'...', 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth150onsmartphone hideonprint', 0, 'hidden selected', 0, 1); if (empty($conf->use_javascript_ajax)) { $selectboxlist .= ' '; } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e039779c96d..d223a70fbc9 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1652,7 +1652,7 @@ table.tableforfield tr>td:first-of-type, tr.trforfield>td:first-of-type, div.tab } -.hideonprint { display: none; } +.hideonprint { display: none !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2c91aa0299b..5027c1501e9 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1668,7 +1668,7 @@ table.tableforfield tr>td:first-of-type, tr.trforfield>td:first-of-type, div.tab } -.hideonprint { display: none; } +.hideonprint { display: none !important; } From 831cc4f4b71b7f8849d08a6318aa7261d4856083 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 14:19:05 +0200 Subject: [PATCH 570/739] Fix 17986 error on comparing integer and string in strict sql --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 62d0e03e27e..e042331b9eb 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = ".((int) $year); + $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From a54a955a652515a933ab14a0bbf118a96350583e Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 15:40:32 +0200 Subject: [PATCH 571/739] Use year() instead of date_format --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index e042331b9eb..ea106e4b4c5 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE date_format(p.dateadh,'%Y') = '".((int) $year)."'"; + $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From 4739694ad7dc4e00df1410c00251d99bba4d1de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 16:24:58 +0200 Subject: [PATCH 572/739] fix php warning --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 04b104ff0f1..831b0f50f04 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -870,7 +870,7 @@ class FormFile // Show share link $out .= ''; - if ($file['share']) { + if (!empty($file['share'])) { // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file From 4e7af173a64d0efc4ac0301527a84729cc3d4777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 16:33:41 +0200 Subject: [PATCH 573/739] fix php warnings --- htdocs/societe/project.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index d2ad361034f..1bf43864cdd 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -6,6 +6,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -129,8 +130,8 @@ if ($socid) { print dol_get_fiche_end(); $params = ''; - - $newcardbutton .= dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopage='.urlencode($backtopage), '', 1, $params); + $backtopage = $_SERVER['PHP_SELF'].'?socid='.$object->id; + $newcardbutton = dolGetButtonTitle($langs->trans("NewProject"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?action=create&socid='.$object->id.'&backtopage='.urlencode($backtopage), '', 1, $params); print '
'; From 68b8a6a916650dd90028d6345579ad66581947fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 16:35:49 +0200 Subject: [PATCH 574/739] css --- htdocs/compta/paiement/card.php | 2 +- htdocs/core/boxes/box_clients.php | 2 +- htdocs/core/boxes/box_ficheinter.php | 2 +- htdocs/core/boxes/box_goodcustomers.php | 2 +- htdocs/core/boxes/box_prospect.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index c971ccbf4fd..2b65ad4a84a 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -392,7 +392,7 @@ if ($resql) { print "\n"; // Third party - print ''; + print ''; print $thirdpartystatic->getNomUrl(1); print ''; diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index df56b510823..3c83d7521f2 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -128,7 +128,7 @@ class box_clients extends ModeleBoxes $thirdpartystatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax150"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index edf4daa5191..7179be0cfbb 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -138,7 +138,7 @@ class box_ficheinter extends ModeleBoxes ); $this->info_box_contents[$i][] = array( - 'td' => 'class="tdoverflowmax150 maxwidth150onsmartphone"', + 'td' => 'class="tdoverflowmax150"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index aef7cdc9f3d..ab425ceac87 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -120,7 +120,7 @@ class box_goodcustomers extends ModeleBoxes $nbimpaye = $objp->nbfact - $objp->nbfactpaye; $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax150"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index a8959202082..7489cc997ea 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -129,7 +129,7 @@ class box_prospect extends ModeleBoxes $thirdpartystatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax150"', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); From 5ad999e46de0dc5c0a2498391f691ccb27517d17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 16:39:30 +0200 Subject: [PATCH 575/739] css --- htdocs/core/boxes/box_actions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index 45c9d580ad2..121137fd1a6 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -148,14 +148,14 @@ class box_actions extends ModeleBoxes $label = empty($objp->label) ? $objp->type_label : $objp->label; $this->info_box_contents[$line][0] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax200"', 'text' => $actionstatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1 ); $this->info_box_contents[$line][1] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax100"', 'text' => ($societestatic->id > 0 ? $societestatic->getNomUrl(1) : ''), 'asis' => 1 ); From f486595e13ef66dd16994d60f3dd5199b35d10c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 16:55:22 +0200 Subject: [PATCH 576/739] Fix dolSqlDateFilter --- htdocs/core/lib/date.lib.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 0dde3a93159..864fea050a0 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -294,32 +294,35 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l /** - * Generate a SQL string to make a filter into a range (for second of date until last second of date) + * Generate a SQL string to make a filter into a range (for second of date until last second of date). + * This method allows to maje SQL request that will deal correctly the timezone of server. * * @param string $datefield Name of SQL field where apply sql date filter * @param int $day_date Day date * @param int $month_date Month date * @param int $year_date Year date * @param int $excludefirstand Exclude first and + * @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ, * @return string $sqldate String with SQL filter */ -function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0) +function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm = false) { global $db; $sqldate = ""; if ($month_date > 0) { if ($year_date > 0 && empty($day_date)) { - $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, $month_date, false)); - $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, $month_date, false))."'"; + $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, $month_date, $gm)); + $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, $month_date, $gm))."'"; } elseif ($year_date > 0 && !empty($day_date)) { - $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); - $sqldate .= "' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date))."'"; + $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date, $gm)); + $sqldate .= "' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date, $gm))."'"; } else { + // This case is not reliable on TZ, but we should not need it. $sqldate .= ($excludefirstand ? "" : " AND ")." date_format( ".$datefield.", '%c') = '".$db->escape($month_date)."'"; } } elseif ($year_date > 0) { - $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, 1, false)); - $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, 12, false))."'"; + $sqldate .= ($excludefirstand ? "" : " AND ").$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, 1, $gm)); + $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, 12, $gm))."'"; } return $sqldate; } From c820193d11b6e7d775659913eba638d2d68f2a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 17:01:41 +0200 Subject: [PATCH 577/739] remove not used var and fix php warnings --- htdocs/admin/agenda_extsites.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 9ce55583d99..272da835741 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -3,6 +3,7 @@ * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -158,14 +159,6 @@ print dol_get_fiche_head($head, 'extsites', $langs->trans("Agenda"), -1, 'action print ''.$langs->trans("AgendaExtSitesDesc")."
\n"; print "
\n"; - -$selectedvalue = $conf->global->AGENDA_DISABLE_EXT; -if ($selectedvalue == 1) { - $selectedvalue = 0; -} else { - $selectedvalue = 1; -} - print ""; print ""; @@ -226,15 +219,15 @@ while ($i <= $MAXAGENDA) { // Nb print '"; // Name - print ''; + print ''; // URL - print ''; + print ''; // Offset TZ - print ''; + print ''; // Color (Possible colors are limited by Google) print ''; print ""; $i++; From d4fc23678a17907af58594e42935bec9f3ec19ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 17:12:18 +0200 Subject: [PATCH 578/739] Add phpunit test for dolSqlDateFilter() --- test/phpunit/DateLibTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 7ff09de495e..7c6cda9f997 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -528,4 +528,26 @@ class DateLibTest extends PHPUnit\Framework\TestCase return 1; } + + /** + * testDolSqlDateFilter + * + * @return int + */ + public function testDolSqlDateFilter() + { + global $conf; + + $result = dolSqlDateFilter('field1', 0, 0, 1970, 0); + print __METHOD__." result = ".$result."\n"; + $this->assertEquals(" AND field1 BETWEEN '1970-01-01 00:00:00' AND '1970-12-31 23:59:59'", $result, 'Test dolSqlDateFilter 1'); + + /* If server/company is in TZ America/Bahia, and we need range with a date set in GMT + $result = dolSqlDateFilter('field1', 0, 0, 1970, 0, 'gmt'); + print __METHOD__." result = ".$result."\n"; + $this->assertEquals(" AND field1 BETWEEN '1969-12-31 21:00:00' AND '1970-12-31 20:59:59'", $result, 'Test dolSqlDateFilter 2'); + */ + + return 1; + } } From cfd7c610db7d1ae960c8e601be519c2348752f41 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sun, 20 Jun 2021 17:14:28 +0200 Subject: [PATCH 579/739] Use dolSqlDateFilter instead of SQL function YEAR --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index ea106e4b4c5..bf8cf92bc33 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE YEAR(p.dateadh) = ".((int) $year); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From 65110411ac40d76da0aeb901233b875329c124a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 17:20:12 +0200 Subject: [PATCH 580/739] Doc --- htdocs/core/lib/date.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 864fea050a0..fe21071901a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -302,7 +302,8 @@ function convertSecondToTime($iSecond, $format = 'all', $lengthOfDay = 86400, $l * @param int $month_date Month date * @param int $year_date Year date * @param int $excludefirstand Exclude first and - * @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ, + * @param mixed $gm False or 0 or 'tzserver' = Input date fields are date info in the server TZ. True or 1 or 'gmt' = Input are date info in GMT TZ. + * Note: In database, dates are always fot the server TZ. * @return string $sqldate String with SQL filter */ function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm = false) From 002471b1fe1177c81bfa4cefd36707dbf3bf12f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Jun 2021 17:25:58 +0200 Subject: [PATCH 581/739] Update adherentstats.class.php --- htdocs/adherents/class/adherentstats.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index bf8cf92bc33..cfa83290551 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -92,7 +92,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -133,7 +133,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -154,7 +154,7 @@ class AdherentStats extends Stats $sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")"; $sql .= " FROM ".$this->from; //if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, $year, 1); + $sql .= " WHERE ".dolSqlDateFilter('p.dateadh', 0, 0, (int) $year, 1); $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); From 40afa5b1cc6e4f0cd294c304aa143835291c7a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 18:21:10 +0200 Subject: [PATCH 582/739] fix warning there is already an array called $option --- htdocs/admin/syslog.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index dfdc53e0f18..a0454a5c8b2 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -180,8 +180,8 @@ if (!$defaultsyslogfacility) { if (!$defaultsyslogfile) { $defaultsyslogfile = 'dolibarr.log'; } - -if ($conf->global->MAIN_MODULE_MULTICOMPANY && $user->entity) { +$optionmc = ''; +if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) { print '
'.$langs->trans("ContactSuperAdminForChange").'
'; $option = 'disabled'; } @@ -199,7 +199,7 @@ print ''; print '
'.$langs->trans("AgendaExtNb", $key)."'; //print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist); - print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : $conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); + print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key) ?GETPOST("AGENDA_EXT_COLOR".$key) : getDolGlobalString($color)), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset'); print '
'; print ''; print ''; -print ''; +print ''; print "\n"; foreach ($syslogModules as $moduleName) { From cff5edd6047b9173bef737c9a40ccffdfff536ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 18:24:00 +0200 Subject: [PATCH 583/739] Update syslog.php --- htdocs/admin/syslog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index a0454a5c8b2..7a885c0b74f 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -279,11 +279,11 @@ print ''; print '
'.$langs->trans("Type").''.$langs->trans("Value").'
'; print ''; print ''; -print ''; +print ''; print "\n"; print ''; -print ''; print ''."\n"; print ''; -// Example with a yes / no select +/* No more need for this, you can set that a profile is public when saving it. print ''; print ''; print ''; print ''; +*/ print ''; print ''; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index d352b996ef2..991e3cb37cc 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -110,7 +110,7 @@ class FormOther * @param string $htmlname Nom de la zone select * @param string $type Type des modeles recherches * @param int $useempty Show an empty value in list - * @param int $fk_user User that has created the template (this is set to null to get all export model when EXPORTS_SHARE_MODELS is on) + * @param int $fk_user User we want templates * @return void */ public function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null) @@ -121,8 +121,8 @@ class FormOther $sql = "SELECT rowid, label, fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; $sql .= " WHERE type = '".$this->db->escape($type)."'"; - if (!empty($fk_user)) { - $sql .= " AND fk_user IN (0, ".$fk_user.")"; // An export model + if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner. + $sql .= " AND fk_user IN (0, ".((int) $fk_user).")"; } $sql .= " ORDER BY label"; $result = $this->db->query($sql); @@ -132,6 +132,8 @@ class FormOther print ''; } + $tmpuser = new User($this->db); + $num = $this->db->num_rows($result); $i = 0; while ($i < $num) { @@ -140,8 +142,7 @@ class FormOther $label = $obj->label; if ($obj->fk_user == 0) { $label .= ' ('.$langs->trans("Everybody").')'; - } elseif (!empty($conf->global->EXPORTS_SHARE_MODELS) && empty($fk_user) && is_object($user) && $user->id != $obj->fk_user) { - $tmpuser = new User($this->db); + } elseif ($obj->fk_user > 0) { $tmpuser->fetch($obj->fk_user); $label .= ' ('.$tmpuser->getFullName($langs).')'; } @@ -171,7 +172,7 @@ class FormOther * @param string $htmlname Nom de la zone select * @param string $type Type des modeles recherches * @param int $useempty Affiche valeur vide dans liste - * @param int $fk_user User that has created the template (this is set to null to get all export model when EXPORTS_SHARE_MODELS is on) + * @param int $fk_user User that has created the template * @return void */ public function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0, $fk_user = null) @@ -182,10 +183,10 @@ class FormOther $sql = "SELECT rowid, label, fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."import_model"; $sql .= " WHERE type = '".$this->db->escape($type)."'"; - if (!empty($fk_user)) { - $sql .= " AND fk_user IN (0, ".$fk_user.")"; // An export model + if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner. + $sql .= " AND fk_user IN (0, ".((int) $fk_user).")"; } - $sql .= " ORDER BY rowid"; + $sql .= " ORDER BY label"; $result = $this->db->query($sql); if ($result) { print ''; print '
'; print ''.$langs->trans("SelectExportFields").' '; - if (empty($conf->global->EXPORTS_SHARE_MODELS)) { - $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); - } else { - $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1); - } + $htmlother->select_export_model($exportmodelid, 'exportmodelid', $datatoexport, 1, $user->id); print ' '; print ''; print '
'; @@ -1007,20 +1004,28 @@ if ($step == 4 && $datatoexport) { print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("SyslogLevel").''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -166,7 +166,7 @@ class doc_generic_user_odt extends ModelePDFUser if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { // Model for creation $list = ModelePDFUser::liste_modeles($this->db); $texte .= ''; From 9ee95562004e35f4582609dd62fa6179607a9e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 18:37:43 +0200 Subject: [PATCH 585/739] Update user.php --- htdocs/admin/user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 6d8cfe21f00..da3a1913d64 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -268,7 +268,7 @@ foreach ($dirmodels as $reldir) { // Defaut print '\n"; /* - echo '
'; - echo '
'; - echo '
'; - echo show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, -1); - echo '
'."\n"; - echo "
\n"; - */ + echo '
'; + echo '
'; + echo '
'; + echo show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, -1); + echo '
'."\n"; + echo "
\n"; + */ echo '
'; - if ($conf->global->USER_ADDON_PDF == $name) { + if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; From c9c3cef5d768830cad64496c16d2a629fb32d493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 20 Jun 2021 20:15:19 +0200 Subject: [PATCH 586/739] Update syslog.php --- htdocs/admin/syslog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 7a885c0b74f..10b3d1bd47b 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -183,7 +183,7 @@ if (!$defaultsyslogfile) { $optionmc = ''; if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) { print '
'.$langs->trans("ContactSuperAdminForChange").'
'; - $option = 'disabled'; + $optionmc = 'disabled'; } From c8326c1365a54f060c7a5358219df6cc3ff6feb5 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 20 Jun 2021 21:55:48 +0200 Subject: [PATCH 587/739] FIX Accoutancy Limit date payment not register on purchases operations --- htdocs/accountancy/journal/purchasesjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 42bff74097f..5238ee993e1 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -92,7 +92,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); } -$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; +$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; From 0dc16b135d27d30c546808ddcd7c3df1924a7b34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 00:05:01 +0200 Subject: [PATCH 588/739] FIX allow disabling of a module (not dangerous) even if pb with token. --- htdocs/admin/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 56b6e6e1f01..674cbbf52f5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -28,7 +28,7 @@ * \brief Page to activate/disable all modules */ -if (!defined('CSRFCHECK_WITH_TOKEN')) { +if (!defined('CSRFCHECK_WITH_TOKEN') && (empty($_GET['action']) || $_GET['action'] != 'reset')) { // We do not force security to disable modules so we can do it if problem define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET } From 9fd06537b7961c1594d1d0c60fa55aa7bce95575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 21 Jun 2021 10:42:20 +0200 Subject: [PATCH 589/739] move admin warnings on top instead bottom --- htdocs/index.php | 62 +++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 7eaf517b321..0f457b0f40b 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -101,7 +102,36 @@ if (!empty($conf->global->MAIN_MOTD)) { } } +/* + * Show security warnings + */ +// Security warning repertoire install existe (si utilisateur admin) +if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) { + $message = ''; + + // Check if install lock file is present + $lockfile = DOL_DATA_ROOT.'/install.lock'; + if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) { + $langs->load("errors"); + //if (! empty($message)) $message.='
'; + $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); + } + + // Conf files must be in read only mode + if (is_writable($conffile)) { + $langs->load("errors"); + //$langs->load("other"); + //if (! empty($message)) $message.='
'; + $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); + } + + if ($message) { + print $message; + //$message.='
'; + //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); + } +} /* * Dashboard Dolibarr states (statistics) @@ -722,38 +752,6 @@ print $boxlist; print ''; - -/* - * Show security warnings - */ - -// Security warning repertoire install existe (si utilisateur admin) -if ($user->admin && empty($conf->global->MAIN_REMOVE_INSTALL_WARNING)) { - $message = ''; - - // Check if install lock file is present - $lockfile = DOL_DATA_ROOT.'/install.lock'; - if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) { - $langs->load("errors"); - //if (! empty($message)) $message.='
'; - $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); - } - - // Conf files must be in read only mode - if (is_writable($conffile)) { - $langs->load("errors"); - //$langs->load("other"); - //if (! empty($message)) $message.='
'; - $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); - } - - if ($message) { - print $message; - //$message.='
'; - //print info_admin($langs->trans("WarningUntilDirRemoved",DOL_DOCUMENT_ROOT."/install")); - } -} - //print 'mem='.memory_get_usage().' - '.memory_get_peak_usage(); // End of page From 59a7d5b89d1ed250bb91cab2c1fe0a7b4197a604 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 11:13:30 +0200 Subject: [PATCH 590/739] Introduce option MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL --- htdocs/core/lib/functions.lib.php | 35 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 531af8fe73a..20b944b4da2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5867,36 +5867,41 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } // Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. - // Not supported + // 'VATRULE 3' - Not supported // Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise) alors TVA par defaut=0. Fin de regle // Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle if (($seller_in_cee && $buyer_in_cee)) { $isacompany = $thirdparty_buyer->isACompany(); - if ($isacompany) { - if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - if (!isValidVATID($thirdparty_buyer)) { - //print 'VATRULE 6'; - return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); - } + if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + if (!isValidVATID($thirdparty_buyer)) { + $isacompany = 0; } - //print 'VATRULE 3'; - return 0; - } else { + } + + if (!$isacompany) { //print 'VATRULE 4'; return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + } else { + //print 'VATRULE 5'; + return 0; } } - // Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle - if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) { - return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + // Si (vendeur dans Communaute europeene et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle + // I don't see any use case that need this rule + if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee)) { + $isacompany = $thirdparty_buyer->isACompany(); + if (!$isacompany) { + return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice); + //print 'VATRULE extra'; + } } // Sinon la TVA proposee par defaut=0. Fin de regle. // Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe - //print 'VATRULE 5'; + //print 'VATRULE 6'; return 0; } From 5bfd82e5284211673f9030953a096354d3e0f97d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 11:23:53 +0200 Subject: [PATCH 591/739] Clean code --- ChangeLog | 1 + htdocs/core/lib/company.lib.php | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fdb321822f..ef4f01d84c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -225,6 +225,7 @@ Following changes may create regressions for some external modules, but were nec * If your database is MySQL or MariaDB, you need at least version 5.1 * Function set_price_level() has been renamed into setPriceLevel() to follow camelcase rules * removed deprecated subtituion key __REFCLIENT__ (replaced with __REF_CLIENT__) +* Removed constant MAIN_COUNTRIES_IN_EEC. You can now set if country is in Europe or not from the dictionary of countries. ***** ChangeLog for 13.0.3 compared to 13.0.2 ***** diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f6d07e32f01..21b6f9a68e4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -715,10 +715,7 @@ function getCountriesInEEC() global $conf, $db; $country_code_in_EEC = array(); - if (!empty($conf->global->MAIN_COUNTRIES_IN_EEC)) { - // For example MAIN_COUNTRIES_IN_EEC = 'AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,NL,HU,IE,IM,IT,LT,LU,LV,MC,MT,PL,PT,RO,SE,SK,SI,UK' - $country_code_in_EEC = explode(',', $conf->global->MAIN_COUNTRIES_IN_EEC); - } elseif (!empty($conf->cache['country_code_in_EEC'])) { + if (!empty($conf->cache['country_code_in_EEC'])) { // Use of cache to reduce number of database requests $country_code_in_EEC = $conf->cache['country_code_in_EEC']; } else { From bb8d5cec1b88759e06d6642c20d2f0f65b55b3fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 11:36:28 +0200 Subject: [PATCH 592/739] More complete management of MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL --- htdocs/core/lib/functions.lib.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20b944b4da2..fed3f697cb6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5811,12 +5811,12 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller) /** * Function that return vat rate of a product line (according to seller, buyer and product vat rate) - * Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. - * Si le (pays vendeur = pays acheteur) alors TVA par defaut=TVA du produit vendu. Fin de regle. - * Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. - * Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier ou entreprise sans num TVA intra) alors TVA par defaut=TVA du produit vendu. Fin de regle - * Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise avec num TVA) intra alors TVA par defaut=0. Fin de regle - * Sinon TVA proposee par defaut=0. Fin de regle. + * VATRULE 1: Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. + * VATRULE 2: Si le (pays vendeur = pays acheteur) alors TVA par defaut=TVA du produit vendu. Fin de regle. + * VATRULE 3: Si (vendeur et acheteur dans Communaute europeenne) et (bien vendu = moyen de transports neuf comme auto, bateau, avion) alors TVA par defaut=0 (La TVA doit etre paye par acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. + * VATRULE 4: Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle + * VATRULE 5: Si (vendeur et acheteur dans Communaute europeenne) et (acheteur = entreprise) alors TVA par defaut=0. Fin de regle + * VATRULE 6: Sinon TVA proposee par defaut=0. Fin de regle. * * @param Societe $thirdparty_seller Objet societe vendeuse * @param Societe $thirdparty_buyer Objet societe acheteuse @@ -5845,9 +5845,19 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) // we use the buyer VAT. if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) { - if ($seller_in_cee && $buyer_in_cee && !$thirdparty_buyer->isACompany()) { - //print 'VATRULE 0'; - return get_product_vat_for_country($idprod, $thirdparty_buyer, $idprodfournprice); + if ($seller_in_cee && $buyer_in_cee) { + $isacompany = $thirdparty_buyer->isACompany(); + if ($isacompany && !empty($conf->global->MAIN_USE_VAT_COMPANIES_IN_EEC_WITH_INVALID_VAT_ID_ARE_INDIVIDUAL)) { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + if (!isValidVATID($thirdparty_buyer)) { + $isacompany = 0; + } + } + + if (!$isacompany) { + //print 'VATRULE 0'; + return get_product_vat_for_country($idprod, $thirdparty_buyer, $idprodfournprice); + } } } @@ -5890,7 +5900,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } // Si (vendeur dans Communaute europeene et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle - // I don't see any use case that need this rule + // I don't see any use case that need this rule. if (!empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee)) { $isacompany = $thirdparty_buyer->isACompany(); if (!$isacompany) { From ab2e50ef49d9b20d98a3a0dffcd6752940564538 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 12:46:03 +0200 Subject: [PATCH 593/739] Fix css --- htdocs/comm/action/index.php | 62 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 465f1be8701..d619fafe850 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -363,9 +363,9 @@ if ($action == 'show_day') { //print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour'); /*$title = $langs->trans("DoneAndToDoActions"); -if ($status == 'done') $title = $langs->trans("DoneActions"); -if ($status == 'todo') $title = $langs->trans("ToDoActions"); -*/ + if ($status == 'done') $title = $langs->trans("DoneActions"); + if ($status == 'todo') $title = $langs->trans("ToDoActions"); + */ $param = ''; if ($actioncode || GETPOSTISSET('search_actioncode')) { @@ -454,13 +454,13 @@ $param .= '&year='.$year.'&month='.$month.($day ? '&day='.$day : ''); /*$tabactive = ''; -if ($action == 'show_month') $tabactive = 'cardmonth'; -if ($action == 'show_week') $tabactive = 'cardweek'; -if ($action == 'show_day') $tabactive = 'cardday'; -if ($action == 'show_list') $tabactive = 'cardlist'; -if ($action == 'show_pertuser') $tabactive = 'cardperuser'; -if ($action == 'show_pertype') $tabactive = 'cardpertype'; -*/ + if ($action == 'show_month') $tabactive = 'cardmonth'; + if ($action == 'show_week') $tabactive = 'cardweek'; + if ($action == 'show_day') $tabactive = 'cardday'; + if ($action == 'show_list') $tabactive = 'cardlist'; + if ($action == 'show_pertuser') $tabactive = 'cardperuser'; + if ($action == 'show_pertype') $tabactive = 'cardpertype'; + */ $paramnoaction = preg_replace('/action=[a-z_]+/', '', $param); $paramnoactionodate = preg_replace('/action=[a-z_]+/', '', $paramnodate); @@ -502,14 +502,12 @@ $viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="p //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewDay").''; -$viewmode .= ''; +$viewmode .= ''; //$viewmode .= ''; $viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"'); //$viewmode .= ''; $viewmode .= ''.$langs->trans("ViewPerUser").''; -$viewmode .= ''; - // Add more views from hooks $parameters = array(); $object = null; $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); @@ -519,6 +517,8 @@ if (empty($reshook)) { $viewmode = $hookmanager->resPrint; } +$viewmode .= ''; // To add a space before the navigation tools + $newcardbutton = ''; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { @@ -925,13 +925,13 @@ if ($showbirthday) { $eventarray[$daykey][] = $event; /*$loop = true; - $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); - do { - $eventarray[$daykey][] = $event; - $daykey += 60 * 60 * 24; - if ($daykey > $event->date_end_in_calendar) $loop = false; - } while ($loop); - */ + $daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee); + do { + $eventarray[$daykey][] = $event; + $daykey += 60 * 60 * 24; + if ($daykey > $event->date_end_in_calendar) $loop = false; + } while ($loop); + */ $i++; } } else { @@ -1543,13 +1543,13 @@ if (empty($action) || $action == 'show_month') { // View by month echo "
'; print ''; @@ -1793,10 +1793,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { if ($user->rights->agenda->allactions->create || (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { - $cssclass .= " movable cursormove"; - } else { - $cssclass .= " unmovable"; - } + $cssclass .= " movable cursormove"; + } else { + $cssclass .= " unmovable"; + } } $h = ''; $nowrapontd = 1; From aca190d97723be3310aef5c26da7909a776eb0ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 12:46:24 +0200 Subject: [PATCH 594/739] Fix css --- htdocs/comm/action/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index d619fafe850..9b76329d8da 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1794,9 +1794,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($user->rights->agenda->allactions->create || (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { $cssclass .= " movable cursormove"; - } else { - $cssclass .= " unmovable"; - } + } else { + $cssclass .= " unmovable"; + } } $h = ''; $nowrapontd = 1; From ac8564dc34f3df651970e31873ab1371b809689b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 13:06:40 +0200 Subject: [PATCH 595/739] Fix disable token renewal on .css.php, .js.php and .json.php --- htdocs/main.inc.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 437e024a3ae..2301ca75161 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -413,15 +413,17 @@ if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VE } // Creation of a token against CSRF vulnerabilities -if (!defined('NOTOKENRENEWAL')) -{ - // Rolling token at each call ($_SESSION['token'] contains token of previous page) - if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; +if (!defined('NOTOKENRENEWAL')) { + // No token renewal on .css.php, .js.php and .json.php + if (!preg_match('/\.(css|js|json)\.php$/', $_SERVER["PHP_SELF"])) { + // Rolling token at each call ($_SESSION['token'] contains token of previous page) + if (isset($_SESSION['newtoken'])) $_SESSION['token'] = $_SESSION['newtoken']; - // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] - $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number - $_SESSION['newtoken'] = $token; - dol_syslog("NEW TOKEN reclaimed by : " . $_SERVER['PHP_SELF'], LOG_DEBUG); + // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] + $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number + $_SESSION['newtoken'] = $token; + dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG); + } } //dol_syslog("aaaa - ".defined('NOCSRFCHECK')." - ".$dolibarr_nocsrfcheck." - ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN." - ".$_SERVER['REQUEST_METHOD']." - ".GETPOST('token', 'alpha').' '.$_SESSION['token']); From 5697e86c090b98b051b57cdf6022200a51dd597a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 14:11:59 +0200 Subject: [PATCH 596/739] Fix columns for export/import profile --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 9 ++++++--- htdocs/install/mysql/tables/llx_export_model.sql | 2 +- htdocs/install/mysql/tables/llx_import_model.sql | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index deb40d9c7fd..8caf6e9a401 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -67,9 +67,6 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); -ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64); - - INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 11, 'US-BASE', 'USA basic chart of accounts', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 14, 'CA-ENG-BASE', 'Canadian basic chart of accounts - English', 1); INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 154, 'SAT/24-2019', 'Catalogo y codigo agrupador fiscal del 2019', 1); @@ -84,6 +81,12 @@ DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', ' -- For v14 +ALTER TABLE llx_import_model MODIFY COLUMN type varchar(64); +ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64); + +ALTER TABLE llx_import_model ADD COLUMN entity integer DEFAULT 0 NOT NULL; +ALTER TABLE llx_export_model ADD COLUMN entity integer DEFAULT 0 NOT NULL; + ALTER TABLE llx_product_lot ADD COLUMN eol_date datetime NULL; ALTER TABLE llx_product_lot ADD COLUMN manufacturing_date datetime NULL; ALTER TABLE llx_product_lot ADD COLUMN scrapping_date datetime NULL; diff --git a/htdocs/install/mysql/tables/llx_export_model.sql b/htdocs/install/mysql/tables/llx_export_model.sql index 7e68eab4ad5..cfdb2fdc530 100644 --- a/htdocs/install/mysql/tables/llx_export_model.sql +++ b/htdocs/install/mysql/tables/llx_export_model.sql @@ -22,10 +22,10 @@ create table llx_export_model ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 0, -- by default on all entities for compatibility fk_user integer DEFAULT 0 NOT NULL, label varchar(50) NOT NULL, type varchar(64) NOT NULL, field text NOT NULL, filter text - )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_import_model.sql b/htdocs/install/mysql/tables/llx_import_model.sql index 2a110a2d80a..ceb3ae9f323 100644 --- a/htdocs/install/mysql/tables/llx_import_model.sql +++ b/htdocs/install/mysql/tables/llx_import_model.sql @@ -21,8 +21,9 @@ create table llx_import_model ( rowid integer AUTO_INCREMENT PRIMARY KEY, + entity integer DEFAULT 0 NOT NULL, -- by default on all entities for compatibility fk_user integer DEFAULT 0 NOT NULL, label varchar(50) NOT NULL, - type varchar(50) NOT NULL, + type varchar(64) NOT NULL, field text NOT NULL )ENGINE=innodb; From 31db1dc412549476fd2713f0be0628f5676c6f30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 15:03:45 +0200 Subject: [PATCH 597/739] Fix management of visibility of export/import templates. --- htdocs/admin/export.php | 3 +- htdocs/core/class/html.formother.class.php | 24 +++++++------- htdocs/exports/class/export.class.php | 8 ++--- htdocs/exports/export.php | 37 +++++++++++++++------- htdocs/imports/class/import.class.php | 19 +++++++++-- htdocs/imports/import.php | 34 +++++++++++++++++--- 6 files changed, 89 insertions(+), 36 deletions(-) diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php index b83b15571b8..9b154e88789 100644 --- a/htdocs/admin/export.php +++ b/htdocs/admin/export.php @@ -86,13 +86,14 @@ print '
 
'.$langs->trans("EXPORTS_SHARE_MODELS").' '; print ajax_constantonoff('EXPORTS_SHARE_MODELS'); print '
'.$langs->trans("ExportCsvSeparator").'
'; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; + print ''; + $tmpuser = new User($db); + // List of existing export profils - $sql = "SELECT rowid, label"; + $sql = "SELECT rowid, label, fk_user, entity"; $sql .= " FROM ".MAIN_DB_PREFIX."export_model"; $sql .= " WHERE type = '".$db->escape($datatoexport)."'"; - if (empty($conf->global->EXPORTS_SHARE_MODELS)) { - $sql .= " AND fk_user=".$user->id; + if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner. + $sql .= " AND fk_user IN (0, ".((int) $user->id).")"; } $sql .= " ORDER BY rowid"; $resql = $db->query($sql); @@ -1029,9 +1034,19 @@ if ($step == 4 && $datatoexport) { $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); + print ''; + print ''; + print ''; } else { print ''; @@ -157,7 +164,9 @@ $coldisplay++; $coldisplay++; print ''; if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { @@ -176,12 +185,14 @@ $coldisplay++;
'.$langs->trans("ExportModelName").' '.$langs->trans("Visibility").'
'; + print ''; + $arrayvisibility = array('private'=>$langs->trans("Private"), 'all'=>$langs->trans("Everybody")); + print $form->selectarray('visibility', $arrayvisibility, 'private'); + print ''; print ''; print '
'; print $obj->label; - print ''; + print ''; + if (empty($obj->fk_user)) { + print $langs->trans("Everybody"); + } else { + $tmpuser->fetch($obj->fk_user); + print $tmpuser->getNomUrl(1); + } + print ''; print 'rowid.'">'; print img_delete(); print ''; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 567aaf754a8..44ec5935d49 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -55,6 +55,12 @@ class Import */ public $errors = array(); + // To store import templates + public $hexa; // List of fields in the export profile + public $datatoimport; + public $model_name; // Name of export profile + public $fk_user; + /** * Constructor @@ -266,11 +272,18 @@ class Import $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'import_model ('; - $sql .= 'fk_user, label, type, field'; + $sql .= 'fk_user,'; + $sql .= ' label,'; + $sql .= ' type,'; + $sql .= ' field'; $sql .= ')'; - $sql .= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->db->escape($this->datatoimport)."', '".$this->db->escape($this->hexa)."')"; + $sql .= " VALUES ("; + $sql .= (isset($this->fk_user) ? (int) $this->fk_user : 'null').","; + $sql .= " '".$this->db->escape($this->model_name)."',"; + $sql .= " '".$this->db->escape($this->datatoimport)."',"; + $sql .= " '".$this->db->escape($this->hexa)."'"; + $sql .= ")"; - dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $this->db->commit(); diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 20a846123f1..4c5975ecb43 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -226,6 +226,7 @@ if ($action == 'add_import_model') { $objimport->model_name = $import_name; $objimport->datatoimport = $datatoimport; $objimport->hexa = $hexa; + $objimport->fk_user = (GETPOST('visibility', 'aZ09') == 'all' ? 0 : $user->id); $result = $objimport->create($user); if ($result >= 0) { @@ -968,7 +969,7 @@ if ($step == 4 && $datatoimport) { $s = str_replace('{s1}', img_picto('', 'grip_title', '', false, 0, 0, '', '', 0), $s); print $s; print ' '; - $htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1); + $htmlother->select_import_model($importmodelid, 'importmodelid', $datatoimport, 1, $user->id); print ''; print ''; print ''; @@ -1249,28 +1250,51 @@ if ($step == 4 && $datatoimport) { print ''; print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; + print ''; + print ''; // List of existing import profils - $sql = "SELECT rowid, label"; + $sql = "SELECT rowid, label, fk_user, entity"; $sql .= " FROM ".MAIN_DB_PREFIX."import_model"; $sql .= " WHERE type = '".$db->escape($datatoimport)."'"; + if (empty($conf->global->EXPORTS_SHARE_MODELS)) { // EXPORTS_SHARE_MODELS means all templates are visible, whatever is owner. + $sql .= " AND fk_user IN (0, ".((int) $user->id).")"; + } $sql .= " ORDER BY rowid"; + $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); + + $tmpuser = new user($db); + $i = 0; while ($i < $num) { $obj = $db->fetch_object($resql); + print ''; + print ''; + print ''; print ''; print ''; print '
'.$langs->trans("ImportModelName").' '.$langs->trans("Visibility").'
'; + print ''; + $arrayvisibility = array('private'=>$langs->trans("Private"), 'all'=>$langs->trans("Everybody")); + print $form->selectarray('visibility', $arrayvisibility, 'private'); + print ''; print ''; print '
'; print $obj->label; - print ''; + print ''; + if (empty($obj->fk_user)) { + print $langs->trans("Everybody"); + } else { + $tmpuser->fetch($obj->fk_user); + print $tmpuser->getNomUrl(1); + } + print ''; print 'rowid.'&filetoimport='.urlencode($filetoimport).'">'; print img_delete(); print ''; From f48b2812a3d263da54e08818168e8f68a1e9d5be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 15:26:14 +0200 Subject: [PATCH 598/739] Doc --- ChangeLog | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef4f01d84c7..98c22d90bf7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -64,7 +64,7 @@ NEW: VAT payment request and VAT payment are now 2 different steps in workflow o NEW: VAT report - Optimisation & collapse by rate NEW: When a doc file is shared, link is visible from the main page of doc. NEW: #16378 more E-Mail Contact substitution Values for better salutation -NEW: option to keep the "Automatically create a total payment" checkbox empty on the tax creation page +NEW: option to keep the "Automatically create the payment" checkbox empty on the tax creation page Accountancy NEW: Accountancy - Add FEC import @@ -285,7 +285,6 @@ FIX: test must be === and not == FIX: test on link type FIX: type link extrafield case for advanced target emailing FIX: Write right on document ->>>>>>> branch '13.0' of git@github.com:Dolibarr/dolibarr.git ***** ChangeLog for 13.0.2 compared to 13.0.1 ***** From 05bb2c720d06501eb6e744996201e0b9c5b0bd7e Mon Sep 17 00:00:00 2001 From: damien clochard Date: Mon, 21 Jun 2021 18:24:52 +0200 Subject: [PATCH 599/739] FIX #17996: Avoid implicit type casts for llx_adherent_type.subscription The llx_adherent_type.subscription column is VARCHAR so we need to compare it with a string, not an int. --- htdocs/adherents/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7a4a7d5bc1f..d669270b565 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -363,13 +363,13 @@ if ($search_type > 0) { $sql .= " AND t.rowid=".((int) $search_type); } if ($search_filter == 'withoutsubscription') { - $sql .= " AND (datefin IS NULL OR t.subscription = 0)"; + $sql .= " AND (datefin IS NULL OR t.subscription = '0')"; } if ($search_filter == 'uptodate') { - $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = 0)"; + $sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = '0')"; } if ($search_filter == 'outofdate') { - $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; + $sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = '1')"; } if ($search_status != '') { // Peut valoir un nombre ou liste de nombre separes par virgules From a0b594fbdc5b490a99107a10903aea89d87c5a3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 21 Jun 2021 19:47:43 +0200 Subject: [PATCH 600/739] Debug emailcollector --- htdocs/admin/emailcollector_card.php | 28 +-- htdocs/core/class/commonobject.class.php | 10 +- htdocs/core/class/translate.class.php | 2 +- .../class/emailcollector.class.php | 5 +- .../template/class/myobject.class.php | 4 + test/phpunit/AllTests.php | 4 + test/phpunit/EmailCollector.php | 235 ++++++++++++++++++ 7 files changed, 269 insertions(+), 19 deletions(-) create mode 100644 test/phpunit/EmailCollector.php diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 724c4ab6dd4..4e2c9e34bf9 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -482,13 +482,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Filters - print '
'; - print ''; - print ''; + print '
'; + print '
'; + print ''; print ''; print ''; // Add filter - print ''; + print ''; print ''; echo ''; // Fields for situation invoice -if ($this->situation_cycle_ref) { +if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { print ''; print ''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8e9d72d40b4..3b4bb3cfdcb 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -132,7 +132,7 @@ if (($line->info_bits & 2) == 2) { } } } else { - $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day'; + $format = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) && $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'; if ($line->fk_product > 0) { print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); @@ -288,7 +288,7 @@ if (!empty($line->remise_percent) && $line->special_code != 3) { } // Fields for situation invoices -if ($this->situation_cycle_ref) { +if (isset($this->situation_cycle_ref) && $this->situation_cycle_ref) { include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; $coldisplay++; print ''; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index c4e8a1d7226..3ed7441afa5 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -301,3 +301,4 @@ ErrorActionCommPropertyUserowneridNotDefined=User's owner is required ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Event Type dictionary CheckVersionFail=Version check fail ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it +ErrorNotInDictionaryPaymentConditions=Not in Payment Terms Dictionary, please modify. From 796b2d201acb9938b903fb2afa297db289ecc93e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 18:17:27 +0200 Subject: [PATCH 720/739] Enhance the sanitizing. --- htdocs/core/lib/functions.lib.php | 8 ++++++-- htdocs/main.inc.php | 9 +++++---- test/phpunit/SecurityTest.php | 10 +++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e3b288aff8e..87a4b966056 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -778,8 +778,12 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = do { $oldstringtoclean = $out; - // We replace chars encoded with numeric HTML entities with real char (to avoid to have numeric entities used for obfuscation of injections) - $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+);/i', 'realCharForNumericEntities', $out); + // We replace chars from a/A to z/Z encoded with numeric HTML entities with the real char so we won't loose the chars at the next step. + // No need to use a loop here, this step is not to sanitize (this is done at next step, this is to try to save chars, even if they are + // using a non coventionnel way to be encoded, to not have them sanitized just after) + $out = preg_replace_callback('/&#(x?[0-9][0-9a-f]+;?)/i', 'realCharForNumericEntities', $out); + + // Now we remove all remaining HTML entities staring with a number. We don't want such entities. $out = preg_replace('/&#x?[0-9]+/i', '', $out); // For example if we have javascript with an entities without the ; to hide the 'a' of 'javascript'. $out = dol_string_onlythesehtmltags($out, 0, 1, 1); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 93388190275..b66b5f5b211 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -53,7 +53,7 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { /** * Return the real char for a numeric entities. - * This function is required by testSqlAndScriptInject(). + * WARNING: This function is required by testSqlAndScriptInject() and the GETPOST 'restricthtml'. Regex calling must be similar. * * @param string $matches String of numeric entity * @return string New value @@ -61,17 +61,18 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { function realCharForNumericEntities($matches) { $newstringnumentity = $matches[1]; + //print '$newstringnumentity='.$newstringnumentity; if (preg_match('/^x/i', $newstringnumentity)) { - $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity)); + $newstringnumentity = hexdec(preg_replace('/;$/', '', preg_replace('/^x/i', '', $newstringnumentity))); } - // The numeric value we don't want as entities + // The numeric value we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ? if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) { return chr((int) $newstringnumentity); } - return '&#'.$matches[1]; + return '&#'.$matches[1]; // Value will be unchanged because regex was /&#( )/ } /** diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 7e93f7673f2..08d4ec88703 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -345,7 +345,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_GET["param5"]="a_1-b"; $_POST["param6"]="">assertEquals('">', $result); $result=GETPOST("param7", 'restricthtml'); - print __METHOD__." result=".$result."\n"; - $this->assertEquals('"c:\this is a path~1\aaan" abcdef', $result); + print __METHOD__." result param7 = ".$result."\n"; + $this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef', $result); $result=GETPOST("param12", 'restricthtml'); print __METHOD__." result=".$result."\n"; @@ -488,11 +488,11 @@ class SecurityTest extends PHPUnit\Framework\TestCase $result=GETPOST("param13", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('n n > < " XSS', $result, 'Test that HTML entities are decoded with restricthtml, but only for common alpha chars'); + $this->assertEquals('n n > < " XSS', $result, 'Test 13 that HTML entities are decoded with restricthtml, but only for common alpha chars'); $result=GETPOST("param13b", 'restricthtml'); print __METHOD__." result=".$result."\n"; - $this->assertEquals('n n > < " XSS', $result, 'Test that HTML entities are decoded with restricthtml, but only for common alpha chars'); + $this->assertEquals('n n > < " XSS', $result, 'Test 13b that HTML entities are decoded with restricthtml, but only for common alpha chars'); // Special test for GETPOST of backtopage, backtolist or backtourl parameter From 7aeb652c66a7cfff1e43fbbfe8985fed14b5b770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 18:22:36 +0200 Subject: [PATCH 721/739] Better sanitizing, fix phpcs --- .../reception/doc/pdf_squille.modules.php | 3 +-- .../doc/pdf_standard_myobject.modules.php | 16 ++++++++-------- ...standard_recruitmentjobposition.modules.php | 18 +++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 2f4427d7566..68ceb87ba96 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -145,8 +145,7 @@ class pdf_squille extends ModelePdfReception $objphoto = new Product($this->db); $objphoto->fetch($object->lines[$i]->fk_product); - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) - { + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } else { diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index e5e352def43..43457d6620d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -240,14 +240,14 @@ class pdf_standard_myobject extends ModelePDFMyObject { if (empty($object->lines[$i]->fk_product)) continue; - //var_dump($objphoto->ref);exit; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; - } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative - } + //var_dump($objphoto->ref);exit; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; + } else { + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative + } $arephoto = false; foreach ($pdir as $midir) diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index 4600377ee01..4c6cb84783a 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -251,15 +251,15 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio { if (empty($object->lines[$i]->fk_product)) continue; - $objphoto->fetch($object->lines[$i]->fk_product); - //var_dump($objphoto->ref);exit; - if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; - $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; - } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default - $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative - } + $objphoto->fetch($object->lines[$i]->fk_product); + //var_dump($objphoto->ref);exit; + if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { + $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; + $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; + } else { + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default + $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative + } $arephoto = false; foreach ($pdir as $midir) From 0f020d5b203e5724b17e3e5f05c2eb0d4aa6b991 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:05:18 +0200 Subject: [PATCH 722/739] Fix for phpv8 --- htdocs/core/lib/geturl.lib.php | 2 +- htdocs/main.inc.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index f87e7b7b4cd..3398189a771 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -223,7 +223,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = // Set CURLOPT_CONNECT_TO so curl will not try another resolution that may give a different result. Possible only on PHP v7+ if (defined('CURLOPT_CONNECT_TO')) { - $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], $newUrlArray['port'], $iptocheck, $newUrlArray['port'])); + $connect_to = array(sprintf("%s:%d:%s:%d", $newUrlArray['host'], empty($newUrlArray['port'])?'':$newUrlArray['port'], $iptocheck, empty($newUrlArray['port'])?'':$newUrlArray['port'])); //var_dump($newUrlArray); //var_dump($connect_to); curl_setopt($ch, CURLOPT_CONNECT_TO, $connect_to); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b66b5f5b211..bd0d77d3389 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -60,11 +60,11 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { */ function realCharForNumericEntities($matches) { - $newstringnumentity = $matches[1]; - //print '$newstringnumentity='.$newstringnumentity; + $newstringnumentity = preg_replace('/;$/', '', $matches[1]); + //print ' $newstringnumentity='.$newstringnumentity; if (preg_match('/^x/i', $newstringnumentity)) { - $newstringnumentity = hexdec(preg_replace('/;$/', '', preg_replace('/^x/i', '', $newstringnumentity))); + $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity)); } // The numeric value we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ? From 56787bc292074f4f576b1386f1c3073a246c8971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:14:03 +0200 Subject: [PATCH 723/739] Update card.php --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 265f515233f..1f6a03ca351 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2367,7 +2367,7 @@ if (empty($reshook)) { $line = new FactureLigne($db); $line->fetch(GETPOST('lineid', 'int')); $percent = $line->get_prev_progress($object->id); - $progress = floatval(GETPOST('progress', 'int')); + $progress = price2num(GETPOST('progress', 'alpha')); if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) { // in case of situation credit note From 2860e12b6558c1bb5dfd39a1e9072b530ad70ffb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:16:29 +0200 Subject: [PATCH 724/739] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 3b4bb3cfdcb..c0339c28fc4 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -132,7 +132,7 @@ if (($line->info_bits & 2) == 2) { } } } else { - $format = (isset($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) && $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'; + $format = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 'dayhour' : 'day'); if ($line->fk_product > 0) { print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); From d379151da6a4543294f68cc70ee3f2e630fbd7af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:19:38 +0200 Subject: [PATCH 725/739] Fix doc --- test/phpunit/KnowledgeRecordTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/phpunit/KnowledgeRecordTest.php b/test/phpunit/KnowledgeRecordTest.php index fc6f385e25d..5e4d9a0d301 100644 --- a/test/phpunit/KnowledgeRecordTest.php +++ b/test/phpunit/KnowledgeRecordTest.php @@ -87,7 +87,7 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. if (empty($conf->knowledgemanagement->enabled)) { - print __METHOD__." module knowledgemanagement order must be enabled.\n"; die(1); + print __METHOD__." module knowledgemanagement must be enabled.\n"; die(1); } } From d59dfcb08a11c10323c75b2e35e424af4a02e059 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:21:35 +0200 Subject: [PATCH 726/739] Update list.php --- htdocs/accountancy/customer/list.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 5ce9f5e13e8..97d94a42f00 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -739,11 +739,13 @@ if ($result) { $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } else { - print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; - $s .= $langs->trans("NotDefined"); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { + print '
'; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $shelp = ''; + $s .= $langs->trans("NotDefined"); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); + } } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; From c74060d02cdc3da264a8c1ab4bdc5b5aa7805b6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:24:46 +0200 Subject: [PATCH 727/739] Fix lost change in merge --- htdocs/accountancy/customer/list.php | 12 +++++------- htdocs/societe/card.php | 6 ++---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 97d94a42f00..5ce9f5e13e8 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -739,13 +739,11 @@ if ($result) { $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, $ttype, '', 0, 2, '', 1); } else { - if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { - print '
'; - $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; - $shelp = ''; - $s .= $langs->trans("NotDefined"); - print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); - } + print '
'; + $s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $shelp = ''; + $s .= $langs->trans("NotDefined"); + print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
'; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a2b229147fa..8e1d03411cd 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1659,8 +1659,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, ''); print '
'; - } else // For external software - { + } else { // For external software // Accountancy_code_sell print ''; print ''; - } else // For external software - { + } else { // For external software // Accountancy_code_sell print ''; print ''; - print '\n"; - print ''; + print ''; print ""; From 94974af738d9e15edfd1f3f5397fce775aeb291a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 01:52:54 +0200 Subject: [PATCH 731/739] trans --- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index efaf99b63a9..173ec749e2a 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -202,7 +202,7 @@ $now = dol_now(); //$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord"; $help_url = ''; -$title = $langs->trans('ListOfArticles'); +$title = $langs->trans('ListKnowledgeRecord'); $morejs = array(); $morecss = array(); From f95b5be971ded339888d57099c3af77288b73538 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Jun 2021 04:55:22 +0200 Subject: [PATCH 732/739] FIX Accountancy - Clean virtual zero on the import --- htdocs/core/modules/import/import_csv.modules.php | 6 +++++- htdocs/core/modules/import/import_xlsx.modules.php | 6 +++++- htdocs/core/modules/modAccounting.class.php | 6 +++--- htdocs/core/modules/modProduct.class.php | 8 +++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 52b7af1fee5..6bec94d6130 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -624,7 +624,11 @@ class ImportCsv extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { - $newval = rtrim($newval, "0"); + if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + $newval = rtrim(trim($newval), "0"); + } else { + $newval = trim($newval); + } } //print 'Val to use as insert is '.$newval.'
'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index abc2a80abc9..0378180475d 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -665,7 +665,11 @@ class ImportXlsx extends ModeleImports } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { - $newval = rtrim($newval, "0"); + if (empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { + $newval = rtrim(trim($newval), "0"); + } else { + $newval = trim($newval); + } } //print 'Val to use as insert is '.$newval.'
'; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index f86a2078c9e..d6127f65b83 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -297,9 +297,9 @@ class modAccounting extends DolibarrModules ); $this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); - $this->import_convertvalue_array[$r]=array( - 'b.numero_compte'=>array('rule'=>'accountingaccount'), - 'b.subledger_account'=>array('rule'=>'accountingaccount') + $this->import_convertvalue_array[$r] = array( + 'b.numero_compte' => array('rule' => 'accountingaccount'), + 'b.subledger_account' => array('rule' => 'accountingaccount') ); $this->import_examplevalues_array[$r] = array( 'b.piece_num'=>'123 (!!! use next value not already used)', diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 3459973a699..37cda4b7b30 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -572,7 +572,13 @@ class modProduct extends DolibarrModules 'class' => 'CProductNature', 'method' => 'fetch', 'dict' => 'DictionaryProductNature' - ), + ), + 'p.accountancy_code_sell'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_sell_intra'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_sell_export'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_buy'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_buy_intra'=>array('rule'=>'accountingaccount'), + 'p.accountancy_code_buy_export'=>array('rule'=>'accountingaccount'), ); $this->import_regex_array[$r] = array( From dcd4d5362247db1bda448c64b6b6760108b5e5d1 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 30 Jun 2021 10:22:00 +0200 Subject: [PATCH 733/739] Fix php 8 warning in adherents list --- htdocs/adherents/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index d669270b565..1c93b247dfc 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -65,6 +65,7 @@ $search_filter = GETPOST("search_filter", 'alpha'); $search_status = GETPOST("search_status", 'intcomma'); $catid = GETPOST("catid", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); +$socid = GETPOST('socid', 'int'); $filter = GETPOST("filter", 'alpha'); if ($filter) { From 2ab97d522d523507c7fefd966c351d2945827b0d Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 30 Jun 2021 10:30:46 +0200 Subject: [PATCH 734/739] Fix php 8.0 warning societe index --- htdocs/societe/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index f5a4392a0c0..14901dc8a9c 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -185,6 +185,7 @@ $thirdpartygraph .= '
'; $thirdpartygraph .= '
'.$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'
'; $arrayoftypes = array( 'from'=>array('label'=>'MailFrom', 'data-placeholder'=>$langs->trans('SearchString')), @@ -518,7 +518,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1), 'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1) ); - print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth500', 1, '', 2); + print $form->selectarray('filtertype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1, '', 2); print "\n"; print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 056a73328dc..1d994e25177 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -305,21 +305,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index fbd219a298b..b598b95ae0a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -244,22 +244,6 @@ $title = $langs->trans('BOM'); $help_url ='EN:Module_BOM'; llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index ab8451c9e59..ec7af37940c 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -343,21 +343,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index b51823242f8..d7f7cdb8bb1 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -253,20 +253,6 @@ if ($projectid > 0) { llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; if ($projectid > 0) { // To verify role of users diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9a689c79a08..cac59593950 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -212,19 +212,19 @@ $help_url = ''; llxHeader('', $title, $help_url); // Example : Adding jquery code -print ''; +// print ''; // Part to create diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 41561a5a45b..abc8b879d33 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -386,19 +386,19 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); // Example : Adding jquery code -print ''; +// print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index fad22645cd5..b6cc502bd60 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -201,20 +201,6 @@ $title = $langs->trans('Mo')." - ".$langs->trans("Card"); llxHeader('', $title, ''); -// Example : Adding jquery code -print ''; // Part to create diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 1883517470c..731a7bcfc50 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -299,20 +299,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 79f51be6ca9..49d46c652fd 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -398,20 +398,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); -// Example : Adding jquery code -print ''; $arrayofselected = is_array($toselect) ? $toselect : array(); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 6a29a414ed7..5ec359e5d8a 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -168,20 +168,6 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks|DE:Modul_Best llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; // Part to create diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 4826dc735ef..a1e98ded601 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -305,21 +305,6 @@ $title = $langs->trans("RecruitmentCandidature"); $help_url = ''; llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - // Part to create if ($action == 'create') { diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 1caeb05095f..7a5a88bc6c4 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -348,21 +348,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 6475a60a8ed..7ccad1de16a 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -349,21 +349,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url); -// Example : Adding jquery code -print ''; - $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 2074873a031..cf4d26b2c33 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -117,22 +117,6 @@ $formfile = new FormFile($db); llxHeader('', 'WebsiteAccount', ''); -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("WebsiteAccount"))); diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 673b1db935d..5b63ca2d481 100755 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -159,7 +159,7 @@ $help_url = 'EN:Module_Workstation'; llxHeader('', $title, $help_url); -// Example : Adding jquery code +// jquery code ?> '; + $sql .= $this->db->order('ctc.pos', 'ASC'); + $resql = $this->db->query($sql); + if ($resql) { + $num_rows = $this->db->num_rows($resql); + $i = 0; + $arrayidused=array(); + while ($i < $num_rows) { + $obj = $this->db->fetch_object($resql); + if ($obj) { + $grouprowid = $obj->rowid; + $groupvalue = $obj->code; + $grouplabel = $obj->label; + $isparent = $obj->isparent; + $fatherid = $obj->fk_parent; + $arrayidused[] = $grouprowid; + $groupcodefather = $obj->codefather; + if ($isparent == 'NOTPARENT') { + $arraycodenotparent[] = $groupvalue; + } + $iselected = $groupticketchild == $obj->code ?'selected':''; + $stringtoprint .= ''; + if (empty($tabscript[$groupcodefather])) { + $tabscript[$groupcodefather] = 'if($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){ + $(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show() + console.log("We show childs tickets of '.$groupcodefather.' group ticket") + }else{ + $(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").hide() + console.log("We hide childs tickets of '.$groupcodefather.' group ticket") + }'; + } + } + $i++; + } + } else { + dol_print_error($this->db); + } + $stringtoprint .=''; + + $stringtoprint .=''; + } return $stringtoprint; } } From b83f57da4897b22406602a4f06a96d93a322afe1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:26:48 +0200 Subject: [PATCH 715/739] Fix some proposal php 8 warning --- htdocs/comm/index.php | 2 ++ htdocs/comm/propal/class/propal.class.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0a39e596ba3..9d0d9f1befc 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -65,6 +65,8 @@ $socid = GETPOST("socid", 'int'); if ($user->socid > 0) { $action = ''; $id = $user->socid; +} else { + $id = 0; } restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6c670c82364..940e0156c7e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2535,12 +2535,12 @@ class Propal extends CommonObject $resql = $this->db->query($sql); if ($resql) { // Status self::STATUS_REFUSED by default - $modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; + $modelpdf = !empty($conf->global->PROPALE_ADDON_PDF_ODT_CLOSED) ? $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED : $this->model_pdf; $trigger_name = 'PROPAL_CLOSE_REFUSED'; if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED $trigger_name = 'PROPAL_CLOSE_SIGNED'; - $modelpdf = $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->model_pdf; + $modelpdf = !empty($conf->global->PROPALE_ADDON_PDF_ODT_TOBILL) ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf; // The connected company is classified as a client $soc=new Societe($this->db); From b8f5dc74d70bcb831a1690712562d2b6ba243fa6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:30:36 +0200 Subject: [PATCH 716/739] Some order php 8 warning --- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/tpl/linkedobjectblock.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2805f4556d3..f601606be33 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1368,7 +1368,7 @@ class Commande extends CommonOrder } // Possibility to add external linked objects with hooks $this->linked_objects[$this->origin] = $this->origin_id; - if (is_array($object->other_linked_objects) && !empty($object->other_linked_objects)) { + if (isset($object->other_linked_objects) && is_array($object->other_linked_objects) && !empty($object->other_linked_objects)) { $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 428589aa844..a0641c4c493 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } echo '
'.$langs->trans("CustomerOrder"); - if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + if (!empty($showImportButton) && !empty($conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES)) { print ' '; From e4f61d430f9dc55aa8a630cf70c5cf11d0133547 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:33:24 +0200 Subject: [PATCH 717/739] Invoice php 8 issue and warnings. Seems if ("" < 0) is true in php 8 --- htdocs/compta/facture/card.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 585cabc1be4..6ec837fe1d1 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -112,7 +112,12 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object if ($id > 0 || !empty($ref)) { if ($action != 'add') { - $ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION); + if (empty($conf->global->INVOICE_USE_SITUATION)) { + $fetch_situation = false; + } else { + $fetch_situation = true; + } + $ret = $object->fetch($id, $ref, '', '', $fetch_situation); } } @@ -607,7 +612,7 @@ if (empty($reshook)) { } // Check for mandatory fields in invoice - $array_to_check = array('REF_CUSTOMER'=>'RefCustomer'); + $array_to_check = array('REF_CLIENT'=>'RefCustomer'); foreach ($array_to_check as $key => $val) { $keymin = strtolower($key); $vallabel = $object->$keymin; @@ -2362,21 +2367,22 @@ if (empty($reshook)) { $line = new FactureLigne($db); $line->fetch(GETPOST('lineid', 'int')); $percent = $line->get_prev_progress($object->id); + $progress = floatval(GETPOST('progress', 'int')); if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->situation_cycle_ref > 0) { // in case of situation credit note - if (GETPOST('progress') >= 0) { + if ($progress >= 0) { $mesg = $langs->trans("CantBeNullOrPositive"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; - } elseif (GETPOST('progress') < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result + } elseif ($progress < $line->situation_percent) { // TODO : use a modified $line->get_prev_progress($object->id) result $mesg = $langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; } - } elseif (GETPOST('progress') < $percent) { + } elseif ($progress < $percent) { $mesg = '
'.$langs->trans("CantBeLessThanMinPercent").'
'; setEventMessages($mesg, null, 'warnings'); $error++; From 0d7fccc7b30b00b241f85d5b1e28fdbbf19042e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 16:33:53 +0200 Subject: [PATCH 718/739] Fix test --- test/other/test_serialize.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/other/test_serialize.php b/test/other/test_serialize.php index 2fdfffaef3e..74d1d40e025 100644 --- a/test/other/test_serialize.php +++ b/test/other/test_serialize.php @@ -3,7 +3,10 @@ $path = __DIR__ . '/'; + $res=@include_once $path.'/../htdocs/master.inc.php'; +$res=@include_once $path.'/../../htdocs/master.inc.php'; +if (! $res) @include_once '../../master.inc.php'; if (! $res) @include_once '../master.inc.php'; if (! $res) @include_once './master.inc.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; From 051bb3f3ef8d7f31706f81457a6435af235581f6 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 29 Jun 2021 16:37:07 +0200 Subject: [PATCH 719/739] Fix some core php8 warnings. Fixing php 8 warnings seems also to solve some situations like a paiment condition removed from dictionary can not be selected. --- htdocs/core/class/html.form.class.php | 7 ++++++- htdocs/core/tpl/ajaxrow.tpl.php | 1 - htdocs/core/tpl/objectline_title.tpl.php | 2 +- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/langs/en_US/errors.lang | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 33e2ed8b972..0b1504d229a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5085,7 +5085,12 @@ class Form } else { if ($selected) { $this->load_cache_conditions_paiements(); - print $this->cache_conditions_paiements[$selected]['label']; + if (isset($this->cache_conditions_paiements[$selected])) { + print $this->cache_conditions_paiements[$selected]['label']; + } else { + $langs->load('errors'); + print $langs->trans('ErrorNotInDictionaryPaymentConditions'); + } } else { print " "; } diff --git a/htdocs/core/tpl/ajaxrow.tpl.php b/htdocs/core/tpl/ajaxrow.tpl.php index 6d6df3a5408..88c643c641d 100644 --- a/htdocs/core/tpl/ajaxrow.tpl.php +++ b/htdocs/core/tpl/ajaxrow.tpl.php @@ -79,7 +79,6 @@ $(document).ready(function(){ function() { console.log("tableDND end of ajax call"); if (reloadpage == 1) { - //console.log(''); global->PRODUCT_USE_UNITS)) { print '
'.$langs->trans('ReductionShort').''.$langs->trans('Progress').''.$form->textwithpicto($langs->trans('TotalHT100Short'), $langs->trans('UnitPriceXQtyLessDiscount')).''.$line->situation_percent.'%
'.$langs->trans("ProductAccountancySellCode").''; @@ -2364,8 +2363,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1); print '
'.$langs->trans("ProductAccountancySellCode").''; From c7befd9acc929cd1f3e3e2969a1ad2d07ce15397 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Jun 2021 19:49:26 +0200 Subject: [PATCH 728/739] Fix php8 (related to #18019) --- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/lib/files.lib.php | 6 +++--- htdocs/core/photos_resize.php | 4 ++-- htdocs/ecm/file_card.php | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 789bfb4e8b2..ec9449eba8f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -940,7 +940,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $ecmfile->share = getRandomPassword(true); $result = $ecmfile->create($user); if ($result < 0) @@ -5261,7 +5261,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->update($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -5274,7 +5274,7 @@ abstract class CommonObject $ecmfile->fullpath_orig = ''; $ecmfile->gen_or_uploaded = 'generated'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $ecmfile->src_object_type = $this->table_element; $ecmfile->src_object_id = $this->id; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7e34eec5ecd..05d8c6c4ec5 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -377,7 +377,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) $ecmfile->fullpath_orig = $filearray[$key]['fullname']; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -933,7 +933,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te $ecmfile->fullpath_orig = $srcfile; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $resultecm = $ecmfile->create($user); if ($resultecm < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -1785,7 +1785,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo $ecmfile->fullpath_orig = $fullpathorig; $ecmfile->gen_or_uploaded = $mode; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content if (is_object($object) && $object->id > 0) { $ecmfile->src_object_id = $object->id; diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 7c7813fbe14..374f381c098 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -383,7 +383,7 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex") $ecmfile->fullpath_orig = $fullpath; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); @@ -448,7 +448,7 @@ if ($action == 'confirm_crop') { $ecmfile->fullpath_orig = $fullpath; $ecmfile->gen_or_uploaded = 'unknown'; $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content + $ecmfile->keywords = ''; // keyword content $result = $ecmfile->create($user); if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 14bc7e377f0..5ca1667ac9f 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -205,7 +205,7 @@ if ($action == 'update' && $permtoadd) { $object->fullpath_orig = ''; $object->gen_or_uploaded = 'unknown'; $object->description = ''; // indexed content - $object->keyword = ''; // keyword content + $object->keywords = ''; // keyword content $result = $object->create($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'warnings'); From 6f128123292ffa521adbb63fe7efcac69f33cfae Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 29 Jun 2021 23:07:20 +0200 Subject: [PATCH 729/739] FIX Accountancy - Clean virtual zero on the import --- htdocs/core/modules/import/import_csv.modules.php | 2 ++ htdocs/core/modules/import/import_xlsx.modules.php | 2 ++ htdocs/core/modules/modAccounting.class.php | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 1768029b97e..52b7af1fee5 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -623,6 +623,8 @@ class ImportCsv extends ModeleImports } } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); + } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { + $newval = rtrim($newval, "0"); } //print 'Val to use as insert is '.$newval.'
'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index d90a52755e3..abc2a80abc9 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -664,6 +664,8 @@ class ImportXlsx extends ModeleImports } } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { $newval = price2num($newval); + } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'accountingaccount') { + $newval = rtrim($newval, "0"); } //print 'Val to use as insert is '.$newval.'
'; diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 21618c56bc9..f86a2078c9e 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -297,6 +297,10 @@ class modAccounting extends DolibarrModules ); $this->import_fieldshidden_array[$r] = array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r] = array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); + $this->import_convertvalue_array[$r]=array( + 'b.numero_compte'=>array('rule'=>'accountingaccount'), + 'b.subledger_account'=>array('rule'=>'accountingaccount') + ); $this->import_examplevalues_array[$r] = array( 'b.piece_num'=>'123 (!!! use next value not already used)', 'b.doc_date'=>dol_print_date(dol_now(), "%Y-%m-%d"), @@ -350,6 +354,8 @@ class modAccounting extends DolibarrModules 'b.sens'=>'rule-computeSens' ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_convertvalue_array[$r]=array( + 'b.numero_compte'=>array('rule'=>'accountingaccount'), + 'b.subledger_account'=>array('rule'=>'accountingaccount'), 'b.montant' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeAmount', 'element' => 'Accountancy'), 'b.sens' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'computeDirection', 'element' => 'Accountancy'), ); @@ -395,6 +401,7 @@ class modAccounting extends DolibarrModules $this->import_fields_array[$r] = array('aa.fk_pcg_version'=>"Chartofaccounts*", 'aa.account_number'=>"AccountAccounting*", 'aa.label'=>"Label*", 'aa.account_parent'=>"Accountparent", "aa.fk_accounting_category"=>"AccountingCategory", "aa.pcg_type"=>"Pcgtype*", 'aa.active'=>'Status*', 'aa.datec'=>"DateCreation"); $this->import_regex_array[$r] = array('aa.fk_pcg_version'=>'pcg_version@'.MAIN_DB_PREFIX.'accounting_system', 'aa.account_number'=>'^.{1,32}$', 'aa.label'=>'^.{1,255}$', 'aa.account_parent'=>'^.{0,32}$', 'aa.fk_accounting_category'=>'rowid@'.MAIN_DB_PREFIX.'c_accounting_category', 'aa.pcg_type'=>'^.{1,20}$', 'aa.active'=>'^0|1$', 'aa.datec'=>'^\d{4}-\d{2}-\d{2}$'); $this->import_convertvalue_array[$r] = array( + 'aa.account_number'=>array('rule'=>'accountingaccount'), 'aa.account_parent'=>array('rule'=>'fetchidfromref', 'classfile'=>'/accountancy/class/accountingaccount.class.php', 'class'=>'AccountingAccount', 'method'=>'fetch', 'element'=>'AccountingAccount'), 'aa.fk_accounting_category'=>array('rule'=>'fetchidfromcodeorlabel', 'classfile'=>'/accountancy/class/accountancycategory.class.php', 'class'=>'AccountancyCategory', 'method'=>'fetch', 'dict'=>'DictionaryAccountancyCategory'), ); From 5e37c2ef74664c2608620e149cbfe60fa69391bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 01:36:49 +0200 Subject: [PATCH 730/739] CSS --- htdocs/product/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 4aaaf3a0fa7..cab4f537c5d 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -354,10 +354,10 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us print '
'; + print ''; print $product_static->getNomUrl(1, '', 16); print "'.dol_trunc($objp->label, 32).''.dol_escape_htmltag($objp->label).'"; print dol_print_date($db->jdate($objp->datem), 'day'); print "
'; $thirdpartygraph .= '
'; +$thirdpartycateggraph = ''; if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_THIRDPARTIES)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $elementtype = 'societe'; From 3b4ea5c5af71d6fb2ab46895a01e59112bfeec1e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 30 Jun 2021 10:56:09 +0200 Subject: [PATCH 735/739] use formintervention --- htdocs/core/class/html.form.class.php | 141 ------------------ .../class/html.formintervention.class.php | 13 +- htdocs/projet/tasks/time.php | 5 +- 3 files changed, 12 insertions(+), 147 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8d0f1931763..0b1504d229a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8746,147 +8746,6 @@ class Form return $out; } - /** - * Output a combo list with interventions qualified for a third party - * - * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) - * @param int $selected Id intervention preselected - * @param string $htmlname Name of HTML select - * @param int $maxlength Maximum length of label - * @param int $option_only Return only html options lines without the select tag - * @param string $show_empty Add an empty line ('1' or string to show for empty line) - * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) - * @param int $forcefocus Force focus on field (works with javascript only) - * @param int $disabled Disabled - * @param string $morecss More css added to the select component - * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. - * @param string $showproject 'all' = Show project info, ''=Hide project info - * @param User $usertofilter User object to use for filtering - * @return int Nbr of project if OK, <0 if KO - */ - public function selectIntervention($socid = -1, $selected = '', $htmlname = 'interid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) - { - global $user, $conf, $langs; - - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - - if (is_null($usertofilter)) { - $usertofilter = $user; - } - - $out = ''; - - $hideunselectables = false; - if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; - - if (empty($projectsListId)) { - if (empty($usertofilter->rights->projet->all->lire)) { - $projectstatic = new Project($this->db); - $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1); - } - } - - // Search all projects - $sql = 'SELECT i.rowid, i.ref as ref, p.fk_soc, p.fk_statut, p.public,'; - $sql .= ' s.nom as name'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; - $sql .= ' '.MAIN_DB_PREFIX.'fichinter as i'; - $sql .= " WHERE p.entity IN (".getEntity('project').")"; - $sql .= " AND i.fk_projet = p.rowid AND i.fk_statut=0"; //Brouillons seulement - if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")"; - if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; - if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; - $sql .= " GROUP BY i.ref ORDER BY p.ref, i.ref ASC"; - - $resql = $this->db->query($sql); - if ($resql) { - // Use select2 selector - if (!empty($conf->use_javascript_ajax)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); - $out .= $comboenhancement; - $morecss = 'minwidth200imp maxwidth500'; - } - - if (empty($option_only)) { - $out .= ''; - } - - print $out; - - $this->db->free($resql); - return $num; - } else { - dol_print_error($this->db); - return -1; - } - } - /** * Output a combo list with invoices qualified for a third party * diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index 7058e80b1d7..b9564c6aa52 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -57,10 +57,11 @@ class FormIntervention * @param int $selected Id intervention preselected * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label - * @param int $showempty Show empty line + * @param int $showempty Show empty line ('1' or string to show for empty line) + * @param int $draftonly Show only drafts intervention * @return int Nbre of project if OK, <0 if KO */ - public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1) + public function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1, $draftonly = false) { // phpcs:enable global $db, $user, $conf, $langs; @@ -80,13 +81,17 @@ class FormIntervention $sql .= " AND f.fk_soc = ".((int) $socid); } } + if ($draftonly) $sql .= " AND f.fk_statut = 0"; dol_syslog(get_class($this)."::select_intervention", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $out .= '
'; - $form->selectIntervention($projectstatic->thirdparty->id, '', 'interid', 24, 0, $langs->trans('NewInter'), - 1, 0, 0, 'maxwidth500', '', 'all'); + $forminter = new FormIntervention($db); + print $forminter->select_interventions($projectstatic->thirdparty->id, '', 'interid', 24, $langs->trans('NewInter'), true); print '
'; From 51456741d97337329bde1f8fd0b8fa8861db1036 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 12:43:44 +0200 Subject: [PATCH 736/739] FIX Can't edit replacement invoice FIX Status of invoice when making a replacement invoice --- htdocs/compta/facture/card.php | 6 ++--- htdocs/compta/facture/class/facture.class.php | 26 +++++++++++------- htdocs/core/tpl/objectline_edit.tpl.php | 27 ++++++++++++++----- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 54994eaf187..b3a33b11d1b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3131,10 +3131,10 @@ if ($action == 'create') foreach ($facids as $facparam) { $options .= ''; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4ae9fe197fe..63a7b2f8e21 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3927,8 +3927,8 @@ class Facture extends CommonInvoice * Invoices matching the following rules are returned: * (Status validated or abandonned for a reason 'other') + not payed + no payment at all + not already replaced * - * @param int $socid Id thirdparty - * @return array|int Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) + * @param int $socid Id thirdparty + * @return array|int Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ public function list_replacable_invoices($socid = 0) { @@ -3937,17 +3937,19 @@ class Facture extends CommonInvoice $return = array(); - $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,"; + $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut as status, f.paye as paid,"; $sql .= " ff.rowid as rowidnext"; + //$sql .= ", SUM(pf.amount) as alreadypaid"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON f.rowid = ff.fk_facture_source"; $sql .= " WHERE (f.fk_statut = ".self::STATUS_VALIDATED." OR (f.fk_statut = ".self::STATUS_ABANDONED." AND f.close_code = '".self::CLOSECODE_ABANDONED."'))"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND f.paye = 0"; // Pas classee payee completement - $sql .= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait - $sql .= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement - if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; + $sql .= " AND f.paye = 0"; // Not paid completely + $sql .= " AND pf.fk_paiement IS NULL"; // No payment already done + $sql .= " AND ff.fk_statut IS NULL"; // Return true if it is not a replacement invoice + if ($socid > 0) $sql .= " AND f.fk_soc = ".((int) $socid); + //$sql .= " GROUP BY f.rowid, f.ref, f.fk_statut, f.paye, ff.rowid"; $sql .= " ORDER BY f.ref"; dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG); @@ -3956,9 +3958,13 @@ class Facture extends CommonInvoice { while ($obj = $this->db->fetch_object($resql)) { - $return[$obj->rowid] = array('id' => $obj->rowid, - 'ref' => $obj->ref, - 'status' => $obj->fk_statut); + $return[$obj->rowid] = array( + 'id' => $obj->rowid, + 'ref' => $obj->ref, + 'status' => $obj->status, + 'paid' => $obj->paid, + 'alreadypaid' => 0 + ); } //print_r($return); return $return; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index bc6b87a3353..685cc78fe67 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -109,9 +109,16 @@ $coldisplay++; $reshook = $hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); } + $situationinvoicelinewithparent = 0; + if ($line->fk_prev_id != null && in_array($object->element, array('facture', 'facturedet'))) { + if ($object->type == $object::TYPE_SITUATION) { // The constant TYPE_SITUATION exists only for object invoice + // Set constant to disallow editing during a situation cycle + $situationinvoicelinewithparent = 1; + } + } + // Do not allow editing during a situation cycle - if ($line->fk_prev_id == null) - { + if (!$situationinvoicelinewithparent) { // editor wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $nbrows = ROWS_2; @@ -149,7 +156,7 @@ $coldisplay++; } $coldisplay++; - if ($line->fk_prev_id == null) { + if (!$situationinvoicelinewithparent) { print '
'.$form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code ? (' ('.$line->vat_src_code.')') : ''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1).'%fk_prev_id != null) print ' readonly'; + if ($situationinvoicelinewithparent) { + print ' readonly'; + } print '> info_bits & 2) != 2) { - // I comment this because it shows info even when not required + // I comment warning of stock because it shows the info even when it should not. // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print 'fk_prev_id != null) print ' readonly'; + if ($situationinvoicelinewithparent) { // Do not allow editing during a situation cycle + print ' readonly'; + } print '>'; } else { ?>   @@ -202,7 +213,9 @@ $coldisplay++; info_bits & 2) != 2) { print 'fk_prev_id != null) print ' readonly'; + if ($situationinvoicelinewithparent) { + print ' readonly'; + } print '>%'; } else { ?>   From a914ffa42c0861febd39256a6415297558f8edb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 15:00:04 +0200 Subject: [PATCH 737/739] CSS --- htdocs/core/lib/project.lib.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/time.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d20a0348d3d..93c061310a5 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -849,7 +849,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t // Contacts of task if (count($arrayfields) > 0 && !empty($arrayfields['c.assigned']['checked'])) { - print ''; + print ''; foreach (array('internal', 'external') as $source) { $tab = $lines[$i]->liste_contact(-1, $source); $num = count($tab); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9de05d67e29..d4b5bf89bbf 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -902,7 +902,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third } */ if (!empty($arrayfields['c.assigned']['checked'])) { - print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'right ', ''); + print_liste_field_titre($arrayfields['c.assigned']['label'], $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center ', ''); } // Extra fields $disablesortlink = 1; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index a9316bcedcd..bbe9671faf3 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1410,7 +1410,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { // By User if (!empty($arrayfields['author']['checked'])) { - print ''; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { if (empty($object->id)) { $object->fetch($id); @@ -1441,7 +1441,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { // Note if (!empty($arrayfields['t.note']['checked'])) { - print ''; + print ''; if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; } else { @@ -1773,7 +1773,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { // Note if (!empty($arrayfields['t.note']['checked'])) { - print ''; + print ''; if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; } else { From bda36337cd005fbe25f6e68d7cdfecabf35fcaaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jun 2021 17:14:19 +0200 Subject: [PATCH 738/739] Prepare fix #yogosha6443 --- htdocs/api/class/api_setup.class.php | 2 +- htdocs/blockedlog/class/blockedlog.class.php | 2 - htdocs/compta/bank/treso.php | 26 ++- htdocs/core/class/commonobject.class.php | 19 -- htdocs/core/class/extrafields.class.php | 4 +- htdocs/core/commonfieldsinexport.inc.php | 2 +- htdocs/core/extrafieldsinexport.inc.php | 4 +- htdocs/core/lib/functions.lib.php | 21 +- .../modules/export/export_csv.modules.php | 4 +- .../export/export_excel2007.modules.php | 4 +- .../modules/export/export_tsv.modules.php | 4 +- htdocs/core/modules/modFournisseur.class.php | 211 ++---------------- .../install/mysql/tables/llx_oauth_token.sql | 4 +- test/phpunit/JsonLibTest.php | 9 + 14 files changed, 78 insertions(+), 238 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 1f59762c865..f5f301e9c16 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1013,7 +1013,7 @@ class Setup extends DolibarrApi $list[$tab->elementtype][$tab->name]['computed'] = $tab->fieldcomputed; $list[$tab->elementtype][$tab->name]['unique'] = $tab->fieldunique; $list[$tab->elementtype][$tab->name]['required'] = $tab->fieldrequired; - $list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? unserialize($tab->param) : ''); + $list[$tab->elementtype][$tab->name]['param'] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); // This may be a string encoded with serialise() or json_encode() $list[$tab->elementtype][$tab->name]['pos'] = $tab->pos; $list[$tab->elementtype][$tab->name]['alwayseditable'] = $tab->alwayseditable; $list[$tab->elementtype][$tab->name]['perms'] = $tab->perms; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 366d7042d77..112456480e1 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -777,10 +777,8 @@ class BlockedLog public function dolDecodeBlockedData($data, $mode = 0) { try { - //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $aaa = unserialize($data); - //$aaa = unserialize($data); } catch (Exception $e) { //print $e->getErrs); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 6ccd953a68b..d9b54ad1c3d 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -163,8 +163,8 @@ if (GETPOST("account") || GETPOST("ref")) { $sqls[] = $sql; // Social contributions - $sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; - $sql .= ", cs.fk_account"; + $sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr,"; + $sql .= " 0 as socid, 'noname' as name, 0 as fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; $sql .= " WHERE cs.entity = ".$conf->entity; @@ -188,7 +188,18 @@ if (GETPOST("account") || GETPOST("ref")) { $resql = $db->query($sql); if ($resql) { while ($sqlobj = $db->fetch_object($resql)) { - $tab_sqlobj[] = $sqlobj; + $tmpobj = new stdClass(); + $tmpobj->family = $sqlobj->family; + $tmpobj->objid = $sqlobj->objid; + $tmpobj->ref = $sqlobj->ref; + $tmpobj->total_ttc = $sqlobj->total_ttc; + $tmpobj->type = $sqlobj->type; + $tmpobj->dlt = $sqlobj->dlr; + $tmpobj->socid = $sqlobj->socid; + $tmpobj->name = $sqlobj->name; + $tmpobj->fournisseur = $sqlobj->fournisseur; + + $tab_sqlobj[] = $tmpobj; $tab_sqlobjOrder[] = $db->jdate($sqlobj->dlr); } $db->free($resql); @@ -201,15 +212,6 @@ if (GETPOST("account") || GETPOST("ref")) { if (!$error) { array_multisort($tab_sqlobjOrder, $tab_sqlobj); - // Apply distinct filter - foreach ($tab_sqlobj as $key => $value) { - $tab_sqlobj[$key] = "'".serialize($value)."'"; - } - $tab_sqlobj = array_unique($tab_sqlobj); - foreach ($tab_sqlobj as $key => $value) { - $tab_sqlobj[$key] = unserialize(trim($value, "'")); - } - $num = count($tab_sqlobj); $i = 0; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ec9449eba8f..5467490ea0e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8167,15 +8167,6 @@ abstract class CommonObject } else { $queryarray[$field] = $this->db->idate($this->{$field}); } - } elseif ($this->isArray($info)) { - if (!empty($this->{$field})) { - if (!is_array($this->{$field})) { - $this->{$field} = array($this->{$field}); - } - $queryarray[$field] = serialize($this->{$field}); - } else { - $queryarray[$field] = null; - } } elseif ($this->isDuration($info)) { // $this->{$field} may be null, '', 0, '0', 123, '123' if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) { @@ -8236,16 +8227,6 @@ abstract class CommonObject } else { $this->{$field} = $db->jdate($obj->{$field}); } - } elseif ($this->isArray($info)) { - if (!empty($obj->{$field})) { - $this->{$field} = @unserialize($obj->{$field}); - // Hack for data not in UTF8 - if ($this->{$field } === false) { - @unserialize(utf8_decode($obj->{$field})); - } - } else { - $this->{$field} = array(); - } } elseif ($this->isInt($info)) { if ($field == 'rowid') { $this->id = (int) $obj->{$field}; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index b4d7f1a74df..54d812aeafb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -936,7 +936,7 @@ class ExtraFields $this->attribute_computed[$tab->name] = $tab->fieldcomputed; $this->attribute_unique[$tab->name] = $tab->fieldunique; $this->attribute_required[$tab->name] = $tab->fieldrequired; - $this->attribute_param[$tab->name] = ($tab->param ? unserialize($tab->param) : ''); + $this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); $this->attribute_pos[$tab->name] = $tab->pos; $this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable; $this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms); @@ -954,7 +954,7 @@ class ExtraFields $this->attributes[$tab->elementtype]['computed'][$tab->name] = $tab->fieldcomputed; $this->attributes[$tab->elementtype]['unique'][$tab->name] = $tab->fieldunique; $this->attributes[$tab->elementtype]['required'][$tab->name] = $tab->fieldrequired; - $this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? unserialize($tab->param) : ''); + $this->attributes[$tab->elementtype]['param'][$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); $this->attributes[$tab->elementtype]['pos'][$tab->name] = $tab->pos; $this->attributes[$tab->elementtype]['alwayseditable'][$tab->name] = $tab->alwayseditable; $this->attributes[$tab->elementtype]['perms'][$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms); diff --git a/htdocs/core/commonfieldsinexport.inc.php b/htdocs/core/commonfieldsinexport.inc.php index a02a21afdd6..3b201e4f10a 100644 --- a/htdocs/core/commonfieldsinexport.inc.php +++ b/htdocs/core/commonfieldsinexport.inc.php @@ -37,7 +37,7 @@ if (class_exists($keyforclass)) { /* * case 'sellist': * $tmp=''; - * $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + * $tmpparam=jsonOrUnserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null * if ($tmpparam['options'] && is_array($tmpparam['options'])) { * $tmpkeys=array_keys($tmpparam['options']); * $tmp=array_shift($tmpkeys); diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 861ef142c25..70dd0077e57 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -39,7 +39,7 @@ if ($resql) { // This can fail when class is used on old database (during mig case 'checkbox': case 'select': if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) { - $tmpparam = unserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) + $tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...) if ($tmpparam['options'] && is_array($tmpparam['options'])) { $typeFilter = "Select:".$obj->param; } @@ -47,7 +47,7 @@ if ($resql) { // This can fail when class is used on old database (during mig break; case 'sellist': $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null if ($tmpparam['options'] && is_array($tmpparam['options'])) { $tmpkeys = array_keys($tmpparam['options']); $tmp = array_shift($tmpkeys); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 87a4b966056..33a073920ff 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -993,7 +993,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) function dol_clone($object, $native = 0) { if (empty($native)) { - $myclone = unserialize(serialize($object)); + $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields } else { $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable) } @@ -10301,9 +10301,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) */ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '') { + /* global $conf; - /*if (!empty($conf->dol_no_mouse_hover)) { + if (!empty($conf->dol_no_mouse_hover)) { $showonlyonhover = 0; }*/ @@ -10315,3 +10316,19 @@ function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $tex return $result; } + + +/** + * Decode an encode string. The string can be encoded in json format (recommended) or with serialize (avoid this) + * + * @param string $stringtodecode String to decode (json or serialize coded) + */ +function jsonOrUnserialize($stringtodecode) +{ + $result = json_decode($stringtodecode); + if ($result === null) { + $result = unserialize($stringtodecode); + } + + return $result; +} diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 2d15f3999d0..88ae937bb6d 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -277,8 +277,8 @@ class ExportCsv extends ModeleExports $newvalue = $this->csvClean($newvalue, $outputlangs->charset_output); - if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) { - $array = unserialize($typefield); + if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) { + $array = json_decode($typefield, true); $array = $array['options']; $newvalue = $array[$newvalue]; } diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 370fc49df7e..54842ff8278 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -315,8 +315,8 @@ class ExportExcel2007 extends ModeleExports $newvalue = $this->excel_clean($newvalue); $typefield = isset($array_types[$code]) ? $array_types[$code] : ''; - if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) { - $array = unserialize($typefield); + if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) { + $array = json_decode($typefield, true); $array = $array['options']; $newvalue = $array[$newvalue]; } diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index c93787a762c..7718dd3e350 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -252,8 +252,8 @@ class ExportTsv extends ModeleExports $newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output); - if (preg_match('/^Select:/i', $typefield, $reg) && $typefield = substr($typefield, 7)) { - $array = unserialize($typefield); + if (preg_match('/^Select:/i', $typefield) && $typefield = substr($typefield, 7)) { + $array = json_decode($typefield, true); $array = $array['options']; $newvalue = $array[$newvalue]; } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 41107d5c34a..5d71a5abdc8 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -285,7 +285,7 @@ class modFournisseur extends DolibarrModules $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'Vendor invoices and lines of invoices'; - $this->export_icon[$r] = 'bill'; + $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("fournisseur", "facture", "export")); $this->export_fields_array[$r] = array( 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', @@ -328,81 +328,14 @@ class modFournisseur extends DolibarrModules ); $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object - $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { // This can fail when class is used on old database (during migration for example) - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $typeFilter = "Text"; - switch ($obj->type) { - case 'int': - case 'double': - case 'price': - $typeFilter = "Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter = "Date"; - break; - case 'boolean': - $typeFilter = "Boolean"; - break; - case 'sellist': - $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $var = array_keys($tmpparam['options']); - $tmp = array_shift($var); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { - $typeFilter = "List:".$tmp; - } - break; - } - $this->export_fields_array[$r][$fieldname] = $fieldlabel; - $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; - $this->export_entities_array[$r][$fieldname] = 'invoice'; - } - } - // End add extra fields - // Add extra fields line - $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { // This can fail when class is used on old database (during migration for example) - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extraline.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $typeFilter = "Text"; - switch ($obj->type) { - case 'int': - case 'double': - case 'price': - $typeFilter = "Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter = "Date"; - break; - case 'boolean': - $typeFilter = "Boolean"; - break; - case 'sellist': - $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmp = array_shift(array_keys($tmpparam['options'])); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { - $typeFilter = "List:".$tmp; - } - break; - } - $this->export_fields_array[$r][$fieldname] = $fieldlabel; - $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; - $this->export_entities_array[$r][$fieldname] = 'invoice_line'; - } - } + $keyforselect = 'facture_fourn'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect = 'facture_fourn_det'; + $keyforelement = 'invoice_line'; + $keyforaliasextra = 'extraline'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields line $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -426,7 +359,7 @@ class modFournisseur extends DolibarrModules $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'Factures fournisseurs et reglements'; - $this->export_icon[$r] = 'bill'; + $this->export_icon[$r] = 'invoice'; $this->export_permission[$r] = array(array("fournisseur", "facture", "export")); $this->export_fields_array[$r] = array( 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone', @@ -465,43 +398,10 @@ class modFournisseur extends DolibarrModules 'p.datep'=>'payment', 'p.num_paiement'=>'payment', 'p.fk_bank'=>'account', 'project.rowid'=>'project', 'project.ref'=>'project', 'project.title'=>'project'); $this->export_dependencies_array[$r] = array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object - $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { // This can fail when class is used on old database (during migration for example) - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $typeFilter = "Text"; - switch ($obj->type) { - case 'int': - case 'double': - case 'price': - $typeFilter = "Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter = "Date"; - break; - case 'boolean': - $typeFilter = "Boolean"; - break; - case 'sellist': - $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $array_keys = array_keys($tmpparam['options']); - $tmp = array_shift($array_keys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { - $typeFilter = "List:".$tmp; - } - break; - } - $this->export_fields_array[$r][$fieldname] = $fieldlabel; - $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; - $this->export_entities_array[$r][$fieldname] = 'invoice'; - } - } + $keyforselect = 'facture_fourn'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields object $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -564,83 +464,16 @@ class modFournisseur extends DolibarrModules ); $this->export_dependencies_array[$r] = array('order_line'=>'fd.rowid', 'product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them // Add extra fields object - $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { // This can fail when class is used on old database (during migration for example) - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $typeFilter = "Text"; - switch ($obj->type) { - case 'int': - case 'double': - case 'price': - $typeFilter = "Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter = "Date"; - break; - case 'boolean': - $typeFilter = "Boolean"; - break; - case 'sellist': - $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - $tmpkey = array_keys($tmpparam['options']); - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmp = array_shift($tmpkey); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { - $typeFilter = "List:".$tmp; - } - break; - } - $this->export_fields_array[$r][$fieldname] = $fieldlabel; - $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; - $this->export_entities_array[$r][$fieldname] = 'order'; - } - } + $keyforselect = 'commande_fournisseur'; + $keyforelement = 'order'; + $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields object // Add extra fields line - $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) { // This can fail when class is used on old database (during migration for example) - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extraline.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $typeFilter = "Text"; - switch ($obj->type) { - case 'int': - case 'double': - case 'price': - $typeFilter = "Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter = "Date"; - break; - case 'boolean': - $typeFilter = "Boolean"; - break; - case 'sellist': - $tmp = ''; - $tmpparam = unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpparam_param_key = array_keys($tmpparam['options']); - $tmp = array_shift($tmpparam_param_key); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) { - $typeFilter = "List:".$tmp; - } - break; - } - $this->export_fields_array[$r][$fieldname] = $fieldlabel; - $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; - $this->export_entities_array[$r][$fieldname] = 'order_line'; - } - } + $keyforselect = 'commande_fournisseurdet'; + $keyforelement = 'order_line'; + $keyforaliasextra = 'extraline'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields line $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/install/mysql/tables/llx_oauth_token.sql b/htdocs/install/mysql/tables/llx_oauth_token.sql index 7674f7f3455..62542d13401 100644 --- a/htdocs/install/mysql/tables/llx_oauth_token.sql +++ b/htdocs/install/mysql/tables/llx_oauth_token.sql @@ -18,8 +18,8 @@ CREATE TABLE llx_oauth_token ( rowid integer AUTO_INCREMENT PRIMARY KEY, service varchar(36), -- What king of key or token: 'Google', 'Stripe', 'auth-public-key', ... - token text, -- token in serialize() format, of an object StdOAuth2Token of library phpoauth2 - tokenstring text, -- token in text or json format. Value depends on 'service'. For example for an OAUTH service: '{"access_token": "sk_test_cccc", "refresh_token": "rt_aaa", "token_type": "bearer", ..., "scope": "read_write"} + token text, -- token in serialize format, of an object StdOAuth2Token of library phpoauth2. Deprecated, use tokenstring instead. + tokenstring text, -- token in json or text format. Value depends on 'service'. For example for an OAUTH service: '{"access_token": "sk_test_cccc", "refresh_token": "rt_aaa", "token_type": "bearer", ..., "scope": "read_write"} fk_soc integer, -- Id of thirdparty in llx_societe fk_user integer, -- Id of user in llx_user fk_adherent integer, -- Id of member in llx_adherent diff --git a/test/phpunit/JsonLibTest.php b/test/phpunit/JsonLibTest.php index ddb62a90204..a8619ae08c5 100644 --- a/test/phpunit/JsonLibTest.php +++ b/test/phpunit/JsonLibTest.php @@ -161,6 +161,15 @@ class JsonLibTest extends PHPUnit\Framework\TestCase $this->savlangs=$langs; $this->savdb=$db; + // Try to decode a string encoded with serialize + $encoded = 'a:1:{s:7:"options";a:3:{s:3:"app";s:11:"Application";s:6:"system";s:6:"System";s:6:"option";s:6:"Option";}}'; + $decoded=json_decode($encoded, true); + $this->assertEquals(null, $decoded, 'test to json_decode() a string that was encoded with serialize()'); + + $encoded = 'rubishstring!aa{bcd'; + $decoded=json_decode($encoded, true); + $this->assertEquals(null, $decoded, 'test to json_decode() a string that was encoded with serialize()'); + // Do a test with an array starting with 0 $arraytotest=array(0=>array('key'=>1,'value'=>'PRODREF','label'=>'Product ref with é and special chars \\ \' "')); $arrayencodedexpected='[{"key":1,"value":"PRODREF","label":"Product ref with \u00e9 and special chars \\\\ \' \""}]'; From 1a63a379cc447c3ddc07dd1c9c715db9efe11141 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Jul 2021 03:03:59 +0200 Subject: [PATCH 739/739] Fix missing permission --- htdocs/comm/propal/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index d99c8b81b2c..1b0b57afc7a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -226,6 +226,7 @@ if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { } else { $permissiontovalidate = $user->rights->propal->creer; $permissiontoclose = $user->rights->propal->creer; + $permissiontosendbymail = $user->rights->propale->lire; }