From 3006cf770c696654456846c54578a57a7aa50856 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 01:06:59 +0100 Subject: [PATCH 01/14] FIX Timeout during import --- htdocs/imports/import.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c6e2e282778..8cd1b826ab0 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1545,6 +1545,14 @@ if ($step == 5 && $datatoimport) } else { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + // Launch import $arrayoferrors = array(); $arrayofwarnings = array(); From 1b559355776147798eceec97db55976bd39a02b7 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 5 Feb 2021 10:39:46 +0100 Subject: [PATCH 02/14] Add critical price patch from 12 to 11. --- htdocs/product/price.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3f6a89cbddb..c364cd464fc 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1442,11 +1442,11 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul // Il doit au moins y avoir la ligne de prix initial. // On l'ajoute donc pour remettre a niveau (pb vieilles versions) //$object->updatePrice($object->price, $object->price_base_type, $user, $object->tva_tx, $object->price_min); - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { - $object->updatePrice($object->multiprices[1], $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), $object->multiprices_min[1], 1); - } else { - $object->updatePrice($object->price, $object->price_base_type, $user, $object->tva_tx, $object->price_min); - } + if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + $object->updatePrice(($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_ttc[1] : $object->multiprices[1]), $object->multiprices_base_type[1], $user, (empty($object->multiprices_tva_tx[1]) ? 0 : $object->multiprices_tva_tx[1]), ($object->multiprices_base_type[1] == 'TTC' ? $object->multiprices_min_ttc[1] : $object->multiprices_min[1]), 1); + } else { + $object->updatePrice(($object->price_base_type == 'TTC' ? $object->price_ttc : $object->price), $object->price_base_type, $user, $object->tva_tx, ($object->price_base_type == 'TTC' ? $object->price_min_ttc : $object->price_min)); + } $result = $db->query($sql); $num = $db->num_rows($result); From 3f862bf43ee33cfc16ce7a193312efcebae092a9 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 5 Feb 2021 11:34:39 +0100 Subject: [PATCH 03/14] FIX 10.0 - before crediting a withdrawal receipt, check whether it has been credited already --- htdocs/compta/prelevement/card.php | 44 ++++++++++++++++++----------- htdocs/langs/en_US/withdrawals.lang | 1 + htdocs/langs/fr_FR/withdrawals.lang | 1 + 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index bf95a35f1fd..1e3f1f49d23 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -85,16 +85,21 @@ if (empty($reshook)) } } - // Seems to no be used and replaced with $action == 'infocredit' - if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') - { - $res=$object->set_credite(); - if ($res >= 0) - { - header("Location: card.php?id=".$id); - exit; - } - } + // Seems to no be used and replaced with $action == 'infocredit' + if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') + { + if ($object->statut == 2) { + $res = -1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $res=$object->set_credite(); + } + if ($res >= 0) + { + header("Location: card.php?id=".$id); + exit; + } + } if ($action == 'infotrans' && $user->rights->prelevement->bons->send) { @@ -135,14 +140,19 @@ if (empty($reshook)) { $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); - $error = $object->set_infocredit($user, $dt); + if ($object->statut == 2) { + $error = 1; + setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); + } else { + $error = $object->set_infocredit($user, $dt); + } - if ($error) - { - header("Location: card.php?id=".$id."&error=$error"); - exit; - } - } + if ($error) + { + header("Location: card.php?id=".$id."&error=$error"); + exit; + } + } } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index cbca2b2f103..45cf89c8592 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -27,6 +27,7 @@ MakeWithdrawRequest=Make a direct debit payment request WithdrawRequestsDone=%s direct debit payment requests recorded ThirdPartyBankCode=Third-party bank code NoInvoiceCouldBeWithdrawed=No invoice debited successfully. Check that invoices are on companies with a valid IBAN and that IBAN has a UMR (Unique Mandate Reference) with mode %s. +WithdrawalCantBeCreditedTwice=This withdrawal receipt is already marked as credited; this can't be done twice, as this would potentially create duplicate payments and bank entries. ClassCredited=Classify credited ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account? TransData=Transmission date diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index 468cdd8b9f3..ea8fadeedba 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -27,6 +27,7 @@ MakeWithdrawRequest=Faire une demande de prélèvement WithdrawRequestsDone=%s demandes de prélèvements enregistrées ThirdPartyBankCode=Code banque du tiers NoInvoiceCouldBeWithdrawed=Aucune facture traitée avec succès. Vérifiez que les factures sont sur les sociétés avec un BAN par défaut valide et que le BAN a un RUM avec le mode %s . +WithdrawalCantBeCreditedTwice=Ce bon de prélèvement est déjà classé crédité ; cette opération ne peut pas être réalisée deux fois, car cela pourrait engendrer des doublons dans les paiements et les écritures bancaires. ClassCredited=Classer crédité ClassCreditedConfirm=Êtes-vous sûr de vouloir classer ce bon de prélèvement comme crédité sur votre compte bancaire ? TransData=Date de transmission From cdd2c165ef4b706091d0793348a4534524140d28 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Fri, 5 Feb 2021 11:36:12 +0100 Subject: [PATCH 04/14] add missing hook addMoreActionsButtons in viewcat.php --- htdocs/categories/viewcat.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 958b77e42e8..5ad45f6b420 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -269,16 +269,19 @@ dol_fiche_end(); */ print "
\n"; +$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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)) { + if ($user->rights->categorie->creer) + { + $socid = ($object->socid ? "&socid=".$object->socid : ""); + print "".$langs->trans("Modify").""; + } -if ($user->rights->categorie->creer) -{ - $socid = ($object->socid ? "&socid=".$object->socid : ""); - print "".$langs->trans("Modify").""; -} - -if ($user->rights->categorie->supprimer) -{ - print "".$langs->trans("Delete").""; + if ($user->rights->categorie->supprimer) + { + print "".$langs->trans("Delete").""; + } } print "
"; From ac83cea83a3ee98c56baf7c8481e16dd7903efdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 14:34:04 +0100 Subject: [PATCH 05/14] Fix avoid to run import twice by clicking on tab step6 Fix timeout for real import step --- htdocs/core/lib/import.lib.php | 6 +++- .../modules/import/import_csv.modules.php | 3 +- .../modules/import/import_xlsx.modules.php | 3 +- htdocs/imports/import.php | 34 +++++++++++++------ 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/import.lib.php b/htdocs/core/lib/import.lib.php index 8fa6a995331..385dee32a86 100644 --- a/htdocs/core/lib/import.lib.php +++ b/htdocs/core/lib/import.lib.php @@ -43,7 +43,11 @@ function import_prepare_head($param, $maxstep = 0) $i = 1; while ($i <= $maxstep) { - $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; + if ($i < 6) { + $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step='.$i.$param; + } else { + $head[$h][0] = DOL_URL_ROOT.'/imports/import.php?step=5'.$param; // For step6, link is to step 5 + } $head[$h][1] = $langs->trans("Step")." ".$i; $head[$h][2] = 'step'.$i; $h++; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 36dc3ca8f13..e7386f0b7e4 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -618,6 +618,7 @@ class ImportCsv extends ModeleImports if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) { // If test is "Must exist in a field@table or field@table:..." + $reg = array(); if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field = $reg[1]; @@ -844,7 +845,7 @@ class ImportCsv extends ModeleImports $sqlend .= ', '.$user->id; } $sql = $sqlstart.$sqlend.')'; - dol_syslog("import_csv.modules", LOG_DEBUG); + //dol_syslog("import_csv.modules", LOG_DEBUG); // Run insert request if ($sql) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index c427e01a758..6c0bcc0f4b1 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -636,6 +636,7 @@ class ImportXlsx extends ModeleImports // Test regexp if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) { // If test is "Must exist in a field@table or field@table:..." + $reg = array(); if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) { $field = $reg[1]; $table = $reg[2]; @@ -845,7 +846,7 @@ class ImportXlsx extends ModeleImports $sqlend .= ', ' . $user->id; } $sql = $sqlstart . $sqlend . ')'; - dol_syslog("import_xlsx.modules", LOG_DEBUG); + //dol_syslog("import_xlsx.modules", LOG_DEBUG); // Run insert request if ($sql) { diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 8814fa584fa..6921db8ce99 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1255,6 +1255,14 @@ if ($step == 4 && $datatoimport) // STEP 5: Summary of choices and launch simulation if ($step == 5 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); @@ -1518,14 +1526,6 @@ if ($step == 5 && $datatoimport) } print ''; } else { - $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined - $max_time = @ini_get("max_execution_time"); - if ($max_time && $max_time < $max_execution_time_for_importexport) - { - dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); - @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 - } - // Launch import $arrayoferrors = array(); $arrayofwarnings = array(); @@ -1603,8 +1603,10 @@ if ($step == 5 && $datatoimport) // Show OK if (!count($arrayoferrors) && !count($arrayofwarnings)) { print '
'.img_picto($langs->trans("OK"), 'tick').' '.$langs->trans("NoError").'


'; + print '
'; print $langs->trans("NbInsert", $obj->nbinsert).'
'; print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print '
'; } else print $langs->trans("NbOfLinesOK", $nbok).'

'; // Show Errors @@ -1692,9 +1694,17 @@ if ($step == 5 && $datatoimport) // STEP 6: Real import if ($step == 6 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); - $importid = $_REQUEST["importid"]; + $importid = GETPOST("importid", 'alphanohtml'); // Create classe to use for import @@ -1970,12 +1980,14 @@ if ($step == 6 && $datatoimport) // Show result print '
'; - print '
'; + print '
'; print $langs->trans("NbOfLinesImported", $nbok).'
'; print $langs->trans("NbInsert", $obj->nbinsert).'
'; print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print '
'; + print '
'; print $langs->trans("FileWasImported", $importid).'
'; - print $langs->trans("YouCanUseImportIdToFindRecord", $importid).'
'; + print ''.$langs->trans("YouCanUseImportIdToFindRecord", $importid).'
'; print '
'; } From e9fa5a647d9bf66dd0ac3f6103cb3c5be9602d85 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 14:35:10 +0100 Subject: [PATCH 06/14] Fix import --- htdocs/imports/import.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 8cd1b826ab0..0ad5bbd7873 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1269,6 +1269,14 @@ if ($step == 4 && $datatoimport) // STEP 5: Summary of choices and launch simulation if ($step == 5 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); @@ -1545,14 +1553,6 @@ if ($step == 5 && $datatoimport) } else { - $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined - $max_time = @ini_get("max_execution_time"); - if ($max_time && $max_time < $max_execution_time_for_importexport) - { - dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); - @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 - } - // Launch import $arrayoferrors = array(); $arrayofwarnings = array(); @@ -1726,6 +1726,14 @@ if ($step == 5 && $datatoimport) // STEP 6: Real import if ($step == 6 && $datatoimport) { + $max_execution_time_for_importexport = (empty($conf->global->IMPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->IMPORT_MAX_EXECUTION_TIME); // 5mn if not defined + $max_time = @ini_get("max_execution_time"); + if ($max_time && $max_time < $max_execution_time_for_importexport) + { + dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); + @ini_set("max_execution_time", $max_execution_time_for_importexport); // This work only if safe mode is off. also web servers has timeout of 300 + } + $model = $format; $liste = $objmodelimport->liste_modeles($db); $importid = $_REQUEST["importid"]; From dbfeba661d47f9b130aaf370e5c20cb4294c45b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 14:51:54 +0100 Subject: [PATCH 07/14] Fix value show 0 if empty --- htdocs/imports/import.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 6921db8ce99..344ede7d0cd 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -1604,8 +1604,8 @@ if ($step == 5 && $datatoimport) if (!count($arrayoferrors) && !count($arrayofwarnings)) { print '
'.img_picto($langs->trans("OK"), 'tick').' '.$langs->trans("NoError").'


'; print '
'; - print $langs->trans("NbInsert", $obj->nbinsert).'
'; - print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'
'; + print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'

'; print '
'; } else print $langs->trans("NbOfLinesOK", $nbok).'

'; @@ -1982,8 +1982,8 @@ if ($step == 6 && $datatoimport) print '
'; print '
'; print $langs->trans("NbOfLinesImported", $nbok).'
'; - print $langs->trans("NbInsert", $obj->nbinsert).'
'; - print $langs->trans("NbUpdate", $obj->nbupdate).'

'; + print $langs->trans("NbInsert", empty($obj->nbinsert) ? 0 : $obj->nbinsert).'
'; + print $langs->trans("NbUpdate", empty($obj->nbupdate) ? 0 : $obj->nbupdate).'

'; print '
'; print '
'; print $langs->trans("FileWasImported", $importid).'
'; From 653fa38b061875d9a7411f6ce1b77e36e16d72f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 15:07:07 +0100 Subject: [PATCH 08/14] Fix autoselect of category with 'auto' --- htdocs/categories/card.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index feca9c4f204..74e16f9082d 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -210,7 +210,7 @@ llxHeader("", $langs->trans("Categories"), $helpurl); if ($user->rights->categorie->creer) { // Create or add - if ($action == 'create' || $_POST["addcat"] == 'addcat') + if ($action == 'create' || GETPOST("addcat") == 'addcat') { dol_set_focus('#label'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2482795147a..0348a01de3f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4174,7 +4174,7 @@ class Form $output .= ''; foreach ($cate_arbo as $key => $value) { - if ($cate_arbo[$key]['id'] == $selected || ($selected == 'auto' && count($cate_arbo) == 1)) + if ($cate_arbo[$key]['id'] == $selected || ($selected === 'auto' && count($cate_arbo) == 1)) { $add = 'selected '; } else { From 9843e79bace6ac633a2feeb8293337d49814e158 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 5 Feb 2021 15:43:03 +0100 Subject: [PATCH 09/14] Trans --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc10b054606..f5770bad737 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -444,8 +444,8 @@ ExtrafieldParamHelpPassword=Leaving this field blank means this value will be st ExtrafieldParamHelpselect=List of values must be lines with format key,value (where key can't be '0')

for example:
1,value1
2,value2
code3,value3
...

In order to have the list depending on another complementary attribute list:
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

In order to have the list depending on another list:
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value (where key can't be '0')

for example:
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')

for example:
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=List of values comes from a table
Syntax: table_name:label_field:id_field::filter
Example: c_typent:libelle:id::filter

- id_field is necessarly a primary int key
- filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter which is the current id of current object
To use a SELECT into the filter use the keyword $SEL$ to bypass anti-injection protection.
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter -ExtrafieldParamHelpchkbxlst=List of values comes from a table
Syntax: table_name:label_field:id_field::filter
Example: c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpsellist=List of values comes from a table
Syntax: table_name:label_field:id_field::filtersql
Example: c_typent:libelle:id::filtersql

- id_field is necessarly a primary int key
- filtersql is a SQL condition. It can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter which is the current id of current object
To use a SELECT into the filter use the keyword $SEL$ to bypass anti-injection protection.
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpchkbxlst=List of values comes from a table
Syntax: table_name:label_field:id_field::filtersql
Example: c_typent:libelle:id::filtersql

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax: ObjectName:Classpath ExtrafieldParamHelpSeparator=Keep empty for a simple separator
Set this to 1 for a collapsing separator (open by default for new session, then status is kept for each user session)
Set this to 2 for a collapsing separator (collapsed by default for new session, then status is kept fore each user session) LibraryToBuildPDF=Library used for PDF generation From 4477578766bfa1adf6abdfb7fff532b6204a093b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 5 Feb 2021 17:30:41 +0100 Subject: [PATCH 10/14] FIX takepos : load date function fix loading dol_get_first_hour() --- htdocs/takepos/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b641efd2502..8062368d360 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales $action = GETPOST('action', 'aZ09'); From 7b351924765d6015b2ad680a914fc859f60bb4b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Feb 2021 00:15:07 +0100 Subject: [PATCH 11/14] Fix bad label --- 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 84d4ddc3679..85a45e9ff45 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -643,7 +643,7 @@ class Setup extends DolibarrApi public function getListOfShipmentMethods($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { $list = array(); - $sql = "SELECT t.rowid, t.code, t.libelle, t.description, t.tracking"; + $sql = "SELECT t.rowid, t.code, t.libelle as label, t.description, t.tracking"; $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; $sql .= " WHERE t.active = ".$active; // Add sql filters From 83f24e6fd27f5992661e60fc44e9b393189721dd Mon Sep 17 00:00:00 2001 From: werewolf7160 <31860486+werewolf7160@users.noreply.github.com> Date: Fri, 5 Feb 2021 12:44:55 +0100 Subject: [PATCH 12/14] call to createCommon() return int and not bool with generated Object, the post request call to createCommon() in it and taht function return a int (id or -1 if error). but the test on the returned value is a '!', that don't return false on "-1". a post request with an sql error for example(foreign key error for my test), will always return 200 instead of 500 with the error --- htdocs/modulebuilder/template/class/api_mymodule.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 05ca7f27d16..2e04e34dcac 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -203,7 +203,7 @@ class MyModuleApi extends DolibarrApi foreach ($request_data as $field => $value) { $this->myobject->$field = $value; } - if (!$this->myobject->create(DolibarrApiAccess::$user)) { + if ($this->myobject->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); } return $this->myobject->id; From c15deff817ac9945792c6c6ecefce9783193434c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Feb 2021 00:30:44 +0100 Subject: [PATCH 13/14] FIX #16185 --- htdocs/compta/paiement/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e1f6fb38dbc..e2e9e63ba28 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -148,7 +148,7 @@ llxHeader('', $langs->trans('ListPayment')); if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. - $sql = "SELECT p.ref, p.datep, p.amount, p.statut, p.num_paiement"; + $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; // Add fields from hooks @@ -166,7 +166,7 @@ if (GETPOST("orphelins", "alpha")) { $sql .= $hookmanager->resPrint; } else { // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql = "SELECT DISTINCT p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement"; + $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement"; $sql .= ", c.code as paiement_code"; $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; @@ -390,7 +390,7 @@ while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); $object->id = $objp->rowid; - $object->ref = $objp->ref; + $object->ref = ($objp->ref ? $objp->ref : $objp->rowid); $companystatic->id = $objp->socid; $companystatic->name = $objp->name; From bee08492909488a71a07a9b268fe708f6e2cdad7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 6 Feb 2021 00:42:53 +0100 Subject: [PATCH 14/14] Fix when nothing found, we should show message nothing found --- htdocs/compta/paiement/list.php | 8 ++++++++ htdocs/societe/list.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e2e9e63ba28..cfcdead5fed 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -497,6 +497,14 @@ while ($i < min($num, $limit)) { // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + print ""; print "
"; print ""; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5b5e9685628..0df74bc166e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1343,6 +1343,14 @@ while ($i < min($num, $limit)) $i++; } +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''.$langs->trans("NoRecordFound").''; +} + $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);