diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php
index b866c322158..b91cc49374c 100644
--- a/htdocs/core/actions_extrafields.inc.php
+++ b/htdocs/core/actions_extrafields.inc.php
@@ -162,6 +162,7 @@ if ($action == 'add')
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
+ ,(GETPOST('ishidden')?1:0)
);
if ($result > 0)
{
@@ -312,6 +313,7 @@ if ($action == 'update')
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
+ ,(GETPOST('ishidden')?1:0)
);
if ($result > 0)
{
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 005f4684322..d90932d1738 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4085,6 +4085,7 @@ abstract class CommonObject
else
{
$csstyle='';
+ $class=(!empty($extrafields->attribute_hidden[$key]) ? 'class="hideobject" ' : '');
if (is_array($params) && count($params)>0) {
if (array_key_exists('style',$params)) {
$csstyle=$params['style'];
@@ -4092,12 +4093,12 @@ abstract class CommonObject
}
if ( !empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
{
- $out .= '
';
+ $out .= ' ';
$colspan='0';
}
else
{
- $out .= ' ';
+ $out .= ' ';
}
// Convert date into timestamp format
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index ee5f1465e3f..828483db3c7 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -61,6 +61,8 @@ class ExtraFields
var $error;
var $errno;
+ var $attribute_hidden;
+
public static $type2label=array(
'varchar'=>'String',
'text'=>'TextLong',
@@ -98,6 +100,7 @@ class ExtraFields
$this->attribute_required = array();
$this->attribute_perms = array();
$this->attribute_list = array();
+ $this->attribute_hidden = array();
}
/**
@@ -116,9 +119,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
+ * @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
- function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0)
+ function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0, $perms='', $list=0, $ishidden=0)
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@@ -135,7 +139,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{
// Add declaration of field into table
- $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list);
+ $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $ishidden);
$err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{
@@ -243,9 +247,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
+ * @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
- private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0)
+ private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0)
{
global $conf;
@@ -271,7 +276,7 @@ class ExtraFields
$params='';
}
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list)";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable, perms, list, ishidden)";
$sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',";
@@ -285,6 +290,7 @@ class ExtraFields
$sql.= " '".$alwayseditable."',";
$sql.= " ".($perms?"'".$this->db->escape($perms)."'":"null").",";
$sql.= " ".$list;
+ $sql.= ", ".$ishidden;
$sql.=')';
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
@@ -389,9 +395,10 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
+ * @param int $ishidden Is hidden extrafield
* @return int >0 if OK, <=0 if KO
*/
- function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='')
+ function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='',$ishidden=0)
{
if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
@@ -432,7 +439,7 @@ class ExtraFields
{
if ($label)
{
- $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list);
+ $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$ishidden);
}
if ($result > 0)
{
@@ -483,12 +490,13 @@ class ExtraFields
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
* @param int $list Into list view by default
+ * @param int $ishidden Is hidden extrafield
* @return int <=0 if KO, >0 if OK
*/
- private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0)
+ private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list=0,$ishidden=0)
{
global $conf;
- dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list);
+ dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$ishidden);
// Clean parameters
if ($elementtype == 'thirdparty') $elementtype='societe';
@@ -526,6 +534,7 @@ class ExtraFields
$sql.= " alwayseditable,";
$sql.= " param,";
$sql.= " list";
+ $sql.= ", ishidden";
$sql.= ") VALUES (";
$sql.= "'".$attrname."',";
$sql.= " ".$conf->entity.",";
@@ -540,6 +549,7 @@ class ExtraFields
$sql.= " '".$alwayseditable."',";
$sql.= " '".$param."',";
$sql.= " ".$list;
+ $sql.= ", ".$ishidden;
$sql.= ")";
dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
$resql2=$this->db->query($sql);
@@ -585,7 +595,7 @@ class ExtraFields
// For avoid conflicts with external modules
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
- $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list";
+ $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,list,ishidden";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
@@ -616,6 +626,7 @@ class ExtraFields
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
$this->attribute_perms[$tab->name]=$tab->perms;
$this->attribute_list[$tab->name]=$tab->list;
+ $this->attribute_hidden[$tab->name]=$tab->ishidden;
}
}
}
diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index 174da1ae409..6273ea93940 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -118,6 +118,8 @@
trans("Required"); ?> >
trans("AlwaysEditable"); ?> >
+
+trans("IsHidden"); ?> >
global->MAIN_FEATURES_LEVEL >= 2) { ?>
trans("ByDefaultInList"); ?>
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index 5551d848b5f..71b81ecee0f 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -60,6 +60,7 @@ $alwayseditable=$extrafields->attribute_alwayseditable[$attrname];
$param=$extrafields->attribute_param[$attrname];
$perms=$extrafields->attribute_perms[$attrname];
$list=$extrafields->attribute_list[$attrname];
+$ishidden=$extrafields->attribute_hidden[$attrname];
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{
@@ -117,6 +118,8 @@ if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($typ
trans("Required"); ?> >
trans("AlwaysEditable"); ?> >
+
+trans("IsHidden"); ?> >
global->MAIN_FEATURES_LEVEL >= 2) { ?>
trans("ByDefaultInList"); ?>
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index a5890e36ea2..adb04bbc540 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -44,6 +44,7 @@ print ' '.$langs->trans("Size").' ';
print ''.$langs->trans("Unique").' ';
print ''.$langs->trans("Required").' ';
print ''.$langs->trans("AlwaysEditable").' ';
+print ''.$langs->trans("IsHidden").' ';
print ' ';
print " \n";
@@ -60,6 +61,7 @@ foreach($extrafields->attribute_type as $key => $value)
print ''.yn($extrafields->attribute_unique[$key])." \n";
print ''.yn($extrafields->attribute_required[$key])." \n";
print ''.yn($extrafields->attribute_alwayseditable[$key])." \n";
+ print ''.yn($extrafields->attribute_hidden[$key])." \n";
print ''.img_edit().' ';
print " ".img_delete()." \n";
print "";
diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php
index 8b38cbc5520..9789922e6dc 100644
--- a/htdocs/core/tpl/extrafields_view.tpl.php
+++ b/htdocs/core/tpl/extrafields_view.tpl.php
@@ -45,7 +45,8 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
}
else
{
- print '';
+ if (!empty($extrafields->attribute_hidden[$key])) print ' ';
+ else print ' ';
print 'attribute_required[$key])) print ' class="fieldrequired"';
diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
index 9ac450b90f8..e10746958aa 100644
--- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
+++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql
@@ -76,7 +76,7 @@ ALTER TABLE llx_website_page ADD UNIQUE INDEX uk_website_page_url (fk_website,pa
ALTER TABLE llx_website_page ADD CONSTRAINT fk_website_page_website FOREIGN KEY (fk_website) REFERENCES llx_website (rowid);
-
+ALTER TABLE llx_extrafields ADD COLUMN ishidden integer DEFAULT 0;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql
index 9ccbdf60bff..062f20b5c9f 100644
--- a/htdocs/install/mysql/tables/llx_extrafields.sql
+++ b/htdocs/install/mysql/tables/llx_extrafields.sql
@@ -34,4 +34,5 @@ create table llx_extrafields
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
list integer DEFAULT 0 -- list of values for field that are combo lists
+ ,ishidden integer DEFAULT 0
)ENGINE=innodb;
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 55eb22f0aee..cc596bae7e8 100755
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1641,6 +1641,7 @@ CloseFiscalYear=Close fiscal year
DeleteFiscalYear=Delete fiscal year
ConfirmDeleteFiscalYear=Are you sure to delete this fiscal year ?
AlwaysEditable=Can always be edited
+IsHidden=Is not visible
MAIN_APPLICATION_TITLE=Force visible name of application (warning: setting your own name here may break autofill login feature when using DoliDroid mobile application)
NbMajMin=Minimum number of uppercase characters
NbNumMin=Minimum number of numeric characters