Fix regression with label of order

This commit is contained in:
Laurent Destailleur 2023-09-19 20:29:24 +02:00
parent 69e7f0f1f3
commit 492b726da9
4 changed files with 25 additions and 20 deletions

View File

@ -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 '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}*/
// 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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;origin='.urlencode($object->element).'&amp;originid='.$object->id.'&amp;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&amp;token='.newToken().'&amp;id='.$object->id, '');
}
@ -2965,6 +2962,7 @@ if ($action == 'create' && $usercancreate) {
print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifyunbilled&amp;token='.newToken().'&amp;id='.$object->id, '');
}
}
// Clone
if ($usercancreate) {
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&amp;token='.newToken().'&amp;id='.$object->id.'&amp;socid='.$object->socid, '');

View File

@ -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';

View File

@ -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 '<tr class="oddeven">';
// Sending id
print '<td class="nowrap left">';
print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"), 'sending').' '.$objp->exp_ref.'<a>';
print $expedition->getNomUrl(1);
//print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"), 'sending').' '.$objp->exp_ref.'<a>';
print '</td>';
// Description
@ -346,6 +353,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
$product_static->id = $objp->fk_product;
$product_static->ref = $objp->ref;
$product_static->status_batch = $objp->product_tobatch;
$text = $product_static->getNomUrl(1);
$text .= ' - '.$label;
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
@ -436,7 +444,6 @@ function show_list_sending_receive($origin, $origin_id, $filter = '')
// Informations on receipt
if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php';
$expedition->id = $objp->sendingid;
$expedition->fetchObjectLinked($expedition->id, $expedition->element);
//var_dump($expedition->linkedObjects);

View File

@ -697,14 +697,14 @@ class Expedition extends CommonObject
*/
public function valid($user, $notrigger = 0)
{
global $conf, $langs;
global $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_syslog(get_class($this)."::valid");
// Protection
if ($this->statut) {
if ($this->status) {
dol_syslog(get_class($this)."::valid not in draft status", LOG_WARNING);
return 0;
}