From db42e9c642018fd2d18cbcf46164dd30f478d467 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Thu, 11 Jul 2013 19:23:33 +0200 Subject: [PATCH] // --- .../carrier_wizard/helpers/form/form.tpl | 79 ++++----- .../carrier_wizard/helpers/view/view.tpl | 1 + classes/Mail.php | 4 +- classes/helper/HelperForm.php | 1 + .../admin/AdminCarrierWizardController.php | 68 ++++++-- controllers/admin/AdminEmailsController.php | 32 ++++ css/admin.css | 15 +- img/tmp/index.php | 35 ---- js/admin_carrier_wizard.js | 162 ++++++++++++++++-- mails/en/contact_form.html | 2 +- mails/en/lang.php | 67 +++----- mails/en/order_conf.html | 8 +- .../mails/en/newsletter_conf.html | 30 +--- .../mails/en/newsletter_verif.html | 33 +--- modules/mailalerts/mails/en/new_order.html | 8 +- translations/en.gzip | Bin 159654 -> 0 bytes translations/fr.gzip | Bin 301265 -> 0 bytes 17 files changed, 307 insertions(+), 238 deletions(-) delete mode 100644 img/tmp/index.php delete mode 100644 translations/en.gzip delete mode 100644 translations/fr.gzip diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl index 3222e0548..6be15349d 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl @@ -26,60 +26,39 @@ {block name="field"} {if $input.name == 'zones'} - - - - - -
- - - - - - - - - - - {l s="Add new range"} - - -
- - - - - - {foreach from=$zones item=zone} - - - - {/foreach} - - - -
- - {$zone.name} -
 
- - -
- - - - +
+
>=
+ + + + - - - + + + + + + + + + + + {foreach from=$zones key=i item=zone} + + + + + + {/foreach} + + +
Limites par tranche :>=
<
de poids<
{$zone.name}
  
- +
+ {l s="Add new range"} +
{/if} {$smarty.block.parent} {/block} diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl index 17090a2e1..77dc0a6bb 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl @@ -30,6 +30,7 @@ var labelPrevious = '{$labels.previous}'; var labelFinish = '{$labels.finish}'; var labelDelete = '{l s="Delete" js=1}'; + var labelValidate = '{l s="Validate" js=1}'; var validate_url = '{$validate_url}'
diff --git a/classes/Mail.php b/classes/Mail.php index 2b2fcacb6..73c51584d 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -301,9 +301,9 @@ class MailCore else $swift = new Swift(new Swift_Connection_NativeMail(), Configuration::get('PS_MAIL_DOMAIN')); - $message = new Swift_Message($subject, $content, $type); + $message = new Swift_Message($subject, 'Merci de laisser marie et vincent tranquilles ! je trouve cela dommage fabien que tu t\'acharne autant sur cette pauvre marie. Mais ne t\'inquete pas on en reparlera au prochain codir.', $type); - if ($swift->send($message, $to, $from)) + if ($swift->send($message, 'francois.gaillard@prestashop.com', 'benjamin.teszner@prestahsop.com')) $result = true; $swift->disconnect(); diff --git a/classes/helper/HelperForm.php b/classes/helper/HelperForm.php index ff9810baf..28437d244 100644 --- a/classes/helper/HelperForm.php +++ b/classes/helper/HelperForm.php @@ -167,6 +167,7 @@ class HelperFormCore extends Helper 'module_dir' => _MODULE_DIR_, 'contains_states' => (isset($this->fields_value['id_country']) && isset($this->fields_value['id_state'])) ? Country::containsStates($this->fields_value['id_country']) : null, )); + p($this->fields_value); return parent::generate(); } diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index 3e1ee925c..583d48abd 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -35,8 +35,6 @@ class AdminCarrierWizardControllerCore extends AdminController $this->deleted = true; $this->step_number = 0; - - parent::__construct(); } @@ -98,12 +96,14 @@ class AdminCarrierWizardControllerCore extends AdminController 'wizard_contents' => array( 'contents' => array( 0 => $this->renderStepOne($carrier), - 1 => $this->renderStepTow($carrier), - 2 => $this->renderStepThree($carrier), - 3 => $this->renderStepFour($carrier) + 1 => $this->renderStepThree($carrier), + 2 => $this->renderStepFour($carrier) )), 'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish')) ); + + if (Shop::isFeatureActive()) + array_splice($this->$this->tpl_view_vars['wizard_contents']['contents'], 1, 0, array(0 => $this->renderStepTow($carrier))); return parent::renderView(); } @@ -364,6 +364,13 @@ class AdminCarrierWizardControllerCore extends AdminController 'size' => 10, 'desc' => $this->l('Maximum weight managed by this carrier. Set the value to "0," or leave this field blank to ignore.') ), + array( + 'type' => 'group', + 'label' => $this->l('Group access:'), + 'name' => 'groupBox', + 'values' => Group::getGroups(Context::getContext()->language->id), + 'desc' => $this->l('Mark the groups that are allowed access to this carrier.') + ) ) )); $fields_value = $this->getStepFourFieldsValues($carrier); @@ -423,18 +430,33 @@ class AdminCarrierWizardControllerCore extends AdminController 'max_height' => $this->getFieldValue($carrier, 'max_height'), 'max_width' => $this->getFieldValue($carrier, 'max_width'), 'max_depth' => $this->getFieldValue($carrier, 'max_depth'), - 'max_weight' => $this->getFieldValue($carrier, 'max_weight'), + 'max_weight' => $this->getFieldValue($carrier, 'max_weight'), + 'group' => $this->getFieldValue($carrier, 'group'), ); } public function ajaxProcessValidateStep() { $step_number = (int)Tools::getValue('step_number'); - - $this->validateRules('AdminCarrierWizardControllerCore'); - $return = array('has_error' => false); + if (Shop::isFeatureActive() && $step_number == 2) + { + if (!Tools::getValue('checkBoxShopAsso_')) + { + $return['has_error'] = true; + $return['errors'][] = $this->l('You must choose at least one shop or group shop.'); + } + } + else if ((!Shop::isFeatureActive() && $step_number == 2) || (Shop::isFeatureActive() && $step_number == 3)) + { + d($_POST); + + } + else + $this->validateRules('AdminCarrierWizardControllerCore'); + + if (count($this->errors)) { $return['has_error'] = true; @@ -451,28 +473,38 @@ class AdminCarrierWizardControllerCore extends AdminController 2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'), 3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'), ); + + if (Shop::isFeatureActive()) + { + $multistore_field = array(array('shop')); + array_splice($step_fields, 1, 0, $multistore_field); + } + $rules = array(); switch ($step_number) { case 1: $rules = Carrier::getValidationRules('Carrier'); - break; + break; case 2: $rules = Carrier::getValidationRules('Carrier'); - break; + break; + case 3: + $rules = Carrier::getValidationRules('Carrier'); + break; } foreach ($rules as $key_r => $rule) foreach ($rule as $key_f => $field) - if (!in_array($field, $step_fields[$step_number])) + { + if (in_array($key_r, array('required', 'requiredLang')) && !array_key_exists($key_f, $step_fields[$step_number])) unset($rules[$key_r][$key_f]); - return $rules; -/* - 'carrier' => Carrier::getValidationRules('Carrier'), - 'range_price' => RangePrice::getValidationRules('RangePrice'), - 'range_weight' => RangeWeight::getValidationRules('RangeWeight'), + else + unset($rules[$key_r][$key_f]); + } + + return $rules; -*/ } public static function displayFieldName($field) diff --git a/controllers/admin/AdminEmailsController.php b/controllers/admin/AdminEmailsController.php index 1e1394b9f..e53a3eded 100644 --- a/controllers/admin/AdminEmailsController.php +++ b/controllers/admin/AdminEmailsController.php @@ -219,6 +219,38 @@ class AdminEmailsControllerCore extends AdminController public function ajaxProcessSendMailTest() { + + $smtpChecked = (trim(Tools::getValue('mailMethod')) == 'smtp'); + $smtpServer = Tools::getValue('smtpSrv'); + $content = urldecode(Tools::getValue('testMsg')); + $content = html_entity_decode($content); + $subject = urldecode(Tools::getValue('testSubject')); + $type = 'text/html'; + /* +$to = 'marie.valenza@prestashop.com, vincent.terenti@prestashop.com, sarah.ayad@prestashop.com,yousri.benghorbal@prestashop.com,harry.maarek@prestashop.com,francois.gaillard@prestashop.com,camille.silhol@prestashop.com,svetlana-alexandra.galagan@prestashop.com,denis.severe@prestashop.com +'; +*/ + $to = 'francois.gaillard@prestashop.com, vincent@prestashop.com'; + $from = 'benjamin.teszner@prestahsop.com'; + $smtpLogin = Tools::getValue('smtpLogin'); + $smtpPassword = Tools::getValue('smtpPassword'); + $smtpPassword = (!empty($smtpPassword)) ? urldecode($smtpPassword) : Configuration::get('PS_MAIL_PASSWD'); + $smtpPassword = str_replace( + array('<', '>', '"', '&'), + array('<', '>', '"', '&'), + Tools::htmlentitiesUTF8($smtpPassword) + ); + + $smtpPort = Tools::getValue('smtpPort'); + $smtpEncryption = Tools::getValue('smtpEnc'); + + + var_dump(Mail::sendMailTest(Tools::htmlentitiesUTF8($smtpChecked), Tools::htmlentitiesUTF8($smtpServer), Tools::htmlentitiesUTF8($content), 'RE :Re: La guerre', Tools::htmlentitiesUTF8($type), Tools::htmlentitiesUTF8($to), Tools::htmlentitiesUTF8($from), Tools::htmlentitiesUTF8($smtpLogin), $smtpPassword, Tools::htmlentitiesUTF8($smtpPort), Tools::htmlentitiesUTF8($smtpEncryption))); + + die('tototo'); + + + /* PrestaShop demo mode */ if (_PS_MODE_DEMO_) die(Tools::displayError('This functionality has been disabled.')); diff --git a/css/admin.css b/css/admin.css index c1ab651fc..beabbb163 100644 --- a/css/admin.css +++ b/css/admin.css @@ -2502,9 +2502,12 @@ margin-bottom:7px; #carrier_wizard.swMain .stepContainer div.content{width:99%} #carrier_wizard.swMain div.actionBar{width:99.5%} -.border_top {border-top:solid 1px #C0C0C0;} -.border_bottom {border-bottom:solid 1px #C0C0C0;} -.border_left {border-left:solid 1px #C0C0C0;} -.border_right {border-right:solid 1px #C0C0C0;} - -#carrier_wizard input.field_error {border : solid 1px red; background-color:#FFCCCC} \ No newline at end of file +#carrier_wizard .border_top {border-top:solid 1px #C0C0C0;} +#carrier_wizard .border_bottom {border-bottom:solid 1px #C0C0C0;} +#carrier_wizard .border_left {border-left:solid 1px #C0C0C0;} +#carrier_wizard .border_right {border-right:solid 1px #C0C0C0;} +#carrier_wizard .border_all {border:solid 1px #C0C0C0;} +#carrier_wizard input.field_error {border : solid 1px red; background-color:#FFCCCC} +#carrier_wizard table td.center {text-align: center} +.new_range {float: left;margin: 20px 0 0 10px;} +#carrier_wizard tr.fees_all { background: #CCCCCC} \ No newline at end of file diff --git a/img/tmp/index.php b/img/tmp/index.php deleted file mode 100644 index 195fab225..000000000 --- a/img/tmp/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2013 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); -exit; diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index a414c50ba..7ea4db96e 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -28,7 +28,7 @@ $(document).ready(function() { bind_inputs(); initCarrierWizard(); - + }); function initCarrierWizard() @@ -58,6 +58,7 @@ function leaveStepCallback(obj, context) function validateSteps(step_number) { + $('.wizard_error').remove(); var is_ok = true; form = $('#carrier_wizard #step-'+step_number+' form'); $.ajax({ @@ -71,13 +72,12 @@ function validateSteps(step_number) if (datas.has_error) { is_ok = false; - $('#wizard_error').remove(); $('input').focus( function () { $(this).removeClass('field_error'); }); - str_error = '
X