Merge pull request #15444 from OPEN-DSI/new-order-list-hide-shippable-icon-by-default
NEW Add an option to hide by default icon shippable order in order list
This commit is contained in:
commit
9ef395a183
@ -114,6 +114,8 @@ $pagenext = $page + 1;
|
|||||||
if (!$sortfield) $sortfield = 'c.ref';
|
if (!$sortfield) $sortfield = 'c.ref';
|
||||||
if (!$sortorder) $sortorder = 'DESC';
|
if (!$sortorder) $sortorder = 'DESC';
|
||||||
|
|
||||||
|
$show_shippable_command = GETPOST('show_shippable_command', 'aZ09');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$hookmanager->initHooks(array('orderlist'));
|
$hookmanager->initHooks(array('orderlist'));
|
||||||
@ -569,6 +571,11 @@ if ($resql)
|
|||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
|
$moreforfilter .= $langs->trans('ShowShippableCommand').': ';
|
||||||
|
$moreforfilter .= '<input type="checkbox" name="show_shippable_command" value="show_shippable_command"'.($show_shippable_command == 'show_shippable_command' ? ' checked' : '').'>';
|
||||||
|
$moreforfilter.='</div>';
|
||||||
|
|
||||||
// If the user can view prospects other than his'
|
// If the user can view prospects other than his'
|
||||||
if ($user->rights->societe->client->voir || $socid)
|
if ($user->rights->societe->client->voir || $socid)
|
||||||
{
|
{
|
||||||
@ -950,19 +957,18 @@ if ($resql)
|
|||||||
if (!empty($arrayfields['c.ref']['checked']))
|
if (!empty($arrayfields['c.ref']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
|
if (!empty($show_shippable_command)) {
|
||||||
$generic_commande->getLinesArray(); // This set ->lines
|
$generic_commande->getLinesArray(); // This set ->lines
|
||||||
|
}
|
||||||
|
|
||||||
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
if (!empty($show_shippable_command)) {
|
||||||
// Show shippable Icon (create subloop, so may be slow)
|
// Show shippable Icon (create subloop, so may be slow)
|
||||||
if ($conf->stock->enabled)
|
if ($conf->stock->enabled) {
|
||||||
{
|
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3)) {
|
||||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
|
||||||
{
|
|
||||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||||
for ($lig = 0; $lig < $numlines; $lig++)
|
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
|
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
|
$nbprod++; // order contains real products
|
||||||
@ -981,13 +987,12 @@ if ($resql)
|
|||||||
|
|
||||||
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($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 .= $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").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
|
$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 .= ' - ' . $langs->trans("VirtualStock") . ': <span class="' . ($generic_product->stock_theorique > 0 ? 'ok' : 'error') . '">' . $generic_product->stock_theorique . '</span>';
|
||||||
$text_info .= '<br>';
|
$text_info .= '<br>';
|
||||||
|
|
||||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
|
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
|
||||||
{
|
|
||||||
$notshippable++;
|
$notshippable++;
|
||||||
}
|
}
|
||||||
} else { // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
} else { // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
||||||
@ -996,8 +1001,7 @@ if ($resql)
|
|||||||
$stock_order_supplier = 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->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) // What about other options ?
|
||||||
{
|
{
|
||||||
if (!empty($conf->commande->enabled))
|
if (!empty($conf->commande->enabled)) {
|
||||||
{
|
|
||||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
|
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
|
||||||
$generic_product->load_stats_commande(0, '1,2');
|
$generic_product->load_stats_commande(0, '1,2');
|
||||||
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
|
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
|
||||||
@ -1006,8 +1010,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
$stock_order = $generic_product->stats_commande['qty'];
|
$stock_order = $generic_product->stats_commande['qty'];
|
||||||
}
|
}
|
||||||
if (!empty($conf->fournisseur->enabled))
|
if (!empty($conf->fournisseur->enabled)) {
|
||||||
{
|
|
||||||
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
|
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
|
||||||
$generic_product->load_stats_commande_fournisseur(0, '3');
|
$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'];
|
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
|
||||||
@ -1017,20 +1020,20 @@ if ($resql)
|
|||||||
$stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
|
$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_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;
|
$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)) {
|
if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
|
||||||
$warning++;
|
$warning++;
|
||||||
$text_warning .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
$text_warning .= '<span class="warning">' . $langs->trans('Available') . ' : ' . $text_stock_reel . '</span>';
|
||||||
}
|
}
|
||||||
if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
|
if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
|
||||||
$notshippable++;
|
$notshippable++;
|
||||||
$text_info .= '<span class="warning">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
$text_info .= '<span class="warning">' . $langs->trans('Available') . ' : ' . $text_stock_reel . '</span>';
|
||||||
} else {
|
} else {
|
||||||
$text_info .= '<span class="ok">'.$langs->trans('Available').' : '.$text_stock_reel.'</span>';
|
$text_info .= '<span class="ok">' . $langs->trans('Available') . ' : ' . $text_stock_reel . '</span>';
|
||||||
}
|
}
|
||||||
if (!empty($conf->fournisseur->enabled)) {
|
if (!empty($conf->fournisseur->enabled)) {
|
||||||
$text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier.'<br>';
|
$text_info .= ' ' . $langs->trans('SupplierOrder') . ' : ' . $stock_order_supplier . '<br>';
|
||||||
} else {
|
} else {
|
||||||
$text_info .= '<br>';
|
$text_info .= '<br>';
|
||||||
}
|
}
|
||||||
@ -1039,19 +1042,19 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
if ($notshippable == 0) {
|
if ($notshippable == 0) {
|
||||||
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
|
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
|
||||||
$text_info = $langs->trans('Shippable').'<br>'.$text_info;
|
$text_info = $langs->trans('Shippable') . '<br>' . $text_info;
|
||||||
} else {
|
} else {
|
||||||
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
|
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
|
||||||
$text_info = $langs->trans('NonShippable').'<br>'.$text_info;
|
$text_info = $langs->trans('NonShippable') . '<br>' . $text_info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nbprod)
|
if ($nbprod) {
|
||||||
{
|
|
||||||
print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
|
print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
|
||||||
}
|
}
|
||||||
if ($warning) { // Always false in default mode
|
if ($warning) { // Always false in default mode
|
||||||
print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').'<br>'.$text_warning, 2, 1, img_picto('', 'error'), '', 2);
|
print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders') . '<br>' . $text_warning, 2, 1, img_picto('', 'error'), '', 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,5 +27,6 @@ Recipient=Recipient
|
|||||||
ErrorStockIsNotEnough=There's not enough stock
|
ErrorStockIsNotEnough=There's not enough stock
|
||||||
Shippable=Shippable
|
Shippable=Shippable
|
||||||
NonShippable=Not Shippable
|
NonShippable=Not Shippable
|
||||||
|
ShowShippableCommand=Show shippable command
|
||||||
ShowReceiving=Show delivery receipt
|
ShowReceiving=Show delivery receipt
|
||||||
NonExistentOrder=Nonexistent order
|
NonExistentOrder=Nonexistent order
|
||||||
|
|||||||
@ -27,5 +27,6 @@ Recipient=Destinataire
|
|||||||
ErrorStockIsNotEnough=Le stock est insuffisant
|
ErrorStockIsNotEnough=Le stock est insuffisant
|
||||||
Shippable=Expédiable
|
Shippable=Expédiable
|
||||||
NonShippable=Non expédiable
|
NonShippable=Non expédiable
|
||||||
|
ShowShippableCommand=Afficher statut expédiabilité
|
||||||
ShowReceiving=Afficher le bon de réception
|
ShowReceiving=Afficher le bon de réception
|
||||||
NonExistentOrder=Commande inexistante
|
NonExistentOrder=Commande inexistante
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user