diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index f3121faa70d..06c59338e58 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -232,7 +232,7 @@ foreach ($dirmodels as $reldir) { while (($file = readdir($handle))!==false) { - if (substr($file, 0, 8) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php') + if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file)-4); diff --git a/htdocs/core/modules/modMrp.class.php b/htdocs/core/modules/modMrp.class.php index 248179b5447..bc85111ebd2 100644 --- a/htdocs/core/modules/modMrp.class.php +++ b/htdocs/core/modules/modMrp.class.php @@ -135,9 +135,9 @@ class modMrp extends DolibarrModules // 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1) // ); $this->const = array( - 1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of BOM', 0), - 2=>array('MRP_MO_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), - 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) + 1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of MO', 0), + 2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0), + 3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0) ); // Some keys to add into the overwriting translation tables diff --git a/htdocs/core/modules/mrp/mod_mrp_advanced.php b/htdocs/core/modules/mrp/mod_mo_advanced.php similarity index 93% rename from htdocs/core/modules/mrp/mod_mrp_advanced.php rename to htdocs/core/modules/mrp/mod_mo_advanced.php index 1c24b4010ba..42c506194f3 100644 --- a/htdocs/core/modules/mrp/mod_mrp_advanced.php +++ b/htdocs/core/modules/mrp/mod_mo_advanced.php @@ -21,7 +21,7 @@ */ /** - * \file htdocs/core/modules/mrp/mod_mrp_advanced.php + * \file htdocs/core/modules/mrp/mod_mo_advanced.php * \ingroup mrp * \brief File containing class for numbering model of MOs advanced */ @@ -30,9 +30,9 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php'; /** - * Class to manage customer Bom numbering rules advanced + * Class to manage MO numbering rules advanced */ -class mod_mrp_advanced extends ModeleNumRefMos +class mod_mo_advanced extends ModeleNumRefMos { /** * Dolibarr version of the loaded document @@ -68,7 +68,7 @@ class mod_mrp_advanced extends ModeleNumRefMos $texte.= '
'; $texte.= ''; $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo")); @@ -79,7 +79,7 @@ class mod_mrp_advanced extends ModeleNumRefMos // Parametrage du prefix $texte.= ''; - $texte.= ''; + $texte.= ''; $texte.= ''; @@ -129,7 +129,7 @@ class mod_mrp_advanced extends ModeleNumRefMos require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php'; // We get cursor rule - $mask=$conf->global->MRP_ADVANCED_MASK; + $mask=$conf->global->MRP_MO_ADVANCED_MASK; if (! $mask) { diff --git a/htdocs/core/modules/mrp/mod_mrp_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php similarity index 90% rename from htdocs/core/modules/mrp/mod_mrp_standard.php rename to htdocs/core/modules/mrp/mod_mo_standard.php index 24f1b0a1f69..6d392a6b74c 100644 --- a/htdocs/core/modules/mrp/mod_mrp_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -18,16 +18,16 @@ */ /** - * \file htdocs/core/modules/mrp/mod_mrp_standard.php + * \file htdocs/core/modules/mrp/mod_mo_standard.php * \ingroup mrp * \brief File of class to manage MO numbering rules standard */ require_once DOL_DOCUMENT_ROOT .'/core/modules/mrp/modules_mrp.php'; /** - * Class to manage customer order numbering rules standard + * Class to manage MO numbering rules standard */ -class mod_mrp_standard extends ModeleNumRefMos +class mod_mo_standard extends ModeleNumRefMos { /** * Dolibarr version of the loaded document @@ -85,7 +85,7 @@ class mod_mrp_standard extends ModeleNumRefMos $posindice=8; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -119,7 +119,7 @@ class mod_mrp_standard extends ModeleNumRefMos // D'abord on recupere la valeur max $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; - $sql.= " FROM ".MAIN_DB_PREFIX."bom_bom"; + $sql.= " FROM ".MAIN_DB_PREFIX."mrp_mo"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " AND entity = ".$conf->entity; @@ -132,7 +132,7 @@ class mod_mrp_standard extends ModeleNumRefMos } else { - dol_syslog("mod_mrp_standard::getNextValue", LOG_DEBUG); + dol_syslog("mod_mo_standard::getNextValue", LOG_DEBUG); return -1; } @@ -143,7 +143,7 @@ class mod_mrp_standard extends ModeleNumRefMos if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max+1); - dol_syslog("mod_mrp_standard::getNextValue return ".$this->prefix.$yymm."-".$num); + dol_syslog("mod_mo_standard::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0525f71ab5f..d19807c03c6 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -94,8 +94,10 @@ class Mo extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>20, 'notnull'=>1, 'default'=>'1', 'index'=>1,), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',), + 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce",), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'1',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>52), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), @@ -105,10 +107,8 @@ class Mo extends CommonObject 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce",), 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), - 'fk_bom' => array('type'=>'integer:Bom:bom/class/bom.class.php:0:t.status=1', 'filter'=>'active=1', 'label'=>'BOM', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>-1, 'index'=>1, 'comment'=>"Original BOM",), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1,), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>4, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '-1'=>'Canceled')), ); diff --git a/htdocs/mrp/lib/mrp.lib.php b/htdocs/mrp/lib/mrp.lib.php index 7ee1fcd04c7..4fdfa25342e 100644 --- a/htdocs/mrp/lib/mrp.lib.php +++ b/htdocs/mrp/lib/mrp.lib.php @@ -35,7 +35,7 @@ function mrpAdminPrepareHead() $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/mrp/admin/setup.php", 1); + $head[$h][0] = dol_buildpath("/admin/mrp.php", 1); $head[$h][1] = $langs->trans("Settings"); $head[$h][2] = 'settings'; $h++;
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).'