2
0
forked from Wavyzz/dolibarr

Fix several trouble with some types in modulebuilder

Fix difference between null and 0
This commit is contained in:
Laurent Destailleur
2019-11-17 17:36:36 +01:00
parent 502626156e
commit 16d67a1a8e
7 changed files with 105 additions and 41 deletions

View File

@@ -95,7 +95,7 @@ class BOM extends CommonObject
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'), 'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -49,7 +49,14 @@ if ($action == 'add' && ! empty($permissiontoadd))
{ {
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields if ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') continue; // The field was not submited to be edited
}
else {
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
}
// Ignore special fields
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
// Set value to insert // Set value to insert
if (in_array($object->fields[$key]['type'], array('text', 'html'))) { if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
@@ -58,6 +65,8 @@ if ($action == 'add' && ! empty($permissiontoadd))
$value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); $value = dol_mktime(12, 0, 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'datetime') { } elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'));
} elseif ($object->fields[$key]['type'] == 'duration') {
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} else { } else {
@@ -108,8 +117,16 @@ if ($action == 'update' && !empty($permissiontoadd))
{ {
foreach ($object->fields as $key => $val) foreach ($object->fields as $key => $val)
{ {
// Check if field was submited to be edited
if ($object->fields[$key]['type'] == 'duration') {
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited
}
else {
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields }
// Ignore special fields
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
// Set value to update // Set value to update
if (in_array($object->fields[$key]['type'], array('text', 'html'))) { if (in_array($object->fields[$key]['type'], array('text', 'html'))) {
$value = GETPOST($key, 'none'); $value = GETPOST($key, 'none');
@@ -117,6 +134,12 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'datetime') { } elseif ($object->fields[$key]['type'] == 'datetime') {
$value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year'));
} elseif ($object->fields[$key]['type'] == 'duration') {
if (GETPOST($key.'hour', 'int') != '' || GETPOST($key.'min', 'int') != '') {
$value = 60*60*GETPOST($key.'hour', 'int') + 60*GETPOST($key.'min', 'int');
} else {
$value = '';
}
} elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) { } elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) {
$value = price2num(GETPOST($key)); $value = price2num(GETPOST($key));
} else { } else {

View File

@@ -5626,14 +5626,12 @@ abstract class CommonObject
$objectid = $this->id; $objectid = $this->id;
if ($computed) if ($computed)
{ {
if (!preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>'; if (!preg_match('/^search_/', $keyprefix)) return '<span class="opacitymedium">'.$langs->trans("AutomaticallyCalculated").'</span>';
else return ''; else return '';
} }
// Set value of $morecss. For this, we use in priority showsize from parameters, then $val['css'] then autodefine // Set value of $morecss. For this, we use in priority showsize from parameters, then $val['css'] then autodefine
if (empty($morecss) && !empty($val['css'])) if (empty($morecss) && !empty($val['css']))
{ {
@@ -5689,6 +5687,10 @@ abstract class CommonObject
// TODO Must also support $moreparam // TODO Must also support $moreparam
$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1);
} }
elseif (in_array($type, array('duration')))
{
$out=$form->select_duration($keyprefix.$key.$keysuffix, $value, 0, 'text', 0, 1);
}
elseif (in_array($type, array('int', 'integer'))) elseif (in_array($type, array('int', 'integer')))
{ {
$tmp = explode(',', $size); $tmp = explode(',', $size);
@@ -6239,7 +6241,6 @@ abstract class CommonObject
$type = 'sellist'; $type = 'sellist';
} }
$langfile = $val['langfile']; $langfile = $val['langfile'];
$list = $val['list']; $list = $val['list'];
$help = $val['help']; $help = $val['help'];
@@ -6313,9 +6314,16 @@ abstract class CommonObject
$value = ''; $value = '';
} }
} }
elseif ($type == 'duration')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (! is_null($value) && $value !== '') {
$value = convertSecondToTime($value, 'allhourmin');
}
}
elseif ($type == 'double' || $type == 'real') elseif ($type == 'double' || $type == 'real')
{ {
if (!empty($value)) { if (! is_null($value) && $value !== '') {
$value = price($value); $value = price($value);
} }
} }
@@ -6341,8 +6349,10 @@ abstract class CommonObject
} }
elseif ($type == 'price') elseif ($type == 'price')
{ {
if (! is_null($value) && $value !== '') {
$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); $value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
} }
}
elseif ($type == 'select') elseif ($type == 'select')
{ {
$value = $param['options'][$value]; $value = $param['options'][$value];
@@ -7181,6 +7191,22 @@ abstract class CommonObject
return false; return false;
} }
/**
* Function test if type is duration
*
* @param array $info content informations of field
* @return bool true if field of type duration
*/
public function isDuration($info)
{
if (is_array($info))
{
if (isset($info['type']) && ($info['type'] == 'duration')) return true;
else return false;
}
else return false;
}
/** /**
* Function test if type is integer * Function test if type is integer
* *
@@ -7315,19 +7341,24 @@ abstract class CommonObject
$queryarray[$field] = null; $queryarray[$field] = null;
} }
} }
elseif ($this->isInt($info)) elseif ($this->isDuration($info))
{
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
else $queryarray[$field] = null;
}
elseif ($this->isInt($info) || $this->isFloat($info))
{ {
if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity; if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity;
else else
{ {
$queryarray[$field] = (int) $this->{$field}; // $this->{$field} may be null, '', 0, '0', 123, '123'
if (empty($queryarray[$field])) $queryarray[$field] = 0; // May be reset to null later if property 'notnull' is -1 for this field. if ($this->{$field} != '' || !empty($info['notnull'])) {
if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
} }
else $queryarray[$field] = null;
} }
elseif ($this->isFloat($info))
{
$queryarray[$field] = (double) $this->{$field};
if (empty($queryarray[$field])) $queryarray[$field] = 0;
} }
else else
{ {
@@ -7335,7 +7366,7 @@ abstract class CommonObject
} }
if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]); if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]);
if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; if (!empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; // May force 0 to null
} }
return $queryarray; return $queryarray;
@@ -7378,7 +7409,11 @@ abstract class CommonObject
} }
else else
{ {
if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (int) $obj->{$field}; $this->{$field} = (int) $obj->{$field};
} else {
$this->{$field} = null;
}
} }
} }
} }
@@ -7391,7 +7426,11 @@ abstract class CommonObject
} }
else else
{ {
if (! is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) {
$this->{$field} = (double) $obj->{$field}; $this->{$field} = (double) $obj->{$field};
} else {
$this->{$field} = null;
}
} }
} }
else else
@@ -7425,7 +7464,7 @@ abstract class CommonObject
protected function quote($value, $fieldsentry) protected function quote($value, $fieldsentry)
{ {
if (is_null($value)) return 'NULL'; if (is_null($value)) return 'NULL';
elseif (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) return $this->db->escape("$value");
else return "'".$this->db->escape($value)."'"; else return "'".$this->db->escape($value)."'";
} }
@@ -7446,6 +7485,7 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id; if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
@@ -7467,7 +7507,7 @@ abstract class CommonObject
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = ''; if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); //var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1));
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($val['default'])) if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
{ {
$error++; $error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); $this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
@@ -7678,6 +7718,7 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification'] = $this->db->idate($now); if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification'] = $this->db->idate($now);
if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif'] = $user->id; if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.

View File

@@ -5753,8 +5753,8 @@ class Form
* @param int $iSecond Default preselected duration (number of seconds or '') * @param int $iSecond Default preselected duration (number of seconds or '')
* @param int $disabled Disable the combo box * @param int $disabled Disable the combo box
* @param string $typehour If 'select' then input hour and input min is a combo, * @param string $typehour If 'select' then input hour and input min is a combo,
* if 'text' input hour is in text and input min is a text, * If 'text' input hour is in text and input min is a text,
* if 'textselect' input hour is in text and input min is a combo * If 'textselect' input hour is in text and input min is a combo
* @param integer $minunderhours If 1, show minutes selection under the hours * @param integer $minunderhours If 1, show minutes selection under the hours
* @param int $nooutput Do not output html string but return it * @param int $nooutput Do not output html string but return it
* @return string|void * @return string|void

View File

@@ -63,8 +63,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
return -2; return -2;
} }
if (! preg_match('/^(integer|price|sellist|date|varchar|double|text|html)/', $addfieldentry['type']) if (! preg_match('/^(integer|price|sellist|varchar|double|text|html|duration)/', $addfieldentry['type'])
&& ! preg_match('/^(boolean|real|timestamp)$/', $addfieldentry['type'])) && ! preg_match('/^(boolean|real|date|datetime|timestamp)$/', $addfieldentry['type']))
{ {
setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors'); setEventMessages($langs->trans('BadValueForType', $objectname), null, 'errors');
return -2; return -2;
@@ -164,7 +164,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
if (count($object->fields)) if (count($object->fields))
{ {
$typetotypephp=array('integer'=>'integer', 'varchar'=>'string'); //$typetotypephp=array('integer'=>'integer', 'duration'=>'integer', 'varchar'=>'string');
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
@@ -266,7 +266,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database elseif ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
elseif ($type == 'link' || $type == 'sellist') $type = 'integer'; elseif (in_array($type, array('link', 'sellist', 'duration'))) $type = 'integer';
$texttoinsert.= "\t".$key." ".$type; $texttoinsert.= "\t".$key." ".$type;
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';

View File

@@ -2480,7 +2480,7 @@ elseif (! empty($module))
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th class="liste_titre">'.$langs->trans("Property"); print '<th>'.$langs->trans("Property");
print ' (<a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("SeeExamples").'</a>)'; print ' (<a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank">'.$langs->trans("SeeExamples").'</a>)';
print '</th>'; print '</th>';
print '<th>'; print '<th>';

View File

@@ -64,7 +64,7 @@ class MyObject extends CommonObject
/** /**
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
* 'label' the translation key. * 'label' the translation key.
* 'enabled' is a condition when the field must be managed. * 'enabled' is a condition when the field must be managed.
@@ -94,7 +94,7 @@ class MyObject extends CommonObject
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), 'amount' =>array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'),
'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1), 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1),