Merge branch 'NEW_filter_by_supplier_on_replenishment_card' of github.com:atm-gauthier/dolibarr into develop_NEW_filter_by_supplier_on_replenishment_card
This commit is contained in:
commit
ee014681b0
@ -2344,13 +2344,13 @@ class Form
|
||||
* @param string $htmlname Name of HTML field
|
||||
* @return string|null
|
||||
*/
|
||||
function select_product_fourn_price($productid,$htmlname='productfournpriceid')
|
||||
function select_product_fourn_price($productid, $selected_supplier='', $htmlname='productfournpriceid')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$langs->load('stocks');
|
||||
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration,";
|
||||
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,";
|
||||
$sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,";
|
||||
$sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
@ -2387,7 +2387,7 @@ class Form
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
//if there is only one supplier, preselect it
|
||||
if($num == 1) {
|
||||
if($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier)) {
|
||||
$opt .= ' selected';
|
||||
}
|
||||
$opt.= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2013-2016 Laurent Destaileur <ely@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2016 ATM Consulting <support@atm-consulting.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -54,6 +55,7 @@ $salert = GETPOST('salert', 'alpha');
|
||||
$mode = GETPOST('mode','alpha');
|
||||
|
||||
$fourn_id = GETPOST('fourn_id','int');
|
||||
$fk_supplier = GETPOST('fk_supplier','int');
|
||||
$fk_entrepot = GETPOST('fk_entrepot','int');
|
||||
$texte = '';
|
||||
|
||||
@ -269,6 +271,9 @@ $sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'
|
||||
$sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p';
|
||||
$sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s';
|
||||
$sql.= ' ON p.rowid = s.fk_product';
|
||||
if($fk_supplier > 0) {
|
||||
$sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')';
|
||||
}
|
||||
if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) {
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.$fk_entrepot.')';
|
||||
}
|
||||
@ -406,23 +411,26 @@ if ($usevirtualstock == 1)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingVirtualStock").' - ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=physical&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UsePhysicalStock").'</a><br>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=physical&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UsePhysicalStock").'</a><br>';
|
||||
}
|
||||
if ($usevirtualstock == 0)
|
||||
{
|
||||
print $langs->trans("CurentSelectionMode").': ';
|
||||
print $langs->trans("CurentlyUsingPhysicalStock").' - ';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=virtual&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UseVirtualStock").'</a><br>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?mode=virtual&fk_supplier='.$fk_supplier.'&fk_entrepot='.$fk_entrepot.'">'.$langs->trans("UseVirtualStock").'</a><br>';
|
||||
}
|
||||
print '<br>'."\n";
|
||||
|
||||
print '<form name="formFilterWarehouse" method="GET" action="">';
|
||||
print '<input type="hidden" name="action" value="filter_warehouse">';
|
||||
print '<input type="hidden" name="action" value="filter">';
|
||||
print '<input type="hidden" name="sref" value="'.$sref.'">';
|
||||
print '<input type="hidden" name="snom" value="'.$snom.'">';
|
||||
print '<input type="hidden" name="salert" value="'.$salert.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print $formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
|
||||
print $langs->trans('Warehouse').' : '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1);
|
||||
print '<br />';
|
||||
print $langs->trans('Supplier').' : '.$form->select_company($fk_supplier, 'fk_supplier', 'fournisseur=1', 1);
|
||||
print '<br />';
|
||||
print ' <input class="button" type="submit" name="valid" value="'.$langs->trans('ToFilter').'">';
|
||||
print '</form>';
|
||||
|
||||
@ -431,6 +439,7 @@ if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) {
|
||||
$filters .= '&sall=' . $sall;
|
||||
$filters .= '&salert=' . $salert;
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
@ -448,6 +457,7 @@ if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) {
|
||||
$filters .= (isset($type)?'&type=' . $type:'');
|
||||
$filters .= '&=' . $salert;
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste(
|
||||
$texte,
|
||||
@ -467,6 +477,7 @@ $param = (isset($type)? '&type=' . $type : '');
|
||||
$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert;
|
||||
$param .= '&sref=' . $sref;
|
||||
$param .= '&mode=' . $mode;
|
||||
$param .= '&fk_supplier=' . $fk_supplier;
|
||||
$param .= '&fk_entrepot=' . $fk_entrepot;
|
||||
|
||||
$stocklabel = $langs->trans('Stock');
|
||||
@ -475,6 +486,7 @@ if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formulaire">'.
|
||||
'<input type="hidden" name="token" value="' .$_SESSION['newtoken'] . '">'.
|
||||
'<input type="hidden" name="fk_supplier" value="' . $fk_supplier . '">'.
|
||||
'<input type="hidden" name="fk_entrepot" value="' .$fk_entrepot . '">'.
|
||||
'<input type="hidden" name="sortfield" value="' . $sortfield . '">'.
|
||||
'<input type="hidden" name="sortorder" value="' . $sortorder . '">'.
|
||||
@ -632,7 +644,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
print '<td align="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.$stocktobuy.'"></td>';
|
||||
|
||||
// Supplier
|
||||
print '<td align="right">'. $form->select_product_fourn_price($prod->id, 'fourn'.$i, 1).'</td>';
|
||||
print '<td align="right">'. $form->select_product_fourn_price($prod->id, $fk_supplier, 'fourn'.$i).'</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
@ -649,6 +661,7 @@ if ($num > $conf->liste_limit)
|
||||
$filters .= '&sall=' . $sall;
|
||||
$filters .= '&salert=' . $salert;
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste('', $page, 'replenish.php', $filters, $sortfield, $sortorder, '', $num, 0, '');
|
||||
}
|
||||
@ -659,6 +672,7 @@ if ($num > $conf->liste_limit)
|
||||
$filters .= (isset($type)? '&type=' . $type : '');
|
||||
$filters .= '&salert=' . $salert;
|
||||
$filters .= '&mode=' . $mode;
|
||||
$filters .= '&fk_supplier=' . $fk_supplier;
|
||||
$filters .= '&fk_entrepot=' . $fk_entrepot;
|
||||
print_barre_liste('', $page, 'replenish.php', $filters, $sortfield, $sortorder, '', $num, 0, '');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user