Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-05-20 23:23:17 +02:00
commit e1e5d12524
5 changed files with 72 additions and 6 deletions

View File

@ -80,7 +80,7 @@ llxHeader('', $title);
$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'home', 0, '', 'titleforhome');
print load_fiche_titre(' ', $resultboxes['selectboxlist'], '', 0, '', 'titleforhome');
if (!empty($conf->global->MAIN_MOTD))
{

View File

@ -112,8 +112,10 @@ BOM_CLOSEInDolibarr=BOM disabled
BOM_REOPENInDolibarr=BOM reopen
BOM_DELETEInDolibarr=BOM deleted
MRP_MO_VALIDATEInDolibarr=MO validated
MRP_MO_UNVALIDATEInDolibarr=MO set to draft status
MRP_MO_PRODUCEDInDolibarr=MO produced
MRP_MO_DELETEInDolibarr=MO deleted
MRP_MO_CANCELInDolibarr=MO canceled
##### End agenda events #####
AgendaModelModule=Document templates for event
DateActionStart=Start date

View File

@ -929,7 +929,7 @@ class Mo extends CommonObject
return -1;
}*/
return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MO_UNVALIDATE');
return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'MRP_MO_UNVALIDATE');
}
/**
@ -954,7 +954,7 @@ class Mo extends CommonObject
return -1;
}*/
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MO_CLOSE');
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'MRP_MO_CANCEL');
}
/**
@ -967,7 +967,7 @@ class Mo extends CommonObject
public function reopen($user, $notrigger = 0)
{
// Protection
if ($this->status != self::STATUS_CANCELED)
if ($this->status != self::STATUS_PRODUCED && $this->status != self::STATUS_CANCELED)
{
return 0;
}
@ -979,7 +979,7 @@ class Mo extends CommonObject
return -1;
}*/
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MO_REOPEN');
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'MRP_MO_REOPEN');
}
/**

View File

@ -169,6 +169,35 @@ if (empty($reshook))
{
$object->setProject(GETPOST('projectid', 'int'));
}
// Action close produced
if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd)
{
$result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
if ($result >= 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, 0, 0, 0);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -630,10 +659,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS)
{
// TODO If production is already > 1, show only close, else show cancel
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_produced&confirm=yes">'.$langs->trans("Close").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n";
}
if ($object->status == $object::STATUS_CANCELED)
if ($object->status == $object::STATUS_PRODUCED || $object->status == $object::STATUS_CANCELED)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes">'.$langs->trans("Re-Open").'</a>'."\n";
}

View File

@ -383,6 +383,35 @@ if (empty($reshook))
exit;
}
}
// Action close produced
if ($action == 'confirm_produced' && $confirm == 'yes' && $permissiontoadd)
{
$result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
if ($result >= 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, 0, 0, 0);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -599,6 +628,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
if ($object->status == $object::STATUS_VALIDATED || $object->status == $object::STATUS_INPROGRESS)
{
// TODO If production is already > 1, show only close, else show cancel
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_produced&confirm=yes">'.$langs->trans("Close").'</a>'."\n";
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_close&confirm=yes">'.$langs->trans("Cancel").'</a>'."\n";
}