diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 39037eb00f0..6a561ecffb3 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -2446,8 +2446,8 @@ class Commande extends CommonOrder
if ($statut==0) return $langs->trans('StatusOrderDraft');
if ($statut==1) return $langs->trans('StatusOrderValidated');
if ($statut==2) return $langs->trans('StatusOrderSentShort');
- if ($statut==3 && ! $facturee) return $langs->trans('StatusOrderToBill');
- if ($statut==3 && $facturee) return $langs->trans('StatusOrderProcessed');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBill');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
}
elseif ($mode == 1)
{
@@ -2455,8 +2455,8 @@ class Commande extends CommonOrder
if ($statut==0) return $langs->trans('StatusOrderDraftShort');
if ($statut==1) return $langs->trans('StatusOrderValidatedShort');
if ($statut==2) return $langs->trans('StatusOrderSentShort');
- if ($statut==3 && ! $facturee) return $langs->trans('StatusOrderToBillShort');
- if ($statut==3 && $facturee) return $langs->trans('StatusOrderProcessed');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessed');
}
elseif ($mode == 2)
{
@@ -2464,8 +2464,8 @@ class Commande extends CommonOrder
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraftShort');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidatedShort');
if ($statut==2) return img_picto($langs->trans('StatusOrderSent'),'statut3').' '.$langs->trans('StatusOrderSentShort');
- if ($statut==3 && ! $facturee) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort');
- if ($statut==3 && $facturee) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBillShort');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessedShort');
}
elseif ($mode == 3)
{
@@ -2473,8 +2473,8 @@ class Commande extends CommonOrder
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==2) return img_picto($langs->trans('StatusOrderSentShort'),'statut3');
- if ($statut==3 && ! $facturee) return img_picto($langs->trans('StatusOrderToBill'),'statut7');
- if ($statut==3 && $facturee) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6');
}
elseif ($mode == 4)
{
@@ -2482,8 +2482,8 @@ class Commande extends CommonOrder
if ($statut==0) return img_picto($langs->trans('StatusOrderDraft'),'statut0').' '.$langs->trans('StatusOrderDraft');
if ($statut==1) return img_picto($langs->trans('StatusOrderValidated'),'statut1').' '.$langs->trans('StatusOrderValidated');
if ($statut==2) return img_picto($langs->trans('StatusOrderSentShort'),'statut3').' '.$langs->trans('StatusOrderSent');
- if ($statut==3 && ! $facturee) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill');
- if ($statut==3 && $facturee) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderToBill'),'statut7').' '.$langs->trans('StatusOrderToBill');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return img_picto($langs->trans('StatusOrderProcessed'),'statut6').' '.$langs->trans('StatusOrderProcessed');
}
elseif ($mode == 5)
{
@@ -2491,8 +2491,8 @@ class Commande extends CommonOrder
if ($statut==0) return $langs->trans('StatusOrderDraftShort').' '.img_picto($langs->trans('StatusOrderDraft'),'statut0');
if ($statut==1) return $langs->trans('StatusOrderValidatedShort').' '.img_picto($langs->trans('StatusOrderValidated'),'statut1');
if ($statut==2) return $langs->trans('StatusOrderSentShort').' '.img_picto($langs->trans('StatusOrderSent'),'statut3');
- if ($statut==3 && ! $facturee) return $langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut7');
- if ($statut==3 && $facturee) return $langs->trans('StatusOrderProcessedShort').' '.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
+ if ($statut==3 && (! $facturee && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderToBillShort').' '.img_picto($langs->trans('StatusOrderToBill'),'statut7');
+ if ($statut==3 && ($facturee || ! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) return $langs->trans('StatusOrderProcessedShort').' '.img_picto($langs->trans('StatusOrderProcessed'),'statut6');
}
}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index d51ec804614..459b2f1540f 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -859,7 +859,7 @@ else if ($action == 'confirm_modif' && $user->rights->commande->creer)
}
}
-else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->commande->cloturer)
+else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer)
{
$result = $object->cloture($user);
if ($result < 0) $mesgs=$object->errors;
@@ -1648,9 +1648,9 @@ else
/*
* Confirmation de la cloture
*/
- if ($action == 'close')
+ if ($action == 'shipped')
{
- $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_close', '', 0, 1);
+ $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_shipped', '', 0, 1);
}
/*
@@ -2115,6 +2115,7 @@ else
print ''.$langs->trans('ReOpen').'';
}
+
// Create bill and Classify billed
if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
{
@@ -2122,17 +2123,16 @@ else
{
print ''.$langs->trans("CreateBill").'';
}
-
- if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER))
+ if ($user->rights->commande->creer && $object->statut > 2 && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORsKFLOW_BILL_ON_SHIPMENT))
{
print 'id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'';
}
}
- // Close
+ // Set to shipped
if (($object->statut == 1 || $object->statut == 2) && $user->rights->commande->cloturer)
{
- print 'id.'&action=close">'.$langs->trans('Close').'';
+ print 'id.'&action=shipped">'.$langs->trans('ClassifyShipped').'';
}
// Clone
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 44a0e6d24dd..ff7b1843a2e 100755
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -152,6 +152,7 @@ class InterfaceWorkflowManager
if ($action == 'BILL_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER))
{
$object->fetchObjectLinked('','commande',$object->id,$object->element);
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index b07a02e1dc0..efa3d132d24 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -1288,8 +1288,8 @@ else
else print ''.$langs->trans('SendByMail').'';
}
- // Create bill and Classify billed
- if ($conf->facture->enabled && $object->statut > 0 && ! $object->billed)
+ // Create bill and Close shipment
+ if ($conf->facture->enabled && $object->statut > 0)
{
if ($user->rights->facture->creer)
{
@@ -1298,10 +1298,12 @@ else
//print ''.$langs->trans("CreateBill").'';
}
- // TODO add alternative status
- if ($user->rights->expedition->creer && $object->statut > 0)
+ if ($user->rights->expedition->creer && $object->statut > 0 && ! $object->billed)
{
- print 'id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'';
+ $label="Close";
+ // Label here should be "Close" or "ClassifyBilled" if we decided to make bill on shipments instead of orders
+ if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) $label="ClassifyBilled";
+ print 'id.'&action=classifybilled">'.$langs->trans($label).'';
}
}
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index d5d3406611a..88fc29c764c 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -152,7 +152,7 @@ if ($id > 0 || ! empty($ref))
*/
if ($action == 'cloture')
{
- $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseOrder"),$langs->trans("ConfirmCloseOrder"),"confirm_cloture");
+ $ret=$form->form_confirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture");
if ($ret == 'html') print '
';
}