From 711339945ce8a43f2f771a24e56e707053d1e8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 2 Oct 2020 21:41:05 +0200 Subject: [PATCH 1/8] use create instead edit on create contract --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9581d625f80..dbdba874dda 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -1264,7 +1264,7 @@ if ($action == 'create') // Other attributes if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit', $parameters); + print $object->showOptionals($extrafields, 'create', $parameters); } print "\n"; From 3840d6c0a7bcea82a540b75cba696342be2c7975 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 13:52:52 +0200 Subject: [PATCH 2/8] Fix entity in ordre box --- htdocs/core/boxes/box_commandes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index c48e79bb4bd..372dba8081a 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; From e9c101349b6ca215d947ee27e291bf32c522dd3f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 13:57:37 +0200 Subject: [PATCH 3/8] Fix multicompany in propal box --- htdocs/core/boxes/box_propales.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 7e73166ed90..12e1166120c 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -91,7 +91,7 @@ class box_propales extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; + $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; From 26a2fea8c70f9ff9d6dce01641c6819a343fcab9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:00:23 +0200 Subject: [PATCH 4/8] Fix multicompany in supplier order box --- htdocs/core/boxes/box_supplier_orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 85ee2e6f71c..f69f6e10099 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; From 331db5e367a1faa82ea9eb735b375d09711ecead Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:01:46 +0200 Subject: [PATCH 5/8] Fix multicompany in supplier order awaiting box --- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 416dc7f2f2a..b1f53d2de20 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -95,7 +95,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; $sql.= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; From 69660d1a9d407b94d54c9ef70507ba94a5c2c9d4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:02:59 +0200 Subject: [PATCH 6/8] Update box_supplier_orders.php --- htdocs/core/boxes/box_supplier_orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index f69f6e10099..b71b5b660b5 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; + $sql.= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; From af2bd76500bf83d2e5a22a03ac817aca86fc46ff Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:06:33 +0200 Subject: [PATCH 7/8] Fix multicompany in shipment box --- htdocs/core/boxes/box_shipments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 26f45bc08db..4603450b482 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -104,7 +104,7 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; - $sql .= " WHERE e.entity = ".$conf->entity; + $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; From ca16606b4fb54d3d993768cd44e51c776a0b0c08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Oct 2020 23:21:24 +0200 Subject: [PATCH 8/8] Fix phpcs --- htdocs/core/tpl/objectline_edit.tpl.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index b75284938ef..6bffd5f7bb1 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -305,23 +305,25 @@ if (!empty($extrafields)) rights->margins->creer) { -?> + ?> /* Some js test when we click on button "Add" */ jQuery(document).ready(function() { - global->DISPLAY_MARGIN_RATES)) { ?> + global->DISPLAY_MARGIN_RATES)) { + ?> $("input[name='np_marginRate']:first").blur(function(e) { return checkFreeLine(e, "np_marginRate"); }); global->DISPLAY_MARK_RATES)) { ?> + } + if (! empty($conf->global->DISPLAY_MARK_RATES)) { + ?> $("input[name='np_markRate']:first").blur(function(e) { return checkFreeLine(e, "np_markRate"); }); + } + ?> }); /* TODO This does not work for number with thousand separator that is , */ @@ -369,7 +371,7 @@ if (! empty($usemargins) && $user->rights->margins->creer) return true; } -