variant on services

This commit is contained in:
Frédéric FRANCE 2018-04-24 11:01:17 +02:00
parent 271e50ccf4
commit 5f4e2dc565
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3 changed files with 12 additions and 11 deletions

View File

@ -97,7 +97,7 @@ function product_prepare_head($object)
$head[$h][2] = 'referers';
$h++;
if (!empty($conf->variants->enabled) && $object->isProduct()) {
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
global $db;

View File

@ -1771,7 +1771,7 @@ else
}
//Parent product.
if (!empty($conf->variants->enabled) && $object->isProduct()) {
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
$combination = new ProductCombination($db);

View File

@ -71,7 +71,7 @@ if ($cancel) {
unset($_SESSION['addvariant_'.$object->id]);
}
if (! $object->isProduct()) {
if (! $object->isProduct() && ! $object->isService()) {
header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2));
exit();
}
@ -523,12 +523,13 @@ if (! empty($id) || ! empty($ref))
<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><input type="text" id="weight_impact" name="weight_impact" value="<?php echo price($weight_impact) ?>"></td>
</tr>
</table>
<?php
<?php if ($object->isProduct()) {
print '<tr>';
print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>';
print '<td><input type="text" id="weight_impact" name="weight_impact" value="'.price($weight_impact).'"></td>';
print '</tr>';
}
print '</table>';
}
print dol_fiche_end();
@ -678,7 +679,7 @@ if (! empty($id) || ! empty($ref))
<td class="liste_titre"><?php echo $langs->trans('Product') ?></td>
<td class="liste_titre"><?php echo $langs->trans('Combination') ?></td>
<td class="liste_titre right"><?php echo $langs->trans('PriceImpact') ?></td>
<td class="liste_titre right"><?php echo $langs->trans('WeightImpact') ?></td>
<?php if ($object->isProduct()) print'<td class="liste_titre right">'.$langs->trans('WeightImpact').'</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"></td>
@ -714,7 +715,7 @@ if (! empty($id) || ! empty($ref))
} ?>
</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>
<?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 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">