New: works with variants:
- If product is parent showing stock of childs and not itself - Add function hasVariants for know if product has variants
This commit is contained in:
parent
b8eaeb7c62
commit
2ef0e95586
@ -3493,6 +3493,25 @@ class Product extends CommonObject
|
|||||||
return $nb;
|
return $nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a product has variants or not
|
||||||
|
*
|
||||||
|
* @return int Number of variants
|
||||||
|
*/
|
||||||
|
function hasVariants() {
|
||||||
|
$nb = 0;
|
||||||
|
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."product_attribute_combination WHERE fk_product_parent = ".$this->id;
|
||||||
|
$sql.= " AND entity IN (".getEntity('product').")";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($obj) $nb = $obj->nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nb;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return all parent products for current product (first level only)
|
* Return all parent products for current product (first level only)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -45,6 +45,13 @@ if (! empty($conf->projet->enabled))
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->variants->enabled)) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductAttribute.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductAttributeValue.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination2ValuePair.class.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadlangs(array('products', 'orders', 'bills', 'stocks', 'sendings'));
|
$langs->loadlangs(array('products', 'orders', 'bills', 'stocks', 'sendings'));
|
||||||
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
|
||||||
@ -518,6 +525,8 @@ if ($id > 0 || $ref)
|
|||||||
$object = new Product($db);
|
$object = new Product($db);
|
||||||
$result = $object->fetch($id,$ref);
|
$result = $object->fetch($id,$ref);
|
||||||
|
|
||||||
|
$variants = $object->hasVariants();
|
||||||
|
|
||||||
$object->load_stock();
|
$object->load_stock();
|
||||||
|
|
||||||
$title = $langs->trans('ProductServiceCard');
|
$title = $langs->trans('ProductServiceCard');
|
||||||
@ -558,8 +567,9 @@ if ($id > 0 || $ref)
|
|||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
if ($conf->productbatch->enabled)
|
if (! $variants) {
|
||||||
{
|
|
||||||
|
if ($conf->productbatch->enabled) {
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("ManageLotSerial") . '</td><td>';
|
print '<tr><td class="titlefield">' . $langs->trans("ManageLotSerial") . '</td><td>';
|
||||||
print $object->getLibStatut(0, 2);
|
print $object->getLibStatut(0, 2);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -576,15 +586,13 @@ if ($id > 0 || $ref)
|
|||||||
print '<tr><td>' . $langs->trans("BuyingPriceMin") . '</td>';
|
print '<tr><td>' . $langs->trans("BuyingPriceMin") . '</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$product_fourn = new ProductFournisseur($db);
|
$product_fourn = new ProductFournisseur($db);
|
||||||
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0)
|
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) {
|
||||||
{
|
|
||||||
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur();
|
if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur();
|
||||||
else print $langs->trans("NotDefined");
|
else print $langs->trans("NotDefined");
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES))
|
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
{
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
||||||
if ($object->price_base_type == 'TTC') {
|
if ($object->price_base_type == 'TTC') {
|
||||||
@ -602,9 +610,7 @@ if ($id > 0 || $ref)
|
|||||||
print price($object->price_min) . ' ' . $langs->trans($object->price_base_type);
|
print price($object->price_min) . ' ' . $langs->trans($object->price_base_type);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Price
|
// Price
|
||||||
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
print '<tr><td>' . $langs->trans("SellingPrice") . '</td><td>';
|
||||||
print $langs->trans("Variable");
|
print $langs->trans("Variable");
|
||||||
@ -654,8 +660,7 @@ if ($id > 0 || $ref)
|
|||||||
$found = 0;
|
$found = 0;
|
||||||
$helpondiff = '<strong>' . $langs->trans("StockDiffPhysicTeoric") . ':</strong><br>';
|
$helpondiff = '<strong>' . $langs->trans("StockDiffPhysicTeoric") . ':</strong><br>';
|
||||||
// Number of customer orders running
|
// Number of customer orders running
|
||||||
if (! empty($conf->commande->enabled))
|
if (!empty($conf->commande->enabled)) {
|
||||||
{
|
|
||||||
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
||||||
$helpondiff .= $langs->trans("ProductQtyInCustomersOrdersRunning") . ': ' . $object->stats_commande['qty'];
|
$helpondiff .= $langs->trans("ProductQtyInCustomersOrdersRunning") . ': ' . $object->stats_commande['qty'];
|
||||||
$result = $object->load_stats_commande(0, '0', 1);
|
$result = $object->load_stats_commande(0, '0', 1);
|
||||||
@ -664,16 +669,14 @@ if ($id > 0 || $ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Number of product from customer order already sent (partial shipping)
|
// Number of product from customer order already sent (partial shipping)
|
||||||
if (! empty($conf->expedition->enabled))
|
if (!empty($conf->expedition->enabled)) {
|
||||||
{
|
|
||||||
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
||||||
$result = $object->load_stats_sending(0, '2', 1);
|
$result = $object->load_stats_sending(0, '2', 1);
|
||||||
$helpondiff .= $langs->trans("ProductQtyInShipmentAlreadySent") . ': ' . $object->stats_expedition['qty'];
|
$helpondiff .= $langs->trans("ProductQtyInShipmentAlreadySent") . ': ' . $object->stats_expedition['qty'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of supplier order running
|
// Number of supplier order running
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (!empty($conf->fournisseur->enabled)) {
|
||||||
{
|
|
||||||
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
||||||
$result = $object->load_stats_commande_fournisseur(0, '3,4', 1);
|
$result = $object->load_stats_commande_fournisseur(0, '3,4', 1);
|
||||||
$helpondiff .= $langs->trans("ProductQtyInSuppliersOrdersRunning") . ': ' . $object->stats_commande_fournisseur['qty'];
|
$helpondiff .= $langs->trans("ProductQtyInSuppliersOrdersRunning") . ': ' . $object->stats_commande_fournisseur['qty'];
|
||||||
@ -683,8 +686,7 @@ if ($id > 0 || $ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Number of product from supplier order already received (partial receipt)
|
// Number of product from supplier order already received (partial receipt)
|
||||||
if (! empty($conf->fournisseur->enabled))
|
if (!empty($conf->fournisseur->enabled)) {
|
||||||
{
|
|
||||||
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
if ($found) $helpondiff .= '<br>'; else $found = 1;
|
||||||
$helpondiff .= $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied") . ': ' . $object->stats_reception['qty'];
|
$helpondiff .= $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied") . ': ' . $object->stats_reception['qty'];
|
||||||
}
|
}
|
||||||
@ -705,27 +707,21 @@ if ($id > 0 || $ref)
|
|||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "stock_mouvement as m";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "stock_mouvement as m";
|
||||||
$sql .= " WHERE m.fk_product = '" . $object->id . "'";
|
$sql .= " WHERE m.fk_product = '" . $object->id . "'";
|
||||||
$resqlbis = $db->query($sql);
|
$resqlbis = $db->query($sql);
|
||||||
if ($resqlbis)
|
if ($resqlbis) {
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resqlbis);
|
$obj = $db->fetch_object($resqlbis);
|
||||||
$lastmovementdate = $db->jdate($obj->datem);
|
$lastmovementdate = $db->jdate($obj->datem);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
print '<tr><td class="tdtop">' . $langs->trans("LastMovement") . '</td><td>';
|
print '<tr><td class="tdtop">' . $langs->trans("LastMovement") . '</td><td>';
|
||||||
if ($lastmovementdate)
|
if ($lastmovementdate) {
|
||||||
{
|
|
||||||
print dol_print_date($lastmovementdate, 'dayhour') . ' ';
|
print dol_print_date($lastmovementdate, 'dayhour') . ' ';
|
||||||
print '(<a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?idproduct=' . $object->id . '">' . $langs->trans("FullList") . '</a>)';
|
print '(<a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?idproduct=' . $object->id . '">' . $langs->trans("FullList") . '</a>)';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?idproduct=' . $object->id . '">' . $langs->trans("None") . '</a>';
|
print '<a href="' . DOL_URL_ROOT . '/product/stock/mouvement.php?idproduct=' . $object->id . '">' . $langs->trans("None") . '</a>';
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
}
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -770,23 +766,24 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
print "<div class=\"tabsAction\">\n";
|
print "<div class=\"tabsAction\">\n";
|
||||||
|
|
||||||
if ($user->rights->stock->mouvement->creer)
|
if (! $variants) {
|
||||||
{
|
|
||||||
|
if ($user->rights->stock->mouvement->creer) {
|
||||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=correction">' . $langs->trans("CorrectStock") . '</a>';
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=correction">' . $langs->trans("CorrectStock") . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch())
|
//if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch())
|
||||||
if ($user->rights->stock->mouvement->creer)
|
if ($user->rights->stock->mouvement->creer) {
|
||||||
{
|
|
||||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=transfert">' . $langs->trans("TransferStock") . '</a>';
|
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=transfert">' . $langs->trans("TransferStock") . '</a>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (! $variants) {
|
||||||
/*
|
/*
|
||||||
* Stock detail (by warehouse). May go down into batch details.
|
* Stock detail (by warehouse). May go down into batch details.
|
||||||
*/
|
*/
|
||||||
@ -801,8 +798,7 @@ print '<td align="right">'.$langs->trans("EstimatedStockValueShort").'</td>';
|
|||||||
print '<td align="right">' . $langs->trans("SellPriceMin") . '</td>';
|
print '<td align="right">' . $langs->trans("SellPriceMin") . '</td>';
|
||||||
print '<td align="right">' . $langs->trans("EstimatedStockValueSellShort") . '</td>';
|
print '<td align="right">' . $langs->trans("EstimatedStockValueSellShort") . '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if ((! empty($conf->productbatch->enabled)) && $object->hasbatch())
|
if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) {
|
||||||
{
|
|
||||||
print '<tr class="liste_titre"><td width="10%"></td>';
|
print '<tr class="liste_titre"><td width="10%"></td>';
|
||||||
print '<td align="right" width="10%">' . $langs->trans("batch_number") . '</td>';
|
print '<td align="right" width="10%">' . $langs->trans("batch_number") . '</td>';
|
||||||
print '<td align="center" width="10%">' . $langs->trans("EatByDate") . '</td>';
|
print '<td align="center" width="10%">' . $langs->trans("EatByDate") . '</td>';
|
||||||
@ -832,13 +828,12 @@ $total=0;
|
|||||||
$totalvalue = $totalvaluesell = 0;
|
$totalvalue = $totalvaluesell = 0;
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$total = $totalwithpmp;
|
$total = $totalwithpmp;
|
||||||
$i=0; $var=false;
|
$i = 0;
|
||||||
while ($i < $num)
|
$var = false;
|
||||||
{
|
while ($i < $num) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$entrepotstatic->id = $obj->rowid;
|
$entrepotstatic->id = $obj->rowid;
|
||||||
$entrepotstatic->libelle = $obj->label;
|
$entrepotstatic->libelle = $obj->label;
|
||||||
@ -866,19 +861,16 @@ if ($resql)
|
|||||||
$totalvalue = $totalvalue + ($object->pmp * $obj->reel);
|
$totalvalue = $totalvalue + ($object->pmp * $obj->reel);
|
||||||
$totalvaluesell = $totalvaluesell + ($object->price * $obj->reel);
|
$totalvaluesell = $totalvaluesell + ($object->price * $obj->reel);
|
||||||
// Batch Detail
|
// Batch Detail
|
||||||
if ((! empty($conf->productbatch->enabled)) && $object->hasbatch())
|
if ((!empty($conf->productbatch->enabled)) && $object->hasbatch()) {
|
||||||
{
|
|
||||||
$details = Productbatch::findAll($db, $obj->product_stock_id, 0, $object->id);
|
$details = Productbatch::findAll($db, $obj->product_stock_id, 0, $object->id);
|
||||||
if ($details < 0) dol_print_error($db);
|
if ($details < 0) dol_print_error($db);
|
||||||
foreach ($details as $pdluo)
|
foreach ($details as $pdluo) {
|
||||||
{
|
|
||||||
$product_lot_static->id = $pdluo->lotid;
|
$product_lot_static->id = $pdluo->lotid;
|
||||||
$product_lot_static->batch = $pdluo->batch;
|
$product_lot_static->batch = $pdluo->batch;
|
||||||
$product_lot_static->eatby = $pdluo->eatby;
|
$product_lot_static->eatby = $pdluo->eatby;
|
||||||
$product_lot_static->sellby = $pdluo->sellby;
|
$product_lot_static->sellby = $pdluo->sellby;
|
||||||
|
|
||||||
if ($action == 'editline' && GETPOST('lineid','int') == $pdluo->id)
|
if ($action == 'editline' && GETPOST('lineid', 'int') == $pdluo->id) { //Current line edit
|
||||||
{ //Current line edit
|
|
||||||
print "\n" . '<tr>';
|
print "\n" . '<tr>';
|
||||||
print '<td colspan="9">';
|
print '<td colspan="9">';
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||||
@ -896,9 +888,7 @@ if ($resql)
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
print "\n" . '<tr><td align="right">';
|
print "\n" . '<tr><td align="right">';
|
||||||
print img_picto($langs->trans("Tranfer"), 'uparrow', 'class="hideonsmartphone"') . ' ';
|
print img_picto($langs->trans("Tranfer"), 'uparrow', 'class="hideonsmartphone"') . ' ';
|
||||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&id_entrepot=' . $entrepotstatic->id . '&action=transfert&pdluoid=' . $pdluo->id . '">' . $langs->trans("TransferStock") . '</a>';
|
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&id_entrepot=' . $entrepotstatic->id . '&action=transfert&pdluoid=' . $pdluo->id . '">' . $langs->trans("TransferStock") . '</a>';
|
||||||
@ -919,8 +909,7 @@ if ($resql)
|
|||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} else dol_print_error($db);
|
||||||
else dol_print_error($db);
|
|
||||||
|
|
||||||
print '<tr class="liste_total"><td align="right" class="liste_total" colspan="4">' . $langs->trans("Total") . ':</td>';
|
print '<tr class="liste_total"><td align="right" class="liste_total" colspan="4">' . $langs->trans("Total") . ':</td>';
|
||||||
print '<td class="liste_total" align="right">' . price2num($total, 'MS') . '</td>';
|
print '<td class="liste_total" align="right">' . price2num($total, 'MS') . '</td>';
|
||||||
@ -944,8 +933,7 @@ print "</tr>";
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) {
|
||||||
{
|
|
||||||
print '<br><br>';
|
print '<br><br>';
|
||||||
print_titre($langs->trans('AddNewProductStockWarehouse'));
|
print_titre($langs->trans('AddNewProductStockWarehouse'));
|
||||||
|
|
||||||
@ -971,11 +959,9 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
|||||||
$pse = new ProductStockEntrepot($db);
|
$pse = new ProductStockEntrepot($db);
|
||||||
$lines = $pse->fetchAll($id);
|
$lines = $pse->fetchAll($id);
|
||||||
|
|
||||||
if (!empty($lines))
|
if (!empty($lines)) {
|
||||||
{
|
|
||||||
$var = false;
|
$var = false;
|
||||||
foreach($lines as $line)
|
foreach ($lines as $line) {
|
||||||
{
|
|
||||||
$ent = new Entrepot($db);
|
$ent = new Entrepot($db);
|
||||||
$ent->fetch($line['fk_entrepot']);
|
$ent->fetch($line['fk_entrepot']);
|
||||||
print '<tr class="oddeven"><td width="40%">' . $ent->getNomUrl(3) . '</td>';
|
print '<tr class="oddeven"><td width="40%">' . $ent->getNomUrl(3) . '</td>';
|
||||||
@ -994,6 +980,92 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE))
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// List of variants
|
||||||
|
|
||||||
|
$prodstatic = new Product($db);
|
||||||
|
$prodcomb = new ProductCombination($db);
|
||||||
|
$comb2val = new ProductCombination2ValuePair($db);
|
||||||
|
$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id);
|
||||||
|
|
||||||
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="massaction">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||||
|
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||||
|
|
||||||
|
// load variants
|
||||||
|
$title = $langs->trans("ProductCombinations");
|
||||||
|
|
||||||
|
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive">';
|
||||||
|
?>
|
||||||
|
<table class="liste">
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
|
||||||
|
<td class="liste_titre"><?php echo $langs->trans('Combination') ?></td>
|
||||||
|
<td class="liste_titre center"><?php echo $langs->trans('OnSell') ?></td>
|
||||||
|
<td class="liste_titre center"><?php echo $langs->trans('OnBuy') ?></td>
|
||||||
|
<td class="liste_titre right"><?php echo $langs->trans('Stock') ?></td>
|
||||||
|
<td class="liste_titre"></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if (count($productCombinations))
|
||||||
|
{
|
||||||
|
$stock_total= 0;
|
||||||
|
foreach ($productCombinations as $currcomb)
|
||||||
|
{
|
||||||
|
$prodstatic->fetch($currcomb->fk_product_child);
|
||||||
|
$prodstatic->load_stock();
|
||||||
|
$stock_total+=$prodstatic->stock_reel;
|
||||||
|
?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td><?php echo $prodstatic->getNomUrl(1) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id);
|
||||||
|
$iMax = count($productCombination2ValuePairs);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $iMax; $i++) {
|
||||||
|
echo dol_htmlentities($productCombination2ValuePairs[$i]);
|
||||||
|
|
||||||
|
if ($i !== ($iMax - 1)) {
|
||||||
|
echo ', ';
|
||||||
|
}
|
||||||
|
} ?>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: center;"><?php echo $prodstatic->getLibStatut(2, 0) ?></td>
|
||||||
|
<td style="text-align: center;"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
|
||||||
|
<td class="right"><?php echo $prodstatic->stock_reel ?></td>
|
||||||
|
<td class="right">
|
||||||
|
<a class="paddingleft paddingright" href="<?php echo dol_buildpath('/product/stock/product.php?id='.$currcomb->fk_product_child, 2) ?>"><?php echo img_edit() ?></a>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
print '<td colspan="4" align="left">'.$langs->trans("Total").'</td>';
|
||||||
|
print '<td align="right">'.$stock_total.'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -634,7 +634,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
|
|||||||
}
|
}
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
return 1;
|
return $newproduct->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user