From ea44e14b605725457bf6cf5f6293c9acf47184e3 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 7 Apr 2017 11:01:12 +0200
Subject: [PATCH] Start debug the variant module
---
htdocs/compta/index.php | 12 +-
htdocs/core/class/html.formfile.class.php | 2 +
htdocs/langs/en_US/products.lang | 3 +
htdocs/product/card.php | 1 +
htdocs/product/class/product.class.php | 5 +
htdocs/product/index.php | 16 +--
htdocs/variants/combinations.php | 162 ++++++++++++++--------
htdocs/variants/generator.php | 46 +++---
8 files changed, 143 insertions(+), 104 deletions(-)
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index ea8d47b264e..736d5696c3e 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -233,7 +233,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
if ( $resql )
{
- $var = false;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
@@ -248,7 +247,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
while ($i < $num)
{
$obj = $db->fetch_object($resql);
- print '<tr '.$bc[$var].'><td class="nowrap">';
+ print '<tr class="oddeven"><td class="nowrap">';
$facturesupplierstatic->ref=$obj->ref;
$facturesupplierstatic->id=$obj->rowid;
$facturesupplierstatic->total_ht=$obj->total_ht;
@@ -269,7 +268,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
print '</tr>';
$tot_ttc+=$obj->total_ttc;
$i++;
- $var=!$var;
}
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
@@ -278,7 +276,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
}
else
{
- print '<tr '.$bc[$var].'><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
+ print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
@@ -768,6 +766,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$num = $db->num_rows($resql);
$i = 0;
+ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status=1"><span class="badge">'.$num.'</span></a></th>';
print '<th align="right">'.$langs->trans("DateDue").'</th>';
@@ -848,7 +847,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
- print '</table><br>';
+ print '</table></div><br>';
$db->free($resql);
}
else
@@ -890,6 +889,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
$var=false;
$num = $db->num_rows($resql);
+ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("BillsSuppliersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/fourn/facture/impayees.php"><span class="badge">'.$num.'</span></a></th>';
print '<th align="right">'.$langs->trans("DateDue").'</th>';
@@ -948,7 +948,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoInvoice").'</td></tr>';
}
- print '</table><br>';
+ print '</table></div><br>';
}
else
{
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 1e2dc1c4938..647d0cf6a76 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -593,6 +593,7 @@ class FormFile
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$out.= load_fiche_titre($titletoshow, '', '');
+ $out.= '<div class="div-table-responsive-no-min">';
$out.= '<table class="liste formdoc noborder" summary="listofdocumentstable" width="100%">';
$out.= '<tr class="liste_titre">';
@@ -802,6 +803,7 @@ class FormFile
{
// Affiche pied du tableau
$out.= "</table>\n";
+ $out.= "</div>\n";
if ($genallowed)
{
if (empty($noform)) $out.= '</form>'."\n";
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index 046521e398e..ef4c13c89cc 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -287,6 +287,9 @@ HideProductCombinations=Hide products variant in the products selector
ProductCombination=Variant
NewProductCombination=New variant
EditProductCombination=Editing variant
+NewProductCombinations=New variants
+EditProductCombinations=Editing variants
+SelectCombination=Select combination
ProductCombinationGenerator=Variants generator
Features=Features
PriceImpact=Price impact
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index ac260fc99fb..0c6109ba64a 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -2015,6 +2015,7 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action =
/*
* Documents generes
*/
+
if ($action != 'edit' && $action != 'delete')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 23be6de5111..5f5b6f6eae9 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3559,6 +3559,11 @@ class Product extends CommonObject
if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"');
}
+ if ($mode == 6)
+ {
+ if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"');
+ if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"');
+ }
return $langs->trans('Unknown');
}
diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index 355e0d2757f..73447e456e6 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -130,26 +130,26 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").'</th></tr>';
if (! empty($conf->product->enabled))
{
- $statProducts = "<tr ".$bc[0].">";
+ $statProducts = '<tr class="oddeven">';
$statProducts.= '<td><a href="list.php?type=0&tosell=0&tobuy=0">'.$langs->trans("ProductsNotOnSell").'</a></td><td align="right">'.round($prodser[0][0]).'</td>';
$statProducts.= "</tr>";
- $statProducts.= "<tr ".$bc[1].">";
+ $statProducts.= '<tr class="oddeven">';
$statProducts.= '<td><a href="list.php?type=0">'.$langs->trans("ProductsOnSell").'</a></td><td align="right">'.round($prodser[0][1]).'</td>';
$statProducts.= "</tr>";
- $statProducts.= "<tr ".$bc[0].">";
+ $statProducts.= '<tr class="oddeven">';
$statProducts.= '<td><a href="list.php?type=0&tosell=1&tobuy=1">'.$langs->trans("ProductsOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[0][2]).'</td>';
$statProducts.= "</tr>";
}
if (! empty($conf->service->enabled))
{
- $statServices = "<tr ".$bc[1].">";
+ $statServices = '<tr class="oddeven">';
$statServices.= '<td><a href="list.php?type=1&tosell=0&tobuy=0">'.$langs->trans("ServicesNotOnSell").'</a></td><td align="right">'.round($prodser[1][0]).'</td>';
$statServices.= "</tr>";
- $statServices.= "<tr ".$bc[0].">";
+ $statServices.= '<tr class="oddeven">';
$statServices.= '<td><a href="list.php?type=1">'.$langs->trans("ServicesOnSell").'</a></td><td align="right">'.round($prodser[1][1]).'</td>';
$statServices.= "</tr>";
- $statServices.= "<tr ".$bc[1].">";
+ $statServices.= '<tr class="oddeven">';
$statServices.= '<td><a href="list.php?type=1&tosell=1&tobuy=1">'.$langs->trans("ServicesOnSellAndOnBuy").'</a></td><td align="right">'.round($prodser[1][2]).'</td>';
$statServices.= "</tr>";
@@ -325,10 +325,10 @@ if ($result)
print '</td>';
}
print '<td align="right" class="nowrap">';
- print $product_static->LibStatut($objp->tosell,5,0);
+ print $product_static->LibStatut($objp->tosell,3,0);
print "</td>";
print '<td align="right" class="nowrap">';
- print $product_static->LibStatut($objp->tobuy,5,1);
+ print $product_static->LibStatut($objp->tobuy,3,1);
print "</td>";
print "</tr>\n";
$i++;
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index dabace75ac0..cfbec4a8016 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -36,6 +36,7 @@ $price_impact = (float) GETPOST('price_impact');
$price_impact_percent = (bool) GETPOST('price_impact_percent');
$form = new Form($db);
$action = GETPOST('action');
+$cancel = GETPOST('cancel');
// Security check
$fieldvalue = (! empty($id) ? $id : $ref);
@@ -57,6 +58,10 @@ if ($id > 0 || $ref)
* Actions
*/
+if ($cancel) {
+ $action='';
+}
+
if (! $object->isProduct()) {
header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2));
exit();
@@ -107,7 +112,7 @@ if ($_POST) {
$db->begin();
if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) {
- if (ProductCombination::createProductCombination($product, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact)) {
+ if (ProductCombination::createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact)) {
$db->commit();
setEventMessage($langs->trans('RecordSaved'));
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
@@ -175,7 +180,7 @@ if ($_POST) {
setEventMessage($langs->trans('RecordSaved'));
}
- } else {
+ } elseif ($valueid > 0) {
if ($prodcomb->fetch($valueid) < 0) {
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
@@ -256,6 +261,9 @@ if ($action === 'confirm_deletecombination') {
* View
*/
+$form = new Form($db);
+
+
if (! empty($id) || ! empty($ref)) {
llxHeader("", "", $langs->trans("CardProduct".$object->type));
@@ -342,6 +350,7 @@ if (! empty($id) || ! empty($ref)) {
var select = jQuery("select#features");
select.empty();
+
jQuery("form#combinationform input[type=hidden]").detach();
jQuery.each(variants_selected.index, function (key, val) {
@@ -359,11 +368,12 @@ if (! empty($id) || ! empty($ref)) {
jQuery(document).ready(function() {
jQuery("select#attribute").change(function () {
- console.log("Change of field attribute");
+ console.log("Change of field variant attribute");
var select = jQuery("select#value");
if (!jQuery(this).val().length || jQuery(this).val() == '-1') {
select.empty();
+ select.append('<option value="-1"> </option>');
return;
}
@@ -373,22 +383,27 @@ if (! empty($id) || ! empty($ref)) {
id: jQuery(this).val()
}, function(data) {
if (data.error) {
- jQuery("select#value").empty();
+ select.empty();
+ select.append('<option value="-1"> </option>');
return alert(data.error);
}
select.empty();
- /* console.log(data.length); */
+ select.append('<option value="-1"> </option>');
jQuery(data).each(function (key, val) {
keyforoption = val.id
valforoption = val.value
- jQuery("select#value").append('<option value="' + keyforoption + '">' + valforoption + '</option>');
+ select.append('<option value="' + keyforoption + '">' + valforoption + '</option>');
});
});
});
+ /* Click on button Add combination
+ @FIXME Not compatible with all browsers.
+ */
jQuery("#addfeature").click(function () {
+ console.log("Click on add");
var selectedattr = jQuery("select[name=attribute] option:selected");
var selectedvalu = jQuery("select[name=value] option:selected");
@@ -438,54 +453,69 @@ if (! empty($id) || ! empty($ref)) {
<?php
}
- print '<form method="post" id="combinationform">';
+ print '<form method="post" id="combinationform">';
+ print '<input type="hidden" name="id" value="'.dol_escape_htmltag($id).'">';
+
print dol_fiche_head();
?>
<table class="border" style="width: 100%">
<?php if ($action == 'add') { ?>
+ <!-- Variant -->
<tr>
<td class="titlefieldcreate fieldrequired"><label for="attribute"><?php echo $langs->trans('ProductAttribute') ?></label></td>
- <td colspan="2"><select class="flat minwidth100" id="attribute" name="attribute">
+ <td><select class="flat minwidth100" id="attribute" name="attribute">
<option value="-1"> </option>
<?php foreach ($prodattr_all as $attr): ?>
<option value="<?php echo $attr->id ?>"><?php echo $attr->label ?></option>
<?php endforeach ?>
</select></td>
</tr>
+ <!-- Value -->
<tr>
<td class="fieldrequired"><label for="value"><?php echo $langs->trans('Value') ?></label></td>
- <td colspan="2">
+ <td>
<select class="flat minwidth100" id="value" name="value">
<option value="-1"> </option>
</select>
</td>
</tr>
- <?php } ?>
<tr>
- <td class="titlefieldcreate fieldrequired"><label for="features"><?php echo $langs->trans('Features') ?></label></td>
- <td><select multiple style="width: 100%" id="features">
+ <td></td><td>
+ <a href="#" class="button" id="addfeature"><?php echo $langs->trans("SelectCombination"); ?></a>
+ </td>
+ </tr>
+ </table>
+ <hr>
+ <?php }
+ ?>
+ <table class="border" style="width: 100%">
+ <tr>
+ <td class="titlefieldcreate fieldrequired tdtop"><label for="features"><?php echo $langs->trans('Variant') ?></label></td>
+ <td class="valignmiddle">
+ <div class="inline-block valignmiddle quatrevingtpercent">
+ <select multiple class="centpercent" id="features">
<?php
foreach ($productCombination2ValuePairs1 as $pc2v): ?>
<option value="<?php echo $pc2v->fk_prod_attr ?>:<?php echo $pc2v->fk_prod_attr_val ?>"><?php echo dol_htmlentities($pc2v) ?></option>
<?php endforeach ?>
- </select></td>
+ </select></div>
+ <div class="inline-block valignmiddle">
+ <a href="#" class="inline-block valignmiddle button" id="delfeature"><?php echo img_edit_remove() ?></a>
+ </div>
+ </td>
<td>
- <?php if ($action == 'add'): ?>
- <a href="#" class="button" id="addfeature"><?php echo img_edit_add() ?></a><br><br>
- <a href="#" class="button" id="delfeature"><?php echo img_edit_remove() ?></a>
- <?php endif; ?>
</td>
</tr>
<tr>
<td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td>
- <td colspan="2"><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
+ <td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
<input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo $price_impact_percent ? ' checked' : '' ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label></td>
</tr>
<tr>
<td><label for="weight_impact"><?php echo $langs->trans('WeightImpact') ?></label></td>
- <td colspan="2"><input type="text" id="weight_impact" name="weight_impact" value="<?php echo price($weight_impact) ?>"></td>
+ <td><input type="text" id="weight_impact" name="weight_impact" value="<?php echo price($weight_impact) ?>"></td>
</tr>
</table>
@@ -494,8 +524,10 @@ if (! empty($id) || ! empty($ref)) {
?>
<div style="text-align: center">
-
- <input type="submit" value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button"></div>
+ <input type="submit" value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button">
+
+ <input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel'); ?>" class="button">
+ </div>
<?php foreach ($productCombination2ValuePairs1 as $pc2v): ?>
<input type="hidden" name="features[]" value="<?php echo $pc2v->fk_prod_attr.':'.$pc2v->fk_prod_attr_val ?>">
@@ -509,7 +541,6 @@ if (! empty($id) || ! empty($ref)) {
if ($action === 'delete') {
if ($prodcomb->fetch($valueid) > 0) {
- $form = new Form($db);
$prodstatic->fetch($prodcomb->fk_product_child);
print $form->formconfirm(
@@ -524,8 +555,6 @@ if (! empty($id) || ! empty($ref)) {
}
} elseif ($action === 'copy') {
- $form = new Form($db);
-
print $form->formconfirm(
'combinations.php?id='.$id,
$langs->trans('CloneCombinationsProduct'),
@@ -570,50 +599,64 @@ if (! empty($id) || ! empty($ref)) {
});
</script>
- <form method="post">
- <label for="bulk_action"><?php echo $langs->trans('BulkActions') ?></label>
- <select id="bulk_action" name="bulk_action" class="flat">
- <option value="not_buy"><?php echo $langs->trans('ProductStatusNotOnBuy') ?></option>
- <option value="not_sell"><?php echo $langs->trans('ProductStatusNotOnSell') ?></option>
- <option value="on_buy"><?php echo $langs->trans('ProductStatusOnBuy') ?></option>
- <option value="on_sell"><?php echo $langs->trans('ProductStatusOnSell') ?></option>
- <option value="delete"><?php echo $langs->trans('Delete') ?></option>
- </select>
- <input type="hidden" name="action" value="bulk_actions">
- <input type="submit" value="<?php echo $langs->trans("Apply") ?>" class="button">
- <br>
- <br>
<?php }
-
+ // Buttons
print '<div class="tabsAction">';
+
print ' <div class="inline-block divButAction">';
if ($productCombinations) {
print '<a href="combinations.php?id='.$id.'&action=copy" class="butAction">'.$langs->trans('Copy').'</a>';
}
+
print '<a href="combinations.php?id='.$id.'&action=add" class="butAction">'.$langs->trans('NewProductCombination').'</a>';
- print '<a href="generator.php?id='.$id.'" class="butAction">'.$langs->trans('ProductCombinationGenerator').'</a>';
+
+ if (empty($conf->dol_optimize_smallscreen) && $conf->use_javascript_ajax) // Bugged page. Too much useless javascript.
+ {
+ print '<a href="generator.php?id='.$id.'" class="butAction">'.$langs->trans('ProductCombinationGenerator').'</a>';
+ }
+
print ' </div>';
+
print '</div>';
+ print '<form method="post">';
+
+ $aaa='';
+ if (count($productCombinations))
+ {
+ $aaa = '<label for="bulk_action">'.$langs->trans('BulkActions').'</label>';
+ $aaa .= '<select id="bulk_action" name="bulk_action" class="flat">';
+ $aaa .= ' <option value="not_buy">'.$langs->trans('ProductStatusNotOnBuy').'</option>';
+ $aaa .= ' <option value="not_sell">'.$langs->trans('ProductStatusNotOnSell').'</option>';
+ $aaa .= ' <option value="on_buy">'.$langs->trans('ProductStatusOnBuy').'</option>';
+ $aaa .= ' <option value="on_sell">'.$langs->trans('ProductStatusOnSell').'</option>';
+ $aaa .= ' <option value="delete">'.$langs->trans('Delete').'</option>';
+ $aaa .= '</select>';
+ $aaa .= '<input type="hidden" name="action" value="bulk_actions">';
+ $aaa .= '<input type="submit" value="'.dol_escape_htmltag($langs->trans("Apply")).'" class="button">';
+ }
+
+ $title = $langs->trans("ProductCombinations");
+ print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $aaa, 0);
+ print '<div class="div-table-responsive">';
?>
-
<table class="liste">
<tr class="liste_titre">
- <th class="liste_titre">
+ <th class="liste_titre"><?php echo $langs->trans('Product') ?></th>
+ <th class="liste_titre"><?php echo $langs->trans('Combination') ?></th>
+ <th class="liste_titre right"><?php echo $langs->trans('PriceImpact') ?></th>
+ <th class="liste_titre right"><?php echo $langs->trans('WeightImpact') ?></th>
+ <th class="liste_titre center"><?php echo $langs->trans('OnSell') ?></th>
+ <th class="liste_titre center"><?php echo $langs->trans('OnBuy') ?></th>
+ <th class="liste_titre"></th>
+ <th class="liste_titre center">
<?php if ($productCombinations): ?>
<input type="checkbox" name="select_all">
<?php endif ?>
</th>
- <th class="liste_titre"><?php echo $langs->trans('Product') ?></th>
- <th class="liste_titre"><?php echo $langs->trans('Combination') ?></th>
- <th class="liste_titre" style="text-align: center"><?php echo $langs->trans('PriceImpact') ?></th>
- <th class="liste_titre" style="text-align: center"><?php echo $langs->trans('WeightImpact') ?></th>
- <th class="liste_titre" style="text-align: center;"><?php echo $langs->trans('OnSell') ?></th>
- <th class="liste_titre" style="text-align: center;"><?php echo $langs->trans('OnBuy') ?></th>
- <th class="liste_titre"></th>
</tr>
<?php
@@ -622,8 +665,7 @@ if (! empty($id) || ! empty($ref)) {
foreach ($productCombinations as $currcomb) {
$prodstatic->fetch($currcomb->fk_product_child);
?>
- <tr <?php echo $bc[!$var] ?>>
- <td><input type="checkbox" name="select[<?php echo $prodstatic->id ?>]"></td>
+ <tr class="oddeven">
<td><?php echo $prodstatic->getNomUrl(1) ?></td>
<td>
<?php
@@ -639,17 +681,17 @@ if (! empty($id) || ! empty($ref)) {
}
} ?>
</td>
- <td style="text-align: right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
- <td style="text-align: right"><?php echo ($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?></td>
+ <td class="right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
+ <td class="right"><?php echo ($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?></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 style="text-align: right">
- <a href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=edit&valueid='.$currcomb->id, 2) ?>"><?php echo img_edit() ?></a>
- <a href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=delete&valueid='.$currcomb->id, 2) ?>"><?php echo img_delete() ?></a>
+ <td class="right">
+ <a class="paddingleft paddingright" href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=edit&valueid='.$currcomb->id, 2) ?>"><?php echo img_edit() ?></a>
+ <a class="paddingleft paddingright" href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=delete&valueid='.$currcomb->id, 2) ?>"><?php echo img_delete() ?></a>
</td>
+ <td class="center"><input type="checkbox" name="select[<?php echo $prodstatic->id ?>]"></td>
</tr>
<?php
- $var = !$var;
}
}
else
@@ -659,12 +701,12 @@ if (! empty($id) || ! empty($ref)) {
?>
</table>
- <?php if ($productCombinations): ?>
- </form>
- <?php endif ?>
-
<?php
+ print '</div>';
+ print '</form>';
}
}
llxFooter();
+
+$db->close();
diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php
index b709f240551..7b0358fd176 100644
--- a/htdocs/variants/generator.php
+++ b/htdocs/variants/generator.php
@@ -130,6 +130,8 @@ if ($_POST) {
}
}
+
+
/*
* View
*/
@@ -140,37 +142,21 @@ if (! empty($id) || ! empty($ref)) {
llxHeader("", "", $langs->trans("CardProduct".$object->type));
- if ($result) {
- $head = product_prepare_head($object);
- $titre = $langs->trans("CardProduct".$object->type);
- $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
-
+ if ($result > 0)
+ {
+ $showbarcode=empty($conf->barcode->enabled)?0:1;
+ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
+
+ $head=product_prepare_head($object);
+ $titre=$langs->trans("CardProduct".$object->type);
+ $picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'combinations', $titre, 0, $picto);
-
- print '<table class="border" width="100%">';
-
- // Reference
- print '<tr>';
- print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
- print $form->showrefnav($object, 'id', '', 0);
- print '</td>';
- print '</tr>';
-
- // Label
- print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-
- // Status (to sell)
- print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
- print $object->getLibStatut(2, 0);
- print '</td></tr>';
-
- // Status (to buy)
- print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
- print $object->getLibStatut(2, 1);
- print '</td></tr>';
-
- print '</table>';
-
+
+ $linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
+ $object->next_prev_filter=" fk_product_type = ".$object->type;
+
+ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
+
dol_fiche_end();
}
--
GitLab