';
foreach($object->fields as $key => $val)
{
- if (in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue; // Discard some field output at end
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
@@ -553,30 +530,6 @@ while ($i < min($num, $limit))
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
- // Rest of fields
- foreach($object->fields as $key => $val)
- {
- if (! in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue; // Keep only field not yet already output
- $align='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
- if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
- if ($key == 'status') $align.=($align?' ':'').'center';
- if (! empty($arrayfields['t.'.$key]['checked']))
- {
- print '';
- if (in_array($val['type'], array('date'))) print dol_print_date($db->jdate($obj->$key), 'day', 'tzuser');
- elseif (in_array($val['type'], array('datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour', 'tzuser');
- elseif ($key == 'status') print $object->getLibStatut(3);
- else print $obj->$key;
- print ' ';
- if (! $i) $totalarray['nbfield']++;
- if (! empty($val['isameasure']))
- {
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
- $totalarray['val']['t.'.$key] += $obj->$key;
- }
- }
- }
// Action column
print '';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php
index b441234fb63..03c4d70b417 100644
--- a/htdocs/product/inventory/card.php
+++ b/htdocs/product/inventory/card.php
@@ -97,7 +97,7 @@ if (empty($reshook))
{
foreach ($object->fields as $key => $val)
{
- if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'import_key'))) continue; // Ignore special fields
+ if (in_array($key, array('rowid', 'entity', 'date_creation', 'date_validation', 'tms', 'fk_user_creat', 'fk_user_modif', 'fk_user_validation', 'import_key'))) continue; // Ignore special fields
$object->$key=GETPOST($key,'alpha');
if ($val['notnull'] && $object->$key == '')
@@ -215,7 +215,7 @@ jQuery(document).ready(function() {
// Part to create
if ($action == 'create')
{
- print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Inventory")));
+ print load_fiche_titre($langs->trans("NewInventory", $langs->transnoentitiesnoconv("MyInventory")));
print '';
}
@@ -258,8 +289,40 @@ if (($id || $ref) && $action == 'edit')
dol_fiche_head();
print ''."\n";
- // print ''.$langs->trans("Label").' ';
- // LIST_OF_TD_LABEL_FIELDS_EDIT
+ 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;
+
+ print ''.$langs->trans($val['label']).' ';
+ print '';
+ $defaultcss='minwidth100';
+ if ($val['type'] == 'text')
+ {
+ print '';
+ print GETPOST($key,'none')?GETPOST($key,'none'):$object->$key;
+ print ' ';
+ }
+ elseif (is_array($val['arrayofkeyval']))
+ {
+ print $form->selectarray($key, $val['arrayofkeyval'], GETPOST($key, 'int')!=''?GETPOST($key, 'int'):$object->$key);
+ }
+ else
+ {
+ $cssforinput = empty($val['css'])?$defaultcss:$val['css'];
+ print ' ';
+ }
+ print ' ';
+ print ' ';
+ }
+
+ // Other attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
+
print '
';
dol_fiche_end();
@@ -273,6 +336,7 @@ if (($id || $ref) && $action == 'edit')
+
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index fdd49d99d7b..63790b7789c 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -73,9 +73,9 @@ class Inventory extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',),
'ref' => array('type'=>'varchar(64)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Reference of object',),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
+ 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300'),
'fk_warehouse' => array('type'=>'integer', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'index'=>1,),
'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>1,),
- 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1,),
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>1000, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1,),
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 426dab725b3..33900ed8a9a 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -234,7 +234,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
- header("Location: ".DOL_URL_ROOT.'/inventory/inventory_card.php?id='.$id);
+ header("Location: ".DOL_URL_ROOT.'/inventory/card.php?id='.$id);
exit;
}
@@ -333,7 +333,6 @@ print '';
foreach($object->fields as $key => $val)
{
- if (in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
@@ -366,15 +365,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
-// Rest of fields search
-foreach($object->fields as $key => $val)
-{
- if (! in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
- $align='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
- if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
- if (! empty($arrayfields['t.'.$key]['checked'])) print ' ';
-}
// Action column
print '';
$searchpicto=$form->showFilterButtons();
@@ -388,7 +378,6 @@ print ''."\n";
print ' ';
foreach($object->fields as $key => $val)
{
- if (in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
@@ -412,15 +401,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
-// Rest of fields title
-foreach($object->fields as $key => $val)
-{
- if (! in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
- $align='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
- if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
- if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
-}
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
print ' '."\n";
@@ -453,7 +433,6 @@ while ($i < min($num, $limit))
print '';
foreach($object->fields as $key => $val)
{
- if (in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
$align='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
@@ -501,29 +480,6 @@ while ($i < min($num, $limit))
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
- // Rest of fields
- foreach($object->fields as $key => $val)
- {
- if (! in_array($key, array('fk_user_creat', 'fk_user_valid', 'fk_user_modif', 'date_creation', 'date_validation', 'tms', 'import_key', 'status'))) continue;
- $align='';
- if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
- if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
- if ($key == 'status') $align.=($align?' ':'').'center';
- if (! empty($arrayfields['t.'.$key]['checked']))
- {
- print '';
- if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour');
- elseif ($key == 'status') print $object->getLibStatut(3);
- else print $obj->$key;
- print ' ';
- if (! $i) $totalarray['nbfield']++;
- if (! empty($val['isameasure']))
- {
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
- $totalarray['val']['t.'.$key] += $obj->$key;
- }
- }
- }
// Action column
print '';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined