Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
8dbadc0aa8
@ -158,18 +158,6 @@ if ($action == 'updateMask') {
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == "setshippableiconinlist") {
|
||||
// Activate Set Shippable Icon In List
|
||||
$setshippableiconinlist = GETPOST('value', 'int');
|
||||
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
@ -646,25 +634,6 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
// Shippable Icon in List
|
||||
/* Kept as hidden feature for the moment, result seems bugged.
|
||||
Where is definition of "shippable" according to all different STOCK_CALCULATE_... options ?
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ShippableOrderIconInList").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td class="center">';
|
||||
if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=0">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setshippableiconinlist&token='.newToken().'&value=1">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
}
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
*/
|
||||
|
||||
/*
|
||||
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
|
||||
// Ask for payment bank during order
|
||||
|
||||
@ -261,6 +261,11 @@ class Commande extends CommonOrder
|
||||
//! key of pos source ('0', '1', ...)
|
||||
public $pos_source;
|
||||
|
||||
/**
|
||||
* @var array Array with line of all shipments
|
||||
*/
|
||||
public $expeditions;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
@ -2010,9 +2015,9 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Load array lines
|
||||
*
|
||||
* @param int $only_product Return only physical products, not services
|
||||
* @param int $only_product Return only physical products, not services
|
||||
* @param int $loadalsotranslation Return translation for products
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||
{
|
||||
@ -2207,9 +2212,10 @@ class Commande extends CommonOrder
|
||||
* Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order
|
||||
*
|
||||
* @param int $filtre_statut Filter on shipment status
|
||||
* @param int $fk_product Add a filter on a product
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*/
|
||||
public function loadExpeditions($filtre_statut = -1)
|
||||
public function loadExpeditions($filtre_statut = -1, $fk_product = 0)
|
||||
{
|
||||
$this->expeditions = array();
|
||||
|
||||
|
||||
@ -1854,10 +1854,13 @@ 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(); // This set ->lines
|
||||
$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++) {
|
||||
$reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
|
||||
|
||||
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;
|
||||
@ -1872,15 +1875,15 @@ if ($resql) {
|
||||
$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 .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$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>';
|
||||
|
||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
|
||||
$notshippable++;
|
||||
}
|
||||
} 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
|
||||
@ -1908,32 +1911,31 @@ if ($resql) {
|
||||
$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 .= $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 ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
|
||||
$notshippable++;
|
||||
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 ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
|
||||
$text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier.'<br>';
|
||||
} else {
|
||||
$text_info .= '<br>';
|
||||
$text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier;
|
||||
}
|
||||
$text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' <span class="opacitymedium">('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')</span>' : '');
|
||||
$text_info .= '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($notshippable == 0) {
|
||||
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
|
||||
$text_info = $langs->trans('Shippable').'<br>'.$text_info;
|
||||
$text_info = $text_icon.' '.$langs->trans('Shippable').'<br>'.$text_info;
|
||||
} else {
|
||||
$text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
|
||||
$text_info = $langs->trans('NonShippable').'<br>'.$text_info;
|
||||
$text_info = $text_icon.' '.$langs->trans('NonShippable').'<br>'.$text_info;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1126,16 +1126,19 @@ if ($action == 'create') {
|
||||
$product_static->status_buy = $line->product_tobuy;
|
||||
$product_static->status_batch = $line->product_tobatch;
|
||||
|
||||
$showdescinproductdesc = (getDolGlobalString('PRODUIT_DESC_IN_FORM') == 2 ? 1 : 0);
|
||||
|
||||
$text = $product_static->getNomUrl(1);
|
||||
$text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
|
||||
$description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
|
||||
$description = ($showdescinproductdesc ? '' : dol_htmlentitiesbr($line->desc));
|
||||
|
||||
print $form->textwithtooltip($text, $description, 3, '', '', $i);
|
||||
|
||||
// Show range
|
||||
print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
|
||||
|
||||
// Add description in form
|
||||
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
||||
if ($showdescinproductdesc) {
|
||||
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user