From 8198276d64856cd7fe9cf27c9d6a9e39c63dce7f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 13 Aug 2019 17:47:30 +0200 Subject: [PATCH 1/8] FIX for MAIN_MAXTABS_IN_CARD = $i card --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e9f4301f8f2..a46bd661eb2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1130,7 +1130,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) { // If active tab is already present - if ($i >= $limittoshow) $limittoshow--; + if ($i > $limittoshow) $limittoshow--; } } @@ -1146,7 +1146,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $isactive=false; } - if ($i < $limittoshow || $isactive) + if ($i <= $limittoshow || $isactive) { $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') From 93d64bb84e3278891a52332bae037a31df58329f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 13 Aug 2019 17:59:19 +0200 Subject: [PATCH 2/8] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a46bd661eb2..9d85ab85048 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1130,7 +1130,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) { // If active tab is already present - if ($i > $limittoshow) $limittoshow--; + if ($i >= $limittoshow) $limittoshow--; } } From 5613532b80474f28bcb00cbb389c9a59fede2f25 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 21 Aug 2019 13:30:31 +0200 Subject: [PATCH 3/8] Fix context in takepos need downgrade in v10 of this PR fo fix hiden context https://github.com/Dolibarr/dolibarr/pull/11629 --- htdocs/societe/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 964812a05a3..daff9aec557 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -596,6 +596,7 @@ print ''; print ''; print ''; +print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, $newcardbutton, '', $limit); From b06dab69307cf73c34e22f00abbd80b26127a5cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 00:44:28 +0200 Subject: [PATCH 4/8] 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 a19228ccc043e26d87f97df48d0edd886adf89e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 10:38:45 +0200 Subject: [PATCH 5/8] Fix compatibility with twofactor Conflicts: htdocs/api/class/api_login.class.php htdocs/dav/fileserver.php --- htdocs/api/class/api_login.class.php | 2 ++ htdocs/dav/fileserver.php | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 2bf464f7296..080dca889b5 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -63,6 +63,8 @@ class Login // Authentication mode if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'http,dolibarr'; + $dolibarr_main_authentication = preg_replace('/twofactor/', 'dolibarr', $dolibarr_main_authentication); + // Authentication mode: forceuser if ($dolibarr_main_authentication == 'forceuser') { diff --git a/htdocs/dav/fileserver.php b/htdocs/dav/fileserver.php index 4e99cf92613..05dc3978be9 100644 --- a/htdocs/dav/fileserver.php +++ b/htdocs/dav/fileserver.php @@ -81,6 +81,19 @@ $authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $p // Authentication mode if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr'; + $dolibarr_main_authentication = preg_replace('/twofactor/', 'dolibarr', $dolibarr_main_authentication); + + // Authentication mode: forceuser + if ($dolibarr_main_authentication == 'forceuser') + { + if (empty($dolibarr_auto_user)) $dolibarr_auto_user='auto'; + if ($dolibarr_auto_user != $username) + { + dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode."); + return false; + } + } + $authmode = explode(',', $dolibarr_main_authentication); $entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1)); From 923eb935eb004eb9ed3239612dc9bde3c5e04980 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 11:28:49 +0200 Subject: [PATCH 6/8] Revert "FIX for MAIN_MAXTABS_IN_CARD = $i card" --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 20f595a562b..24a87c15032 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1147,7 +1147,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab $isactive=false; } - if ($i <= $limittoshow || $isactive) + if ($i < $limittoshow || $isactive) { $out.='
'; if (isset($links[$i][2]) && $links[$i][2] == 'image') From cdda08c0d3200ece5b7e0eb6a1c22b46c1b9beae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 11:47:03 +0200 Subject: [PATCH 7/8] FIX #11685 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 24a87c15032..625cbbee4b7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1209,7 +1209,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab } if ($popuptab) $outmore.='
'; - if ($displaytab > $limittoshow) + if ($popuptab) // If there is some tabs not shown { $left=($langs->trans("DIRECTION") == 'rtl'?'right':'left'); $right=($langs->trans("DIRECTION") == 'rtl'?'left':'right'); From a35f010e55e76518bf4007f3261b0f039dc522e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 22 Aug 2019 12:30:14 +0200 Subject: [PATCH 8/8] 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++;