From 1768c3d9268fcc6c42c5202af85b5da2af1ae1b1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 May 2022 10:48:34 +0200 Subject: [PATCH 1/4] Code more robust when fk_account has been corrupted --- htdocs/compta/bank/line.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index b0113149146..3661eec8e8e 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -125,7 +125,11 @@ if ($user->rights->banque->modifier && $action == "update") { $error = 0; $acline = new AccountLine($db); - $acline->fetch($rowid); + $result = $acline->fetch($rowid); + if ($result <= 0) { + dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null. + $acline->id = $rowid; + } $acsource = new Account($db); $acsource->fetch($accountoldid); From 85cddf638fbe821a052969b0a3326c13ba282efd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 May 2022 11:06:22 +0200 Subject: [PATCH 2/4] Fix can fix a corrupted lost bank account on bank account lines --- htdocs/compta/bank/line.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 3661eec8e8e..3cde5212e2d 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -334,11 +334,12 @@ if ($result) { // Bank account print ''.$langs->trans("Account").''; print ''; - if (!$objp->rappro && !$bankline->getVentilExportCompta()) { - print img_picto('', 'bank_account', 'class="paddingright"'); - print $form->select_comptes($acct->id, 'accountid', 0, '', 0, '', 0, '', 1); - } else { + // $objp->fk_account may be not > 0 if data was lost by an old bug. In such a case, we let a chance to user to fix it. + if (($objp->rappro || $bankline->getVentilExportCompta()) && $objp->fk_account > 0) { print $acct->getNomUrl(1, 'transactions', 'reflabel'); + } else { + print img_picto('', 'bank_account', 'class="paddingright"'); + print $form->select_comptes($acct->id, 'accountid', 0, '', ($acct->id > 0 ? $acct->id : 1), '', 0, '', 1); } print ''; print ''; From 7a361a3bde5f6bf9d08c3dafec1146bdc7a42170 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 May 2022 14:28:17 +0200 Subject: [PATCH 3/4] More info to help debug --- htdocs/langs/en_US/companies.lang | 1 + htdocs/modulebuilder/template/myobject_list.php | 5 ++++- htdocs/product/list.php | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index a3105a1eecd..5ad0b8e257f 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -102,6 +102,7 @@ WrongSupplierCode=Vendor code invalid CustomerCodeModel=Customer code model SupplierCodeModel=Vendor code model Gencod=Barcode +GencodBuyPrice=Barcode of price ref ##### Professional ID ##### ProfId1Short=Prof. id 1 ProfId2Short=Prof. id 2 diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 92b131d56ba..6f9b266a8c1 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -493,10 +493,13 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 26dbf18e439..ad2876c894e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -178,7 +178,7 @@ if (!empty($conf->barcode->enabled)) { $fieldstosearchall['p.barcode'] = 'Gencod'; $fieldstosearchall['pfp.barcode'] = 'GencodBuyPrice'; } -// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel' +// Personalized search criterias. Example: $conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS = 'p.ref=ProductRef;p.label=ProductLabel;p.description=Description;p.note=Note;' if (!empty($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS)) { $fieldstosearchall = dolExplodeIntoArray($conf->global->PRODUCT_QUICKSEARCH_ON_FIELDS); } @@ -800,10 +800,13 @@ if ($resql) { } if ($sall) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'."\n"; } // Filter on categories From e6c103733ed6242fd60127cd57606b7de06216fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 16 May 2022 11:06:21 +0200 Subject: [PATCH 4/4] dlc dluo are inverted --- htdocs/reception/card.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index c4a3b108b34..9e4cb346398 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -352,8 +352,10 @@ if (empty($reshook)) { } $qty = "qtyl".$i; $comment = "comment".$i; - $eatby = "dlc".$i; - $sellby = "dluo".$i; + // EATBY <-> DLUO see productbatch.class.php + // SELLBY <-> DLC + $eatby = "dluo".$i; + $sellby = "dlc".$i; $batch = "batch".$i; $cost_price = "cost_price".$i; @@ -628,9 +630,11 @@ if (empty($reshook)) { $batch = "batch".$line_id; $dlc = "dlc".$line_id; $dluo = "dluo".$line_id; - $eatby = GETPOST($dlc, 'alpha'); + // EATBY <-> DLUO + $eatby = GETPOST($dluo, 'alpha'); $eatbydate = str_replace('/', '-', $eatby); - $sellby = GETPOST($dluo, 'alpha'); + // SELLBY <-> DLC + $sellby = GETPOST($dlc, 'alpha'); $sellbydate = str_replace('/', '-', $sellby); $line->batch = GETPOST($batch, 'alpha'); $line->eatby = strtotime($eatbydate); @@ -641,8 +645,7 @@ if (empty($reshook)) { setEventMessages($line->error, $line->errors, 'errors'); $error++; } - } else // Product no predefined - { + } else { // Product no predefined $qty = "qtyl".$line_id; $line->id = $line_id; $line->qty = GETPOST($qty, 'int');