Skip to content

Commit

Permalink
Merge pull request #8986 from atm-greg/fix_desired_stock
Browse files Browse the repository at this point in the history
FIX bad result on fetch ProductStockEntrepot
  • Loading branch information
eldy committed Jun 22, 2018
2 parents cfc8e8b + df05698 commit bd72774
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions htdocs/product/stock/product.php
Expand Up @@ -85,6 +85,9 @@
$result = $object->fetch($id, $ref);

}

if(empty($id) && !empty($object->id)) $id = $object->id;

$modulepart='product';

// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
Expand Down Expand Up @@ -130,7 +133,7 @@
if($maj_ok) {

$pse = new ProductStockEntrepot($db);
if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) {
if($pse->fetch('', $id, GETPOST('fk_entrepot')) > 0) {

// Update
$pse->seuil_stock_alerte = $seuil_stock_alerte;
Expand All @@ -141,7 +144,7 @@

// Create
$pse->fk_entrepot = GETPOST('fk_entrepot');
$pse->fk_product = GETPOST('id');
$pse->fk_product = $id;
$pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte');
$pse->desiredstock = GETPOST('desiredstock');
if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated'));
Expand All @@ -150,7 +153,7 @@

}

header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id'));
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;

}
Expand Down Expand Up @@ -951,7 +954,7 @@
if (!empty($user->rights->produit->creer)){
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="action" value="addlimitstockwarehouse">';
print '<input type="hidden" name="id" value="'.GETPOST('id').'">';
print '<input type="hidden" name="id" value="'.$id.'">';
}
print '<table class="noborder" width="100%">';
if (!empty($user->rights->produit->creer)){
Expand All @@ -968,7 +971,7 @@
}

$pse = new ProductStockEntrepot($db);
$lines = $pse->fetchAll(GETPOST('id'));
$lines = $pse->fetchAll($id);

if (!empty($lines))
{
Expand All @@ -981,7 +984,7 @@
print '<td align="right">'.$line['seuil_stock_alerte'].'</td>';
print '<td align="right">'.$line['desiredstock'].'</td>';
if (!empty($user->rights->produit->creer)){
print '<td align="right"><a href="?id='.GETPOST('id').'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
print '<td align="right"><a href="?id='.$id.'&fk_productstockwarehouse='.$line['id'].'&action=delete_productstockwarehouse">'.img_delete().'</a></td>';
}
print '</tr>';
}
Expand Down

0 comments on commit bd72774

Please sign in to comment.