From ec2035a73e4d11599ceefb7b1bf2fa4e2fc95e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 25 May 2015 17:19:22 +0200 Subject: [PATCH] Allow usage of contact extrafield element type As documented in the methods comments --- htdocs/core/class/extrafields.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e2313d157d5..be006f5489b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -124,6 +124,7 @@ class ExtraFields if (empty($label)) return -1; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; // Create field into database except for separator type which is not stored in database if ($type != 'separate') @@ -169,6 +170,7 @@ class ExtraFields private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0) { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -248,6 +250,7 @@ class ExtraFields global $conf; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; // Clean parameters if (empty($pos)) $pos=0; @@ -308,6 +311,7 @@ class ExtraFields function delete($attrname, $elementtype='member') { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -342,6 +346,7 @@ class ExtraFields global $conf; if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) { @@ -389,6 +394,7 @@ class ExtraFields function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='') { if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $table=$elementtype.'_extrafields'; @@ -486,6 +492,8 @@ class ExtraFields // Clean parameters if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; + if (empty($list)) $list=0; if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) @@ -570,6 +578,7 @@ class ExtraFields if ( empty($elementtype) ) return array(); if ($elementtype == 'thirdparty') $elementtype='societe'; + if ($elementtype == 'contact') $elementtype='socpeople'; $array_name_label=array();