From a15353fa333bd1bfa42a8a1657d2083a48aae89b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 13:42:40 +0100 Subject: [PATCH 01/12] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index c87289da390..55c42cd4c28 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -1,9 +1,10 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent +/* Copyright (C) 2004 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -225,10 +226,12 @@ if ($action == "setaskforshippingmet") { } } -//Activate "Disable prospect/customer type" +// Activate "Disable prospect/customer type" if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); + // Remove customer type by default if type prospect/customer is disabled + $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } From 5a86f998904f386cb7af9dbb987c8244f5dc825a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 13 Feb 2022 17:53:22 +0100 Subject: [PATCH 02/12] FIX Disable customer type by default if type prospect/customer is disabled --- htdocs/societe/admin/societe.php | 3 --- htdocs/societe/card.php | 41 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 55c42cd4c28..ab6c6bd063d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -4,7 +4,6 @@ * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -230,8 +229,6 @@ if ($action == "setaskforshippingmet") { if ($action == "setdisableprospectcustomer") { $setdisableprospectcustomer = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity); - // Remove customer type by default if type prospect/customer is disabled - $res = dolibarr_del_const($db, "THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT", $conf->entity); if (!($res > 0)) { $error++; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 668d8199b16..8c2c7e85e56 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Patrick Raguin * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2011-2013 Alexandre Spangaro + * Copyright (C) 2011-2022 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud @@ -986,21 +986,24 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $modCodeFournisseur = new $module; // Define if customer/prospect or supplier status is set or not - if (GETPOST("type") != 'f') { + if (GETPOST("type", 'aZ') != 'f') { $object->client = -1; if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client = 3; } } // Prospect / Customer - if (GETPOST("type") == 'c') { + if (GETPOST("type", 'aZ') == 'c') { if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { $object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; } else { $object->client = 3; } } - if (GETPOST("type") == 'p') { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + $object->client = 1; + } + if (GETPOST("type", 'aZ') == 'p') { $object->client = 2; } if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { @@ -1757,21 +1760,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (GETPOSTISSET('name')) { // We overwrite with values if posted - $object->name = GETPOST('name', 'alphanohtml'); - $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); - $object->client = GETPOST('client', 'int'); - $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alphanohtml'); - $object->zip = GETPOST('zipcode', 'alphanohtml'); - $object->town = GETPOST('town', 'alphanohtml'); - $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; - $object->state_id = GETPOST('state_id', 'int'); - //$object->skype = GETPOST('skype', 'alpha'); - //$object->twitter = GETPOST('twitter', 'alpha'); - //$object->facebook = GETPOST('facebook', 'alpha'); - //$object->linkedin = GETPOST('linkedin', 'alpha'); + $object->name = GETPOST('name', 'alphanohtml'); + $object->prefix_comm = GETPOST('prefix_comm', 'alphanohtml'); + $object->client = GETPOST('client', 'int'); + $object->code_client = GETPOST('customer_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur', 'int'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alphanohtml'); + $object->zip = GETPOST('zipcode', 'alphanohtml'); + $object->town = GETPOST('town', 'alphanohtml'); + $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; + $object->state_id = GETPOST('state_id', 'int'); + //$object->skype = GETPOST('skype', 'alpha'); + //$object->twitter = GETPOST('twitter', 'alpha'); + //$object->facebook = GETPOST('facebook', 'alpha'); + //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { From b7e7c95d2a3e2549031dfef95699320c82c51b25 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 29 Mar 2022 16:02:39 +0200 Subject: [PATCH 03/12] FIX : ref_client doesn't exists on supplier invoice, then ref_fourn needs to have a default value when we want to bill several supplier orders --- htdocs/fourn/commande/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 72fc7a7439c..2fb6f03607a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -291,7 +291,7 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_client = $cmd->ref_client; + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : dol_print_date(dol_now(), '%Y%m%d%H%M%S'); } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From 6480877b9900af10c17db64b05d9a240586ee434 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 10:01:17 +0200 Subject: [PATCH 04/12] FIX : We need to have a different default_ref_supplier for each new fourn invoice --- htdocs/fourn/commande/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 2fb6f03607a..b2b6484917d 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -274,6 +274,8 @@ if (empty($reshook)) { $db->begin(); + $default_ref_supplier=dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + foreach ($orders as $id_order) { $cmd = new CommandeFournisseur($db); if ($cmd->fetch($id_order) <= 0) { @@ -291,7 +293,7 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : dol_print_date(dol_now(), '%Y%m%d%H%M%S'); + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier+1; } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From 7d3dbf1876ec3acc96301c410d2fbb0b8c3ebdbe Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 11:20:01 +0200 Subject: [PATCH 05/12] FIX : "WHERE" clause missing on resource export --- htdocs/core/modules/modResource.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 944866d82e2..0478cdff2a7 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -249,7 +249,7 @@ class modResource extends DolibarrModules $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid'; - $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; + $this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')'; // Imports From e93f1cc5074c8efb50c47cf918dcfa78f0aa7f5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Mar 2022 12:15:33 +0200 Subject: [PATCH 06/12] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8c2c7e85e56..a88aec05618 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1000,7 +1000,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->client = 3; } } - if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS) && $object->client == 3) { $object->client = 1; } if (GETPOST("type", 'aZ') == 'p') { From 684e816ac32b305443c360d63be95fb0bb1fa73d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 30 Mar 2022 14:12:16 +0200 Subject: [PATCH 07/12] FIX : incrementation --- htdocs/fourn/commande/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index b2b6484917d..de195504d39 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -293,7 +293,8 @@ if (empty($reshook)) { $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) { - $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier+1; + $objecttmp->ref_supplier = !empty($cmd->ref_supplier) ? $cmd->ref_supplier : $default_ref_supplier; + $default_ref_supplier+=1; } $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); From a22450391f9ac4cfd7c61cd1240cb29f430d708f Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 30 Mar 2022 15:50:36 +0200 Subject: [PATCH 08/12] FIX - Fix search by filters --- htdocs/compta/stats/casoc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 76dbc56beef..0bef7ff555a 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -57,6 +57,7 @@ $socid = GETPOST('socid', 'int'); // Category $selected_cat = (int) GETPOST('search_categ', 'int'); +if ($selected_cat == -1) $selected_cat = ''; $subcat = false; if (GETPOST('subcat', 'alpha') === 'yes') { $subcat = true; From ce83fa9f7e32621bd59eccd4dc8f1a34cc5fd299 Mon Sep 17 00:00:00 2001 From: atm-florian Date: Thu, 31 Mar 2022 17:34:24 +0200 Subject: [PATCH 09/12] FIX missing call to executeHooks() --- htdocs/core/boxes/box_dolibarr_state_board.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 21bf58b859f..028547f7867 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -79,6 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); + $object = new stdClass; + $action = ''; + $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; From e7db103b57d527a15f7a8fc4e52ee7e8077a3995 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 31 Mar 2022 18:55:54 +0200 Subject: [PATCH 10/12] fix: on update with action reminder in future there is user key error --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 0833929c82a..adfd3f34429 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders(); + $object->loadReminders($remindertype,0,false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user); From 5df5050418461383fbabb72fad6dac0eb5df1c04 Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Fri, 1 Apr 2022 09:14:04 +0200 Subject: [PATCH 11/12] Apply suggestions from code review replace spaces with tabs --- htdocs/core/boxes/box_dolibarr_state_board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index 028547f7867..9661b1d363e 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -79,9 +79,9 @@ class box_dolibarr_state_board extends ModeleBoxes if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) { $hookmanager = new HookManager($this->db); $hookmanager->initHooks(array('index')); - $object = new stdClass; - $action = ''; - $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); + $object = new stdClass; + $action = ''; + $hookmanager->executeHooks('addStatisticLine', array(), $object, $action); $boxstatItems = array(); $boxstatFromHook = ''; $boxstatFromHook = $hookmanager->resPrint; From 106e3072dcbbe1415c9f4a34822b2843f305e451 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 1 Apr 2022 13:20:40 +0200 Subject: [PATCH 12/12] Update card.php --- htdocs/comm/action/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index adfd3f34429..a5a898ef7f2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -659,7 +659,7 @@ if (empty($reshook) && $action == 'update') { $categories = GETPOST('categories', 'array'); $object->setCategories($categories); - $object->loadReminders($remindertype,0,false); + $object->loadReminders($remindertype, 0, false); if (!empty($object->reminders) && $object->datep > dol_now()) { foreach ($object->reminders as $reminder) { $reminder->delete($user);