Start to work on feature to select stock id for increase/decrease.
This commit is contained in:
parent
8d46ae1d35
commit
83f2061e0e
@ -131,7 +131,7 @@ if ($conf->stock->enabled)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("CashDeskIdWareHouse").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1);
|
||||
print $formproduct->selectWarehouses($conf->global->CASHDESK_ID_WAREHOUSE,'CASHDESK_ID_WAREHOUSE','',1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -99,7 +99,7 @@ if ($conf->stock->enabled)
|
||||
print '<td>';
|
||||
$disabled=0;
|
||||
if (! empty($conf->global->CASHDESK_ID_WAREHOUSE)) $disabled=1; // If a particular stock is defined, we disable choice
|
||||
$formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled);
|
||||
print $formproduct->selectWarehouses(GETPOST('warehouseid')?GETPOST('warehouseid'):$conf->global->CASHDESK_ID_WAREHOUSE,'warehouseid','',!$disabled,$disabled);
|
||||
//print '<input name="warehouse_id" class="texte_login" type="warehouse_id" value="" />';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1462,7 +1462,18 @@ else
|
||||
$text.='<br>';
|
||||
$text.=$notify->confirmMessage('NOTIFY_VAL_ORDER',$object->socid);
|
||||
}
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', '', 0, 1);
|
||||
if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) && '1' == 'TODO')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php");
|
||||
$formproduct=new FormProduct($db);
|
||||
$formquestion=array(
|
||||
//'text' => $langs->trans("ConfirmClone"),
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
|
||||
}
|
||||
|
||||
$formconfirm=$html->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -2168,15 +2168,15 @@ class Form
|
||||
/**
|
||||
* Show a confirmation HTML form or AJAX popup
|
||||
*
|
||||
* @param page Url of page to call if confirmation is OK
|
||||
* @param title title
|
||||
* @param question question
|
||||
* @param action action
|
||||
* @param formquestion an array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
|
||||
* @param selectedchoice "" or "no" or "yes"
|
||||
* @param useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
|
||||
* @param height Force height of box
|
||||
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
||||
* @param string $page Url of page to call if confirmation is OK
|
||||
* @param string $title Title
|
||||
* @param string $question Question
|
||||
* @param string $action Action
|
||||
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
|
||||
* @param string $selectedchoice "" or "no" or "yes"
|
||||
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No
|
||||
* @param int $height Force height of box
|
||||
* @return string 'ajax' if a confirm ajax popup is shown, 'html' if it's an html form
|
||||
*/
|
||||
function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500)
|
||||
{
|
||||
|
||||
@ -749,7 +749,7 @@ if ($action == 'create')
|
||||
// Show warehous
|
||||
if ($_REQUEST["entrepot_id"])
|
||||
{
|
||||
$formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||
print $formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||
//print $stock.' '.$quantityToBeDelivered;
|
||||
//if ($stock >= 0 && $stock < $quantityToBeDelivered)
|
||||
if ($stock < $quantityToBeDelivered)
|
||||
@ -759,7 +759,7 @@ if ($action == 'create')
|
||||
}
|
||||
else
|
||||
{
|
||||
$formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||
print $formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -624,8 +624,8 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<td>'.$langs->trans("WarehouseSource").'</td>';
|
||||
print '<td>';
|
||||
$result=$formproduct->selectWarehouses(-1,'entrepot_id','',1);
|
||||
if ($result <= 0)
|
||||
print $formproduct->selectWarehouses(-1,'entrepot_id','',1);
|
||||
if (count($formproduct->cache_warehouses) <= 0)
|
||||
{
|
||||
print ' No warehouse defined, <a href="'.DOL_URL_ROOT.'/product/stock/fiche.php?action=create">add one</a>';
|
||||
}
|
||||
@ -653,7 +653,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
show_list_sending_receive('commande',$commande->id);
|
||||
}
|
||||
else
|
||||
|
||||
@ -82,7 +82,7 @@ DetailMenuIdParent=ID of parent menu (0 for a top menu)
|
||||
DetailPosition=Sort number to define menu position
|
||||
PersonalizedMenusNotSupported=Personalized menus not supported
|
||||
AllMenus=All
|
||||
NotConfigured=Numbering module not configured
|
||||
NotConfigured=Module not configured
|
||||
Setup=Setup
|
||||
Activation=Activation
|
||||
Active=Active
|
||||
|
||||
@ -83,7 +83,7 @@ DetailMenuIdParent= Id du menu parent (0 pour un menu du haut)
|
||||
DetailPosition= Numéro d'ordre déterminant la position du menu
|
||||
PersonalizedMenusNotSupported= Menus personnalisés non gérés
|
||||
AllMenus= Tous
|
||||
NotConfigured=Module numérotation non configuré
|
||||
NotConfigured=Module non configuré
|
||||
Setup= Configuration
|
||||
Activation= Activation
|
||||
Active= Actif
|
||||
|
||||
@ -39,22 +39,24 @@ class FormProduct
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructeur
|
||||
* \param DB Database handler
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function FormProduct($DB)
|
||||
function FormProduct($db)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Load in cache array list of warehouses
|
||||
* \param fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* \return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
* \remarks If fk_product is not 0, we do not use cache
|
||||
* Load in cache array list of warehouses
|
||||
* If fk_product is not 0, we do not use cache
|
||||
*
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function loadWarehouses($fk_product=0)
|
||||
{
|
||||
@ -73,7 +75,7 @@ class FormProduct
|
||||
$sql.= " WHERE statut = 1";
|
||||
$sql.= " ORDER BY e.label";
|
||||
|
||||
dol_syslog('FormProduct::loadWarehouses sql='.$sql,LOG_DEBUG);
|
||||
dol_syslog(get_class($this).'::loadWarehouses sql='.$sql,LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -98,39 +100,41 @@ class FormProduct
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return list of possible payments modes
|
||||
* \param selected Id du mode de paiement pre-selectionne
|
||||
* \param htmlname Name of html select html
|
||||
* \param filtertype For filtre
|
||||
* \param empty 1=Can be empty, 0 if not
|
||||
* \param disabled 1=Select is disabled
|
||||
* \param fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* \return int <0 if KO, Nb of product in list if OK
|
||||
* Return list of possible payments modes
|
||||
*
|
||||
* @param int $selected Id du mode de paiement pre-selectionne
|
||||
* @param string $htmlname Name of html select html
|
||||
* @param string $filtertype For filter
|
||||
* @param int $empty 1=Can be empty, 0 if not
|
||||
* @param int $disabled 1=Select is disabled
|
||||
* @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0.
|
||||
* @return string HTML select
|
||||
*/
|
||||
function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0)
|
||||
{
|
||||
global $langs,$user;
|
||||
|
||||
dol_syslog("Form::selectWarehouses $selected, $htmlname, $filtertype, $empty, $disabled, $fk_product",LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filtertype, $empty, $disabled, $fk_product",LOG_DEBUG);
|
||||
|
||||
$this->loadWarehouses($fk_product);
|
||||
|
||||
print '<select class="flat"'.($disabled?' disabled="disabled"':'').' name="'.($htmlname.($disabled?'_disabled':'')).'">';
|
||||
if ($empty) print '<option value=""> </option>';
|
||||
$out='<select class="flat"'.($disabled?' disabled="disabled"':'').' name="'.($htmlname.($disabled?'_disabled':'')).'">';
|
||||
if ($empty) $out.='<option value=""> </option>';
|
||||
foreach($this->cache_warehouses as $id => $arraytypes)
|
||||
{
|
||||
print '<option value="'.$id.'"';
|
||||
$out.='<option value="'.$id.'"';
|
||||
// Si selected est text, on compare avec code, sinon avec id
|
||||
if ($selected == $id) print ' selected="selected"';
|
||||
print '>';
|
||||
print $arraytypes['label'];
|
||||
if ($fk_product) print ' ('.$langs->trans("Stock").': '.($arraytypes['stock']>0?$arraytypes['stock']:'?').')';
|
||||
print '</option>';
|
||||
if ($selected == $id) $out.=' selected="selected"';
|
||||
$out.='>';
|
||||
$out.=$arraytypes['label'];
|
||||
if ($fk_product) $out.=' ('.$langs->trans("Stock").': '.($arraytypes['stock']>0?$arraytypes['stock']:'?').')';
|
||||
$out.='</option>';
|
||||
}
|
||||
print '</select>';
|
||||
if ($disabled) print '<input type="hidden" name="'.$htmlname.'" value="'.$selected.'">';
|
||||
$out.='</select>';
|
||||
if ($disabled) $out.='<input type="hidden" name="'.$htmlname.'" value="'.$selected.'">';
|
||||
|
||||
return count($this->cache_warehouses);
|
||||
//count($this->cache_warehouses);
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -327,7 +327,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<tr>';
|
||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td>';
|
||||
print '<td width="20%">';
|
||||
$formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1);
|
||||
print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%">';
|
||||
print '<select name="mouvement" class="flat">';
|
||||
@ -366,10 +366,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
|
||||
print '<tr>';
|
||||
print '<td width="20%">'.$langs->trans("WarehouseSource").'</td><td width="20%">';
|
||||
$formproduct->selectWarehouses($_GET["dwid"],'id_entrepot_source','',1);
|
||||
print $formproduct->selectWarehouses($_GET["dwid"],'id_entrepot_source','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans("WarehouseTarget").'</td><td width="20%">';
|
||||
$formproduct->selectWarehouses('','id_entrepot_destination','',1);
|
||||
print $formproduct->selectWarehouses('','id_entrepot_destination','',1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td>';
|
||||
print '</tr>';
|
||||
@ -403,7 +403,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<input type="hidden" name="action" value="create_stock">';
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
print '<td width="20%">'.$langs->trans("Warehouse").'</td><td width="40%">';
|
||||
$formproduct->selectWarehouses('','id_entrepot','',1);
|
||||
print $formproduct->selectWarehouses('','id_entrepot','',1);
|
||||
print '</td><td width="20%">'.$langs->trans("NumberOfUnit").'</td><td width="20%"><input name="nbpiece" size="10" value=""></td></tr>';
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" class="button" value="'.$langs->trans('Save').'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'"></td></tr>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user