From 83d7750274ffbb01e0421dc2b416f36a61ab3b7e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 27 Mar 2019 09:33:51 +0100 Subject: [PATCH 1/5] FIX missing hook completeTabsHead in margins module --- htdocs/margin/lib/margins.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index e1c2d59b7b8..e6089c00d01 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -96,6 +96,9 @@ function marges_prepare_head() $head[$h][2] = 'checkMargins'; } + complete_head_from_modules($conf,$langs,null,$head,$h,'margins','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'margins'); + return $head; } From 11343e986c94832f96ef305493d0718a5c15adbf Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 28 Mar 2019 10:47:32 +0100 Subject: [PATCH 2/5] add all missing hooks on replenish --- htdocs/product/stock/replenish.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index dfb875b6483..c9908ca9502 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -299,6 +299,12 @@ if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrep $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock,'; $sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'; + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s'; $sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))'; @@ -308,6 +314,12 @@ if($fk_supplier > 0) { if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.$fk_entrepot.')'; } + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListJoin',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= ' WHERE p.entity IN (' . getEntity('product') . ')'; if ($sall) $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) @@ -388,6 +400,11 @@ if ($usevirtualstock) } } +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -452,9 +469,15 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print '
'; print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', 'fournisseur=1', 1); print '
'; + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) print $hookmanager->resPrint; + print '
'; print ''; print '
'; + print ''; if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { @@ -533,6 +556,12 @@ print '' . $langs->trans('AlertOnly') . '& print '' . $langs->trans('Draft') . ' '; print ' '; print ''; + +// Fields from hook +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -550,6 +579,12 @@ print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $pa print_liste_field_titre('Ordered', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); + +// Hook fields +$parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print "\n"; while ($i < ($limit ? min($num, $limit) : $num)) @@ -673,6 +708,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Supplier print ''. $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier).''; + // Fields from hook + $parameters=array( 'objp'=>$objp); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } $i++; From 957fae1081bc658865bc933a8b5d1a400b3ffbdd Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 28 Mar 2019 11:07:27 +0100 Subject: [PATCH 3/5] missing params --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index c9908ca9502..1da387aeec4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -558,7 +558,7 @@ print ' '; print ''; // Fields from hook -$parameters=array(); +$parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 5588fe5b81e1a5f6b8cb744481418316558d527c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 30 Mar 2019 09:42:13 +0100 Subject: [PATCH 4/5] FIX: Don't show journal:getNomUrl without data ErrorBadValueForParamNotAString --- htdocs/compta/bank/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 38add1141f7..35357788f1b 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -637,11 +637,12 @@ else print ''.$langs->trans("AccountancyJournal").''; print ''; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($object->fk_accountancy_journal); - - print $accountingjournal->getNomUrl(0,1,1,'',1); + if (! empty($object->fk_accountancy_journal)) { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($object->fk_accountancy_journal); + print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } print ''; } From 143cbba09b336a0e7c072aadc78c98f8e9a155aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 18:49:38 +0200 Subject: [PATCH 5/5] Update card.php --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 35357788f1b..32f946d7d98 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -637,7 +637,7 @@ else print ''.$langs->trans("AccountancyJournal").''; print ''; - if (! empty($object->fk_accountancy_journal)) { + if ($object->fk_accountancy_journal > 0) { $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($object->fk_accountancy_journal);