From 6106d54632e5cf56f52cb23c1a21810a1e4dcd43 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 May 2022 09:54:10 +0200 Subject: [PATCH 01/19] css --- htdocs/theme/eldy/global.inc.php | 2 ++ htdocs/theme/md/style.css.php | 2 +- htdocs/user/card.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2ac2e0744b3..83d7bc120e2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3481,6 +3481,8 @@ div .tdtop { vertical-align: top !important; /*padding-top: 10px !important; padding-bottom: 2px !important; */ + padding-top: 6px !important; + padding-bottom: 4px !important; } table.border td, table.bordernooddeven td, div.border div div.tagtd { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 15c9ef74612..d8a6a1d928c 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4144,7 +4144,7 @@ div.tabBar .noborder { } div .tdtop { vertical-align: top !important; - padding-top: 5px !important; + padding-top: 8px !important; padding-bottom: 0px !important; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 3a27e308172..f789023b8d4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1707,7 +1707,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; // VCard - print ''.$langs->trans("VCard").''; + print ''.$langs->trans("VCard").''; print ''; print ''; print img_picto($langs->trans("Download"), 'vcard.png', 'class="paddingrightonly"'); From 1ba8bc9147588f51b9ae1f720ed6055f33accce3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 May 2022 07:51:48 +0200 Subject: [PATCH 02/19] css --- htdocs/societe/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bdc0fae08e0..80b0142a572 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1466,7 +1466,7 @@ while ($i < min($num, $limit)) { } // Address if (!empty($arrayfields['s.address']['checked'])) { - print ''.dol_escape_htmltag($obj->address).''; + print ''.dol_escape_htmltag($obj->address).''; if (!$i) { $totalarray['nbfield']++; } @@ -1673,7 +1673,7 @@ while ($i < min($num, $limit)) { print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['s.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (!$i) { @@ -1682,7 +1682,7 @@ while ($i < min($num, $limit)) { } // Date modification if (!empty($arrayfields['s.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (!$i) { @@ -1691,7 +1691,7 @@ while ($i < min($num, $limit)) { } // Status if (!empty($arrayfields['s.status']['checked'])) { - print ''.$companystatic->getLibStatut(5).''; + print ''.$companystatic->getLibStatut(5).''; if (!$i) { $totalarray['nbfield']++; } From b0c96455ced21667d2bb20cb801272ff4a152a4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 May 2022 00:59:00 +0200 Subject: [PATCH 03/19] Prepare 15.0.2 --- ChangeLog | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/ChangeLog b/ChangeLog index e55cfad84d1..b67cbabafb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,103 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 15.0.2 compared to 15.0.1 ***** + +FIX: #19777 #20281 +FIX: #20140 #20301 +FIX: #20279 Accountancy - PostGreSQL - Error on mass update lines already binded +FIX: #20476 migration postgresql 14.0.x to 15.0.x packaging type +FIX: #20733 Inventory: Do not use batch qty even if present if batch module is disabled. +FIX: action comm list: holiday last day not included + handle duration with halfdays +FIX: Add missing entity on salary's payment +FIX: Add 'recruitment' into check array +FIX: add tools to fix bad bank amount in accounting with multicurrency +FIX: assign member cateogry to a member +FIX: backport +FIX: bad bank amount in accounting with multicurrency +FIX: Bad condition on remx +FIX: Bad filter on date on salary list +FIX: bad link to add a customer price (token duplicated) +FIX: bad status of member on widget by type and status +FIX: better error management at product selling price update +FIX: Can't edit bank record +FIX: check mandatory thirdparty fields for mass action +FIX: check thirdparty object loaded and properties exist +FIX: comment +FIX: compatibility for ticket number sharing +FIX: compatibility with multicompany sharings +FIX: contact card: single extrafield update failed +FIX: country not visible into list of states +FIX: Delete an extrafield where type is double +FIX: deprecated module are not more viewed as external modules +FIX: Disable customer type by default if type prospect/customer is disabled +FIX: each time we create a supplier order, we need to give it a ref_supplier +FIX: Error management +FIX: fatal error for $db usage in tpl +FIX: filter into the list of product lots +FIX: Filter on Object Referent page give CRSF page +FIX: Fix default options ($hidedetails, $hidedesc, $hideref) with globales when generate PDF in mass actions +FIX: Fix search by filters +FIX: Fix the adding of lines in the create invoice functions +FIX: forgotten form confirm before various payment delete +FIX: holiday/leave requests: write status change emails in HTML +FIX: include discount price for PMP after a reception (Issue #20029) +FIX: incrementation +FIX: in salary stats and payment list, we must check right perms as well as salary list +FIX: intervention entity missing +FIX: label tax cat trad +FIX: Mass action ship orders +FIX: missing advanced perms +FIX: missing call to executeHooks() +FIX: Missing entity on adding new VAT +FIX: missing hook for row ordering +FIX: missing hook parameter ($possiblelinks) +FIX: missing parenthesis +FIX: missing picto in combo of mass actions of thirdparties. +FIX: missing signature library when ODT model is used +FIX: Missing unset fields after updateline expensereport +FIX: ModuileBuilder - Fix getLinesArray() error reporting +FIX: Move delete task time trigger position +FIX: Navigation between invoices +FIX: No empty line inserted into accounting_bookkeeping +FIX: Numbering of sepa files +FIX: object cloning: set unique extrafield values to null to prevent duplicates +FIX: on update with action reminder in future there is user key error +FIX: originproductline array td identification data-id +FIX: out of memory when more than 100 000 invoices. +FIX: permit access to medias when logged in a different entity +FIX: phpcs +FIX: project creation prevented if PROJECTLEADER contact role renamed, de-activated or deleted +FIX: project timesheet by week: cleanup unused code +FIX: project timesheet: public holidays offset by 1 day +FIX: project timesheets: assume Saturday and Sunday as default weekend days when working days conf is empty or badly formed +FIX: propal list: bad error management when setting "not signed" mass action +FIX: propal list mass action translations and error management (v14 edition) +FIX: propal list: missing not signed massaction translation keys for transifex +FIX: PR returns +FIX: ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders +FIX: replenish and manage product stock by warhouse +FIX: sending email on payment of registration of event +FIX: SEPA ICS is not mandatory for bank transfer +FIX: Set datec when add time spent on a project task +FIX: status filter on supplierOrder stats doesn't work +FIX: stickler-ci +FIX: still prevent project creation if PROJECTLEADER role unavailable, but with a specific error message +FIX: Supplier order stats +FIX: Tabulation must be allowed for HTML content +FIX: tool to fix bank account not in main currency for vendor invoice +FIX: translations +FIX: Travis + Update dev +FIX: truncate Customer Reference too long on PDF header (PR #20718) +FIX: uniformize code +FIX: Update of sale price (log not correctly updated) +FIX: user actions rights when mulit-company transverse mode is enabled +FIX: user employee tab: offset in open days messes up holiday length calculation +FIX: We need to have a different default_ref_supplier for each new fourn invoice +FIX: "WHERE" clause missing on resource export +FIX: #yogosha9754 + + ***** ChangeLog for 15.0.1 compared to 15.0.0 ***** FIX: #19777 #20281 FIX: bad position of extrafields for interventions From c47578943327436113ba4ef8137888b578500f69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 May 2022 23:23:50 +0200 Subject: [PATCH 04/19] Debug v16 --- htdocs/comm/propal/list.php | 4 ++-- htdocs/commande/list.php | 4 ++-- htdocs/compta/bank/list.php | 12 ++++++------ htdocs/compta/bank/various_payment/list.php | 6 +++--- htdocs/contrat/index.php | 10 +++++----- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/paiement/list.php | 8 ++++---- .../class/knowledgerecord.class.php | 4 ++-- htdocs/knowledgemanagement/knowledgerecord_list.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/societe/list.php | 8 ++++---- htdocs/supplier_proposal/list.php | 4 ++-- htdocs/ticket/list.php | 2 +- 13 files changed, 34 insertions(+), 34 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0056716972b..43f369faef2 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -765,12 +765,12 @@ if ($resql) { if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); - $title = $langs->trans('ListOfProposals').' - '.$soc->name; + $title = $langs->trans('Proposals').' - '.$soc->name; if (empty($search_societe)) { $search_societe = $soc->name; } } else { - $title = $langs->trans('ListOfProposals'); + $title = $langs->trans('Proposals'); } $num = $db->num_rows($resql); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5a85038bddc..b047c413b6c 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1015,12 +1015,12 @@ if ($resql) { if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); - $title = $langs->trans('ListOfOrders').' - '.$soc->name; + $title = $langs->trans('CustomersOrders').' - '.$soc->name; if (empty($search_company)) { $search_company = $soc->name; } } else { - $title = $langs->trans('ListOfOrders'); + $title = $langs->trans('CustomersOrders'); } if (strval($search_status) == '0') { $title .= ' - '.$langs->trans('StatusOrderDraftShort'); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 19b47430fad..90bc79483bf 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -534,7 +534,7 @@ foreach ($accounts as $key => $type) { // Ref if (!empty($arrayfields['b.ref']['checked'])) { - print ''.$objecttmp->getNomUrl(1).''; + print ''.$objecttmp->getNomUrl(1).''; if (!$i) { $totalarray['nbfield']++; } @@ -586,7 +586,7 @@ foreach ($accounts as $key => $type) { // Accountancy journal if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { - print ''; + print ''; if (!empty($conf->accounting->enabled)) { if (empty($objecttmp->fk_accountancy_journal)) { print img_warning($langs->trans("Mandatory")); @@ -606,7 +606,7 @@ foreach ($accounts as $key => $type) { // Currency if (!empty($arrayfields['b.currency_code']['checked'])) { - print ''; + print ''; print $objecttmp->currency_code; print ''; if (!$i) { @@ -616,7 +616,7 @@ foreach ($accounts as $key => $type) { // Transactions to reconcile if (!empty($arrayfields['toreconcile']['checked'])) { - print ''; + print ''; $conciliate = $objecttmp->canBeConciliated(); if ($conciliate == -2) { @@ -663,7 +663,7 @@ foreach ($accounts as $key => $type) { print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['b.datec']['checked'])) { - print ''; + print ''; print dol_print_date($objecttmp->date_creation, 'dayhour'); print ''; if (!$i) { @@ -672,7 +672,7 @@ foreach ($accounts as $key => $type) { } // Date modification if (!empty($arrayfields['b.tms']['checked'])) { - print ''; + print ''; print dol_print_date($objecttmp->date_update, 'dayhour'); print ''; if (!$i) { diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index bbec4f23fc6..4d0c9eb19c5 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -535,7 +535,7 @@ if ($result) { $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 '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); print ''; @@ -652,7 +652,7 @@ if ($result) { if ($arrayfields['account']['checked']) { $accountingaccount->fetch('', $obj->accountancy_code, 1); - print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; + print ''.$accountingaccount->getNomUrl(0, 1, 1, '', 1).''; if (!$i) { $totalarray['nbfield']++; } @@ -660,7 +660,7 @@ if ($result) { // Accounting subledger account if ($arrayfields['subledger']['checked']) { - print ''.length_accounta($obj->subledger_account).''; + print ''.length_accounta($obj->subledger_account).''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 99739260b36..b3ed6191535 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -356,12 +356,12 @@ if ($result) { print img_warning($langs->trans("Late")); } print ''; - print ''; + print ''; $staticcompany->id = $obj->socid; $staticcompany->name = $obj->name; print $staticcompany->getNomUrl(1, '', 20); print ''; - print ''.dol_print_date($db->jdate($obj->tms), 'dayhour').''; + print ''.dol_print_date($db->jdate($obj->tms), 'dayhour').''; //print ''.$staticcontrat->LibStatut($obj->statut,2).''; print ''.($obj->nb_initial > 0 ? ''.$obj->nb_initial.''.$staticcontratligne->LibStatut(0, 3, -1, 'class="paddingleft"') : '').''; print ''.($obj->nb_running > 0 ? ''.$obj->nb_running.''.$staticcontratligne->LibStatut(4, 3, 0, 'class="marginleft"') : '').''; @@ -439,7 +439,7 @@ if ($resql) { } } print ''; - print ''; + print ''; $staticcompany->id = $obj->fk_soc; $staticcompany->name = $obj->name; print $staticcompany->getNomUrl(1, '', 20); @@ -521,7 +521,7 @@ if ($resql) { } } print ''; - print ''; + print ''; $staticcompany->id = $obj->fk_soc; $staticcompany->name = $obj->name; print $staticcompany->getNomUrl(1, '', 20); @@ -603,7 +603,7 @@ if ($resql) { } } print ''; - print ''; + print ''; $staticcompany->id = $obj->fk_soc; $staticcompany->name = $obj->name; print $staticcompany->getNomUrl(1, '', 20); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 98df5e11170..3551ab27856 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -711,7 +711,7 @@ $formorder = new FormOrder($db); $formother = new FormOther($db); $formcompany = new FormCompany($db); -$title = $langs->trans("ListOfSupplierOrders"); +$title = $langs->trans("SuppliersOrders"); if ($socid > 0) { $fourn = new Fournisseur($db); $fourn->fetch($socid); diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index 0f8f9050755..13812e3595f 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -485,7 +485,7 @@ while ($i < min($num, $limit)) { // No if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''.(($offset * $limit) + $i).''; + print ''.(($offset * $limit) + $i).''; if (!$i) { $totalarray['nbfield']++; } @@ -493,7 +493,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['p.ref']['checked'])) { - print ''.$paymentfournstatic->getNomUrl(1).''; + print ''.$paymentfournstatic->getNomUrl(1).''; if (!$i) { $totalarray['nbfield']++; } @@ -510,7 +510,7 @@ while ($i < min($num, $limit)) { // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; if ($objp->socid > 0) { print $companystatic->getNomUrl(1, '', 24); } @@ -539,7 +539,7 @@ while ($i < min($num, $limit)) { // Bank account if (!empty($arrayfields['ba.label']['checked'])) { - print ''; + print ''; if ($objp->bid) { $accountstatic->id = $objp->bid; $accountstatic->ref = $objp->bref; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index a2f03a64e41..590b31263e2 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -101,10 +101,10 @@ class KnowledgeRecord extends CommonObject */ public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", "showoncombobox"=>1), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", "csslist"=>"nowraponall", "showoncombobox"=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), - 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), + 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'tdcss'=>'titlefieldcreate nowraponall', "csslist"=>"tdoverflowmax100"), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflowmax300', 'copytoclipboard'=>1, 'tdcss'=>'titlefieldcreate nowraponall'), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>2,), diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index feadd8d9800..1e93abd31e9 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -222,7 +222,7 @@ $now = dol_now(); //$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord"; $help_url = ''; -$title = $langs->trans('ListKnowledgeRecord'); +$title = $langs->trans('KnowledgeRecords'); $morejs = array(); $morecss = array(); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 050c99bfed0..5803b8c94aa 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -259,7 +259,7 @@ $now = dol_now(); //$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; $help_url = ''; -$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("MyObjects")); +$title = $langs->trans("MyObjects"); $morejs = array(); $morecss = array(); diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5884679950f..563add49938 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -420,15 +420,15 @@ $prospectstatic->client = 2; $prospectstatic->loadCacheOfProspStatus(); -$title = $langs->trans("ListOfThirdParties"); +$title = $langs->trans("ThirdParties"); if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) { - $title = $langs->trans("ListOfCustomers"); + $title = $langs->trans("Customers"); } if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) { - $title = $langs->trans("ListOfProspects"); + $title = $langs->trans("Prospects"); } if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) { - $title = $langs->trans("ListOfSuppliers"); + $title = $langs->trans("Suppliers"); } // Select every potentiels, and note each potentiels which fit in search parameters diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 55fdaf6f413..a0e404dbd89 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -448,9 +448,9 @@ if ($resql) { if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); - $title = $langs->trans('ListOfSupplierProposals').' - '.$soc->name; + $title = $langs->trans('SupplierProposals').' - '.$soc->name; } else { - $title = $langs->trans('ListOfSupplierProposals'); + $title = $langs->trans('SupplierProposals'); } $num = $db->num_rows($resql); diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index a8314c4bf89..4eaadb3fc74 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -333,7 +333,7 @@ $user_temp = new User($db); $socstatic = new Societe($db); $help_url = ''; -$title = $langs->trans('TicketList'); +$title = $langs->trans('Tickets'); $morejs = array(); $morecss = array(); From 68b25b35b445254f11e08da1aae40a90cfc4a1c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 May 2022 23:53:36 +0200 Subject: [PATCH 05/19] Look and feel v16 --- htdocs/comm/index.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index dafc1e7ee16..5903b7e4bdb 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -634,7 +634,11 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) { print $s; print ''; - print ''.dol_print_date($db->jdate($objp->tms), 'day').''; + + $datem = $db->jdate($objp->tms); + print ''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''; print ''; $i++; @@ -725,7 +729,11 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S print $s; print ''; - print ''.dol_print_date($db->jdate($objp->dm), 'day').''; + + $datem = $db->jdate($objp->dm); + print ''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''; print ''; $i++; @@ -922,7 +930,10 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { print ''; print ''.$companystatic->getNomUrl(1, 'customer', 44).''; - print ''.dol_print_date($db->jdate($obj->dp), 'day').''; + $datem = $db->jdate($obj->dp); + print ''; + print dol_print_date($datem, 'day', 'tzserver'); + print ''; print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''; print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''; @@ -1039,7 +1050,11 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { print ''; print ''.$companystatic->getNomUrl(1, 'customer', 44).''; - print ''.dol_print_date($db->jdate($obj->dv), 'day').''; + $datem = $db->jdate($obj->dv); + print ''; + print dol_print_date($datem, 'day', 'tzserver'); + print ''; + print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''; print ''.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).''; From 2e15a14c140b887b9bf459837ad9dae8047d4786 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 00:10:44 +0200 Subject: [PATCH 06/19] css --- htdocs/commande/card.php | 8 ++++---- htdocs/core/class/html.form.class.php | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b1d0cdb9223..f1423ffa12b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1733,10 +1733,10 @@ if ($action == 'create' && $usercancreate) { $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; - // Terms of the settlement + // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; - print img_picto('', 'paiment', 'class="pictofixedwidth"'); - $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', $deposit_percent); + print img_picto('', 'payment', 'class="pictofixedwidth"'); + $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print ''; // Payment mode @@ -1836,7 +1836,7 @@ if ($action == 'create' && $usercancreate) { print ''; print ''.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; print ''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code'); + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); print ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f1a93868809..81fbb83b264 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5883,14 +5883,16 @@ class Form /** * Return array of currencies in user language * - * @param string $selected preselected currency code - * @param string $htmlname name of HTML select list - * @param integer $useempty 1=Add empty line - * @param string $filter Optional filters criteras (example: 'code <> x', ' in (1,3)') - * @param bool $excludeConfCurrency false = If company current currency not in table, we add it into list. Should always be available. true = we are in currency_rate update , we don't want to see conf->currency in select + * @param string $selected Preselected currency code + * @param string $htmlname Name of HTML select list + * @param integer $useempty 1=Add empty line + * @param string $filter Optional filters criteras (example: 'code <> x', ' in (1,3)') + * @param bool $excludeConfCurrency false = If company current currency not in table, we add it into list. Should always be available. + * true = we are in currency_rate update , we don't want to see conf->currency in select + * @param string $morecss More css * @return string */ - public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0, $filter = '', $excludeConfCurrency = false) + public function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0, $filter = '', $excludeConfCurrency = false, $morecss = '') { global $conf, $langs; @@ -5911,7 +5913,7 @@ class Form } $out = ''; - $out .= ''; if ($useempty) { $out .= ''; } From 7de1fe864626311b454cfd3763a19701fffbd776 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 00:17:46 +0200 Subject: [PATCH 07/19] Look and feel v16 --- htdocs/projet/index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 51e78f23d57..b519f298ecc 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -288,7 +288,10 @@ if ($resql) { print ''; // Date - print ''.dol_print_date($db->jdate($obj->datem), 'day').''; + $datem = $db->jdate($obj->datem); + print ''; + print dol_print_date($datem, 'day', 'tzuserrel'); + print ''; // Status print ''.$projectstatic->LibStatut($obj->status, 3).''; From 1a0e416c1a24c5a08e34f82067abd8e6b9223d64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 00:51:20 +0200 Subject: [PATCH 08/19] WIP --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/societe/card.php | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4999aba895d..e6852cdde03 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1628,7 +1628,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di close: function (event, ui) { returnedid = jQuery("#varforreturndialogid'.$name.'").text(); returnedlabel = jQuery("#varforreturndialoglabel'.$name.'").text(); - console.log("popup has been closed. returnedid="+returnedid+" returnedlabel="+returnedlabel); + console.log("popup has been closed. returnedid (js var defined into parent page)="+returnedid+" returnedlabel="+returnedlabel); if (returnedid != "" && returnedid != "div for returned id") { jQuery("#'.(empty($backtopagejsfieldsid)?"none":$backtopagejsfieldsid).'").val(returnedid); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index df50f0703e0..98e0bd099fc 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -619,7 +619,7 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!GETPOSTISSET('backtopage')) { $url = '/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create'); $newbutton = ''; - // TODO @LDR Impletment this + // TODO @LDR Implement this //$tmpbacktopagejsfields = 'socid:search_socid'; //print dolButtonToOpenUrlInDialogPopup('addthirdparty', $langs->transnoentitiesnoconv('AddThirdParty'), $newbutton, $url, '', '', $tmpbacktopagejsfields); print ' '.$newbutton.''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index cbb8de3cf28..d29870b413e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -704,8 +704,14 @@ if (empty($reshook)) { $url = DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; } - header("Location: ".$url); - exit; + // TODO @LDR + if ($dol_openinpopup && $backtopagejsfields) { + print 'TODO Set js var of parent with id, then close popup.'; + exit; + } else { + header("Location: ".$url); + exit; + } } } else { $db->rollback(); From ed2e1bda46099dc306631f213e1078482683a6ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:00:43 +0200 Subject: [PATCH 09/19] Clean code v16 --- htdocs/admin/expensereport_ik.php | 13 +- htdocs/admin/expensereport_rules.php | 48 +- .../bank/class/paymentvarious.class.php | 2 +- .../deplacement/class/deplacement.class.php | 2 +- .../facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- .../facture/class/facturestats.class.php | 2 +- .../facture/class/paymentterm.class.php | 2 +- .../sociales/class/chargesociales.class.php | 2 +- .../class/paymentsocialcontribution.class.php | 2 +- htdocs/core/class/coreobject.class.php | 413 ------------------ htdocs/core/customreports.php | 2 +- htdocs/core/db/sqlite3.class.php | 2 +- .../expedition/doc/pdf_espadon.modules.php | 2 +- .../class/expensereport_ik.class.php | 71 ++- .../class/expensereport_rule.class.php | 75 +++- 16 files changed, 183 insertions(+), 459 deletions(-) delete mode 100644 htdocs/core/class/coreobject.class.php diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index 900754ef4b4..10b14f8ee99 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -36,10 +36,10 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict")); $error = 0; $action = GETPOST('action', 'aZ09'); + $id = GETPOST('id', 'int'); $ikoffset = GETPOST('ikoffset', 'int'); $coef = GETPOST('coef', 'int'); - $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); $fk_range = GETPOST('fk_range', 'int'); @@ -62,9 +62,16 @@ if ($action == 'updateik') { } } - $expIk->setValues($_POST); - $result = $expIk->create($user); + $expIk->coef = $coef; + $expIk->ikoffset = $ikoffset; + $expIk->fk_c_exp_tax_cat = $fk_c_exp_tax_cat; + $expIk->fk_range = $fk_range; + if ($expIk->id > 0) { + $result = $expIk->update($user); + } else { + $result = $expIk->create($user); + } if ($result > 0) { setEventMessages('SetupSaved', null, 'mesgs'); diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 62fb097841b..7c27ee6e408 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -34,13 +34,19 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph // Load translation files required by the page $langs->loadLangs(array("admin", "other", "trips", "errors", "dict")); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules')); + +$object = new ExpenseReportRule($db); + if (!$user->admin) { accessforbidden(); } -// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules')); +/* + * Action + */ $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -51,7 +57,6 @@ if ($reshook < 0) { if (empty($reshook)) { //Init error $error = false; - $message = false; $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); @@ -59,21 +64,20 @@ if (empty($reshook)) { $apply_to = GETPOST('apply_to'); $fk_user = GETPOST('fk_user', 'int'); $fk_usergroup = GETPOST('fk_usergroup', 'int'); - - $fk_c_type_fees = GETPOST('fk_c_type_fees'); + $restrictive = GETPOST('restrictive', 'int'); + $fk_c_type_fees = GETPOST('fk_c_type_fees', 'int'); $code_expense_rules_type = GETPOST('code_expense_rules_type'); $dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear')); $datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear')); - $amount = GETPOST('amount'); + $amount = price2num(GETPOST('amount'), 'MT', 2); - $object = new ExpenseReportRule($db); if (!empty($id)) { $result = $object->fetch($id); if ($result < 0) { dol_print_error('', $object->error, $object->errors); } } - // TODO do action + if ($action == 'save') { $error = 0; @@ -104,8 +108,6 @@ if (empty($reshook)) { } if (empty($error)) { - $object->setValues($_POST); - if ($apply_to == 'U') { $object->fk_user = (int) $fk_user; $object->fk_usergroup = 0; @@ -122,18 +124,30 @@ if (empty($reshook)) { $object->dates = $dates; $object->datee = $datee; - + $object->restrictive = $restrictive; + $object->fk_c_type_fees = $fk_c_type_fees; + $object->code_expense_rules_type = $code_expense_rules_type; + $object->amount = $amount; $object->entity = $conf->entity; - $res = $object->create($user); + if ($object->id > 0) { + $res = $object->update($user); + } else { + $res = $object->create($user); + } if ($res > 0) { setEventMessages($langs->trans('ExpenseReportRuleSave'), null); } else { dol_print_error($object->db); + $error++; } - header('Location: ' . $_SERVER['PHP_SELF']); - exit; + if (!$error) { + header('Location: ' . $_SERVER['PHP_SELF']); + exit; + } else { + $action = ''; + } } } elseif ($action == 'delete') { // TODO add confirm @@ -207,7 +221,7 @@ if ($action != 'edit') { echo '' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . ''; echo '' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . ''; echo ' ' . $conf->currency . ''; + echo ''; echo '' . $form->selectyesno('restrictive', 0, 1) . ''; echo ''; echo ''; @@ -304,10 +318,10 @@ foreach ($rules as $rule) { } echo ''; - + // Amount echo ''; if ($action == 'edit' && $object->id == $rule->id) { - echo '' . $conf->currency; + echo ''; } else { echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index cdcd26490a3..77aded9c594 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -165,7 +165,7 @@ class PaymentVarious extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; $this->element = 'payment_various'; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e05750918da..c09943540bc 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -121,7 +121,7 @@ class Deplacement extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index a406a48c7f6..af6d4dc606b 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -222,7 +222,7 @@ class FactureRec extends CommonInvoice * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a5cb99c2260..e971262208c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -428,7 +428,7 @@ class Facture extends CommonInvoice * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index a54cd1a6668..522fe9aa2e2 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -57,7 +57,7 @@ class FactureStats extends Stats * @param int $typentid Id typent of thirdpary for filter * @param int $categid Id category of thirdpary for filter */ - public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) + public function __construct(DoliDB $db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0) { global $user, $conf; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index f94ad573a81..a4441804570 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -68,7 +68,7 @@ class PaymentTerm // extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6996c689922..70d8da4c27b 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -123,7 +123,7 @@ class ChargeSociales extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 9a4b50e3474..b6a611a47ee 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -105,7 +105,7 @@ class PaymentSocialContribution extends CommonObject * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { $this->db = $db; } diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php deleted file mode 100644 index 1bb4e92a0c9..00000000000 --- a/htdocs/core/class/coreobject.class.php +++ /dev/null @@ -1,413 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/core/class/coreobject.class.php - * \ingroup core - * \brief File of class to manage all object. Might be replace or merge into commonobject - */ - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; - -// TODO Remove this class (used in Expensereportik and ExpenseReportRule -/** - * CoreObject - */ -class CoreObject extends CommonObject -{ - public $withChild = true; - - /** - * @var Array $_fields Fields to synchronize with Database - */ - protected $fields = array(); - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB &$db) - { - $this->db = $db; - } - - /** - * Function to init fields - * - * @return bool - */ - protected function init() - { - $this->id = 0; - $this->datec = 0; - $this->tms = 0; - - if (!empty($this->fields)) { - foreach ($this->fields as $field => $info) { - if ($this->isDate($info)) { - $this->{$field} = time(); - } elseif ($this->isArray($info)) { - $this->{$field} = array(); - } elseif ($this->isInt($info)) { - $this->{$field} = (int) 0; - } elseif ($this->isFloat($info)) { - $this->{$field} = (double) 0; - } else { - $this->{$field} = ''; - } - } - - $this->to_delete = false; - $this->is_clone = false; - - return true; - } else { - return false; - } - } - - /** - * Test type of field - * - * @param string $field name of field - * @param string $type type of field to test - * @return boolean value of field or false - */ - private function checkFieldType($field, $type) - { - if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) { - return $this->{'is_'.$type}($this->fields[$field]); - } else { - return false; - } - } - - /** - * Get object and children from database - * - * @param int $id Id of object to load - * @param bool $loadChild used to load children from database - * @return int >0 if OK, <0 if KO, 0 if not found - */ - public function fetch($id, $loadChild = true) - { - $res = $this->fetchCommon($id); - if ($res > 0) { - if ($loadChild) { - $this->fetchChild(); - } - } - - return $res; - } - - - /** - * Function to instantiate a new child - * - * @param string $tabName Table name of child - * @param int $id If id is given, we try to return his key if exist or load if we try_to_load - * @param string $key Attribute name of the object id - * @param bool $try_to_load Force the fetch if an id is given - * @return int - */ - public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false) - { - if (!empty($id)) { - foreach ($this->{$tabName} as $k => &$object) { - if ($object->{$key} === $id) { - return $k; - } - } - } - - $k = count($this->{$tabName}); - - $className = ucfirst($tabName); - $this->{$tabName}[$k] = new $className($this->db); - if ($id > 0 && $key === 'id' && $try_to_load) { - $this->{$tabName}[$k]->fetch($id); - } - - return $k; - } - - - /** - * Function to set a child as to delete - * - * @param string $tabName Table name of child - * @param int $id Id of child to set as to delete - * @param string $key Attribute name of the object id - * @return bool - */ - public function removeChild($tabName, $id, $key = 'id') - { - foreach ($this->{$tabName} as &$object) { - if ($object->{$key} == $id) { - $object->to_delete = true; - return true; - } - } - return false; - } - - - /** - * Function to fetch children objects - * - * @return void - */ - public function fetchChild() - { - if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - - $this->{$className} = array(); - - $sql = "SELECT rowid FROM ".$this->db->prefix().$childTable." WHERE ".$this->fk_element." = ".((int) $this->id); - $res = $this->db->query($sql); - - if ($res) { - while ($obj = $this->db->fetch_object($res)) { - $o = new $className($this->db); - $o->fetch($obj->rowid); - - $this->{$className}[] = $o; - } - } else { - $this->errors[] = $this->db->lasterror(); - } - } - } - } - - /** - * Function to update children data - * - * @param User $user user object - * @return void - */ - public function saveChild(User &$user) - { - if ($this->withChild && !empty($this->childtables) && !empty($this->fk_element)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - if (!empty($this->{$className})) { - foreach ($this->{$className} as $i => &$object) { - $object->{$this->fk_element} = $this->id; - - $object->update($user); - if ($this->unsetChildDeleted && isset($object->to_delete) && $object->to_delete == true) { - unset($this->{$className}[$i]); - } - } - } - } - } - } - - - /** - * Function to update object or create or delete if needed - * - * @param User $user User object - * @return int < 0 if KO, > 0 if OK - */ - public function update(User &$user) - { - if (empty($this->id)) { - return $this->create($user); // To test, with that, no need to test on high level object, the core decide it, update just needed - } elseif (isset($this->to_delete) && $this->to_delete == true) { - return $this->delete($user); - } - - $error = 0; - $this->db->begin(); - - $res = $this->updateCommon($user); - if ($res) { - $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); - if ($result < 0) { - $error++; - } else { - $this->saveChild($user); - } - } else { - $error++; - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - } - - if (empty($error)) { - $this->db->commit(); - return $this->id; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Function to create object in database - * - * @param User $user User object - * @return int < 0 if KO, > 0 if OK - */ - public function create(User $user) - { - if ($this->id > 0) { - return $this->update($user); - } - - $error = 0; - $this->db->begin(); - - $res = $this->createCommon($user); - if ($res) { - $this->id = $this->db->last_insert_id($this->table_element); - - $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user); - if ($result < 0) { - $error++; - } else { - $this->saveChild($user); - } - } else { - $error++; - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - } - - if (empty($error)) { - $this->db->commit(); - return $this->id; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Function to delete object in database - * - * @param User $user user object - * @return int < 0 if KO, > 0 if OK - */ - public function delete(User &$user) - { - if ($this->id <= 0) { - return 0; - } - - $error = 0; - $this->db->begin(); - - $result = $this->call_trigger(strtoupper($this->element).'_DELETE', $user); - if ($result < 0) { - $error++; - } - - if (!$error) { - $this->deleteCommon($user); - if ($this->withChild && !empty($this->childtables)) { - foreach ($this->childtables as &$childTable) { - $className = ucfirst($childTable); - if (!empty($this->{$className})) { - foreach ($this->{$className} as &$object) { - $object->delete($user); - } - } - } - } - } - - if (empty($error)) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->errors[] = $this->error; - $this->db->rollback(); - return -1; - } - } - - - /** - * Function to get a formatted date - * - * @param string $field Attribute to return - * @param string $format Output date format - * @return string - */ - public function getDate($field, $format = '') - { - if (empty($this->{$field})) { - return ''; - } else { - return dol_print_date($this->{$field}, $format); - } - } - - /** - * Function to set date in field - * - * @param string $field field to set - * @param string $date formatted date to convert - * @return mixed - */ - public function setDate($field, $date) - { - if (empty($date)) { - $this->{$field} = 0; - } else { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $this->{$field} = dol_stringtotime($date); - } - - return $this->{$field}; - } - - - /** - * Function to update current object - * - * @param array $Tab Array of values - * @return int - */ - public function setValues(&$Tab) - { - foreach ($Tab as $key => $value) { - if ($this->checkFieldType($key, 'date')) { - $this->setDate($key, $value); - } elseif ($this->checkFieldType($key, 'float')) { - $this->{$key} = (double) price2num($value); - } elseif ($this->checkFieldType($key, 'int')) { - $this->{$key} = (int) price2num($value); - } else { - $this->{$key} = dol_string_nohtmltag($value); - } - } - - return 1; - } -} diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index ace78c5199a..476b1d5a4da 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -465,7 +465,7 @@ print ''; $count = 0; print '
'; print '
'; -print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth200 maxwidth250', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields +print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields print '
'; diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 10f9c021c0d..7aabf0eace7 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1026,7 +1026,7 @@ class DoliDBSqlite3 extends DoliDB * * @param string $table Name of table * @param string $field Optionnel : Name of field if we want description of field - * @return SQLite3Result Resource + * @return bool|SQLite3Result Resource */ public function DDLDescTable($table, $field = "") { diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index efc061b9e67..cc2d3f57052 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -120,7 +120,7 @@ class pdf_espadon extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct($db) { global $conf, $langs, $mysoc; diff --git a/htdocs/expensereport/class/expensereport_ik.class.php b/htdocs/expensereport/class/expensereport_ik.class.php index 53cf3695b12..49ac0af9857 100644 --- a/htdocs/expensereport/class/expensereport_ik.class.php +++ b/htdocs/expensereport/class/expensereport_ik.class.php @@ -22,12 +22,12 @@ * \brief File of class to manage expense ik */ -require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; /** * Class to manage inventories */ -class ExpenseReportIk extends CoreObject +class ExpenseReportIk extends CommonObject { /** * @var string ID to identify managed object @@ -68,6 +68,7 @@ class ExpenseReportIk extends CoreObject */ public $ikoffset; + /** * Attribute object linked with database * @var array @@ -80,17 +81,75 @@ class ExpenseReportIk extends CoreObject ,'ikoffset'=>array('type'=>'double') ); + /** * Constructor * * @param DoliDB $db Database handler */ - public function __construct(DoliDB &$db) + public function __construct(DoliDB $db) { - parent::__construct($db); - parent::init(); + $this->db = $db; + } - $this->errors = array(); + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + $resultcreate = $this->createCommon($user, $notrigger); + + //$resultvalidate = $this->validate($user, $notrigger); + + return $resultcreate; + } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && !empty($this->table_element_line)) { + $this->fetchLines(); + } + return $result; + } + + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); } diff --git a/htdocs/expensereport/class/expensereport_rule.class.php b/htdocs/expensereport/class/expensereport_rule.class.php index ae89b4b0f51..02bf8b8ce5c 100644 --- a/htdocs/expensereport/class/expensereport_rule.class.php +++ b/htdocs/expensereport/class/expensereport_rule.class.php @@ -22,12 +22,12 @@ * \brief File of class to manage expense ik */ -require_once DOL_DOCUMENT_ROOT.'/core/class/coreobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; /** * Class to manage inventories */ -class ExpenseReportRule extends CoreObject +class ExpenseReportRule extends CommonObject { /** * @var string ID to identify managed object @@ -125,21 +125,78 @@ class ExpenseReportRule extends CoreObject ,'entity'=>array('type'=>'integer') ); + /** * Constructor * * @param DoliDB $db Database handler */ - public function __construct(DoliDB &$db) + public function __construct(DoliDB $db) { - global $conf; - - parent::__construct($db); - parent::init(); - - $this->errors = array(); + $this->db = $db; } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + $resultcreate = $this->createCommon($user, $notrigger); + + //$resultvalidate = $this->validate($user, $notrigger); + + return $resultcreate; + } + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id, $ref = null) + { + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && !empty($this->table_element_line)) { + $this->fetchLines(); + } + return $result; + } + + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + //return $this->deleteCommon($user, $notrigger, 1); + } + + /** * Return all rules or filtered by something * From 177e8c17fb8c7905c36504199207dec206328601 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:23:21 +0200 Subject: [PATCH 10/19] Fix scrutinizer --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/action/index.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/utils.class.php | 2 +- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_merou.modules.php | 2 +- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 2 +- htdocs/core/modules/reception/doc/pdf_squille.modules.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 7 +++++++ htdocs/install/fileconf.php | 6 +++--- htdocs/product/card.php | 2 +- htdocs/societe/class/societe.class.php | 7 ++++--- 14 files changed, 25 insertions(+), 17 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f22cea8d04e..aeb20e6c7b4 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1621,7 +1621,7 @@ class ActionComm extends CommonObject $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"'; + $linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, '', 1).'"'; $linkclose .= ' class="'.$classname.' classfortooltip"'; /* $hookmanager->initHooks(array('actiondao')); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 920fe69025d..f5bbeb6467d 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -110,7 +110,7 @@ $week = GETPOST("week", "int") ?GETPOST("week", "int") : date("W"); $day = GETPOST("day", "int") ?GETPOST("day", "int") : date("d"); $pid = GETPOST("search_projectid", "int", 3) ? GETPOST("search_projectid", "int", 3) : GETPOST("projectid", "int", 3); $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo' -$type = GETPOSTISSET("search_type", 'aZ09') ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); +$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09'); $maxprint = GETPOSTISSET("maxprint") ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW; $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6466754f241..b4bac9b1d73 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -201,7 +201,7 @@ abstract class CommonObject public $user; /** - * @var string The type of originating object ('commande', 'facture', ...) + * @var string The type of originating object ('commande', 'facture', ...). Note: on some object this field is called $origin_type * @see fetch_origin() */ public $origin; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 81fbb83b264..c21434b49de 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7621,7 +7621,7 @@ class Form if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...) $tmpfieldstoshow = ''; foreach ($objecttmp->fields as $key => $val) { - if (!dol_eval($val['enabled'], 1, 1, 1, '1')) { + if (!dol_eval($val['enabled'], 1, 1, '1')) { continue; } if (!empty($val['showoncombobox'])) { diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index f3d46e09f30..8b74609bfa3 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -342,7 +342,7 @@ class Utils $handle = ''; - $lowmemorydump = GETPOSTISSET("lowmemorydump", "alpha") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); + $lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP'); // Start call method to execute dump $fullcommandcrypted = $command." ".$paramcrypted." 2>&1"; diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index cc2d3f57052..fa47f7be159 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -120,7 +120,7 @@ class pdf_espadon extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 9a905422ff1..87098733502 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -121,7 +121,7 @@ class pdf_merou extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 94e048382dc..64d8a2c65e6 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -121,7 +121,7 @@ class pdf_rouget extends ModelePdfExpedition * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 9f03abef52c..1ad02edc46b 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -44,7 +44,7 @@ class pdf_squille extends ModelePdfReception * * @param DoliDB $db Database handler */ - public function __construct($db = 0) + public function __construct(DoliDB $db) { global $conf, $langs, $mysoc; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 0dec85b2e4f..acb54dde6f3 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -752,7 +752,7 @@ class Expedition extends CommonObject //var_dump($this->lines[$i]); $mouvS = new MouvementStock($this->db); - $mouvS->origin = dol_clone($this, 1); + //$mouvS->origin = dol_clone($this, 1); $mouvS->setOrigin($this->element, $this->id); if (empty($obj->edbrowid)) { diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index ab68cd3ecc6..a43e4a3ff9b 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -127,6 +127,13 @@ class FactureFournisseurRec extends CommonInvoice public $model_pdf; + /** + * Invoice lines + * @var FactureFournisseurLigneRec[] + */ + public $lines = array(); + + /* Override fields in CommonObject public $entity; public $date_creation; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 16d8a919dbe..14f1ee2a1cd 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -143,7 +143,7 @@ if (!empty($force_install_message)) { @@ -178,7 +178,7 @@ if (!empty($force_install_noedit)) { $dolibarr_main_data_root = @$force_install_main_data_root; } if (empty($dolibarr_main_data_root)) { - $dolibarr_main_data_root = GETPOSTISSET('main_data_dir', 'alpha') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root); + $dolibarr_main_data_root = GETPOSTISSET('main_data_dir') ? GETPOST('main_data_dir') : detect_dolibarr_main_data_root($dolibarr_main_document_root); } ?> @@ -207,7 +207,7 @@ if (!empty($force_install_noedit)) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6040e116fa5..c7d26830ebf 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1461,7 +1461,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($type == 1) { print ''.$langs->trans("Duration").''; print ''; - print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOSTISSET('duration_value', 'alpha') : 'h'), 0, 1); + print $formproduct->selectMeasuringUnits("duration_unit", "time", (GETPOSTISSET('duration_value') ? GETPOST('duration_value', 'alpha') : 'h'), 0, 1); // Mandatory period print '       '; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 30f8515e92c..686c301af79 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -504,18 +504,19 @@ class Societe extends CommonObject /** * Date of last update - * @var string + * @var integer|string */ public $date_modification; /** * User that made last update - * @var string + * @var User */ public $user_modification; /** - * @var integer|string date_creation + * Date of creation + * @var integer|string */ public $date_creation; From 48cb30bd9babad7335121207a5dceab10d85fe99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:34:54 +0200 Subject: [PATCH 11/19] Fix scrutinizer --- .../modules/expedition/doc/pdf_espadon.modules.php | 2 +- .../modules/expedition/doc/pdf_merou.modules.php | 2 +- .../core/modules/facture/doc/pdf_crabe.modules.php | 12 ++++++------ .../core/modules/propale/doc/pdf_azur.modules.php | 3 ++- .../supplier_invoice/doc/pdf_canelle.modules.php | 13 +++++++------ .../interface_50_modTicket_TicketEmail.class.php | 2 +- htdocs/install/step5.php | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index fa47f7be159..a038705ea22 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -642,7 +642,7 @@ class pdf_espadon extends ModelePdfExpedition if ($this->getColumnStatus('weight')) { - $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt, array('html'=>1)); + $this->printStdColumnContent($pdf, $curY, 'weight', $weighttxt.(($weighttxt && $voltxt) ? '
' : '').$voltxt); $nexY = max($pdf->GetY(), $nexY); } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 87098733502..69105dd31cc 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -584,7 +584,7 @@ class pdf_merou extends ModelePdfExpedition $origin_id = $object->origin_id; // Add list of linked elements - $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1, $hookmanager); + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size - 1); //$this->Code39($Xoff+43, $Yoff+1, $object->commande->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true); //Definition Location of the Company block diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8046347e881..091b78d2ed5 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -874,12 +874,12 @@ class pdf_crabe extends ModelePDFFactures /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Facture $object Object invoice - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @param int $heightforfooter height for footer - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param Facture $object Object invoice + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @param int $heightforfooter Height for footer + * @return int <0 if KO, >0 if OK */ protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index c6bb975092d..abf2b843a39 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1458,9 +1458,10 @@ class pdf_azur extends ModelePDFPropales * @param Propal $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output + * @param Translate $outputlangsbis Object lang for output bis * @return void */ - protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) + protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { global $conf, $langs; diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 23a38b961ec..b026a39791c 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -967,13 +967,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices /** * Show payments table * - * @param TCPDF $pdf Object PDF - * @param Object $object Object to show - * @param int $posy Position y in PDF - * @param Translate $outputlangs Object langs for output - * @return int <0 if KO, >0 if OK + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int $posy Position y in PDF + * @param Translate $outputlangs Object langs for output + * @param int $heightforfooter Height for footer + * @return int <0 if KO, >0 if OK */ - protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs) + protected function _tableau_versements(&$pdf, $object, $posy, $outputlangs, $heightforfooter = 0) { // phpcs:enable global $conf; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index e13328e0a2a..840d6d9c3ba 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -169,7 +169,7 @@ class InterfaceTicketEmail extends DolibarrTriggers } if ($sendto) { - $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs, $conf); + $this->composeAndSendCustomerMessage($sendto, $subject_customer, $body_customer, $see_ticket_customer, $object, $langs); } } diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 89681794aeb..ee592007522 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -228,7 +228,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { $success = 1; } else { dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); - setEventMessage($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors'); + setEventMessages($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors'); //header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : '')); print '
'.$langs->trans("FailedToCreateAdminLogin").': '.$newuser->error.'


'; print $langs->trans("ErrorGoBackAndCorrectParameters").'

'; From 86d34af4b0e3687b324b0e3719f26859bf9323df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 11:38:56 +0200 Subject: [PATCH 12/19] Fix deprecated code --- htdocs/compta/deplacement/list.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 +- htdocs/compta/paiement/rapport.php | 2 +- htdocs/contact/consumption.php | 2 +- htdocs/contrat/list.php | 2 +- htdocs/expensereport/list.php | 4 ++-- htdocs/fourn/facture/rapport.php | 2 +- htdocs/holiday/list.php | 8 ++++---- htdocs/opensurvey/results.php | 2 +- htdocs/projet/list.php | 4 ++-- htdocs/projet/tasks.php | 4 ++-- htdocs/projet/tasks/time.php | 2 +- htdocs/societe/consumption.php | 2 +- htdocs/societe/paymentmodes.php | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 9f92cecc4a7..2aa03441e9b 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -158,7 +158,7 @@ if ($resql) { print ''; } print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index d12caf36bbe..1c3abfe87bd 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -172,7 +172,7 @@ if ($resql) { print ''; } print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); print ''; print ''; $form->select_comptes($search_account, 'search_account', 0, '', 1); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index cf02c2aeb74..326be7144a8 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -102,7 +102,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time()); print $formother->select_month($cmonth, 'remonth'); -print $formother->select_year($syear, 'reyear'); +print $formother->selectyear($syear, 'reyear'); print ''; print ''; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 02813cee469..7f1d9bdc64b 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -410,7 +410,7 @@ if ($sql_select) { print ''; print ''; // date print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); - $formother->select_year($year ? $year : -1, 'year', 1, 20, 1); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1); print ''; print ''; print ''; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 57b4657eab4..e76261010da 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -693,7 +693,7 @@ if (!empty($arrayfields['lower_planned_end_date']['checked'])) { print '
'; print $formother->select_month($search_dfmonth, 'search_dfmonth', 1, 0); print ' '; - $formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, ''); + print $formother->selectyear($search_dfyear, 'search_dfyear', 1, 20, 5, 0, 0, ''); print ''; } // Status diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 551957d0a69..24432cb7cf1 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -580,14 +580,14 @@ if ($resql) { if (!empty($arrayfields['d.date_valid']['checked'])) { print ''; //print ''; - //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year); print ''; } // Date approve if (!empty($arrayfields['d.date_approve']['checked'])) { print ''; //print ''; - //$formother->select_year($year_end,'year_end',1, $min_year, $max_year); + //print $formother->selectyear($year_end,'year_end',1, $min_year, $max_year); print ''; } // Amount with no tax diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 59b92f349c0..f46871b03e9 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -105,7 +105,7 @@ $syear = GETPOST("reyear") ?GETPOST("reyear") : date("Y", time()); print $formother->select_month($cmonth, 'remonth'); -print $formother->select_year($syear, 'reyear'); +print $formother->selectyear($syear, 'reyear'); print ''; print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5dc05d1c617..ed6e421d302 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -625,7 +625,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_debut']['checked'])) { print ''; print ''; - $formother->select_year($search_year_start, 'search_year_start', 1, $min_year, $max_year); + print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); print ''; } @@ -633,7 +633,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_fin']['checked'])) { print ''; print ''; - $formother->select_year($search_year_end, 'search_year_end', 1, $min_year, $max_year); + print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); print ''; } @@ -654,7 +654,7 @@ if ($resql) { if (!empty($arrayfields['cp.date_create']['checked'])) { print ''; print ''; - $formother->select_year($search_year_create, 'search_year_create', 1, $min_year, 0); + print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); print ''; } @@ -662,7 +662,7 @@ if ($resql) { if (!empty($arrayfields['cp.tms']['checked'])) { print ''; print ''; - $formother->select_year($search_year_update, 'search_year_update', 1, $min_year, 0); + print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); print ''; } diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index bb2e3604627..eda16dec32c 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -609,7 +609,7 @@ if (GETPOST('ajoutsujet')) { print ' '; - print $formother->select_year('', 'nouvelleannee', 1, 0, 5, 0, 1); + print $formother->selectyear('', 'nouvelleannee', 1, 0, 5, 0, 1); print '

'.$langs->trans("AddStartHour").':

'."\n"; print ''; } print ''; - $formother->select_year($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print $formother->selectyear($search_syear ? $search_syear : -1, 'search_syear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ print '
'; print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; @@ -914,7 +914,7 @@ if (!empty($arrayfields['p.datee']['checked'])) { print ''; } print ''; - $formother->select_year($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ + print $formother->selectyear($search_eyear ? $search_eyear : -1, 'search_eyear', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');*/ print '
'; print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index eacd507b35c..24f3874301b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -901,7 +901,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; /*print ''; print ''; - $formother->select_year($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);*/ + print $formother->selectyear($search_dtstartyear ? $search_dtstartyear : -1, 'search_dtstartyear', 1, 20, 5);*/ print '
'; print $form->selectDate($search_date_start_start ? $search_date_start_start : -1, 'search_date_start_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; @@ -915,7 +915,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; /*print ''; print ''; - $formother->select_year($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);*/ + print $formother->selectyear($search_dtendyear ? $search_dtendyear : -1, 'search_dtendyear', 1, 20, 5);*/ print '
'; print $form->selectDate($search_date_end_start ? $search_date_end_start : -1, 'search_date_end_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index fa987805a25..3718fe55e27 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1562,7 +1562,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } print ''; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print $formother->selectyear($search_year, 'search_year', 1, 20, 5); print ''; } if (!empty($allprojectforuser)) { diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2ab5a836c51..5f997a37e9c 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -443,7 +443,7 @@ if ($sql_select) { print ''; print ''; // date print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle'); - $formother->select_year($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly'); + print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly'); print ''; print ''; print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index bdbf7453c35..e2ac40f8770 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1683,7 +1683,7 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation) print ''.$langs->trans("ExpiryDate").''; print ''; print $formother->select_month($companypaymentmode->exp_date_month, 'exp_date_month', 1); - print $formother->select_year($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); + print $formother->selectyear($companypaymentmode->exp_date_year, 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); print ''; print ''.$langs->trans("CVN").''; @@ -1841,7 +1841,7 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio print ''.$langs->trans("ExpiryDate").''; print ''; print $formother->select_month(GETPOST('exp_date_month', 'int'), 'exp_date_month', 1); - print $formother->select_year(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); + print $formother->selectyear(GETPOST('exp_date_year', 'int'), 'exp_date_year', 1, 5, 10, 0, 0, '', 'marginleftonly'); print ''; print ''.$langs->trans("CVN").''; From 308e7a3d9bd74ec3267491aa14178bd05d4fdeb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 12:40:44 +0200 Subject: [PATCH 13/19] Fix scrutinizer --- .../class/accountingaccount.class.php | 1 + htdocs/accountancy/class/lettering.class.php | 2 ++ htdocs/compta/facture/class/facture.class.php | 7 +++-- .../core/class/commondocgenerator.class.php | 20 ++++++++++++ htdocs/core/class/html.form.class.php | 31 ++++++++++--------- htdocs/core/class/html.formticket.class.php | 28 +++++++++++------ htdocs/core/modules/action/rapport.pdf.php | 8 +++++ .../doc/doc_generic_asset_odt.modules.php | 1 - .../core/modules/bank/doc/pdf_ban.modules.php | 1 - .../bank/doc/pdf_sepamandate.modules.php | 1 - .../doc/doc_generic_order_odt.modules.php | 1 - .../commande/doc/pdf_einstein.modules.php | 1 - .../commande/doc/pdf_eratosthene.modules.php | 1 - .../doc/doc_generic_contract_odt.modules.php | 1 - .../contract/doc/pdf_strato.modules.php | 1 - .../delivery/doc/pdf_storm.modules.php | 1 - .../delivery/doc/pdf_typhon.modules.php | 1 - .../doc/doc_generic_shipment_odt.modules.php | 1 - .../doc/pdf_standard.modules.php | 9 +++++- .../doc/doc_generic_invoice_odt.modules.php | 1 - .../modules/facture/doc/pdf_crabe.modules.php | 1 - .../facture/doc/pdf_sponge.modules.php | 1 - .../fichinter/doc/pdf_soleil.modules.php | 1 - .../doc/doc_generic_member_odt.class.php | 1 - .../movement/doc/pdf_standard.modules.php | 31 ++++++++----------- .../modules/movement/modules_movement.php | 2 ++ .../mrp/doc/doc_generic_mo_odt.modules.php | 1 - .../modules/mrp/doc/pdf_vinci.modules.php | 1 - .../doc/doc_generic_product_odt.modules.php | 1 - .../product/doc/pdf_standard.modules.php | 1 - .../doc/doc_generic_project_odt.modules.php | 1 - .../project/doc/pdf_baleine.modules.php | 1 - .../project/doc/pdf_beluga.modules.php | 1 - .../project/doc/pdf_timespent.modules.php | 1 - .../task/doc/doc_generic_task_odt.modules.php | 1 - .../doc/doc_generic_proposal_odt.modules.php | 1 - .../modules/propale/doc/pdf_azur.modules.php | 1 - .../modules/propale/doc/pdf_cyan.modules.php | 1 - .../doc/doc_generic_reception_odt.modules.php | 1 - .../doc/doc_generic_stock_odt.modules.php | 1 - .../doc/pdf_canelle.modules.php | 1 - ...doc_generic_supplier_order_odt.modules.php | 2 -- .../supplier_order/doc/pdf_cornas.modules.php | 1 - .../doc/pdf_muscadet.modules.php | 1 - .../doc/pdf_standard.modules.php | 8 +++++ ..._generic_supplier_proposal_odt.modules.php | 1 - .../doc/pdf_aurore.modules.php | 1 - .../user/doc/doc_generic_user_odt.modules.php | 1 - .../doc/doc_generic_usergroup_odt.modules.php | 1 - .../doc/doc_generic_myobject_odt.modules.php | 1 - htdocs/product/class/product.class.php | 16 +++++----- htdocs/public/recruitment/view.php | 2 +- htdocs/public/ticket/list.php | 4 +-- ...ric_recruitmentjobposition_odt.modules.php | 1 - ...tandard_recruitmentjobposition.modules.php | 1 - 55 files changed, 112 insertions(+), 99 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 72efffc2b49..28c35016054 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject $reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { + $const_name = ''; if ($type == 'customer') { $const_name = "SOLD"; } elseif ($type == 'supplier') { diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 81caaa05358..405a630942e 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -699,6 +699,8 @@ class Lettering extends BookKeeping return $grouped_payments; } + $save_payment_by_element = null; + $save_element_by_payment = null; if ($element_id == 0) { // Save list when is the begin of recursive function $save_payment_by_element = $payment_by_element; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e971262208c..3dde8ce2638 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1652,13 +1652,13 @@ class Facture extends CommonInvoice 0, // date_start 0, // date_end 0, - $lines[$i]->info_bits, // info_bits + 0, // info_bits 0, 'HT', 0, 0, // product_type 1, - $lines[$i]->special_code, + 0, // special_code $deposit->origin, 0, 0, @@ -5503,6 +5503,7 @@ class Facture extends CommonInvoice $sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1); // Recipient + $to = ''; $res = $tmpinvoice->fetch_thirdparty(); $recipient = $tmpinvoice->thirdparty; if ($res > 0) { @@ -5524,7 +5525,7 @@ class Facture extends CommonInvoice $error++; } - if (!$error) { + if (!$error && $to) { // Errors Recipient $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a9536f410ca..e80eaa52b14 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -65,6 +65,26 @@ abstract class CommonDocGenerator */ public $scandir; + public $page_hauteur; + public $page_largeur; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; + + public $option_logo; + public $option_tva; + public $option_multilang; + public $option_freetext; + public $option_draft_watermark; + + public $option_modereg; + public $option_condreg; + public $option_escompte; + public $option_credit_note; + + public $emetteur; + /** * Constructor diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c21434b49de..06b56076316 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -466,6 +466,8 @@ class Form $ext_element = false; $button_only = false; $inputOption = ''; + $rows = ''; + $cols = ''; if (is_object($object)) { $element = $object->element; @@ -1001,9 +1003,10 @@ class Form * @param string $htmloption Options html on select object * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array $disableautocomplete Disable autocomplete * @return string HTML string with select and input */ - public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array()) + public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array(), $disableautocomplete = 0) { // phpcs:enable global $conf, $langs; @@ -1038,8 +1041,6 @@ class Form $num = $this->db->num_rows($resql); $i = 0; if ($num) { - $foundselected = false; - while ($i < $num) { $obj = $this->db->fetch_object($resql); $incotermArray[$i]['rowid'] = $obj->rowid; @@ -1901,6 +1902,7 @@ class Form { // phpcs:enable global $conf, $user, $langs, $hookmanager; + global $action; // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) { @@ -2414,6 +2416,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $events = array(); $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); } @@ -4192,6 +4195,7 @@ class Form } } $out .= '>'; + $value = ''; if ($format == 0) { $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); } elseif ($format == 1) { @@ -6333,6 +6337,9 @@ class Form // Analysis of the pre-selection date $reg = array(); + $shour = ''; + $smin = ''; + $ssec = ''; if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage // Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' $syear = (!empty($reg[1]) ? $reg[1] : ''); @@ -6349,10 +6356,6 @@ class Form $shour = dol_print_date($set_time, "%H", $gm); $smin = dol_print_date($set_time, "%M", $gm); $ssec = dol_print_date($set_time, "%S", $gm); - } else { - $shour = ''; - $smin = ''; - $ssec = ''; } } else { // Date est '' ou vaut -1 @@ -6878,6 +6881,7 @@ class Form unset($tickettmpselect); } + $urloption = ''; $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : '; @@ -7020,16 +7024,11 @@ class Form protected function constructTicketListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '') { $outkey = ''; - $outval = ''; $outref = ''; - $outlabel = ''; $outtype = ''; - $label = $objp->label; - $outkey = $objp->rowid; $outref = $objp->ref; - $outlabel = $objp->label; $outtype = $objp->fk_product_type; $opt = '\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype); } /** @@ -7648,6 +7646,7 @@ class Form $out = ''; $outarray = array(); + $tmparray = array(); $num = 0; @@ -9353,10 +9352,12 @@ class Form global $conf, $user, $langs; // Permettre l'exclusion de groupes + $excludeGroups = null; if (is_array($exclude)) { $excludeGroups = implode(",", $exclude); } // Permettre l'inclusion de groupes + $includeGroups = null; if (is_array($include)) { $includeGroups = implode(",", $include); } @@ -9920,7 +9921,7 @@ class Form //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled $out .= '>' . $labeltoshow . ''; } else { - if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { + if ($disabled && ($selected != $obj->rowid)) { $resultat = ''; } else { $resultat = '