From b06dab69307cf73c34e22f00abbd80b26127a5cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 00:44:28 +0200 Subject: [PATCH 1/2] Fix add option to restore backward compatibility --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6230f2a545f..b7c47818e39 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -172,7 +172,8 @@ function societe_prepare_head(Societe $object) } // Related items - if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled)) + if ((! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled)) + && empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][1] = $langs->trans("Referers"); From a35f010e55e76518bf4007f3261b0f039dc522e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 12:30:14 +0200 Subject: [PATCH 2/2] FIX name and position of hook FIX #11710 --- htdocs/compta/bank/treso.php | 2 +- htdocs/compta/paiement.php | 14 +++++++------- htdocs/product/fournisseurs.php | 8 ++++++-- htdocs/stripe/payment.php | 27 ++++++++++++++++++++------- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 3d9ba5e376d..7932c5dd773 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -303,7 +303,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if(empty($reshook)){ print $hookmanager->resPrint; - $solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde; + $solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde; } // solde diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 6a2965dc7c2..2da6052c63f 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -736,6 +736,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ""; + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook + // Warning print ''; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
"; @@ -746,9 +749,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ''; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook - print "\n"; $total+=$objp->total; @@ -886,11 +886,11 @@ if (! GETPOST('action','aZ09')) print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''.$objp->paiement_type.' '.$objp->num_paiement."\n"; print ''.price($objp->amount).' '; - - $parameters=array(); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook - print ''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook + $i++; } print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 08459729e87..567a3180216 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -779,12 +779,16 @@ SCRIPT; print_liste_field_titre("DiscountQtyMin",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("NbDaysToDelivery",$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre("ReputationForThisProduct",$_SERVER["PHP_SELF"],"pfp.supplier_reputation","",$param,'align="center"',$sortfield,$sortorder); + if (is_object($hookmanager)) + { + $parameters=array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); + } print_liste_field_titre(''); print "\n"; if (is_array($product_fourn_list)) { - foreach($product_fourn_list as $productfourn) { print ''; @@ -866,7 +870,7 @@ SCRIPT; if (is_object($hookmanager)) { $parameters=array('id_pfp'=>$productfourn->product_fourn_price_id,'id_fourn'=>$id_fourn,'prod_id'=>$object->id); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$object,$action); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); } // Modify-Remove diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php index 7a06da294ab..f087f6d7895 100644 --- a/htdocs/stripe/payment.php +++ b/htdocs/stripe/payment.php @@ -810,8 +810,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type == 2) { $remaindertopay=$langs->trans("RemainderToPayBack"); $multicurrencyremaindertopay=$langs->trans("MulticurrencyRemainderToPayBack"); } $i = 0; - //print ''; + print '
'; + print_barre_liste($langs->trans('StripeInvoiceList').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); print ''; print ''; @@ -830,6 +831,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->multicurrency->enabled)) { print ''; } + + $tmpinvoice =new Facture($db); + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $tmpinvoice, $action); // Note that $action and $object may have been modified by hook + print ''; print "\n"; @@ -960,6 +966,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ""; } + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook + // Warning print ''; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook - print "\n"; $total+=$objp->total; @@ -984,7 +990,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } if ($i > 1) { - $amount=round(price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT'))*100); + $amount=round(price($sign * price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits,'MT'))*100); + // Print total print ''; print ''; @@ -1003,6 +1010,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if (!empty($conf->multicurrency->enabled)) { print ''; } + print ''; print "\n"; } print "
'.$langs->trans('MulticurrencyPaymentAmount').' 
'; //print "xx".$amounts[$invoice->id]."-".$amountsresttopay[$invoice->id]."
"; @@ -970,9 +979,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print '
'.$langs->trans('TotalTTC').'
"; @@ -1100,7 +1108,12 @@ if (! GETPOST('action')) print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; + + $tmpobject = new Paiement($db); + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $tmpobject, $action); // Note that $action and $object may have been modified by hook + + print "\n"; while ($i < min($num,$limit)) { @@ -1112,7 +1125,7 @@ if (! GETPOST('action')) print ''.price($objp->amount).' '; $parameters=array(); - $reshook=$hookmanager->executeHooks('printObjectLine',$parameters,$objp,$action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook print ''; $i++;