BugFix Issue #8261: Variants module. Combinations cannot be edited

This commit is contained in:
BadPixxel 2018-03-10 14:51:24 +01:00
parent 7b0119aee0
commit 836054a8b3

View File

@ -351,7 +351,7 @@ if (! empty($id) || ! empty($ref))
<script type="text/javascript"> <script type="text/javascript">
variants_available = <?php echo json_encode($prodattr_alljson) ?>; variants_available = <?php echo json_encode($prodattr_alljson); ?>;
variants_selected = { variants_selected = {
index: [], index: [],
info: [] info: []
@ -425,7 +425,10 @@ if (! empty($id) || ! empty($ref))
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";
print '<input type="hidden" name="action" value="create">'."\n"; print '<input type="hidden" name="action" value="' . (($valueid > 0) ? "update" : "create") .'">'."\n";
if($valueid > 0) {
print '<input type="hidden" name="valueid" value="' . $valueid .'">'."\n";
}
print dol_fiche_head(); print dol_fiche_head();
@ -485,7 +488,7 @@ if (! empty($id) || ! empty($ref))
<?php <?php
} }
if (is_array($selectedvariant)) { if (is_array($productCombination2ValuePairs1)) {
?> ?>
<hr> <hr>
<table class="border" style="width: 100%"> <table class="border" style="width: 100%">
@ -494,12 +497,11 @@ if (! empty($id) || ! empty($ref))
<td class="tdtop"> <td class="tdtop">
<div class="inline-block valignmiddle quatrevingtpercent"> <div class="inline-block valignmiddle quatrevingtpercent">
<?php <?php
if (is_array($selectedvariant)) if (is_array($productCombination2ValuePairs1))
{ {
foreach ($selectedvariant as $key => $val) { foreach ($productCombination2ValuePairs1 as $key => $val) {
$tmp = explode(':',$val); $result1 = $prodattr->fetch($val->fk_prod_attr);
$result1 = $prodattr->fetch($tmp[0]); $result2 = $prodattr_val->fetch($val->fk_prod_attr_val);
$result2 = $prodattr_val->fetch($tmp[1]);
if ($result1 > 0 && $result2 > 0) if ($result1 > 0 && $result2 > 0)
{ {
print $prodattr->label . ' - '.$prodattr_val->value.'<br>'; print $prodattr->label . ' - '.$prodattr_val->value.'<br>';
@ -533,7 +535,7 @@ if (! empty($id) || ! empty($ref))
?> ?>
<div style="text-align: center"> <div style="text-align: center">
<input type="submit" name="create" <?php if (! is_array($selectedvariant)) print ' disabled="disabled"'; ?> value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button"> <input type="submit" name="create" <?php if (! is_array($productCombination2ValuePairs1)) print ' disabled="disabled"'; ?> value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button">
&nbsp; &nbsp;
<input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel'); ?>" class="button"> <input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel'); ?>" class="button">
</div> </div>