From 12e13e275faa01256a532c963fd37df5438edadd Mon Sep 17 00:00:00 2001
From: Damien Metzger
Date: Fri, 14 Jun 2013 11:20:23 +0200
Subject: [PATCH 1/3] [-] BO : fixed ajax in permissions tab #PSCFV-7442
---
.../controllers/access/helpers/form/form.tpl | 13 +++----
controllers/admin/AdminAccessController.php | 39 +++++++++----------
controllers/admin/AdminTrackingController.php | 2 -
3 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl
index 532b87e80..72beec990 100644
--- a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl
+++ b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl
@@ -49,8 +49,10 @@
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
{
- checked = enabled ? 'checked': '';
- $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked);
+ if (enabled)
+ $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', 'checked');
+ else
+ $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').removeAttr('checked');
$.ajax({
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
cache: false,
@@ -68,15 +70,12 @@
},
success : function(res,textStatus,jqXHR)
{
- try
- {
+ try {
if (res == 'ok')
showSuccessMessage("{l s='Update successful'}");
else
showErrorMessage("{l s='Update error'}");
- }
- catch(e)
- {
+ } catch(e) {
jAlert('Technical error');
}
}
diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php
index 9f636c25b..543a3b5d2 100644
--- a/controllers/admin/AdminAccessController.php
+++ b/controllers/admin/AdminAccessController.php
@@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
}
- if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
- $sql = '
+ if ($id_tab == -1)
+ {
+ if ($perm == 'all')
+ $sql = '
UPDATE `'._DB_PREFIX_.'access` a
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
WHERE `id_profile` = '.(int)$id_profile;
- else if ($id_tab == -1 && $perm == 'all')
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
- WHERE `id_profile` = '.(int)$id_profile;
- else if ($id_tab == -1)
- $sql = '
+ else
+ $sql = '
UPDATE `'._DB_PREFIX_.'access` a
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
WHERE `id_profile` = '.(int)$id_profile;
- else if ($perm == 'all')
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- '.$join.'
- SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
- WHERE '.$where.' = '.(int)$id_tab.'
- AND `id_profile` = '.(int)$id_profile;
+ }
else
- $sql = '
- UPDATE `'._DB_PREFIX_.'access` a
- '.$join.'
+ {
+ if ($perm == 'all')
+ $sql = '
+ UPDATE `'._DB_PREFIX_.'access` a '.$join.'
+ SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
+ WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
+ else
+ $sql = '
+ UPDATE `'._DB_PREFIX_.'access` a '.$join.'
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
- WHERE '.$where.' = '.(int)$id_tab.'
- AND `id_profile` = '.(int)$id_profile;
+ WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
+ }
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php
index 8ba7265a4..4510d998c 100644
--- a/controllers/admin/AdminTrackingController.php
+++ b/controllers/admin/AdminTrackingController.php
@@ -154,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
-
-
return $this->renderList();
}
From 909a459e5da0fce898d10a9854d6ebef4aca38c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Gaillard?=
Date: Fri, 14 Jun 2013 11:49:04 +0200
Subject: [PATCH 2/3] // miss ;
---
classes/pdf/HTMLTemplateOrderSlip.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/classes/pdf/HTMLTemplateOrderSlip.php b/classes/pdf/HTMLTemplateOrderSlip.php
index 70f395b75..95d9b9f1f 100644
--- a/classes/pdf/HTMLTemplateOrderSlip.php
+++ b/classes/pdf/HTMLTemplateOrderSlip.php
@@ -212,7 +212,7 @@ class HTMLTemplateOrderSlipCore extends HTMLTemplateInvoice
foreach ($tmp_tax_infos as $rate => &$row)
{
if (!isset($ecotax[$rate]))
- continue
+ continue;
$row['total_price_tax_excl'] -= $ecotax[$rate]['ecotax_tax_excl'];
$row['total_amount'] -= ($ecotax[$rate]['ecotax_tax_incl'] - $ecotax[$rate]['ecotax_tax_excl']);
}
From eae2a16442321aa7a043d5b9c704dab205df4699 Mon Sep 17 00:00:00 2001
From: Damien Metzger
Date: Fri, 14 Jun 2013 11:56:33 +0200
Subject: [PATCH 3/3] // Removed button hide in contact form (create issues
with the back button in the browser for example)
---
themes/default/contact-form.tpl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/themes/default/contact-form.tpl b/themes/default/contact-form.tpl
index 6e11d401e..dcd5d252f 100644
--- a/themes/default/contact-form.tpl
+++ b/themes/default/contact-form.tpl
@@ -125,7 +125,7 @@
-
+