diff --git a/ChangeLog.md b/ChangeLog.md index bbe7b64..3b88f6b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog +## 4.1.62.0 +- Ajout d'une option sur le parametrage des "attributs" de produit pour definir l'affichage de celui-ci sur WooCommerce +- Correction de la page "A propos" + ## 4.1.61.0 - Ajout d'un champ dans la liste des factures pour afficher le delta entre le total TTC et le total HT plus total TVA - Ajout d'un script pour corriger les factures en recreant les lignes de celles-ci (et modifie le prix des lignes existantes de la commande liƩ, ne creer pas les nouvelle lignes manquantes) diff --git a/VERSION b/VERSION index 9ae0c12..6b1b7f6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.1.61 \ No newline at end of file +4.1.62 \ No newline at end of file diff --git a/admin/about.php b/admin/about.php index 7862e81..b9b3c8e 100644 --- a/admin/about.php +++ b/admin/about.php @@ -34,7 +34,35 @@ $langs->load("ecommerce@ecommerceng"); $langs->load("opendsi@ecommerceng"); -if (!$user->admin) accessforbidden(); +if (!$user->admin && !$user->rights->ecommerceng->site) accessforbidden(); + +$id = GETPOST('id', 'int'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'aZ09'); + +$object = new eCommerceSite($db); +if (empty($action) && !($id > 0) && strlen($id) == 0) { + $sites = $object->listSites(); + if (!empty($sites)) { + $id = array_values($sites)[0]['id']; + } +} +if ($id > 0) { + $result = $object->fetch($id); + if ($result < 0) { + accessforbidden($object->errorsToString()); + } elseif ($result == 0) { + $langs->load('errors'); + accessforbidden($langs->trans('ErrorRecordNotFound')); + } +} + +/** + * Actions + */ +$error = 0; + +include dol_buildpath('/ecommerceng/admin/actions_selectsite.inc.php'); /** @@ -46,12 +74,13 @@ $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ECommerceSetup"),$linkback,'title_setup'); -print "
\n"; + +include dol_buildpath('/ecommerceng/admin/tpl/selectsite.tpl.php'); $head=ecommercengConfigSitePrepareHead($object); print dol_get_fiche_head($head, 'about', $langs->trans("Module107100Name"), 0, 'opendsi@ecommerceng'); - +print '
'; $modClass = new modECommerceNg($db); $ECommerceNgVersion = !empty($modClass->getVersion()) ? $modClass->getVersion() : 'NC'; diff --git a/admin/actions_extrafields.inc.php b/admin/actions_extrafields.inc.php index 20c0edc..f1b604b 100644 --- a/admin/actions_extrafields.inc.php +++ b/admin/actions_extrafields.inc.php @@ -35,6 +35,7 @@ $activated_list = array(); $value_list = array(); + $show_list = array(); foreach ($extra_fields_list[$table_element]['extra_fields'] as $key => $label) { // default value $activated = GETPOST("ef_dft_state_{$table_element}_{$key}", 'int') ? 1 : 0; @@ -56,9 +57,13 @@ $value = $activated ? GETPOST("ef_att_value_{$table_element}_{$key}", 'alphanohtml') : (!empty($object->parameters['extra_fields'][$table_element]['values']['att'][$key]) ? $object->parameters['extra_fields'][$table_element]['values']['att'][$key] : null); if (isset($value)) $value_list['att'][$key] = $value; + $show = $activated ? GETPOST("ef_att_show_{$table_element}_{$key}", 'alphanohtml') : + (!empty($object->parameters['extra_fields'][$table_element]['show']['att'][$key]) ? $object->parameters['extra_fields'][$table_element]['show']['att'][$key] : null); + if (isset($show)) $show_list['att'][$key] = $show; } $object->parameters['extra_fields'][$table_element]['activated'] = $activated_list; $object->parameters['extra_fields'][$table_element]['values'] = $value_list; + $object->parameters['extra_fields'][$table_element]['show'] = $show_list; $result = $object->update($user); diff --git a/admin/tpl/extrafields.tpl.php b/admin/tpl/extrafields.tpl.php index 637b03a..aefa0a6 100644 --- a/admin/tpl/extrafields.tpl.php +++ b/admin/tpl/extrafields.tpl.php @@ -75,6 +75,7 @@ $activated_info = $object->parameters['extra_fields'][$table_element]['activated']; $values_info = $object->parameters['extra_fields'][$table_element]['values']; + $show_info = $object->parameters['extra_fields'][$table_element]['show']; foreach ($info['extra_fields'] as $key => $label) { if (!empty($extrafields->attributes[$table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$table_element]['langfile'][$key]); @@ -83,6 +84,7 @@ if (!empty($info['default'])) { $not_supported = in_array($extrafields->attributes[$table_element]['type'][$key], [ 'date', 'datetime' ]); + $target_class = 'ef_dft_' . $table_element . '_' . $key; $default_value = ''; if (isset($extrafields->attributes[$table_element]['default'][$key])) $default_value = $extrafields->attributes[$table_element]['default'][$key]; $value = isset($values_info['dft'][$key]) ? $values_info['dft'][$key] : $default_value; @@ -92,33 +94,37 @@ print $langs->trans('NotSupported'); } else { // print $extrafields->showInputField($key, $value, ($activated ? '' : ' disabled'), '', 'ef_dft_value_' . $table_element . '_', '', 0, $table_element); - print ''; + print ''; } print '' . "\n"; print '' . "\n"; if (!$not_supported) { - print '' . "\n"; + print '' . "\n"; } print ''; } if (!empty($info['metadata'])) { + $target_class = 'ef_mdt_' . $table_element . '_' . $key; $value = isset($values_info['mdt'][$key]) ? $values_info['mdt'][$key] : $key; $activated = !empty($activated_info['mdt'][$key]); print '' . "\n"; - print ''; + print ''; print '' . "\n"; print '' . "\n"; - print '' . "\n"; + print '' . "\n"; print ''; } if (!empty($info['attributes'])) { + $target_class = 'ef_att_' . $table_element . '_' . $key; $value = isset($values_info['att'][$key]) ? $values_info['att'][$key] : (isset($remote_attributes_label[$label]) ? $remote_attributes_label[$label] : $key); + $show = isset($show_info['att'][$key]) ? $show_info['att'][$key] : 0; $activated = !empty($activated_info['att'][$key]); print '' . "\n"; - print $form->selectarray('ef_att_value_' . $table_element . '_' . $key, $info['attributes'], $value, 1, 0, 0, '', 0, 0, $activated ? 0 : 1, '', 'minwidth300'); + print $form->selectarray('ef_att_value_' . $table_element . '_' . $key, $info['attributes'], $value, 1, 0, 0, '', 0, 0, $activated ? 0 : 1, '', 'minwidth300 ' . $target_class); + print $form->selectarray('ef_att_show_' . $table_element . '_' . $key, [ 1 => $langs->trans('Show'), 2 => $langs->trans('Hide') ], $show, 0, 0, 0, '', 0, 0, $activated ? 0 : 1, '', 'minwidth100 ' . $target_class); print '' . "\n"; print '' . "\n"; - print '' . "\n"; + print '' . "\n"; print ''; } print '' . "\n"; diff --git a/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php b/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php index 9151ca7..bba0c9f 100755 --- a/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php +++ b/class/data/woocommerce/eCommerceRemoteAccessWoocommerce.class.php @@ -3181,8 +3181,9 @@ public function convertObjectIntoProductData($remote_id, $object) // Synch extrafields <=> attributes if (!empty($this->site->parameters['extra_fields']['product']['activated']['att'][$cr_key])) { $data_key = $this->site->parameters['extra_fields']['product']['values']['att'][$cr_key]; + $show_attr = $this->site->parameters['extra_fields']['product']['show']['att'][$cr_key]; if (!empty($data_key)) { - $variationData['attributes'][] = array('id' => $data_key, 'options' => !empty($value) ? explode(',', $value) : array()); + $variationData['attributes'][] = array('id' => $data_key, 'visible' => $show_attr != 2, 'options' => !empty($value) ? explode(',', $value) : array()); } } } @@ -3474,8 +3475,9 @@ public function convertObjectIntoProductData($remote_id, $object) // Synch extrafields <=> attributes if (!empty($this->site->parameters['extra_fields']['product']['activated']['att'][$cr_key])) { $data_key = $this->site->parameters['extra_fields']['product']['values']['att'][$cr_key]; + $show_attr = $this->site->parameters['extra_fields']['product']['show']['att'][$cr_key]; if (!empty($data_key)) { - $productData['attributes'][] = array('id' => $data_key, 'options' => !empty($value) ? explode(',', $value) : array()); + $productData['attributes'][] = array('id' => $data_key, 'visible' => $show_attr != 2, 'options' => !empty($value) ? explode(',', $value) : array()); } } } diff --git a/js/form.js b/js/form.js index a0851a1..31c5103 100644 --- a/js/form.js +++ b/js/form.js @@ -19,6 +19,6 @@ jQuery(document).ready(function (){ var target = _this.attr('data-target'); var state = _this.is(':checked'); - jQuery('#'+target).prop('disabled', !state); + jQuery('.'+target).prop('disabled', !state); } }); \ No newline at end of file diff --git a/lib/eCommerce.lib.php b/lib/eCommerce.lib.php index 54d6af7..cd384f1 100644 --- a/lib/eCommerce.lib.php +++ b/lib/eCommerce.lib.php @@ -39,12 +39,6 @@ function ecommercengConfigSitePrepareHead($object) $head[$h][2] = 'settings'; $h++; - $head[$h][0] = dol_buildpath("/ecommerceng/admin/about.php", 1); - $head[$h][1] = $langs->trans("About") . " / " . $langs->trans("Support"); - $head[$h][2] = 'about'; - $h++; - - if ($object->id > 0) { if (!empty($conf->societe->enabled)) { $langs->load('companies'); @@ -90,6 +84,11 @@ function ecommercengConfigSitePrepareHead($object) complete_head_from_modules($conf, $langs, null, $head, $h, 'ecommerceng_config_site', 'remove'); + $head[$h][0] = dol_buildpath("/ecommerceng/admin/about.php", 1); + $head[$h][1] = $langs->trans("About") . " / " . $langs->trans("Support"); + $head[$h][2] = 'about'; + $h++; + return $head; }