From d1c19d9c96012324fdb764cad1664bb9cc79122d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 30 Jan 2023 14:41:25 +0100 Subject: [PATCH 01/59] Add files via upload --- htdocs/theme/common/flags/xk.png | Bin 0 -> 371 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/common/flags/xk.png diff --git a/htdocs/theme/common/flags/xk.png b/htdocs/theme/common/flags/xk.png new file mode 100644 index 0000000000000000000000000000000000000000..d90e8277ac9eaec104db360252fd59cb72f0b613 GIT binary patch literal 371 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~o!2~3KHq6QcQjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy17M4uLS^MYatoKn)z8E{-7@!O1BFapxSk64C;=8jTJ*c+GGQ z>p30ZdceW;!Rh|}b8>v*>;JT#YGf2{dGs`CWk-N{nCObWYbnWze?GoGzy5yx&YP0y zViGU4KQ6D(a+t!%c*V1ahllanBWE(OD7k`fG(l_68R>ObZJ P1B$`Z)z4*}Q$iB}`3aRW literal 0 HcmV?d00001 From 2a35dc32c69533abd059b4f6fd39c7b46cdedbb9 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Fri, 27 Jan 2023 17:17:42 +0100 Subject: [PATCH 02/59] NEW Order export : allow to export field 'shipment method'. --- htdocs/core/modules/modCommande.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 38b81cdb4fb..29e9f8c12f4 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -204,7 +204,7 @@ class modCommande extends DolibarrModules 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT", - 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", + 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'sm.code'=>'SendingMethod', 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", @@ -235,7 +235,7 @@ class modCommande extends DolibarrModules $this->export_TypeFields_array[$r] = array( 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", - 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric", + 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'sm.code'=>"Text", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text', @@ -244,9 +244,9 @@ class modCommande extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order", - 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", + 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", - 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line", + 'c.date_livraison'=>"order", 'sm.code'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line", 'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line", 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); @@ -277,6 +277,7 @@ class modCommande extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande as c'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_shipment_mode as sm ON c.fk_shipping_method = sm.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uc ON c.fk_user_author = uc.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as uv ON c.fk_user_valid = uv.rowid'; From 4168f0be01bfdb1533fc73390db91b97fbbdfa05 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 12:11:37 +0100 Subject: [PATCH 03/59] checkbox colum on left for task/time.php list --- htdocs/projet/tasks/time.php | 122 +++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 35 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3c8597cd862..2ab70190722 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1855,7 +1855,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; @@ -1863,6 +1863,13 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Fields title search print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + } // Date if (!empty($arrayfields['t.task_date']['checked'])) { print ''; @@ -1954,13 +1961,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } print ''."\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + } if (!empty($arrayfields['t.task_date']['checked'])) { print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); } @@ -2014,7 +2026,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + } print "\n"; $tasktmp = new Task($db); @@ -2035,6 +2049,42 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { + print ''; + print ''; + print ' '; + print ''; + } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks + if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { + print ' '; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_split('', 'class="pictofixedwidth"'); + print ''; + } + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); + print ''; + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_delete('default', 'class="pictodelete paddingleft"'); + 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($task_time->rowid, $arrayofselected)) { + $selected = 1; + } + print ' '; + print ''; + } + } + } + } // Date if (!empty($arrayfields['t.task_date']['checked'])) { print ''; @@ -2318,36 +2368,38 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print $hookmanager->resPrint; // Action column - print ''; - if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { - print ''; - print ''; - print ' '; - print ''; - } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks - if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { - if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { - print ' '; - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_split('', 'class="pictofixedwidth"'); - print ''; - } - - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); - print ''; - - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; - print img_delete('default', 'class="pictodelete paddingleft"'); - 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($task_time->rowid, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (($action == 'editline' || $action == 'splitline') && GETPOST('lineid', 'int') == $task_time->rowid) { + print ''; + print ''; + print ' '; + print ''; + } elseif ($user->hasRight('projet', 'time') || $user->hasRight('projet', 'all', 'creer')) { // Read project and enter time consumed on assigned tasks + if (in_array($task_time->fk_user, $childids) || $user->hasRight('projet', 'all', 'creer')) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 2) { + print ' '; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_split('', 'class="pictofixedwidth"'); + print ''; + } + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_edit('default', 0, 'class="pictofixedwidth paddingleft"'); + print ''; + + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print img_delete('default', 'class="pictodelete paddingleft"'); + 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($task_time->rowid, $arrayofselected)) { + $selected = 1; + } + print ' '; + print ''; } - print ' '; - print ''; } } } From f7cdc24aab1b73b9fd921bb68be4e05e70926316 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 12:37:56 +0100 Subject: [PATCH 04/59] checkbox colum on left for workstation list --- htdocs/workstation/workstation_list.php | 67 ++++++++++++++++++------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index d4ea81e769f..8639adf866d 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -462,7 +462,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -473,6 +473,13 @@ print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -530,10 +537,12 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; $totalarray = array(); @@ -542,6 +551,11 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -576,8 +590,10 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; -$totalarray['nbfield']++; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalaray['nbfield']++; +} print ''."\n"; @@ -625,6 +641,21 @@ while ($i < $imaxinloop) { // Show here line of result $j = 0; print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -717,17 +748,19 @@ while ($i < $imaxinloop) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; - } - print ''; - if (!$i) { - $totalarray['nbfield']++; } print ''."\n"; From bc12290739260fdebfbdb3806051177ec3f2c11a Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 12:45:17 +0100 Subject: [PATCH 05/59] checkbox colum on left for adherent/subscription list --- htdocs/adherents/subscription/list.php | 67 ++++++++++++++++++-------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 3c17fc64852..40a9c042bd4 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -342,7 +342,7 @@ if ($sall) { $moreforfilter = ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -353,7 +353,13 @@ print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + 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; + } + print ''; + } + 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 (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + 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; + } + print ''; + } + print '
'; - +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} // Line numbering if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; @@ -431,15 +437,19 @@ if (!empty($arrayfields['c.tms']['checked'])) { } // Action column -print ''; - +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print "\n"; print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} if (!empty($arrayfields['d.ref']['checked'])) { print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder); } @@ -484,7 +494,9 @@ if (!empty($arrayfields['c.datec']['checked'])) { if (!empty($arrayfields['c.tms']['checked'])) { print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); } -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} print "\n"; @@ -540,7 +552,21 @@ while ($i < min($num, $limit)) { } } else { print ''; - + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Ref if (!empty($arrayfields['d.ref']['checked'])) { print ''; @@ -662,19 +688,20 @@ while ($i < min($num, $limit)) { } } // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print "\n"; } $i++; From a2a5d6f68acea70b17f04e58da9fb88d22c96bb8 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 12:56:41 +0100 Subject: [PATCH 06/59] checkbox colum on left for adherent/type list --- htdocs/adherents/type.php | 60 +++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f516efdd819..c91915f7bdb 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -289,6 +289,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ' '; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + 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($obj->crowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''.$subscription->getNomUrl(1).''; - 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($obj->crowid, $arrayofselected)) { - $selected = 1; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + 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($obj->crowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'."\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; print ''; print ''; @@ -297,7 +300,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print "\n"; $membertype = new AdherentType($db); @@ -333,6 +338,13 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } } else { print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($user->rights->adherent->configurer) { + print ''; + } else { + print ''; + } + } print ''; print ''; print ''; - if ($user->rights->adherent->configurer) { - print ''; - } else { - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + if ($user->rights->adherent->configurer) { + print ''; + } else { + print ''; + } } print ""; } @@ -708,13 +722,18 @@ if ($rowid > 0) { print "\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + } print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); + } print "\n"; $adh = new Adherent($db); @@ -732,7 +751,17 @@ if ($rowid > 0) { $adh->statut = $objp->status; print ''; - + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print '"; + } // Lastname if ($objp->company != '') { print ''."\n"; @@ -785,15 +814,16 @@ if ($rowid > 0) { } // Actions - print '"; } - if ($user->hasRight('adherent', 'supprimer')) { - print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; - } - print ""; - print "\n"; $i++; } From ba0949dd65bccf6ae688893e21c2111a25ee6fdf Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 13:08:31 +0100 Subject: [PATCH 07/59] checkbox colum on left for salaries list --- htdocs/salaries/list.php | 66 +++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index fbbac2a2f3b..24b416295d1 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -399,7 +399,7 @@ $newcardbutton = dolGetButtonTitle($langs->trans('NewSalaryPayment'), '', 'fa fa print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'salary', 0, $newcardbutton, '', $limit, 0, 0, 1); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields = ''; $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); @@ -411,6 +411,13 @@ print '
 '.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("MembersNature").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").'  
rowid.'">'.img_edit().' '; print $membertype->getNomUrl(1); //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' @@ -352,10 +364,12 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().' rowid.'">'.img_edit().' 
'; + if ($user->hasRight('adherent', 'creer')) { + print ''.img_edit().''; + } + if ($user->hasRight('adherent', 'supprimer')) { + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + } + print "'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).''; - if ($user->hasRight('adherent', 'creer')) { - print ''.img_edit().''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->hasRight('adherent', 'creer')) { + print ''.img_edit().''; + } + if ($user->hasRight('adherent', 'supprimer')) { + print ''.img_picto($langs->trans("Resiliate"), 'disable.png').''; + } + print "
'; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} // Ref print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "s.label", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "s.datesp,s.rowid", "", $param, 'align="center"', $sortfield, $sortorder); @@ -500,7 +513,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} print ''."\n"; @@ -567,6 +582,22 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Ref print "\n"; if (!$i) { @@ -661,19 +692,20 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; + if (!$i) { + $totalarray['nbfield']++; } - print ''; } - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - print ''."\n"; } $i++; From f128639bbe2c4b1b876e98cb29f59a52079de348 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 13:28:05 +0100 Subject: [PATCH 08/59] checkbox colum on left for loan list --- htdocs/loan/list.php | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index b664d784e7e..84c0e3a100c 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -227,27 +227,40 @@ if ($resql) { // Filters lines print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; print ''; print ''; print ''; print ''; print ''; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } // Fields title label // -------------------------------------------------------------------- print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "l.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "l.label", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("LoanCapital", $_SERVER["PHP_SELF"], "l.capital", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + } print "\n"; print "\n"; @@ -287,6 +300,11 @@ if ($resql) { } else { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Ref print ''; @@ -306,7 +324,10 @@ if ($resql) { print $loan_static->LibStatut($obj->paid, 5, $obj->alreadypaid); print ''; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print "\n"; } From 7b27081014f66c9b311a4c8b4fafd6c153e81110 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 13:31:33 +0100 Subject: [PATCH 09/59] checkbox colum on left for donnation list --- htdocs/don/list.php | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index eb487be4768..819e0ea7931 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -219,6 +219,12 @@ if ($resql) { // Filters lines print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; @@ -252,13 +258,18 @@ if ($resql) { ); print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'search_status maxwidth100 onrightofpage'); print ''; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print "\n"; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre(''); + } print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder); if (!empty($conf->global->DONATION_USE_THIRDPARTIES)) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder); @@ -273,7 +284,9 @@ if ($resql) { } print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "d.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre(''); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre(''); + } print "\n"; while ($i < min($num, $limit)) { @@ -307,6 +320,9 @@ if ($resql) { } } else { print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } $donationstatic->id = $objp->rowid; $donationstatic->ref = $objp->rowid; $donationstatic->lastname = $objp->lastname; @@ -339,7 +355,9 @@ if ($resql) { } print ''; print ''; - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ""; } $i++; From 76489bdc2808aaac3d57ee05159a16a1e5519a01 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 13:32:39 +0100 Subject: [PATCH 10/59] missing loan list --- htdocs/loan/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 84c0e3a100c..b864c9f09ab 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -245,6 +245,7 @@ if ($resql) { print $searchpicto; print ''; } + print ''; // Fields title label // -------------------------------------------------------------------- From 0c3d4a77c6deea86281b96f5234f13a9a49a97ac Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 13:38:50 +0100 Subject: [PATCH 11/59] checkbox colum on left for compta/bank/various_payment list --- htdocs/compta/bank/various_payment/list.php | 36 ++++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 70abe873cba..edb770bb4e6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -396,7 +396,7 @@ if ($resql) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $moreforfilter= ''; print '
'; @@ -404,6 +404,13 @@ if ($resql) { print '
'; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -507,16 +514,22 @@ if ($resql) { print ''; } - print ''; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + } + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); } @@ -563,7 +576,9 @@ if ($resql) { $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + } print ''; @@ -602,6 +617,10 @@ if ($resql) { } else { print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // No if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -751,8 +770,9 @@ if ($resql) { print ''; } - print ''; - + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if (!$i) { $totalarray['nbfield']++; } From 7861ff8ae7956205753519b6674752dc797f30a6 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 14:39:11 +0100 Subject: [PATCH 12/59] checkbox colum on left for compta/sociales list --- htdocs/compta/sociales/list.php | 38 +++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index a925fe6968d..a132a3650dc 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -412,7 +412,7 @@ $moreforfilter = ''; $massactionbutton = ''; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -422,6 +422,13 @@ print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; print ''; @@ -472,16 +479,22 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + 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; + } + print ''; + } + print '".$salstatic->getNomUrl(1)."'; - 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 (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + 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; + } + print ''; + } + print '
'; + $searchpicto = $form->showFilterAndCheckAddButtons(); + print $searchpicto; + print '  '; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(); + print $searchpicto; + print '
'.$loan_static->getNomUrl(1).'
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; print ''; print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'.price($objp->amount).''.$donationstatic->LibStatut($objp->status, 5).'
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'.(($offset * $limit) + $i).'
'; +// Filter: Buttons +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + // Filters: Line number (placeholder) if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''; print ''; + +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); +} + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); } @@ -571,7 +585,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); +} print ''; $i = 0; @@ -611,6 +627,12 @@ while ($i < min($num, $limit)) { } else { print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Line number if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -750,8 +772,10 @@ while ($i < min($num, $limit)) { } } - // Buttons - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if (!$i) { $totalarray['nbfield']++; } From 8167d5a64da506c73d8a8c206d4ece1663835a13 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 14:43:15 +0100 Subject: [PATCH 13/59] checkbox colum on left for compta/tva list --- htdocs/compta/tva/list.php | 40 +++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index c839625a705..0497c05d204 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -328,7 +328,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('NewVATPayment'), '', 'fa fa-p print_barre_liste($langs->trans("VATDeclarations"), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); $varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } @@ -338,6 +338,13 @@ print '
'; + print $form->showFilterAndCheckAddButtons(0); + print ''; @@ -522,13 +529,20 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N print $hookmanager->resPrint; // Filter: Buttons -print ''; -print $form->showFilterAndCheckAddButtons(0); -print ''; + print $form->showFilterAndCheckAddButtons(0); + print '
'.(($offset * $limit) + $i).'
'; +// Filter: Buttons +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + // Filters: Lines (placeholder) if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; - +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''; print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); } @@ -454,7 +465,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +} print ''; $i = 0; @@ -488,6 +501,11 @@ while ($i < min($num, $limit)) { } else { print ''; + // Buttons + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // No if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { print ''; @@ -527,7 +545,10 @@ while ($i < min($num, $limit)) { } // Date payment - /*if (!empty($arrayfields['t.datep']['checked'])) { + /*if // Buttons + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + }(!empty($arrayfields['t.datep']['checked'])) { print ''; if (!$i) $totalarray['nbfield']++; }*/ @@ -591,8 +612,9 @@ while ($i < min($num, $limit)) { } // Buttons - print ''; - + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; } From e36a1ebf7c0c729ba5c2df3565ba4d1c507bcd2e Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 14:49:24 +0100 Subject: [PATCH 14/59] checkbox colum on left for compta/cashcontrol list --- .../compta/cashcontrol/cashcontrol_list.php | 57 ++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 05612f54166..0ae54456735 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -447,7 +447,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -457,6 +457,13 @@ print '
'; + print $form->showFilterAndCheckAddButtons(0); + print ''; @@ -417,13 +424,17 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // N print $hookmanager->resPrint; // Filter: Buttons -print ''; -print $form->showFilterAndCheckAddButtons(0); -print ''; + print $form->showFilterAndCheckAddButtons(0); + print '
'.(($offset * $limit) + $i).''.dol_print_date($db->jdate($obj->datep), 'day').'
'; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -495,16 +502,22 @@ $parameters = array('arrayfields'=>$arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''."\n"; // Fields title label // -------------------------------------------------------------------- print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { @@ -527,7 +540,9 @@ $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column -print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} print ''."\n"; @@ -579,6 +594,20 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result $j = 0; print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { @@ -636,15 +665,17 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - print ''; } - print ''; if (!$i) { $totalarray['nbfield']++; } From f53b55b360f677eba0d4ca745d3f2f6e1931ae57 Mon Sep 17 00:00:00 2001 From: Faustin Date: Tue, 31 Jan 2023 16:55:37 +0100 Subject: [PATCH 15/59] checkbox colum on left for resource list --- htdocs/resource/list.php | 62 ++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 55a9540bfe1..dcee2d813f5 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -186,7 +186,7 @@ if ($action == 'delete_resource') { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); print '
'; @@ -230,6 +230,13 @@ print '
'; print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + 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; + } + print ''; + } + 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 (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + 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; + } + print ''; } - print ''; + print '
'."\n"; print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} if (!empty($arrayfields['t.ref']['checked'])) { print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print "\n"; print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +} if (!empty($arrayfields['t.ref']['checked'])) { print_liste_field_titre($arrayfields['t.ref']['label'], $_SERVER["PHP_SELF"], "t.ref", "", $param, "", $sortfield, $sortorder); } @@ -258,7 +271,10 @@ if (!empty($arrayfields['ty.label']['checked'])) { } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); +} print "\n"; @@ -266,6 +282,19 @@ if ($ret) { foreach ($object->lines as $resource) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (!empty($arrayfields['t.ref']['checked'])) { print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if (!$i) { $totalarray['nbfield']++; } From ca32f6247e81ba64e9f4d37941df93dd434b5ed6 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 1 Feb 2023 08:53:10 +0100 Subject: [PATCH 16/59] FIX filter status na --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index e313c1207cb..4c83a8ffb08 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -758,7 +758,7 @@ if ($type) { if ($status == '0') { $sql .= " AND a.percent = 0"; } -if ($status == '-1' || $status == 'na') { +if ($status == 'na') { // Not applicable $sql .= " AND a.percent = -1"; } From 1ce55f34bd387dc33e9011f26d8fc76ebc9a6f15 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Wed, 1 Feb 2023 15:33:14 +0100 Subject: [PATCH 17/59] FIX: Remove orphelan $this->db->rollback() in the function insertExtrafields() --- htdocs/core/class/commonobject.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 25f16cbbdb4..8191b426ca8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6288,7 +6288,6 @@ abstract class CommonObject $new_array_options[$key] = $object->id; } else { $this->error = "Id/Ref '".$value."' for object '".$object->element."' not found"; - $this->db->rollback(); return -1; } } From 941a73411b6aeb15b46268766f75a1e05af6b245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 22:10:20 +0100 Subject: [PATCH 18/59] doc --- htdocs/core/class/commondocgenerator.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index da529e33d0e..8b79bf82d36 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2023 Frédéric France * Copyright (C) 2020 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify @@ -65,6 +65,11 @@ abstract class CommonDocGenerator */ public $scandir; + /** + * @var array + */ + public $format; + public $page_hauteur; public $page_largeur; public $marge_gauche; From ac5b95b5554b00ff52e91b01acdc133c6ba829d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 22:14:37 +0100 Subject: [PATCH 19/59] Update commondocgenerator.class.php --- htdocs/core/class/commondocgenerator.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 8b79bf82d36..d0d9ad49113 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -65,6 +65,16 @@ abstract class CommonDocGenerator */ public $scandir; + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + /** * @var array */ From eaf125e028f0e5e75d2c8eb5603bafee08a151b9 Mon Sep 17 00:00:00 2001 From: Sylvain Legrand Date: Wed, 1 Feb 2023 22:42:41 +0100 Subject: [PATCH 20/59] Fix input for progress not shown on lines in edit mode --- htdocs/core/tpl/objectline_edit.tpl.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index dbc8b407fa5..fba73125aa5 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -70,7 +70,7 @@ if (!empty($inputalsopricewithtax)) { if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { $colspan++; // With this, there is a column move button } -if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { +if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { $colspan += 2; } if (isModEnabled('asset') && $object->element == 'invoice_supplier') { @@ -218,7 +218,7 @@ $coldisplay++; } print '>'; - if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { + if (isModEnabled("multicurrency") && $object->multicurrency_code != $conf->currency) { $coldisplay++; print ''; } @@ -286,7 +286,7 @@ $coldisplay++; situation_cycle_ref) { + if ($object->situation_cycle_ref) { $coldisplay++; print ''; $coldisplay++; @@ -490,7 +490,7 @@ jQuery(document).ready(function() } }); - table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?> + table_element_line, array('propaldet', 'commandedet', 'facturedet'))) { ?> $("#date_start, #date_end").focusout(function() { if ( $(this).val() == '' && !$(this).hasClass('inputmandatory') ) { $(this).addClass('inputmandatory'); From 2aa6868f1372b87c598ae7c613c596d7fd0a8bd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 12:17:17 +0100 Subject: [PATCH 21/59] Complete the repair to remove orphelins states and regions --- htdocs/install/mysql/migration/repair.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index a33143f8aef..0d3aa4dc51d 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -576,3 +576,13 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee'; -- DROP TABLE tmp_bank2; -- CREATE TABLE tmp_bank2 SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment_supplier' INNER JOIN llx_paiementfourn as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount; -- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank2 as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL; + + +-- Delete duplicate entries into llx_c_transport_mode +-- VMYSQL4.1 DELETE T1 FROM llx_c_transport_mode as T1, llx_c_transport_mode as T2 where T1.entity = T2.entity AND T1.code = T2.code and T1.rowid > T2.rowid; +-- VPGSQL8.2 DELETE FROM llx_c_transport_mode as T1 WHERE rowid NOT IN (SELECT min(rowid) FROM llx_c_transport_mode GROUP BY code, entity); + +-- Delete department of regions linked to no coutry, then delete region with no country +DELETE FROM llx_c_departements WHERE fk_region <> 0 AND fk_region IN (select code_region FROM llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country)); +DELETE from llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country); + From 8f0f9af94a0a7efdeef2430c4c9f1930990cc294 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 12:27:43 +0100 Subject: [PATCH 22/59] Enhance repair by removing some bad named indexes --- htdocs/install/mysql/migration/repair.sql | 68 +++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 0d3aa4dc51d..26469449a0b 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -586,3 +586,71 @@ DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee'; DELETE FROM llx_c_departements WHERE fk_region <> 0 AND fk_region IN (select code_region FROM llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country)); DELETE from llx_c_regions WHERE fk_pays NOT IN (select rowid from llx_c_country); + +-- Drop duplicate indexes not named correctly and create the only one we should have +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combination; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_2; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_3; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_4; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_5; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_6; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_7; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_8; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_9; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_10; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_11; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_12; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_13; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_14; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_15; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_16; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_17; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_18; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_19; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_20; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_21; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_22; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_23; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_24; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_25; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_26; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_27; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_28; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_29; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_30; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_31; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_32; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_33; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_34; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_35; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_36; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_37; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_38; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_39; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_40; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_41; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_42; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_43; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_44; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_45; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_46; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_47; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_48; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_49; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_50; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_51; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_52; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_53; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_54; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_55; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_56; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_57; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_58; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_59; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_60; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_61; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_62; +alter table llx_product_attribute_combination_price_level drop index fk_product_attribute_combinati_63; +ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE INDEX uk_prod_att_comb_price_level(fk_product_attribute_combination, fk_price_level); + + From fc64d78247f00ed581541035a0d72ec61292bae8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 12:58:12 +0100 Subject: [PATCH 23/59] NEW The upgrade process can be done by creating a file upgrade.unlock --- htdocs/core/modules/modImport.class.php | 1 - htdocs/core/modules/modUser.class.php | 1 - htdocs/install/check.php | 1 + htdocs/install/inc.php | 50 ++++++++++--------- htdocs/install/index.php | 2 + .../install/mysql/migration/17.0.0-18.0.0.sql | 1 + htdocs/install/step5.php | 19 +++++-- htdocs/install/upgrade.php | 1 + htdocs/install/upgrade2.php | 1 + htdocs/langs/en_US/install.lang | 4 +- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 12 files changed, 52 insertions(+), 31 deletions(-) diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 63f0ca5189f..e7dbf1c4b32 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modImport extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index de7bb6feecf..22e7425c7fa 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -32,7 +32,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; */ class modUser extends DolibarrModules { - /** * Constructor. Define names, constants, directories, boxes, permissions * diff --git a/htdocs/install/check.php b/htdocs/install/check.php index c72885ef1ea..0e255969ee8 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -27,6 +27,7 @@ * \brief Test if file conf can be modified and if does not exists, test if install process can create it */ +define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; global $langs; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index e68f0d70a96..970fd40261b 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -180,33 +180,27 @@ if (!empty($dolibarr_main_document_root_alt)) { } -// Security check (old method, when directory is renamed /install.lock) -if (preg_match('/install\.lock/i', $_SERVER["SCRIPT_FILENAME"])) { - if (!is_object($langs)) { - $langs = new Translate('..', $conf); - $langs->setDefaultLang('auto'); - } - $langs->load("install"); +// Check install.lock (for both install and upgrade) - header("X-Content-Type-Options: nosniff"); - header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) - - print $langs->trans("YouTryInstallDisabledByDirLock"); - if (!empty($dolibarr_main_url_root)) { - print 'Click on following link, '; - print $langs->trans("ClickHereToGoToApp"); - print ''; - } - exit; -} - -$lockfile = DOL_DATA_ROOT.'/install.lock'; +$lockfile = DOL_DATA_ROOT.'/install.lock'; // To lock all /install pages +$lockfile2 = DOL_DOCUMENT_ROOT.'/install.lock'; // To lock all /install pages (recommended) +$upgradeunlockfile = DOL_DATA_ROOT.'/upgrade.unlock'; // To unlock upgrade process +$upgradeunlockfile2 = DOL_DOCUMENT_ROOT.'/upgrade.unlock'; // To unlock upgrade process if (constant('DOL_DATA_ROOT') === null) { // We don't have a configuration file yet // Try to detect any lockfile in the default documents path $lockfile = '../../documents/install.lock'; + $upgradeunlockfile = '../../documents/upgrade.unlock'; } -if (@file_exists($lockfile)) { +$islocked=false; +if (@file_exists($lockfile) || @file_exists($lockfile2)) { + if (!defined('ALLOWED_IF_UPGRADE_UNLOCK_FOUND') || (! @file_exists($upgradeunlockfile) && ! @file_exists($upgradeunlockfile2))) { + // If this is a dangerous install page (ALLOWED_IF_UPGRADE_UNLOCK_FOUND not defined) or + // if there is no upgrade unlock files, we lock the pages. + $islocked = true; + } +} +if ($islocked) { // Pages are locked if (!isset($langs) || !is_object($langs)) { $langs = new Translate('..', $conf); $langs->setDefaultLang('auto'); @@ -216,14 +210,22 @@ if (@file_exists($lockfile)) { header("X-Content-Type-Options: nosniff"); header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) - print $langs->trans("YouTryInstallDisabledByFileLock"); + if (GETPOST('action') != 'upgrade') { + print $langs->trans("YouTryInstallDisabledByFileLock").'
'; + } else { + print $langs->trans("YouTryUpgradeDisabledByMissingFileUnLock").'
'; + } if (!empty($dolibarr_main_url_root)) { - print $langs->trans("ClickOnLinkOrRemoveManualy").'
'; + if (GETPOST('action') != 'upgrade') { + print $langs->trans("ClickOnLinkOrRemoveManualy").'
'; + } else { + print $langs->trans("ClickOnLinkOrCreateUnlockFileManualy").'
'; + } print ''; print $langs->trans("ClickHereToGoToApp"); print ''; } else { - print 'If you always reach this page, you must remove install.lock file manually.
'; + print 'If you always reach this page, you must remove the install.lock file manually.
'; } exit; } diff --git a/htdocs/install/index.php b/htdocs/install/index.php index 6810e3c509f..d62f82eaa27 100644 --- a/htdocs/install/index.php +++ b/htdocs/install/index.php @@ -23,6 +23,8 @@ * \brief Show page to select language. This is done only for a first installation. * For a reinstall this page redirect to page check.php */ + +define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; include_once '../core/class/html.form.class.php'; include_once '../core/class/html.formadmin.class.php'; diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 5999acf05a8..c97d080db3a 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -37,6 +37,7 @@ -- VMYSQL4.3 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN `rank` rankorder integer; -- VPGSQL8.2 ALTER TABLE llx_hrm_skillrank CHANGE COLUMN rank rankorder integer; +ALTER TABLE llx_accounting_system CHANGE COLUMN fk_pays fk_country integer; -- v18 diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index c516cc70aef..fc0dcf37799 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -24,8 +24,18 @@ * \file htdocs/install/step5.php * \ingroup install * \brief Last page of upgrade / install process + * + * This page is called with parameter action=set by step4.php or action=upgrade by upgrade2.php + * For installation: + * It creates the login admin and set the MAIN_SECURITY_SALT to a random value. + * It set the value for MAIN_VERSION_LAST_INSTALL + * It creates the install.lock and shows the final message. + * For upgrade: + * It updates the value for MAIN_VERSION_LAST_UPGRADE. + * It (re)creates the install.lock and shows the final message. */ +define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; if (file_exists($conffile)) { include_once $conffile; @@ -384,7 +394,7 @@ if ($action == "set") { if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { $force_install_lockinstall = 444; // For backward compatibility } - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")"); fclose($fp); @chmod($lockfile, octdec($force_install_lockinstall)); $createlock = 1; @@ -416,8 +426,9 @@ if ($action == "set") { } elseif (empty($action) || preg_match('/upgrade/i', $action)) { // If upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { - // Upgrade is finished (database is on same version than files) - print 'Configuration '.$langs->trans("SystemIsUpgraded")."
"; + // Upgrade is finished (database is on the same version than files) + print 'Configuration'; + print ' '.$langs->trans("SystemIsUpgraded")."
"; // Create install.lock file if it does not exists. // Note: it should always exists. A better solution to allow upgrade will be to add an upgrade.unlock file @@ -430,7 +441,7 @@ if ($action == "set") { if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { $force_install_lockinstall = 444; // For backward compatibility } - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")"); fclose($fp); @chmod($lockfile, octdec($force_install_lockinstall)); $createlock = 1; diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 22ef26295aa..1cccc3cc129 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -36,6 +36,7 @@ * \brief Run migration script */ +define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; if (!file_exists($conffile)) { print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").'; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 1e153109140..7f76261bcea 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -38,6 +38,7 @@ * \brief Upgrade some data */ +define('ALLOWED_IF_UPGRADE_UNLOCK_FOUND', 1); include_once 'inc.php'; if (!file_exists($conffile)) { print 'Error: Dolibarr config file was not found. This may means that Dolibarr is not installed yet. Please call the page "/install/index.php" instead of "/install/upgrade.php").'; diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index d0c841fe802..58e57018ac3 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -88,7 +88,7 @@ LoginAlreadyExists=Already exists DolibarrAdminLogin=Dolibarr admin login AdminLoginAlreadyExists=Dolibarr administrator account '%s' already exists. Go back if you want to create another one. FailedToCreateAdminLogin=Failed to create Dolibarr administrator account. -WarningRemoveInstallDir=Warning, for security reasons, once the install or upgrade is complete, you should add a file called install.lock into the Dolibarr document directory in order to prevent the accidental/malicious use of the install tools again. +WarningRemoveInstallDir=Warning, for security reasons, once the installation process is complete, you must add a file called install.lock into the Dolibarr document directory in order to prevent the accidental/malicious use of the install tools again. FunctionNotAvailableInThisPHP=Not available in this PHP ChoosedMigrateScript=Choose migration script DataMigration=Database migration (data) @@ -208,8 +208,10 @@ HideNotAvailableOptions=Hide unavailable options ErrorFoundDuringMigration=Error(s) were reported during the migration process so next step is not available. To ignore errors, you can click here, but the application or some features may not work correctly until the errors are resolved. YouTryInstallDisabledByDirLock=The application tried to self-upgrade, but the install/upgrade pages have been disabled for security (directory renamed with .lock suffix).
YouTryInstallDisabledByFileLock=The application tried to self-upgrade, but the install/upgrade pages have been disabled for security (by the existence of a lock file install.lock in the dolibarr documents directory).
+YouTryUpgradeDisabledByMissingFileUnLock=The application tried to self-upgrade, but the upgrade process is currently not allowed.
ClickHereToGoToApp=Click here to go to your application ClickOnLinkOrRemoveManualy=If an upgrade is in progress, please wait. If not, click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory. +ClickOnLinkOrCreateUnlockFileManualy=If an upgrade is in progress, please wait... If not, you must create a file upgrade.unlock into the Dolibarr documents directory. Loaded=Loaded FunctionTest=Function test NodoUpgradeAfterDB=No action requested by external modules after upgrade of database diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 027305965ed..d2035edc58e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4867,6 +4867,7 @@ div.divphotoref > div > .photowithmargin, div.divphotoref > img.photowithmargin, { content:url(); /* content is used to best fit the container */ display: inline-block; + opacity: 0.2; } .nographyet { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 2493afa058b..33ceb6a1481 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4892,6 +4892,7 @@ div.divphotoref > img.photowithmargin, div.divphotoref > a > .photowithmargin { { content:url(); /* content is used to best fit the container */ display: inline-block; + opacity: 0.2; } .nographyet { From fb655a0b0a74a4c3dca77dca532e280acdb92bad Mon Sep 17 00:00:00 2001 From: Rept0id Date: Thu, 2 Feb 2023 16:50:50 +0200 Subject: [PATCH 24/59] Updated function dol_eval, added error handling - There were cases that dol_eval() would break the whole system. -That was happening in case of using a new version plugin on an old version dolibarr. New plugin validates through isModActive() instead of $conf->moduleName->enabled. Even if you were deactivating the plugin, or totally delete it, the records were still on database for menu, so there were no obvious solution. This update adds a backwards compatibility, makes doli more stable and counterparts the use of eval, making it more safe. - Use of eval is not bad, as well there are techniques in any project that are project-related useful and smart. For example, Linux kernel uses GOTO. But in such cases, there needs to be a safety net. -I found out this after a lot of trouble, I hope this small fix will save other developers. :+1: --- htdocs/core/lib/functions.lib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4be0fd2006f..4279f7a73ed 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8946,6 +8946,7 @@ function verifCond($strToEvaluate) */ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1') { + try { // Only global variables can be changed by eval function and returned to caller global $db, $langs, $user, $conf, $website, $websitepage; global $action, $mainmenu, $leftmenu; @@ -9049,6 +9050,13 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' eval($s); } } + } catch (Error $e) { + $error = 'Caught error : '; + $error .= $e->getMessage() . ', '; + $error .= 'Trace : '; + $error .= json_encode($e->getTrace()); + error_log($error, 1); + } } /** From 1be5145148ec0037b545ac1fc834c97b4a6d7120 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 14:56:03 +0100 Subject: [PATCH 25/59] NEW Add more zip, town, country for owner of a bank account --- .../qr-bar-codes/QR code for invoices.txt | 4 +- htdocs/compta/bank/card.php | 122 +++++++++++++----- htdocs/compta/bank/class/account.class.php | 56 +++++--- htdocs/core/class/commoninvoice.class.php | 6 +- .../install/mysql/migration/17.0.0-18.0.0.sql | 7 + .../install/mysql/tables/llx_bank_account.sql | 3 + htdocs/langs/en_US/banks.lang | 3 + 7 files changed, 148 insertions(+), 53 deletions(-) diff --git a/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt b/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt index b388ed0c599..b14f33638c2 100644 --- a/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt +++ b/dev/resources/iso-normes/qr-bar-codes/QR code for invoices.txt @@ -22,8 +22,8 @@ https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a- Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php -* FOR QR-Bill in switzerland ----------------------------- +* FOR QR-Bill in switzerland - Facture-QR +----------------------------------------- Syntax of QR Code https://www.swiss-qr-invoice.org/fr/ Syntax of complentary field named "structured information of invoice S1": https://www.swiss-qr-invoice.org/downloads/qr-bill-s1-syntax-fr.pdf To test/validate: https://www.swiss-qr-invoice.org/validator/ diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 15cb5123e0f..3ba717f7a51 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -51,7 +51,7 @@ if (isModEnabled('accounting')) { } // Load translation files required by the page -$langs->loadLangs(array("banks", "bills", "categories", "companies", "compta")); +$langs->loadLangs(array("banks", "bills", "categories", "companies", "compta", "withdrawals")); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); @@ -140,6 +140,9 @@ if (empty($reshook)) { $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); + $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); + $object->owner_town = trim(GETPOST("owner_town", 'alphanohtml')); + $object->owner_country_id = GETPOST("owner_country_id", 'int'); $object->ics = trim(GETPOST("ics", 'alpha')); $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); @@ -241,6 +244,9 @@ if (empty($reshook)) { $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); + $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); + $object->owner_town = trim(GETPOST("owner_town", 'alphanohtml')); + $object->owner_country_id = GETPOST("owner_country_id", 'int'); $object->ics = trim(GETPOST("ics", 'alpha')); $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); @@ -422,7 +428,8 @@ if ($action == 'create') { print '
'; print ''; + $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value + if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { + print '"; + } + // Web print ''; print ''; if (isModEnabled('paymentbybanktransfer')) { - print ''; - print ''; + print ''; } + print '
'; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print ''; print ''; @@ -243,13 +250,19 @@ if (!empty($arrayfields['ty.label']['checked'])) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Action column -print ''; -$searchpicto = $form->showFilterAndCheckAddButtons(0); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + print '
'; + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete('', 'class="marginleftonly"'); + print ''; + print ''; print $resource->getNomUrl(5); @@ -287,15 +316,18 @@ if ($ret) { $obj = (Object) $resource->array_options; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - print ''; - print ''; - print img_edit(); - print ''; - print ' '; - print ''; - print img_delete('', 'class="marginleftonly"'); - print ''; - print ''; + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete('', 'class="marginleftonly"'); + print ''; + print '%
'.$langs->trans("BankAccountCountry").''; - print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id'); + print img_picto('', 'country', 'class="pictofixedwidth"'); + print $form->select_country($selectedcode, 'account_country_id'); if ($user->admin) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } @@ -438,6 +445,14 @@ if ($action == 'create') { } print '
'.$langs->trans("BankAccountDomiciliation").''; + print '
'.$langs->trans("Web").''; @@ -552,18 +567,15 @@ if ($action == 'create') { print '
'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").' '; - print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info'); + print '
'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; print '
'; + print '
'; - print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; - - print ''.$langs->trans("BankAccountOwner").''; + print ''; + print ''; print ''; @@ -572,8 +584,22 @@ if ($action == 'create') { print (GETPOST('owner_address') ?GETPOST('owner_address', 'alpha') : $object->owner_address); print ""; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + print '
'.$langs->trans("BankAccountOwner").''; print '
'.$langs->trans("BankAccountOwnerZip").''; + print '
'.$langs->trans("BankAccountOwnerTown").''; + print '
'.$langs->trans("BankAccountOwnerCountry").''; + print img_picto('', 'country', 'class="pictofixedwidth"'); + print $form->select_country(GETPOST('owner_country_id') ?GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id'); + print '
'; - print '
'; + print '
'; } print ''; @@ -722,8 +748,6 @@ if ($action == 'create') { print '
'; if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) { - //print '
'; - print ''; print ''; @@ -787,16 +811,11 @@ if ($action == 'create') { print ''; print ''; - print '\n"; } - print '\n"; - print '\n"; @@ -805,6 +824,22 @@ if ($action == 'create') { print nl2br($object->owner_address); print "\n"; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + print '
'.$langs->trans("BankName").''.$object->ics_transfer.'
'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").''; - print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . ' '; - print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info'); + print '
'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).''; + print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")); print "
'.$langs->trans("BankAccountDomiciliation").''; - print nl2br($object->domiciliation); - print "
'.$langs->trans("BankAccountOwner").''; print $object->proprio; print "
'.$langs->trans("BankAccountOwnerZip").''.$object->owner_zip; + print '
'.$langs->trans("BankAccountOwnerTown").''.$object->owner_town; + print '
'.$langs->trans("BankAccountOwnerCountry").''; + $object->owner_country_code = dol_getIdFromCode($db, $object->owner_country_id, 'c_country', 'rowid', 'code'); + $langs->load("dict"); + print (empty($object->owner_country_code) ? '' : $langs->convToOutputCharset($langs->transnoentitiesnoconv("Country".$object->owner_country_code))); + + print '
'; } @@ -933,6 +968,14 @@ if ($action == 'create') { } print ''; + $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value + if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { + print ''.$langs->trans("BankAccountDomiciliation").''; + print '"; + } + // Conciliable print ''.$langs->trans("Conciliable").''; print ''; @@ -942,7 +985,7 @@ if ($action == 'create') { } elseif ($conciliate == -3) { print $langs->trans("No").' ('.$langs->trans("Closed").')'; } else { - print ' 0) ? '' : ' checked="checked"').'"> '; + print ' 0) ? '' : ' checked="checked"').'"> '; } print ''; @@ -993,7 +1036,7 @@ if ($action == 'create') { } print ''; - print '
'; + print '
'; //print '
'; @@ -1030,8 +1073,6 @@ if ($action == 'create') { if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print '
'; - //print '
'; - print ''; // If bank account @@ -1087,26 +1128,39 @@ if ($action == 'create') { print ''; print ''; - print ''; - print ''; + print ''; } - print '"; - print ''; print ''; print ''; - print '
'.$form->textwithpicto($langs->trans("IDS"), $langs->trans("IDS").' ('.$langs->trans("UsedFor", $langs->transnoentitiesnoconv("BankTransfer")).')').'
'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'pti_in_ctti ? ' checked ' : '') . '> '; - print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info'); + print '
'.$form->textwithpicto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).'pti_in_ctti ? ' checked ' : '') . '>'; print '
'.$langs->trans("BankAccountDomiciliation").''; - print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'; + print '
'; + + print ''; + + print '"; + print ''; + print ''; + + print ''; + print ''; + + print ''; + print ''; + print '
'.$langs->trans("BankAccountOwnerAddress").''; print '
'.$langs->trans("BankAccountOwnerZip").''; + print '
'.$langs->trans("BankAccountOwnerTown").''; + print '
'.$langs->trans("BankAccountOwnerCountry").''; + print img_picto('', 'country', 'class="pictofixedwidth"'); + print $form->select_country(GETPOST('owner_country_id') ?GETPOST('owner_country_id', 'alpha') : $object->owner_country_id, 'owner_country_id'); + print '
'; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e144677832f..a623184478b 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -146,12 +146,6 @@ class Account extends CommonObject */ public $iban_prefix; - /** - * Address of the bank - * @var string - */ - public $domiciliation; - /** * XML SEPA format: place Payment Type Information (PmtTpInf) in Credit Transfer Transaction Information (CdtTrfTxInf) * @var int @@ -169,7 +163,17 @@ class Account extends CommonObject * @var string */ public $owner_address; + public $owner_zip; + public $owner_town; + public $owner_country_id; + public $owner_country_code; + /** + * Address of the bank account + * @var string + */ + public $domiciliation; // deprecated, use now address + public $address; public $state_id; public $state_code; public $state; @@ -297,10 +301,13 @@ class Account extends CommonObject 'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75), 'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'state_id' =>array('type'=>'integer', 'label'=>'State id', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), + 'state_id' =>array('type'=>'integer', 'label'=>'StateId', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), 'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'owner_address' =>array('type'=>'text', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'owner_address' =>array('type'=>'varchar(255)', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'owner_zip' =>array('type'=>'varchar(25)', 'label'=>'Owner zip', 'enabled'=>1, 'visible'=>-1, 'position'=>106), + 'owner_town' =>array('type'=>'varchar(50)', 'label'=>'Owner town', 'enabled'=>1, 'visible'=>-1, 'position'=>107), + 'owner_country_id' =>array('type'=>'integer', 'label'=>'Owner country', 'enabled'=>1, 'visible'=>-1, 'position'=>108), 'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110), 'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115), 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), @@ -698,6 +705,9 @@ class Account extends CommonObject $sql .= ", pti_in_ctti"; $sql .= ", proprio"; $sql .= ", owner_address"; + $sql .= ", owner_zip"; + $sql .= ", owner_town"; + $sql .= ", owner_country_id"; $sql .= ", currency_code"; $sql .= ", rappro"; $sql .= ", min_allowed"; @@ -713,7 +723,7 @@ class Account extends CommonObject $sql .= ", '".$this->db->escape($this->label)."'"; $sql .= ", ".((int) $conf->entity); $sql .= ", '".$this->db->escape($this->account_number)."'"; - $sql .= ", ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null"); + $sql .= ", ".($this->fk_accountancy_journal > 0 ? ((int) $this->fk_accountancy_journal) : "null"); $sql .= ", '".$this->db->escape($this->bank)."'"; $sql .= ", '".$this->db->escape($this->code_banque)."'"; $sql .= ", '".$this->db->escape($this->code_guichet)."'"; @@ -725,6 +735,9 @@ class Account extends CommonObject $sql .= ", ".((int) $this->pti_in_ctti); $sql .= ", '".$this->db->escape($this->proprio)."'"; $sql .= ", '".$this->db->escape($this->owner_address)."'"; + $sql .= ", '".$this->db->escape($this->owner_zip)."'"; + $sql .= ", '".$this->db->escape($this->owner_town)."'"; + $sql .= ", ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null"); $sql .= ", '".$this->db->escape($this->currency_code)."'"; $sql .= ", ".((int) $this->rappro); $sql .= ", ".price2num($this->min_allowed, 'MT'); @@ -836,7 +849,7 @@ class Account extends CommonObject $sql .= ",rappro = ".((int) $this->rappro); $sql .= ",url = ".($this->url ? "'".$this->db->escape($this->url)."'" : "null"); $sql .= ",account_number = '".$this->db->escape($this->account_number)."'"; - $sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null"); + $sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? ((int) $this->fk_accountancy_journal) : "null"); $sql .= ",bank = '".$this->db->escape($this->bank)."'"; $sql .= ",code_banque='".$this->db->escape($this->code_banque)."'"; $sql .= ",code_guichet='".$this->db->escape($this->code_guichet)."'"; @@ -848,6 +861,9 @@ class Account extends CommonObject $sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti); $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; + $sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'"; + $sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'"; + $sql .= ",owner_country_id = ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null"); $sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'"; @@ -931,6 +947,9 @@ class Account extends CommonObject $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; + $sql .= ",owner_zip = '".$this->db->escape($this->owner_zip)."'"; + $sql .= ",owner_town = '".$this->db->escape($this->owner_town)."'"; + $sql .= ",owner_country_id = ".($this->owner_country_id > 0 ? ((int) $this->owner_country_id) : "null"); $sql .= ",state_id = ".($this->state_id > 0 ? $this->state_id : "null"); $sql .= ",fk_pays = ".($this->country_id > 0 ? $this->country_id : "null"); $sql .= " WHERE rowid = ".((int) $this->id); @@ -967,13 +986,13 @@ class Account extends CommonObject $sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,"; $sql .= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,"; - $sql .= " ba.domiciliation, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,"; + $sql .= " ba.domiciliation as address, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.owner_zip, ba.owner_town, ba.owner_country_id, ba.state_id, ba.fk_pays as country_id,"; $sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,"; $sql .= " ba.min_allowed, ba.min_desired, ba.comment,"; $sql .= " ba.datec as date_creation, ba.tms as date_update, ba.ics, ba.ics_transfer,"; $sql .= ' c.code as country_code, c.label as country,'; - $sql .= ' d.code_departement as state_code, d.nom as state'; - $sql .= ' , aj.code as accountancy_journal'; + $sql .= ' d.code_departement as state_code, d.nom as state,'; + $sql .= ' aj.code as accountancy_journal'; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON ba.fk_pays = c.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ba.state_id = d.rowid'; @@ -1009,10 +1028,14 @@ class Account extends CommonObject $this->cle_rib = $obj->cle_rib; $this->bic = $obj->bic; $this->iban = $obj->iban; - $this->domiciliation = $obj->domiciliation; + $this->domiciliation = $obj->address; + $this->address = $obj->address; $this->pti_in_ctti = $obj->pti_in_ctti; $this->proprio = $obj->proprio; $this->owner_address = $obj->owner_address; + $this->owner_zip = $obj->owner_zip; + $this->owner_town = $obj->owner_town; + $this->owner_country_id = $obj->owner_country_id; $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; @@ -1723,6 +1746,9 @@ class Account extends CommonObject $this->domiciliation = 'Banque de France'; $this->proprio = 'Owner'; $this->owner_address = 'Owner address'; + $this->owner_zip = 'Owner zip'; + $this->owner_town = 'Owner town'; + $this->owner_country_id = 'Owner country_id'; $this->country_id = 1; } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index dd0ec988062..cc871fd1ef2 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -1735,15 +1735,17 @@ abstract class CommonInvoice extends CommonObject $complementaryinfo .= '/30/'.$this->thirdparty->tva_intra; } + $bankaccount = new Account($this->db); + // Header $s = ''; $s .= "SPC\n"; $s .= "0200\n"; $s .= "1\n"; + // Info seller if ($this->fk_account > 0) { // Bank BAN if country is LI or CH - // TODO Add - $bankaccount = new Account($this->db); + // TODO Add test on bank iban $bankaccount->fetch($this->fk_account); $s .= $bankaccount->iban."\n"; } else { diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index c97d080db3a..11495748eff 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -64,3 +64,10 @@ ALTER TABLE llx_website ADD COLUMN pageviews_previous_month BIGINT UNSIGNED DEFA ALTER TABLE llx_product_stock ADD CONSTRAINT fk_product_product_rowid FOREIGN KEY (fk_product) REFERENCES llx_product (rowid); ALTER TABLE llx_product_stock ADD CONSTRAINT fk_entrepot_entrepot_rowid FOREIGN KEY (fk_entrepot) REFERENCES llx_entrepot (rowid); + + +ALTER TABLE llx_bank_account ADD COLUMN owner_zip varchar(25); +ALTER TABLE llx_bank_account ADD COLUMN owner_town varchar(50); +ALTER TABLE llx_bank_account ADD COLUMN owner_country_id integer DEFAULT NULL; + + diff --git a/htdocs/install/mysql/tables/llx_bank_account.sql b/htdocs/install/mysql/tables/llx_bank_account.sql index d9713b66d38..d7b8941e69b 100644 --- a/htdocs/install/mysql/tables/llx_bank_account.sql +++ b/htdocs/install/mysql/tables/llx_bank_account.sql @@ -47,6 +47,9 @@ create table llx_bank_account fk_pays integer NOT NULL, proprio varchar(60), owner_address varchar(255), + owner_zip varchar(25), + owner_town varchar(50), + owner_country_id integer DEFAULT NULL, courant smallint DEFAULT 0 NOT NULL, clos smallint DEFAULT 0 NOT NULL, rappro smallint DEFAULT 1, diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 10ba859e71f..7be02da2c27 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -49,6 +49,9 @@ BankAccountDomiciliation=Bank address BankAccountCountry=Account country BankAccountOwner=Account owner name BankAccountOwnerAddress=Account owner address +BankAccountOwnerZip=Account owner zip +BankAccountOwnerTown=Account owner town +BankAccountOwnerCountry=Account owner country CreateAccount=Create account NewBankAccount=New account NewFinancialAccount=New financial account From e9c43718ba00b902c6c090b3af5571235619b590 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 20:53:07 +0100 Subject: [PATCH 26/59] Fix error was not propagated correctly --- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/paiement/class/paiement.class.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index a623184478b..71ec8393e09 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 return 0; } } else { - $this->error = $this->db->lasterror; + $this->error = $this->db->lasterror(); $this->errors[] = $this->error; return -1; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ec1392e9ea7..373fa2d5175 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -643,6 +643,8 @@ class Paiement extends CommonObject $acc = new Account($this->db); $result = $acc->fetch($this->fk_account); if ($result < 0) { + $this->error = $acc->error; + $this->errors = $acc->errors; $error++; return -1; } @@ -768,7 +770,7 @@ class Paiement extends CommonObject } // Add link 'InvoiceRefused' in bank_url - if (! $error && $label == '(InvoiceRefused)') { + if (!$error && $label == '(InvoiceRefused)') { $result=$acc->add_url_line( $bank_line_id, $this->id_prelevement, @@ -788,6 +790,7 @@ class Paiement extends CommonObject } } else { $this->error = $acc->error; + $this->errors = $acc->errors; $error++; } From af61006b8b18e2f91cf4a148029566189b23335a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Feb 2023 21:11:52 +0100 Subject: [PATCH 27/59] Add missing call of hook doActions in projet/contact.php --- htdocs/projet/contact.php | 295 +++++++++++++++++++------------------- 1 file changed, 151 insertions(+), 144 deletions(-) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 2174a02c347..43fdb1a3ca2 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -69,134 +69,142 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard')); * Actions */ -// Test if we can add contact to the tasks at the same times, if not or not required, make a redirect -$formconfirmtoaddtasks = ''; -if ($action == 'addcontact') { - $form = new Form($db); - - $source=GETPOST("source", 'aZ09'); - - $taskstatic = new Task($db); - $task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0); - $nbTasks = count($task_array); - - //If no task avaiblable, redirec to to add confirm - $type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type')); - $personToAffect = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); - $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect); - $url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source; - - if ($personToAffect > 0 && (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0)) { - $text = $langs->trans('AddPersonToTask'); - $textbody = $text.' ('.$langs->trans("SelectAll").')'; - $formquestion = array('text' => $textbody); - - $task_to_affect = array(); - foreach ($task_array as $task) { - $task_already_affected=false; - $personsLinked = $task->liste_contact(-1, $source); - if (!is_array($personsLinked) && count($personsLinked) < 0) { - setEventMessage($object->error, 'errors'); - } else { - foreach ($personsLinked as $person) { - if ($person['id']==$personToAffect) { - $task_already_affected = true; - break; - } - } - if (!$task_already_affected) { - $task_to_affect[$task->id] = $task->id; - } - } - } - - if (empty($task_to_affect)) { - $action = 'addcontact_confirm'; - } else { - $formcompany = new FormCompany($db); - foreach ($task_array as $task) { - $key = $task->id; - $val = $task->ref . ' '.dol_trunc($task->label); - $formquestion[] = array( - 'type' => 'other', - 'name' => 'person_'.$key.',person_role_'.$key, - 'label' => '
"; + $db->free($resql); } else { - $result .= ''.$langs->trans("NoInvoice").''; + dol_print_error($db); } - $result .= "
"; - $db->free($resql); - } else { - dol_print_error($db); } return $result; @@ -565,119 +571,122 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) { global $conf, $db, $langs, $user, $hookmanager; - $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); - $result = ''; - $facturesupplierstatic = new FactureFournisseur($db); - $sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye"; - $sql .= ", s.nom as name"; - $sql .= ", s.rowid as socid, s.email"; - $sql .= ", s.code_client, s.code_compta"; - $sql .= ", s.code_fournisseur, s.code_compta_fournisseur"; - $sql .= ", cc.rowid as country_id, cc.code as country_code"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; - if (empty($user->rights->societe->client->voir) && !$socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - $sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT; - $sql .= " AND f.entity IN (".getEntity('invoice').')'; - if (empty($user->rights->societe->client->voir) && !$socid) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); - } - if ($socid) { - $sql .= " AND f.fk_soc = ".((int) $socid); - } - // Add where from hooks - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters); - $sql .= $hookmanager->resPrint; - $resql = $db->query($sql); + if ((isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && !empty($user->rights->facture->lire)) { + $maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); - if ($resql) { - $num = $db->num_rows($resql); - $nbofloop = min($num, $maxofloop); + $facturesupplierstatic = new FactureFournisseur($db); - $result .= '
'; - $result .= ''; + $sql = "SELECT f.ref, f.rowid, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.fk_statut as status, f.paye"; + $sql .= ", s.nom as name"; + $sql .= ", s.rowid as socid, s.email"; + $sql .= ", s.code_client, s.code_compta"; + $sql .= ", s.code_fournisseur, s.code_compta_fournisseur"; + $sql .= ", cc.rowid as country_id, cc.code as country_code"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays"; + if (empty($user->rights->societe->client->voir) && !$socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT; + $sql .= " AND f.entity IN (".getEntity('invoice').')'; + if (empty($user->rights->societe->client->voir) && !$socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); + } + if ($socid) { + $sql .= " AND f.fk_soc = ".((int) $socid); + } + // Add where from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListWhereSupplierDraft', $parameters); + $sql .= $hookmanager->resPrint; + $resql = $db->query($sql); - $result .= ''; - $result .= ''; - $result .= ''; + if ($resql) { + $num = $db->num_rows($resql); + $nbofloop = min($num, $maxofloop); - if ($num) { - $companystatic = new Societe($db); + $result .= '
'; + $result .= '
'; - $result .= $langs->trans("SuppliersDraftInvoices").' '; - $result .= ''; - $result .= ''.$num.''; - $result .= ''; - $result .= '
'; - $i = 0; - $othernb = 0; - $tot_ttc = 0; - while ($i < $nbofloop) { - $obj = $db->fetch_object($resql); + $result .= ''; + $result .= ''; + $result .= ''; - if ($i >= $maxCount) { - $othernb += 1; - $i++; + if ($num) { + $companystatic = new Societe($db); + + $i = 0; + $othernb = 0; + $tot_ttc = 0; + while ($i < $nbofloop) { + $obj = $db->fetch_object($resql); + + if ($i >= $maxCount) { + $othernb += 1; + $i++; + $tot_ttc += $obj->total_ttc; + continue; + } + + $facturesupplierstatic->ref = $obj->ref; + $facturesupplierstatic->id = $obj->rowid; + $facturesupplierstatic->total_ht = $obj->total_ht; + $facturesupplierstatic->total_tva = $obj->total_tva; + $facturesupplierstatic->total_ttc = $obj->total_ttc; + $facturesupplierstatic->ref_supplier = $obj->ref_supplier; + $facturesupplierstatic->type = $obj->type; + $facturesupplierstatic->statut = $obj->status; + $facturesupplierstatic->paye = $obj->paye; + + $companystatic->id = $obj->socid; + $companystatic->name = $obj->name; + $companystatic->email = $obj->email; + $companystatic->country_id = $obj->country_id; + $companystatic->country_code = $obj->country_code; + $companystatic->fournisseur = 1; + $companystatic->code_client = $obj->code_client; + $companystatic->code_fournisseur = $obj->code_fournisseur; + $companystatic->code_compta = $obj->code_compta; + $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + + $result .= ''; + $result .= ''; + $result .= ''; + $result .= ''; + $result .= ''; $tot_ttc += $obj->total_ttc; - continue; + $i++; } - $facturesupplierstatic->ref = $obj->ref; - $facturesupplierstatic->id = $obj->rowid; - $facturesupplierstatic->total_ht = $obj->total_ht; - $facturesupplierstatic->total_tva = $obj->total_tva; - $facturesupplierstatic->total_ttc = $obj->total_ttc; - $facturesupplierstatic->ref_supplier = $obj->ref_supplier; - $facturesupplierstatic->type = $obj->type; - $facturesupplierstatic->statut = $obj->status; - $facturesupplierstatic->paye = $obj->paye; + if ($othernb) { + $result .= ''; + $result .= ''; + $result .= "\n"; + } - $companystatic->id = $obj->socid; - $companystatic->name = $obj->name; - $companystatic->email = $obj->email; - $companystatic->country_id = $obj->country_id; - $companystatic->country_code = $obj->country_code; - $companystatic->fournisseur = 1; - $companystatic->code_client = $obj->code_client; - $companystatic->code_fournisseur = $obj->code_fournisseur; - $companystatic->code_compta = $obj->code_compta; - $companystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; - - $result .= ''; - $result .= ''; - $result .= ''; - $result .= ''; + $result .= ''; + $result .= ''; $result .= ''; - $tot_ttc += $obj->total_ttc; - $i++; + } else { + $result .= ''; } - - if ($othernb) { - $result .= ''; - $result .= ''; - $result .= "\n"; - } - - $result .= ''; - $result .= ''; - $result .= ''; + $result .= "
'; + $result .= $langs->trans("SuppliersDraftInvoices").' '; + $result .= ''; + $result .= ''.$num.''; + $result .= ''; + $result .= '
'; + $result .= $facturesupplierstatic->getNomUrl(1, ''); + $result .= ''; + $result .= $companystatic->getNomUrl(1, 'supplier'); + $result .= ''.price($obj->total_ttc).'
'; + $result .= ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; + $result .= '
'; - $result .= $facturesupplierstatic->getNomUrl(1, ''); - $result .= ''; - $result .= $companystatic->getNomUrl(1, 'supplier'); - $result .= ''.price($obj->total_ttc).'
'.$langs->trans("Total").''.price($tot_ttc).'
'.$langs->trans("NoInvoice").'
'; - $result .= ''.$langs->trans("More").'...'.($othernb < $maxofloop ? ' ('.$othernb.')' : '').''; - $result .= '
'.$langs->trans("Total").''.price($tot_ttc).'
"; + $db->free($resql); } else { - $result .= ''.$langs->trans("NoInvoice").''; + dol_print_error($db); } - $result .= ""; - $db->free($resql); - } else { - dol_print_error($db); } return $result; From 1f195a3be57844a5e791b529f859426d54380857 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Feb 2023 14:04:25 +0100 Subject: [PATCH 48/59] Fix #yogosha14963 --- ChangeLog | 2 +- htdocs/adherents/class/subscription.class.php | 2 +- htdocs/comm/propal/class/propal.class.php | 4 +-- htdocs/commande/class/commande.class.php | 4 +-- htdocs/compta/bank/class/account.class.php | 2 +- .../facture/class/facture-rec.class.php | 4 +-- htdocs/compta/facture/class/facture.class.php | 4 +-- htdocs/contact/class/contact.class.php | 6 ++--- htdocs/contrat/class/contrat.class.php | 8 +++--- htdocs/core/actions_addupdatedelete.inc.php | 25 ++++++++++++++++--- .../core/class/emailsenderprofile.class.php | 2 +- htdocs/core/lib/company.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/tpl/commonfields_add.tpl.php | 18 +++++++++++-- htdocs/core/tpl/commonfields_edit.tpl.php | 10 +++++++- .../class/emailcollector.class.php | 2 -- .../class/conferenceorbooth.class.php | 2 +- .../class/expensereport.class.php | 4 +-- htdocs/fichinter/class/fichinter.class.php | 6 ++--- .../class/fournisseur.commande.class.php | 4 +-- .../class/fournisseur.facture-rec.class.php | 4 +-- .../fourn/class/fournisseur.facture.class.php | 4 +-- htdocs/projet/class/project.class.php | 4 +-- htdocs/societe/class/societe.class.php | 4 +-- htdocs/societe/class/societeaccount.class.php | 4 +-- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/website/class/websitepage.class.php | 2 +- 27 files changed, 88 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00fbde60b91..350a29fe051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,7 @@ Following changes may create regressions for some external modules, but were nec * The method "nb_expedition()" has been renamed into "countNbOfShipments()" * Revert default type of hooks. Default is now 'addreplace' hooks (and exception become 'output' hooks, that become deprecated). * Deprecated property libelle removed from entrepot class. - +* The type 'text' in ->fields property dos not accept html content anymore. Use the type 'html' for that. ***** ChangeLog for 17.0.0 compared to 16.0.0 ***** diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index b5079676603..c8994283fe1 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -109,7 +109,7 @@ class Subscription extends CommonObject 'datef' =>array('type'=>'datetime', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35), 'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1), 'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45), - 'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'note' =>array('type'=>'html', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50), 'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c4328328f18..41913afe8b9 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -327,8 +327,8 @@ class Propal extends CommonObject 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 2a462f77bc4..bca5992b5ba 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -328,8 +328,8 @@ class Commande extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160), //'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165), 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170), diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 71ec8393e09..36bf8795f47 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -323,7 +323,7 @@ class Account extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), '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), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 269c5267ab3..0ec2deed6e1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -185,8 +185,8 @@ class FactureRec extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), 'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 561ebf3e9ed..75869a900dd 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -341,8 +341,8 @@ class Facture extends CommonInvoice 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225), 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230), diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 52ea2b69c8d..b9963b1e16c 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -101,7 +101,7 @@ class Contact extends CommonObject 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>52), 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), - 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70), 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75), 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>77, 'searchall'=>1), @@ -117,8 +117,8 @@ class Contact extends CommonObject 'fk_stcommcontact' =>array('type'=>'integer', 'label'=>'ProspectStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), 'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>300), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index ad2cbcea84b..6078e33cb6a 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -238,8 +238,8 @@ class Contrat extends CommonObject 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105, 'searchall'=>1), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), @@ -2988,8 +2988,8 @@ class ContratLigne extends CommonObjectLine 'fk_contrat' =>array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'Contract', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70), 'fk_product' =>array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>-1, 'position'=>75), //'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), //'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), //'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), //'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 18ab3ac5eda..71901f8db44 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -76,8 +76,20 @@ if ($action == 'add' && !empty($permissiontoadd)) { } // Set value to insert - if (in_array($object->fields[$key]['type'], array('text', 'html'))) { - $value = GETPOST($key, 'restricthtml'); + if (preg_match('/^text/', $object->fields[$key]['type'])) { + $tmparray = explode(':', $object->fields[$key]['type']); + if (!empty($tmparray[1])) { + $value = GETPOST($key, $tmparray[1]); + } else { + $value = GETPOST($key, 'nohtml'); + } + } elseif (preg_match('/^html/', $object->fields[$key]['type'])) { + $tmparray = explode(':', $object->fields[$key]['type']); + if (!empty($tmparray[1])) { + $value = GETPOST($key, $tmparray[1]); + } else { + $value = GETPOST($key, 'restricthtml'); + } } elseif ($object->fields[$key]['type'] == 'date') { $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); // for date without hour, we use gmt } elseif ($object->fields[$key]['type'] == 'datetime') { @@ -205,7 +217,14 @@ if ($action == 'update' && !empty($permissiontoadd)) { } // Set value to update - if (preg_match('/^(text|html)/', $object->fields[$key]['type'])) { + if (preg_match('/^text/', $object->fields[$key]['type'])) { + $tmparray = explode(':', $object->fields[$key]['type']); + if (!empty($tmparray[1])) { + $value = GETPOST($key, $tmparray[1]); + } else { + $value = GETPOST($key, 'nohtml'); + } + } elseif (preg_match('/^html/', $object->fields[$key]['type'])) { $tmparray = explode(':', $object->fields[$key]['type']); if (!empty($tmparray[1])) { $value = GETPOST($key, $tmparray[1]); diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 583dd7faca0..c43ba48db10 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -98,7 +98,7 @@ class EmailSenderProfile extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1), 'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1), 'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1), - 'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,), + 'signature' => array('type'=>'html', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,), 'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a29c22cbcf7..a6069634243 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1011,7 +1011,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl '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'=>2, 'index'=>1, 'position'=>20), 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35), 'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40), 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45), '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/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4be0fd2006f..6e2ee88134d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -515,7 +515,7 @@ function GETPOSTISARRAY($paramname, $method = 0) * 'aZ09'=check it's simple alpha string (recommended for keys) * 'aZ09comma'=check it's a string for a sortfield or sortorder * 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string) - * 'nohtml'=check there is no html content and no " and no ../ + * 'nohtml'=check there is no html content * 'restricthtml'=check html content is restricted to some tags only * 'custom'= custom filter specify $filter and $options) * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 24fddc2fda4..abdb45eff4e 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -69,8 +69,22 @@ foreach ($object->fields as $key => $val) { $value = GETPOST($key, 'int'); } elseif ($val['type'] == 'double') { $value = price2num(GETPOST($key, 'alphanohtml')); - } elseif ($val['type'] == 'text' || $val['type'] == 'html') { - $value = GETPOST($key, 'restricthtml'); + } elseif (preg_match('/^text/', $val['type'])) { + $tmparray = explode(':', $val['type']); + if (!empty($tmparray[1])) { + $check = $tmparray[1]; + } else { + $check = 'nohtml'; + } + $value = GETPOST($key, $check); + } elseif (preg_match('/^html/', $val['type'])) { + $tmparray = explode(':', $val['type']); + if (!empty($tmparray[1])) { + $check = $tmparray[1]; + } else { + $check = 'restricthtml'; + } + $value = GETPOST($key, $check); } elseif ($val['type'] == 'date') { $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); } elseif ($val['type'] == 'datetime') { diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index 1439ce73afe..1643ea77e98 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -72,7 +72,15 @@ foreach ($object->fields as $key => $val) { $value = GETPOSTISSET($key) ?GETPOST($key, 'int') : $object->$key; } elseif ($val['type'] == 'double') { $value = GETPOSTISSET($key) ? price2num(GETPOST($key, 'alphanohtml')) : $object->$key; - } elseif (preg_match('/^(text|html)/', $val['type'])) { + } elseif (preg_match('/^text/', $val['type'])) { + $tmparray = explode(':', $val['type']); + if (!empty($tmparray[1])) { + $check = $tmparray[1]; + } else { + $check = 'nohtml'; + } + $value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key; + } elseif (preg_match('/^html/', $val['type'])) { $tmparray = explode(':', $val['type']); if (!empty($tmparray[1])) { $check = $tmparray[1]; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 69d1ea61a30..13fcbfbef6b 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -139,8 +139,6 @@ class EmailCollector extends CommonObject 'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>"1", 'position'=>103, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'), 'oauth_service' => array('type'=>'varchar(128)', 'label'=>'oauthService', 'visible'=>-1, 'enabled'=>"getDolGlobalInt('MAIN_IMAP_USE_PHPIMAP')", 'position'=>104, 'notnull'=>0, 'index'=>1, 'comment'=>"IMAP login oauthService", 'arrayofkeyval'=>array(), 'help'=>'TokenMustHaveBeenCreated'), 'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>104, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'), - //'filter' => array('type'=>'text', 'label'=>'Filter', 'visible'=>1, 'enabled'=>1, 'position'=>105), - //'actiontodo' => array('type'=>'varchar(255)', 'label'=>'ActionToDo', 'visible'=>1, 'enabled'=>1, 'position'=>106), 'target_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxTargetDirectory', 'visible'=>1, 'enabled'=>1, 'position'=>110, 'notnull'=>0, 'help'=>"EmailCollectorTargetDir"), 'maxemailpercollect' => array('type'=>'integer', 'label'=>'MaxEmailCollectPerCollect', 'visible'=>-1, 'enabled'=>1, 'position'=>111, 'default'=>100), 'datelastresult' => array('type'=>'datetime', 'label'=>'DateLastCollectResult', 'visible'=>1, 'enabled'=>'$action != "create" && $action != "edit"', 'position'=>121, 'notnull'=>-1, 'csslist'=>'nowraponall'), diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index b15dcf3e545..9da7aa06a84 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -108,7 +108,7 @@ class ConferenceOrBooth extends ActionComm 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'width100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'), - 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), + 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'), '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',), diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 06adcd92770..38c39d96b6f 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -191,8 +191,8 @@ class ExpenseReport extends CommonObject 'fk_user_cancel' =>array('type'=>'integer', 'label'=>'Fk user cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>130), 'fk_c_paiement' =>array('type'=>'integer', 'label'=>'Fk c paiement', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'paid' =>array('type'=>'integer', 'label'=>'Paid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145), - 'note_public' =>array('type'=>'text', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150), - 'note_private' =>array('type'=>'text', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_public' =>array('type'=>'html', 'label'=>'Note public', 'enabled'=>1, 'visible'=>0, 'position'=>150), + 'note_private' =>array('type'=>'html', 'label'=>'Note private', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'detail_refuse' =>array('type'=>'varchar(255)', 'label'=>'Detail refuse', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'detail_cancel' =>array('type'=>'varchar(255)', 'label'=>'Detail cancel', 'enabled'=>1, 'visible'=>-1, 'position'=>165), 'integration_compta' =>array('type'=>'integer', 'label'=>'Integration compta', 'enabled'=>1, 'visible'=>-1, 'position'=>170), diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 450e2c63af3..66645583216 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -57,9 +57,9 @@ 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'=>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), + 'description' =>array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>105, 'showoncombobox'=>2), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>120), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>125), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>130), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 94415f5f1f3..c7357813d43 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -237,8 +237,8 @@ class CommandeFournisseur extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>3, 'position'=>140, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>1, 'position'=>145, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155, 'searchall'=>1), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165), 'fk_input_method' =>array('type'=>'integer', 'label'=>'OrderMode', 'enabled'=>1, 'visible'=>3, 'position'=>170), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>3, 'position'=>175), diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 8964213f83d..a05aa22a59a 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -201,8 +201,8 @@ class FactureFournisseurRec extends CommonInvoice 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2c45a8d67d5..dd9ba7a6248 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -300,8 +300,8 @@ class FactureFournisseur extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 79ea13dcd40..6eb7384c11d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -281,8 +281,8 @@ class Project extends CommonObject 'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65), 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>75), 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'getDolGlobalString("PROJECT_USE_OPPORTUNITIES")', 'visible'=>1, 'position'=>80), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), 'date_close' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>0, 'position'=>105), 'fk_user_close' =>array('type'=>'integer', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>0, 'position'=>110), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fa6d77ad485..5f4a8c36b7c 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -212,8 +212,8 @@ class Societe extends CommonObject 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>"getDolGlobalInt('SOCIETE_USEPREFIX')", 'visible'=>-1, 'position'=>235), 'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240), 'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245), diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 411b11a4cd9..09fee02c8a3 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -90,8 +90,8 @@ class SocieteAccount extends CommonObject 'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',), 'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,), 'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,), - //'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,), - 'note_private' => array('type'=>'text', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,), + //'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,), + 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>46, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-2, 'enabled'=>1, 'position'=>500, 'notnull'=>1,), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index be035f7ea46..5faea34ad6c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -290,7 +290,7 @@ class Ticket extends CommonObject 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'csslist'=>'tdoverflowmax100 maxwidth150onsmartphone'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), - 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), + 'message' => array('type'=>'html', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc', 'csslist'=>'tdoverflowmax100'), 'email_date' => array('type'=>'datetime', 'label'=>'EmailDate', 'visible'=>-2, 'enabled'=>1, 'position'=>541), 'progress' => array('type'=>'integer', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>2, 'csslist'=>'width50'), diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index c4efd987d0b..932762b3998 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -174,7 +174,7 @@ class WebsitePage extends CommonObject 'fk_website' =>array('type'=>'integer', 'label'=>'WebsiteId', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>40, 'searchall'=>0, 'foreignkey'=>'websitepage.rowid'), 'fk_page' =>array('type'=>'integer', 'label'=>'ParentPageId', 'enabled'=>1, 'visible'=>1, 'notnull'=>-1, 'position'=>45, 'searchall'=>0, 'foreignkey'=>'website.rowid'), 'allowed_in_frames' =>array('type'=>'integer', 'label'=>'AllowedInFrames', 'enabled'=>1, 'visible'=>-1, 'position'=>48, 'searchall'=>0, 'default'=>0), - 'htmlheader' =>array('type'=>'text', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0), + 'htmlheader' =>array('type'=>'html', 'label'=>'HtmlHeader', 'enabled'=>1, 'visible'=>0, 'position'=>50, 'searchall'=>0), 'content' =>array('type'=>'mediumtext', 'label'=>'Content', 'enabled'=>1, 'visible'=>0, 'position'=>51, 'searchall'=>0), 'grabbed_from' =>array('type'=>'varchar(255)', 'label'=>'GrabbedFrom', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>400, 'comment'=>'URL page content was grabbed from'), 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), From e04cd242b01479feb1b2e64608a39d7c99fff347 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 4 Feb 2023 17:12:09 +0100 Subject: [PATCH 49/59] fix #21072: error message if deocument model not found --- htdocs/core/actions_setnotes.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index b9dd4194268..79ab36e1486 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -54,7 +54,12 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + //see #21072: Update a public note with a "document model not found" is not really a problem : the PDF is not created/updated + //but the note is saved, so just add a notification will be enought + $resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($resultGenDoc < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } if ($result < 0) dol_print_error($db, $result); } From 1aaec5325fce3eaf36a496087543d543b6d7672c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 4 Feb 2023 17:21:13 +0100 Subject: [PATCH 50/59] warnings is better than error --- htdocs/core/actions_setnotes.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 79ab36e1486..5d61c49d85f 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -58,7 +58,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', //but the note is saved, so just add a notification will be enought $resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($resultGenDoc < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'warnings'); } if ($result < 0) dol_print_error($db, $result); From 9213ba76d8e112cc27071919db1f2d4c02b6c22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 19:10:35 +0100 Subject: [PATCH 51/59] Update admin.lang --- htdocs/langs/en_US/admin.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 8e0acd832d5..6ea2ef4fd10 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2366,3 +2366,6 @@ MaxNumberOfAttachementOnForms=Max number of joinded files in a form IfDefinedUseAValueBeetween=If defined, use a value between %s and %s Reload=Reload ConfirmReload=Confirm module reload +WarningModuleHasChangedLastVersionCheckParameter=Warning module %s has changed last version check parameter +WarningModuleHasChangedSecurityCsrfParameter=Warning module %s has changed security CSRF parameter + From 741fd1bf9cae362565d3f6f6084d7d2e059fb2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Feb 2023 19:11:59 +0100 Subject: [PATCH 52/59] Update modules.php --- htdocs/admin/modules.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6e0d90499d4..6adfe48ebfe 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -8,7 +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 + * Copyright (C) 2021-2023 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 @@ -251,7 +251,15 @@ if ($action == 'install') { } if ($action == 'set' && $user->admin) { + $checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE'); + $csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN'); $resarray = activateModule($value); + if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) { + setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings'); + } + if ($csrfCheckOldValue != getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) { + setEventMessage($langs->trans('WarningModuleHasChangedSecurityCsrfParameter', $value), 'warnings'); + } 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'); From d0e1e16567b61fe696968aa0de7f0e93df244803 Mon Sep 17 00:00:00 2001 From: John Veness Date: Sun, 5 Feb 2023 18:51:32 +0000 Subject: [PATCH 53/59] Improve English in DoliWamp installer --- build/exe/doliwamp/Languages/MyEnglish.isl | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index 7ad94c4ca86..9c91ae92e4a 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -11,38 +11,38 @@ LaunchProgram=Launch %1 AssocFileExtension=&Associate %1 with the %2 file extension AssocingFileExtension=Associating %1 with the %2 file extension... -YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr + all required third party software like Apache, Mysql and PHP) on your computer. -ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer break down, you can lose all your data. Do this if you are ready to manage backup yourself seriously. If not, use an installation in Saas instead (see https://saas.dolibarr.org). -IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledges and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing server with Apache, Mysql and PHP. -ButIfYouLook=But if you look for an automatic setup on your local computer, you''re on the good way... -DoYouWantToStart=Do you want to start installation process ? +YouWillInstallDoliWamp=You will install DoliWamp (so Dolibarr plus all required third-party software like Apache, MySQL and PHP) on your computer. +ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer breaks down, you can lose all your data. Do this if you are ready to manage backups yourself seriously. If not, use an installation in SaaS instead (see https://saas.dolibarr.org). +IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledge and want to manage Apache, MySQL and PHP yourself, you should not use this assistant and instead make a manual installation of Dolibarr on your existing server with Apache, MySQL and PHP. +ButIfYouLook=But if you are looking for an automatic setup on your local computer, you're on the right path... +DoYouWantToStart=Do you want to start the installation process? TechnicalParameters=Technical parameters -IfFirstInstall=If first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just leave the default values. +IfFirstInstall=If this is the first install, please specify some technical parameters. If you don't understand, are not sure, or are doing an upgrade, just keep the default values. ; WARNING !!! STRINGS HERE MUST BE LOWER THAN 60 CHARACTERS -SMTPServer=SMTP server (your own or ISP SMTP server, first install only) : -ApachePort=Apache port (first install only, common choice is 80) : -MySqlPort=MySql port (first install only, common choice is 3306) : -MySqlPassword=MySql server and database password you want for root (first install only): +SMTPServer=SMTP server (your own or ISP SMTP server, first install only): +ApachePort=Apache port (first install only, common choice is 80): +MySqlPort=MySQL port (first install only, common choice is 3306): +MySqlPassword=MySQL server and database password you want for root (first install only): -FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore warning but you may have to remove it manually later when asked. Click OK to continue... +FailedToDeleteLock=Failed to delete the file %1/www/dolibarr/install.lock. You can ignore this warning but you may have to remove the file manually later when asked. Click OK to continue... -PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value ? +PortAlreadyInUse=Port %1 seems to already be in use. You should cancel to go back and choose another value for %2 port. Cancel choice and choose another value? -FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? -ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? -MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? -ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open : +FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr? +ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr? +MicrosoftEdgeDetected=Microsoft Edge has been detected on your computer. Would you like to use it as the default browser for Dolibarr? +ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open: LaunchNow=Launch Dolibarr now -ProgramHasBeenRemoved=Dolibarr program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall. +ProgramHasBeenRemoved=Dolibarr's program files have been removed. However, all your data files are still in directory %1. You must remove this directory manually for a complete uninstall. -DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and Mysql, this may last from several seconds to one minute after this confirmation. Start to install or upgrade the web and database server required by Dolibarr ? +DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache and MySQL. This may take from several seconds to one minute. Start to install or upgrade the web and database server required by Dolibarr? -OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version -OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version +OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version +OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version -DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. -ContinueAnyway=Continue anyway (install process may fails without this prerequisite) +DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. +ContinueAnyway=Continue anyway (install process may fail without this prerequisite) From 89c5af14f4e08d5032100bf6e79151ace35ba3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 Feb 2023 21:14:09 +0100 Subject: [PATCH 54/59] add extrafields count in salary(ies) admin --- htdocs/core/lib/salaries.lib.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 51ec880e31e..7909773260f 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Charlie BENKE * Copyright (C) 2019 Alexandre Spangaro * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2023 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 @@ -76,7 +77,10 @@ function salaries_prepare_head($object) */ function salaries_admin_prepare_head() { - global $langs, $conf, $user; + global $conf, $db, $langs, $user; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('salary'); $h = 0; $head = array(); @@ -94,6 +98,10 @@ function salaries_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSalaries"); + $nbExtrafields = $extrafields->attributes['salary']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ''.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; From 631168f56cf7009a5cdd0511802ab65e78763e69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Feb 2023 22:17:09 +0100 Subject: [PATCH 55/59] NEW Collapse/Expand separators supported in edit and create mode --- htdocs/core/class/commonobject.class.php | 20 ++++++++++++++++---- htdocs/core/class/extrafields.class.php | 24 +++++++++++++++--------- htdocs/core/lib/functions.lib.php | 12 +++++++----- htdocs/core/tpl/extrafields_edit.tpl.php | 6 +++++- htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ 5 files changed, 46 insertions(+), 19 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 25f16cbbdb4..29643850e60 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8066,10 +8066,16 @@ abstract class CommonObject $out .= "\n"; $nbofextrafieldsshown = 0; - $extrafields_collapse_num = ''; $e = 0; // var to manage the modulo (odd/even) + $lastseparatorkeyfound = ''; + $extrafields_collapse_num = ''; + $extrafields_collapse_num_old = ''; + $i = 0; + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) { + $i++; + // Show only the key field in params if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) { continue; @@ -8104,6 +8110,7 @@ abstract class CommonObject if (empty($perms)) { continue; } + // Load language if required if (!empty($extrafields->attributes[$this->table_element]['langfile'][$key])) { $langs->load($extrafields->attributes[$this->table_element]['langfile'][$key]); @@ -8165,14 +8172,19 @@ abstract class CommonObject $extrafield_collapse_display_value = intval($extrafield_param_list[0]); if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { - $extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key]; + //$extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key]; + $extrafields_collapse_num = $key; } } } // if colspan=0 or 1, the second column is not extended, so the separator must be on 2 columns $out .= $extrafields->showSeparator($key, $this, ($colspan ? $colspan + 1 : 2), $display_type, $mode); + + $lastseparatorkeyfound = $key; } else { + $collapse_group = $extrafields_collapse_num.(!empty($this->id) ? '_'.$this->id : ''); + $class = (!empty($extrafields->attributes[$this->table_element]['hidden'][$key]) ? 'hideobject ' : ''); $csstyle = ''; if (is_array($params) && count($params) > 0) { @@ -8243,13 +8255,13 @@ abstract class CommonObject $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); if ($display_type == 'card') { - $out .= ''; + $out .= ''; if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) { $out .= ''; } $out .= ''; + $out .= '
'; $out .= '
table_element.'_extrafields_'.$key]) || GETPOST('ignorecollapsesetup', 'int')) ? (empty($_COOKIE['DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key]) ? false : true) : ($extrafield_collapse_display_value == 2 ? false : true)); } + $disabledcookiewrite = 0; if ($mode == 'create') { - $extrafield_collapse_display_value = 0; + // On create mode, force separator group to not be collapsable + $extrafield_collapse_display_value = 1; + $expand_display = true; // We force group to be shown expanded + $disabledcookiewrite = 1; // We keep status of group unchanged into the cookie } $out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id)?'_'.$object->id:'').'">'; @@ -2004,19 +2008,21 @@ class ExtraFields // Set the collapse_display status to cookie in priority or if ignorecollapsesetup is 1, if cookie and ignorecollapsesetup not defined, use the setup. $this->expand_display[$collapse_group] = $expand_display; - if (!empty($conf->use_javascript_ajax) && $mode != 'create') { + if (!empty($conf->use_javascript_ajax)) { $out .= ''."\n"; $out .= '