diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index ffb2e834db7..644469a257d 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -2440,19 +2440,6 @@ if ($action == 'create') {
if (empty($reshook)) {
$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
if ($object->statut == 0 && $num > 0) {
if ($usercanvalidate) {
@@ -2528,21 +2515,17 @@ if ($action == 'create') {
// Reopen
if (in_array($object->statut, array(CommandeFournisseur::STATUS_ACCEPTED))) {
$buttonshown = 0;
- if ($hasreception) {
- print ''.$langs->trans("Disapprove").'';
- } else {
- if (!$buttonshown && $usercanapprove) {
- if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
- || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
- print 'id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'';
- $buttonshown++;
- }
+ if (!$buttonshown && $usercanapprove) {
+ if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY)
+ || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER_ONLY) && $user->id == $object->user_approve_id)) {
+ print 'id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'';
+ $buttonshown++;
}
- if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
- if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
- || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
- print 'id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'';
- }
+ }
+ if (!$buttonshown && $usercanapprovesecond && !empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)) {
+ if (empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY)
+ || (!empty($conf->global->SUPPLIER_ORDER_REOPEN_BY_APPROVER2_ONLY) && $user->id == $object->user_approve_id2)) {
+ print 'id.'&action=reopen&token='.newToken().'">'.$langs->trans("Disapprove").'';
}
}
}
@@ -2553,10 +2536,19 @@ if ($action == 'create') {
}
// 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))) {
$labelofbutton = $langs->trans('ReceiveProducts');
if ($conf->reception->enabled) {
$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))) {
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 0accaadfa62..f988cd62f19 100644
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -204,4 +204,3 @@ StatusSupplierOrderApproved=Approved
StatusSupplierOrderRefused=Refused
StatusSupplierOrderReceivedPartially=Partially received
StatusSupplierOrderReceivedAll=All products received
-NeedAtLeastOneInvoice = There has to be at least one Invoice