From 74ac69fc5a27768c5644865933b3980109d483f6 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Thu, 27 Feb 2020 09:16:15 +0100 Subject: [PATCH 01/52] Add Entity in list_product_fournisseur_price() Select too the entity value to add const NOTMODIFYOTHERENTITYFOURNPRICE --- .../fourn/class/fournisseur.product.class.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 9f49fb31b83..f11f88464f3 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1,12 +1,13 @@ - * Copyright (C) 2006-2011 Laurent Destailleur - * Copyright (C) 2009-2014 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2015 Marcos García - * Copyright (C) 2016 Charlie Benke - * Copyright (C) 2019 Frédéric France +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2009-2014 Regis Houssin + * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2015 Marcos García + * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2019 Frédéric France + * Copyright (C) 2020 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -590,7 +591,7 @@ class ProductFournisseur extends Product global $conf; $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; - $sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; + $sql.= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql.= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; $sql.= " pfp.barcode, pfp.fk_barcode_type"; @@ -616,6 +617,7 @@ class ProductFournisseur extends Product $prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"]; $prodfourn->product_fourn_id = $record["product_fourn_id"]; + $prodfourn->product_fourn_entity = $record["entity"]; $prodfourn->fourn_ref = $record["ref_fourn"]; $prodfourn->ref_supplier = $record["ref_fourn"]; $prodfourn->desc_supplier = $record["desc_fourn"]; From 84764771373f06b9fd62ea691ddac377bbdfe848 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Thu, 27 Feb 2020 09:19:39 +0100 Subject: [PATCH 02/52] add const NOTMODIFYOTHERENTITYFOURNPRICE if const NOTMODIFYOTHERENTITYFOURNPRICE, can't modify other shared fourn prices. --- htdocs/product/fournisseurs.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 0bda7d44564..797f350627e 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1,14 +1,15 @@ - * Copyright (C) 2004-2013 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2012 Juanjo Menent - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2014 Ion Agorria - * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2019 Frédéric France +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2014 Ion Agorria + * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2019 Frédéric France + * Copyright (C) 2020 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -933,7 +934,14 @@ SCRIPT; // Modify-Remove print ''; - if ($usercancreate) + + if (!empty($conf->global->NOTMODIFYOTHERENTITYFOURNPRICE) && $productfourn->product_fourn_entity!=$conf->entity) { + $canmodifyotherentityfournprice = 0; + }else{ + $canmodifyotherentityfournprice = 1; + } + + if ($usercancreate && $canmodifyotherentityfournprice == 1) { print ''.img_edit().""; print '   '; From 5dc403cb664fe3c1397fc3cbb9b7469dfc816466 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Mar 2020 12:19:24 +0100 Subject: [PATCH 03/52] FIX #13304 --- htdocs/expensereport/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index a05fd1393bb..03cafb6b60d 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -277,7 +277,9 @@ $sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.tota $sql.= " d.date_debut, d.date_fin, d.date_create, d.tms as date_modif, d.date_valid, d.date_approve, d.note_private, d.note_public,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname, u.login, u.email, u.statut, u.photo"; // Add fields from extrafields -foreach ($extrafields->attributes['expensereport']['type'] as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +if (is_array($extrafields->attributes['expensereport']['type'])) { + foreach ($extrafields->attributes['expensereport']['type'] as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook From c2b11782730b80a1f8df6a0e38b5f44cd99eacc7 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Mon, 16 Mar 2020 07:55:15 +0100 Subject: [PATCH 04/52] Add substitution for user_civility for ODT --- .../core/class/commondocgenerator.class.php | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 279eb1f7a6b..bd3dcb01e76 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -267,33 +267,34 @@ abstract class CommonDocGenerator $object->state = getState($object->state_code, 0); } - $array_contact = array( - $array_key.'_fullname' => $object->getFullName($outputlangs, 1), - $array_key.'_lastname' => $object->lastname, - $array_key.'_firstname' => $object->firstname, - $array_key.'_address' => $object->address, - $array_key.'_zip' => $object->zip, - $array_key.'_town' => $object->town, - $array_key.'_state_id' => $object->state_id, - $array_key.'_state_code' => $object->state_code, - $array_key.'_state' => $object->state, - $array_key.'_country_id' => $object->country_id, - $array_key.'_country_code' => $object->country_code, - $array_key.'_country' => $object->country, - $array_key.'_poste' => $object->poste, - $array_key.'_socid' => $object->socid, - $array_key.'_statut' => $object->statut, - $array_key.'_code' => $object->code, - $array_key.'_email' => $object->email, - $array_key.'_jabberid' => $object->jabberid, - $array_key.'_phone_pro' => $object->phone_pro, - $array_key.'_phone_perso' => $object->phone_perso, - $array_key.'_phone_mobile' => $object->phone_mobile, - $array_key.'_fax' => $object->fax, - $array_key.'_birthday' => $object->birthday, - $array_key.'_default_lang' => $object->default_lang, - $array_key.'_note_public' => $object->note_public, - $array_key.'_note_private' => $object->note_private + $array_contact = array ( + $array_key . '_fullname' => $object->getFullName($outputlangs, 1), + $array_key . '_lastname' => $object->lastname, + $array_key . '_firstname' => $object->firstname, + $array_key . '_address' => $object->address, + $array_key . '_zip' => $object->zip, + $array_key . '_town' => $object->town, + $array_key . '_state_id' => $object->state_id, + $array_key . '_state_code' => $object->state_code, + $array_key . '_state' => $object->state, + $array_key . '_country_id' => $object->country_id, + $array_key . '_country_code' => $object->country_code, + $array_key . '_country' => $object->country, + $array_key . '_poste' => $object->poste, + $array_key . '_socid' => $object->socid, + $array_key . '_statut' => $object->statut, + $array_key . '_code' => $object->code, + $array_key . '_email' => $object->email, + $array_key . '_jabberid' => $object->jabberid, // deprecated + $array_key . '_phone_pro' => $object->phone_pro, + $array_key . '_phone_perso' => $object->phone_perso, + $array_key . '_phone_mobile' => $object->phone_mobile, + $array_key . '_fax' => $object->fax, + $array_key . '_birthday' => $object->birthday, + $array_key . '_default_lang' => $object->default_lang, + $array_key . '_note_public' => $object->note_public, + $array_key . '_note_private' => $object->note_private, + $array_key . '_civility' => $object->civility, ); // Retrieve extrafields From 564f4129578cd1b5de730af0807ac3d673ef8a07 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 17 Mar 2020 10:04:43 +0100 Subject: [PATCH 05/52] correction due to comments @hregis and @eldy --- htdocs/product/fournisseurs.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 797f350627e..843a32c57a4 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -53,6 +53,7 @@ $socid=GETPOST('socid', 'int'); $cost_price=GETPOST('cost_price', 'alpha'); $backtopage=GETPOST('backtopage', 'alpha'); $error=0; +$canmodifyotherentityfournprice = 1 // If socid provided by ajax company selector if (! empty($_REQUEST['search_fourn_id'])) @@ -935,12 +936,6 @@ SCRIPT; // Modify-Remove print ''; - if (!empty($conf->global->NOTMODIFYOTHERENTITYFOURNPRICE) && $productfourn->product_fourn_entity!=$conf->entity) { - $canmodifyotherentityfournprice = 0; - }else{ - $canmodifyotherentityfournprice = 1; - } - if ($usercancreate && $canmodifyotherentityfournprice == 1) { print ''.img_edit().""; From 26f6f04486448c4071c8ac5c35fd63daebf5082e Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 17 Mar 2020 10:08:18 +0100 Subject: [PATCH 06/52] forgot ";" --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 843a32c57a4..d7238a72174 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -53,7 +53,7 @@ $socid=GETPOST('socid', 'int'); $cost_price=GETPOST('cost_price', 'alpha'); $backtopage=GETPOST('backtopage', 'alpha'); $error=0; -$canmodifyotherentityfournprice = 1 +$canmodifyotherentityfournprice = 1 ; // If socid provided by ajax company selector if (! empty($_REQUEST['search_fourn_id'])) From 45579b0986f5bdd3d7534ec4370e44765520a433 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 23 Mar 2020 07:01:23 +0100 Subject: [PATCH 07/52] FIX remove unused var, $usercancreate can be change by Multicompany --- htdocs/product/fournisseurs.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index d7238a72174..254f462d07e 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -53,7 +53,6 @@ $socid=GETPOST('socid', 'int'); $cost_price=GETPOST('cost_price', 'alpha'); $backtopage=GETPOST('backtopage', 'alpha'); $error=0; -$canmodifyotherentityfournprice = 1 ; // If socid provided by ajax company selector if (! empty($_REQUEST['search_fourn_id'])) @@ -935,8 +934,8 @@ SCRIPT; // Modify-Remove print ''; - - if ($usercancreate && $canmodifyotherentityfournprice == 1) + + if ($usercancreate) { print ''.img_edit().""; print '   '; From 53850caa870c5fe8d861a29b34dd4564cec2203a Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 23 Mar 2020 22:44:26 +0100 Subject: [PATCH 08/52] No reload page to load other sale in TakePOS --- htdocs/takepos/invoice.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 51536ba8133..290d0df9443 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -733,17 +733,17 @@ $( document ).ready(function() { while ($obj = $db->fetch_object($resql)) { echo '$("#customerandsales").append(\''; if ($placeid==$obj->rowid) echo ""; - echo 'ref)); echo $num_sale; if (str_replace("-", "", $num_sale)>$max_sale) $max_sale=str_replace("-", "", $num_sale); - echo '\\\'">'.date('H:i', strtotime($obj->datec)); + echo '\\\';Refresh();">'.date('H:i', strtotime($obj->datec)); if ($placeid==$obj->rowid) echo ""; echo '\');'; } - echo '$("#customerandsales").append(\'\');'; + echo '\\\';Refresh();">\');'; } else { dol_print_error($db); } From 585c46b181058694079c682869ebe54766a54187 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 23 Mar 2020 22:58:04 +0100 Subject: [PATCH 09/52] Avoid print customer name when is default --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 290d0df9443..6251b5b57b0 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -717,7 +717,7 @@ $( document ).ready(function() { trans("Customer"); - if ($invoice->socid != $conf->global->$constforcompanyid) { + if ($invoice->id > 0 && ($invoice->socid != $conf->global->$constforcompanyid)) { $s = $soc->name; } ?> From 58a10c9c1633c53e0814acb7d2e81f867e443f48 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 23 Mar 2020 23:10:55 +0100 Subject: [PATCH 10/52] Unnecessary line --- htdocs/takepos/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 2ce3f31211b..9f3a259e441 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -733,7 +733,6 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { ?>
-
From a5379c71443c7b385f69bb3fbe558895c0b1a051 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 13:10:35 +0100 Subject: [PATCH 11/52] FIX All forms must use newToken() Conflicts: htdocs/commande/card.php htdocs/compta/cashcontrol/cashcontrol_card.php htdocs/supplier_proposal/card.php --- .../bookkeeping/thirdparty_lettering_customer.php | 2 +- .../bookkeeping/thirdparty_lettering_supplier.php | 2 +- htdocs/adherents/cartes/carte.php | 6 +++--- htdocs/adherents/type.php | 2 +- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/agenda_reminder.php | 2 +- htdocs/admin/clicktodial.php | 2 +- htdocs/admin/fckeditor.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/comm/action/pertype.php | 2 +- htdocs/comm/action/peruser.php | 2 +- htdocs/comm/propal/card.php | 8 ++++---- htdocs/commande/card.php | 10 +++++----- htdocs/compta/cashcontrol/cashcontrol_card.php | 2 +- htdocs/compta/facture/card-rec.php | 2 +- htdocs/compta/facture/card.php | 6 +++--- htdocs/core/lib/agenda.lib.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/product/price.php | 8 ++++---- htdocs/reception/card.php | 2 +- htdocs/societe/price.php | 4 ++-- htdocs/supplier_proposal/card.php | 13 ++++++++----- 24 files changed, 46 insertions(+), 43 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 9cb863aec7d..33563b7b57a 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -197,7 +197,7 @@ if ($resql) { $param="&socid=".$socid; print '
'; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 61e5e34da99..54aec9490b4 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -195,7 +195,7 @@ if ($resql) { $param="&socid=".$socid; print ''; - print ''; + print ''; print ''; $letteringbutton = ''; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index e7686a0a055..6736a22cd5d 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -259,7 +259,7 @@ print '
'; print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -279,7 +279,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_CARD_TYPE").' '; @@ -299,7 +299,7 @@ print '

'; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print ''; -print ''; +print ''; print ''; print ''; print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 11360ad4652..4590254ebf6 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -605,7 +605,7 @@ if ($rowid > 0) } print ''; - print ''; + print ''; print ''; print '
'; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 0ea6a932fe7..0a86aa9b5e6 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -324,7 +324,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) } print ''; -print ''; +print ''; print ''; print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 614d4ef4407..b641dd74fe2 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -180,7 +180,7 @@ $head=agenda_prepare_head(); dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); print ''; -print ''; +print ''; print ''; print '
'."\n"; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 03c4eeb66cf..3fb3340a702 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -119,7 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL)) if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest'); print ''; - print ''; + print ''; print $langs->trans("LinkToTestClickToDial", $user->login).' : '; print ''; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index efe8ca1117d..3bbd23fa7d6 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -185,7 +185,7 @@ else print '
'."\n"; print ''."\n"; - print ''; + print ''; // Skins show_skin(null, 1); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 3f1be6c7e4c..3320c160fc2 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -546,7 +546,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 04f334a9551..5591741997e 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -248,7 +248,7 @@ $nav .= "   ('; -$nav .= ''; +$nav .= ''; $nav .= ''; $nav .= ''; $nav .= ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index f906c4cab45..711e18ef8b6 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -289,7 +289,7 @@ $nav .= "   ".$langs->trans("Today").")"; /*$nav.='   '; -$nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f55861b00cc..ad3af8c799d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1541,7 +1541,7 @@ if ($action == 'create') $object = new Propal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -2052,7 +2052,7 @@ if ($action == 'create') print ''; } From 90e0ead953716b9c021fe86a4e4f6c5a6d970671 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 00:52:05 +0100 Subject: [PATCH 33/52] FIX default value of selectMasssAction broken --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b94a36c04e5..5ede559c0bf 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -669,12 +669,14 @@ class Form /* console.log( index + ": " + $( this ).text() ); */ if ($(this).is(\':checked\')) atleastoneselected++; }); + console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected); + if (atleastoneselected || '.$alwaysvisible.') { jQuery(".massaction").show(); - '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' - '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' + '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' + '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' } else { From 82825f143ba7f86adb3ba873c38a4fe1b0ef3a1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:05 +0100 Subject: [PATCH 34/52] FIX Look and feel v11 --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/expensereport/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 55342a98c27..7e51160195b 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -332,7 +332,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -341,7 +341,7 @@ if ($result) { $product_static = new Product($db); while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; @@ -390,7 +390,7 @@ if ($result) { print ''; - print ''; - print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ef44222568f..8d3f3937823 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -336,7 +336,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $checkpicto = $form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -347,7 +347,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codecompta = length_accountg($objp->account_number).' - '.$objp->label; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label.''; $facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->id = $objp->facid; @@ -399,7 +399,7 @@ if ($result) { print ''; - print ''; From ba000dbcfde76b5ceaa9638aeb7644b3fc9650cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:27 +0100 Subject: [PATCH 35/52] FIX #13410 --- htdocs/compta/facture/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a2731ade92c..3e38333802a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -302,10 +302,12 @@ if (empty($reshook)) $array_of_total_ht_per_vat_rate = array(); $array_of_total_ht_devise_per_vat_rate = array(); foreach ($object->lines as $line) { - if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht; - $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht; + //$vat_src_code_for_line = $line->vat_src_code; // TODO We chek sign of total per vat without taking into account the vat code because for the moment the vat code is lost/unknown when we add a down payment. + $vat_src_code_for_line = ''; + if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->total_ht; + $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->multicurrency_total_ht; } //var_dump($array_of_total_ht_per_vat_rate);exit; From ab19bb24553820aa4e5fdb9d01566272806d6b6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 00:52:05 +0100 Subject: [PATCH 36/52] FIX default value of selectMasssAction broken --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e4c81435752..4be8c74ffac 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -646,12 +646,14 @@ class Form /* console.log( index + ": " + $( this ).text() ); */ if ($(this).is(\':checked\')) atleastoneselected++; }); + console.log("initCheckForSelect mode="+mode+" atleastoneselected="+atleastoneselected); + if (atleastoneselected || '.$alwaysvisible.') { jQuery(".massaction").show(); - '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'"); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' - '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0"); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' + '.($selected ? 'if (atleastoneselected) { jQuery(".massactionselect").val("'.$selected.'").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', false); }' : '').' + '.($selected ? 'if (! atleastoneselected) { jQuery(".massactionselect").val("0").trigger(\'change\'); jQuery(".massactionconfirmed").prop(\'disabled\', true); } ' : '').' } else { From a05f9fad33a18d515e7e64992b676050cdafe913 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:05 +0100 Subject: [PATCH 37/52] FIX Look and feel v11 --- htdocs/accountancy/customer/lines.php | 6 +++--- htdocs/accountancy/expensereport/lines.php | 4 ++-- htdocs/accountancy/supplier/lines.php | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d52c4c51f07..c35468ea85a 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -332,7 +332,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -341,7 +341,7 @@ if ($result) { $product_static = new Product($db); while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; $facture_static->ref = $objp->ref; $facture_static->id = $objp->facid; @@ -390,7 +390,7 @@ if ($result) { print ''; - print ''; - print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index a035aed2b1f..5b74311c310 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -336,7 +336,7 @@ if ($result) { print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $checkpicto = $form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center '); print "\n"; @@ -347,7 +347,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codecompta = length_accountg($objp->account_number).' - '.$objp->label; + $codecompta = length_accountg($objp->account_number).' - '.$objp->label.''; $facturefournisseur_static->ref = $objp->ref; $facturefournisseur_static->id = $objp->facid; @@ -399,7 +399,7 @@ if ($result) { print ''; - print ''; From 88d98acbba9ec104192083e6c349b8508ca95320 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 01:24:27 +0100 Subject: [PATCH 38/52] FIX #13410 Conflicts: htdocs/compta/facture/card.php --- htdocs/compta/facture/card.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0b38c4eb7e7..d08c69e7638 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -302,11 +302,13 @@ if (empty($reshook)) // Note: Other solution if you want to add a negative line on invoice, is to create a discount for customer and consumme it (but this is possible on standard invoice only). $array_of_total_ht_per_vat_rate = array(); $array_of_total_ht_devise_per_vat_rate = array(); - foreach($object->lines as $line) { - if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] = 0; - $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->total_ht; - $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$line->vat_src_code] += $line->multicurrency_total_ht; + foreach ($object->lines as $line) { + //$vat_src_code_for_line = $line->vat_src_code; // TODO We chek sign of total per vat without taking into account the vat code because for the moment the vat code is lost/unknown when we add a down payment. + $vat_src_code_for_line = ''; + if (empty($array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + if (empty($array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line])) $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] = 0; + $array_of_total_ht_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->total_ht; + $array_of_total_ht_devise_per_vat_rate[$line->tva_tx.'_'.$vat_src_code_for_line] += $line->multicurrency_total_ht; } //var_dump($array_of_total_ht_per_vat_rate);exit; From fa3bba942f5a4f0c5385f894b1db0582d00d3446 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:01:30 +0100 Subject: [PATCH 39/52] Start to save the VAT src code into table of discounts to reuse them later --- htdocs/comm/remx.php | 40 +++++++++++-------- htdocs/core/class/discount.class.php | 9 +++-- .../install/mysql/migration/11.0.0-12.0.0.sql | 3 ++ .../tables/llx_societe_remise_except.sql | 1 + htdocs/societe/class/societe.class.php | 23 ++++++++--- 5 files changed, 50 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 651fa556e8a..efb589ac8b9 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -56,7 +56,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) exit; } -if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') +if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') { //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) @@ -122,6 +122,8 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount2->datec = $discount->datec; $newdiscount1->tva_tx = $discount->tva_tx; $newdiscount2->tva_tx = $discount->tva_tx; + $newdiscount1->vat_src_code = $discount->vat_src_code; + $newdiscount2->vat_src_code = $discount->vat_src_code; $newdiscount1->amount_ttc = $amount_ttc_1; $newdiscount2->amount_ttc = price2num($discount->amount_ttc - $newdiscount1->amount_ttc); $newdiscount1->amount_ht = price2num($newdiscount1->amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); @@ -154,12 +156,12 @@ if ($action == 'setremise' && $user->rights->societe->creer) //if ($user->rights->societe->creer) //if ($user->rights->facture->creer) - $amount_ht = GETPOST('amount_ht'); + $amount_ht = price2num(GETPOST('amount_ht', 'alpha')); $desc = GETPOST('desc', 'alpha'); $tva_tx = GETPOST('tva_tx', 'alpha'); $discount_type = !empty($_POST['discount_type']) ?GETPOST('discount_type', 'alpha') : 0; - if (price2num($amount_ht) > 0) + if ($amount_ht > 0) { $error = 0; if (empty($desc)) @@ -196,7 +198,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) } else { - setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("NewGlobalDiscount")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("AmountHT")), null, 'errors'); } } @@ -375,10 +377,10 @@ if ($socid > 0) print ' '.$langs->trans("Currency".$conf->currency).''; print ''; print ''; print ''; - print ''; + print ''; print "
'; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 're', '', '', 0, "editdate"); print ''; @@ -2078,7 +2078,7 @@ if ($action == 'create') print ''; if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); print ''; @@ -2412,7 +2412,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3c1bf672c0f..3e9c1a2b0ca 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1594,8 +1594,8 @@ if ($action == 'create' && $usercancreate) $note_public = $object->getDefaultCreateValueFor('note_public'); } - print ''; - print ''; + print ''; + print ''; print ''; print '' . "\n"; print ''; @@ -2177,7 +2177,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date, 'order_', '', '', '', "setdate"); print ''; @@ -2198,7 +2198,7 @@ if ($action == 'create' && $usercancreate) print ''; if ($action == 'editdate_livraison') { print ''; - print ''; + print ''; print ''; print $form->selectDate($object->date_livraison ? $object->date_livraison : - 1, 'liv_', '', '', '', "setdate_livraison"); print ''; @@ -2492,7 +2492,7 @@ if ($action == 'create' && $usercancreate) $result = $object->getLinesArray(); print ' - + '; diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 8e83e6a33a4..41ba0dbd0fe 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -318,7 +318,7 @@ if ($action == "create" || $action == "start") print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print ''; - print ''; + print ''; if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 7d1f529bf82..06717574b07 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -1680,7 +1680,7 @@ else // Lines print ' - + diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 185f2a1a818..0b38c4eb7e7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2840,7 +2840,7 @@ if ($action == 'create') } print ''; - print ''; + print ''; print ''; if ($soc->id > 0) print ''."\n"; print ''; @@ -4441,7 +4441,7 @@ elseif ($id > 0 || !empty($ref)) print ''; if ($action == 'editrevenuestamp') { print ''; - print ''; + print ''; print ''; print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); @@ -4945,7 +4945,7 @@ elseif ($id > 0 || !empty($ref)) } print ' - + diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index dd1810fdf5f..e5d7422cf8a 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -59,7 +59,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh // Filters //print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index b137e6cdfa5..cc9111fc813 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2012,7 +2012,7 @@ elseif ($id || $ref) if ($action == 'editline') { print ' - + diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index cc87e83d5c0..93eb7560aaa 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -401,7 +401,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $result = $object->getLinesArray(); print ' - + diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index db05bfd408d..e16a19ea482 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -497,7 +497,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fetchLines(); print ' - + diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a6697701a68..3f6a89cbddb 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1151,7 +1151,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se print load_fiche_titre($langs->trans("UpdateVAT"), ''); print ''; - print ''; + print ''; print ''; print ''; @@ -1185,7 +1185,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''."\n"; print ''; - print ''; + print ''; print ''; print ''; @@ -1660,7 +1660,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print load_fiche_titre($langs->trans('PriceByCustomer')); print ''; - print ''; + print ''; print ''; print ''; @@ -1747,7 +1747,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index b2723a0ce6a..83a28d55f48 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1610,7 +1610,7 @@ elseif ($id || $ref) if ($action == 'editline') { print ' - + '; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 5b383f30e28..7386987945e 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -256,7 +256,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print load_fiche_titre($langs->trans('PriceByCustomer')); print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -334,7 +334,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print ''; - print ''; + print ''; print ''; print ''; print '
'; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5067a4935bc..37afb5f9621 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1125,7 +1125,7 @@ if ($action == 'create') $object = new SupplierProposal($db); print ''; - print ''; + print ''; print ''; if ($origin != 'project' && $originid) { print ''; @@ -1557,8 +1557,8 @@ if ($action == 'create') print '
'; print '
'; if ($action == 'editdate_livraison') { - print ''; - print ''; + print ''; + print ''; print ''; print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); print ''; @@ -1762,7 +1762,7 @@ if ($action == 'create') $result = $object->getLinesArray(); print ' - + @@ -1806,7 +1806,10 @@ if ($action == 'create') if ($action == 'statut') { // Form to set proposal accepted/refused - $form_close = ''; + $form_close = ''; + $form_close .= ''; + $form_close .= ''; + if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) $form_close .= '

'.$langs->trans('SupplierProposalRefFournNotice').'

'; // TODO Suggest a permanent checkbox instead of option $form_close .= ''; $form_close .= ''; From 1657a6b50a4e5db486e5331488612ee4899ec590 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 Mar 2020 13:25:45 +0100 Subject: [PATCH 12/52] FIX actions on supplier proposal not saved (bad trigger name) Conflicts: htdocs/supplier_proposal/class/supplier_proposal.class.php --- htdocs/supplier_proposal/card.php | 4 ++-- .../class/supplier_proposal.class.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 37afb5f9621..e998f909d06 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1041,7 +1041,7 @@ if (empty($reshook)) if (!$error) { - $result = $object->insertExtraFields('SUPPLIER_PROPOSAL_MODIFY'); + $result = $object->insertExtraFields('PROPOSAL_SUPPLIER_MODIFY'); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -1433,7 +1433,7 @@ if ($action == 'create') require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); $text .= '
'; - $text .= $notify->confirmMessage('SUPPLIER_PROPOSAL_VALIDATE', $object->socid, $object); + $text .= $notify->confirmMessage('PROPOSAL_SUPPLIER_VALIDATE', $object->socid, $object); } if (!$error) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 97e3b12b92f..6f41426ee80 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1481,7 +1481,7 @@ class SupplierProposal extends CommonObject if (! $error && ! $notrigger) { // Call trigger - $result=$this->call_trigger('SUPPLIER_PROPOSAL_VALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_VALIDATE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1683,7 +1683,7 @@ class SupplierProposal extends CommonObject if (! $notrigger) { // Call trigger - $result=$this->call_trigger('SUPPLIER_PROPOSAL_REOPEN', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_REOPEN', $user); if ($result < 0) { $error++; } // End call triggers } @@ -1736,13 +1736,13 @@ class SupplierProposal extends CommonObject $resql=$this->db->query($sql); if ($resql) { - $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED:$this->modelpdf; - $triggerName = 'SUPPLIER_PROPOSAL_CLOSE_REFUSED'; + $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED : $this->modelpdf; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_REFUSED'; if ($status == 2) { - $triggerName='SUPPLIER_PROPOSAL_CLOSE_SIGNED'; - $modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf; + $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_SIGNED'; + $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL : $this->modelpdf; if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists { @@ -1751,7 +1751,7 @@ class SupplierProposal extends CommonObject } if ($status == 4) { - $triggerName='SUPPLIER_PROPOSAL_CLASSIFY_BILLED'; + $triggerName = 'PROPOSAL_SUPPLIER_CLASSIFY_BILLED'; } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) @@ -1916,7 +1916,7 @@ class SupplierProposal extends CommonObject if (!$error) { // Call trigger - $result=$this->call_trigger('SUPPLIER_PROPOSAL_UNVALIDATE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_UNVALIDATE', $user); if ($result < 0) $error++; } @@ -2034,7 +2034,7 @@ class SupplierProposal extends CommonObject if (! $notrigger) { // Call trigger - $result=$this->call_trigger('SUPPLIER_PROPOSAL_DELETE', $user); + $result = $this->call_trigger('PROPOSAL_SUPPLIER_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } From 4c0de7447047c87be907925b46353413f15eacb7 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 24 Mar 2020 16:27:53 +0100 Subject: [PATCH 13/52] FIX : sort by default role makes no sense --- htdocs/core/lib/company.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 561cc0a02b3..30a1b80c232 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1098,7 +1098,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($val['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; if ($key == 'role') $align .= ($align ? ' ' : '').'left'; if (!empty($arrayfields['sc.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'sc.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; + print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; } } // Extra fields From 8409f3ba4ee46a4751e0e3da5c5487b80cfc3287 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 24 Mar 2020 17:28:12 +0100 Subject: [PATCH 14/52] NEW PRODUCT_SHOW_ORIGIN_IN_COMBO for some business, products have same label so we sometimes need display origin of product for a good choice --- htdocs/core/class/html.form.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3615d4180f..a168b5abe3b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2141,7 +2141,7 @@ class Form } } - $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; + $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country as country_id, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; if (count($warehouseStatusArray)) { $selectFieldsGrouped = ", sum(".$db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock @@ -2445,6 +2445,7 @@ class Form $outlabel = ''; $outdesc = ''; $outbarcode = ''; + $outorigin = ''; $outtype = ''; $outprice_ht = ''; $outprice_ttc = ''; @@ -2464,6 +2465,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; + $outorigin = $objp->country_id; $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; @@ -2525,12 +2527,15 @@ class Form $opt .= $objp->ref; if ($outbarcode) $opt .= ' ('.$outbarcode.')'; $opt .= ' - '.dol_trunc($label, $maxlengtharticle); + if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $opt .= ' ('.getCountry($outorigin, 1).')'; $objRef = $objp->ref; if (!empty($filterkey) && $filterkey != '') $objRef = preg_replace('/('.preg_quote($filterkey).')/i', '$1', $objRef, 1); $outval .= $objRef; if ($outbarcode) $outval .= ' ('.$outbarcode.')'; $outval .= ' - '.dol_trunc($label, $maxlengtharticle); + if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $outval .= ' ('.getCountry($outorigin, 1).')'; + // Units $opt .= $outvalUnits; $outval .= $outvalUnits; From 06f53fdd6989175bf6efa5081e0b4a0da4c8e9ac Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 24 Mar 2020 17:32:50 +0100 Subject: [PATCH 15/52] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a168b5abe3b..756e1016ea9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2535,7 +2535,7 @@ class Form if ($outbarcode) $outval .= ' ('.$outbarcode.')'; $outval .= ' - '.dol_trunc($label, $maxlengtharticle); if ($outorigin && !empty($conf->global->PRODUCT_SHOW_ORIGIN_IN_COMBO)) $outval .= ' ('.getCountry($outorigin, 1).')'; - + // Units $opt .= $outvalUnits; $outval .= $outvalUnits; From fec3377f2470353f5c7702cb63b06017d35e518c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Tue, 24 Mar 2020 18:49:16 +0100 Subject: [PATCH 16/52] FIX: Compatibility with multicompany, bad numerotation of task. --- htdocs/projet/class/task.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 60657b08061..bba05a55c8e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2014 Marcos García * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -154,7 +155,8 @@ class Task extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; - $sql .= "fk_projet"; + $sql .= "entity"; + $sql .= ", fk_projet"; $sql .= ", ref"; $sql .= ", fk_task_parent"; $sql .= ", label"; @@ -166,7 +168,8 @@ class Task extends CommonObject $sql .= ", planned_workload"; $sql .= ", progress"; $sql .= ") VALUES ("; - $sql .= $this->fk_project; + $sql .= $conf->entity; + $sql .= ", ".$this->fk_project; $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); $sql .= ", ".$this->fk_task_parent; $sql .= ", '".$this->db->escape($this->label)."'"; From 81af385259c9296b5f7734fba027292266eb7fa2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 25 Mar 2020 10:27:59 +0100 Subject: [PATCH 17/52] FIX : when we filter a list on a view status, we want this filter to be on bookmark that we create --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index f49fd1f93a3..d3d3a65557d 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -61,7 +61,7 @@ function printBookmarksList($aDb, $aLangs) { foreach($_POST as $key => $val) { - if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; + if ((preg_match('/^search_/', $key) || in_array($key, array('viewstatut')) ) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; } } $url.=($tmpurl?'?'.$tmpurl:''); From c38e16460e028914cf2f8b8307aace9427896a71 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 25 Mar 2020 10:31:40 +0100 Subject: [PATCH 18/52] Add new category button in sub categories --- htdocs/categories/viewcat.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 727ef8b0610..c7242077da4 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -4,6 +4,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -290,8 +291,18 @@ if ($user->rights->categorie->supprimer) print ""; +if (! empty($user->rights->categorie->creer)) +{ + $link = DOL_URL_ROOT.'/categories/card.php'; + $link .= '?action=create'; + $link .= '&type='.$type; + $link .= '&catorigin='.$object->id; + $link .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.'&id='.$id); - + print '
'; + print dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', $link); + print "
"; +} $cats = $object->get_filles(); if ($cats < 0) From 59f66ce9bd8486bb912a2e142a8b9e5d0cda7ea5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 11:32:24 +0100 Subject: [PATCH 19/52] Type of var --- htdocs/accountancy/bookkeeping/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index e50112f7ff1..065a72a5257 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -622,7 +622,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); print $formconfirm; } From c516a54f78515d2f284341e153365f6aa498c9e6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 25 Mar 2020 11:53:47 +0100 Subject: [PATCH 20/52] FIX get remain to pay with rounding decimals --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 259014cf691..270f0385104 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -103,7 +103,7 @@ abstract class CommonInvoice extends CommonObject $alreadypaid+=$this->getSommePaiement($multicurrency); $alreadypaid+=$this->getSumDepositsUsed($multicurrency); $alreadypaid+=$this->getSumCreditNotesUsed($multicurrency); - return $this->total_ttc - $alreadypaid; + return price2num($this->total_ttc, 'MT') - price2num($alreadypaid, 'MT'); } /** From c06655bc031cee1ba93ad66929437b5ca4a9499e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 15:40:02 +0100 Subject: [PATCH 21/52] Fix regression of bookmarks for blind people --- htdocs/bookmarks/bookmarks.lib.php | 154 +++++++++++++++++++-------- htdocs/main.inc.php | 84 ++++++++------- htdocs/theme/eldy/badges.inc.php | 6 +- htdocs/theme/eldy/progress.inc.php | 13 ++- htdocs/theme/eldy/theme_vars.inc.php | 1 + 5 files changed, 167 insertions(+), 91 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 9e69eda2cd3..199c227df43 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -60,10 +60,9 @@ function printDropdownBookmarksList() } $searchForm = ''."\n"; - $searchForm .= ''; + $searchForm .= 'global->MAIN_OPTIMIZEFORTEXTBROWSER)?'onsubmit="return false"':'').'>'; $searchForm .= ''; - $searchForm .= ''; - $searchForm .= ''; + // Url to list bookmark $listbtn = ''; @@ -79,7 +78,6 @@ function printDropdownBookmarksList() $newbtn .= img_picto('', 'bookmark', '', false, 0, 0, '', 'paddingright').dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; } - $bookmarkList = ''; - $html = ' - - - '; + $searchForm .= ''; - $html .= ' - - - '; + // Generate the return string + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $html = $searchForm; - $html .= ' - - - '; + $html.=' + '; + } else { + $html = ' + + + '; - if ($(this).text().search(new RegExp(filter, "i")) < 0) { - $(this).addClass("hidden-search-result"); - } else { - $(this).removeClass("hidden-search-result"); - count++; - } - }); - $("#top-bookmark-search-filter-count").text(count); - }); - '; + $html .= ' + + + '; + + $html .= ' + + + '; + + $html .= ' + '; + } return $html; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8d3812d5553..400ad73fad2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1969,51 +1969,57 @@ function top_menu_bookmark() include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; $langs->load("bookmarks"); - $html .= ' - '; + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + $html .= ''; + } else { + $html .= ' + '; - $html .= ' - - - '; + }); + + '; + } } return $html; } diff --git a/htdocs/theme/eldy/badges.inc.php b/htdocs/theme/eldy/badges.inc.php index ed609ddbc87..ae02a8e7f73 100644 --- a/htdocs/theme/eldy/badges.inc.php +++ b/htdocs/theme/eldy/badges.inc.php @@ -118,13 +118,13 @@ a.badge-warning:focus, a.badge-warning:hover { } /* WARNING colorblind */ -body[class^="colorblind-"] .badge-warning { +body[class*="colorblind-"] .badge-warning { background-color: ; } -body[class^="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus { +body[class*="colorblind-"] a.badge-warning.focus,body[class^="colorblind-"] a.badge-warning:focus { box-shadow: 0 0 0 0.2rem ; } -body[class^="colorblind-"] a.badge-warning:focus, a.badge-warning:hover { +body[class*="colorblind-"] a.badge-warning:focus, a.badge-warning:hover { background-color: ; } diff --git a/htdocs/theme/eldy/progress.inc.php b/htdocs/theme/eldy/progress.inc.php index 750db266dfd..6df6d3480a8 100644 --- a/htdocs/theme/eldy/progress.inc.php +++ b/htdocs/theme/eldy/progress.inc.php @@ -145,16 +145,21 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } -.progress-bar-green, -.progress-bar-success { +.progress-bar-green, .progress-bar-success { background-color: ; } -.progress-striped .progress-bar-green, -.progress-striped .progress-bar-success { +.progress-striped .progress-bar-green, .progress-striped .progress-bar-success { background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); } +body[class*="colorblind-"] .progress-bar-green, body[class*="colorblind-"] .progress-bar-success { + background-color: ; +} +body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progress-bar-danger { + background-color: ; +} + .progress-bar-aqua, .progress-bar-info { background-color: #00c0ef; diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 65c51e10dfe..b0ab509dc5c 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -99,6 +99,7 @@ $badgeLight = '#f8f9fa'; $colorblind_deuteranopes_badgeSuccess = '#37de5d'; //! text color black $colorblind_deuteranopes_badgeSuccess_textColor7 = '#000'; $colorblind_deuteranopes_badgeWarning = '#e4e411'; +$colorblind_deuteranopes_badgeDanger = $badgeDanger; // currently not tested with a color blind people so use default color /* default color for status : After a quick check, somme status can have oposite function according to objects * So this badges status uses default value according to theme eldy status img From f509c6a266e1f426fd8005e4de0678450c6b6b5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 16:00:42 +0100 Subject: [PATCH 22/52] Add user id into ajaxconst_onoff --- htdocs/core/js/lib_head.js.php | 13 ++++++++----- htdocs/core/lib/ajax.lib.php | 11 ++++++----- htdocs/core/lib/usergroups.lib.php | 1 + 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 9f8fda42d61..a35fee85d0a 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -524,8 +524,9 @@ function hideMessage(fieldId,message) { * @param int entity Entity * @param int strict Strict * @param int forcereload Force reload + * @param int userid User id */ -function setConstant(url, code, input, entity, strict, forcereload) { +function setConstant(url, code, input, entity, strict, forcereload, userid) { $.get( url, { action: "set", name: code, @@ -593,8 +594,9 @@ function setConstant(url, code, input, entity, strict, forcereload) { * @param int entity Entity * @param int strict Strict * @param int forcereload Force reload + * @param int userid User id */ -function delConstant(url, code, input, entity, strict, forcereload) { +function delConstant(url, code, input, entity, strict, forcereload, userid) { $.get( url, { action: "del", name: code, @@ -661,8 +663,9 @@ function delConstant(url, code, input, entity, strict, forcereload) { * @param int yesButton yesButton * @param int noButton noButton * @param int strict Strict + * @param int userid User id */ -function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) { +function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict, userid) { var boxConfirm = box; $("#confirm_" + code) .attr("title", boxConfirm.title) @@ -678,9 +681,9 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, text : yesButton, click : function() { if (action == "set") { - setConstant(url, code, input, entity, strict); + setConstant(url, code, input, entity, strict, 0, userid); } else if (action == "del") { - delConstant(url, code, input, entity, strict); + delConstant(url, code, input, entity, strict, 0, userid); } // Close dialog $(this).dialog("close"); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 58567748f7f..c29b82f4329 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -485,7 +485,7 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2) { - global $conf, $langs; + global $conf, $langs, $user; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); @@ -504,6 +504,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof var code = \''.$code.'\'; var entity = \''.$entity.'\'; var strict = \''.$strict.'\'; + var userid = \''.$user->id.'\'; var yesButton = "'.dol_escape_js($langs->transnoentities("Yes")).'"; var noButton = "'.dol_escape_js($langs->transnoentities("No")).'"; @@ -512,9 +513,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (input.alert && input.alert.set) { if (input.alert.set.yesButton) yesButton = input.alert.set.yesButton; if (input.alert.set.noButton) noButton = input.alert.set.noButton; - confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict); + confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid); } else { - setConstant(url, code, input, entity, 0, '.$forcereload.'); + setConstant(url, code, input, entity, 0, '.$forcereload.', userid); } }); @@ -523,9 +524,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (input.alert && input.alert.del) { if (input.alert.del.yesButton) yesButton = input.alert.del.yesButton; if (input.alert.del.noButton) noButton = input.alert.del.noButton; - confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict); + confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid); } else { - delConstant(url, code, input, entity, 0, '.$forcereload.'); + delConstant(url, code, input, entity, 0, '.$forcereload.', userid); } }); }); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index a6fc287d0cf..2b510373299 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -942,6 +942,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print '
'; print ''; print ''; + print ''; } print "
'.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").''; + //print ajax_constantonoff("MAIN_OPTIMIZEFORTEXTBROWSER", array(), null, 0, 0, 1, 0); if ($edit) { print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1); From 3c572c19095cc368a31a563c40c7d1ea84c4a3e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 17:24:20 +0100 Subject: [PATCH 23/52] Debug multicurrency --- htdocs/admin/multicurrency.php | 5 ++++- htdocs/langs/en_US/multicurrency.lang | 2 ++ htdocs/multicurrency/class/multicurrency.class.php | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 0c6d3e219b8..a2db56549e3 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -148,7 +148,10 @@ elseif ($action == 'setapilayer') } else { - MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); + $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); + if ($result > 0) { + setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs"); + } } } diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang index 4dc04ff2622..bfcbd11fb7c 100644 --- a/htdocs/langs/en_US/multicurrency.lang +++ b/htdocs/langs/en_US/multicurrency.lang @@ -18,3 +18,5 @@ MulticurrencyReceived=Received, original currency MulticurrencyRemainderToTake=Remaining amount, original currency MulticurrencyPaymentAmount=Payment amount, original currency AmountToOthercurrency=Amount To (in currency of receiving account) +CurrencyRateSyncSucceed=Currency rate synchronization done successfuly +MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT=Use the currency of the document for online payments diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index d3b589fe88a..3701d3404f0 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -628,11 +628,11 @@ class MultiCurrency extends CommonObject } /** - * Sync rates from api + * Sync rates from API * * @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID. * @param int $addifnotfound Add if not found - * @return void + * @return int <0 if KO, >0 if OK */ public static function syncRates($key, $addifnotfound = 0) { @@ -672,11 +672,15 @@ class MultiCurrency extends CommonObject } } } - } + + return 1; + } else { dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); + + return -1; } } From 1c01972bfe6a5fb2796fa1b6cc417cfdd21f7fe3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 17:30:54 +0100 Subject: [PATCH 24/52] Fix logs --- .../class/multicurrency.class.php | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 3701d3404f0..2085678f583 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2007-2020 Laurent Destailleur * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; + /** * Class Currency * @@ -92,6 +93,7 @@ class MultiCurrency extends CommonObject */ public $rate; + /** * Constructor * @@ -99,7 +101,7 @@ class MultiCurrency extends CommonObject */ public function __construct(DoliDB $db) { - $this->db = &$db; + $this->db = $db; return 1; } @@ -107,16 +109,15 @@ class MultiCurrency extends CommonObject /** * Create object into database * - * @param User $user User that creates - * @param bool $trigger true=launch triggers after, false=disable triggers - * - * @return int <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param bool $trigger true=launch triggers after, false=disable triggers + * @return int <0 if KO, Id of created object if OK */ public function create(User $user, $trigger = true) { global $conf,$langs; - dol_syslog('Currency::create', LOG_DEBUG); + dol_syslog('MultiCurrency::create', LOG_DEBUG); $error = 0; @@ -152,7 +153,7 @@ class MultiCurrency extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::create ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::create ' . join(',', $this->errors), LOG_ERR); } if (!$error) { @@ -180,14 +181,13 @@ class MultiCurrency extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object - * @param string $code code - * - * @return int <0 if KO, 0 if not found, >0 if OK + * @param int $id Id object + * @param string $code code + * @return int <0 if KO, 0 if not found, >0 if OK */ public function fetch($id, $code = null) { - dol_syslog('Currency::fetch', LOG_DEBUG); + dol_syslog('MultiCurrency::fetch', LOG_DEBUG); global $conf; @@ -224,7 +224,7 @@ class MultiCurrency extends CommonObject } } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::fetch ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::fetch ' . join(',', $this->errors), LOG_ERR); return -1; } @@ -260,7 +260,7 @@ class MultiCurrency extends CommonObject return $num; } else { $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::fetchAllCurrencyRate ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::fetchAllCurrencyRate ' . join(',', $this->errors), LOG_ERR); return - 1; } @@ -269,16 +269,15 @@ class MultiCurrency extends CommonObject /** * Update object into database * - * @param User $user User that modifies - * @param bool $trigger true=launch triggers after, false=disable triggers - * - * @return int <0 if KO, >0 if OK + * @param User $user User that modifies + * @param bool $trigger true=launch triggers after, false=disable triggers + * @return int <0 if KO, >0 if OK */ public function update(User $user, $trigger = true) { $error = 0; - dol_syslog('Currency::update', LOG_DEBUG); + dol_syslog('MultiCurrency::update', LOG_DEBUG); // Clean parameters $this->name = trim($this->name); @@ -287,7 +286,7 @@ class MultiCurrency extends CommonObject // Check parameters if (empty($this->code)) { $error++; - dol_syslog('Currency::update $this->code can not be empty', LOG_ERR); + dol_syslog('MultiCurrency::update $this->code can not be empty', LOG_ERR); return -1; } @@ -298,14 +297,13 @@ class MultiCurrency extends CommonObject $sql .= ' code=\''.$this->db->escape($this->code).'\''; $sql .= ' WHERE rowid=' . $this->id; - dol_syslog(__METHOD__, LOG_DEBUG); $this->db->begin(); $resql = $this->db->query($sql); if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::update ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::update ' . join(',', $this->errors), LOG_ERR); } if (!$error && $trigger) { @@ -329,14 +327,13 @@ class MultiCurrency extends CommonObject * Delete object in database * * @param bool $trigger true=launch triggers after, false=disable triggers - * * @return int <0 if KO, >0 if OK */ public function delete($trigger = true) { global $user; - dol_syslog('Currency::delete', LOG_DEBUG); + dol_syslog('MultiCurrency::delete', LOG_DEBUG); $error = 0; @@ -363,7 +360,7 @@ class MultiCurrency extends CommonObject if (!$resql) { $error ++; $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog('Currency::delete ' . join(',', $this->errors), LOG_ERR); + dol_syslog('MultiCurrency::delete ' . join(',', $this->errors), LOG_ERR); } } @@ -398,16 +395,15 @@ class MultiCurrency extends CommonObject } /** - * Delete rate in database + * Add a Rate into database * * @param double $rate rate value - * - * @return int -1 if KO, 1 if OK + * @return int -1 if KO, 1 if OK */ public function addRate($rate) { $currencyRate = new CurrencyRate($this->db); - $currencyRate->rate = $rate; + $currencyRate->rate = price2num($rate); if ($currencyRate->create($this->id) > 0) { @@ -427,7 +423,6 @@ class MultiCurrency extends CommonObject * * @param string $code currency code * @param double $rate new rate - * * @return int -1 if KO, 1 if OK, 2 if label found and OK */ public function addRateFromDolibarr($code, $rate) @@ -459,10 +454,9 @@ class MultiCurrency extends CommonObject } /** - * Add new entry into llx_multicurrency_rate to historise + * Add new entry into llx_multicurrency_rate * * @param double $rate rate value - * * @return int <0 if KO, >0 if OK */ public function updateRate($rate) From 63e0e1f4bf269e083463ffba2ba98c4ce2df8049 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 17:35:50 +0100 Subject: [PATCH 25/52] Fix option THEME_TOPMENU_DISABLE_IMAGE --- htdocs/theme/eldy/dropdown.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index bfe55597316..e930eef3f03 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -164,7 +164,9 @@ button.dropdown-item.global-search-item { } div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown { - line-height: 46px; + global->THEME_TOPMENU_DISABLE_IMAGE)) { ?> + line-height: 46px; + } a.top-menu-dropdown-link { padding: 8px; From 3855ef6073edb6904afb1bbf93b90aa3e3d48310 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 17:41:39 +0100 Subject: [PATCH 26/52] Add rounding code 'CR' (currency rate' --- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f3615d4180f..ddf8288210a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4770,7 +4770,7 @@ class Form print '
'; print ''; print ''; - print ' '; + print ' '; print '
'.$langs->trans("NoSessionFound", $savepath, $openbasedir).'
'.$langs->trans("NoSessionFound", $savepath, $openbasedir).'
"; } From 925554d15e9ccda8443cc2076ad2f24aaefa26d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 18:27:53 +0100 Subject: [PATCH 28/52] More accurate result --- htdocs/core/class/commoninvoice.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 270f0385104..b730c029be2 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -95,7 +95,7 @@ abstract class CommonInvoice extends CommonObject * This does not include open direct debit requests. * * @param int $multicurrency Return multicurrency_amount instead of amount - * @return double Remain of amount to pay + * @return double Remain of amount to pay */ public function getRemainToPay($multicurrency = 0) { @@ -103,7 +103,7 @@ abstract class CommonInvoice extends CommonObject $alreadypaid+=$this->getSommePaiement($multicurrency); $alreadypaid+=$this->getSumDepositsUsed($multicurrency); $alreadypaid+=$this->getSumCreditNotesUsed($multicurrency); - return price2num($this->total_ttc, 'MT') - price2num($alreadypaid, 'MT'); + return price2num($this->total_ttc - $alreadypaid, 'MT'); } /** From b48c21dbcb64fcfa781374559827cb73d17f409b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 18:47:42 +0100 Subject: [PATCH 29/52] If we need more var here, we must fix to have var starting with search_ --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 9f511424006..1abc235b87d 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -61,7 +61,7 @@ function printBookmarksList($aDb, $aLangs) { foreach($_POST as $key => $val) { - if ((preg_match('/^search_/', $key) || in_array($key, array('viewstatut')) ) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; + if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; } } $url.=($tmpurl?'?'.$tmpurl:''); From 4e774139964d8d213ed6fab67140ac0083ba37cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 19:29:54 +0100 Subject: [PATCH 30/52] Try fix suggested in #13418 --- htdocs/api/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 7a9ef9ad24d..50a37793273 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -56,6 +56,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $url = $_SERVER['PHP_SELF']; +if (preg_match('/api\/index\.php$', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method' + $url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO']; +} // Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases) if (! empty($conf->global->MAIN_NGINX_FIX)) { From e937b227217d3546e5acf95727a26091ae4751da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 19:34:52 +0100 Subject: [PATCH 31/52] Increase batch number to 128 --- .../mysql/tables/llx_commande_fournisseur_dispatch.sql | 2 +- htdocs/install/mysql/tables/llx_expeditiondet_batch.sql | 2 +- htdocs/install/mysql/tables/llx_inventorydet.sql | 2 +- htdocs/install/mysql/tables/llx_mrp_production.sql | 2 +- htdocs/install/mysql/tables/llx_product_batch.sql | 2 +- htdocs/install/mysql/tables/llx_product_lot.sql | 2 +- htdocs/install/mysql/tables/llx_stock_mouvement.sql | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 750b40cb73c..22a0e241dd6 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -31,7 +31,7 @@ create table llx_commande_fournisseur_dispatch fk_entrepot integer, fk_user integer, comment varchar(255), -- comment on movement - batch varchar(30) DEFAULT NULL, + batch varchar(128) DEFAULT NULL, eatby date DEFAULT NULL, sellby date DEFAULT NULL, status integer, diff --git a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql index af3a261e893..7a6a3bfd777 100644 --- a/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql +++ b/htdocs/install/mysql/tables/llx_expeditiondet_batch.sql @@ -20,7 +20,7 @@ CREATE TABLE llx_expeditiondet_batch ( fk_expeditiondet int NOT NULL, eatby date DEFAULT NULL, sellby date DEFAULT NULL, - batch varchar(30) DEFAULT NULL, + batch varchar(128) DEFAULT NULL, qty double NOT NULL DEFAULT '0', fk_origin_stock integer NOT NULL ) ENGINE=InnoDB; diff --git a/htdocs/install/mysql/tables/llx_inventorydet.sql b/htdocs/install/mysql/tables/llx_inventorydet.sql index c70a2909882..b4df529433e 100644 --- a/htdocs/install/mysql/tables/llx_inventorydet.sql +++ b/htdocs/install/mysql/tables/llx_inventorydet.sql @@ -25,7 +25,7 @@ tms timestamp, fk_inventory integer DEFAULT 0, fk_warehouse integer DEFAULT 0, fk_product integer DEFAULT 0, -batch varchar(30) DEFAULT NULL, -- Lot or serial number +batch varchar(128) DEFAULT NULL, -- Lot or serial number qty_stock double DEFAULT NULL, -- The targeted value. can be filled during draft edition qty_view double DEFAULT NULL, -- must be filled once regulation is done qty_regulated double DEFAULT NULL -- must be filled once regulation is done diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index 78b8847d9de..509d78a5c0e 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -23,7 +23,7 @@ CREATE TABLE llx_mrp_production( qty real NOT NULL DEFAULT 1, qty_frozen smallint DEFAULT 0, disable_stock_change smallint DEFAULT 0, - batch varchar(30), + batch varchar(128), role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation) fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' fk_stock_movement integer, -- id of stock movement when movements are validated diff --git a/htdocs/install/mysql/tables/llx_product_batch.sql b/htdocs/install/mysql/tables/llx_product_batch.sql index ba8b7ff59e4..7b09d6a0024 100644 --- a/htdocs/install/mysql/tables/llx_product_batch.sql +++ b/htdocs/install/mysql/tables/llx_product_batch.sql @@ -24,7 +24,7 @@ CREATE TABLE llx_product_batch ( fk_product_stock integer NOT NULL, eatby datetime DEFAULT NULL, -- deprecated. should not be used here but should be stored into a table llx_product_lot sellby datetime DEFAULT NULL, -- deprecated. should not be used here but should be stored into a table llx_product_lot - batch varchar(30) NOT NULL, + batch varchar(128) NOT NULL, qty double NOT NULL DEFAULT 0, import_key varchar(14) DEFAULT NULL ) ENGINE=InnoDB; diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql index 493a8792f20..885f699d800 100644 --- a/htdocs/install/mysql/tables/llx_product_lot.sql +++ b/htdocs/install/mysql/tables/llx_product_lot.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_product_lot ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1, fk_product integer NOT NULL, -- Id of product - batch varchar(30) DEFAULT NULL, -- Lot or serial number + batch varchar(128) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date datec datetime, diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement.sql b/htdocs/install/mysql/tables/llx_stock_mouvement.sql index 397165e296c..94501a516dd 100644 --- a/htdocs/install/mysql/tables/llx_stock_mouvement.sql +++ b/htdocs/install/mysql/tables/llx_stock_mouvement.sql @@ -21,9 +21,9 @@ create table llx_stock_mouvement ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, - datem datetime, -- Date and hour of movement + datem datetime, -- Date and hour of movement fk_product integer NOT NULL, -- Id of product - batch varchar(30) DEFAULT NULL, -- Lot or serial number + batch varchar(128) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date (deprecated, we should get value from batch number in table llx_product_lot) sellby date DEFAULT NULL, -- Sellby date (deprecated, we should get value from batch number in table llx_product_lot) fk_entrepot integer NOT NULL, -- Id warehouse From 2e5bfb207f8d55b4a141645d656f444b49084a77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 25 Mar 2020 23:50:05 +0100 Subject: [PATCH 32/52] Fix responsive --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index fbff955db47..a2731ade92c 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3397,7 +3397,7 @@ if ($action == 'create') { $langs->load('projects'); print '
'.$langs->trans('Project').''; - $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1); + $numprojet = $formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print ' id.($fac_rec ? '&fac_rec='.$fac_rec : '')).'">'; print '
'.$objp->tva_intra.''; + print ''; print $codecompta.' '; print img_edit(); print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 63b142e1bdd..8cc398a00bf 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -287,7 +287,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codeCompta = length_accountg($objp->account_number).' - '.$objp->label; + $codeCompta = length_accountg($objp->account_number).' - '.$objp->label.''; $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -315,7 +315,7 @@ if ($result) { print ''.$codeCompta.''; + print ''; print img_edit(); print '
'.$objp->tva_intra.''; + print ''; print $codecompta.' '; print img_edit(); print '
'.$objp->tva_intra.''; + print ''; print $codecompta.' '; print img_edit(); print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index cc606555b37..4d96027f79a 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -287,7 +287,7 @@ if ($result) { while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $codeCompta = length_accountg($objp->account_number).' - '.$objp->label; + $codeCompta = length_accountg($objp->account_number).' - '.$objp->label.''; $expensereport_static->ref = $objp->ref; $expensereport_static->id = $objp->erid; @@ -315,7 +315,7 @@ if ($result) { print ''.$codeCompta.''; + print ''; print img_edit(); print '
'.$objp->tva_intra.''; + print ''; print $codecompta.' '; print img_edit(); print '
'.$langs->trans("VAT").''; - print $form->load_tva('tva_tx', GETPOST('tva_tx'), $mysoc, $object); + print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0, $mysoc, $object, 0, 0, '', 0, 1); print '
'.$langs->trans("NoteReason").'
"; @@ -409,7 +411,7 @@ if ($socid > 0) /* - * List remises fixes client restant en cours (= liees a aucune facture ni ligne de facture) + * List not consumed available credits (= linked to no invoice and no invoice line) */ print load_fiche_titre($langs->trans("DiscountStillRemaining")); @@ -421,7 +423,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("CustomerDiscounts"), '', ''); } - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description,"; $sql .= " rc.fk_facture_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -510,7 +513,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -577,7 +580,8 @@ if ($socid > 0) /* * Liste remises fixes fournisseur restant en cours (= liees a aucune facture ni ligne de facture) */ - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -666,7 +670,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -744,7 +748,8 @@ if ($socid > 0) } // Discount linked to invoice lines - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture_source,"; $sql .= " u.login, u.rowid as user_id,"; $sql .= " f.rowid as invoiceid, f.ref,"; @@ -762,7 +767,7 @@ if ($socid > 0) $sql .= " ORDER BY dc DESC"; //$sql.= " UNION "; // Discount linked to invoices - $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql2 .= " rc.fk_facture_source,"; $sql2 .= " u.login, u.rowid as user_id,"; @@ -881,7 +886,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { @@ -920,7 +925,8 @@ if ($socid > 0) } // Discount linked to invoice lines - $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; + $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; @@ -939,7 +945,7 @@ if ($socid > 0) $sql .= " ORDER BY dc DESC"; //$sql.= " UNION "; // Discount linked to invoices - $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,"; + $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql2 .= " rc.fk_invoice_supplier_source,"; $sql2 .= " u.login, u.rowid as user_id,"; @@ -1057,7 +1063,7 @@ if ($socid > 0) { print ''.price($obj->multicurrency_amount_ht).''; } - print ''.vatrate($obj->tva_tx, true).''; + print ''.vatrate($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), true).''; print ''.price($obj->amount_ttc).''; if (!empty($conf->multicurrency->enabled)) { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index c3707b18972..bf85699a9fe 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -62,6 +62,7 @@ class DiscountAbsolute public $multicurrency_amount_ttc; // Vat rate public $tva_tx; + public $vat_src_code; /** * @var int User ID Id utilisateur qui accorde la remise @@ -133,7 +134,7 @@ class DiscountAbsolute $sql = "SELECT sr.rowid, sr.fk_soc, sr.discount_type,"; $sql.= " sr.fk_user,"; - $sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx,"; + $sql.= " sr.amount_ht, sr.amount_tva, sr.amount_ttc, sr.tva_tx, sr.vat_src_code,"; $sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,"; $sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,"; $sql.= " sr.datec,"; @@ -168,6 +169,8 @@ class DiscountAbsolute $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc; $this->tva_tx = $obj->tva_tx; + $this->vat_src_code = $obj->vat_src_code; + $this->fk_user = $obj->fk_user; $this->fk_facture_line = $obj->fk_facture_line; $this->fk_facture = $obj->fk_facture; @@ -244,12 +247,12 @@ class DiscountAbsolute // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; $sql .= " (entity, datec, fk_soc, discount_type, fk_user, description,"; - $sql .= " amount_ht, amount_tva, amount_ttc, tva_tx,"; + $sql .= " amount_ht, amount_tva, amount_ttc, tva_tx, vat_src_code,"; $sql .= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,"; $sql .= " fk_facture_source, fk_invoice_supplier_source"; $sql .= ")"; $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec != '' ? $this->datec : dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type) ? 0 : intval($this->discount_type)).", ".$userid.", '".$this->db->escape($this->description)."',"; - $sql .= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; + $sql .= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.", '".$this->db->escape($this->vat_src_code)."',"; $sql .= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", "; $sql .= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null").","; $sql .= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'" : "null"); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index f5c4dee3f15..892c2a94f5f 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -200,3 +200,6 @@ ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL; ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active; ALTER TABLE llx_categorie MODIFY type integer NOT NULL DEFAULT 1; + +ALTER TABLE llx_societe_remise_except ADD COLUMN vat_src_code varchar(10) DEFAULT ''; + diff --git a/htdocs/install/mysql/tables/llx_societe_remise_except.sql b/htdocs/install/mysql/tables/llx_societe_remise_except.sql index 50cbfae51c1..63762f8ad32 100644 --- a/htdocs/install/mysql/tables/llx_societe_remise_except.sql +++ b/htdocs/install/mysql/tables/llx_societe_remise_except.sql @@ -30,6 +30,7 @@ create table llx_societe_remise_except amount_tva double(24,8) DEFAULT 0 NOT NULL, amount_ttc double(24,8) DEFAULT 0 NOT NULL, tva_tx double(6,3) DEFAULT 0 NOT NULL, + vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. fk_user integer NOT NULL, fk_facture_line integer, fk_facture integer, diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e61c98e3267..e6e9e42aa75 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1987,11 +1987,11 @@ class Societe extends CommonObject * @param float $remise Amount of discount * @param User $user User adding discount * @param string $desc Reason of discount - * @param float $tva_tx VAT rate + * @param string $vatrate VAT rate (may contain the vat code too). Exemple: '1.23', '1.23 (ABC)', ... * @param int $discount_type 0 => customer discount, 1 => supplier discount - * @return int <0 if KO, id of discount record if OK + * @return int <0 if KO, id of discount record if OK */ - public function set_remise_except($remise, User $user, $desc, $tva_tx = 0, $discount_type = 0) + public function set_remise_except($remise, User $user, $desc, $vatrate = '', $discount_type = 0) { // phpcs:enable global $langs; @@ -2012,8 +2012,17 @@ class Societe extends CommonObject return -2; } - if ($this->id) + if ($this->id > 0) { + // Clean vat code + $reg = array(); + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $vatrate, $reg)) + { + $vat_src_code = $reg[1]; + $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + } + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; $discount = new DiscountAbsolute($this->db); @@ -2022,10 +2031,12 @@ class Societe extends CommonObject $discount->discount_type = $discount_type; $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise, 'MT'); - $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $tva_tx / 100, 'MT'); + $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $vatrate / 100, 'MT'); $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($discount->amount_ht + $discount->amount_tva, 'MT'); - $discount->tva_tx = price2num($tva_tx, 'MT'); + $discount->tva_tx = price2num($vatrate, 'MT'); + $discount->vat_src_code = $vat_src_code; + $discount->description = $desc; $result = $discount->create($user); From d2163c95d6bec1f6ec777f51d3cb193ecd4f0abd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:13:34 +0100 Subject: [PATCH 40/52] Save the vat src code when converting down payment into discount --- htdocs/compta/facture/card.php | 38 +++++++++++++------ htdocs/compta/facture/class/facture.class.php | 1 + 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3e38333802a..af21b259d38 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004-2020 Laurent Destailleur * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani @@ -811,14 +811,16 @@ if (empty($reshook)) $i = 0; foreach ($object->lines as $line) { - if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 - { // no need to create discount if amount is null - $amount_ht[$line->tva_tx] += $line->total_ht; - $amount_tva[$line->tva_tx] += $line->total_tva; - $amount_ttc[$line->tva_tx] += $line->total_ttc; - $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; - $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; - $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; + if ($line->product_type < 9 && $line->total_ht != 0) // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null + { + $keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); + + $amount_ht[$keyforvatrate] += $line->total_ht; + $amount_tva[$keyforvatrate] += $line->total_tva; + $amount_ttc[$keyforvatrate] += $line->total_ttc; + $multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht; + $multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva; + $multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc; $i++; } } @@ -832,9 +834,9 @@ if (empty($reshook)) $amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU'); $amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU'); $amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ht[$vatrate] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_tva[$vatrate] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ttc[$vatrate] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); } } } @@ -889,6 +891,7 @@ if (empty($reshook)) $discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc; $discount->amount_tva = 0; $discount->tva_tx = 0; + $discount->vat_src_code = ''; $result = $discount->create($user); if ($result < 0) @@ -906,7 +909,18 @@ if (empty($reshook)) $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); + + // Clean vat code + $reg = array(); + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $tva_tx, $reg)) + { + $vat_src_code = $reg[1]; + $tva_tx = preg_replace('/\s*\(.*\)/', '', $tva_tx); // Remove code into vatrate. + } + $discount->tva_tx = abs($tva_tx); + $discount->vat_src_code =$vat_src_code; $result = $discount->create($user); if ($result < 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ec7348723c5..7f499149034 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3076,6 +3076,7 @@ class Facture extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); // Clean vat code + $reg = array(); $vat_src_code = ''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { From d3debccabe2bd24fc405c8a14ad307ac172ac5fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:14:57 +0100 Subject: [PATCH 41/52] FIX bad value in currency into discount created from down payment --- htdocs/compta/facture/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d08c69e7638..bf03ad2c3d6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -833,9 +833,9 @@ if (empty($reshook)) $amount_ht[$vatrate] = price2num($amount_ht[$vatrate] * $ratio, 'MU'); $amount_tva[$vatrate] = price2num($amount_tva[$vatrate] * $ratio, 'MU'); $amount_ttc[$vatrate] = price2num($amount_ttc[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ht[$line->tva_tx] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_tva[$line->tva_tx] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); - $multicurrency_amount_ttc[$line->tva_tx] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ht[$vatrate] = price2num($multicurrency_amount_ht[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_tva[$vatrate] = price2num($multicurrency_amount_tva[$vatrate] * $ratio, 'MU'); + $multicurrency_amount_ttc[$vatrate] = price2num($multicurrency_amount_ttc[$vatrate] * $ratio, 'MU'); } } } From 3ae3e9a16ea67ccfeed2b18ae61c9d6c477bfecc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:21:50 +0100 Subject: [PATCH 42/52] Remove $_POST --- htdocs/compta/facture/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index af21b259d38..fced3c4d84a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -487,10 +487,10 @@ if (empty($reshook)) // POST[remise_id] or POST[remise_id_for_payment] // We use the credit to reduce amount of invoice - if (!empty($_POST["remise_id"])) { + if (GETPOST("remise_id", 'int') > 0) { $ret = $object->fetch($id); if ($ret > 0) { - $result = $object->insert_discount($_POST["remise_id"]); + $result = $object->insert_discount(GETPOST("remise_id", 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -499,11 +499,11 @@ if (empty($reshook)) } } // We use the credit to reduce remain to pay - if (!empty($_POST["remise_id_for_payment"])) + if (GETPOST("remise_id_for_payment", 'int') > 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; $discount = new DiscountAbsolute($db); - $discount->fetch($_POST["remise_id_for_payment"]); + $discount->fetch(GETPOST("remise_id_for_payment", 'int')); //var_dump($object->getRemainToPay(0)); //var_dump($discount->amount_ttc);exit; From f0de10897a7167965fab36b22a1465a8dc066736 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:32:24 +0100 Subject: [PATCH 43/52] FIX Foreign currency lost when splitting a discount --- htdocs/comm/remx.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index efb589ac8b9..c312591aeec 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -131,6 +131,13 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') $newdiscount1->amount_tva = price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht); $newdiscount2->amount_tva = price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht); + $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); + $newdiscount2->multicurrency_amount_ttc = price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc); + $newdiscount1->multicurrency_amount_ht = price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); + $newdiscount2->multicurrency_amount_ht = price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100), 'MT'); + $newdiscount1->multicurrency_amount_tva = price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht); + $newdiscount2->multicurrency_amount_tva = price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht); + $db->begin(); $discount->fk_facture_source = 0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source From 004397304e4fa7ae65d90f7e42b283e5369235bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 02:32:24 +0100 Subject: [PATCH 44/52] FIX Foreign currency lost when splitting a discount --- htdocs/comm/remx.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 651fa556e8a..c7016f2dbab 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -129,6 +129,13 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount1->amount_tva = price2num($newdiscount1->amount_ttc - $newdiscount1->amount_ht); $newdiscount2->amount_tva = price2num($newdiscount2->amount_ttc - $newdiscount2->amount_ht); + $newdiscount1->multicurrency_amount_ttc = $amount_ttc_1 * ($discount->multicurrency_amount_ttc / $discount->amount_ttc); + $newdiscount2->multicurrency_amount_ttc = price2num($discount->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ttc); + $newdiscount1->multicurrency_amount_ht = price2num($newdiscount1->multicurrency_amount_ttc / (1 + $newdiscount1->tva_tx / 100), 'MT'); + $newdiscount2->multicurrency_amount_ht = price2num($newdiscount2->multicurrency_amount_ttc / (1 + $newdiscount2->tva_tx / 100), 'MT'); + $newdiscount1->multicurrency_amount_tva = price2num($newdiscount1->multicurrency_amount_ttc - $newdiscount1->multicurrency_amount_ht); + $newdiscount2->multicurrency_amount_tva = price2num($newdiscount2->multicurrency_amount_ttc - $newdiscount2->multicurrency_amount_ht); + $db->begin(); $discount->fk_facture_source = 0; // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_facture_source // This is to delete only the require record (that we will recreate with two records) and not all family with same fk_invoice_supplier_source From 84fc394e6fc84549dc07bed1ee538c3a6de6883c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:29:29 +0100 Subject: [PATCH 45/52] Fix exclude fucking composer dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 39fce4fb1a7..2c55ef199e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -299,7 +299,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From fb5363d857e164c11d7fb89e9d51d647b8af62dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:32:05 +0100 Subject: [PATCH 46/52] Fix pregex --- htdocs/api/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 50a37793273..6ccdab6c179 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -56,7 +56,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $url = $_SERVER['PHP_SELF']; -if (preg_match('/api\/index\.php$', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method' +if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method' $url = $_SERVER['PHP_SELF'].$_SERVER['PATH_INFO']; } // Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases) From 5fdf23bba8c53403a3e621e2982dc1c7b4df9aff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:36:16 +0100 Subject: [PATCH 47/52] Fix exclude fucking composer dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2c55ef199e8..854925e9109 100644 --- a/.travis.yml +++ b/.travis.yml @@ -299,7 +299,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From 386d478b659a4626efcad5bd5d16e8446c222fff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:44:58 +0100 Subject: [PATCH 48/52] Add os in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index eb767ea1b61..ff02f7330f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: trusty to have php 5.4+ available +os: linux dist: trusty sudo: required From 39f7742387b13ec59a3c3627c5b8430d3488ad8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:46:39 +0100 Subject: [PATCH 49/52] Update travis config --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 854925e9109..ea26438b435 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: trusty to have php 5.4+ available +os: linux dist: trusty sudo: required From 81ae6c45ea6bda0f70c4fd5a95b861350a11ba5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:47:58 +0100 Subject: [PATCH 50/52] composer is a big mess --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ea26438b435..4e947325633 100644 --- a/.travis.yml +++ b/.travis.yml @@ -300,7 +300,7 @@ script: # Ensure we catch errors set -e #parallel-lint --exclude htdocs/includes --blame . - parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpsec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . + parallel-lint --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . set +e echo From 5a5863f46aa947de59c0dc0be9dcbbd46116f921 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 03:55:34 +0100 Subject: [PATCH 51/52] FIX Group by invalid with pgsql --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5ede559c0bf..1a42c9816b9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2143,7 +2143,7 @@ class Form } } - $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country as country_id, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; + $selectFields = " p.rowid, p.ref, p.label, p.description, p.barcode, p.fk_country, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; if (count($warehouseStatusArray)) { $selectFieldsGrouped = ", sum(".$db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock @@ -2467,7 +2467,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; - $outorigin = $objp->country_id; + $outorigin = $objp->fk_country; $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; From c9696114f45b1158d06437215c7d420eaa927d68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Mar 2020 04:30:16 +0100 Subject: [PATCH 52/52] Fix scrutinizer --- htdocs/bookmarks/bookmarks.lib.php | 1 + htdocs/opensurvey/fonctions.php | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 199c227df43..699065520da 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -112,6 +112,7 @@ function printDropdownBookmarksList() $searchForm .= ''; } + $i = 0; while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) { $searchForm .= '