From 537048a10a37c8cee123722112835c6193524be0 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 15:30:32 +0200 Subject: [PATCH 1/7] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index f4902e4912e..c6cf20dd5f1 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2012-2018 Charlene BENKE * * 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 @@ -57,7 +57,7 @@ class FormContract global $db,$user,$conf,$langs; $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; From 2f1800f3e23dd2fd03d7182c95cfac48efb8ded9 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 15:34:26 +0200 Subject: [PATCH 2/7] Update html.formprojet.class.php --- htdocs/core/class/html.formprojet.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index a572d546ca7..75ccc1d8245 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Marcos GarcĂ­a + * Copyright (C) 2018 Charlene Benke * * 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 @@ -139,10 +140,10 @@ class FormProjets if (empty($htmlid)) $htmlid = $htmlname; $out=''; - $outarray=array(); + $outarray=array(); $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; $projectsListId = false; if (empty($user->rights->projet->all->lire)) @@ -317,7 +318,7 @@ class FormProjets $out=''; $hideunselectables = false; - if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (empty($projectsListId)) { From b0757916c4731fea9e04048fffb88e08b2d1ee45 Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 16:59:03 +0200 Subject: [PATCH 3/7] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index c6cf20dd5f1..28b256e32ef 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -64,8 +64,18 @@ class FormContract $sql.= ' FROM '.MAIN_DB_PREFIX .'contrat as c'; $sql.= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; + if ($socid > 0) + { + // CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. + if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) + $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; + else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') + { + $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; + $sql.= " OR p.fk_soc IS NULL)"; + } + } if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; - if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; $sql.= " ORDER BY c.ref "; dol_syslog(get_class($this)."::select_contract", LOG_DEBUG); From f4af9ec22f9b2c55fb9cf73523cb4d8ae05a7bff Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 19:38:30 +0200 Subject: [PATCH 4/7] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 28b256e32ef..64d28e6b281 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -72,7 +72,7 @@ class FormContract else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; - $sql.= " OR p.fk_soc IS NULL)"; + $sql.= " OR c.fk_soc IS NULL)"; } } if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; From 4bebc8149baae5a744159a046e8a2c074794ec9e Mon Sep 17 00:00:00 2001 From: BENKE Charlene Date: Sun, 13 May 2018 21:17:15 +0200 Subject: [PATCH 5/7] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 64d28e6b281..01ebe66666b 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -108,12 +108,12 @@ class FormContract else { $disabled=0; - if (! $obj->statut > 0) + if ( $obj->statut == 0) { $disabled=1; $labeltoshow.=' ('.$langs->trans("Draft").')'; } - if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) + if ( empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled=1; $labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany"); From 933a6a5ba353306fc599a27c8918ed6ff487353d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jun 2018 22:11:44 +0200 Subject: [PATCH 6/7] Update html.formcontract.class.php --- htdocs/core/class/html.formcontract.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 01ebe66666b..a3a3696e5f4 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -57,7 +57,7 @@ class FormContract global $db,$user,$conf,$langs; $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; From e18717aa8575bbc78ee334c3917c73dd470743e5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Jun 2018 22:12:16 +0200 Subject: [PATCH 7/7] Update html.formprojet.class.php --- htdocs/core/class/html.formprojet.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 75ccc1d8245..f437920caf9 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -143,7 +143,7 @@ class FormProjets $outarray=array(); $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; $projectsListId = false; if (empty($user->rights->projet->all->lire)) @@ -318,7 +318,7 @@ class FormProjets $out=''; $hideunselectables = false; - if (! empty($conf->global->SELECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; if (empty($projectsListId)) {