diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 8c01eea6d99..015733ed95f 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -186,7 +186,7 @@ - + diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php index b6bfb90e22c..3e89df4e587 100644 --- a/htdocs/variants/admin/admin.php +++ b/htdocs/variants/admin/admin.php @@ -35,11 +35,11 @@ if ($_POST) { setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); } - if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { - setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); - } else { - setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); - } + if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); + } else { + setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); + } } $title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes'); diff --git a/htdocs/variants/ajax/getCombinations.php b/htdocs/variants/ajax/getCombinations.php index 6f028f5aa8b..38affc574d2 100644 --- a/htdocs/variants/ajax/getCombinations.php +++ b/htdocs/variants/ajax/getCombinations.php @@ -31,18 +31,18 @@ header('Content-Type: application/json'); $id = GETPOST('id', 'int'); if (!$id) { -print json_encode(array( - 'error' => 'ID not set' - )); - exit(); + print json_encode(array( + 'error' => 'ID not set' + )); + exit(); } $product = new Product($db); if ($product->fetch($id) < 0) { -print json_encode(array( - 'error' => 'Product not found' - )); + print json_encode(array( + 'error' => 'Product not found' + )); } $prodcomb = new ProductCombination($db); diff --git a/htdocs/variants/ajax/get_attribute_values.php b/htdocs/variants/ajax/get_attribute_values.php index 0d72b16c5ed..866bac1ef78 100644 --- a/htdocs/variants/ajax/get_attribute_values.php +++ b/htdocs/variants/ajax/get_attribute_values.php @@ -31,19 +31,19 @@ header('Content-Type: application/json'); $id = GETPOST('id'); if (!$id) { -print json_encode(array( - 'error' => 'ID not set' - )); - exit(); + print json_encode(array( + 'error' => 'ID not set' + )); + exit(); } $prodattr = new ProductAttribute($db); if ($prodattr->fetch($id) < 0) { -print json_encode(array( - 'error' => 'Attribute not found' - )); - exit(); + print json_encode(array( + 'error' => 'Attribute not found' + )); + exit(); } $prodattrval = new ProductAttributeValue($db); @@ -51,10 +51,10 @@ $prodattrval = new ProductAttributeValue($db); $res = $prodattrval->fetchAllByProductAttribute($id); if ($res == -1) { -print json_encode(array( - 'error' => 'Internal error' - )); - exit(); + print json_encode(array( + 'error' => 'Internal error' + )); + exit(); } print json_encode($res); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index e425aa16c5d..5847aa259b4 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -144,58 +144,54 @@ if ($action == 'edit') { } -if ($action != 'edit') -{ +if ($action != 'edit') { print '
'; print '
'; } -?> - - - - - - - - - +print '
trans('Ref') ?> - ref.'">'; - } else { - print dol_htmlentities($object->ref); - } ?> -
trans('Label') ?> - label.'">'; - } else { - print dol_htmlentities($object->label); - } ?> -
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; -
'.$langs->trans('Ref').''; +if ($action == 'edit') { + print ''; +} else { + print dol_htmlentities($object->ref); +} +print '
'.$langs->trans('Label').''; +if ($action == 'edit') { + print ''; +} else { + print dol_htmlentities($object->label); +} +print '
+print ''; -'; } dol_fiche_end(); -if ($action == 'edit') { ?> -
-
- -     - -
-
-'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + print '
'; +} else { if ($action == 'delete') { $form = new Form($db); -print $form->formconfirm( + print $form->formconfirm( "card.php?id=".$object->id, $langs->trans('Delete'), $langs->trans('ProductAttributeDeleteDialog'), @@ -208,7 +204,7 @@ print $form->formconfirm( if ($objectval->fetch($valueid) > 0) { $form = new Form($db); -print $form->formconfirm( + print $form->formconfirm( "card.php?id=".$object->id."&valueid=".$objectval->id, $langs->trans('Delete'), $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($objectval->value), dol_htmlentities($objectval->ref)), @@ -241,20 +237,19 @@ print $form->formconfirm( print ''; print ''; print ''; - } ?> + } - - - - - - + print '
trans('Ref') ?>trans('Value') ?>
'; + print ''; + print ''; + print ''; + print ''; + print ''; - fetchAllByProductAttribute($object->id) as $attrval) { - ?> - - id)): ?> + foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval) { + print ''; + if ($action == 'edit_value' && ($valueid == $attrval->id)) { + ?> - + - - - -
'.$langs->trans('Ref').''.$langs->trans('Value').'
@@ -262,31 +257,30 @@ print $form->formconfirm(     ref) ?> value) ?>
+ print ''; + } + print ''; - - - + if ($action == 'edit_value') { + print ''; + } -
- -
- - '; + print '
'; + print ''.$langs->trans('Create').''; + print '
'; + print ''; } // End of page diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php index db0d49a0e36..21346d6124e 100644 --- a/htdocs/variants/class/ProductCombination.class.php +++ b/htdocs/variants/class/ProductCombination.class.php @@ -572,9 +572,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1"; } if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { - $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; + $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; } else { - $newproduct->ref .= '_'.$prodattrval->ref; + $newproduct->ref .= '_'.$prodattrval->ref; } //The first one should not contain a linebreak diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index e5f1d17b8aa..a87959e76fb 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -425,7 +425,7 @@ if (! empty($id) || ! empty($ref)) fetch($pc2v->fk_prod_attr_val); - ?> + ?> variants_selected.index.push(fk_prod_attr ?>); variants_selected.info[fk_prod_attr ?>] = { attribute: variants_available[fk_prod_attr ?>], @@ -434,7 +434,7 @@ if (! empty($id) || ! empty($ref)) label: 'value ?>' } }; - @@ -484,7 +484,7 @@ if (! empty($id) || ! empty($ref)) }); - '; @@ -495,40 +495,36 @@ if (! empty($id) || ! empty($ref)) print ''; print ''."\n"; print ''."\n"; - if($valueid > 0) { + if ($valueid > 0) { print ''."\n"; } print dol_fiche_head(); - ?> - - - - - - '; + print '
- '; - print ''; - foreach ($prodattr_all as $attr) - { - //print ''; - print ''; - } - print ''; + print ''; + if ($action == 'add') { + print "\n"; + print ''; + print ''; + print ' @@ -555,15 +551,14 @@ if (! empty($id) || ! empty($ref)) - -
'; + if (is_array($prodattr_all)) { + print ''; + } - $htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes")); - print $form->textwithpicto('', $htmltext); - /*print '     id).'">'; - print $langs->trans("Create"); - print '';*/ + $htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes")); + print $form->textwithpicto('', $htmltext); + /*print '     id).'">'; + print $langs->trans("Create"); + print '';*/ - ?> + ?>
- -
- '; + print '
'; + } if (is_array($productCombination2ValuePairs1)) { - ?> + ?>
@@ -597,7 +592,7 @@ if (! empty($id) || ! empty($ref)) -isProduct()) { print ''; print ''; @@ -644,7 +639,7 @@ if (! empty($id) || ! empty($ref)) if ($productCombinations) { - ?> + ?>
>