From 42d3d431a18e88b7d0f6ccd39e987d156a0656a3 Mon Sep 17 00:00:00 2001 From: Faustin Date: Sat, 15 Oct 2022 22:42:15 +0200 Subject: [PATCH 01/71] NEW #25594: can chose if VAT ID is unique or not for third parties --- htdocs/societe/admin/societe.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 76fd9297e2b..d466f1fe9a7 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -181,6 +181,20 @@ if ($action == "setaccountancycodecustomerinvoicemandatory") { } } +//Activate Set vat id unique +if ($action == "setvatintraunique") { + $setvatintraunique = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "SOCIETE_VAT_INTRA_UNIQUE", $setvatintraunique, 'yesno', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + //Activate Set ref in list if ($action == "setaddrefinlist") { $setaddrefinlist = GETPOST('value', 'int'); @@ -731,6 +745,22 @@ if (isModEnabled('accounting')) { print "\n"; } +// VAT ID +print ''; +print ''.$langs->trans('VATIntra')."\n"; + +if (!empty($conf->global->SOCIETE_VAT_INTRA_UNIQUE)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; +} +print ''; +print "\n"; + print "\n"; print ''; From e18e88a83144b451571bd0bd042e226a8c0e2fb2 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sun, 16 Oct 2022 00:40:23 +0200 Subject: [PATCH 02/71] advanced permission to read price stock card --- htdocs/product/stock/product.php | 79 ++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 25 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index faaf7e346fa..c53454f0fc3 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -117,6 +117,12 @@ $error = 0; $usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); $usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); +$usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire'); + +if ($object->isService()) { + $label = $langs->trans('Service'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); +} if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { @@ -643,6 +649,11 @@ if ($id > 0 || $ref) { $textdesc = $langs->trans("CostPriceDescription"); $textdesc .= "
".$langs->trans("CostPriceUsage"); $text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', ''); + $costprice = $object->cost_price; + if (!$usercancreadprice) { + $costprice = ''; + } + print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); print ''; print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); @@ -653,7 +664,7 @@ if ($id > 0 || $ref) { print $form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")); print ''; print ''; - if ($object->pmp > 0) { + if ($object->pmp > 0 && $usercancreadprice) { print price($object->pmp).' '.$langs->trans("HT"); } print ''; @@ -664,7 +675,7 @@ if ($id > 0 || $ref) { print ''; $product_fourn = new ProductFournisseur($db); if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) { - if ($product_fourn->product_fourn_price_id > 0) { + if ($product_fourn->product_fourn_price_id > 0 && $usercancreadprice) { print $product_fourn->display_price_product_fournisseur(); } else { print $langs->trans("NotDefined"); @@ -675,19 +686,23 @@ if ($id > 0 || $ref) { if (empty($conf->global->PRODUIT_MULTIPRICES)) { // Price print ''.$langs->trans("SellingPrice").''; - if ($object->price_base_type == 'TTC') { - print price($object->price_ttc).' '.$langs->trans($object->price_base_type); - } else { - print price($object->price).' '.$langs->trans($object->price_base_type); + if ($usercancreadprice) { + if ($object->price_base_type == 'TTC') { + print price($object->price_ttc).' '.$langs->trans($object->price_base_type); + } else { + print price($object->price).' '.$langs->trans($object->price_base_type); + } } print ''; // Price minimum print ''.$langs->trans("MinPrice").''; - if ($object->price_base_type == 'TTC') { - print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); - } else { - print price($object->price_min).' '.$langs->trans($object->price_base_type); + if ($usercancreadprice) { + if ($object->price_base_type == 'TTC') { + print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); + } else { + print price($object->price_min).' '.$langs->trans($object->price_base_type); + } } print ''; } else { @@ -1043,7 +1058,11 @@ if (!$variants) { print ''.(price2num($object->pmp) ? price2num($object->pmp, 'MU') : '').''; // Value purchase - print ''.(price2num($object->pmp) ? price(price2num($object->pmp * $obj->reel, 'MT')) : '').''; + if ($usercancreadprice) { + print ''.(price2num($object->pmp) ? price(price2num($object->pmp * $obj->reel, 'MT')) : '').''; + } else { + print ''; + } // Sell price $minsellprice = null; $maxsellprice = null; @@ -1060,14 +1079,16 @@ if (!$variants) { } } print ''; - if ($minsellprice != $maxsellprice) { - print price(price2num($minsellprice, 'MU'), 1).' - '.price(price2num($maxsellprice, 'MU'), 1); - } else { - print price(price2num($minsellprice, 'MU'), 1); + if ($usercancreadprice) { + if ($minsellprice != $maxsellprice) { + print price(price2num($minsellprice, 'MU'), 1).' - '.price(price2num($maxsellprice, 'MU'), 1); + } else { + print price(price2num($minsellprice, 'MU'), 1); + } } print ''; print $form->textwithpicto('', $langs->trans("Variable")); - } else { + } elseif ($usercancreadprice) { print price(price2num($object->price, 'MU'), 1); } print ''; @@ -1076,15 +1097,19 @@ if (!$variants) { print ''; if (!empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; - if ($minsellprice != $maxsellprice) { - print price(price2num($minsellprice * $obj->reel, 'MT'), 1).' - '.price(price2num($maxsellprice * $obj->reel, 'MT'), 1); - } else { - print price(price2num($minsellprice * $obj->reel, 'MT'), 1); + if ($usercancreadprice) { + if ($minsellprice != $maxsellprice) { + print price(price2num($minsellprice * $obj->reel, 'MT'), 1).' - '.price(price2num($maxsellprice * $obj->reel, 'MT'), 1); + } else { + print price(price2num($minsellprice * $obj->reel, 'MT'), 1); + } } print ''; print $form->textwithpicto('', $langs->trans("Variable")); } else { - print price(price2num($object->price * $obj->reel, 'MT'), 1); + if ($usercancreadprice) { + print price(price2num($object->price * $obj->reel, 'MT'), 1); + } } print ''; print ''; @@ -1189,11 +1214,15 @@ if (!$variants) { print ''.$langs->trans("Total").':'; print ''.price2num($total, 'MS').''; print ''; - print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : ' '); // This value may have rounding errors + if ($usercancreadprice) { + print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : ' '); // This value may have rounding errors + } print ''; // Value purchase print ''; - print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : ' '; + if ($usercancreadprice) { + print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : ' '; + } print ''; print ''; if ($num) { @@ -1201,7 +1230,7 @@ if (!$variants) { print ''; if (!empty($conf->global->PRODUIT_MULTIPRICES)) { print $form->textwithpicto('', $langs->trans("Variable")); - } else { + } elseif ($usercancreadprice) { print price($totalvaluesell / $total, 1); } print ''; @@ -1212,7 +1241,7 @@ if (!$variants) { print ''; if ($num) { print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (empty($conf->global->PRODUIT_MULTIPRICES) && $usercancreadprice) { print price(price2num($totalvaluesell, 'MT'), 1); } else { print $form->textwithpicto('', $langs->trans("Variable")); From d0cff20bfddd36f35317de29213779e9d0508b60 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 17 Oct 2022 12:25:31 +0200 Subject: [PATCH 03/71] FIX - editfieldkey --- htdocs/product/stock/product.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index c53454f0fc3..551bfd5f9d0 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -649,15 +649,19 @@ if ($id > 0 || $ref) { $textdesc = $langs->trans("CostPriceDescription"); $textdesc .= "
".$langs->trans("CostPriceUsage"); $text = $form->textwithpicto($langs->trans("CostPrice"), $textdesc, 1, 'help', ''); - $costprice = $object->cost_price; if (!$usercancreadprice) { - $costprice = ''; + print $form->editfieldkey($text, 'cost_price', '', $object, 0, 'amount:6'); + print ''; + print $form->editfieldval($text, 'cost_price', '', $object, 0, 'amount:6'); + print ''; + } else { + print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); + print ''; + print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); + print ''; } - print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); - print ''; - print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); - print ''; + // AWP print ''; From 5492ea871f8b3532025a3b3c3cc92b71b58cd777 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 17 Oct 2022 23:40:32 +0200 Subject: [PATCH 04/71] FIX tr --- htdocs/product/stock/product.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 551bfd5f9d0..b0771bc39d9 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -653,13 +653,12 @@ if ($id > 0 || $ref) { print $form->editfieldkey($text, 'cost_price', '', $object, 0, 'amount:6'); print ''; print $form->editfieldval($text, 'cost_price', '', $object, 0, 'amount:6'); - print ''; } else { print $form->editfieldkey($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); print ''; print $form->editfieldval($text, 'cost_price', $object->cost_price, $object, $usercancreate, 'amount:6'); - print ''; } + print ''; From 2ed2f74c8aca18745bf19e9ea6d7a3b013096dd4 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 15:35:27 +0200 Subject: [PATCH 05/71] FIX - /td in if to MAIN_CHECKBOX_LEFT_COLUMN --- htdocs/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 455420ce90a..7bb730b93c2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2565,8 +2565,8 @@ if ($resql) { } print ''; } + print ''; } - print ''; if (!$i) { $totalarray['nbfield']++; } From 12db216f1e0dd6e0e2629145b0763a480a270b7a Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 16:05:10 +0200 Subject: [PATCH 06/71] FIX - $totalarray['nbfield']++; --- htdocs/commande/list.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 7bb730b93c2..1e26bd2ed9e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1950,6 +1950,10 @@ if ($resql) { } print ''; } + if (!$i) { + $totalarray['nbfield']++; + } + print ''; } // Ref @@ -2566,9 +2570,9 @@ if ($resql) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; From 04cba0307d6028922d489f27bcb41855fed29374 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 19:15:55 +0200 Subject: [PATCH 07/71] Propal list and third --- htdocs/comm/propal/list.php | 10 +++++++--- htdocs/societe/list.php | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0d560d741ce..c7f901c2c25 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1661,6 +1661,9 @@ if ($resql) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['p.ref']['checked'])) { @@ -2205,10 +2208,11 @@ if ($resql) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - if (!$i) { - $totalarray['nbfield']++; - } + print ''."\n"; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f32317163ad..675a86410a5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1478,6 +1478,9 @@ while ($i < min($num, $limit)) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['s.rowid']['checked'])) { print ''; @@ -1795,9 +1798,9 @@ while ($i < min($num, $limit)) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; From 3a97588d810998ad6a6f14cea0e8c01dea4b0a3c Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Wed, 26 Oct 2022 19:22:36 +0200 Subject: [PATCH 08/71] product list --- htdocs/product/list.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 26f6a3a410c..74b066490e3 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1381,6 +1381,9 @@ if ($resql) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref if (!empty($arrayfields['p.rowid']['checked'])) { @@ -1944,9 +1947,9 @@ if ($resql) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; From 2f60b5f847b16650c5206a7c59af459f6899b34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Oct 2022 10:29:18 +0200 Subject: [PATCH 09/71] add ceil in evalmath --- htdocs/core/class/evalmath.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 5c659344465..f2dfb80960e 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -113,7 +113,8 @@ class EvalMath // constants public $fb = array( // built-in functions - 'sin', 'sinh', 'arcsin', 'asin', 'arcsinh', 'asinh', 'cos', 'cosh', 'arccos', 'acos', 'arccosh', 'acosh', 'tan', 'tanh', 'arctan', 'atan', 'arctanh', 'atanh', 'sqrt', 'abs', 'ln', 'log', 'intval'); + 'sin', 'sinh', 'arcsin', 'asin', 'arcsinh', 'asinh', 'cos', 'cosh', 'arccos', 'acos', 'arccosh', 'acosh', 'tan', 'tanh', 'arctan', 'atan', 'arctanh', 'atanh', 'sqrt', 'abs', 'ln', 'log', 'intval', 'ceil', + ); /** * Constructor From 02942e844e5e94b4289caf96c29397244e7683a8 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 27 Oct 2022 15:26:40 +0200 Subject: [PATCH 10/71] Fix propal page reload : use thirdparty values --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c737ea63ebe..64f58e4d705 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1635,13 +1635,13 @@ if ($action == 'create') { // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); - $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements((GETPOST('cond_reglement_id', 'int') > 0 ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print ''; // Mode of payment print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank').' '; - $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements((GETPOST('mode_reglement_id', 'int') > 0 ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account From f45f3740e2aa1517938bb62bb4e472ff45dfaf23 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 28 Oct 2022 08:10:39 +0200 Subject: [PATCH 11/71] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../accountancy/class/accountancyexport.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index ec24af642fd..db58cb2ccbc 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,9 +657,12 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta + * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) * + * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * * @param array $TData data + * * @return void */ public function exportWinfic(&$TData) @@ -679,7 +682,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(self::trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -688,11 +691,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(self::trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -704,9 +707,9 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); - $Tab['lettrage'] = str_repeat(' ', 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); $Tab['code_piece'] = str_repeat(' ', 5); From b3c7d64cb2b184c245f682851ad4035e4b249f4d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 28 Oct 2022 10:40:43 +0200 Subject: [PATCH 12/71] NEW: Allow download link in module configuration (propal,invoice,supplier proposal, order) --- htdocs/admin/commande.php | 44 ++++++++++++++++++++++-- htdocs/admin/contract.php | 45 ++++++++++++++++++------- htdocs/admin/facture.php | 54 ++++++++++++++++++++++-------- htdocs/admin/propal.php | 9 +++++ htdocs/admin/supplier_proposal.php | 48 +++++++++++++++++++++----- htdocs/langs/en_US/contracts.lang | 1 - htdocs/langs/es_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/langs/fr_FR/contracts.lang | 1 - 9 files changed, 165 insertions(+), 39 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index e9ad4a5c53b..34a5e281fac 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -182,7 +182,39 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') { +} elseif (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $value = (GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} +/*elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') { // Activate ask for payment bank $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity); @@ -208,7 +240,8 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} +} */ + /* @@ -636,6 +669,13 @@ print ''; print ''; print "\n"; + +// Allow external download +print ''; +print ''.$langs->trans("AllowExternalDownload").''; +print ''; +print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); +print ''; print ''; /* diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index eb6ff17e411..55271091db1 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -55,6 +55,8 @@ if (empty($conf->global->CONTRACT_ADDON)) { include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +$error=0; + if ($action == 'updateMask') { $maskconst = GETPOST('maskconstcontract', 'alpha'); $maskvalue = GETPOST('maskcontract', 'alpha'); @@ -158,10 +160,37 @@ if ($action == 'updateMask') { if (!dolibarr_set_const($db, "CONTRACT_ALLOW_ONLINESIGN", $value, 0, 'int', $conf->entity)) { $error++; } -} elseif ($action == "allowexternaldownload") { - if (!dolibarr_set_const($db, "CONTRACT_ALLOW_EXTERNAL_DOWNLOAD", $value, 0, 'int', $conf->entity)) { +} elseif (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $value = (GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { $error++; } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } } @@ -504,16 +533,8 @@ print ''; // Allow external download print ''; print ''.$langs->trans("AllowExternalDownload").''; -print ''; -if ($conf->global->CONTRACT_ALLOW_EXTERNAL_DOWNLOAD) { - print ''; - print img_picto($langs->trans("Activited"), 'switch_on'); - print ''; -} else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; -} +print ''; +print ajax_constantonoff('CONTRACT_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); print ''; print ''; print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index cdb7794c4d2..d2e1ec4ea25 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -232,6 +232,37 @@ if ($action == 'updateMask') { if (!($res > 0)) { $error++; } +} elseif (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $value = (GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } } @@ -771,20 +802,15 @@ print ''; print ''.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ; print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . ''; -print ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE'); -} else { - print '
'; - print ''; - print ''; - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE); - print ''; - print ''; - print ''; - print '
'; -} +print ''; +print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE'); +print ''; + +// Allow external download +print ''; +print ''.$langs->trans("AllowExternalDownload").''; +print ''; +print ajax_constantonoff('INVOICE_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); print ''; print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index c24446fb1bd..7883cc7da20 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -625,6 +625,15 @@ print ''; +print ''.$langs->trans("AllowExternalDownload").''; +print ''; +print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); +print ''; + + + // default update prices on cloning a proposal /* print '
'; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index fa3702d36b7..993e19fc796 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -178,6 +178,37 @@ if ($action == 'set') { // par appel methode canBeActivated dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON", $value, 'chaine', 0, '', $conf->entity); +} elseif (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $value = (GETPOST($code) ? GETPOST($code) : 1); + + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } +} elseif (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + $res = dolibarr_del_const($db, $code, $conf->entity); + + if (!($res > 0)) { + $error++; + } + + if ($error) { + setEventMessages($langs->trans('Error'), null, 'errors'); + } else { + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); + header("Location: " . $_SERVER["PHP_SELF"]); + exit(); + } } @@ -502,21 +533,20 @@ print '
'; if (isModEnabled('banque')) { print ''; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); - } else { - if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; - } else { - print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; - } - } + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); print ''; } else { print ''; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '.$langs->trans('NotAvailable').''; } +// Allow external download +print ''; +print ''.$langs->trans("AllowExternalDownload").' '; +print ''; +print ajax_constantonoff('PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); +print ''; + print ''; diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index f0db53f3ddd..a485f97a553 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -102,7 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Follow-up customer contact TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact HideClosedServiceByDefault=Hide closed services by default AllowOnlineSign=Allow online signing -AllowExternalDownload=Allow external download ShowClosedServices=Show Closed Services HideClosedServices=Hide Closed Services UserStartingService=User starting service diff --git a/htdocs/langs/es_US/admin.lang b/htdocs/langs/es_US/admin.lang index c5ab56cb8d8..f59ee2569c5 100644 --- a/htdocs/langs/es_US/admin.lang +++ b/htdocs/langs/es_US/admin.lang @@ -3,3 +3,4 @@ OperationParamDesc=Define the rules to use to extract or set values.
Example EmailCollectorLoadThirdPartyHelp=You can use this action to use the email content to find and load an existing thirdparty in your database. The found (or created) thirdparty will be used for following actions that need it.
For example, if you want to create a thirdparty with a name extracted from a string 'Name: name to find' present into the body, use the sender email as email, you can set the parameter field like this:
'email=HEADER:^From:(.*);name=EXTRACT:BODY:Name:\\s([^\\s]*);client=SET:2;'
IfYouUseASecondTaxYouMustSetYouUseTheMainTax=If you want to use a second tax, you must enable also the first sale tax IfYouUseAThirdTaxYouMustSetYouUseTheMainTax=If you want to use a third tax, you must enable also the first sale tax +AllowExternalDownload=Allow external download diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 3f45fc1643d..8ba3c5802ca 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2329,3 +2329,4 @@ HelpCssOnViewDesc=Le CSS utilisé lors de l'affichage du champ. HelpCssOnListDesc=Le CSS utilisé lorsque le champ est à l'intérieur du tableau d'une liste.
Exemple : "tdoverflowmax200" RECEPTION_PDF_HIDE_ORDERED=Masquer la quantité commandée sur les documents générés pour les réceptions MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Afficher le prix sur les documents générés pour les réceptions +AllowExternalDownload=Autoriser le téléchargement externe diff --git a/htdocs/langs/fr_FR/contracts.lang b/htdocs/langs/fr_FR/contracts.lang index 3c3d5620d1a..7d6bfc6f2e0 100644 --- a/htdocs/langs/fr_FR/contracts.lang +++ b/htdocs/langs/fr_FR/contracts.lang @@ -102,7 +102,6 @@ TypeContact_contrat_external_CUSTOMER=Contact client suivi contrat TypeContact_contrat_external_SALESREPSIGN=Contact client signataire contrat HideClosedServiceByDefault=Masquer les services fermés par défaut AllowOnlineSign=Autoriser la signature en ligne -AllowExternalDownload=Autoriser le téléchargement externe ShowClosedServices=Afficher les services fermés HideClosedServices=Masquer les services fermés UserStartingService=Utilisateur démarrant le service From db1de27be669f1d64fccbabf8851a110dc0597f7 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Fri, 28 Oct 2022 12:36:48 +0200 Subject: [PATCH 13/71] Header Scroll index.php --- htdocs/takepos/index.php | 69 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8be5a97e465..05e910790fc 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -939,6 +939,65 @@ $( document ).ready(function() { } } ?> + + /* For Header Scroll */ + var elem1 = $("#topnav-left")[0]; + var elem2 = $("#topnav-right")[0]; + var checkOverflow = function() { + if (scrollBars().horizontal) $("#topnav").addClass("overflow"); + else $("#topnav").removeClass("overflow"); + } + + var scrollBars = function(){ + var container= $('#topnav')[0]; + return { + vertical:container.scrollHeight > container.clientHeight, + horizontal:container.scrollWidth > container.clientWidth + }; + } + + $(window).resize(function(){ + checkOverflow(); + }); + + let resizeObserver = new ResizeObserver(() => { + checkOverflow(); + }); + resizeObserver.observe(elem1); + resizeObserver.observe(elem2); + checkOverflow(); + + var pressTimer = []; + var direction = 1; + var step = 200; + + $(".indicator").mousedown(function(){ + direction = $(this).hasClass("left") ? -1 : 1; + scrollTo(); + pressTimer.push(setInterval(scrollTo, 100)); + }); + + $(".indicator").mouseup(function(){ + pressTimer.forEach(clearInterval); + }); + + $("body").mouseup(function(){ + pressTimer.forEach(clearInterval); + console.log("body"); + }); + + function scrollTo(){ + console.log("here"); + var pos = $("#topnav").scrollLeft(); + document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' }) + } + + $("#topnav").scroll(function(){ + if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) { + console.log("end"); + } + }); + /* End Header Scroll */ }); @@ -951,8 +1010,8 @@ $keyCodeForEnter = getDolGlobalInt('CASHDESK_READER_KEYCODE_FOR_ENTER'.$_SESSION if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { ?>
-
-
+
+
-
+
+
+ + +
Date: Fri, 28 Oct 2022 12:37:35 +0200 Subject: [PATCH 14/71] CSS Header Scroll --- htdocs/takepos/css/pos.css.php | 103 +++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index f4a130dc5f1..c72ae215289 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -929,4 +929,107 @@ div#moreinfo, div#infowarehouse { div.wrapper2{ height:10%; } +} + +.arrows { + display: none; + position: absolute; + justify-content: space-between; + width: 100%; +} + +.indicator { + background: #00000042; + padding: 15px 5px; + cursor: pointer; +} + +.indicator:hover { + background: #000000; +} + +.indicator i { + color: white; +} + +.topnav-left { + margin-left: 20px; +} + +.topnav-right { + margin-right: 20px; +} + +/* For Header Scroll */ +html { + scroll-behavior: smooth; +} + +.topnav { + scroll-behavior: smooth; +} + +.header { + height: unset; +} + +.topnav { + width: 100%; + white-space: nowrap; + overflow-x: scroll; + display: inline-flex; +} + +.topnav-left { + white-space: nowrap; + float: none; + margin-right: auto; + align-items: center; +} + +.topnav-right { + display: flex; + white-space: nowrap; + float: none; + align-items: center; +} + +.topnav-left #shoppingcart { + display:inline-flex; +} + +.topnav-right .login_block_other { + display: flex; + white-space: nowrap; +} + +::-webkit-scrollbar { + width: 8px; +} + + +::-webkit-scrollbar-track { + background: #f1f1f1; +} + + +::-webkit-scrollbar-thumb { + background: #888; +} + +.topnav::-webkit-scrollbar-track{ + background: #eeeeee; +} + +.topnav::-webkit-scrollbar{ + width: 1px; + background: #F5F5F5; +} + +.topnav::-webkit-scrollbar-thumb{ + background: #f9171700; +} + +.topnav.overflow .arrows { + display: flex; } \ No newline at end of file From 764ddd4636a18ae86308fe7264669d60b5fea13a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 28 Oct 2022 10:44:04 +0000 Subject: [PATCH 15/71] Fixing style errors. --- htdocs/takepos/css/pos.css.php | 28 ++++++++++++++-------------- htdocs/takepos/index.php | 10 +++++----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index c72ae215289..d39b3fb0b37 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -933,9 +933,9 @@ div#moreinfo, div#infowarehouse { .arrows { display: none; - position: absolute; - justify-content: space-between; - width: 100%; + position: absolute; + justify-content: space-between; + width: 100%; } .indicator { @@ -970,28 +970,28 @@ html { } .header { - height: unset; + height: unset; } .topnav { width: 100%; - white-space: nowrap; - overflow-x: scroll; + white-space: nowrap; + overflow-x: scroll; display: inline-flex; } .topnav-left { - white-space: nowrap; - float: none; + white-space: nowrap; + float: none; margin-right: auto; - align-items: center; + align-items: center; } .topnav-right { - display: flex; - white-space: nowrap; - float: none; - align-items: center; + display: flex; + white-space: nowrap; + float: none; + align-items: center; } .topnav-left #shoppingcart { @@ -1000,7 +1000,7 @@ html { .topnav-right .login_block_other { display: flex; - white-space: nowrap; + white-space: nowrap; } ::-webkit-scrollbar { diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 05e910790fc..a128a0d66fd 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -960,11 +960,11 @@ $( document ).ready(function() { checkOverflow(); }); - let resizeObserver = new ResizeObserver(() => { - checkOverflow(); - }); - resizeObserver.observe(elem1); - resizeObserver.observe(elem2); + let resizeObserver = new ResizeObserver(() => { + checkOverflow(); + }); + resizeObserver.observe(elem1); + resizeObserver.observe(elem2); checkOverflow(); var pressTimer = []; From 95b3913910670ca42be28e7200ae8f7305e2a0df Mon Sep 17 00:00:00 2001 From: hector Date: Fri, 28 Oct 2022 13:52:22 +0200 Subject: [PATCH 16/71] Add hooks --- htdocs/comm/action/card.php | 9 +++++++++ htdocs/comm/action/document.php | 12 ++++++++++++ htdocs/comm/action/info.php | 12 ++++++++++++ htdocs/resource/element_resource.php | 12 ++++++++++++ 4 files changed, 45 insertions(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3aa6a16d3ef..271b6eb463c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2148,6 +2148,15 @@ if ($id > 0) { $linkback .= ''.$langs->trans("ViewPerUser").''; $linkback .= ''; + // Add more views from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); + if (empty($reshook)) { + $linkback .= $hookmanager->resPrint; + } elseif ($reshook > 1) { + $linkback = $hookmanager->resPrint; + } + //$linkback.=$out; $morehtmlref = '
'; diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index b02b2850346..82cc7584c07 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -63,6 +63,9 @@ if ($id > 0) { $object->fetch_thirdparty(); } +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('actioncard', 'globalcard')); + // Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -155,6 +158,15 @@ if ($object->id > 0) { $out .= '
  • '.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); $out .= ''.$langs->trans("ViewDay").''; + // Add more views from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); + if (empty($reshook)) { + $out .= $hookmanager->resPrint; + } elseif ($reshook > 1) { + $out = $hookmanager->resPrint; + } + $linkback .= $out; $morehtmlref = '
    '; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 749ca6a0c62..d4588223b26 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -39,6 +39,9 @@ $langs->load("commercial"); $id = GETPOST('id', 'int'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('actioncard', 'globalcard')); + // Security check if ($user->socid > 0) { $action = ''; @@ -83,6 +86,15 @@ $out .= ''.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); $out .= ''.$langs->trans("ViewDay").''; +// Add more views from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); +if (empty($reshook)) { + $out .= $hookmanager->resPrint; +} elseif ($reshook > 1) { + $out = $hookmanager->resPrint; +} + $linkback .= $out; $morehtmlref = '
    '; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index c063e049f44..eedfcc06245 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -324,6 +324,9 @@ if (!$ret) { if (($element_id || $element_ref) && $element == 'action') { require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + $hookmanager->initHooks(array('actioncard', 'globalcard')); + $act = fetchObjectByElement($element_id, $element, $element_ref); if (is_object($act)) { $head = actions_prepare_head($act); @@ -344,6 +347,15 @@ if (!$ret) { $out .= '
  • '.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); $out .= ''.$langs->trans("ViewDay").''; + // Add more views from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); + if (empty($reshook)) { + $out .= $hookmanager->resPrint; + } elseif ($reshook > 1) { + $out = $hookmanager->resPrint; + } + $linkback .= $out; $morehtmlref = '
    '; From bbebdbb840ff74e775f78639831d4bbbc759301d Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 28 Oct 2022 15:48:46 +0200 Subject: [PATCH 17/71] Fix php 8.1 warnings --- htdocs/bom/bom_card.php | 2 +- htdocs/core/actions_addupdatedelete.inc.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/project.lib.php | 12 +++++++----- htdocs/mrp/mo_card.php | 7 ++++--- htdocs/mrp/mo_movements.php | 3 ++- htdocs/product/class/html.formproduct.class.php | 1 + htdocs/product/index.php | 4 ++-- htdocs/product/list.php | 4 ++-- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/permonth.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- htdocs/projet/class/project.class.php | 2 +- .../class/recruitmentjobposition.class.php | 2 +- htdocs/recruitment/recruitmentcandidature_agenda.php | 3 ++- htdocs/recruitment/recruitmentcandidature_card.php | 4 ++-- htdocs/recruitment/recruitmentcandidature_list.php | 3 ++- htdocs/recruitment/recruitmentcandidature_note.php | 2 +- htdocs/recruitment/recruitmentjobposition_card.php | 7 ++++--- .../recruitment/recruitmentjobposition_document.php | 2 +- htdocs/recruitment/recruitmentjobposition_note.php | 4 ++-- 21 files changed, 40 insertions(+), 32 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 926797d1f07..89705c25ec5 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -704,7 +704,7 @@ if (empty($reshook)) { // Clone if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=bom', 'clone', $permissiontoadd); + print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd); } // Close / Cancel diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 6401437ac15..49f3b2fa302 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -435,7 +435,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) { $newlang = GETPOST('lang_id', 'aZ09'); } if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) { - $newlang = $object->thirdparty->default_lang; + $newlang = !empty($object->thirdparty->default_lang) ? $object->thirdparty->default_lang : ""; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0a1f5f16d6d..67cae4a652e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5060,7 +5060,7 @@ class Form $more .= $input['label'].'
    '; } if ($input['type'] == 'select') { - $more .= $this->selectarray($input['name'], $input['values'], $input['default'], $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); + $more .= $this->selectarray($input['name'], $input['values'], !empty($input['default']) ? $input['default'] : '-1', $show_empty, $key_in_label, $value_as_key, $moreattr, $translate, $maxlen, $disabled, $sort, $morecss); } else { $more .= $this->multiselectarray($input['name'], $input['values'], is_array($input['default']) ? $input['default'] : [$input['default']], $key_in_label, $value_as_key, $morecss, $translate, $maxlen, $moreattr); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d427f87189a..6028a8d4bea 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1610,7 +1610,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr // Duration print ''; - $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]; + $dayWorkLoad = !empty($projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$preselectedday][$lines[$i]->id] : 0; + if (!isset($totalforeachday[$preselectedday])) $totalforeachday[$preselectedday] = 0; $totalforeachday[$preselectedday] += $dayWorkLoad; $alreadyspent = ''; @@ -1990,7 +1991,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $modeinput = 'hours'; for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); - + if (!isset($totalforeachday[$tmpday])) $totalforeachday[$tmpday] = 0; $cssonholiday = ''; if (!$isavailable[$tmpday]['morning'] && !$isavailable[$tmpday]['afternoon']) { $cssonholiday .= 'onholidayallday '; @@ -2001,14 +2002,14 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } $tmparray = dol_getdate($tmpday); - $dayWorkLoad = $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]; + $dayWorkLoad = (!empty($projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id]) ? $projectstatic->weekWorkLoadPerTask[$tmpday][$lines[$i]->id] : 0); $totalforeachday[$tmpday] += $dayWorkLoad; $alreadyspent = ''; if ($dayWorkLoad > 0) { $alreadyspent = convertSecondToTime($dayWorkLoad, 'allhourmin'); } - $alttitle = $langs->trans("AddHereTimeSpentForDay", $tmparray['day'], $tmparray['mon']); + $alttitle = $langs->trans("AddHereTimeSpentForDay", !empty($tmparray['day']) ? $tmparray['day'] : 0, $tmparray['mon']); global $numstartworkingday, $numendworkingday; $cssweekend = ''; @@ -2288,7 +2289,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $year = $firstdaytoshowarray['year']; $month = $firstdaytoshowarray['mon']; foreach ($TWeek as $weekIndex => $weekNb) { - $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]; + $weekWorkLoad = !empty($projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]) ? $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id] : 0 ; + if (!isset($totalforeachweek[$weekNb])) $totalforeachweek[$weekNb] = 0; $totalforeachweek[$weekNb] += $weekWorkLoad; $alreadyspent = ''; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 4142693b172..32571252ebf 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -49,7 +49,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'moc $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $TBomLineId = GETPOST('bomlineid', 'array'); -//$lineid = GETPOST('lineid', 'int'); +$lineid = GETPOST('lineid', 'int'); +$socid = GETPOST("socid", 'int'); // Initialize technical objects $object = new Mo($db); @@ -678,7 +679,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=mo', 'clone', $permissiontoadd); + print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=mo', 'clone', $permissiontoadd); } // Cancel - Reopen @@ -725,7 +726,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $filedir = $conf->mrp->dir_output.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card + $delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); // Show links to link elements diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 761a17f016d..2f3ed1f2d2b 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -47,7 +47,8 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mostockmovement'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +$massaction = GETPOST('massaction', 'aZ09'); +$lineid = GETPOST('lineid', 'int'); $msid = GETPOST('msid', 'int'); $year = GETPOST("year", 'int'); diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index a21ff6348e6..75a929f53e5 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -403,6 +403,7 @@ class FormProduct dol_syslog(get_class($this)."::selectWorkstations $selected, $htmlname, $empty, $disabled, $fk_product, $empty_label, $forcecombo, $morecss", LOG_DEBUG); + $filterstatus=''; $out = ''; if (!empty($fk_product) && $fk_product > 0) { $this->cache_workstations = array(); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 845c2e1012d..c2704111094 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -126,7 +126,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This may be /* * Number of products and/or services */ -if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->produit->lire || $user->rights->service->lire)) { +if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) { $prodser = array(); $prodser[0][0] = $prodser[0][1] = $prodser[0][2] = $prodser[0][3] = 0; $prodser[0]['sell'] = 0; @@ -284,7 +284,7 @@ print '
    '; /* * Latest modified products */ -if ((isModEnabled("product") || isModEnabled("service")) && ($user->rights->produit->lire || $user->rights->service->lire)) { +if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) { $max = 15; $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,"; $sql .= " p.entity,"; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 26f6a3a410c..50aa776eceb 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1909,7 +1909,7 @@ if ($resql) { // Status (to sell) if (!empty($arrayfields['p.tosell']['checked'])) { print ''; - if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { print $product_static->LibStatut($obj->tosell, 5, 0); @@ -1922,7 +1922,7 @@ if ($resql) { // Status (to buy) if (!empty($arrayfields['p.tobuy']['checked'])) { print ''; - if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + if (!empty($conf->use_javascript_ajax) && $user->hasRight("produit", "creer") && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { print $product_static->LibStatut($obj->tobuy, 5, 1); diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 0854dceee67..018aeb85965 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -709,7 +709,7 @@ if (count($tasksarray) > 0) { // Calculate total for all tasks $listofdistinctprojectid = array(); // List of all distinct projects - if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { + if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { foreach ($tasksarraywithoutfilter as $tmptask) { $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project; } diff --git a/htdocs/projet/activity/permonth.php b/htdocs/projet/activity/permonth.php index 380b4891376..273affc3563 100644 --- a/htdocs/projet/activity/permonth.php +++ b/htdocs/projet/activity/permonth.php @@ -524,7 +524,7 @@ if (count($tasksarray) > 0) { // Calculate total for all tasks $listofdistinctprojectid = array(); // List of all distinct projects - if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { + if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { foreach ($tasksarraywithoutfilter as $tmptask) { $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project; } diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index e7bc897db5a..7177f35e71c 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -747,7 +747,7 @@ if (count($tasksarray) > 0) { // Calculate total for all tasks $listofdistinctprojectid = array(); // List of all distinct projects - if (is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { + if (!empty($tasksarraywithoutfilter) && is_array($tasksarraywithoutfilter) && count($tasksarraywithoutfilter)) { foreach ($tasksarraywithoutfilter as $tmptask) { $listofdistinctprojectid[$tmptask->fk_project] = $tmptask->fk_project; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c5dcf0d4bb4..81f767d2d7d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2046,7 +2046,7 @@ class Project extends CommonObject $sql .= " AND pt.fk_projet = ".((int) $this->id); $sql .= " AND (ptt.task_date >= '".$this->db->idate($datestart)."' "; $sql .= " AND ptt.task_date <= '".$this->db->idate(dol_time_plus_duree($datestart, 1, 'm') - 1)."')"; - if ($task_id) { + if ($taskid) { $sql .= " AND ptt.fk_task=".((int) $taskid); } if (is_numeric($userid)) { diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index d5c109a5516..dda796c243e 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -254,7 +254,7 @@ class RecruitmentJobPosition extends CommonObject // Reset some properties unset($object->id); unset($object->fk_user_creat); - unset($object->import_key); + $object->import_key = null; // Clear fields if (property_exists($object, 'ref')) { diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 9988140393d..01d3e8a27c2 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); +$socid = GETPOST('socid', 'int'); if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->recruitment->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->recruitment->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } $permissiontoadd = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 4226e016e73..2452c9e530b 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -43,7 +43,7 @@ $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'recruitmentcandidaturecard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +$lineid = GETPOST('lineid', 'int'); // Initialize technical objects $object = new RecruitmentCandidature($db); @@ -565,7 +565,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentcandidature', 'clone', $permissiontoadd); + print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&object=recruitmentcandidature', 'clone', $permissiontoadd); } // Button to convert into a user diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 0489d68bffb..9b860ac54d5 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -47,6 +47,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : ((e $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'aZ'); +$lineid = GETPOST('lineid', 'int'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -437,7 +438,7 @@ if ($jobposition->id > 0 && (empty($action) || ($action != 'edit' && $action != $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index 543d7a66c10..1649ab5ee5e 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -48,7 +48,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->recruitment->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->recruitment->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } $permissionnote = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_setnotes.inc.php diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index 88424f1b06d..be1b9eec084 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -42,7 +42,7 @@ $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'recruitmentjobpositioncard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +$lineid = GETPOST('lineid', 'int'); // Initialize technical objects $object = new RecruitmentJobPosition($db); @@ -279,6 +279,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } if ($action == 'closeas') { + $text = ""; //Form to close proposal (signed or not) $formquestion = array( array('type' => 'select', 'name' => 'status', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array(3=>$object->LibStatut($object::STATUS_RECRUITED), 9=>$object->LibStatut($object::STATUS_CANCELED))), @@ -340,7 +341,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { @@ -435,7 +436,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=recruitmentjobposition', 'clone', $permissiontoadd); + print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=recruitmentjobposition', 'clone', $permissiontoadd); } /* diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index ca9907976be..a162f4c3af7 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -148,7 +148,7 @@ if ($object->id) { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/recruitment/recruitmentjobposition_note.php b/htdocs/recruitment/recruitmentjobposition_note.php index dcda5b53109..5dc4004a361 100644 --- a/htdocs/recruitment/recruitmentjobposition_note.php +++ b/htdocs/recruitment/recruitmentjobposition_note.php @@ -53,7 +53,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->recruitment->multidir_output[$object->entity]."/".$object->id; + $upload_dir = $conf->recruitment->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; } $permissionnote = $user->rights->recruitment->recruitmentjobposition->write; // Used by the include of actions_setnotes.inc.php @@ -125,7 +125,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, !empty($object->socid) ? $object->socid : 0, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { From ba20087ceb95ff35294b5220378fbfef0c03362b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 15:52:59 +0200 Subject: [PATCH 18/71] FIX better compatibility for translation of label in setup API --- htdocs/api/class/api_setup.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..41715cff0ba 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -612,10 +612,11 @@ class Setup extends DolibarrApi * @param object $object Object with label to translate * @param string $lang Code of the language the name of the object must be translated to * @param string $prefix Prefix for translation key + * @param string $dict Dictionnary for translation * * @return void */ - private function translateLabel($object, $lang, $prefix = 'Country') + private function translateLabel($object, $lang, $prefix = 'Country', $dict = 'dict') { if (!empty($lang)) { // Load the translations if this is a new language. @@ -623,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->load('dict'); + $this->translations->load($dict); } if ($object->code) { $key = $prefix.$object->code; @@ -636,7 +637,6 @@ class Setup extends DolibarrApi } } - /** * Get the list of events types. * From b0c6b59eb2cad3b1b31aecefb6de278fa40a0ae1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 15:56:15 +0200 Subject: [PATCH 19/71] NEW translate setup/ticket API link to https://github.com/Dolibarr/dolibarr/pull/22699 & fix for multicompany --- htdocs/api/class/api_setup.class.php | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..7c43b751082 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1496,6 +1496,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the severity must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of ticket categories * @@ -1503,13 +1504,14 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { $list = array(); $sql = "SELECT rowid, code, pos, label, use_default, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t"; - $sql .= " WHERE t.active = ".((int) $active); + $sql .= " WHERE t.entity IN (".getEntity('c_ticket_category').")"; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { $errormessage = ''; @@ -1538,7 +1540,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $category = $this->db->fetch_object($result); + $this->translateLabel($category, $lang, 'TicketCategoryShort', 'ticket'); + $list[] = $category; } } else { throw new RestException(503, 'Error when retrieving list of ticket categories : '.$this->db->lasterror()); @@ -1555,6 +1559,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the severity must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of ticket severities * @@ -1562,13 +1567,14 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { $list = array(); $sql = "SELECT rowid, code, pos, label, use_default, color, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t"; - $sql .= " WHERE t.active = ".((int) $active); + $sql .= " WHERE t.entity IN (".getEntity('c_ticket_severity').")"; + $sql .= " AND t.active = ".((int) $active); // Add sql filters if ($sqlfilters) { $errormessage = ''; @@ -1597,7 +1603,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $severity = $this->db->fetch_object($result); + $this->translateLabel($severity, $lang, 'TicketSeverityShort', 'ticket'); + $list[] = $severity; } } else { throw new RestException(503, 'Error when retrieving list of ticket severities : '.$this->db->lasterror()); @@ -1614,6 +1622,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the severity must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of ticket types * @@ -1621,15 +1630,15 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { $list = array(); $sql = "SELECT rowid, code, pos, label, use_default, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t"; - $sql .= " WHERE t.active = ".(int) $active; - // if ($type) $sql .= " AND t.type LIKE '%".$this->db->escape($type)."%'"; - // if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'"; + $sql .= " WHERE t.entity IN (".getEntity('c_ticket_type').")"; + $sql .= " AND t.active = ".((int) $active); + // Add sql filters if ($sqlfilters) { $errormessage = ''; @@ -1658,7 +1667,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $type =$this->db->fetch_object($result); + $this->translateLabel($type, $lang, 'TicketTypeShort', 'ticket'); + $list[] = $type; } } else { throw new RestException(503, 'Error when retrieving list of ticket types : '.$this->db->lasterror()); From 8d604e3b2d4fe8416b761d7ed63c0c473a17b29f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 16:16:11 +0200 Subject: [PATCH 20/71] NEW support lang in Civilities API --- htdocs/api/class/api_setup.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..342eedf483d 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -845,6 +845,7 @@ class Setup extends DolibarrApi * @param int $page Page number (starting from zero) * @param string $module To filter on module events * @param int $active Civility is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the civility must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of civility types * @@ -852,7 +853,7 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '') + public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $lang = '', $sqlfilters = '') { $list = array(); @@ -890,7 +891,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $civility = $this->db->fetch_object($result); + $this->translateLabel($civility, $lang, 'Civility', 'dict'); + $list[] = $civility; } } else { throw new RestException(503, 'Error when retrieving list of civility : '.$this->db->lasterror()); From 81bec045865eeac4f549298e581e6f31f970d0f1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 16:17:14 +0200 Subject: [PATCH 21/71] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 7c43b751082..28c693ed87c 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1496,7 +1496,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param int $active Payment term is active or not {@min 0} {@max 1} - * @param string $lang Code of the language the label of the severity must be translated to + * @param string $lang Code of the language the label of the category must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of ticket categories * @@ -1622,7 +1622,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number (starting from zero) * @param int $active Payment term is active or not {@min 0} {@max 1} - * @param string $lang Code of the language the label of the severity must be translated to + * @param string $lang Code of the language the label of the type must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of ticket types * From c4543eff73244ee05c7d5e502c24a6fac956acc6 Mon Sep 17 00:00:00 2001 From: kkhelifa Date: Fri, 28 Oct 2022 16:31:01 +0200 Subject: [PATCH 22/71] FIX: Fix the request SQL for transversal user, the join on usergroup table must be with getEntity('usergroup') and not other element --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/user/class/user.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a3a72d4894a..27b00377411 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2072,7 +2072,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; @@ -2142,7 +2142,7 @@ abstract class CommonObject $sql .= " AND te.entity IS NOT NULL"; // Show all users } else { $sql .= " AND ug.fk_user = te.rowid"; - $sql .= " AND ug.entity IN (".getEntity($this->element).")"; + $sql .= " AND ug.entity IN (".getEntity('usergroup').")"; } } else { $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 04eebd6b6c9..1543d579839 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3490,7 +3490,7 @@ class User extends CommonObject } else { $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE ((ug.fk_user = t.rowid"; - $sql .= " AND ug.entity IN (".getEntity('user')."))"; + $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; $sql .= " OR t.entity = 0)"; // Show always superadmin } } else { From 72870ec95c224f27ffce9bddc60750ef69502fb8 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 28 Oct 2022 16:35:11 +0200 Subject: [PATCH 23/71] Fix : wrong backtopage in recruitmentcandidature_agenda.php --- htdocs/recruitment/recruitmentcandidature_agenda.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 9988140393d..56cc1abb24c 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -209,7 +209,8 @@ if ($object->id > 0) { if (get_class($objthirdparty) == 'Societe') { $out .= '&socid='.$objthirdparty->id; } - $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage=1&percentage=-1'; + $backtopageurl = urlencode($_SERVER['PHP_SELF'].'?id='.$objthirdparty->id); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : '').'&backtopage='.$backtopageurl.'&percentage=-1'; //$out.=$langs->trans("AddAnAction").' '; //$out.=img_picto($langs->trans("AddAnAction"),'filenew'); //$out.=""; From eb54ae1d22eae1e22814dfad87ddbca76c7bb147 Mon Sep 17 00:00:00 2001 From: Faustin Date: Fri, 28 Oct 2022 17:41:09 +0200 Subject: [PATCH 24/71] Added checking when thirdparty is created/updated --- htdocs/societe/class/societe.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c01f83401cf..d0012e78e3a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1171,7 +1171,7 @@ class Societe extends CommonObject } // Check for duplicate or mandatory fields defined into setup - $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); + $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA'); foreach ($array_to_check as $key) { $keymin = strtolower($key); $i = (int) preg_replace('/[^0-9]/', '', $key); @@ -1216,6 +1216,14 @@ class Societe extends CommonObject $error++; $this->errors[] = $langs->trans('Email')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; } } + } elseif ($key == 'TVA_INTRA') { + // Check for unicity + if ($vallabel && !empty($conf->global->SOCIETE_VAT_INTRA_UNIQUE)) { + if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { + $langs->load("errors"); + $error++; $this->errors[] = $langs->trans('VATIntra')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; + } + } } } } From 65cbd2c663f48b9646b3551a0e61482608c58e61 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 17:59:34 +0200 Subject: [PATCH 25/71] Update api_setup.class.php some values needs more dictionaries --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 41715cff0ba..345a8e60799 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -624,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->load($dict); + $this->translations->loadLangs(array($dict)); } if ($object->code) { $key = $prefix.$object->code; From e450b950d14819077cd422b223b913f06731f7ad Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 21:24:30 +0200 Subject: [PATCH 26/71] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 345a8e60799..c35c75cd154 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -616,7 +616,7 @@ class Setup extends DolibarrApi * * @return void */ - private function translateLabel($object, $lang, $prefix = 'Country', $dict = 'dict') + private function translateLabel($object, $lang, $prefix = 'Country', $dict = array('dict')) { if (!empty($lang)) { // Load the translations if this is a new language. @@ -624,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->loadLangs(array($dict)); + $this->translations->loadLangs($dict); } if ($object->code) { $key = $prefix.$object->code; From 0277c07c31fc9d44d634d9ac1025b4f1571f099d Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 21:25:42 +0200 Subject: [PATCH 27/71] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 342eedf483d..a604aa46432 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -892,7 +892,7 @@ class Setup extends DolibarrApi $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { $civility = $this->db->fetch_object($result); - $this->translateLabel($civility, $lang, 'Civility', 'dict'); + $this->translateLabel($civility, $lang, 'Civility', array('dict')); $list[] = $civility; } } else { From 6dd07121937293c8d362ad20a164a588ec691ab0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 21:26:45 +0200 Subject: [PATCH 28/71] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 28c693ed87c..ef1d7e4c512 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1541,7 +1541,7 @@ class Setup extends DolibarrApi $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { $category = $this->db->fetch_object($result); - $this->translateLabel($category, $lang, 'TicketCategoryShort', 'ticket'); + $this->translateLabel($category, $lang, 'TicketCategoryShort', array('ticket')); $list[] = $category; } } else { @@ -1604,7 +1604,7 @@ class Setup extends DolibarrApi $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { $severity = $this->db->fetch_object($result); - $this->translateLabel($severity, $lang, 'TicketSeverityShort', 'ticket'); + $this->translateLabel($severity, $lang, 'TicketSeverityShort', array('ticket')); $list[] = $severity; } } else { @@ -1668,7 +1668,7 @@ class Setup extends DolibarrApi $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { $type =$this->db->fetch_object($result); - $this->translateLabel($type, $lang, 'TicketTypeShort', 'ticket'); + $this->translateLabel($type, $lang, 'TicketTypeShort', array('ticket')); $list[] = $type; } } else { From 27ee846562edb0a3c029257e34db8ae2993efde3 Mon Sep 17 00:00:00 2001 From: Lenin Rivas <53640168+leninrivas@users.noreply.github.com> Date: Fri, 28 Oct 2022 16:14:50 -0500 Subject: [PATCH 29/71] New constant warhouse internal not sell To no show stock of products in internal warehouse --- htdocs/core/tpl/objectline_create.tpl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 381683cf62c..1bfc9587b89 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -258,9 +258,11 @@ if ($nolinesbefore) { } if (empty($senderissupplier)) { $statustoshow = 1; + $statuswarehouse = 'warehouseopen,warehouseinternal'; + if (!empty($conf->global->ENTREPOT_WAREHOUSEINTERNAL_NOT_SELL)) $statuswarehouse = 'warehouseopen'; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, $statuswarehouse, GETPOST('combinations', 'array')); } else { $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } From bc4b9c4b18ab9eddc5b365e3a102f818035e0ca5 Mon Sep 17 00:00:00 2001 From: Faustin Date: Sat, 29 Oct 2022 09:39:12 +0200 Subject: [PATCH 30/71] NEW #22622: all partneships displayed on tab partnership of thirdparty and member --- htdocs/core/lib/company.lib.php | 20 +- htdocs/core/lib/member.lib.php | 20 +- htdocs/langs/en_US/partnership.lang | 5 +- htdocs/langs/fr_FR/partnership.lang | 1 + htdocs/partnership/partnership_list.php | 149 ++++++++++++- htdocs/societe/partnership.php | 274 ------------------------ 6 files changed, 180 insertions(+), 289 deletions(-) delete mode 100644 htdocs/societe/partnership.php diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 70589dfb120..43264ac3d98 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -267,9 +267,23 @@ function societe_prepare_head(Societe $object) if (!empty($user->rights->partnership->read)) { $langs->load("partnership"); $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0; - $head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Partnership"); - $head[$h][2] = 'partnership'; + $head[$h][0] = DOL_URL_ROOT.'/partnership/partnership_list.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Partnerships"); + $nbNote = 0; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."partnership as n"; + $sql .= " WHERE fk_soc = ".((int) $object->id); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbNote = $obj->nb; + } else { + dol_print_error($db); + } + if ($nbNote > 0) { + $head[$h][1] .= ''.$nbNote.''; + } + $head[$h][2] = 'partnerships'; if ($nbPartnership > 0) { $head[$h][1] .= ''.$nbPartnership.''; } diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 6e0dcb3b83a..71a9849dc16 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -66,9 +66,23 @@ function member_prepare_head(Adherent $object) if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { if (!empty($user->rights->partnership->read)) { $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0; - $head[$h][0] = DOL_URL_ROOT.'/adherents/partnership.php?rowid='.$object->id; - $head[$h][1] = $langs->trans("Partnership"); - $head[$h][2] = 'partnership'; + $head[$h][0] = DOL_URL_ROOT.'/partnership/partnership_list.php?rowid='.$object->id; + $head[$h][1] = $langs->trans("Partnerships"); + $nbNote = 0; + $sql = "SELECT COUNT(n.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."partnership as n"; + $sql .= " WHERE fk_member = ".((int) $object->id); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbNote = $obj->nb; + } else { + dol_print_error($db); + } + if ($nbNote > 0) { + $head[$h][1] .= ''.$nbNote.''; + } + $head[$h][2] = 'partnerships'; if ($nbPartnership > 0) { $head[$h][1] .= ''.$nbPartnership.''; } diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 6490bf23d8b..89a1bfa742d 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -20,6 +20,7 @@ ModulePartnershipName=Partnership management PartnershipDescription=Module Partnership management PartnershipDescriptionLong= Module Partnership management Partnership=Partnership +Partnerships=Partnerships AddPartnership=Add partnership CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions PartnershipCheckBacklink=Partnership: Check referring backlink @@ -49,8 +50,8 @@ PublicFormRegistrationPartnerDesc=Dolibarr can provide you a public URL/website # Object # DeletePartnership=Delete a partnership -PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party -PartnershipDedicatedToThisMember=Partnership dedicated to this member +PartnershipDedicatedToThisThirdParty=Partnership dedicated to this third party +PartnershipDedicatedToThisMember=Partnership dedicated to this member DatePartnershipStart=Start date DatePartnershipEnd=End date ReasonDecline=Decline reason diff --git a/htdocs/langs/fr_FR/partnership.lang b/htdocs/langs/fr_FR/partnership.lang index 41849e2812e..20c3fc0d801 100644 --- a/htdocs/langs/fr_FR/partnership.lang +++ b/htdocs/langs/fr_FR/partnership.lang @@ -20,6 +20,7 @@ ModulePartnershipName=Gestion des partenariats PartnershipDescription=Module de gestion des partenariats PartnershipDescriptionLong= Module de gestion des partenariats Partnership=Partenariat +Partnerships=Partenariats AddPartnership=Ajouter un partenariat CancelPartnershipForExpiredMembers=Partenariat : annuler le partenariat des adhérents dont les cotisations ont expirés PartnershipCheckBacklink=Partenariat : Vérifiez le backlink référent diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 838969e745e..0aba38fd7e3 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -28,7 +28,9 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; // for other modules @@ -49,7 +51,8 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ' $mode = GETPOST('mode', 'aZ'); $id = GETPOST('id', 'int'); - +$socid = GETPOST('socid', 'int'); +$memberid = GETPOST('rowid', 'int'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -68,7 +71,13 @@ $object = new Partnership($db); $extrafields = new ExtraFields($db); $adherent = new Adherent($db); $diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('partnershiplist')); // Note that conf->hooks_modules contains array +if ($socid > 0) { + $hookmanager->initHooks(array('thirdpartypartnership')); +} elseif ($memberid > 0) { + $hookmanager->initHooks(array('memberpartnership')); +} else { + $hookmanager->initHooks(array('partnershiplist')); // Note that conf->hooks_modules contains array +} // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -144,7 +153,6 @@ $permissiontodelete = $user->rights->partnership->delete; if (empty($conf->partnership->enabled)) { accessforbidden('Module not enabled'); } -$socid = 0; if ($user->socid > 0) { // Protection if external user //$socid = $user->socid; accessforbidden(); @@ -325,9 +333,19 @@ if ($object->ismultientitymanaged == 1) { } else { $sql .= " WHERE 1 = 1"; } -if ($managedfor == 'member') - $sql .= " AND fk_member > 0"; -else $sql .= " AND fk_soc > 0"; +if ($managedfor == 'member') { + if ($memberid > 0) { + $sql .= " AND t.fk_member = ".$memberid; + } else { + $sql .= " AND fk_member > 0"; + } +} else { + if ($socid > 0) { + $sql .= " AND t.fk_soc = ".((int) $socid); + } else { + $sql .= " AND fk_soc > 0"; + } +} foreach ($search as $key => $val) { if (array_key_exists($key, $object->fields)) { if ($key == 'status' && $search[$key] == -1) { @@ -449,6 +467,113 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'classforhorizontalscrolloftabs'); +if ($managedfor == "member") { + if ($memberid > 0 && $user->hasRight('adherent', 'lire')) { + $langs->load("members"); + + $adhstat = new Adherent($db); + $adht = new AdherentType($db); + $result = $adhstat->fetch($memberid); + + if (isModEnabled('notification')) { + $langs->load("mails"); + } + + $adht->fetch($adhstat->typeid); + + $head = member_prepare_head($adhstat); + + print dol_get_fiche_head($head, 'partnerships', $langs->trans("ThirdParty"), -1, 'user'); + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
    '; + + print '
    '; + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print ''; + } + + // Type + print '\n"; + + // Morphy + print ''; + print ''; + + // Company + print ''; + + // Civility + print ''; + print ''; + + print '
    '.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
    '.$langs->trans("Type").''.$adht->getNomUrl(1)."
    '.$langs->trans("MemberNature").''.$adhstat->getmorphylib().'
    '.$langs->trans("Company").''.$adhstat->company.'
    '.$langs->trans("UserTitle").''.$adhstat->getCivilityLabel().' 
    '; + + print '
    '; + + print dol_get_fiche_end(); + } +} elseif ($managedfor == "thirdparty") { + if ($socid && $user->hasRight('societe', 'lire')) { + $socstat = new Societe($db); + $res = $socstat->fetch($socid); + if ($res > 0) { + $tmpobject = $object; + $object = $socstat; // $object must be of type Societe when calling societe_prepare_head + $head = societe_prepare_head($socstat); + $object = $tmpobject; + + print dol_get_fiche_head($head, 'partnerships', $langs->trans("ThirdParty"), -1, 'company'); + + dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); + + print '
    '; + + print '
    '; + print ''; + + // Type Prospect/Customer/Supplier + print ''; + + // Customer code + if ($socstat->client && !empty($socstat->code_client)) { + print ''; + print ''; + } + // Supplier code + if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) { + print ''; + print ''; + } + + print '
    '.$langs->trans('NatureOfThirdParty').''; + print $socstat->getTypeUrl(1); + print '
    '; + print $langs->trans('CustomerCode').''; + print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_client)); + $tmpcheck = $socstat->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print '
    '; + print $langs->trans('SupplierCode').''; + print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_fournisseur)); + $tmpcheck = $socstat->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print '
    '; + print '
    '; + print dol_get_fiche_end(); + } + } +} $arrayofselected = is_array($toselect) ? $toselect : array(); @@ -459,6 +584,12 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } +if ($socid) { + $param .= '&socid='.urlencode($socid); +} +if ($memberid) { + $param .= '&rowid='.urlencode($memberid); +} foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { foreach ($search[$key] as $skey) { @@ -512,7 +643,11 @@ print ''; print ''; print ''; print ''; - +if ($socid) { + print ''; +} elseif ($memberid) { + print ''; +} $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php deleted file mode 100644 index b7bcd153092..00000000000 --- a/htdocs/societe/partnership.php +++ /dev/null @@ -1,274 +0,0 @@ - - * Copyright (C) 2021 NextGestion - * Copyright (C) 2022 Charlene Benke - * - * 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 partnership_card.php - * \ingroup partnership - * \brief Page to create/edit/view partnership - */ - -// Load Dolibarr environment -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php'; -require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array("companies", "partnership", "other")); - -// Get parameters -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershipcard'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); - -// Security check -$socid = GETPOST('socid', 'int'); -if (!empty($user->socid)) { - $socid = $user->socid; -} - -if (empty($id) && $socid && (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty')) { - $id = $socid; -} - -$object = new Societe($db); -if ($id > 0) { - $object->fetch($id); -} - -// Initialize technical objects -$object = new Partnership($db); -$extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('thirdpartypartnership', 'globalcard')); // Note that conf->hooks_modules contains array - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); - -// Initialize array of search criterias -$search_all = GETPOST("search_all", 'alpha'); -$search = array(); - -foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) { - $search[$key] = GETPOST('search_'.$key, 'alpha'); - } -} - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. - -$permissiontoread = $user->rights->partnership->read; -$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php -$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1]; - - -if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') != 'thirdparty') { - accessforbidden('Partnership is not activated for thirdparties'); -} -if (empty($conf->partnership->enabled)) { - accessforbidden(); -} -if (empty($permissiontoread)) { - accessforbidden(); -} -if ($action == 'edit' && empty($permissiontoadd)) { - accessforbidden(); -} - -if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT && !empty($user->socid)) { - accessforbidden(); -} - - -// Security check -$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0); - - -/* - * Actions - */ - -$parameters = array('socid' => $id); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} - -$date_start = dol_mktime(0, 0, 0, GETPOST('date_partnership_startmonth', 'int'), GETPOST('date_partnership_startday', 'int'), GETPOST('date_partnership_startyear', 'int')); -$date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GETPOST('date_partnership_endday', 'int'), GETPOST('date_partnership_endyear', 'int')); - -if (empty($reshook)) { - $error = 0; - - $backtopage = DOL_URL_ROOT.'/partnership/partnership.php?id='.($id > 0 ? $id : '__ID__'); - - // Actions when linking object each other - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; -} - -$object->fields['fk_soc']['visible'] = 0; -if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) { - $object->fields['reason_decline_or_cancel']['visible'] = 1; -} -$object->fields['note_public']['visible'] = 1; - - -/* - * View - */ - -$form = new Form($db); -$formfile = new FormFile($db); - -$title = $langs->trans("Partnership"); -llxHeader('', $title); - -$form = new Form($db); - -if ($id > 0) { - $langs->load("companies"); - - $object = new Societe($db); - $result = $object->fetch($id); - - if (isModEnabled('notification')) { - $langs->load("mails"); - } - $head = societe_prepare_head($object); - - print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'company'); - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); - - print '
    '; - - print '
    '; - print ''; - - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; - } - - if ($object->client) { - print ''; - } - - if ($object->fournisseur) { - print ''; - print ''; - } - - print '
    '.$langs->trans('Prefix').''.$object->prefix_comm.'
    '; - print $langs->trans('CustomerCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); - $tmpcheck = $object->check_codeclient(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; - } - print '
    '; - print $langs->trans('SupplierCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); - $tmpcheck = $object->check_codefournisseur(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; - } - print '
    '; - - print '
    '; - - print dol_get_fiche_end(); -} else { - dol_print_error('', 'Parameter id not defined'); -} - -// Part to show record -if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - // Buttons for actions - - if ($action != 'presend') { - print '
    '."\n"; - $parameters = array(); - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - - if (empty($reshook)) { - // Show - if ($permissiontoadd) { - print dolGetButtonAction($langs->trans('AddPartnership'), '', 'default', DOL_URL_ROOT.'/partnership/partnership_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode(DOL_URL_ROOT.'/societe/partnership.php?id='.$object->id), '', $permissiontoadd); - } - } - print '
    '."\n"; - } - - - //$morehtmlright = 'partnership/partnership_card.php?action=create&backtopage=%2Fdolibarr%2Fhtdocs%2Fpartnership%2Fpartnership_list.php'; - $morehtmlright = ''; - - print load_fiche_titre($langs->trans("PartnershipDedicatedToThisThirdParty", $langs->transnoentitiesnoconv("Partnership")), $morehtmlright, ''); - - $socid = $object->id; - - - // TODO Replace this card with a table of list of all partnerships. - - $object = new Partnership($db); - $partnershipid = $object->fetch(0, '', 0, $socid); - - if ($partnershipid > 0) { - print '
    '; - print '
    '; - print '
    '; - print ''."\n"; - - // Common attributes - unset($object->fields['fk_soc']); // Hide field already shown in banner - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $forcefieldid = 'socid'; - $forceobjectid = $object->fk_soc; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print '
    '; - print '
    '; - } -} - -// End of page -llxFooter(); -$db->close(); From d5ad0090a0bb5a204078948e6d11350401d6ddd9 Mon Sep 17 00:00:00 2001 From: Faustin Date: Sat, 29 Oct 2022 17:56:03 +0200 Subject: [PATCH 31/71] sql var not quoted --- htdocs/partnership/partnership_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 0aba38fd7e3..36a0fd39218 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -335,7 +335,7 @@ if ($object->ismultientitymanaged == 1) { } if ($managedfor == 'member') { if ($memberid > 0) { - $sql .= " AND t.fk_member = ".$memberid; + $sql .= " AND t.fk_member = ".((int) $memberid); } else { $sql .= " AND fk_member > 0"; } From 8efaf03ec9526bf3eb84ab1dd6d742e7752fef12 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 29 Oct 2022 21:49:03 +0200 Subject: [PATCH 32/71] FIX - php 8 totalarray --- htdocs/commande/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 455420ce90a..4114f5f4129 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1887,6 +1887,8 @@ if ($resql) { $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; + $totalarray['val']['c.total_tva'] = 0; + $totalarray['val']['c.total_ttc'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); From 1d08d2c8ab3a32f557a40fd540d6e9762143d18e Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 29 Oct 2022 21:50:06 +0200 Subject: [PATCH 33/71] erreur --- htdocs/commande/list.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4114f5f4129..455420ce90a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1887,8 +1887,6 @@ if ($resql) { $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; - $totalarray['val']['c.total_tva'] = 0; - $totalarray['val']['c.total_ttc'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); From df2f3b046928de3db14eecbf5d4754146fe59a6e Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 29 Oct 2022 21:50:23 +0200 Subject: [PATCH 34/71] FIX - php 8 totalarray --- htdocs/commande/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 455420ce90a..4114f5f4129 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1887,6 +1887,8 @@ if ($resql) { $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; + $totalarray['val']['c.total_tva'] = 0; + $totalarray['val']['c.total_ttc'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); From 1c0dd84d6f11de6d9195f9d389e54244bfdda46f Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Sat, 29 Oct 2022 21:57:58 +0200 Subject: [PATCH 35/71] OK --- htdocs/commande/list.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4114f5f4129..53e95ff649f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1887,8 +1887,6 @@ if ($resql) { $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; - $totalarray['val']['c.total_tva'] = 0; - $totalarray['val']['c.total_ttc'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -2194,7 +2192,11 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva'; } - $totalarray['val']['c.total_tva'] += $obj->total_tva; + if (isset($totalarray['val']['c.total_tva'])) { + $totalarray['val']['c.total_tva'] += $obj->total_tva; + } else { + $totalarray['val']['c.total_tva'] = $obj->total_tva; + } } // Amount TTC / gross @@ -2206,7 +2208,11 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc'; } - $totalarray['val']['c.total_ttc'] += $obj->total_ttc; + if (isset($totalarray['val']['c.total_ttc'])) { + $totalarray['val']['c.total_ttc'] += $obj->total_ttc; + } else { + $totalarray['val']['c.total_ttc'] = $obj->total_ttc; + } } // Currency From d15493e50dbfc8040a6f6cd18aa9413176ced637 Mon Sep 17 00:00:00 2001 From: Faustin Date: Sun, 30 Oct 2022 02:59:11 +0200 Subject: [PATCH 36/71] massacrtion for updating product prices --- htdocs/core/actions_massactions.inc.php | 44 +++++++++++++++++++++++++ htdocs/core/tpl/massactions_pre.tpl.php | 18 ++++++++++ htdocs/langs/en_US/main.lang | 3 ++ htdocs/langs/en_US/products.lang | 1 + htdocs/langs/fr_FR/main.lang | 5 ++- htdocs/langs/fr_FR/products.lang | 1 + htdocs/product/list.php | 4 +-- 7 files changed, 73 insertions(+), 3 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 49cc6fa873c..7539bb028a4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1240,6 +1240,50 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd } } +if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) { + $db->begin(); + if (GETPOSTISSET('pricevariation')) { + $pricepercentage=GETPOST('pricevariation', 'int'); + if ($pricepercentage == 0) { + setEventMessages($langs->trans("RecordsModified", 0), null); + } else { + foreach ($toselect as $toselectid) { + $result = $object->fetch($toselectid); + //var_dump($contcats);exit; + if ($result > 0) { + if ($obj->price_base_type == 'TTC') { + $newprice = $object->price_ttc * (100 + $pricepercentage) / 100; + $minprice = $object->price_min_ttc; + } else { + $newprice = $object->price * (100 + $pricepercentage) / 100; + $minprice = $object->price_min; + } + $res = $object->updatePrice($newprice, $obj->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code); + if ($res > 0) { + $nbok++; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + break; + } + } + } + } + + if (!$error) { + if ($nbok > 0) { + setEventMessages($langs->trans("RecordsModified", $nbok), null); + } + $db->commit(); + $toselect=array(); + } else { + $db->rollback(); + } +} + if (!$error && ($action == 'setsupervisor' && $confirm == 'yes') && $permissiontoadd) { $db->begin(); $supervisortoset=GETPOST('supervisortoset'); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index f09d7defeb1..74ae317d938 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -78,6 +78,23 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) { } } +if ($massaction == 'preupdateprice' && isModEnabled('category')) { + $formquestion = array(); + + $valuefield = '
    '; + $valuefield .= '%'; + $valuefield .= '
    '; + + $formquestion[] = array( + 'type' => 'other', + 'name' => 'pricevariation', + 'label' => $langs->trans("PriceVariation"), + 'value' => $valuefield + ); + + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUpdatePrice"), $langs->trans("ConfirmUpdatePriceQuestion", count($toselect)), "updateprice", $formquestion, 1, 0, 200, 500, 1); +} + if ($massaction == 'presetsupervisor') { $formquestion = array(); @@ -96,6 +113,7 @@ if ($massaction == 'presetsupervisor') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmSetSupervisor"), $langs->trans("ConfirmSetSupervisorQuestion", count($toselect)), "setsupervisor", $formquestion, 1, 0, 200, 500, 1); } + if ($massaction == 'presend') { $langs->load("mails"); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 325e27b6606..a21d6633718 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1150,9 +1150,12 @@ SetSupervisor=Set Supervisor CreateExternalUser=Create external user ConfirmAffectTag=Bulk Tag Affect ConfirmSetSupervisor=Bulk Supervisor Set +ConfirmUpdatePrice=Choose a price update percentage ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)? +ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)? CategTypeNotFound=No tag type found for type of records +PriceVariation=Price variation SupervisorNotFound=Supervisor not found CopiedToClipboard=Copied to clipboard InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index fa2ed9669d9..39f09917d99 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -416,6 +416,7 @@ ProductsMergeSuccess=Products have been merged ErrorsProductsMerge=Errors in products merge SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status +UpdatePrice=Update price StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) ScanOrTypeOrCopyPasteYourBarCodes=Scan or type or copy/paste your barcodes diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 2c376c887bf..c51ee2b09fa 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -566,7 +566,7 @@ None=Aucun NoneF=Aucune NoneOrSeveral=Aucun ou plusieurs Late=Retard -LateDesc=Le délai qui définit si un enregistrement est en retard ou non dépend de votre configuration. Demandez à votre administrateur pour changer ce délai depuis Accueil - Configuration - Alertes +LateDesc=Le délai qui définit si un enregistrement est en retard ou non dépend de votre configuration. Demandez à votre administrateur pour changer ce délai depuis Accueil - Configuration - Alertes NoItemLate=Aucun élément en retard Photo=Photo Photos=Photos @@ -1150,9 +1150,12 @@ SetSupervisor=Choisir un superviseur CreateExternalUser=Créer utilisateur externe ConfirmAffectTag=Affecter les tags en masse ConfirmSetSupervisor=Choisir un superviseur en masse +ConfirmUpdatePrice=Choisir un pourcentage de hausse/baisse des prix ConfirmAffectTagQuestion=Êtes-vous sur de vouloir affecter ces catégories aux %s lignes sélectionnées ? ConfirmSetSupervisorQuestion=Êtes-vous sur de vouloir affecter ce superviseur aux %s lignes sélectionnées ? +ConfirmUpdatePriceQuestion=Êtes-vous sur de vouloir mettre à jour les prix des %s lignes sélectionnées ? CategTypeNotFound=Aucun type de tag trouvé pour ce type d'enregistrements +PriceVariation=Variation de prix SupervisorNotFound=Supervisuer non trouvé CopiedToClipboard=Copié dans le presse-papier InformationOnLinkToContract=Ce montant n’est que le total de toutes les lignes du contrat. Aucune notion de temps n’est prise en considération. diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 9061f0498fc..4a679dc4bd6 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -416,6 +416,7 @@ ProductsMergeSuccess=Produits fusionnés ErrorsProductsMerge=Erreur lors de la fusion des produits SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat +UpdatePrice=Mettre à jour le prix StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) InventoryExtraFields= Attributs supplémentaires (inventaire) ScanOrTypeOrCopyPasteYourBarCodes=Scannez ou tapez ou copiez/collez vos codes-barres diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 26f6a3a410c..76fba05b5a7 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -310,7 +310,6 @@ if (GETPOST('cancel', 'alpha')) { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } - $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -737,11 +736,12 @@ if ($resql) { if ($user->rights->{$rightskey}->creer) { $arrayofmassactions['switchonsalestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnSaleStatus"); $arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus"); + $arrayofmassactions['preupdateprice'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("UpdatePrice"); } if (isModEnabled('category') && $user->rights->{$rightskey}->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } - if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields'))) { + if (in_array($massaction, array('presend', 'predelete','preaffecttag', 'edit_extrafields', 'preupdateprice'))) { $arrayofmassactions = array(); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); From 71e55ab7097dcc3df3ab4f5a1724a3497b02442d Mon Sep 17 00:00:00 2001 From: Faustin Date: Sun, 30 Oct 2022 02:37:56 +0100 Subject: [PATCH 37/71] Translation update --- htdocs/core/actions_massactions.inc.php | 4 ++-- htdocs/core/tpl/massactions_pre.tpl.php | 6 +++--- htdocs/langs/en_US/main.lang | 4 ++-- htdocs/langs/en_US/products.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- htdocs/langs/fr_FR/products.lang | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 7539bb028a4..02d4215b963 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1242,8 +1242,8 @@ if (!$error && ($action == 'affecttag' && $confirm == 'yes') && $permissiontoadd if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoadd) { $db->begin(); - if (GETPOSTISSET('pricevariation')) { - $pricepercentage=GETPOST('pricevariation', 'int'); + if (GETPOSTISSET('pricerate')) { + $pricepercentage=GETPOST('pricerate', 'int'); if ($pricepercentage == 0) { setEventMessages($langs->trans("RecordsModified", 0), null); } else { diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 74ae317d938..1e48fc4d5a0 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -82,13 +82,13 @@ if ($massaction == 'preupdateprice' && isModEnabled('category')) { $formquestion = array(); $valuefield = '
    '; - $valuefield .= '%'; + $valuefield .= '%'; $valuefield .= '
    '; $formquestion[] = array( 'type' => 'other', - 'name' => 'pricevariation', - 'label' => $langs->trans("PriceVariation"), + 'name' => 'pricerate', + 'label' => $langs->trans("Rate"), 'value' => $valuefield ); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index a21d6633718..6f849e39be1 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1150,12 +1150,12 @@ SetSupervisor=Set Supervisor CreateExternalUser=Create external user ConfirmAffectTag=Bulk Tag Affect ConfirmSetSupervisor=Bulk Supervisor Set -ConfirmUpdatePrice=Choose a price update percentage +ConfirmUpdatePrice=Choose a increase/decrease price rate ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? ConfirmSetSupervisorQuestion=Are you sure you want to set supervisor to the %s selected record(s)? ConfirmUpdatePriceQuestion=Are you sure you want to update the price of the %s selected record(s)? CategTypeNotFound=No tag type found for type of records -PriceVariation=Price variation +Rate=Rate SupervisorNotFound=Supervisor not found CopiedToClipboard=Copied to clipboard InformationOnLinkToContract=This amount is only the total of all the lines of the contract. No notion of time is taken into consideration. diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 39f09917d99..3d5048d99a9 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -416,7 +416,7 @@ ProductsMergeSuccess=Products have been merged ErrorsProductsMerge=Errors in products merge SwitchOnSaleStatus=Switch on sale status SwitchOnPurchaseStatus=Switch on purchase status -UpdatePrice=Update price +UpdatePrice=Increase/decrease customer price StockMouvementExtraFields= Extra Fields (stock mouvement) InventoryExtraFields= Extra Fields (inventory) ScanOrTypeOrCopyPasteYourBarCodes=Scan or type or copy/paste your barcodes diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index c51ee2b09fa..39d857ae0e8 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1155,7 +1155,7 @@ ConfirmAffectTagQuestion=Êtes-vous sur de vouloir affecter ces catégories aux ConfirmSetSupervisorQuestion=Êtes-vous sur de vouloir affecter ce superviseur aux %s lignes sélectionnées ? ConfirmUpdatePriceQuestion=Êtes-vous sur de vouloir mettre à jour les prix des %s lignes sélectionnées ? CategTypeNotFound=Aucun type de tag trouvé pour ce type d'enregistrements -PriceVariation=Variation de prix +Rate=Taux SupervisorNotFound=Supervisuer non trouvé CopiedToClipboard=Copié dans le presse-papier InformationOnLinkToContract=Ce montant n’est que le total de toutes les lignes du contrat. Aucune notion de temps n’est prise en considération. diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 4a679dc4bd6..2592548059c 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -416,7 +416,7 @@ ProductsMergeSuccess=Produits fusionnés ErrorsProductsMerge=Erreur lors de la fusion des produits SwitchOnSaleStatus=Basculer le statut En vente SwitchOnPurchaseStatus=Basculer le statut En achat -UpdatePrice=Mettre à jour le prix +UpdatePrice=Augmenter/baisser le prix de vente StockMouvementExtraFields= Champs supplémentaires (mouvement de stock) InventoryExtraFields= Attributs supplémentaires (inventaire) ScanOrTypeOrCopyPasteYourBarCodes=Scannez ou tapez ou copiez/collez vos codes-barres From ebcaa34134ca5d73f957a156f504cdc0b3f9a2fd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Oct 2022 16:42:54 +0100 Subject: [PATCH 38/71] NEw translation for shipping method API cf https://github.com/Dolibarr/dolibarr/pull/22699 --- htdocs/api/class/api_setup.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..54f08cb1df3 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1188,6 +1188,7 @@ class Setup extends DolibarrApi * @param int $limit Number of items per page * @param int $page Page number {@min 0} * @param int $active Shipping methodsm is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the method must be translated to * @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')" * * @url GET dictionary/shipping_methods @@ -1196,7 +1197,7 @@ class Setup extends DolibarrApi * * @throws RestException 400 */ - public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getShippingModes($limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { $list = array(); @@ -1232,7 +1233,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $method = $this->db->fetch_object($result); + $this->translateLabel($method, $lang, '', array('dict')); + $list[] = $method; } } else { throw new RestException(400, $this->db->lasterror()); From 55d233e2da43880acfe3806938c56601676e80a2 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 30 Oct 2022 17:19:32 +0100 Subject: [PATCH 39/71] NEW translate for contact type API cf #22699 --- htdocs/api/class/api_setup.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..aa05b5fc588 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -779,6 +779,7 @@ class Setup extends DolibarrApi * @param string $type To filter on type of contact * @param string $module To filter on module contacts * @param int $active Contact's type is active or not {@min 0} {@max 1} + * @param string $lang Code of the language the label of the civility must be translated to * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return array List of Contacts types * @@ -786,7 +787,7 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '') + public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang ='', $sqlfilters = '') { $list = array(); @@ -827,7 +828,9 @@ class Setup extends DolibarrApi $num = $this->db->num_rows($result); $min = min($num, ($limit <= 0 ? $num : $limit)); for ($i = 0; $i < $min; $i++) { - $list[] = $this->db->fetch_object($result); + $contact_type = $this->db->fetch_object($result); + $this->translateLabel($contact_type, $lang, 'TypeContact_'.$contact_type->type.'_'.$contact_type->source.'_', array("eventorganization", "resource", "projects", "contracts", "bills", "orders", "agenda", "propal", "stocks", "supplier_proposal", "interventions", "sendings", "ticket")); + $list[] = $contact_type; } } else { throw new RestException(503, 'Error when retrieving list of contacts types : '.$this->db->lasterror()); From 82da70841fe8b293a4ee9734aafd6cd2200d33b5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 30 Oct 2022 16:20:15 +0000 Subject: [PATCH 40/71] Fixing style errors. --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index aa05b5fc588..c671053f84f 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -787,7 +787,7 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang ='', $sqlfilters = '') + public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang = '', $sqlfilters = '') { $list = array(); From 754881a6efe9f3e29a4f6b3fca5c8c24de0e7554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 31 Oct 2022 10:42:40 +0100 Subject: [PATCH 41/71] strftime is deprecated in php 8.1 --- htdocs/adherents/stats/byproperties.php | 2 +- htdocs/adherents/stats/geo.php | 2 +- htdocs/adherents/stats/index.php | 2 +- htdocs/comm/propal/stats/index.php | 2 +- htdocs/commande/stats/index.php | 2 +- htdocs/compta/deplacement/stats/index.php | 2 +- htdocs/compta/facture/stats/index.php | 2 +- htdocs/compta/journal/purchasesjournal.php | 2 +- htdocs/compta/journal/sellsjournal.php | 2 +- htdocs/compta/localtax/clients.php | 2 +- htdocs/compta/localtax/index.php | 2 +- htdocs/compta/localtax/quadri_detail.php | 2 +- htdocs/compta/resultat/result.php | 2 +- htdocs/compta/stats/index.php | 2 +- htdocs/compta/stats/supplier_turnover.php | 2 +- htdocs/core/lib/accounting.lib.php | 4 ++-- htdocs/don/stats/index.php | 2 +- htdocs/expensereport/stats/index.php | 2 +- htdocs/fichinter/stats/index.php | 2 +- htdocs/product/stock/fiche-valo.php | 2 +- htdocs/product/stock/valo.php | 2 +- htdocs/projet/stats/index.php | 2 +- htdocs/projet/tasks/stats/index.php | 2 +- htdocs/reception/stats/index.php | 2 +- htdocs/salaries/card.php | 2 +- htdocs/salaries/stats/index.php | 2 +- htdocs/ticket/stats/index.php | 2 +- scripts/accountancy/export-thirdpartyaccount.php | 2 +- 28 files changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index f632a1ea9c7..1d0f0d92c16 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -40,7 +40,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = strftime("%Y", time()); +$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index bb65a1047a8..e7195d4ee30 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -42,7 +42,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = strftime("%Y", time()); +$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 11447dcd8bb..30b79f4bd76 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -47,7 +47,7 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'adherent', '', '', 'cotisation'); -$year = strftime("%Y", time()); +$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 9e2e485c92a..db85490e1bb 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -52,7 +52,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 15642da2d39..9052ed7ab27 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -65,7 +65,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 50848654a71..1bf7706bf87 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -62,7 +62,7 @@ if ($userid > 0) { } } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 7bb430489b2..760a0eca4c8 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -64,7 +64,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 28eee624db2..e71a85004d1 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -74,7 +74,7 @@ llxHeader('', $langs->trans("PurchasesJournal"), '', '', 0, 0, '', '', $morequer $form = new Form($db); -$year_current = strftime("%Y", dol_now()); +$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; if ($pastmonth == 0) { diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index d704e09ad68..0fc5a192271 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -77,7 +77,7 @@ $morequery = '&date_startyear='.$date_startyear.'&date_startmonth='.$date_startm llxHeader('', $langs->trans("SellsJournal"), '', '', 0, 0, '', '', $morequery); -$year_current = strftime("%Y", dol_now()); +$year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; if ($pastmonth == 0) { diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 7f8e181f121..d5aef47c285 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -39,7 +39,7 @@ $local = GETPOST('localTaxType', 'int'); // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year_start = $year_current; } else { $year_current = $year; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index e9aab173337..ad0b86a161d 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -38,7 +38,7 @@ $localTaxType = GETPOST('localTaxType', 'int'); // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year_start = $year_current; } else { $year_current = $year; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 9e03f156848..66c58580df6 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -49,7 +49,7 @@ $local = GETPOST('localTaxType', 'int'); // Date range $year = GETPOST("year", "int"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year_start = $year_current; } else { $year_current = $year; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 15c369b7a52..3f3e14e2d61 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -59,7 +59,7 @@ $nbofyear = 1; // Date range $year = GETPOST('year', 'int'); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $month_current = strftime("%m", dol_now()); $year_start = $year_current - ($nbofyear - 1); } else { diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 8e20f5b0afd..4d65c201ffd 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -371,7 +371,7 @@ print ''; $now_show_delta = 0; $minyear = substr($minyearmonth, 0, 4); $maxyear = substr($maxyearmonth, 0, 4); -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $nowyearmonth = strftime("%Y-%m", dol_now()); $maxyearmonth = max($maxyearmonth, $nowyearmonth); $now = dol_now(); diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index 53446163183..88e04e89303 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -310,7 +310,7 @@ print ''; $now_show_delta = 0; $minyear = substr($minyearmonth, 0, 4); $maxyear = substr($maxyearmonth, 0, 4); -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $nowyearmonth = strftime("%Y-%m", dol_now()); $maxyearmonth = max($maxyearmonth, $nowyearmonth); $now = dol_now(); diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 4dbdd9f5be8..7d4483de6cf 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -304,7 +304,7 @@ function getDefaultDatesForTransfer() $date_end = dol_get_last_day($year_end, $month_end); } } elseif ($periodbydefaultontransfer == 1) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()); $pastmonthyear = $year_current; if ($pastmonth == 0) { @@ -312,7 +312,7 @@ function getDefaultDatesForTransfer() $pastmonthyear--; } } else { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; if ($pastmonth == 0) { diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 4109c30d335..e9c2b82ae22 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -41,7 +41,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index b4d11320411..e9fdd03a2be 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -54,7 +54,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'expensereport', $id, ''); -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index f1ab4b08fec..162afb68077 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -43,7 +43,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/product/stock/fiche-valo.php b/htdocs/product/stock/fiche-valo.php index b4277e559b1..0e3f9367e16 100644 --- a/htdocs/product/stock/fiche-valo.php +++ b/htdocs/product/stock/fiche-valo.php @@ -106,7 +106,7 @@ if ($id > 0) { /* ************************************************************************** */ print "
    \n"; - $year = strftime("%Y", time()); + $year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $file = $conf->stock->dir_temp.'/entrepot-'.$entrepot->id.'-'.($year).'.png'; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 6bf59ebeb0e..af98ee98540 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -52,7 +52,7 @@ if ($page < 0) { $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; -$year = strftime("%Y", time()); +$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); /* diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index ba293dea744..32498121045 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -41,7 +41,7 @@ if ($user->socid > 0) { $action = ''; $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index dd807b7bb93..07b0199d480 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -44,7 +44,7 @@ if ($user->socid > 0) { $action = ''; $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index b1f5dbdc7f9..1e26bf5871a 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -36,7 +36,7 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 9ee2e52a226..5ba1b818137 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -459,7 +459,7 @@ if ($id > 0) { // Create if ($action == 'create') { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $pastmonth = strftime("%m", dol_now()) - 1; $pastmonthyear = $year_current; if ($pastmonth == 0) { diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index 4dfd0c84e0c..ba5d254f22b 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -51,7 +51,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'salaries', '', '', ''); -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index 52965da8182..7e94af1a431 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -45,7 +45,7 @@ if ($user->socid > 0) { $socid = $user->socid; } -$nowyear = strftime("%Y", dol_now()); +$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ? GETPOST('year', 'int') : $nowyear; $startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index a8a4363ba5c..d7793c3ced1 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -45,7 +45,7 @@ if (!$user->admin) { // Date range $year = GETPOST("year"); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); + $year_current = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $month_current = strftime("%m", dol_now()); $year_start = $year_current; } else { From 88152eccda95c3c8f2ad9941e1e389c116399b03 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 31 Oct 2022 12:30:01 +0100 Subject: [PATCH 42/71] NEW add constant PROPAL_BYPASS_VALIDATED_STATUS --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0d560d741ce..07a950c5d5e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -462,7 +462,7 @@ if ($action == "nosign" && $permissiontoclose) { $error = 0; foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { - if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) { + if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || !empty($conf->global->PROPAL_BYPASS_VALIDATED_STATUS)) { $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs'); From 5888f376774ca613b6692d250da0e4be97081acc Mon Sep 17 00:00:00 2001 From: IC-faycal Date: Mon, 31 Oct 2022 13:53:26 +0100 Subject: [PATCH 43/71] FIX change in the communication status of the prospect --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 28c08631278..4f8618a883e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1452,7 +1452,7 @@ class Societe extends CommonObject $sql .= ",fk_effectif = ".($this->effectif_id > 0 ? ((int) $this->effectif_id) : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".($this->stcomm_id > 0 ? ((int) $this->stcomm_id) : "0"); + $sql .= ",fk_stcomm=".($this->stcomm_id >= -1 ? ((int) $this->stcomm_id) : "0"); } if (isset($this->typent_id)) { $sql .= ",fk_typent = ".($this->typent_id > 0 ? ((int) $this->typent_id) : "0"); From b7293632cf05b3fbfea2f70ad6ff06c6a92b6175 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 31 Oct 2022 14:58:38 +0100 Subject: [PATCH 44/71] FIX use existing PROPAL_SKIP_ACCEPT_REFUSE instead --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 07a950c5d5e..a2655e84bb3 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -462,7 +462,7 @@ if ($action == "nosign" && $permissiontoclose) { $error = 0; foreach ($toselect as $checked) { if ($tmpproposal->fetch($checked) > 0) { - if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || !empty($conf->global->PROPAL_BYPASS_VALIDATED_STATUS)) { + if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (!empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) { $tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED; if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) { setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs'); From 28a6a879cb613db9021d7830519501e4fd516371 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Oct 2022 19:51:04 +0100 Subject: [PATCH 45/71] Code comment --- htdocs/filefunc.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 54c7885e080..3a7eebbffac 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -253,7 +253,7 @@ if (empty($dolibarr_main_data_root)) { // Define some constants define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter) define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents) -// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT. +// Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT when root is not directly the main domain. // Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works. $tmp = ''; $found = 0; @@ -283,7 +283,8 @@ foreach ($paths as $tmppath) { // We check to find (B+start of C)=A } //print "found=".$found." dolibarr_main_url_root=".$dolibarr_main_url_root."\n"; if (!$found) { - $tmp = $dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT). + // There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT). + $tmp = $dolibarr_main_url_root; } else { $tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : ''); } From 4bd9bdaccd509172cf7b483e6eefde78acf42338 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 07:56:24 +0100 Subject: [PATCH 46/71] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- .../class/accountancyexport.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index db58cb2ccbc..022a8ecd3c0 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -657,7 +657,7 @@ class AccountancyExport /** * Export format : WinFic - eWinfic - WinSis Compta - * Last review for this format : 2022-10-28 Alexandre Spangaro (aspangaro@open-dsi.fr) + * Last review for this format : 2022-11-01 Alexandre Spangaro (aspangaro@open-dsi.fr) * * Help : https://wiki.gestan.fr/lib/exe/fetch.php?media=wiki:v15:compta:accountancy-format_winfic-ewinfic-winsiscompta.pdf * @@ -670,10 +670,14 @@ class AccountancyExport global $conf; $end_line = "\r\n"; + $index = 1; //We should use dol_now function not time however this is wrong date to transfert in accounting //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy + + // Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted + foreach ($TData as $data) { $code_compta = $data->numero_compte; if (!empty($data->subledger_account)) { @@ -691,11 +695,11 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($data->piece_num, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); - $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6), 6, '0'); + $Tab['num_compte'] = str_pad(dol_trunc($code_compta, 6, 'right', 'UTF-8', 1), 6, '0'); if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format($data->debit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -707,11 +711,11 @@ class AccountancyExport $Tab['montant_crebit'] = str_pad(number_format($data->credit, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30), 30); + $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); - $Tab['code_piece'] = str_repeat(' ', 5); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4); @@ -735,6 +739,8 @@ class AccountancyExport $Tab['end_line'] = $end_line; print implode('|', $Tab); + + $index++; } } From d3d55240f911cbf98878e935dd107b02ea8952da Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Nov 2022 08:00:37 +0100 Subject: [PATCH 47/71] FIX Accountancy - Review of Winfic - eWinfic - Winsis compta export format --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 022a8ecd3c0..73035c55d5d 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -686,7 +686,7 @@ class AccountancyExport $Tab = array(); //$Tab['type_ligne'] = 'M'; - $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2), 2); + $Tab['code_journal'] = str_pad(dol_trunc($data->code_journal, 2, 'right', 'UTF-8', 1), 2); //We use invoice date $data->doc_date not $date_ecriture which is the transfert date //maybe we should set an option for customer who prefer to keep in accounting software the tranfert date instead of invoice date ? @@ -695,7 +695,7 @@ class AccountancyExport $Tab['folio'] = ' 1'; - $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6), 6, ' ', STR_PAD_LEFT); + $Tab['num_ecriture'] = str_pad(dol_trunc($index, 6, 'right', 'UTF-8', 1), 6, ' ', STR_PAD_LEFT); $Tab['jour_ecriture'] = dol_print_date($data->doc_date, '%d%m%y'); @@ -713,9 +713,9 @@ class AccountancyExport $Tab['libelle_ecriture'] = str_pad(dol_trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 30, 'right', 'UTF-8', 1), 30); - $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left'), 2); + $Tab['lettrage'] = str_repeat(dol_trunc($data->lettering_code, 2, 'left', 'UTF-8', 1), 2); - $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5), 5, ' ', STR_PAD_LEFT); + $Tab['code_piece'] = str_pad(dol_trunc($data->piece_num, 5, 'left', 'UTF-8', 1), 5, ' ', STR_PAD_LEFT); $Tab['code_stat'] = str_repeat(' ', 4); From 9aeb1b0f8671d5b06605a372ee5b8efd37c88757 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 11:46:21 +0100 Subject: [PATCH 48/71] Remove no more used option MODULEBUILDER_FOREVERYONE Add menu entry in main menu Tools for Modulebuilder and API explorer --- htdocs/core/modules/modApi.class.php | 45 ++++++------------- .../core/modules/modModuleBuilder.class.php | 14 +++--- htdocs/langs/en_US/modulebuilder.lang | 2 +- htdocs/modulebuilder/index.php | 6 +-- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 5eaae25a67c..30751fc5222 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -152,37 +152,20 @@ class modApi extends DolibarrModules $this->menu = array(); // List of menus to add $r = 0; - // Add here entries to declare new menus - // - // Example to declare a new Top Menu entry and its Left menu entry: - // $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu - // 'type'=>'top', // This is a Top menu entry - // 'titre'=>'Api top menu', - // 'mainmenu'=>'api', - // 'leftmenu'=>'api', - // 'url'=>'/api/pagetop.php', - // 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'position'=>100, - // 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules - // 'target'=>'', - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - // $r++; - // - // Example to declare a Left Menu entry into an existing Top menu entry: - // $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode - // 'type'=>'left', // This is a Left menu entry - // 'titre'=>'Api left menu', - // 'mainmenu'=>'xxx', - // 'leftmenu'=>'api', - // 'url'=>'/api/pagelevel2.php', - // 'langs'=>'mylangfile@api', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - // 'position'=>100, - // 'enabled'=>'$conf->api->enabled', // Define condition to show or hide menu entry. Use '$conf->api->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. - // 'perms'=>'1', // Use 'perms'=>'$user->rights->api->level1->level2' if you want your menu with a permission rules - // 'target'=>'', - // 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both - // $r++; + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools', + 'type'=>'left', + 'titre'=>'ApiExplorer', + 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), + 'mainmenu'=>'tools', + 'leftmenu'=>'devtools_api', + 'url'=>'/api/index.php/explorer', + 'langs'=>'modulebuilder', + 'position'=>100, + 'perms'=>'1', + //'enabled'=>'isModEnabled("api") && preg_match(\'/^(devtools)/\',$leftmenu)', + 'enabled'=>'isModEnabled("api")', + 'target'=>'_apiexplorer', + 'user'=>0); // Exports diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php index 99c32e48bbd..2d6cafa9c2e 100644 --- a/htdocs/core/modules/modModuleBuilder.class.php +++ b/htdocs/core/modules/modModuleBuilder.class.php @@ -102,16 +102,18 @@ class modModuleBuilder extends DolibarrModules //------------------ $this->menu = array(); - $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', + $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=tools', 'type'=>'left', 'titre'=>'ModuleBuilder', - 'mainmenu'=>'home', - 'leftmenu'=>'admintools_modulebuilder', - 'url'=>'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools', + 'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth"'), + 'mainmenu'=>'tools', + 'leftmenu'=>'devtools_modulebuilder', + 'url'=>'/modulebuilder/index.php?mainmenu=tools&leftmenu=devtools', 'langs'=>'modulebuilder', 'position'=>100, - 'perms'=>'1', - 'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)', + 'perms'=>'$user->hasRight("modulebuilder", "run")', + //'enabled'=>'isModEnabled("modulebuilder") && preg_match(\'/^(devtools|all)/\',$leftmenu)', + 'enabled'=>'isModEnabled("modulebuilder")', 'target'=>'_modulebuilder', 'user'=>0); } diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 6de9ada7e4d..cefdfaa1b41 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -86,7 +86,7 @@ IsAMeasure=Is a measure DirScanned=Directory scanned NoTrigger=No trigger NoWidget=No widget -GoToApiExplorer=API explorer +ApiExplorer=API explorer ListOfMenusEntries=List of menu entries ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 705dc202932..eadef4684a4 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -84,7 +84,7 @@ $idmodule= GETPOST('idmodule', 'alpha'); if (!isModEnabled('modulebuilder')) { accessforbidden('Module ModuleBuilder not enabled'); } -if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) { +if (!$user->hasRight("modulebuilder", "run")) { accessforbidden('ModuleBuilderNotAllowed'); } @@ -2836,9 +2836,9 @@ if ($module == 'initmodule') { print ''.img_picto($langs->trans("Delete"), 'delete').''; print '   '; if (empty($conf->global->$const_name)) { // If module is not activated - print ''.$langs->trans("GoToApiExplorer").''; + print ''.$langs->trans("ApiExplorer").''; } else { - print ''.$langs->trans("GoToApiExplorer").''; + print ''.$langs->trans("ApiExplorer").''; } } else { print ''.img_picto('Generate', 'generate', 'class="paddingleft"').''; From 39ef32326fe92707cb00fffc87454f0dd1a66e83 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 12:05:52 +0100 Subject: [PATCH 49/71] Better responsive behaviour --- htdocs/user/list.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 8642c569752..e92fbf33280 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1072,14 +1072,15 @@ while ($i < $imaxinloop) { } } + // Phone if (!empty($arrayfields['u.office_phone']['checked'])) { - print ''.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."\n"; + print ''.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."\n"; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['u.user_mobile']['checked'])) { - print ''.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."\n"; + print ''.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -1091,10 +1092,10 @@ while ($i < $imaxinloop) { } } if (!empty($arrayfields['u.api_key']['checked'])) { - print ''; + print ''; if ($obj->api_key) { if ($canreadsecretapi) { - print $obj->api_key; + print dol_escape_htmltag($obj->api_key); } else { print ''.$langs->trans("Hidden").''; } From e0a4070da3f3d13c5afd5b676ace1e1357437eea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 14:00:08 +0100 Subject: [PATCH 50/71] Try to fix phpunit --- htdocs/core/modules/DolibarrModules.class.php | 5 +++-- test/phpunit/AdminLibTest.php | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 763973ac031..f6ee9da7d60 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1881,7 +1881,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $i = 0; while ($i < $num) { $obj2 = $this->db->fetch_object($resqlseladmin); - dol_syslog(get_class($this)."::insert_permissions Add permission id '.$r_id.' to user id=".$obj2->rowid); + dol_syslog(get_class($this)."::insert_permissions Add permission id ".$r_id." to user id=".$obj2->rowid); $tmpuser = new User($this->db); $result = $tmpuser->fetch($obj2->rowid); @@ -1968,13 +1968,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $menu->menu_handler = 'all'; //$menu->module=strtolower($this->name); TODO When right_class will be same than module name - $menu->module = empty($this->rights_class) ?strtolower($this->name) : $this->rights_class; + $menu->module = (empty($this->rights_class) ? strtolower($this->name) : $this->rights_class); if (!$this->menu[$key]['fk_menu']) { $menu->fk_menu = 0; } else { $foundparent = 0; $fk_parent = $this->menu[$key]['fk_menu']; + $reg = array(); if (preg_match('/^r=/', $fk_parent)) { // old deprecated method $fk_parent = str_replace('r=', '', $fk_parent); if (isset($this->menu[$fk_parent]['rowid'])) { diff --git a/test/phpunit/AdminLibTest.php b/test/phpunit/AdminLibTest.php index 317d486434e..6649aa19798 100644 --- a/test/phpunit/AdminLibTest.php +++ b/test/phpunit/AdminLibTest.php @@ -165,6 +165,9 @@ class AdminLibTest extends PHPUnit\Framework\TestCase require_once dirname(__FILE__).'/../../htdocs/core/modules/modExpenseReport.class.php'; print "Enable module modExpenseReport"; $moduledescriptor=new modExpenseReport($db); + + $result = $moduledescriptor->remove(); + $result = $moduledescriptor->init(); print __METHOD__." result=".$result."\n"; $this->assertEquals(1, $result); @@ -173,6 +176,9 @@ class AdminLibTest extends PHPUnit\Framework\TestCase require_once dirname(__FILE__).'/../../htdocs/core/modules/modApi.class.php'; print "Enable module modAPI"; $moduledescriptor=new modApi($db); + + $result = $moduledescriptor->remove(); + $result = $moduledescriptor->init(); print __METHOD__." result=".$result."\n"; $this->assertEquals(1, $result); From dca945f1ab7f94bd0b43c2bf8a0b5302799e1483 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 20:25:58 +0100 Subject: [PATCH 51/71] Doc --- htdocs/api/class/api_setup.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..79fe00187d9 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -612,7 +612,6 @@ class Setup extends DolibarrApi * @param object $object Object with label to translate * @param string $lang Code of the language the name of the object must be translated to * @param string $prefix Prefix for translation key - * * @return void */ private function translateLabel($object, $lang, $prefix = 'Country') From 75d784a6eb52bb298c3db637331ebbfc6563cd50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 23:23:42 +0100 Subject: [PATCH 52/71] Fix price on takepos thumb must include vat --- htdocs/product/class/product.class.php | 10 +++++-- htdocs/takepos/admin/appearance.php | 2 +- htdocs/takepos/ajax/ajax.php | 14 +++++++--- htdocs/takepos/css/pos.css.php | 38 +++++++++++++------------- htdocs/takepos/index.php | 28 +++++++++---------- 5 files changed, 51 insertions(+), 41 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index aba48b939be..ffb72bfca78 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -127,19 +127,23 @@ class Product extends CommonObject public $type = self::TYPE_PRODUCT; /** - * Selling price + * Selling price without tax * * @var float */ - public $price; // Price net + public $price; + + public $price_formated; // used by takepos/ajax/ajax.php /** - * Price with tax + * Selling price with tax * * @var float */ public $price_ttc; + public $price_ttc_formated; // used by takepos/ajax/ajax.php + /** * Minimum price net * diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index 250606703af..54ed2f642a2 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -115,7 +115,7 @@ print ''; print $langs->trans("NumberOfLinesToShow"); print ''; $array = array(1=>"1", 2=>"2", 3=>"3", 4=>"4", 5=>"5", 6=>"6"); -print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, (empty($conf->global->TAKEPOS_LINES_TO_SHOW) ? '2' : $conf->global->TAKEPOS_LINES_TO_SHOW), 0); +print $form->selectarray('TAKEPOS_LINES_TO_SHOW', $array, getDolGlobalInt('TAKEPOS_LINES_TO_SHOW', 2), 0); print "\n"; // D'ont display category diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 671ef27ba96..db6b224466c 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -84,7 +84,10 @@ if ($action == 'getProducts') { } unset($prod->fields); unset($prod->db); - $prod->price_formated=price(price2num($prod->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency); + + $prod->price_formated = price(price2num($prod->price, 'MT'), 1, $langs, 1, -1, -1, $conf->currency); + $prod->price_ttc_formated = price(price2num($prod->price_ttc, 'MT'), 1, $langs, 1, -1, -1, $conf->currency); + $res[] = $prod; } } @@ -158,7 +161,7 @@ if ($action == 'getProducts') { if (isset($barcode_value_list['ref'])) { // search product from reference - $sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price"; + $sql = "SELECT rowid, ref, label, tosell, tobuy, barcode, price, price_ttc"; $sql .= " FROM " . $db->prefix() . "product as p"; $sql .= " WHERE entity IN (" . getEntity('product') . ")"; $sql .= " AND ref = '" . $db->escape($barcode_value_list['ref']) . "'"; @@ -207,6 +210,7 @@ if ($action == 'getProducts') { 'tobuy' => $obj->tobuy, 'barcode' => $obj->barcode, 'price' => $obj->price, + 'price_ttc' => $obj->price_ttc, 'object' => 'product', 'img' => $ig, 'qty' => $qty, @@ -223,7 +227,7 @@ if ($action == 'getProducts') { } } - $sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price' ; + $sql = 'SELECT p.rowid, p.ref, p.label, p.tosell, p.tobuy, p.barcode, p.price, p.price_ttc' ; if (getDolGlobalInt('TAKEPOS_PRODUCT_IN_STOCK') == 1) { $sql .= ', ps.reel'; } @@ -299,10 +303,12 @@ if ($action == 'getProducts') { 'tobuy' => $obj->tobuy, 'barcode' => $obj->barcode, 'price' => $obj->price, + 'price_ttc' => $obj->price_ttc, 'object' => 'product', 'img' => $ig, 'qty' => 1, - 'price_formated' => price(price2num($obj->price, 'MU'), 1, $langs, 1, -1, -1, $conf->currency) + 'price_formated' => price(price2num($obj->price, 'MT'), 1, $langs, 1, -1, -1, $conf->currency), + 'price_ttc_formated' => price(price2num($obj->price_ttc, 'MT'), 1, $langs, 1, -1, -1, $conf->currency) ); // Add entries to row from hooks $parameters=array(); diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index d39b3fb0b37..ec21eea2d60 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -477,7 +477,7 @@ p.description_content{ div.description_content { display: -webkit-box; -webkit-box-orient: vertical; - -webkit-line-clamp: global->TAKEPOS_LINES_TO_SHOW; ?>; + -webkit-line-clamp: ; overflow: hidden; padding-left: 2px; padding-right: 2px; @@ -587,11 +587,11 @@ div#moreinfo, div#infowarehouse { background: var(--colorbackhmenu1); color: var(--colortextbackhmenu); font-size: 2em; - padding: 5px; + padding: 4px; border-radius: 2px; opacity: 0.9; - padding-left: 8px; - padding-right: 8px; + padding-left: 6px; + padding-right: 6px; } @@ -841,11 +841,11 @@ div#moreinfo, div#infowarehouse { padding-bottom: 2px; margin-left: 2px; } - + .div4 .wrapper.divempty, .div4 img, .div4 .wrapper:nth-last-child(1), .div4 .wrapper:nth-last-child(2), #prodiv22, #prodiv23, .catwatermark { display: none!important; } - + .tab-category { float: left; position: relative; @@ -858,7 +858,7 @@ div#moreinfo, div#infowarehouse { box-sizing: border-box; background-color: #fff; } - + .div4 .wrapper, .tab-category { width: auto; height: auto; @@ -868,7 +868,7 @@ div#moreinfo, div#infowarehouse { border: 1px solid #FFF!important; border-top: 3px solid #FFF!important; } - + .div4 .tab-category.active { border-right: 1px solid #CCC !important; border-left: 1px solid #CCC !important; @@ -890,42 +890,42 @@ div#moreinfo, div#infowarehouse { padding-top: 0px; background: -webkit-linear-gradient(top, rgba(250,250,250,0), rgba(250,250,250,0.5), rgba(250,250,250,0.95), rgba(250,250,250,1)); } - + .div5 .description .description_content { font-weight: bold; font-size: 14px; padding-left: 10px; } - + .div5 .wrapper2 { width: 100%; display: inline-flex; align-items: center; padding: 10px; } - + .div5 .wrapper2.divempty { display: none; } - + div.wrapper2 { float: none; } - + .div5 .arrow { width: auto; height: auto; display: none!important; } - + .div5 .arrow .centerinmiddle { transform: translate(0, 0); } - + .div5 .imgadd { display: flex; } - + div.wrapper2{ height:10%; } @@ -1009,12 +1009,12 @@ html { ::-webkit-scrollbar-track { - background: #f1f1f1; + background: #f1f1f1; } - + ::-webkit-scrollbar-thumb { - background: #888; + background: #888; } .topnav::-webkit-scrollbar-track{ diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index a128a0d66fd..17c4f14060c 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -367,7 +367,7 @@ function LoadProducts(position, issubcat) { ?> if (data[parseInt(idata)]['price_formated']) { $("#proprice"+ishow).attr("class", "productprice"); - $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']); } console.log("#prodiv"+ishow+".data(rowid)="+data[idata]['id']); console.log($("#prodiv"+ishow)); @@ -449,7 +449,7 @@ function MoreProducts(moreorless) { $("#probutton"+ishow).show(); if (data[parseInt(idata)]['price_formated']) { $("#proprice"+ishow).attr("class", "productprice"); - $("#proprice"+ishow).html(data[parseInt(idata)]['price_formated']); + $("#proprice"+ishow).html(data[parseInt(idata)]['price_ttc_formated']); } $("#proimg"+ishow).attr("src","genimg/index.php?query=pro&id="+data[idata]['id']); $("#prodiv"+ishow).data("rowid",data[idata]['id']); @@ -657,7 +657,7 @@ function Search2(keyCodeForEnter, moreorless) { $("#probutton" + i).show(); if (data[i]['price_formated']) { $("#proprice" + i).attr("class", "productprice"); - $("#proprice" + i).html(data[i]['price_formated']); + $("#proprice" + i).html(data[i]['price_ttc_formated']); } $("#proimg" + i).attr("title", titlestring); if( undefined !== data[i]['img']) { @@ -939,15 +939,15 @@ $( document ).ready(function() { } } ?> - + /* For Header Scroll */ var elem1 = $("#topnav-left")[0]; var elem2 = $("#topnav-right")[0]; var checkOverflow = function() { if (scrollBars().horizontal) $("#topnav").addClass("overflow"); - else $("#topnav").removeClass("overflow"); + else $("#topnav").removeClass("overflow"); } - + var scrollBars = function(){ var container= $('#topnav')[0]; return { @@ -955,43 +955,43 @@ $( document ).ready(function() { horizontal:container.scrollWidth > container.clientWidth }; } - + $(window).resize(function(){ checkOverflow(); }); - + let resizeObserver = new ResizeObserver(() => { checkOverflow(); }); resizeObserver.observe(elem1); resizeObserver.observe(elem2); checkOverflow(); - + var pressTimer = []; var direction = 1; var step = 200; - + $(".indicator").mousedown(function(){ direction = $(this).hasClass("left") ? -1 : 1; scrollTo(); pressTimer.push(setInterval(scrollTo, 100)); }); - + $(".indicator").mouseup(function(){ pressTimer.forEach(clearInterval); }); - + $("body").mouseup(function(){ pressTimer.forEach(clearInterval); console.log("body"); }); - + function scrollTo(){ console.log("here"); var pos = $("#topnav").scrollLeft(); document.getElementById("topnav").scrollTo({ left: $("#topnav").scrollLeft() + direction * step, behavior: 'smooth' }) } - + $("#topnav").scroll(function(){ if (($("#topnav").offsetWidth + $("#topnav").scrollLeft >= $("#topnav").scrollWidth)) { console.log("end"); From 8e9be8f40fbf541b2abdcc519a975e617d53878e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 1 Nov 2022 23:33:08 +0100 Subject: [PATCH 53/71] Update card.php --- htdocs/comm/propal/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 64f58e4d705..da4c756705f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1635,13 +1635,13 @@ if ($action == 'create') { // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); - $form->select_conditions_paiements((GETPOST('cond_reglement_id', 'int') > 0 ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') > 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); print ''; // Mode of payment print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank').' '; - $form->select_types_paiements((GETPOST('mode_reglement_id', 'int') > 0 ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') > 0) ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account From ff16d74bd2975d207ed45fca66fc1caaff3065ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 00:00:02 +0100 Subject: [PATCH 54/71] FIX install wizard error management --- htdocs/install/step5.php | 82 ++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b841edb12ac..27bce2d8e57 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -220,9 +220,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."
    "; $success = 1; } else { - if ($newuser->error == 'ErrorLoginAlreadyExists') { + if ($result == -6) { //login or email already exists dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); - print '
    '.$langs->trans("AdminLoginAlreadyExists", $login)."

    "; + print '
    '.$newuser->error."

    "; $success = 1; } else { dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); @@ -357,48 +357,50 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) { // Create lock file // If first install -if ($action == "set" && $success) { - if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { - // Install is finished - print $langs->trans("SystemIsInstalled")."
    "; +if ($action == "set") { + if ($success) { + if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) { + // Install is finished + print $langs->trans("SystemIsInstalled")."
    "; - $createlock = 0; + $createlock = 0; - if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { - // Install is finished, we create the lock file - $lockfile = DOL_DATA_ROOT.'/install.lock'; - $fp = @fopen($lockfile, "w"); - if ($fp) { - if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { - $force_install_lockinstall = 444; // For backward compatibility + if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) { + // Install is finished, we create the lock file + $lockfile = DOL_DATA_ROOT.'/install.lock'; + $fp = @fopen($lockfile, "w"); + if ($fp) { + if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) { + $force_install_lockinstall = 444; // For backward compatibility + } + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); + fclose($fp); + @chmod($lockfile, octdec($force_install_lockinstall)); + $createlock = 1; } - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); - fclose($fp); - @chmod($lockfile, octdec($force_install_lockinstall)); - $createlock = 1; } + if (empty($createlock)) { + print '
    '.$langs->trans("WarningRemoveInstallDir")."
    "; + } + + print "
    "; + + print $langs->trans("YouNeedToPersonalizeSetup")."


    "; + + print ''; + } else { + // If here MAIN_VERSION_LAST_UPGRADE is not empty + print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
    '; + print $langs->trans("VersionProgram").': '.DOL_VERSION.'
    '; + print $langs->trans("MigrationNotFinished").'
    '; + print "
    "; + + print ''; } - if (empty($createlock)) { - print '
    '.$langs->trans("WarningRemoveInstallDir")."
    "; - } - - print "
    "; - - print $langs->trans("YouNeedToPersonalizeSetup")."


    "; - - print ''; - } else { - // If here MAIN_VERSION_LAST_UPGRADE is not empty - print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
    '; - print $langs->trans("VersionProgram").': '.DOL_VERSION.'
    '; - print $langs->trans("MigrationNotFinished").'
    '; - print "
    "; - - print ''; } } elseif (empty($action) || preg_match('/upgrade/i', $action)) { // If upgrade @@ -443,7 +445,7 @@ if ($action == "set" && $success) { $morehtml .= '
    '; } } else { - dol_print_error('', 'step5.php: unknown choice of action'); + dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction'); } // Clear cache files From 74f350daa47b42ba41ac2b65b50eb1b162f3cd00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 00:36:08 +0100 Subject: [PATCH 55/71] Fix error message not complete --- htdocs/takepos/invoice.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e22f6e6d226..47af7d16260 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -703,7 +703,9 @@ if (empty($reshook)) { $pu_ht = price2num($number / (1 + ($line->tva_tx / 100)), 'MU'); //Check min price if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($line->remise_percent) / 100) < price2num($price_min)))) { - echo $langs->trans("CantBeLessThanMinPrice"); + $langs->load("products"); + dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency))); + //echo $langs->trans("CantBeLessThanMinPrice"); } else { if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code == "4")) { dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); @@ -739,7 +741,8 @@ if (empty($reshook)) { // Check min price if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($line->subprice) * (1 - price2num($number) / 100) < price2num($price_min)))) { - echo $langs->trans("CantBeLessThanMinPrice"); + $langs->load("products"); + dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency))); } else { if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code == "4")) { dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1); From 59809eb50a5b8ce7b8c719d8526eced57aaa335e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 00:49:28 +0100 Subject: [PATCH 56/71] Fix trans --- htdocs/langs/en_US/admin.lang | 4 +++- htdocs/langs/en_US/contracts.lang | 1 - htdocs/langs/en_US/interventions.lang | 4 +--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 0555906768c..e963f8206be 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2333,4 +2333,6 @@ MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT=Show the price on the generated documents f WarningDisabled=Warning disabled LimitsAndMitigation=Access limits and mitigation DesktopsOnly=Desktops only -DesktopsAndSmartphones=Desktops et smartphones \ No newline at end of file +DesktopsAndSmartphones=Desktops et smartphones +AllowOnlineSign=Allow online signing +AllowExternalDownload=Allow external download (without login, using a shared link) \ No newline at end of file diff --git a/htdocs/langs/en_US/contracts.lang b/htdocs/langs/en_US/contracts.lang index a485f97a553..ab94a63bcc3 100644 --- a/htdocs/langs/en_US/contracts.lang +++ b/htdocs/langs/en_US/contracts.lang @@ -101,7 +101,6 @@ TypeContact_contrat_external_BILLING=Billing customer contact TypeContact_contrat_external_CUSTOMER=Follow-up customer contact TypeContact_contrat_external_SALESREPSIGN=Signing contract customer contact HideClosedServiceByDefault=Hide closed services by default -AllowOnlineSign=Allow online signing ShowClosedServices=Show Closed Services HideClosedServices=Hide Closed Services UserStartingService=User starting service diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 7524439f3ec..c93a5c4db09 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -68,6 +68,4 @@ ConfirmReopenIntervention=Are you sure you want to open back the intervention Date: Wed, 2 Nov 2022 02:19:26 +0100 Subject: [PATCH 57/71] Add column for birth place --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_user.sql | 1 + htdocs/user/card.php | 10 +++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 119dda91a2e..d29fdd1cce8 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -368,3 +368,6 @@ ALTER TABLE llx_prelevement_facture_demande RENAME TO llx_prelevement_demande; ALTER TABLE llx_prelevement ADD COLUMN fk_salary INTEGER NULL AFTER fk_facture_fourn; ALTER TABLE llx_prelevement_demande ADD COLUMN fk_salary INTEGER NULL AFTER fk_facture_fourn; + + +ALTER TABLE llx_user ADD COLUMN birth_place varchar(64); diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index e70716d90c4..ca0c7bc818d 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -50,6 +50,7 @@ create table llx_user fk_state integer DEFAULT 0, fk_country integer DEFAULT 0, birth date, -- birthday + birth_place varchar(64), -- birth place (town) job varchar(128), office_phone varchar(20), office_fax varchar(20), diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 905be457810..8a93a57cb96 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1290,7 +1290,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; // Date employment - print ''.$langs->trans("DateEmployment").''; + print ''.$langs->trans("DateOfEmployment").''; print ''; print $form->selectDate($dateemployment, 'dateemployment', 0, 0, 1, 'formdateemployment', 1, 1); @@ -2307,25 +2307,25 @@ if ($action == 'create' || $action == 'adduserldap') { if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); - print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); + print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1); + print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1); + print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } else { // $object->socid is not > 0 here print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); + print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); } } print ''; From 95ca1f66c9b4e6453abc0782a7445165c6ad0e85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 02:42:14 +0100 Subject: [PATCH 58/71] css --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 1b684fdc236..c6b6c3b4c20 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -841,7 +841,7 @@ class FormFile $out .= ''; if ($imgpreview) { - $out .= ''; + $out .= ''; } else { $out .= ''; } From 1f594f5ae953ed88ccf5983ce5cc9f85ba7890ad Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 2 Nov 2022 07:26:58 +0100 Subject: [PATCH 59/71] receipt.php Receipt preview --- htdocs/takepos/receipt.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 3542aa44014..400d05415aa 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -330,7 +330,9 @@ if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeTe ?> From c11f89d18a24429bdf255df996f1f1bbe72c5cb8 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Wed, 2 Nov 2022 07:28:14 +0100 Subject: [PATCH 60/71] admin/receipt.php Receipt preview --- htdocs/takepos/admin/receipt.php | 76 +++----------------------------- 1 file changed, 7 insertions(+), 69 deletions(-) diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index bcf0a853705..1cfe141478d 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -93,75 +93,6 @@ print '
    '; print ''; -print load_fiche_titre($langs->trans("PrintMethod"), '', ''); - -print '
    '; -print ''; -print ''; -print ''; -print "\n"; - -// Browser method -print '\n"; - -// Receipt printer module -print '\n"; - -// TakePOS Connector -print '\n"; -print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").'
    '; -print $langs->trans('Browser'); -print ''; -print $langs->trans('BrowserMethodDescription'); -print ''; -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "browser") { - print img_picto($langs->trans("Activated"), 'switch_on'); -} else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; -} -print "
    '; -print $langs->trans('DolibarrReceiptPrinter'); -print ''; -print $langs->trans('ReceiptPrinterMethodDescription'); -if (isModEnabled('receiptprinter')) { - if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { - print '
    '; - print img_picto('', 'printer', 'class="paddingright"').''.$langs->trans("Setup").''; - } -} -print '
    '; -if (isModEnabled('receiptprinter')) { - if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; - } -} else { - print ''; - print $langs->trans("ModuleReceiptPrinterMustBeEnabled"); - print ''; -} -print "
    '; -print "TakePOS Connector"; -print ''; -print $langs->trans('TakeposConnectorMethodDescription'); - -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - print '
    '; - print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ' '; -} - -print '
    '; -if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - print img_picto($langs->trans("Activated"), 'switch_on'); -} else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; -} -print "
    '; -print '
    '; - - print load_fiche_titre($langs->trans("Receipt"), '', ''); print '
    '; @@ -285,6 +216,13 @@ print $form->buttonsSaveCancel("Save", ''); print "\n"; +print load_fiche_titre($langs->trans("Preview"), '', ''); +print '
    '; +print '
    '; +print ''; +print '
    '; +print '
    '; + print '
    '; llxFooter(); From 95b27d39a3e4e560d34239936857527332a3c87e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 12:52:26 +0100 Subject: [PATCH 61/71] css --- htdocs/fourn/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 9f06c56b9e1..22b9767d13c 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1484,7 +1484,7 @@ if ($num > 0) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print $thirdparty->getNomUrl(1, 'supplier', 0, 0, -1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1); print ''; if (!$i) { @@ -1493,7 +1493,7 @@ if ($num > 0) { } // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; + print ''; print $thirdparty->name_alias; print ''; if (!$i) { @@ -1639,7 +1639,7 @@ if ($num > 0) { // Author if (!empty($arrayfields['u.login']['checked'])) { - print ''; + print ''; if ($userstatic->id) { print $userstatic->getLoginUrl(-1); } else { From 1dfa3e9e9857ab8ebad74257719f1e5d1ec198fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 12:59:29 +0100 Subject: [PATCH 62/71] Look and feel v17 --- htdocs/fourn/facture/list.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 22b9767d13c..0d8945436e2 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1550,8 +1550,9 @@ if ($num > 0) { // Payment condition if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print ''; - $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1); + $s = $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 1, '', -1, -1, 1); + print ''; + print dol_escape_htmltag($s); print ''; if (!$i) { $totalarray['nbfield']++; @@ -1559,8 +1560,9 @@ if ($num > 0) { } // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; - $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1); + $s = $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1, 0, '', 1); + print ''; + print dol_escape_htmltag($s); print ''; if (!$i) { $totalarray['nbfield']++; From ca77beeff6c77aa2c10e51da891feeef33c2133d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 2 Nov 2022 14:32:14 +0100 Subject: [PATCH 63/71] add same translation in many entities --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_overwrite_trans.key.sql | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 119dda91a2e..efb9ff96dbb 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -211,6 +211,9 @@ ALTER TABLE llx_projet ADD COLUMN location varchar(255); ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(128); +ALTER TABLE llx_overwrite_trans DROP INDEX uk_overwrite_trans; +ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(entity, lang, transkey); + -- -- List of all managed triggered events (used for trigger agenda automatic events and for notification) -- diff --git a/htdocs/install/mysql/tables/llx_overwrite_trans.key.sql b/htdocs/install/mysql/tables/llx_overwrite_trans.key.sql index 617036e66ee..7dd3156d2e5 100644 --- a/htdocs/install/mysql/tables/llx_overwrite_trans.key.sql +++ b/htdocs/install/mysql/tables/llx_overwrite_trans.key.sql @@ -17,5 +17,4 @@ -- =========================================================================== -ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(lang, transkey); - +ALTER TABLE llx_overwrite_trans ADD UNIQUE INDEX uk_overwrite_trans(entity, lang, transkey); From d4165f380021ca5d40d29922b739cf35dc851096 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 16:21:20 +0100 Subject: [PATCH 64/71] FIX #22732 --- htdocs/fourn/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 00a3ba55caa..2c929aa40ba 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -848,7 +848,7 @@ if ($object->id > 0) { if ($object->status == 1) { print dolGetButtonAction('', $langs->trans('AddSupplierProposal'), 'default', DOL_URL_ROOT.'/supplier_proposal/card.php?action=create&socid='.$object->id, ''); } else { - print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposalGR'), 'default', $_SERVER['PHP_SELF'].'#', '', false); + print dolGetButtonAction($langs->trans('ThirdPartyIsClosed'), $langs->trans('AddSupplierProposal'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } } @@ -865,7 +865,7 @@ if ($object->id > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) { if ($object->status == 1) { // Company is open - print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplierGR'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1', ''); + print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisSupplier'), 'default', DOL_URL_ROOT.'/fourn/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1', ''); } else { print dolGetButtonAction('', $langs->trans('CreateInvoiceForThisCustomer'), 'default', $_SERVER['PHP_SELF'].'#', '', false); } From 946624fd671cb7862408c4dba9f5d4f03f9ee2ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 16:50:45 +0100 Subject: [PATCH 65/71] Debug v17 --- htdocs/core/class/html.formprojet.class.php | 8 ++++---- htdocs/langs/en_US/categories.lang | 2 +- htdocs/projet/list.php | 16 +++++++++++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index d4c3b1aa21f..9c8928de718 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -689,10 +689,10 @@ class FormProjets $sellist .= ''; } if ($showallnone) { - $sellist .= ''; - $sellist .= ''; - $sellist .= ''; - $sellist .= ''; + $sellist .= ''; + $sellist .= ''; + $sellist .= ''; + $sellist .= ''; } while ($i < $num) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index ae3d31b6f12..0493968798e 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -88,7 +88,7 @@ DeleteFromCat=Remove from tags/category ExtraFieldsCategories=Complementary attributes CategoriesSetup=Tags/categories setup CategorieRecursiv=Link with parent tag/category automatically -CategorieRecursivHelp=If option is on, when you add a product into a subcategory, product will also be added into the parent category. +CategorieRecursivHelp=If option is on, when you add an object into a subcategory, the object will also be added into the parent categories. AddProductServiceIntoCategory=Add the following product/service AddCustomerIntoCategory=Assign category to customer AddSupplierIntoCategory=Assign category to supplier diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9ef64174325..d3a5a203487 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1008,7 +1008,7 @@ if (!empty($arrayfields['c.assigned']['checked'])) { // Opp status if (!empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; - print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100 nowrapoption', 1, 0); + print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 1, 1, 0, 'maxwidth125 nowrapoption', 1, 1); print ''; } if (!empty($arrayfields['p.opp_amount']['checked'])) { @@ -1267,6 +1267,9 @@ while ($i < $imaxinloop) { print ''; } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Project url if (!empty($arrayfields['p.ref']['checked'])) { @@ -1428,6 +1431,9 @@ while ($i < $imaxinloop) { } } print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Opp Status if (!empty($arrayfields['p.fk_opp_status']['checked'])) { @@ -1612,7 +1618,7 @@ while ($i < $imaxinloop) { $userstatic->gender = $obj->gender; if (!empty($arrayfields['u.login']['checked'])) { - print ''; + print ''; if ($userstatic->id) { print $userstatic->getNomUrl(-1); } else { @@ -1672,9 +1678,9 @@ while ($i < $imaxinloop) { print ''; } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; From f3279c5f3d0691c927dbd34ab67762c6c513bf2e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 2 Nov 2022 16:58:15 +0100 Subject: [PATCH 66/71] FIX passing null in "$options" parameter is deprecated --- htdocs/core/lib/security.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 0ef7a568f18..8e1ed6cebd1 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -146,7 +146,7 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") } $ivseed = dolGetRandomBytes($ivlen); - $newchain = openssl_encrypt($chain, $ciphering, $key, null, $ivseed); + $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed); return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain; } else { return $chain; @@ -180,9 +180,9 @@ function dolDecrypt($chain, $key = '') if (function_exists('openssl_decrypt')) { $tmpexplode = explode(':', $reg[2]); if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) { - $newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, null, $tmpexplode[0]); + $newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, 0, $tmpexplode[0]); } else { - $newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, null, null); + $newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, 0, null); } } else { $newchain = 'Error function openssl_decrypt() not available'; From b4ecccfd9de093a771a2372d8756d2fcf17c8e31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Nov 2022 17:08:27 +0100 Subject: [PATCH 67/71] Fix alias --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 8ffe95731de..37cf4746d82 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3604,14 +3604,14 @@ class Societe extends CommonObject } //Verify duplicate entries - $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$this->db->escape($value)."' AND entity IN (".getEntity('societe').")"; + $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$this->db->escape($value)."' AND entity IN (".getEntity('societe').")"; if ($socid) { $sql .= " AND rowid <> ".$socid; } $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $count = $obj->idprof; + $count = $obj->nb; } else { $count = 0; print $this->db->error(); From d0a824c5e9fb9d5c3ec38b619c4f40697b00fec2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 3 Nov 2022 16:13:35 +0100 Subject: [PATCH 68/71] Debug v17 --- htdocs/bookmarks/card.php | 7 +- htdocs/bookmarks/list.php | 110 ++++++++++-------- htdocs/core/lib/functions.lib.php | 4 +- htdocs/core/lib/project.lib.php | 5 +- htdocs/core/menus/standard/eldy.lib.php | 1 + htdocs/core/tpl/objectline_create.tpl.php | 5 +- htdocs/langs/en_US/members.lang | 4 +- .../modulebuilder/template/myobject_list.php | 2 +- htdocs/projet/card.php | 4 +- htdocs/projet/index.php | 2 +- htdocs/theme/eldy/global.inc.php | 4 + htdocs/theme/md/style.css.php | 9 +- htdocs/user/card.php | 37 +++--- 13 files changed, 114 insertions(+), 80 deletions(-) diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index 60d615192d0..5b22b8918d9 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2015 Laurent Destailleur + * Copyright (C) 2005-2022 Laurent Destailleur * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -186,7 +186,7 @@ if ($action == 'create') { print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : $defaulttarget, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").''; - // Owner + // Visibility / Owner print ''.$langs->trans("Visibility").''; print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 0, '', 0, ($user->admin ? '' : array($user->id)), '', 0, 0, 0, '', ($user->admin) ? 1 : 0, '', 'maxwidth300 widthcentpercentminusx'); print ''; @@ -279,9 +279,10 @@ if ($id > 0 && !preg_match('/^add/i', $action)) { } print ''; + // Visibility / owner print ''.$langs->trans("Visibility").''; if ($action == 'edit' && $user->admin) { - print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx'); } else { if ($object->fk_user > 0) { $fuser = new User($db); diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 4f5d73a2404..5f8eb93af96 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2022 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,13 +39,14 @@ $id = GETPOST("id", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action +} $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -72,6 +73,14 @@ $permissiontodelete = !empty($user->rights->bookmark->supprimer); * Actions */ +if (GETPOST('cancel', 'alpha')) { + $action = 'list'; + $massaction = ''; +} +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { + $massaction = ''; +} + if ($action == 'delete') { $res = $object->remove($id); if ($res > 0) { @@ -103,34 +112,41 @@ if (!$user->admin) { $sql .= " AND (b.fk_user = ".((int) $user->id)." OR b.fk_user is NULL OR b.fk_user = 0)"; } -$sql .= $db->order($sortfield.", position", $sortorder); - // Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. -if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { - $num = $nbtotalofrecords; -} else { + +// Complete request and execute it with limit +$sql .= $db->order($sortfield.", position", $sortorder); +if ($limit) { $sql .= $db->plimit($limit + 1, $offset); - - $resql = $db->query($sql); - if (!$resql) { - dol_print_error($db); - exit; - } - - $num = $db->num_rows($resql); } -$param = ""; +$resql = $db->query($sql); +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + +$param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -138,7 +154,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($optioncss != '') { - $param = '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } $moreforfilter = ''; @@ -150,7 +166,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -158,7 +174,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr } $massactionbutton = $form->selectMassAction('', $arrayofmassactions); -print '
    '; +print ''."\n"; if ($optioncss != '') { print ''; } @@ -167,7 +183,9 @@ print ''; print ''; print ''; +print ''; print ''; +print ''; $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer)); @@ -179,13 +197,13 @@ print ''; //print ""; -print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder); -print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder); -print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, 'align="left"', $sortfield, $sortorder); -print_liste_field_titre("Target", '', '', '', '', 'align="center"'); -print_liste_field_titre("Visibility", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "b.dateb", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, 'class="right"', $sortfield, $sortorder); +print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, '', $sortfield, $sortorder); +print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, '', $sortfield, $sortorder); +print_liste_field_titre("Link", $_SERVER["PHP_SELF"], "b.url", "", $param, '', $sortfield, $sortorder); +print_liste_field_titre("Target", $_SERVER["PHP_SELF"], "b.target", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Visibility", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("DateCreation", $_SERVER["PHP_SELF"], "b.dateb", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Position", $_SERVER["PHP_SELF"], "b.position", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -205,33 +223,31 @@ while ($i < min($num, $limit)) { print $object->getNomUrl(1); print ''; - $linkintern = 0; + $linkintern = 1; + if (preg_match('/^http/i', $obj->url)) { + $linkintern = 0; + } $title = $obj->title; $link = $obj->url; $canedit = $user->rights->bookmark->supprimer; $candelete = $user->rights->bookmark->creer; // Title - print "\n"; // Url print '\n"; // Target @@ -264,7 +280,7 @@ while ($i < min($num, $limit)) { print "\n"; // Date creation - print '"; + print '"; // Position print '"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 46a61e60a61..09c9d3e9943 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4072,7 +4072,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring','rss', 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', + 'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', 'conferenceorbooth', 'eventorganization' ))) { $fakey = $pictowithouttext; @@ -4121,7 +4121,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', - 'uncheck'=>'times', 'uparrow'=>'share', 'vat'=>'money-check-alt', 'vcard'=>'address-card', + 'uncheck'=>'times', 'uparrow'=>'share', 'url'=>'external-link-alt', 'vat'=>'money-check-alt', 'vcard'=>'address-card', 'jabber'=>'comment-o', 'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'world'=>'globe', 'private'=>'user-lock', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index f418fcf7de2..062c3f711af 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2451,6 +2451,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $arrayidtypeofcontact = array(); + print ''; print '
    '; print '
     
    "; - $linkintern = 1; - if ($linkintern) { - print ''; - } - print $title; - if ($linkintern) { - print ""; - } + print ''; + print dol_escape_htmltag($title); print "'; - if (!$linkintern) { - print 'target ? ' target="newlink" rel="noopener"' : '').'>'; + if (empty($linkintern)) { + print img_picto('', 'url', 'class="pictofixedwidth"'); + print 'target ? ' target="newlink" rel="noopener"' : '').'>'; + } else { + //print img_picto('', 'rightarrow', 'class="pictofixedwidth"'); + print ''; } print $link; - if (!$linkintern) { - print ''; - } + print ''; print "'.dol_print_date($db->jdate($obj->dateb), 'day')."'.dol_print_date($db->jdate($obj->dateb), 'day')."'.$obj->position."
    '; @@ -2650,12 +2651,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $plannedworkload = $objp->planned_workload; $total_plannedworkload += $plannedworkload; if (!in_array('plannedworkload', $hiddenfields)) { - print ''; + print ''; } if (!in_array('declaredprogress', $hiddenfields)) { $declaredprogressworkload = $objp->declared_progess_workload; $total_declaredprogressworkload += $declaredprogressworkload; - print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 22613a331b7..8f91e4bb122 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2409,6 +2409,7 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->hasRight('adherent', 'read')); $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->hasRight('adherent', 'read')); $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-2", $langs->trans("MenuMembersExcluded"), 2, $user->hasRight('adherent', 'read')); $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->hasRight('adherent', 'read')); $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->hasRight('adherent', 'export')); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 1bfc9587b89..bd961b5bf17 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -107,7 +107,7 @@ if ($nolinesbefore) { global->MAIN_VIEW_LINE_NUMBER)) { ?> - - '; // Label diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 56ce446f4e2..2698a4b1a21 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2019 Nicolas ZABOURI * diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f2cea00230d..a73eb67fccb 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5163,6 +5163,10 @@ tr.visible { /* Module website */ /* ============================================================================== */ +.previewnotyetavailable { + opacity: 0.5; +} + .websiteformtoolbar { position: sticky; top: ; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 002166968cd..50fff15b8f0 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5018,6 +5018,11 @@ tr.visible { /* Module website */ /* ============================================================================== */ + +.previewnotyetavailable { + opacity: 0.5; +} + .websiteformtoolbar { position: sticky; top: ; @@ -5754,7 +5759,7 @@ ul.ecmjqft > a { width: calc(100% - 100px); overflow: hidden; white-space: break-spaces; - word-break: break-all; + word-break: break-all; } ul.ecmjqft a:active { font-weight: bold !important; @@ -6216,7 +6221,7 @@ ul.select2-results__options li { .select2-container.select2-container--open .select2-dropdown--below { min-width: 220px !important; } - + .select2-container--open .select2-dropdown--below { border-top: 1px solid var(--inputbordercolor); /* border-top: 1px solid #aaaaaa; */ diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8a93a57cb96..238724f7ae0 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2004-2020 Laurent Destailleur + * Copyright (C) 2004-2022 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2021 Regis Houssin * Copyright (C) 2005 Lionel Cousteix @@ -1434,7 +1434,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
    '; print '
    '; - print '
    '.($plannedworkload ?convertSecondToTime($plannedworkload) : '').''.($plannedworkload ?convertSecondToTime($plannedworkload) : '').''; + print ''; //print $objp->planned_workload.'-'.$objp->declared_progess_workload."
    "; print ($plannedworkload ?round(100 * $declaredprogressworkload / $plannedworkload, 0).'%' : ''); print '
    +
    trans('AddNewLine'); ?>
    - + global->MAIN_DISABLE_FREE_LINES)) { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index d774a8e7434..dfb4ed1d0bd 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -35,8 +35,8 @@ DateSubscription=Date of membership DateEndSubscription=End date of membership EndSubscription=End of membership SubscriptionId=Contribution ID -WithoutSubscription=Without contribution -WaitingSubscription=Waiting contribution +WithoutSubscription=Without membership +WaitingSubscription=Membership pending MemberId=Member Id MemberRef=Member Ref NewMember=New member diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 30ccdd22e44..f26afd1a503 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -87,7 +87,7 @@ require_once __DIR__.'/class/myobject.class.php'; // Load translation files required by the page $langs->loadLangs(array("mymodule@mymodule", "other")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 718aeecec82..1bdcccbaecf 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -561,7 +561,9 @@ if ($action == 'create' && $user->rights->projet->creer) { // Ref $suggestedref = (GETPOST("ref") ? GETPOST("ref") : $defaultref); print '
    '.$langs->trans("Ref").''; - print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); + if ($suggestedref) { + print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref)); + } print '
    '; + print '
    '; // Login print ''; @@ -1739,9 +1739,11 @@ if ($action == 'create' || $action == 'adduserldap') { print "
    '.$langs->trans("Login").'
    \n"; + // Credentials + print '
    '; print '
    '; - print ''; + print '
    '; print ''; @@ -1749,7 +1751,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; // Date login validity - print ''; + print ''; print '\n"; // Password - print ''; - - print '"; - print ''."\n"; + if (dol_string_nohtmltag($valuetoshow)) { // If there is a real visible content to show + print ''; + print '"; + print ''."\n"; + } // API key if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight("api", "apikey", "generate"))) { - print ''; + print ''; print ''; } - print ''; + print ''; print ''; print "\n"; - print '
    '; print img_picto('', 'security', 'class="paddingleft pictofixedwidth"').$langs->trans("Credentials"); print '
    '.$langs->trans("RangeOfLoginValidity").'
    '.$langs->trans("RangeOfLoginValidity").''; if ($object->datestartvalidity) { print ''.$langs->trans("FromDate").' '; @@ -1763,9 +1765,6 @@ if ($action == 'create' || $action == 'adduserldap') { print "
    '.$langs->trans("Password").''; $valuetoshow = ''; if (preg_match('/ldap/', $dolibarr_main_authentication)) { if (!empty($object->ldap_sid)) { @@ -1785,6 +1784,7 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("HTTPBasicPassword"); } + /* if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { if ($object->pass) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : ''); @@ -1792,15 +1792,15 @@ if ($action == 'create' || $action == 'adduserldap') { } else { if ($user->admin && $user->id == $object->id) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : ''); - //$valuetoshow .= ''.$langs->trans("Crypted").' - '; $valuetoshow .= ''.$langs->trans("Hidden").''; - // TODO Add a feature to reveal the hash $valuetoshow .= ''; } else { - $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''.$langs->trans("Hidden").''; + $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : ''); + $valuetoshow .= ''.$langs->trans("Hidden").''; } } } + */ // Other form for user password $parameters = array('valuetoshow' => $valuetoshow); @@ -1811,13 +1811,17 @@ if ($action == 'create' || $action == 'adduserldap') { $valuetoshow .= $hookmanager->resPrint; // to add } - print $valuetoshow; - print "
    '.$langs->trans("Password").''; + print $valuetoshow; + print "
    '.$langs->trans("ApiKey").'
    '.$langs->trans("ApiKey").''; if (!empty($object->api_key)) { print ''; @@ -1827,7 +1831,7 @@ if ($action == 'create' || $action == 'adduserldap') { print '
    '.$langs->trans("LastConnexion").'
    '.$langs->trans("LastConnexion").''; if ($object->datepreviouslogin) { print dol_print_date($object->datepreviouslogin, "dayhour").' ('.$langs->trans("Previous").'), '; @@ -1838,7 +1842,8 @@ if ($action == 'create' || $action == 'adduserldap') { print '
    '; + print ''; + print '
    '; print '
    '; From 43e153715f97d1153153c951ce815873abedef3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2022 20:49:25 +0100 Subject: [PATCH 69/71] Remove non used code for module webhook --- htdocs/core/lib/functions.lib.php | 22 ++- ...ce_95_modWebhook_WebhookTriggers.class.php | 12 +- htdocs/webhook/class/target.class.php | 6 +- htdocs/webhook/lib/webhook_target.lib.php | 43 ----- htdocs/webhook/target_card.php | 80 +------- htdocs/webhook/target_list.php | 4 +- htdocs/webhook/target_note.php | 174 ------------------ test/phpunit/FunctionsLibTest.php | 2 + 8 files changed, 46 insertions(+), 297 deletions(-) delete mode 100644 htdocs/webhook/target_note.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 46a61e60a61..6989d57de99 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1159,29 +1159,43 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } /** - * Create a clone of instance of object (new instance with same value for properties) - * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid. + * Create a clone of instance of object (new instance with same value for each properties) + * With native = 0: Property that are reference are different memory area in the new object (full isolation clone). This means $this->db of new object may not be valid. * With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object. + * With native = 2: Property that are reference are different memory area in the new object (full isolation clone). Only scalar and array values are cloned. This means $this->db of new object is not valid. * * @param object $object Object to clone - * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended) + * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended) * @return object Clone object * @see https://php.net/manual/language.oop5.cloning.php */ function dol_clone($object, $native = 0) { if ($native == 0) { + // deprecated method, use the method with native = 2 instead $tmpsavdb = null; if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { $tmpsavdb = $object->db; unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') } - $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields + $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields if (!empty($tmpsavdb)) { $object->db = $tmpsavdb; } + } elseif ($native == 2) { + // recommended method to have a full isolated cloned object + $myclone = new stdClass(); + $tmparray = get_object_vars($object); // return only public properties + + if (is_array($tmparray)) { + foreach ($tmparray as $propertykey => $propertyval) { + if (is_scalar($propertyval) || is_array($propertyval)) { + $myclone->$propertykey = $propertyval; + } + } + } } else { $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable) } diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 94b4b861e86..d53b74bcd2e 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -103,7 +103,17 @@ class InterfaceWebhookTriggers extends DolibarrTriggers foreach ($target_url as $key => $tmpobject) { $actionarray = explode(",", $tmpobject->trigger_codes); if (is_array($actionarray) && in_array($action, $actionarray)) { - $jsonstr = '{"triggercode":'.json_encode($action).',"object":'.json_encode($object).'}'; + // Build the answer object + $resobject = new stdClass(); + $resobject->triggercode = $action; + $resobject->object = dol_clone($object, 2); + + unset($resobject->object['fields']); + unset($resobject->object['error']); + unset($resobject->object['errors']); + + $jsonstr = json_encode($resobject); + $response = getURLContent($tmpobject->url, 'POST', $jsonstr, 1, array(), array('http', 'https'), 0, -1); if (empty($response['curl_error_no']) && $response['http_code'] >= 200 && $response['http_code'] < 300) { $nbPosts ++; diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 30d541f33af..ba33f2b8995 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -105,6 +105,8 @@ class Target extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'index'=>1, 'searchall'=>1, 'validate'=>'1', 'comment'=>"Reference of object"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',), + 'url' => array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1,), + 'trigger_codes' => array('type'=>'text', 'label'=>'TriggerCodes', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'help'=>"TriggerCodeInfo",), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',), @@ -113,9 +115,7 @@ class Target extends CommonObject 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>3, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'), 'validate'=>'1',), - 'url' => array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1,), - 'trigger_codes' => array('type'=>'text', 'label'=>'TriggerCodes', 'enabled'=>'1', 'position'=>50, 'notnull'=>1, 'visible'=>1, 'help'=>"TriggerCodeInfo",), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'), 'validate'=>'1',), ); public $rowid; public $ref; diff --git a/htdocs/webhook/lib/webhook_target.lib.php b/htdocs/webhook/lib/webhook_target.lib.php index 894e3134c0c..da342da0065 100644 --- a/htdocs/webhook/lib/webhook_target.lib.php +++ b/htdocs/webhook/lib/webhook_target.lib.php @@ -38,49 +38,6 @@ function targetPrepareHead($object) $head[$h][2] = 'card'; $h++; - if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) { - $nbNote = 0; - if (!empty($object->note_private)) { - $nbNote++; - } - if (!empty($object->note_public)) { - $nbNote++; - } - $head[$h][0] = dol_buildpath('/webhook/target_note.php', 1).'?id='.$object->id; - $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); - } - $head[$h][2] = 'note'; - $h++; - } - - /*require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->webhook->dir_output."/target/".dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); - $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/webhook/target_document.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans('Documents'); - if (($nbFiles + $nbLinks) > 0) { - $head[$h][1] .= ''.($nbFiles + $nbLinks).''; - } - $head[$h][2] = 'document'; - $h++;*/ - - /*$head[$h][0] = dol_buildpath("/webhook/target_agenda.php", 1).'?id='.$object->id; - $head[$h][1] = $langs->trans("Events"); - $head[$h][2] = 'agenda'; - $h++;*/ - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - //$this->tabs = array( - // 'entity:+tabname:Title:@webhook:/webhook/mypage.php?id=__ID__' - //); // to add new tab - //$this->tabs = array( - // 'entity:-tabname:Title:@webhook:/webhook/mypage.php?id=__ID__' - //); // to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'target@webhook'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'target@webhook', 'remove'); diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 35e18a9cdbc..83f2008703f 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -160,8 +160,6 @@ if (empty($reshook)) { /* * View - * - * Put here all code to build page */ $form = new Form($db); @@ -459,25 +457,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Send - if (empty($user->socid)) { + /*if (empty($user->socid)) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle'); - } - - // Back to draft - if ($object->status == $object::STATUS_VALIDATED) { - print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); - } + }*/ print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); - // Validate + // Disable + if ($object->status == $object::STATUS_VALIDATED) { + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); + } + + // Enable if ($object->status == $object::STATUS_DRAFT) { - if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); - } else { - $langs->load("errors"); - print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0); - } + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd); } // Clone @@ -505,61 +498,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
    '."\n"; } - - - // Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - if ($action != 'presend') { - print '
    '; - print ''; // ancre - - $includedocgeneration = 0; - - // Documents - if ($includedocgeneration) { - $objref = dol_sanitizeFileName($object->ref); - $relativepath = $objref.'/'.$objref.'.pdf'; - $filedir = $conf->webhook->dir_output.'/'.$object->element.'/'.$objref; - $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $permissiontoread; // If you can read, you can build the PDF to read content - $delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('webhook:Target', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); - } - - // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object, null, array('target')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); - - - print '
    '; - - $MAXEVENT = 10; - - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', dol_buildpath('/webhook/target_agenda.php', 1).'?id='.$object->id); - - // List of actions on element - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; - $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); - - print '
    '; - } - - //Select mail models is same action as presend - if (GETPOST('modelselected')) { - $action = 'presend'; - } - - // Presend form - $modelmail = 'target'; - $defaulttopic = 'InformationMessage'; - $diroutput = $conf->webhook->dir_output; - $trackid = 'target'.$object->id; - - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } // End of page diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index 5d81bec967f..1db73639103 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -48,10 +48,12 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'ta $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'aZ'); +if (empty($mode)) { + $mode = 'modulesetup'; +} $id = GETPOST('id', 'int'); - // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); diff --git a/htdocs/webhook/target_note.php b/htdocs/webhook/target_note.php deleted file mode 100644 index e09ace533a9..00000000000 --- a/htdocs/webhook/target_note.php +++ /dev/null @@ -1,174 +0,0 @@ - - * Copyright (C) 2022 Frédéric France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * 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/webhook/target_note.php - * \ingroup webhook - * \brief Tab for notes on Target - */ - -// Load Dolibarr environment -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/webhook/class/target.class.php'; -require_once DOL_DOCUMENT_ROOT.'/webhook/lib/webhook_target.lib.php'; - -// Load translation files required by the page -$langs->loadLangs(array('companies')); - -// Get parameters -$action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - -$id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); - -// Initialize technical objects -$object = new Target($db); -$extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->webhook->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('targetnote', 'globalcard')); // Note that conf->hooks_modules contains array - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->webhook->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; -} - -// Permissions -// There is several ways to check permission. -// Set $enablepermissioncheck to 1 to enable a minimum low level of checks -$enablepermissioncheck = 0; -if ($enablepermissioncheck) { - $permissiontoread = $user->rights->webhook->target->read; - $permissiontoadd = $user->rights->webhook->target->write; - $permissionnote = $user->rights->webhook->target->write; // Used by the include of actions_setnotes.inc.php -} else { - $permissiontoread = 1; - $permissiontoadd = 1; - $permissionnote = 1; -} - -// Security check (enable the most restrictive one) -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (!isModEnabled('webhook') || !$permissiontoread) { - accessforbidden(); -} - - -/* - * Actions - */ - -$parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -} -if (empty($reshook)) { - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once -} - - -/* - * View - */ - -$form = new Form($db); - -//$help_url='EN:Webhooks|FR:Webhooks_FR|ES:Webhooks_ES'; -$help_url = ''; -$title = $langs->trans('Target').' - '.$langs->trans("Notes"); -llxHeader('', $title, $help_url); - -if ($id > 0 || !empty($ref)) { - $object->fetch_thirdparty(); - - $head = targetPrepareHead($object); - - print dol_get_fiche_head($head, 'note', $langs->trans("Target"), -1, $object->picto); - - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; - - $morehtmlref = '
    '; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); - // Project - if (isModEnabled('projet')) - { - $langs->load("projects"); - $morehtmlref.='
    '.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ - $morehtmlref .= '
    '; - - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - - print '
    '; - print '
    '; - - - $cssclass = "titlefield"; - include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; - - print '
    '; - - print dol_get_fiche_end(); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 5357f7c8061..12c8683bb8f 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -188,6 +188,8 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals($this->savdb->connected, 1, 'Savdb is connected'); $this->assertNotNull($newproduct1->db->db, 'newproduct1->db is not null'); + $newproductcloned2 = dol_clone($newproduct1, 2); + var_dump($newproductcloned2); //print __METHOD__." newproductcloned1->db must be null\n"; //$this->assertNull($newproductcloned1->db, 'newproductcloned1->db is null'); } From b9fd2302b528dbb3959cd2f13a8c479e770d9bf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Nov 2022 12:39:42 +0100 Subject: [PATCH 70/71] Trans --- htdocs/cron/card.php | 2 +- htdocs/langs/en_US/cron.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 5de627a9a9a..b7ca2c55555 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -787,7 +787,7 @@ if (($action == "create") || ($action == "edit")) { print dol_get_fiche_end(); - print "\n\n
    \n"; + print "\n\n".'
    '."\n"; if (!$user->rights->cron->create) { print ''.$langs->trans("Edit").''; } else { diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 5e4da60f0f2..46a1b834c23 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -58,7 +58,7 @@ CronNote=Comment CronFieldMandatory=Fields %s is mandatory CronErrEndDateStartDt=End date cannot be before start date StatusAtInstall=Status at module installation -CronStatusActiveBtn=Schedule +CronStatusActiveBtn=Enable scheduling CronStatusInactiveBtn=Disable CronTaskInactive=This job is disabled (not scheduled) CronId=Id From e48af2bfbba8fd8e910d37e22a19d0f9747a8960 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Nov 2022 12:48:16 +0100 Subject: [PATCH 71/71] Debug v17 --- htdocs/core/class/html.formcron.class.php | 3 ++ htdocs/cron/card.php | 14 ++++---- htdocs/cron/list.php | 43 ++++++++++++----------- htdocs/langs/en_US/cron.lang | 2 +- 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index b6a9140cf58..609458ce839 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -96,6 +96,9 @@ class FormCron extends Form $out .= ''; } + if (empty($readonly)) { + $out .= ajax_combobox($htmlname); + } return $out; } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index b7ca2c55555..9900db2c9d6 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -493,7 +493,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->datestart)) { print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'datestart', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'datestart', 1, 1, 1, "cronform"); } print ""; print ""; @@ -505,7 +505,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->dateend)) { print $form->selectDate($object->dateend, 'dateend', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'dateend', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'dateend', 1, 1, 1, "cronform"); } print ""; print ""; @@ -518,7 +518,7 @@ if (($action == "create") || ($action == "edit")) { if (!empty($object->priority)) { $priority = $object->priority; } - print " "; + print ' '; print ""; print ""; print ""; @@ -530,7 +530,7 @@ if (($action == "create") || ($action == "edit")) { $maxrun = $object->maxrun; } print $langs->trans('CronMaxRun').""; - print " "; + print ' '; print ""; print ""; print ""; @@ -538,12 +538,12 @@ if (($action == "create") || ($action == "edit")) { print ''; print $langs->trans('CronDtNextLaunch'); - print ' ('.$langs->trans('CronFrom').')'; + //print ' ('.$langs->trans('CronFrom').')'; print ""; if (!empty($object->datenextrun)) { print $form->selectDate($object->datenextrun, 'datenextrun', 1, 1, '', "cronform"); } else { - print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform"); + print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform", 1, 1); } print ""; print ""; @@ -774,7 +774,7 @@ if (($action == "create") || ($action == "edit")) { print ''; print $langs->trans('CronLastOutput').""; - print nl2br($object->lastoutput); + print ''.nl2br($object->lastoutput).''; print ""; print ''; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a2c3b1d4807..ae53242d836 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -420,7 +420,7 @@ if (!empty($conf->global->CRON_WARNING_DELAY_HOURS)) { $text .= $langs->trans("WarningCronDelayed", $conf->global->CRON_WARNING_DELAY_HOURS); } print info_admin($text); -print '
    '; +//print '
    '; //$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = ''; @@ -447,7 +447,7 @@ print ' '; print ''; print ' '; print ' '; -print ''; +print ''; print $form->selectarray('search_status', array('0'=>$langs->trans("Disabled"), '1'=>$langs->trans("Scheduled")), $search_status, 1); print ''; $searchpicto = $form->showFilterButtons(); @@ -460,18 +460,18 @@ print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "t.rowid", "", $param, '', print_liste_field_titre("CronLabel", $_SERVER["PHP_SELF"], "t.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Prority", $_SERVER["PHP_SELF"], "t.priority", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CronModule", $_SERVER["PHP_SELF"], "t.module_name", "", $param, '', $sortfield, $sortorder); -print_liste_field_titre("CronType", '', '', "", $param, '', $sortfield, $sortorder); +print_liste_field_titre("CronType", '', '', "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100 '); print_liste_field_titre("CronFrequency", '', "", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("CronDtStart", $_SERVER["PHP_SELF"], "t.datestart", "", $param, 'align="center"', $sortfield, $sortorder); //print_liste_field_titre("CronDtEnd", $_SERVER["PHP_SELF"], "t.dateend", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("CronLastResult", $_SERVER["PHP_SELF"], "t.lastresult", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("CronNbRun", $_SERVER["PHP_SELF"], "t.nbrun", "", $param, '', $sortfield, $sortorder, 'right tdoverflowmax50'); +print_liste_field_titre("CronDtLastLaunch", $_SERVER["PHP_SELF"], "t.datelastrun", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("CronLastResult", $_SERVER["PHP_SELF"], "t.lastresult", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("CronLastOutput", $_SERVER["PHP_SELF"], "t.lastoutput", "", $param, '', $sortfield, $sortorder); -print_liste_field_titre("CronDtNextLaunch", $_SERVER["PHP_SELF"], "t.datenextrun", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "t.status,t.priority", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print_liste_field_titre("CronDtNextLaunch", $_SERVER["PHP_SELF"], "t.datenextrun", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "t.status,t.priority", "", $param, '', $sortfield, $sortorder, 'center '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -560,19 +560,20 @@ if ($num > 0) { print $form->textwithpicto($text, $texttoshow, 1); print ''; - print ''; + $s = ''; if ($obj->unitfrequency == "60") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Minutes'); - } - if ($obj->unitfrequency == "3600") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Hours'); - } - if ($obj->unitfrequency == "86400") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Days'); - } - if ($obj->unitfrequency == "604800") { - print $langs->trans('CronEach')." ".($obj->frequency)." ".$langs->trans('Weeks'); + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Minutes') : $langs->trans('Minute')); + } elseif ($obj->unitfrequency == "3600") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Hours') : $langs->trans('Hour')); + } elseif ($obj->unitfrequency == "86400") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Days') : $langs->trans('Day')); + } elseif ($obj->unitfrequency == "604800") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Weeks') : $langs->trans('Week')); + } elseif ($obj->unitfrequency == "2678400") { + $s = ($obj->frequency)." ".($obj->frequency > 1 ? $langs->trans('Months') : $langs->trans('Month')); } + print ''; + print $s; print ''; /* diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 46a1b834c23..19572c361ad 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -26,7 +26,7 @@ CronCommand=Command CronList=Scheduled jobs CronDelete=Delete scheduled jobs CronConfirmDelete=Are you sure you want to delete these scheduled jobs? -CronExecute=Launch scheduled job +CronExecute=Launch now CronConfirmExecute=Are you sure you want to execute these scheduled jobs now? CronInfo=Scheduled job module allows to schedule jobs to execute them automatically. Jobs can also be started manually. CronTask=Job