diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 6dce90d372b..d4ce1cbb0fe 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -58,9 +58,10 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line + * @param int $showRef Show customer and supplier reference on each contract (when found) * @return int Nbr of project if OK, <0 if KO */ - public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) + public function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0) { // phpcs:enable global $db, $user, $conf, $langs; @@ -69,7 +70,8 @@ class FormContract if (!empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true; // Search all contacts - $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut'; + $sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut,'; + $sql .= ' c.ref_customer, c.ref_supplier'; $sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c'; $sql .= " WHERE c.entity = ".$conf->entity; //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; @@ -105,6 +107,13 @@ class FormContract // Do nothing } else { $labeltoshow = dol_trunc($obj->ref, 18); + + if ($showRef) + { + if ($obj->ref_customer) $labeltoshow = $labeltoshow." - ".$obj->ref_customer; + if ($obj->ref_supplier) $labeltoshow = $labeltoshow." - ".$obj->ref_supplier; + } + //if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')'; //else $labeltoshow.=' ('.$langs->trans("Private").')'; if (!empty($selected) && $selected == $obj->rowid && $obj->statut > 0) @@ -166,9 +175,10 @@ class FormContract * @param string $htmlname Nom de la zone html * @param int $maxlength Maximum length of label * @param int $showempty Show empty line + * @param int $showRef Show customer and supplier reference on each contract (when found) * @return int Nbr of project if OK, <0 if KO */ - public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) + public function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0) { global $langs; @@ -176,7 +186,7 @@ class FormContract print '
'; print ''; print ''; - $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty); + $this->select_contract($socid, $selected, $htmlname, $maxlength, $showempty, $showRef); print ''; print '
'; } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 6700bd8a7f9..f8e34cc5b55 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -906,7 +906,7 @@ if ($action == 'create') { $langs->load("contracts"); print ''.$langs->trans("Contract").''; - $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1); + $numcontrat = $formcontract->select_contract($soc->id, GETPOST('contratid', 'int'), 'contratid', 0, 1, 1); if ($numcontrat == 0) { print '   '; @@ -1238,7 +1238,7 @@ if ($action == 'create') if ($action == 'contrat') { $formcontract = new Formcontract($db); - $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1); + $formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1, 1); } else { if ($object->fk_contrat) { diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql new file mode 100644 index 00000000000..4c191193754 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.key.sql @@ -0,0 +1,21 @@ +-- ============================================================================ +-- Copyright (C) 2020 John BOTELLA +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- ============================================================================ + + +ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level); + diff --git a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql index ae068b71ed0..70086f82068 100644 --- a/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql +++ b/htdocs/install/mysql/tables/llx_product_attribute_combination_price_level.sql @@ -25,4 +25,3 @@ CREATE TABLE llx_product_attribute_combination_price_level variation_price_percentage INTEGER NULL )ENGINE=innodb; -ALTER TABLE llx_product_attribute_combination_price_level ADD UNIQUE( fk_product_attribute_combination, fk_price_level);