Fix counter of BOM
This commit is contained in:
parent
d3df04c5aa
commit
ffc4820970
@ -97,8 +97,8 @@ if (empty($reshook))
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||
if (empty($backtopage)) {
|
||||
if (empty($id)) $backtopage = $backurlforlist;
|
||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id;
|
||||
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
|
||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||
}
|
||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
|
||||
@ -524,7 +524,7 @@ class BOM extends CommonObject
|
||||
// Protection
|
||||
if ($this->statut == self::STATUS_VALIDATED)
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ class BOM extends CommonObject
|
||||
$sql.= " fk_user_valid = ".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::valid()", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -597,7 +597,7 @@ class BOM extends CommonObject
|
||||
$dirdest = $conf->bom->dir_output.'/'.$newref;
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
|
||||
@ -234,7 +234,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont
|
||||
// Action validate object
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $permissionedit)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
$result = $object->validate($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Define output language
|
||||
|
||||
@ -118,11 +118,11 @@ class mod_bom_advanced extends ModeleNumRefboms
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Product $objprod Object product
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
public function getNextValue($objprod, $object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
@ -139,7 +139,7 @@ class mod_bom_advanced extends ModeleNumRefboms
|
||||
|
||||
$date = ($object->date_bom ? $object->date_bom : $object->date);
|
||||
|
||||
$numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', $objsoc, $date);
|
||||
$numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@ -108,16 +108,16 @@ class mod_bom_standard extends ModeleNumRefboms
|
||||
/**
|
||||
* Return next free value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Product $objprod Object product
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Value if KO, <0 if KO
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
public function getNextValue($objprod, $object)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=8;
|
||||
$posindice=9;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
@ -137,9 +137,9 @@ class mod_bom_standard extends ModeleNumRefboms
|
||||
}
|
||||
|
||||
//$date=time();
|
||||
$date=$object->date;
|
||||
$date=$object->date_creation;
|
||||
$yymm = strftime("%y%m", $date);
|
||||
|
||||
;
|
||||
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);
|
||||
|
||||
|
||||
@ -28,6 +28,6 @@ DateEndPlannedMo=Date end planned
|
||||
KeepEmptyForAsap=Empty means 'As Soon As Possible'
|
||||
EstimatedDuration=Estimated duration
|
||||
EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM
|
||||
ConfirmValidateBom=Are you sure you want to validate this BOM (you will be able to use it to build new Manufacturing Orders)
|
||||
ConfirmValidateBom=Are you sure you want to validate the BOM with the reference <strong>%s</strong> (you will be able to use it to build new Manufacturing Orders)
|
||||
ConfirmCloseBom=Are you sure you want to cancel this BOM (you won't be able to use it to build new Manufacturing Orders anymore) ?
|
||||
ConfirmReopenBom=Are you sure you want to re-open this BOM (you will be able to use it to build new Manufacturing Orders)
|
||||
@ -129,7 +129,7 @@ if (empty($reshook))
|
||||
$permissiontodelete = $user->rights->mymodule->delete || ($permissiontoadd && $object->status == 0);
|
||||
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php', 1);
|
||||
if (empty($backtopage)) {
|
||||
if (empty($id)) $backtopage = $backurlforlist;
|
||||
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
|
||||
else $backtopage = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
|
||||
}
|
||||
$triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
Loading…
Reference in New Issue
Block a user