diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 10e796888b0..44ca05bb7b8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2887,14 +2887,6 @@ if ($action == 'create' && $usercancreate) { if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) { print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&token='.newToken().'&id='.$object->id, ''); } - // Create event - /*if (isModEnabled('agenda') && !empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) - { - // Add hidden condition because this is not a - // "workflow" action so should appears somewhere else on - // page. - print '' . $langs->trans("AddAction") . ''; - }*/ // Create a purchase order if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) { @@ -2927,7 +2919,7 @@ if ($action == 'create' && $usercancreate) { } } - // Ship + // Create shipment $numshipping = 0; if (isModEnabled('expedition')) { $numshipping = $object->countNbOfShipments(); @@ -2950,12 +2942,17 @@ if ($action == 'create' && $usercancreate) { if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&token='.newToken().'&id='.$object->id, ''); } - // Create bill and Classify billed - // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" - if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { + + // Create bill + if (isModEnabled('facture') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if (isModEnabled('facture') && $user->hasRight('facture', 'creer') && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.urlencode($object->element).'&originid='.$object->id.'&socid='.$object->socid, ''); } + } + + // Set billed or unbilled + // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" + if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) { print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&token='.newToken().'&id='.$object->id, ''); } @@ -2965,6 +2962,7 @@ if ($action == 'create' && $usercancreate) { print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifyunbilled&token='.newToken().'&id='.$object->id, ''); } } + // Clone if ($usercancreate) { print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'&socid='.$object->socid, ''); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 31e1f744ccb..fd3ff034df3 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -399,8 +399,8 @@ class Commande extends CommonOrder /** * Shipment on process */ - const STATUS_SHIPMENTONPROCESS = 2; - const STATUS_ACCEPTED = 2; // For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead. + const STATUS_SHIPMENTONPROCESS = 2; // We set this status when a shipment is validated + const STATUS_ACCEPTED = 2; // For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead. /** * Closed (Sent, billed or not) @@ -3729,7 +3729,7 @@ class Commande extends CommonOrder $labelTooltip .= ' - '.$langs->transnoentitiesnoconv("DateDeliveryPlanned").dol_print_date($this->delivery_date, 'day').$billedtext; } $statusType = 'status4'; - } elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->transnoentitiesnoconv('StatusOrderDelivered'); $labelStatusShort = $langs->transnoentitiesnoconv('StatusOrderDeliveredShort'); $statusType = 'status6'; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 030e6ed3e35..3677851a613 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -242,7 +242,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; - $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; + $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition, e.billed, e.fk_statut as status,"; //if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql .= ' p.description as product_desc'; @@ -302,11 +302,18 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') while ($i < $num) { $objp = $db->fetch_object($resql); + $expedition->id = $objp->expedition_id; + $expedition->ref = $objp->exp_ref; + $expedition->billed = $objp->billed; + $expedition->statut = $objp->status; + $expedition->status = $objp->status; + print '