From 2615a1f1529cc88851411f3cf6b5e30a18b03c48 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 15:34:45 +0200 Subject: [PATCH 01/15] Update list.php --- htdocs/user/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index fe05c551945..6d0fecb6210 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -126,6 +126,7 @@ $arrayfields = array( 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)), 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), + 'u.fk_warehouse'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), @@ -154,6 +155,7 @@ $search_email = GETPOST('search_email', 'alpha'); $search_api_key = GETPOST('search_api_key', 'alphanohtml'); $search_statut = GETPOST('search_statut', 'intcomma'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); +$search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_supervisor = GETPOST('search_supervisor', 'intcomma'); $optioncss = GETPOST('optioncss', 'alpha'); $search_categ = GETPOST("search_categ", 'int'); @@ -223,6 +225,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; $search_datelastlogin = ""; @@ -362,6 +365,9 @@ if ($search_supervisor > 0) { if ($search_thirdparty != '') { $sql .= natural_search(array('s.nom'), $search_thirdparty); } +if ($search_warehouse != '') { + $sql .= natural_search(array('u.fk_warehouse'), $search_warehouse); +} if ($search_login != '') { $sql .= natural_search("u.login", $search_login); } From 7b8d4c26566e0d557f4de0d46f6d85e982637d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 May 2021 20:32:41 +0200 Subject: [PATCH 02/15] phpcs --- htdocs/admin/mails_templates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 68e579697d3..c2a54e31a3a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -11,7 +11,7 @@ * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2018-2021 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 @@ -339,7 +339,7 @@ if (empty($reshook)) { $sql = "INSERT INTO ".$tabname[$id]." ("; // List of fields $sql .= $tabfieldinsert[$id]; - $sql .= ", active, enabled)"; + $sql .= ", active, enabled)"; $sql .= " VALUES("; // List of values From 7897469963fd897a12c592c67318a90f0b8e8cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 May 2021 20:34:45 +0200 Subject: [PATCH 03/15] Update account.class.php --- htdocs/compta/bank/class/account.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 0a094a8ab7b..8c29a9ffc36 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1693,8 +1693,7 @@ class Account extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'"; - if (!$db->query($sql)) - { + if (!$db->query($sql)) { //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. //$this->errors = $db->lasterror(); return false; From 4ef53234f12bfeeeb2b83e1e79fb0badb74ae4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 May 2021 20:39:36 +0200 Subject: [PATCH 04/15] Update partnership.class.php --- htdocs/partnership/class/partnership.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a42e12fd412..8b3c9b8240a 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -119,6 +119,10 @@ class Partnership extends CommonObject public $date_partnership_end; public $count_last_url_check_error; public $last_check_backlink; + + /** + * @var string reason_decline_or_cancel + */ public $reason_decline_or_cancel; // END MODULEBUILDER PROPERTIES @@ -848,9 +852,10 @@ class Partnership extends CommonObject /** * Set refused status * - * @param User $user Object user that modify - * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers - * @return int <0 if KO, 0=Nothing done, >0 if OK + * @param User $user Object user that modify + * @param string $reasondeclinenote Reason decline + * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers + * @return int <0 if KO, 0=Nothing done, >0 if OK */ public function refused($user, $reasondeclinenote = '', $notrigger = 0) { From f377b8129aa2337c6316524911a971e3811707d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 May 2021 21:06:25 +0200 Subject: [PATCH 05/15] remove declaration already in commonobject --- htdocs/partnership/class/partnership.class.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a42e12fd412..9c2a6153c74 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -101,18 +101,20 @@ class Partnership extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array(); + + /** + * @var int rowid + * @deprecated + * @see id + */ public $rowid; - public $ref; + public $fk_soc; - public $note_public; - public $note_private; - public $date_creation; + public $tms; public $fk_user_creat; public $fk_user_modif; - public $last_main_doc; - public $import_key; - public $model_pdf; + public $status; public $fk_member; public $date_partnership_start; From 842268df106edcb7b2c2db51cbeee811207b2a90 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 22:11:41 +0200 Subject: [PATCH 06/15] Update list.php --- htdocs/user/list.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 6d0fecb6210..337d02ec8a2 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -126,7 +126,6 @@ $arrayfields = array( 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>($conf->api->enabled && $user->admin)), 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), - 'u.fk_warehouse'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>($conf->salaries->enabled && !empty($user->rights->salaries->readall))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), @@ -416,6 +415,9 @@ if ($search_categ > 0) { if ($search_categ == -2) { $sql .= " AND cu.fk_categorie IS NULL"; } +if ($search_warehouse > 0) { + $sql .= " AND u.fk_warehouse = ".$db->escape($search_warehouse); +} if ($mode == 'employee' && empty($user->rights->salaries->readall)) { $sql .= " AND u.fk_user IN (".$db->sanitize(join(',', $childids)).")"; } @@ -523,7 +525,10 @@ if ($mode != '') { $param .= '&mode='.urlencode($mode); } if ($search_categ > 0) { - $param .= "&search_categ=".urlencode($search_categ); + $param .= '&search_categ='.urlencode($search_categ); +} +if ($search_warehouse > 0) { + $param .= '&search_warehouse='.urlencode($search_warehouse); } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -601,8 +606,16 @@ $moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; - $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"'); - $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); + $tmptitle = $langs->trans('Category'); + $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle); + $moreforfilter .= '
'; +} +if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; + $formproduct = new FormProduct($db); + $moreforfilter .= '
'; + $tmptitle = $langs->trans('Warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle); $moreforfilter .= '
'; } From 7b0d0805f2f76daa82ea1517b33f0d5d624d2f89 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 22:14:45 +0200 Subject: [PATCH 07/15] Update list.php --- htdocs/user/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 337d02ec8a2..debe3e35d12 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -610,6 +610,7 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle); $moreforfilter .= ''; } +// Filter on warehouse if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); From a56dc4ff65839a71036df8e247f643da4d2e77e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 May 2021 22:28:03 +0200 Subject: [PATCH 08/15] fix mulitple module using completeTabsHead complete $template['head'] in module and return 0 to not replace instead return $head and replace --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1e97b424b8f..9ce3948efdf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8385,12 +8385,12 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, // No need to make a return $head. Var is modified as a reference if (!empty($hookmanager)) { - $parameters = array('object' => $object, 'mode' => $mode, 'head' => $head); + $parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head); $reshook = $hookmanager->executeHooks('completeTabsHead', $parameters); if ($reshook > 0) { $head = $hookmanager->resArray; - $h = count($head); } + $h = count($head); } } From 82bf9cd3e970b305ca581c48c33ae214305c5798 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:13:49 +0200 Subject: [PATCH 09/15] Fix public new member form use adh type amount --- htdocs/public/members/new.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 233bc483d06..9bf8cfdb18e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -543,6 +543,10 @@ jQuery(document).ready(function () { document.newmember.action.value="create"; document.newmember.submit(); }); + jQuery("#typeid").change(function() { + document.newmember.action.value="create"; + document.newmember.submit(); + }); }); }); '; @@ -561,7 +565,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $isempty = 0; } print ''.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print ''."\n"; } else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); @@ -704,7 +708,8 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; + $amountbytype = adht->amountByType(1); + $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; @@ -713,6 +718,9 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } + + $amount = price2num($amount); + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' print ''.$langs->trans("Subscription").''; if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { From 2e2b6af98ea80217d4602e01406e25a43e3c219e Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:23:46 +0200 Subject: [PATCH 10/15] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 9bf8cfdb18e..1b4fc6283b1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -708,7 +708,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // Set amount for the subscription - $amountbytype = adht->amountByType(1); + $amountbytype = $adht->amountByType(1); $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { From 9af05f3c6eff76e6106bf26687b3ebc24e29c1c4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:25:38 +0200 Subject: [PATCH 11/15] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 1b4fc6283b1..33af176a169 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid',int)]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 912995a5588511a11409d534ee959052ee052243 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:28:03 +0200 Subject: [PATCH 12/15] Create new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 33af176a169..aaa504bc54d 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid',int)] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset ($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 949e797390437fd3a03c68f5eb6df6a482d29174 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 6 May 2021 22:31:41 +0000 Subject: [PATCH 13/15] Fixing style errors. --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index aaa504bc54d..bbd1661ad94 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -709,7 +709,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER // Set amount for the subscription $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset ($amount) ? $amount : 0); + $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset($amount) ? $amount : 0); if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; From 6504f961887f5e442071a71ed57aa437d9d49ce4 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Fri, 7 May 2021 00:43:01 +0200 Subject: [PATCH 14/15] Copyright --- htdocs/public/members/new.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index bbd1661ad94..71446b58779 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -6,6 +6,7 @@ * Copyright (C) 2012 J. Fernando Lagrange * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2021 Waël Almoman * * 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 From 671633fe867ef1f04c76d7a32023cf7f71aad35c Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 7 May 2021 11:48:14 +0200 Subject: [PATCH 15/15] Fix : Bug included in develop branch and 13.0 --- test/phpunit/CodingPhpTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index b3250b9e265..37fc7eee703 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -219,7 +219,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase 'multicurrency.class.php', 'productbatch.class.php', 'reception.class.php', - 'societe.class.php' + 'societe.class.php' , + 'account.class.php' ))) { // Must must not found $db-> $ok=true;