Debug incdec option.
This commit is contained in:
parent
d688db3b78
commit
89684748c5
@ -251,6 +251,6 @@ PriceExpressionEditorHelp4=In product/service price only: <b>#supplier_min_price
|
|||||||
PriceMode=Price mode
|
PriceMode=Price mode
|
||||||
PriceNumeric=Number
|
PriceNumeric=Number
|
||||||
DefaultPrice=Default price
|
DefaultPrice=Default price
|
||||||
ComposedProductDecreaseStock=Decrease Stock for sub-product
|
ComposedProductDIncDecStock=Increase/Decrease stock on parent change
|
||||||
ComposedProduct=Sub-product
|
ComposedProduct=Sub-product
|
||||||
MinSupplierPrice=Minimun supplier price
|
MinSupplierPrice=Minimun supplier price
|
||||||
|
|||||||
@ -2253,18 +2253,20 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lie un produit associe au produit/service
|
* Link a product/service to a parent product/service
|
||||||
*
|
*
|
||||||
* @param int $id_pere Id du produit auquel sera lie le produit a lier
|
* @param int $id_pere Id of parent product/service
|
||||||
* @param int $id_fils Id du produit a lier
|
* @param int $id_fils Id of child product/service
|
||||||
* @param int $qty Quantity
|
* @param int $qty Quantity
|
||||||
|
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function add_sousproduit($id_pere, $id_fils,$qty)
|
function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! is_numeric($id_pere)) $id_pere=0;
|
if (! is_numeric($id_pere)) $id_pere=0;
|
||||||
if (! is_numeric($id_fils)) $id_fils=0;
|
if (! is_numeric($id_fils)) $id_fils=0;
|
||||||
|
if (! is_numeric($incdec)) $incdec=0;
|
||||||
|
|
||||||
$result=$this->del_sousproduit($id_pere, $id_fils);
|
$result=$this->del_sousproduit($id_pere, $id_fils);
|
||||||
if ($result < 0) return $result;
|
if ($result < 0) return $result;
|
||||||
@ -2290,8 +2292,8 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty)';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec)';
|
||||||
$sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.')';
|
$sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.')';
|
||||||
if (! $this->db->query($sql))
|
if (! $this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -2309,25 +2311,25 @@ class Product extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Modify composed product
|
* Modify composed product
|
||||||
*
|
*
|
||||||
* @param int $id_pere Id of master product
|
* @param int $id_pere Id of parent product/service
|
||||||
* @param int $id_fils Id of linked product
|
* @param int $id_fils Id of child product/service
|
||||||
* @param int $qty Quantity
|
* @param int $qty Quantity
|
||||||
* @param int $incdec increase/descrease stock or not
|
* @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease
|
||||||
* * @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function update_sousproduit($id_pere, $id_fils,$qty, $incdec=1)
|
function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
if (! is_numeric($id_pere)) $id_pere=0;
|
if (! is_numeric($id_pere)) $id_pere=0;
|
||||||
if (! is_numeric($id_fils)) $id_fils=0;
|
if (! is_numeric($id_fils)) $id_fils=0;
|
||||||
if (! is_numeric($incdec)) $incdec=1;
|
if (! is_numeric($incdec)) $incdec=1;
|
||||||
if (! is_numeric($qty)) $qty=1;
|
if (! is_numeric($qty)) $qty=1;
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association SET ';
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.'product_association SET ';
|
||||||
$sql.= 'qty='.$qty;
|
$sql.= 'qty='.$qty;
|
||||||
$sql.= ',incdec='.$incdec;
|
$sql.= ',incdec='.$incdec;
|
||||||
$sql .= ' WHERE fk_product_pere='.$id_pere.' AND fk_product_fils='.$id_fils;
|
$sql .= ' WHERE fk_product_pere='.$id_pere.' AND fk_product_fils='.$id_fils;
|
||||||
|
|
||||||
if (!$this->db->query($sql))
|
if (!$this->db->query($sql))
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
@ -2337,7 +2339,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2375,7 +2377,7 @@ class Product extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function is_sousproduit($fk_parent, $fk_child)
|
function is_sousproduit($fk_parent, $fk_child)
|
||||||
{
|
{
|
||||||
$sql = "SELECT fk_product_pere, qty";
|
$sql = "SELECT fk_product_pere, qty, incdec";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_association";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_association";
|
||||||
$sql.= " WHERE fk_product_pere = '".$fk_parent."'";
|
$sql.= " WHERE fk_product_pere = '".$fk_parent."'";
|
||||||
$sql.= " AND fk_product_fils = '".$fk_child."'";
|
$sql.= " AND fk_product_fils = '".$fk_child."'";
|
||||||
@ -2389,6 +2391,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
$this->is_sousproduit_qty = $obj->qty;
|
$this->is_sousproduit_qty = $obj->qty;
|
||||||
|
$this->is_sousproduit_incdec = $obj->incdec;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2668,7 +2671,7 @@ class Product extends CommonObject
|
|||||||
$type=(! empty($desc_pere[2]) ? $desc_pere[2] :'');
|
$type=(! empty($desc_pere[2]) ? $desc_pere[2] :'');
|
||||||
$label=(! empty($desc_pere[3]) ? $desc_pere[3] :'');
|
$label=(! empty($desc_pere[3]) ? $desc_pere[3] :'');
|
||||||
$incdec=!empty($desc_pere[4]) ? $desc_pere[4] : 0;
|
$incdec=!empty($desc_pere[4]) ? $desc_pere[4] : 0;
|
||||||
|
|
||||||
if ($multiply < 1) $multiply=1;
|
if ($multiply < 1) $multiply=1;
|
||||||
|
|
||||||
//print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n";
|
//print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n";
|
||||||
|
|||||||
@ -64,18 +64,19 @@ if ($id > 0 || ! empty($ref))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if ($cancel) $action ='';
|
||||||
|
|
||||||
// Action association d'un sousproduit
|
// Action association d'un sousproduit
|
||||||
if ($action == 'add_prod' &&
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
$cancel <> $langs->trans("Cancel") &&
|
|
||||||
($user->rights->produit->creer || $user->rights->service->creer))
|
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
for ($i=0; $i<$_POST["max_prod"]; $i++)
|
for ($i=0; $i<$_POST["max_prod"]; $i++)
|
||||||
{
|
{
|
||||||
if ($_POST["prod_id_chk".$i] > 0)
|
if ($_POST["prod_qty_".$i] > 0)
|
||||||
{
|
{
|
||||||
if($product->add_sousproduit($id, $_POST["prod_id_".$i],$_POST["prod_qty_".$i]) > 0)
|
if ($product->add_sousproduit($id, $_POST["prod_id_".$i], $_POST["prod_qty_".$i], $_POST["prod_incdec_".$i]) > 0)
|
||||||
{
|
{
|
||||||
|
//var_dump($id.' - '.$_POST["prod_id_".$i].' - '.$_POST["prod_qty_".$i]);exit;
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -109,25 +110,17 @@ $cancel <> $langs->trans("Cancel") &&
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if($action==='save_composed_product') {
|
else if($action==='save_composed_product')
|
||||||
|
{
|
||||||
$TProduct = GETPOST('TProduct', 'array');
|
$TProduct = GETPOST('TProduct', 'array');
|
||||||
if(!empty($TProduct)) {
|
if(!empty($TProduct))
|
||||||
|
{
|
||||||
foreach ($TProduct as $id_product => $row) {
|
foreach ($TProduct as $id_product => $row)
|
||||||
|
{
|
||||||
$product->update_sousproduit($id, $id_product,$row['qty'], isset($row['incdec']) ? 1 : 0 );
|
$product->update_sousproduit($id, $id_product,$row['qty'], isset($row['incdec']) ? 1 : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$action='';
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cancel == $langs->trans("Cancel"))
|
|
||||||
{
|
|
||||||
$action = '';
|
|
||||||
header("Location: card.php?id=".$_POST["id"]);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -255,94 +248,134 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$atleastonenotdefined=0;
|
$atleastonenotdefined=0;
|
||||||
print '<tr><td colspan="2">';
|
print '<tr><td colspan="2">';
|
||||||
print $langs->trans("ProductAssociationList").'<br>';
|
print $langs->trans("ProductAssociationList").'<br>';
|
||||||
|
|
||||||
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post" ">';
|
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="save_composed_product" />';
|
print '<input type="hidden" name="action" value="save_composed_product" />';
|
||||||
print '<input type="hidden" name="id" value="'.$id.'" />';
|
print '<input type="hidden" name="id" value="'.$id.'" />';
|
||||||
|
|
||||||
print '<table class="centpercent nobordernopadding">';
|
print '<table class="centpercent nobordernopadding">';
|
||||||
|
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans('ComposedProduct').'</td><td>'.$langs->trans('Qty').'</td><td>'.$langs->trans('ComposedProductDecreaseStock').'</td><td>'.$langs->trans('MinSupplierPrice').'</td><td>'.$langs->trans('Price').'</td><td>'.$langs->trans('Stock').'</td></tr>';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans('ComposedProduct').'</td>';
|
||||||
|
print '<td>'.$langs->trans('Label').'</td>';
|
||||||
|
print '<td align="right" colspan="2">'.$langs->trans('MinSupplierPrice').'</td>';
|
||||||
|
if (! empty($conf->stock->enabled)) print '<td align="right">'.$langs->trans('Stock').'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans('Qty').'</td>';
|
||||||
|
print '<td align="center">'.$langs->trans('ComposedProductDIncDecStock').'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
foreach($prods_arbo as $value)
|
foreach($prods_arbo as $value)
|
||||||
{
|
{
|
||||||
$productstatic->id=$value['id'];
|
$productstatic->id=$value['id'];
|
||||||
$productstatic->type=$value['type'];
|
$productstatic->type=$value['type'];
|
||||||
|
$productstatic->label=$value['label'];
|
||||||
|
|
||||||
$class=($class=='impair')?'pair':'impair';
|
$class=($class=='impair')?'pair':'impair';
|
||||||
|
|
||||||
print '<tr class="'.$class.'">';
|
print '<tr class="'.$class.'">';
|
||||||
if ($value['level'] <= 1)
|
if ($value['level'] <= 1)
|
||||||
{
|
{
|
||||||
$notdefined=0;
|
$notdefined=0;
|
||||||
$productstatic->ref=$value['fullpath'];
|
$productstatic->ref=$value['ref'];
|
||||||
$nb_of_subproduct = $value['nb'];
|
$nb_of_subproduct = $value['nb'];
|
||||||
|
|
||||||
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';
|
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';
|
||||||
|
print '<td>'.$productstatic->label.'</td>';
|
||||||
if($user->rights->produit->creer || $user->rights->service->creer) {
|
|
||||||
print '<td><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
|
// Best buying price
|
||||||
print '<td><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked="checked"':'' ).' /></td>';
|
print '<td align="right">';
|
||||||
|
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
|
||||||
|
{
|
||||||
|
print ' '.$langs->trans("BuyingPriceMinShort").': ';
|
||||||
|
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0);
|
||||||
|
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
|
||||||
|
$total+=$totalline;
|
||||||
|
print '<td align="right">';
|
||||||
|
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency));
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Stock
|
||||||
|
if (! empty($conf->stock->enabled)) print '<td align="right">'.$value['stock'].'</td>'; // Real stock
|
||||||
|
|
||||||
|
// Qty + IncDec
|
||||||
|
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||||
|
{
|
||||||
|
print '<td align="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" size="4" /></td>';
|
||||||
|
print '<td align="center"><input type="checkbox" name="TProduct['.$productstatic->id.'][incdec]" value="1" '.($value['incdec']==1?'checked="checked"':'' ).' /></td>';
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
print '<td>'.$nb_of_subproduct.'</td>';
|
print '<td>'.$nb_of_subproduct.'</td>';
|
||||||
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
|
print '<td>'.($value['incdec']==1?'x':'' ).'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<td align="right">';
|
|
||||||
if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0)
|
|
||||||
{
|
|
||||||
print $langs->trans("BuyingPriceMinShort").': ';
|
|
||||||
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0);
|
|
||||||
else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; }
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
$totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT');
|
|
||||||
$total+=$totalline;
|
|
||||||
print '<td align="right">'.($notdefined?'':price($totalline,'','',0,0,-1,$conf->currency)).'</td>';
|
|
||||||
if (! empty($conf->stock->enabled)) print '<td align="right">'.$langs->trans("Stock").': '.$value['stock'].'</td>'; // Real stock
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
$productstatic->ref=$value['label'];
|
{
|
||||||
|
//$productstatic->ref=$value['label'];
|
||||||
|
$productstatic->ref=$value['ref'];
|
||||||
print '<td>';
|
print '<td>';
|
||||||
for ($i=0; $i < $value['level']; $i++)
|
for ($i=0; $i < $value['level']; $i++) print ' '; // Add indentation
|
||||||
{
|
|
||||||
print ' ';
|
|
||||||
}
|
|
||||||
print $productstatic->getNomUrl(1,'composition').'</td>';
|
print $productstatic->getNomUrl(1,'composition').'</td>';
|
||||||
print '<td>'.$value['nb'].'</td>';
|
print '<td>'.$productstatic->label.'</td>';
|
||||||
|
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
|
||||||
|
if (! empty($conf->stock->enabled)) print '<td></td>'; // Real stock
|
||||||
|
print '<td align="center">'.$value['nb'].'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td> <td>';
|
|
||||||
print '<td> <td>';
|
|
||||||
if (! empty($conf->stock->enabled)) print '<td align="right"></td>'; // Real stock
|
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td colspan="3" align="right">'.$langs->trans("TotalBuyingPriceMin").': ';
|
print '<td class="liste_total"></td>';
|
||||||
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
|
print '<td class="liste_total"></td>';
|
||||||
|
|
||||||
|
// Minimum buying price
|
||||||
|
print '<td class="liste_total" align="right">';
|
||||||
|
print $langs->trans("TotalBuyingPriceMin");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right" class="liste_total">'.($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency)).'</td>';
|
|
||||||
|
print '<td class="liste_total" align="right">';
|
||||||
|
if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')';
|
||||||
|
print ($atleastonenotdefined?'':price($total,'','',0,0,-1,$conf->currency));
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Stock
|
||||||
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right"> </td>';
|
if (! empty($conf->stock->enabled)) print '<td class="liste_total" align="right"> </td>';
|
||||||
|
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||||
|
{
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||||
|
{
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if($user->rights->produit->creer || $user->rights->service->creer) {
|
/*if($user->rights->produit->creer || $user->rights->service->creer) {
|
||||||
print '<div class="tabsAction"><input type="submit" value="'.$langs->trans('Save').'" /></div>';
|
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of parent virtual products
|
// Number of parent virtual products
|
||||||
print '<tr class="pair"><td>'.$langs->trans("ParentProductsNumber").'</td><td>';
|
print '<tr class="pair"><td>'.$langs->trans("ParentProductsNumber").'</td><td>';
|
||||||
print $form->textwithpicto(count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
|
print $form->textwithpicto(count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
|
||||||
print '</td>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (count($prodsfather) > 0)
|
if (count($prodsfather) > 0)
|
||||||
{
|
{
|
||||||
@ -409,10 +442,11 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
print '<table class="nobordernopadding" width="100%">';
|
print '<table class="nobordernopadding" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th class="liste_titre">'.$langs->trans("Ref").'</td>';
|
print '<th class="liste_titre">'.$langs->trans("ComposedProduct").'</td>';
|
||||||
print '<th class="liste_titre">'.$langs->trans("Label").'</td>';
|
print '<th class="liste_titre">'.$langs->trans("Label").'</td>';
|
||||||
print '<th class="liste_titre" align="center">'.$langs->trans("IsInPackage").'</td>';
|
//print '<th class="liste_titre" align="center">'.$langs->trans("IsInPackage").'</td>';
|
||||||
print '<th class="liste_titre" align="right">'.$langs->trans("Qty").'</td>';
|
print '<th class="liste_titre" align="right">'.$langs->trans("Qty").'</td>';
|
||||||
|
print '<th align="center">'.$langs->trans('ComposedProductDIncDecStock').'</th>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -464,19 +498,37 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($conf->global->MAIN_MULTILANGS && $objp->labelm) $labeltoshow=$objp->labelm;
|
if ($conf->global->MAIN_MULTILANGS && $objp->labelm) $labeltoshow=$objp->labelm;
|
||||||
|
|
||||||
print '<td>'.$labeltoshow.'</td>';
|
print '<td>'.$labeltoshow.'</td>';
|
||||||
|
|
||||||
|
|
||||||
if($product->is_sousproduit($id, $objp->rowid))
|
if($product->is_sousproduit($id, $objp->rowid))
|
||||||
{
|
{
|
||||||
$addchecked = ' checked="checked"';
|
//$addchecked = ' checked="checked"';
|
||||||
$qty=$product->is_sousproduit_qty;
|
$qty=$product->is_sousproduit_qty;
|
||||||
|
$incdec=$product->is_sousproduit_incdec;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$addchecked = '';
|
//$addchecked = '';
|
||||||
$qty="1";
|
$qty=0;
|
||||||
|
$incdec=0;
|
||||||
}
|
}
|
||||||
print '<td align="center"><input type="hidden" name="prod_id_'.$i.'" value="'.$objp->rowid.'">';
|
// Contained into package
|
||||||
print '<input type="checkbox" '.$addchecked.'name="prod_id_chk'.$i.'" value="'.$objp->rowid.'"></td>';
|
/*print '<td align="center"><input type="hidden" name="prod_id_'.$i.'" value="'.$objp->rowid.'">';
|
||||||
print '<td align="right"><input type="text" size="2" name="prod_qty_'.$i.'" value="'.$qty.'"></td>';
|
print '<input type="checkbox" '.$addchecked.'name="prod_id_chk'.$i.'" value="'.$objp->rowid.'"></td>';*/
|
||||||
|
// Qty
|
||||||
|
print '<td align="right"><input type="hidden" name="prod_id_'.$i.'" value="'.$objp->rowid.'"><input type="text" size="2" name="prod_qty_'.$i.'" value="'.($qty?$qty:'').'"></td>';
|
||||||
|
|
||||||
|
// Inc Dec
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($qty) print '<input type="checkbox" name="prod_incdec_'.$i.'" value="1" '.($incdec?'checked="checked"':'').'>';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO Hide field and show it when setting a qty
|
||||||
|
print '<input type="checkbox" name="prod_incdec_'.$i.'" value="1" checked="checked">';
|
||||||
|
//print '<input type="checkbox" disabled="true" name="prod_incdec_'.$i.'" value="1" checked="checked">';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -493,9 +545,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if($num > 0)
|
if($num > 0)
|
||||||
{
|
{
|
||||||
print '<br><div class="center">';
|
print '<br><div class="center">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'/'.$langs->trans("Update").'">';
|
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Add").'/'.$langs->trans("Update").'">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Cancel").'">';
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user