From 4877680958700ac3e7e174bcd08274da9efb1d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:19:33 +0100 Subject: [PATCH 01/10] php V8 warning --- htdocs/compta/stats/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 9cafa6d2da0..7b5b23f726f 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -419,7 +419,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { // Value turnover of month w/o VAT print ''; if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { - if ($cum_ht[$case]) { + if (!empty($cum_ht[$case])) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; } else { From 36e2a345fc6e8268d7dd3a641808ba3a3488552d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:25:36 +0100 Subject: [PATCH 02/10] php V8 warning --- htdocs/compta/stats/byratecountry.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index a8c5f88e435..dced36d44a6 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -374,9 +374,9 @@ if ($modecompta == 'CREANCES-DETTES') { $j -= 12; } $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT); - print ''.price($totalpermonth[$j]).''; + print ''.price((empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j])).''; } - print ''.price($totalpermonth['total']).''; + print ''.price((empty($totalpermonth['total']) ? 0 : $totalpermonth['total'])).''; print ''; } else { print $db->lasterror(); // Show last sql error From bc7f6f508143e8c9794cb3fb2f4f4252401b877f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:29:07 +0100 Subject: [PATCH 03/10] php V8 warning --- htdocs/compta/bank/bankentries_list.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 1d56ac2016d..cc6f63dcbce 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1290,6 +1290,9 @@ if ($resql) { $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; + $totalarray['totaldeb'] = 0; + $totalarray['totalcred'] = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); From 2165e5d84ba82490532b7541a19a070598f16318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:31:22 +0100 Subject: [PATCH 04/10] php V8 warning --- htdocs/fourn/facture/rapport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 60cf47d3d80..d2ff9442df6 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -36,7 +36,7 @@ $socid = ''; if (!empty($user->socid)) { $socid = $user->socid; } -$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +$result = restrictedArea($user, 'fournisseur', 0, 'facture_fourn', 'facture'); $action = GETPOST('action', 'aZ09'); From c385a3ca3b35fb8cd6f5499b7a8d1d8ef1f1be4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:32:37 +0100 Subject: [PATCH 05/10] Update bankentries_list.php --- htdocs/compta/bank/bankentries_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index cc6f63dcbce..a0a54bdcccd 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1292,7 +1292,7 @@ if ($resql) { $totalarray['nbfield'] = 0; $totalarray['totaldeb'] = 0; $totalarray['totalcred'] = 0; - + $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); From 233018423247b91cbf550151d8fb4dcdd4842d07 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 14 Dec 2023 11:00:02 +0100 Subject: [PATCH 06/10] add hooks to product composition card --- htdocs/product/composition/card.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f39df3b4085..f70639a6a05 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -389,6 +389,10 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled('stock')) { print ''.$langs->trans('Stock').''; } + // Hook fields + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; // Qty in kit print ''.$langs->trans('Qty').''; // Stoc inc/dev @@ -467,6 +471,11 @@ if ($id > 0 || !empty($ref)) { print ''.$value['stock'].''; // Real stock } + // Hook fields + $parameters = array(); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $productstatic); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Qty + IncDec if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) { print ''; @@ -517,6 +526,11 @@ if ($id > 0 || !empty($ref)) { print ''; // Real stock } + // Hook fields + $parameters = array(); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $productstatic); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Qty in kit print ''.dol_escape_htmltag($value['nb']).''; From 88c0700ee583afea53e313699b040c450ca90675 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 14 Dec 2023 13:39:06 +0100 Subject: [PATCH 07/10] QUAL make UI strings differenciate between orders torward customer or supplier --- htdocs/commande/card.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 12 ++++++------ htdocs/langs/en_US/bills.lang | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 791f67fcd56..b19ca882921 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3037,7 +3037,7 @@ if ($action == 'create' && $usercancreate) { // Cancel order if ($object->statut == Commande::STATUS_VALIDATED && !empty($usercancancel)) { - print ''.$langs->trans("Cancel").''; + print ''.$langs->trans("CancelOrder").''; } // Delete order diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 8c8f661fac8..d3cbb3c2367 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1312,7 +1312,7 @@ if ($permissiontoclose) { $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("CancelOrder"); } if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0d2d65416da..708a977677e 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2635,7 +2635,7 @@ if ($action == 'create') { //{ if (isModEnabled("supplier_invoice") && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight("supplier_invoice", "creer")) { - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("SupplierOrderCreateBill").''; } } //} diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 93b72fbd900..825f1353837 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -866,7 +866,7 @@ if (empty($reshook)) { } if (!GETPOST('ref_supplier')) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors'); $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; @@ -1034,7 +1034,7 @@ if (empty($reshook)) { } if (!GETPOST('ref_supplier')) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors'); $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; @@ -2381,7 +2381,7 @@ if ($action == 'create') { } // Ref supplier - print ''.$langs->trans('RefSupplier').''.$langs->trans('RefSupplierBill').'id) && $societe->id > 0) { print ' autofocus'; } @@ -2960,7 +2960,7 @@ if ($action == 'create') { if ($action == 'clone') { // Create an array for form $formquestion = array( - array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplier"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier), + array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplierBill"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier), array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()) ); // Ask confirmation to clone @@ -3192,8 +3192,8 @@ if ($action == 'create') { $morehtmlref = '
'; // Ref supplier - $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'supplier'); if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) { diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 63c86001b28..e45de1d3553 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -268,6 +268,8 @@ NoDraftBills=No draft invoices NoOtherDraftBills=No other draft invoices NoDraftInvoices=No draft invoices RefBill=Invoice ref +RefSupplierBill=Supplier invoice ref +SupplierOrderCreateBill=Create invoice ToBill=To bill RemainderToBill=Remainder to bill SendBillByMail=Send invoice by email From a9d39252908e4ef173ecaa4881cdd5ead028a937 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Dec 2023 15:58:19 +0100 Subject: [PATCH 08/10] Clean code --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 17c852f449d..994c5e89a1d 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1361,9 +1361,9 @@ class FactureFournisseurRec extends CommonInvoice if (!$error && $facturerec->generate_pdf) { // We refresh the object in order to have all necessary data (like date_lim_reglement) - $laststep="Refresh {$new_fac_fourn->id}"; + $laststep="Refresh ".$new_fac_fourn->id; $new_fac_fourn->fetch($new_fac_fourn->id); - $laststep="GenerateDocument {$new_fac_fourn->id}"; + $laststep="GenerateDocument ".$new_fac_fourn->id; $result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs); if ($result < 0) { $this->errors = $new_fac_fourn->errors; From 27df30b773d082638cc0fee87e2ab0e0d85c32c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Dec 2023 16:22:02 +0100 Subject: [PATCH 09/10] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/expedition/list.php | 52 +++++++++++++++++++++++++++----------- htdocs/reception/list.php | 8 ++++++ 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 4394f2018e1..0a065a71933 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -178,7 +178,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_categ = ''; $search_user = ''; $search_sale = ''; $search_product_category = ''; @@ -274,9 +273,6 @@ $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " e.date_creation as date_creation, e.tms as date_update,"; $sql .= " u.login"; -if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $sql .= ", cc.fk_categorie, cc.fk_soc"; -} // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -299,9 +295,6 @@ if ($search_all) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON pd.rowid=ed.fk_origin_line'; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; -if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ -} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; @@ -362,9 +355,6 @@ if ($search_tracking) { if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')'; } -if ($search_sale > 0) { - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale); -} if ($search_user > 0) { // The contact on a shipment is also the contact of the order. $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".((int) $search_user); @@ -395,11 +385,43 @@ if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } -if ($search_categ_cus > 0) { - $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus); +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = e.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = e.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } } -if ($search_categ_cus == -2) { - $sql .= " AND cc.fk_categorie IS NULL"; +// Search for tag/category ($searchCategoryCustomerList is an array of ID) +$searchCategoryCustomerOperator = -1; +$searchCategoryCustomerList = array($search_categ_cus); +if (!empty($searchCategoryCustomerList)) { + $searchCategoryCustomerSqlList = array(); + $listofcategoryid = ''; + foreach ($searchCategoryCustomerList as $searchCategoryCustomer) { + if (intval($searchCategoryCustomer) == -2) { + $searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc)"; + } elseif (intval($searchCategoryCustomer) > 0) { + if ($searchCategoryCustomerOperator == 0) { + $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")"; + } else { + $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); + } + } + } + if ($listofcategoryid) { + $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid)."))"; + } + if ($searchCategoryCustomerOperator == 1) { + if (!empty($searchCategoryCustomerSqlList)) { + $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")"; + } + } else { + if (!empty($searchCategoryCustomerSqlList)) { + $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")"; + } + } } // Search for tag/category ($searchCategoryProductList is an array of ID) $searchCategoryProductOperator = -1; @@ -1179,7 +1201,7 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } $db->free($resql); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index a03270f809b..372d8136940 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -677,6 +677,14 @@ if ($search_ref_supplier) { if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } +// Search on sale representative +if ($search_sale && $search_sale != '-1') { + if ($search_sale == -2) { + $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)"; + } elseif ($search_sale > 0) { + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; + } +} // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; From 70c53b4568de04ac3122ca0f6a3a0b352a6bcb29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Dec 2023 16:24:04 +0100 Subject: [PATCH 10/10] Debug v19 --- htdocs/reception/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 372d8136940..1239a6dc2c4 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -678,6 +678,7 @@ if ($search_all) { $sql .= natural_search(array_keys($fieldstosearchall), $search_all); } // Search on sale representative +/* if ($search_sale && $search_sale != '-1') { if ($search_sale == -2) { $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)"; @@ -685,7 +686,7 @@ if ($search_sale && $search_sale != '-1') { $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; } } - +*/ // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks