Add Hook Extrafields Update - init extrafieldssdao
This commit is contained in:
parent
f6f4968af6
commit
8fb474c687
@ -603,6 +603,8 @@ class ExtraFields
|
||||
*/
|
||||
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
||||
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
||||
|
||||
@ -643,6 +645,18 @@ class ExtraFields
|
||||
}
|
||||
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default);
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$hookmanager->initHooks(array('extrafieldsdao'));
|
||||
$parameters = array('field_desc'=>&$field_desc, 'table'=>$table, 'attr_name'=>$attrname, 'label'=>$label, 'type'=>$type, 'length'=>$length, 'unique'=>$unique, 'required'=>$required, 'pos'=>$pos, 'param'=>$param, 'alwayseditable'=>$alwayseditable, 'perms'=>$perms, 'list'=>$list, 'help'=>$help, 'default'=>$default, 'computed'=>$computed, 'entity'=>$entity, 'langfile'=>$langfile, 'enabled'=>$enabled, 'totalizable'=>$totalizable, 'printable'=>$printable);
|
||||
$reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if ($reshook < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($type != 'separate') // No table update when separate type
|
||||
{
|
||||
$result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user