mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-07 16:41:48 +01:00
Merge pull request #24929 from fappels/18_debug_list_det
Debug Lines of order page.
This commit is contained in:
@@ -813,7 +813,7 @@ if ($resql) {
|
||||
|
||||
// List of mass actions available
|
||||
$arrayofmassactions = array(
|
||||
'GenerateOrdersSuppliers'=>img_picto('', 'doc', 'class="pictofixedwidth"').$langs->trans("GenerateOrdersSupplie"),
|
||||
// TODO add mass action here
|
||||
);
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
@@ -1436,7 +1436,8 @@ if ($resql) {
|
||||
if (empty($i)) {
|
||||
$oldref = $obj->product_ref;
|
||||
}
|
||||
if ($oldref != $obj->product_ref) {
|
||||
if ($oldref != $obj->product_ref && $sortfield == 'pr.ref') {
|
||||
// TODO make new /core/tpl/list_print_sub_total.php
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
$oldref = $obj->product_ref;
|
||||
}
|
||||
@@ -1995,83 +1996,79 @@ if ($resql) {
|
||||
print '<td class="center">';
|
||||
if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) {
|
||||
if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
|
||||
$generic_commande->getLinesArray(); // Load array ->lines
|
||||
$generic_commande->loadExpeditions(); // Load array ->expeditions
|
||||
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
for ($lig = 0; $lig < $numlines; $lig++) {
|
||||
if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
|
||||
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
|
||||
if (isset($generic_commande->expeditions[$obj->rowid])) {
|
||||
$reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
|
||||
} else {
|
||||
$reliquat = $obj->qty;
|
||||
}
|
||||
if ($obj->product_type == 0 && $obj->fk_product > 0) { // If line is a product and not a service
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $obj->fk_product;
|
||||
|
||||
// Get local and virtual stock and store it into cache
|
||||
if (empty($productstat_cache[$obj->fk_product])) {
|
||||
$generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock()
|
||||
$productstat_cache[$obj->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
$productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
} else {
|
||||
$reliquat = $generic_commande->lines[$lig]->qty;
|
||||
$generic_product->stock_reel = $productstat_cache[$obj->fk_product]['stock_reel'];
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
}
|
||||
if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
|
||||
$nbprod++; // order contains real products
|
||||
$generic_product->id = $generic_commande->lines[$lig]->fk_product;
|
||||
|
||||
// Get local and virtual stock and store it into cache
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
|
||||
$generic_product->load_stock('nobatch'); // ->load_virtual_stock() is already included into load_stock()
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
|
||||
$productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
} else {
|
||||
$generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
|
||||
$generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
|
||||
}
|
||||
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
$notshippable++;
|
||||
}
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
|
||||
$text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
|
||||
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
|
||||
$text_info .= '<br>';
|
||||
} else { // BUGGED CODE.
|
||||
// DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
|
||||
// COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
|
||||
// Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
||||
// stock order and stock order_supplier
|
||||
$stock_order = 0;
|
||||
$stock_order_supplier = 0;
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ?
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
|
||||
$generic_product->load_stats_commande(0, '1,2');
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
|
||||
}
|
||||
$stock_order = $generic_product->stats_commande['qty'];
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
$notshippable++;
|
||||
}
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
|
||||
$text_info .= $reliquat.' x '.$obj->product_ref.' '.dol_trunc($obj->product_label, 20);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
|
||||
$text_info .= ($reliquat != $obj->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($obj->qty - $reliquat).')</span>' : '');
|
||||
$text_info .= '<br>';
|
||||
} else { // BUGGED CODE.
|
||||
// DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
|
||||
// COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
|
||||
// Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
||||
// stock order and stock order_supplier
|
||||
$stock_order = 0;
|
||||
$stock_order_supplier = 0;
|
||||
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ?
|
||||
if (!empty($conf->commande->enabled)) {
|
||||
if (empty($productstat_cache[$obj->fk_product]['stats_order_customer'])) {
|
||||
$generic_product->load_stats_commande(0, '1,2');
|
||||
$productstat_cache[$obj->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande['qty'] = $productstat_cache[$obj->fk_product]['stats_order_customer'];
|
||||
}
|
||||
if (isModEnabled('supplier_order')) {
|
||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
|
||||
$generic_product->load_stats_commande_fournisseur(0, '3');
|
||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
|
||||
}
|
||||
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
|
||||
}
|
||||
}
|
||||
$text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
|
||||
$text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
|
||||
if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
|
||||
$warning++;
|
||||
$text_warning .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
}
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
$text_info .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
} else {
|
||||
$text_info .= '<span class="ok">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
$stock_order = $generic_product->stats_commande['qty'];
|
||||
}
|
||||
if (isModEnabled('supplier_order')) {
|
||||
$text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier;
|
||||
if (empty($productstat_cache[$obj->fk_product]['stats_order_supplier'])) {
|
||||
$generic_product->load_stats_commande_fournisseur(0, '3');
|
||||
$productstat_cache[$obj->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
|
||||
} else {
|
||||
$generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$obj->fk_product]['stats_order_supplier'];
|
||||
}
|
||||
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
|
||||
}
|
||||
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
|
||||
$text_info .= '<br>';
|
||||
}
|
||||
$text_info .= $reliquat.' x '.$obj->product_ref.' '.dol_trunc($obj->product_label, 20);
|
||||
$text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
|
||||
if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
|
||||
$warning++;
|
||||
$text_warning .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
}
|
||||
if ($reliquat > $generic_product->stock_reel) {
|
||||
$text_info .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
} else {
|
||||
$text_info .= '<span class="ok">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
||||
}
|
||||
if (isModEnabled('supplier_order')) {
|
||||
$text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier;
|
||||
}
|
||||
$text_info .= ($reliquat != $obj->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($obj->qty - $reliquat).')</span>' : '');
|
||||
$text_info .= '<br>';
|
||||
}
|
||||
}
|
||||
if ($notshippable == 0) {
|
||||
|
||||
@@ -99,7 +99,7 @@ ListOfOrders=List of orders
|
||||
ListOrderLigne=Lines of orders
|
||||
productobuy=Products to buy only
|
||||
productonly=Products only
|
||||
disablelinefree=No lines free
|
||||
disablelinefree=No free lines
|
||||
CloseOrder=Close order
|
||||
ConfirmCloseOrder=Are you sure you want to set this order to delivered? Once an order is delivered, it can be set to billed.
|
||||
ConfirmDeleteOrder=Are you sure you want to delete this order?
|
||||
|
||||
Reference in New Issue
Block a user