From d978d64d5906116d957af65dad64e0c0149f319d Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 24 Sep 2013 14:19:52 +0200 Subject: [PATCH 1/4] Update commonobject.class.php just the active type of contact --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6d89e18c77d..c2a8a052df1 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -461,6 +461,7 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; + $sql.= " AND tc.active=1"; // only the active type if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order; From b400803a2a3fbe8d9e88b244df9251a7e450ec53 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 25 Sep 2013 10:15:32 +0200 Subject: [PATCH 2/4] Update commonobject.class.php add complementary param --- htdocs/core/class/commonobject.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c2a8a052df1..7eae4f9faed 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -453,7 +453,7 @@ abstract class CommonObject * @param string $option 0=Return array id->label, 1=Return array code->label * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='code', $option=0) + function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) { global $langs; @@ -461,7 +461,9 @@ abstract class CommonObject $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE tc.element='".$this->element."'"; - $sql.= " AND tc.active=1"; // only the active type + if ($activeonly == 1) + $sql.= " AND tc.active=1"; // only the active type + if (! empty($source)) $sql.= " AND tc.source='".$source."'"; $sql.= " ORDER by tc.".$order; From f88470d3b8f96633e05c8b7ed19ea5432ff44ece Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Wed, 25 Sep 2013 10:17:27 +0200 Subject: [PATCH 3/4] Update html.formcompany.class.php use paramter to select only active type of contact --- htdocs/core/class/html.formcompany.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 97a0c9e9f26..a6210be79c6 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -627,7 +627,7 @@ class FormCompany { if (is_object($object) && method_exists($object, 'liste_type_contact')) { - $lesTypes = $object->liste_type_contact($source, $order); + $lesTypes = $object->liste_type_contact($source, $order, 0, 1); print '