';
+
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
@@ -950,108 +957,104 @@ if ($resql)
if (!empty($arrayfields['c.ref']['checked']))
{
print '
';
-
- $generic_commande->getLinesArray(); // This set ->lines
+ if (!empty($show_shippable_command)) {
+ $generic_commande->getLinesArray(); // This set ->lines
+ }
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
- // Show shippable Icon (create subloop, so may be slow)
- if ($conf->stock->enabled)
- {
- if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
- {
- $numlines = count($generic_commande->lines); // Loop on each line of order
- for ($lig = 0; $lig < $numlines; $lig++)
- {
- 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');
- //$generic_product->load_virtual_stock(); 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 (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
+ if (!empty($show_shippable_command)) {
+ // Show shippable Icon (create subloop, so may be slow)
+ if ($conf->stock->enabled) {
+ if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) {
+ $numlines = count($generic_commande->lines); // Loop on each line of order
+ for ($lig = 0; $lig < $numlines; $lig++) {
+ if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) // If line is a product and not a service
{
- $text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
- $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.'';
- $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.'';
- $text_info .= ' ';
+ $nbprod++; // order contains real products
+ $generic_product->id = $generic_commande->lines[$lig]->fk_product;
- if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
- {
- $notshippable++;
- }
- } else { // 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 (!empty($conf->fournisseur->enabled))
- {
- 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 .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
- $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 .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
- }
- if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
- $notshippable++;
- $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
+ // 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');
+ //$generic_product->load_virtual_stock(); 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 {
- $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
+ $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 (!empty($conf->fournisseur->enabled)) {
- $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier.' ';
- } else {
+
+ if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
+ {
+ $text_info .= $generic_commande->lines[$lig]->qty . ' X ' . $generic_commande->lines[$lig]->product_ref . ' ' . dol_trunc($generic_commande->lines[$lig]->product_label, 25);
+ $text_info .= ' - ' . $langs->trans("Stock") . ': ' . $generic_product->stock_reel . '';
+ $text_info .= ' - ' . $langs->trans("VirtualStock") . ': ' . $generic_product->stock_theorique . '';
$text_info .= ' ';
+
+ if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
+ $notshippable++;
+ }
+ } else { // 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 (!empty($conf->fournisseur->enabled)) {
+ 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 .= $generic_commande->lines[$lig]->qty . ' X ' . $generic_commande->lines[$lig]->ref . ' ' . dol_trunc($generic_commande->lines[$lig]->product_label, 25);
+ $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 .= '' . $langs->trans('Available') . ' : ' . $text_stock_reel . '';
+ }
+ if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
+ $notshippable++;
+ $text_info .= '' . $langs->trans('Available') . ' : ' . $text_stock_reel . '';
+ } else {
+ $text_info .= '' . $langs->trans('Available') . ' : ' . $text_stock_reel . '';
+ }
+ if (!empty($conf->fournisseur->enabled)) {
+ $text_info .= ' ' . $langs->trans('SupplierOrder') . ' : ' . $stock_order_supplier . ' ';
+ } else {
+ $text_info .= ' ';
+ }
}
}
}
+ if ($notshippable == 0) {
+ $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
+ $text_info = $langs->trans('Shippable') . ' ' . $text_info;
+ } else {
+ $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
+ $text_info = $langs->trans('NonShippable') . ' ' . $text_info;
+ }
}
- if ($notshippable == 0) {
- $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
- $text_info = $langs->trans('Shippable').' '.$text_info;
- } else {
- $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
- $text_info = $langs->trans('NonShippable').' '.$text_info;
- }
- }
- if ($nbprod)
- {
- print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
- }
- if ($warning) { // Always false in default mode
- print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').' '.$text_warning, 2, 1, img_picto('', 'error'), '', 2);
+ if ($nbprod) {
+ print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
+ }
+ if ($warning) { // Always false in default mode
+ print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders') . ' ' . $text_warning, 2, 1, img_picto('', 'error'), '', 2);
+ }
}
}
diff --git a/htdocs/langs/en_US/deliveries.lang b/htdocs/langs/en_US/deliveries.lang
index 1f48c01de75..0713ebd9f2d 100644
--- a/htdocs/langs/en_US/deliveries.lang
+++ b/htdocs/langs/en_US/deliveries.lang
@@ -27,5 +27,6 @@ Recipient=Recipient
ErrorStockIsNotEnough=There's not enough stock
Shippable=Shippable
NonShippable=Not Shippable
+ShowShippableCommand=Show shippable command
ShowReceiving=Show delivery receipt
NonExistentOrder=Nonexistent order
diff --git a/htdocs/langs/fr_FR/deliveries.lang b/htdocs/langs/fr_FR/deliveries.lang
index ff244a08917..29cbd5736cf 100644
--- a/htdocs/langs/fr_FR/deliveries.lang
+++ b/htdocs/langs/fr_FR/deliveries.lang
@@ -27,5 +27,6 @@ Recipient=Destinataire
ErrorStockIsNotEnough=Le stock est insuffisant
Shippable=Expédiable
NonShippable=Non expédiable
+ShowShippableCommand=Afficher statut expédiabilité
ShowReceiving=Afficher le bon de réception
NonExistentOrder=Commande inexistante