Work on MO

This commit is contained in:
Laurent Destailleur 2019-10-31 22:56:08 +01:00
parent 716c2bb531
commit b8803fa8df
6 changed files with 21 additions and 21 deletions

View File

@ -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);

View File

@ -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

View File

@ -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.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="updateMask">';
$texte.= '<input type="hidden" name="maskconstBom" value="MRP_ADVANCED_MASK">';
$texte.= '<input type="hidden" name="maskconstBom" value="MRP_MO_ADVANCED_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">';
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Mo"), $langs->transnoentities("Mo"));
@ -79,7 +79,7 @@ class mod_mrp_advanced extends ModeleNumRefMos
// Parametrage du prefix
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMo" value="'.$conf->global->MRP_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMo" value="'.$conf->global->MRP_MO_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte.= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
@ -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)
{

View File

@ -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;
}
}

View File

@ -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')),
);

View File

@ -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++;