Revert "FIX re-open supplier order should not be allowed when there is a reception."
This reverts commit c52fab09e6.
This commit is contained in:
parent
c52fab09e6
commit
d842d0394d
@ -2440,19 +2440,6 @@ if ($action == 'create') {
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
|
$object->fetchObjectLinked(); // Links are used to show or not button, so we load them now.
|
||||||
|
|
||||||
// check if reception
|
|
||||||
$hasreception = 0;
|
|
||||||
if ($conf->reception->enabled) {
|
|
||||||
if (!empty($object->linkedObjects['reception'])) {
|
|
||||||
foreach ($object->linkedObjects['reception'] as $element) {
|
|
||||||
if ($element->statut >= 0) {
|
|
||||||
$hasreception = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == 0 && $num > 0) {
|
if ($object->statut == 0 && $num > 0) {
|
||||||
if ($usercanvalidate) {
|
if ($usercanvalidate) {
|
||||||
@ -2528,21 +2515,17 @@ if ($action == 'create') {
|
|||||||
// Reopen
|
// Reopen
|
||||||
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) {
|
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) {
|
||||||
$buttonshown = 0;
|
$buttonshown = 0;
|
||||||
if ($hasreception) {
|
if (!$buttonshown && $usercanapprove) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ReceptionExist").'">'.$langs->trans("Disapprove").'</a>';
|
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|
||||||
} else {
|
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
|
||||||
if (!$buttonshown && $usercanapprove) {
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
|
$buttonshown++;
|
||||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
|
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
|
||||||
$buttonshown++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
|
}
|
||||||
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|
if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
|
||||||
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
|
if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
|| (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
|
||||||
}
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2553,10 +2536,19 @@ if ($action == 'create') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ship
|
// Ship
|
||||||
|
$hasreception = 0;
|
||||||
if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
|
if (isModEnabled('stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
|
||||||
$labelofbutton = $langs->trans('ReceiveProducts');
|
$labelofbutton = $langs->trans('ReceiveProducts');
|
||||||
if ($conf->reception->enabled) {
|
if ($conf->reception->enabled) {
|
||||||
$labelofbutton = $langs->trans("CreateReception");
|
$labelofbutton = $langs->trans("CreateReception");
|
||||||
|
if (!empty($object->linkedObjects['reception'])) {
|
||||||
|
foreach ($object->linkedObjects['reception'] as $element) {
|
||||||
|
if ($element->statut >= 0) {
|
||||||
|
$hasreception = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($object->statut, array(3, 4, 5))) {
|
if (in_array($object->statut, array(3, 4, 5))) {
|
||||||
|
|||||||
@ -204,4 +204,3 @@ StatusSupplierOrderApproved=Approved
|
|||||||
StatusSupplierOrderRefused=Refused
|
StatusSupplierOrderRefused=Refused
|
||||||
StatusSupplierOrderReceivedPartially=Partially received
|
StatusSupplierOrderReceivedPartially=Partially received
|
||||||
StatusSupplierOrderReceivedAll=All products received
|
StatusSupplierOrderReceivedAll=All products received
|
||||||
NeedAtLeastOneInvoice = There has to be at least one Invoice
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user