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
PercentDiscountOver=%% discount over %s
KeepEmptyForAutoCalculation=Keep empty to have this calculated automatically from weight or volume of products
VariantRefExample=Example: COL
VariantLabelExample=Example: Color
VariantRefExample=Examples: COL, SIZE
VariantLabelExample=Examples: Color, Size
### composition fabrication
Build=Produce
ProductsMultiPrice=Products and prices for each price segment

View File

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

View File

@ -377,6 +377,7 @@ if (! empty($id) || ! empty($ref))
dol_fiche_end();
$listofvariantselected = '';
// Create or edit a varian
if ($action == 'add' || ($action == 'edit')) {
@ -386,7 +387,7 @@ if (! empty($id) || ! empty($ref))
//print dol_fiche_head();
$features = $_SESSION['addvariant_'.$object->id];
//First, sanitize
print '<div id="parttoaddvariant">';
$listofvariantselected = '<div id="parttoaddvariant">';
if (! empty($features)) {
foreach ($features as $feature) {
@ -400,16 +401,14 @@ if (! empty($id) || ! empty($ref))
continue;
}
print '<i>' . $prodattr->label . '</i>:'. $prodattr_val->value . ' ';
$listofvariantselected .= '<i>' . $prodattr->label . '</i>:'. $prodattr_val->value . ' ';
}
}
print '</div>';
print '<br><br>';
$listofvariantselected .= '</div>';
//print dol_fiche_end();
} else {
$title = $langs->trans('EditProductCombination');
}
print load_fiche_titre($title);
if ($action == 'add') {
$prodattr_all = $prodattr->fetchAll();
@ -499,6 +498,10 @@ if (! empty($id) || ! empty($ref))
<?php
}
print '<br>';
print load_fiche_titre($title);
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="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 dol_fiche_head();
print dol_fiche_head();
?>
?>
<table class="border" style="width: 100%">
<?php if ($action == 'add') { ?>
@ -524,6 +527,7 @@ if (! empty($id) || ! empty($ref))
print '<option value="-1">&nbsp;</option>';
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 '</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")); ?>">
</td>
</tr>
<tr><td></td><td>
<?php echo $listofvariantselected; ?>
</td>
</tr>
</table>
<?php
}
@ -781,8 +789,8 @@ if (! empty($id) || ! empty($ref))
</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>'; ?>
<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, 0) ?></td>
<td class="center"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
<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>