Can reopen to edit supplier order once ordered
This commit is contained in:
parent
ed6f2e9386
commit
e01e0faeef
@ -1747,18 +1747,37 @@ class CommandeFournisseur extends CommonOrder
|
||||
if ($type == 'nev') $statut = 7;
|
||||
if ($type == 'can') $statut = 7;
|
||||
|
||||
if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && ($type == 'tot'))
|
||||
{
|
||||
// If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done"
|
||||
$dispatchedlinearray=$this->getDispachedLines(0);
|
||||
if (count($dispatchedlinearray) > 0)
|
||||
// Some checks to accept the record
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS))
|
||||
{
|
||||
// If option SUPPLIER_ORDER_USE_DISPATCH_STATUS is on, we check all reception are approved to allow status "total/done"
|
||||
if (! $error && ($type == 'tot'))
|
||||
{
|
||||
$dispatchedlinearray=$this->getDispachedLines(0);
|
||||
if (count($dispatchedlinearray) > 0)
|
||||
{
|
||||
$result=-1;
|
||||
$error++;
|
||||
$this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove';
|
||||
dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG);
|
||||
}
|
||||
|
||||
}
|
||||
if (! $error && ! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS_NEED_APPROVE) && ($type == 'tot')) // Accept to move to rception done, only if status of all line are ok (refuse denied)
|
||||
{
|
||||
$result=-1;
|
||||
$error++;
|
||||
$this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionToApprove';
|
||||
dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionToApprove', LOG_DEBUG);
|
||||
$dispatcheddenied=$this->getDispachedLines(2);
|
||||
if (count($dispatchedlinearray) > 0)
|
||||
{
|
||||
$result=-1;
|
||||
$error++;
|
||||
$this->errors[]='ErrorCantSetReceptionToTotalDoneWithReceptionDenied';
|
||||
dol_syslog('ErrorCantSetReceptionToTotalDoneWithReceptionDenied', LOG_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO LDR01 Add option to accept only if ALL predefined products are received (same qty).
|
||||
|
||||
|
||||
if (! $error && ! ($statut == 4 or $statut == 5 or $statut == 7))
|
||||
{
|
||||
|
||||
@ -495,16 +495,19 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut0');
|
||||
if ($statut==1) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut4');
|
||||
if ($statut==2) return '<span class="hideonsmartphone">'.$langs->trans($this->statutshort[$statut]).' </span>'.img_picto($langs->trans($this->statuts[$statut]),'statut8');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -192,10 +192,11 @@ if (empty($reshook))
|
||||
|
||||
if ($action == 'reopen') // no test on permission here, permission to use will depends on status
|
||||
{
|
||||
if (in_array($object->statut, array(1, 2, 5, 6, 7, 9)))
|
||||
if (in_array($object->statut, array(1, 2, 3, 5, 6, 7, 9)))
|
||||
{
|
||||
if ($object->statut == 1) $newstatus=0; // Validated->Draft
|
||||
else if ($object->statut == 2) $newstatus=0; // Approved->Draft
|
||||
else if ($object->statut == 3) $newstatus=2; // Ordered->Approved
|
||||
else if ($object->statut == 5) $newstatus=4; // Received->Received partially
|
||||
else if ($object->statut == 6) $newstatus=2; // Canceled->Approved
|
||||
else if ($object->statut == 7) $newstatus=3; // Canceled->Process running
|
||||
@ -2671,7 +2672,7 @@ elseif (! empty($object->id))
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("Disapprove").'</a>';
|
||||
}
|
||||
}
|
||||
if (in_array($object->statut, array(5, 6, 7, 9)))
|
||||
if (in_array($object->statut, array(3, 5, 6, 7, 9)))
|
||||
{
|
||||
if ($user->rights->fournisseur->commande->commander)
|
||||
{
|
||||
|
||||
@ -109,7 +109,7 @@ if ($action == 'denydispatchline' &&
|
||||
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
|
||||
$result=$supplierorderdispatch->fetch($lineid);
|
||||
if (! $result) dol_print_error($db);
|
||||
$result=$supplierorderdispatch->setStatut(-1);
|
||||
$result=$supplierorderdispatch->setStatut(2);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($supplierorderdispatch->error, $supplierorderdispatch->errors, 'errors');
|
||||
@ -678,11 +678,16 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=checkdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Approve").'</a>';
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=denydispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Deny").'</a>';
|
||||
}
|
||||
else
|
||||
if ($objp->status == 1)
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Disapprove").'</a>';
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Reinit").'</a>';
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=denydispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Deny").'</a>';
|
||||
}
|
||||
if ($objp->status == 2)
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Reinit").'</a>';
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=checkdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Approve").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -160,7 +160,8 @@ ErrorPriceExpressionInternal=Internal error '%s'
|
||||
ErrorPriceExpressionUnknown=Unknown error '%s'
|
||||
ErrorSrcAndTargetWarehouseMustDiffers=Source and target warehouses must differs
|
||||
ErrorTryToMakeMoveOnProductRequiringBatchData=Error, trying to make a stock movement without batch/serial information, on a product requiring batch/serial information
|
||||
ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified before being allowed to do this action
|
||||
ErrorCantSetReceptionToTotalDoneWithReceptionToApprove=All recorded receptions must first be verified (approved or denied) before being allowed to do this action
|
||||
ErrorCantSetReceptionToTotalDoneWithReceptionDenied=All recorded receptions must first be verified (approved) before being allowed to do this action
|
||||
ErrorGlobalVariableUpdater0=HTTP request failed with error '%s'
|
||||
ErrorGlobalVariableUpdater1=Invalid JSON format '%s'
|
||||
ErrorGlobalVariableUpdater2=Missing parameter '%s'
|
||||
|
||||
@ -700,6 +700,7 @@ SelectElementAndClickRefresh=Select an element and click Refresh
|
||||
PrintFile=Print File %s
|
||||
ShowTransaction=Show transaction
|
||||
GoIntoSetupToChangeLogo=Go into Home - Setup - Company to change logo or go into Home - Setup - Display to hide.
|
||||
Denied=Denied
|
||||
# Week day
|
||||
Monday=Monday
|
||||
Tuesday=Tuesday
|
||||
|
||||
Loading…
Reference in New Issue
Block a user