diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 4b0a6ff29be..635f0f9db65 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -375,14 +375,14 @@ print ''; foreach($object->fields as $key => $val) { $cssforfield=(empty($val['css'])?'':$val['css']); - if ($key == 'status') $cssforfield='center'; + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); else print ''; print ''; } @@ -411,7 +411,7 @@ foreach($object->fields as $key => $val) if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index baf454fdf67..cc3accde763 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1080,6 +1080,8 @@ if ($action == 'create') $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500', $projectsListId); print ''; } + + // Object linked if (!empty($origin) && !empty($originid)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8ff78fe5be0..c2c3528c869 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1820,69 +1820,76 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $subelement = $regs[2]; } + // Generic case for $classpath $classpath = $element.'/class'; - // To work with non standard path + // Special cases, to work with non standard path if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'compta/facture/class'; $module='facture'; $subelement='facture'; } - if ($objecttype == 'commande' || $objecttype == 'order') { + elseif ($objecttype == 'commande' || $objecttype == 'order') { $classpath = 'commande/class'; $module='commande'; $subelement='commande'; } - if ($objecttype == 'propal') { + elseif ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } - if ($objecttype == 'supplier_proposal') { + elseif ($objecttype == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; } - if ($objecttype == 'shipping') { + elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } - if ($objecttype == 'delivery') { + elseif ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } - if ($objecttype == 'contract') { + elseif ($objecttype == 'contract') { $classpath = 'contrat/class'; $module='contrat'; $subelement='contrat'; } - if ($objecttype == 'member') { + elseif ($objecttype == 'member') { $classpath = 'adherents/class'; $module='adherent'; $subelement='adherent'; } - if ($objecttype == 'cabinetmed_cons') { + elseif ($objecttype == 'cabinetmed_cons') { $classpath = 'cabinetmed/class'; $module='cabinetmed'; $subelement='cabinetmedcons'; } - if ($objecttype == 'fichinter') { + elseif ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $module='ficheinter'; $subelement='fichinter'; } - if ($objecttype == 'task') { + elseif ($objecttype == 'task') { $classpath = 'projet/class'; $module='projet'; $subelement='task'; } - if ($objecttype == 'stock') { + elseif ($objecttype == 'stock') { $classpath = 'product/stock/class'; $module='stock'; $subelement='stock'; } + elseif ($objecttype == 'inventory') { + $classpath = 'product/inventory/class'; + $module='stock'; + $subelement='inventory'; + } - //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement; - + // Generic case for $classfile and $classname $classfile = strtolower($subelement); $classname = ucfirst($subelement); + //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname; + if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname='FactureFournisseur'; diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 1c1d0e101b9..bf24be61023 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -219,8 +219,9 @@ foreach($object->fields as $key => $val) $sql.='t.'.$key.', '; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) +if (! empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +} // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook @@ -414,7 +415,7 @@ foreach($object->fields as $key => $val) if (! empty($arrayfields['t.'.$key]['checked'])) { print ''; - if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); else print ''; print ''; } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 87e6fadb57a..639b04cdbcc 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -340,6 +340,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + if ($permissiontoadd) + { + print ''.$langs->trans("Validate").''."\n"; + } + else + { + print ''.$langs->trans('Validate').''."\n"; + } + if ($permissiontodelete) { print ''.$langs->trans('Delete').''."\n"; @@ -382,7 +391,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $MAXEVENT = 10; - $morehtmlright = ''; + $morehtmlright = ''; $morehtmlright.= $langs->trans("SeeAll"); $morehtmlright.= ''; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 2445934b98c..e9284781a5d 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -54,22 +54,29 @@ class Inventory extends CommonObject */ public $picto = 'stock'; + const STATUS_DRAFT = 0; + const STATUS_VALIDATED = 1; + const STATUS_RECORDED = 2; + const STATUS_CANCELED = 9; /** - * 'type' if the field format. + * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'label' the translation key. * 'enabled' is a condition when the field must be managed. * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'default' is a default value for creation (can still be replaced by the global setup of default values) * 'index' if we want an index in database. * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'position' is the sort order of field. * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' * 'help' is a string visible as a tooltip on field * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * 'default' is a default value for creation (can still be replaced by the global setup of default values) - * 'showoncombobox' if field must be shown into the label of combobox + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") */ // BEGIN MODULEBUILDER PROPERTIES @@ -85,18 +92,15 @@ class Inventory extends CommonObject 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>1, 'position'=>35), - 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502,), - 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512,), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), + 'date_validation' => array('type'=>'datetime', 'label'=>'DateValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>502), 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), - //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'visible'=>-2, 'enabled'=>1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'default'=>0, 'arrayofkeyval'=>array(0=>'ToDo', 1=>'Done', -1=>'Cancel')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>4, 'enabled'=>1, 'position'=>1000, 'default'=>0, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Recorded', -1=>'Canceled')), ); /** diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ab1a31fe4de..c91834e54e5 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -261,13 +261,28 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { - if ($permissiontoadd) + if ($object->status == Inventory::STATUS_DRAFT) { - print ''.$langs->trans("Validate").''."\n"; + if ($permissiontoadd) + { + print ''.$langs->trans("Validate").''."\n"; + } + else + { + print ''.$langs->trans('Validate').''."\n"; + } } - else + + if ($object->status == Inventory::STATUS_VALIDATED) { - print ''.$langs->trans('Validate').''."\n"; + if ($permissiontoadd) + { + print ''.$langs->trans("RecordVerb").''."\n"; + } + else + { + print ''.$langs->trans('RecordVerb').''."\n"; + } } } print ''."\n"; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index f2e4853908d..b81e989cbb9 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -366,11 +366,18 @@ print ''; foreach($object->fields as $key => $val) { - $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 ''; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -392,11 +399,15 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $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 getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); + else print ''; + print '