Debug variants

This commit is contained in:
Laurent Destailleur 2019-10-12 15:27:06 +02:00
parent 2fa3b23cf1
commit 9871dd8770
3 changed files with 27 additions and 15 deletions

View File

@ -208,8 +208,8 @@ UseMultipriceRules=Use price segment rules (defined into product module setup) t
PercentVariationOver=%% variation over %s PercentVariationOver=%% variation over %s
PercentDiscountOver=%% discount over %s PercentDiscountOver=%% discount over %s
KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products
VariantRefExample=Example: COL VariantRefExample=Examples: COL, SIZE
VariantLabelExample=Example: Color VariantLabelExample=Examples: Color, Size
### composition fabrication ### composition fabrication
Build=Produce Build=Produce
ProductsMultiPrice=Products and prices for each price segment ProductsMultiPrice=Products and prices for each price segment

View File

@ -804,8 +804,8 @@ if (! $variants) {
*/ */
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="4">' . $langs->trans("Warehouse") . '</td>'; print '<td colspan="4">' . $langs->trans("Warehouse") . '</td>';
print '<td class="right">' . $langs->trans("NumberOfUnit") . '</td>'; print '<td class="right">' . $langs->trans("NumberOfUnit") . '</td>';
@ -918,7 +918,8 @@ if (! $variants) {
print '<td class="center">' . dol_print_date($pdluo->eatby, 'day') . '</td>'; print '<td class="center">' . dol_print_date($pdluo->eatby, 'day') . '</td>';
print '<td class="center">' . dol_print_date($pdluo->sellby, 'day') . '</td>'; print '<td class="center">' . dol_print_date($pdluo->sellby, 'day') . '</td>';
print '<td class="right">' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '</td>'; print '<td class="right">' . $pdluo->qty . ($pdluo->qty < 0 ? ' ' . img_warning() : '') . '</td>';
print '<td colspan="4"></td></tr>'; print '<td colspan="4"></td>';
print '</tr>';
} }
} }
} }
@ -926,12 +927,13 @@ if (! $variants) {
} }
} else dol_print_error($db); } else dol_print_error($db);
// Total line
print '<tr class="liste_total"><td class="right liste_total" colspan="4">' . $langs->trans("Total") . ':</td>'; print '<tr class="liste_total"><td class="right liste_total" colspan="4">' . $langs->trans("Total") . ':</td>';
print '<td class="liste_total right">' . price2num($total, 'MS') . '</td>'; print '<td class="liste_total right">' . price2num($total, 'MS') . '</td>';
print '<td class="liste_total right">'; print '<td class="liste_total right">';
print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : '&nbsp;'); // This value may have rounding errors print ($totalwithpmp ? price(price2num($totalvalue / $totalwithpmp, 'MU')) : '&nbsp;'); // This value may have rounding errors
print '</td>'; print '</td>';
// Value purchase // Value purchase
print '<td class="liste_total right">'; print '<td class="liste_total right">';
print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : '&nbsp;'; print $totalvalue ? price(price2num($totalvalue, 'MT'), 1) : '&nbsp;';
print '</td>'; print '</td>';
@ -939,12 +941,13 @@ if (! $variants) {
if (empty($conf->global->PRODUIT_MULTIPRICES)) print ($total ? price($totalvaluesell / $total, 1) : '&nbsp;'); if (empty($conf->global->PRODUIT_MULTIPRICES)) print ($total ? price($totalvaluesell / $total, 1) : '&nbsp;');
else print $langs->trans("Variable"); else print $langs->trans("Variable");
print '</td>'; print '</td>';
// Value to sell // Value to sell
print '<td class="liste_total right">'; print '<td class="liste_total right">';
if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalvaluesell, 'MT'), 1); if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalvaluesell, 'MT'), 1);
else print $langs->trans("Variable"); else print $langs->trans("Variable");
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
print "</table>"; print "</table>";
print '</div>'; print '</div>';
@ -1067,6 +1070,7 @@ if (! $variants) {
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="4" class="left">'.$langs->trans("Total").'</td>'; print '<td colspan="4" class="left">'.$langs->trans("Total").'</td>';
print '<td class="right">'.$stock_total.'</td>'; print '<td class="right">'.$stock_total.'</td>';
print '<td></td>';
print '</tr>'; print '</tr>';
} }
else else

View File

@ -377,6 +377,7 @@ if (! empty($id) || ! empty($ref))
dol_fiche_end(); dol_fiche_end();
$listofvariantselected = '';
// Create or edit a varian // Create or edit a varian
if ($action == 'add' || ($action == 'edit')) { if ($action == 'add' || ($action == 'edit')) {
@ -386,7 +387,7 @@ if (! empty($id) || ! empty($ref))
//print dol_fiche_head(); //print dol_fiche_head();
$features = $_SESSION['addvariant_'.$object->id]; $features = $_SESSION['addvariant_'.$object->id];
//First, sanitize //First, sanitize
print '<div id="parttoaddvariant">'; $listofvariantselected = '<div id="parttoaddvariant">';
if (! empty($features)) { if (! empty($features)) {
foreach ($features as $feature) { foreach ($features as $feature) {
@ -400,16 +401,14 @@ if (! empty($id) || ! empty($ref))
continue; continue;
} }
print '<i>' . $prodattr->label . '</i>:'. $prodattr_val->value . ' '; $listofvariantselected .= '<i>' . $prodattr->label . '</i>:'. $prodattr_val->value . ' ';
} }
} }
print '</div>'; $listofvariantselected .= '</div>';
print '<br><br>';
//print dol_fiche_end(); //print dol_fiche_end();
} else { } else {
$title = $langs->trans('EditProductCombination'); $title = $langs->trans('EditProductCombination');
} }
print load_fiche_titre($title);
if ($action == 'add') { if ($action == 'add') {
$prodattr_all = $prodattr->fetchAll(); $prodattr_all = $prodattr->fetchAll();
@ -499,6 +498,10 @@ if (! empty($id) || ! empty($ref))
<?php <?php
} }
print '<br>';
print load_fiche_titre($title);
print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="post" id="combinationform" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.dol_escape_htmltag($id).'">'."\n"; print '<input type="hidden" name="id" value="'.dol_escape_htmltag($id).'">'."\n";
@ -507,9 +510,9 @@ if (! empty($id) || ! empty($ref))
print '<input type="hidden" name="valueid" value="' . $valueid .'">'."\n"; print '<input type="hidden" name="valueid" value="' . $valueid .'">'."\n";
} }
print dol_fiche_head(); print dol_fiche_head();
?> ?>
<table class="border" style="width: 100%"> <table class="border" style="width: 100%">
<?php if ($action == 'add') { ?> <?php if ($action == 'add') { ?>
@ -524,6 +527,7 @@ if (! empty($id) || ! empty($ref))
print '<option value="-1">&nbsp;</option>'; print '<option value="-1">&nbsp;</option>';
foreach ($prodattr_all as $attr) foreach ($prodattr_all as $attr)
{ {
//print '<option value="'.$attr->id.'"'.($attr->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
print '<option value="'.$attr->id.'">'.$attr->label.'</option>'; print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
} }
print '</select>'; print '</select>';
@ -561,6 +565,10 @@ if (! empty($id) || ! empty($ref))
<input type="submit" class="button" name="selectvariant" id="selectvariant" value="<?php echo dol_escape_htmltag($langs->trans("SelectCombination")); ?>"> <input type="submit" class="button" name="selectvariant" id="selectvariant" value="<?php echo dol_escape_htmltag($langs->trans("SelectCombination")); ?>">
</td> </td>
</tr> </tr>
<tr><td></td><td>
<?php echo $listofvariantselected; ?>
</td>
</tr>
</table> </table>
<?php <?php
} }
@ -781,8 +789,8 @@ if (! empty($id) || ! empty($ref))
</td> </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_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
<?php if ($object->isProduct()) print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight').'</td>'; ?> <?php if ($object->isProduct()) print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight').'</td>'; ?>
<td class="center;"><?php echo $prodstatic->getLibStatut(2, 0) ?></td> <td class="center"><?php echo $prodstatic->getLibStatut(2, 0) ?></td>
<td class="center;"><?php echo $prodstatic->getLibStatut(2, 1) ?></td> <td class="center"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
<td class="right"> <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=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> <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>