[*] BO #PSFV-94 : Added AdminStatusesController
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9853 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminOrdersStates extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'order_state';
|
||||
$this->className = 'OrderState';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->delete = true;
|
||||
$this->colorOnBackground = true;
|
||||
|
||||
$this->fieldImageSettings = array('name' => 'icon', 'dir' => 'os');
|
||||
$this->imageType = 'gif';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_order_state' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 130),
|
||||
'logo' => array('title' => $this->l('Icon'), 'align' => 'center', 'image' => 'os', 'orderby' => false, 'search' => false),
|
||||
'send_email' => array('title' => $this->l('Send e-mail to customer'), 'align' => 'center', 'icon' => array('1' => 'enabled.gif', '0' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false),
|
||||
'invoice' => array('title' => $this->l('Invoice'), 'align' => 'center', 'icon' => array('1' => 'enabled.gif', '0' => 'disabled.gif'), 'type' => 'bool', 'orderby' => false),
|
||||
'template' => array('title' => $this->l('E-mail template'), 'width' => 100));
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
$this->context = Context::getContext();
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
$_POST['invoice'] = Tools::getValue('invoice');
|
||||
$_POST['logable'] = Tools::getValue('logable');
|
||||
$_POST['send_email'] = Tools::getValue('send_email');
|
||||
$_POST['hidden'] = Tools::getValue('hidden');
|
||||
$_POST['shipped'] = Tools::getValue('shipped');
|
||||
if (!$_POST['send_email'])
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages AS $language)
|
||||
$_POST['template_'.$language['id_lang']] = '';
|
||||
}
|
||||
parent::postProcess();
|
||||
}
|
||||
elseif (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
$orderState = new OrderState($_GET['id_order_state'], $this->context->language->id);
|
||||
if (!$orderState->isRemovable())
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
elseif (isset($_POST['submitDelorder_state']))
|
||||
{
|
||||
foreach ($_POST[$this->table.'Box'] AS $selection)
|
||||
{
|
||||
$orderState = new OrderState($selection, $this->context->language->id);
|
||||
if (!$orderState->isRemovable())
|
||||
{
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($this->_errors))
|
||||
parent::postProcess();
|
||||
}
|
||||
else
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
private function getTemplates($iso_code)
|
||||
{
|
||||
$array = array();
|
||||
if (!file_exists(_PS_ADMIN_DIR_.'/../mails/'.$iso_code))
|
||||
return false;
|
||||
$templates = scandir(_PS_ADMIN_DIR_.'/../mails/'.$iso_code);
|
||||
foreach ($templates AS $template)
|
||||
if (!strncmp(strrev($template), 'lmth.', 5))
|
||||
$array[] = substr($template, 0, -5);
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '<script type="text/javascript" src="../js/jquery/jquery-colorpicker.js"></script>
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/time.gif" />'.$this->l('Order statuses').'</legend>
|
||||
<label>'.$this->l('Status name:').' </label>
|
||||
<div class="margin-form">';
|
||||
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="40" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" style="width: 150px;" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters: numbers and').' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤template', 'name');
|
||||
|
||||
echo ' <p class="clear">'.$this->l('Order status (e.g., \'Pending\')').'</p>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Icon:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="file" name="icon" />
|
||||
<p>'.$this->l('Upload an icon from your computer (File type: .gif, suggested size: 16x16)').'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Color:').' </label>
|
||||
<div class="margin-form">
|
||||
<input width="20px" type="color" data-hex="true" class="color mColorPickerInput" name="color" value="'.htmlentities($this->getFieldValue($obj, 'color'), ENT_COMPAT, 'UTF-8').'" />
|
||||
<p>'.$this->l('Status will be highlighted in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" style="vertical-align: text-bottom;" name="logable"'.(($this->getFieldValue($obj, 'logable') == 1) ? ' checked="checked"' : '').' id="logable_on" value="1" />
|
||||
<label class="t" for="logable_on"> '.$this->l('Consider the associated order as validated').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" style="vertical-align: text-bottom;" name="invoice"'.(($this->getFieldValue($obj, 'invoice') == 1) ? ' checked="checked"' : '').' id="invoice_on" value="1" />
|
||||
<label class="t" for="invoice_on"> '.$this->l('Allow customer to download and view PDF version of invoice').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" style="vertical-align: text-bottom;" name="hidden"'.(($this->getFieldValue($obj, 'hidden') == 1) ? ' checked="checked"' : '').' id="hidden_on" value="1" />
|
||||
<label class="t" for="hidden_on"> '.$this->l('Hide this state in order for customer').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" style="vertical-align: text-bottom;" id="send_email" name="send_email" onclick="$(\'#tpl\').slideToggle();"'.
|
||||
(($this->getFieldValue($obj, 'send_email')) ? 'checked="checked"' : '').' value="1" />
|
||||
<label class="t" for="send_email"> '.$this->l('Send e-mail to customer when order is changed to this status').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<p>
|
||||
<input type="checkbox" style="vertical-align: text-bottom;" name="shipped"'.(($this->getFieldValue($obj, 'shipped') == 1) ? ' checked="checked"' : '').' id="shipped_on" value="1" />
|
||||
<label class="t" for="shipped_on"> '.$this->l('Set order as shipped').'</label>
|
||||
</p>
|
||||
</div>
|
||||
<div id="tpl" style="display: '.($this->getFieldValue($obj, 'send_email') ? 'block' : 'none').';">
|
||||
<label>'.$this->l('Template').'</label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
{
|
||||
$templates = $this->getTemplates($language['iso_code']);
|
||||
echo ' <div id="template_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">';
|
||||
if (!$templates)
|
||||
echo '<strong>'.$this->l('Please first copy your e-mail templates in the directory').' mails/'.$language['iso_code'].'.</strong>';
|
||||
else
|
||||
{
|
||||
echo ' <select name="template_'.$language['id_lang'].'" id="template_select_'.$language['id_lang'].'">';
|
||||
foreach ($templates AS $template)
|
||||
echo ' <option value="'.$template.'" '.(($this->getFieldValue($obj, 'template', (int)($language['id_lang'])) == $template) ? 'selected="selected"' : '').'>'.$template.'</option>';
|
||||
echo ' </select>';
|
||||
}
|
||||
echo ' <span class="hint" name="help_box">'.$this->l('Only letters, number and -_ are allowed').'<span class="hint-pointer"> </span></span>
|
||||
<img onclick="viewTemplates(\'template_select_'.$language['id_lang'].'\', '.$language['id_lang'].', \'../mails/'.$language['iso_code'].'/\', \'.html\');" src="../img/t/AdminFeatures.gif" class="pointer" alt="'.$this->l('Preview').'" title="'.$this->l('Preview').'" />
|
||||
</div>';
|
||||
}
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name¤template', 'template');
|
||||
echo '<p style="clear: both">'.$this->l('E-mail template for both .html and .txt').'</p>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">if (getE(\'send_email\').checked) getE(\'tpl\').style.display = \'block\'; else getE(\'tpl\').style.display = \'none\';</script>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminReturnStates extends AdminTab
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'order_return_state';
|
||||
$this->className = 'OrderReturnState';
|
||||
$this->lang = true;
|
||||
$this->edit = true;
|
||||
$this->noAdd = true;
|
||||
$this->delete = false;
|
||||
$this->colorOnBackground = true;
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_order_return_state' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||
'name' => array('title' => $this->l('Name'), 'width' => 130)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
{
|
||||
parent::displayForm();
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
echo '
|
||||
<form action="'.self::$currentIndex.'&submitAdd'.$this->table.'=1&token='.$this->token.'" method="post" enctype="multipart/form-data">
|
||||
'.($obj->id ? '<input type="hidden" name="id_'.$this->table.'" value="'.$obj->id.'" />' : '').'
|
||||
<fieldset><legend><img src="../img/admin/time.gif" />'.$this->l('Order statuses').'</legend>
|
||||
<label>'.$this->l('Status name:').' </label>
|
||||
<div class="margin-form">';
|
||||
foreach ($this->_languages as $language)
|
||||
echo '
|
||||
<div id="name_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input size="40" type="text" name="name_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'name', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" /><sup> *</sup>
|
||||
<span class="hint" name="help_box">'.$this->l('Invalid characters: numbers and').' !<>,;?=+()@#"�{}_$%:<span class="hint-pointer"> </span></span>
|
||||
</div>';
|
||||
$this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'name', 'name');
|
||||
echo ' <p style="clear: both">'.$this->l('Order return status name').'</p>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
<div class="small"><sup>*</sup> '.$this->l('Required field').'</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 6844 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
include(_PS_ADMIN_DIR_.'/tabs/AdminOrdersStates.php');
|
||||
include(_PS_ADMIN_DIR_.'/tabs/AdminReturnStates.php');
|
||||
|
||||
class AdminStatuses extends AdminTab
|
||||
{
|
||||
private $adminOrdersStates;
|
||||
private $adminReturnStates;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = array('order_state', 'order_return_state');
|
||||
$this->adminOrdersStates = new adminOrdersStates();
|
||||
$this->adminReturnStates = new adminReturnStates();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function viewAccess($disable = false)
|
||||
{
|
||||
$result = parent::viewAccess($disable);
|
||||
$this->adminOrdersStates->tabAccess = $this->tabAccess;
|
||||
$this->adminReturnStates->tabAccess = $this->tabAccess;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
$this->adminOrdersStates->token = $this->token;
|
||||
$this->adminReturnStates->token = $this->token;
|
||||
|
||||
$this->adminOrdersStates->postProcess($this->token);
|
||||
$this->adminReturnStates->postProcess($this->token);
|
||||
}
|
||||
|
||||
public function displayErrors()
|
||||
{
|
||||
$this->adminOrdersStates->displayErrors($this->token);
|
||||
$this->adminReturnStates->displayErrors($this->token);
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state'))
|
||||
{
|
||||
echo '<h2>'.$this->l('Order statuses').'</h2>';
|
||||
$this->adminOrdersStates->display($this->token);
|
||||
}
|
||||
if (!Tools::isSubmit('updateorder_state') AND !Tools::isSubmit('submitAddupdateorder_state') AND !Tools::isSubmit('addorder_state'))
|
||||
{
|
||||
if (!Tools::isSubmit('updateorder_return_state') AND !Tools::isSubmit('submitAddorder_return_state'))
|
||||
echo '<div style="margin:10px"> </div>';
|
||||
echo '<h2>'.$this->l('Order return statuses').'</h2>';
|
||||
$this->adminReturnStates->display($this->token);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,9 @@
|
||||
<div id="contains_states" {if $contains_states}style="display:none;"{/if}>
|
||||
{/if}
|
||||
{block name="label"}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
{/block}
|
||||
{if $input.type == 'hidden'}
|
||||
<input type="hidden" name="{$input.name}" value="{$fields_value[$input.name]}" />
|
||||
@@ -171,7 +171,7 @@
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
{/if}
|
||||
{elseif $input.type == 'radio'}
|
||||
{foreach $input.values as $value}
|
||||
@@ -208,7 +208,11 @@
|
||||
{elseif $input.type == 'checkbox'}
|
||||
{foreach $input.values.query as $value}
|
||||
{assign var=id_checkbox value=$input.name|cat:'_'|cat:$value[$input.values.id]}
|
||||
<input type="checkbox" name="{$id_checkbox}" id="{$id_checkbox}" {if $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<input type="checkbox"
|
||||
name="{$id_checkbox}"
|
||||
id="{$id_checkbox}"
|
||||
{if isset($value.val)}value="{$value.val}"{/if}
|
||||
{if isset($fields_value[$id_checkbox]) && $fields_value[$id_checkbox]}checked="checked"{/if} />
|
||||
<label for="{$id_checkbox}" class="t"><strong>{$value[$input.values.name]}</strong></label><br />
|
||||
{/foreach}
|
||||
{elseif $input.type == 'file'}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
{/if}
|
||||
<thead>
|
||||
<tr class="nodrag nodrop">
|
||||
<th>
|
||||
<th class="center">
|
||||
{if $has_bulk_actions}
|
||||
<input type="checkbox" name="checkme" class="noborder" onclick="checkDelBoxes(this.form, '{$table}Box[]', this.checked)" />
|
||||
{/if}
|
||||
@@ -144,7 +144,7 @@
|
||||
</th>
|
||||
{/if}
|
||||
{if $has_actions}
|
||||
<th>{l s='Actions'}</th>
|
||||
<th class="center">{l s='Actions'}</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8971 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{extends file="../helper/form/form.tpl"}
|
||||
|
||||
{block name="label"}
|
||||
{if $input.type == "select_template"}
|
||||
<div id="tpl" style="display:{if isset($fields_value.send_email) && $fields_value.send_email}block{else}none{/if}">
|
||||
{/if}
|
||||
{if isset($input.label)}
|
||||
<label>{$input.label} </label>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="start_field_block"}
|
||||
<div class="margin-form">
|
||||
{if $input.type == "select_template"}
|
||||
<div class="translatable">
|
||||
{foreach $languages as $language}
|
||||
<div class="lang_{$language.id_lang}" id="{$input.name}_{$language.id_lang}" style="display:{if $language.id_lang == $defaultFormLanguage}block{else}none{/if}; float: left;">
|
||||
<select name="{$input.name}_{$language.id_lang}"
|
||||
id="{$input.name}_select_{$language.id_lang}"
|
||||
{if isset($input.multiple)}multiple="multiple" {/if}
|
||||
{if isset($input.size)}size="{$input.size}"{/if}
|
||||
{if isset($input.onchange)}onchange="{$input.onchange}"{/if}>
|
||||
{foreach $input.options.query AS $option}
|
||||
<option value="{$option[$input.options.id]}"
|
||||
{if isset($input.multiple)}
|
||||
{foreach $fields_value[$input.name] as $field_value}
|
||||
{if $field_value == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/foreach}
|
||||
{else}
|
||||
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}
|
||||
{/if}
|
||||
>{$option[$input.options.name]|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{if isset($input.hint)}<span class="hint" name="help_box">{$input.hint}<span class="hint-pointer"> </span></span>{/if}
|
||||
<img onclick="viewTemplates('#template_select_{$language.id_lang}', '../mails/{$language.iso_code}/', '.html');"
|
||||
src="../img/t/AdminFeatures.gif" class="pointer" alt="{l s='Preview'}" title="{l s='Preview'}" />
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="end_field_block"}
|
||||
</div>
|
||||
{if $input.type == "select_template"}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block name="script"}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#send_email_on').click(function() {
|
||||
$('#tpl').slideToggle();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
@@ -0,0 +1,27 @@
|
||||
{*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9197 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<a href="{$href}">
|
||||
<img src="../img/admin/edit.gif" alt="{$action}" title="{$action}" /></a>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -28,27 +28,26 @@
|
||||
class OrderReturnStateCore extends ObjectModel
|
||||
{
|
||||
/** @var string Name */
|
||||
public $name;
|
||||
|
||||
public $name;
|
||||
|
||||
/** @var string Display state in the specified color */
|
||||
public $color;
|
||||
|
||||
|
||||
protected $fieldsValidate = array('color' => 'isColor');
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 64);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||
|
||||
protected $table = 'order_return_state';
|
||||
protected $identifier = 'id_order_return_state';
|
||||
|
||||
public $color;
|
||||
|
||||
protected $fieldsValidate = array('color' => 'isColor');
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 64);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName');
|
||||
|
||||
protected $table = 'order_return_state';
|
||||
protected $identifier = 'id_order_return_state';
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['color'] = pSQL($this->color);
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check then return multilingual fields for database interaction
|
||||
*
|
||||
@@ -59,7 +58,7 @@ class OrderReturnStateCore extends ObjectModel
|
||||
$this->validateFieldsLang();
|
||||
return $this->getTranslationsFields(array('name'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all available order states
|
||||
*
|
||||
@@ -74,7 +73,5 @@ class OrderReturnStateCore extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_return_state_lang` orsl ON (ors.`id_order_return_state` = orsl.`id_order_return_state` AND orsl.`id_lang` = '.(int)($id_lang).')
|
||||
ORDER BY ors.`id_order_return_state` ASC');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
+32
-25
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -29,41 +29,48 @@ class OrderStateCore extends ObjectModel
|
||||
{
|
||||
/** @var string Name */
|
||||
public $name;
|
||||
|
||||
/** @var string Template name if there is any e-mail to send */
|
||||
|
||||
/** @var string Template name if there is any e-mail to send */
|
||||
public $template;
|
||||
|
||||
|
||||
/** @var boolean Send an e-mail to customer ? */
|
||||
public $send_email;
|
||||
|
||||
|
||||
/** @var boolean Allow customer to view and download invoice when order is at this state */
|
||||
public $invoice;
|
||||
|
||||
|
||||
/** @var string Display state in the specified color */
|
||||
public $color;
|
||||
|
||||
|
||||
public $unremovable;
|
||||
|
||||
/** @var boolean Log authorization */
|
||||
public $logable;
|
||||
|
||||
|
||||
/** @var boolean Delivery */
|
||||
public $delivery;
|
||||
|
||||
/** @var boolean Hidden */
|
||||
public $hidden;
|
||||
|
||||
|
||||
/** @var boolean Shipped */
|
||||
public $shipped;
|
||||
|
||||
protected $fieldsValidate = array('send_email' => 'isBool', 'invoice' => 'isBool', 'color' => 'isColor', 'logable' => 'isBool', 'shipped' => 'isBool');
|
||||
protected $fieldsValidate = array(
|
||||
'send_email' => 'isBool',
|
||||
'invoice' => 'isBool',
|
||||
'color' => 'isColor',
|
||||
'logable' => 'isBool',
|
||||
'shipped' => 'isBool'
|
||||
);
|
||||
|
||||
protected $fieldsRequiredLang = array('name');
|
||||
protected $fieldsSizeLang = array('name' => 64, 'template' => 64);
|
||||
protected $fieldsValidateLang = array('name' => 'isGenericName', 'template' => 'isTplName');
|
||||
|
||||
|
||||
protected $table = 'order_state';
|
||||
protected $identifier = 'id_order_state';
|
||||
|
||||
|
||||
protected $webserviceParameters = array(
|
||||
'fields' => array(
|
||||
'unremovable' => array(),
|
||||
@@ -71,21 +78,21 @@ class OrderStateCore extends ObjectModel
|
||||
'hidden' => array(),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
public function getFields()
|
||||
{
|
||||
$this->validateFields();
|
||||
$fields['send_email'] = (int)($this->send_email);
|
||||
$fields['invoice'] = (int)($this->invoice);
|
||||
$fields['send_email'] = (int)$this->send_email;
|
||||
$fields['invoice'] = (int)$this->invoice;
|
||||
$fields['color'] = pSQL($this->color);
|
||||
$fields['unremovable'] = (int)($this->unremovable);
|
||||
$fields['logable'] = (int)($this->logable);
|
||||
$fields['delivery'] = (int)($this->delivery);
|
||||
$fields['hidden'] = (int)($this->hidden);
|
||||
$fields['shipped'] = (int)($this->shipped);
|
||||
$fields['unremovable'] = (int)$this->unremovable;
|
||||
$fields['logable'] = (int)$this->logable;
|
||||
$fields['delivery'] = (int)$this->delivery;
|
||||
$fields['hidden'] = (int)$this->hidden;
|
||||
$fields['shipped'] = (int)$this->shipped;
|
||||
return $fields;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check then return multilingual fields for database interaction
|
||||
*
|
||||
@@ -96,7 +103,7 @@ class OrderStateCore extends ObjectModel
|
||||
$this->validateFieldsLang();
|
||||
return $this->getTranslationsFields(array('name', 'template'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all available order states
|
||||
*
|
||||
@@ -108,7 +115,7 @@ class OrderStateCore extends ObjectModel
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'order_state` os
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$id_lang.')
|
||||
ORDER BY `name` ASC');
|
||||
}
|
||||
|
||||
@@ -123,10 +130,10 @@ class OrderStateCore extends ObjectModel
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `invoice` AS ok
|
||||
FROM `'._DB_PREFIX_.'order_state`
|
||||
WHERE `id_order_state` = '.(int)($id_order_state));
|
||||
WHERE `id_order_state` = '.(int)$id_order_state);
|
||||
return $result['ok'];
|
||||
}
|
||||
|
||||
|
||||
public function isRemovable()
|
||||
{
|
||||
return !($this->unremovable);
|
||||
|
||||
@@ -0,0 +1,491 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8971 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
class AdminStatusesControllerCore extends AdminController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->table = 'order_state';
|
||||
$this->className = 'OrderState';
|
||||
$this->lang = true;
|
||||
$this->deleted = false;
|
||||
$this->colorOnBackground = true;
|
||||
$this->imageType = 'gif';
|
||||
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'icon',
|
||||
'dir' => 'os'
|
||||
);
|
||||
|
||||
$this->requiredDatabase = true;
|
||||
|
||||
$this->context = Context::getContext();
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'icon',
|
||||
'dir' => 'os'
|
||||
);
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_order_state' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 25
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'width' => 130
|
||||
),
|
||||
'logo' => array(
|
||||
'title' => $this->l('Icon'),
|
||||
'align' => 'center',
|
||||
'image' => 'os',
|
||||
'orderby' => false,
|
||||
'search' => false
|
||||
),
|
||||
'send_email' => array(
|
||||
'title' => $this->l('Send e-mail to customer'),
|
||||
'align' => 'center',
|
||||
'icon' => array(
|
||||
'1' => 'enabled.gif',
|
||||
'0' => 'disabled.gif'
|
||||
),
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
),
|
||||
'invoice' => array(
|
||||
'title' => $this->l('Invoice'),
|
||||
'align' => 'center',
|
||||
'icon' => array(
|
||||
'1' => 'enabled.gif',
|
||||
'0' => 'disabled.gif'
|
||||
),
|
||||
'type' => 'bool',
|
||||
'orderby' => false
|
||||
),
|
||||
'template' => array(
|
||||
'title' => $this->l('E-mail template'),
|
||||
'width' => 100
|
||||
)
|
||||
);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function initList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
|
||||
$list_orders_status = parent::initList();
|
||||
|
||||
// Added new list
|
||||
|
||||
// reset actions and query vars
|
||||
$this->actions = array();
|
||||
unset($this->fieldsDisplay, $this->_select, $this->_join, $this->_group, $this->_filterHaving, $this->_filter, $this->identifier);
|
||||
|
||||
$this->table = 'order_return_state';
|
||||
$this->_defaultOrderBy = $this->identifier = 'id_order_return_state';
|
||||
$this->deleted = false;
|
||||
$this->toolbar_btn = array();
|
||||
$this->bulk_actions = array();
|
||||
|
||||
$this->addRowAction('editstatus');
|
||||
|
||||
// test if a filter is applied for this list
|
||||
if (Tools::isSubmit('submitFilter'.$this->table) || $this->context->cookie->{'submitFilter'.$this->table} !== false)
|
||||
$this->filter = true;
|
||||
|
||||
// test if a filter reset request is required for this list
|
||||
if (isset($_POST['submitReset'.$this->table]))
|
||||
$this->action = 'reset_filters';
|
||||
else
|
||||
$this->action = '';
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_order_return_state' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'center',
|
||||
'width' => 25
|
||||
),
|
||||
'name' => array(
|
||||
'title' => $this->l('Name'),
|
||||
'align' => 'center',
|
||||
'width' => 200
|
||||
)
|
||||
);
|
||||
|
||||
// call postProcess() for take care about actions and filters
|
||||
$this->postProcess();
|
||||
|
||||
$list_orders_returns_status = parent::initList();
|
||||
|
||||
return $list_orders_status.$list_orders_returns_status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display editaddresses action link
|
||||
* @param string $token the token to add to the link
|
||||
* @param int $id the identifier to add to the link
|
||||
* @return string
|
||||
*/
|
||||
public function displayEditaddressesLink($token = null, $id)
|
||||
{
|
||||
if (!array_key_exists('editaddresses', self::$cache_lang))
|
||||
self::$cache_lang['editaddresses'] = $this->l('Edit Adresses');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex.
|
||||
'&'.$this->identifier.'='.$id.
|
||||
'&editaddresses&token='.($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['editaddresses'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/manufacturers/list_action_edit_adresses.tpl');
|
||||
}
|
||||
|
||||
public function initForm()
|
||||
{
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
'title' => $this->l('Order statuses'),
|
||||
'image' => '../img/admin/time.gif'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Status name:'),
|
||||
'name' => 'name',
|
||||
'lang' => true,
|
||||
'attributeLang' => 'name¤template',
|
||||
'size' => 40,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters: numbers and').' !<>,;?=+()@#"�{}_$%:',
|
||||
'p' => $this->l('Order status (e.g., \'Pending\')')
|
||||
),
|
||||
array(
|
||||
'type' => 'file',
|
||||
'label' => $this->l('Icon:'),
|
||||
'name' => 'icon',
|
||||
'p' => $this->l('Upload an icon from your computer (File type: .gif, suggested size: 16x16)')
|
||||
),
|
||||
array(
|
||||
'type' => 'color',
|
||||
'label' => $this->l('Color:'),
|
||||
'name' => 'color',
|
||||
'size' => 30,
|
||||
'p' => $this->l('Status will be highlighted in this color. HTML colors only (e.g.,').' "lightblue", "#CC6600")'
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'logable',
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'on',
|
||||
'name' => $this->l('Consider the associated order as validated'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'invoice',
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'on',
|
||||
'name' => $this->l('Allow customer to download and view PDF version of invoice'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'hidden',
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'on',
|
||||
'name' => $this->l('Hide this state in order for customer'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'send_email',
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'on',
|
||||
'name' => $this->l('Send e-mail to customer when order is changed to this status'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'shipped',
|
||||
'values' => array(
|
||||
'query' => array(
|
||||
array(
|
||||
'id' => 'on',
|
||||
'name' => $this->l('Set order as shipped'),
|
||||
'val' => '1'
|
||||
),
|
||||
),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'type' => 'select_template',
|
||||
'label' => $this->l('Template:'),
|
||||
'name' => 'template',
|
||||
'lang' => true,
|
||||
'attributeLang' => 'name¤template',
|
||||
'options' => array(
|
||||
'query' => $this->getTemplates($this->context->language->iso_code),
|
||||
'id' => 'id',
|
||||
'name' => 'name'
|
||||
),
|
||||
'hint' => $this->l('Only letters, number and -_ are allowed'),
|
||||
'p' => $this->l('E-mail template for both .html and .txt')
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
if (!($obj = $this->loadObject(true)))
|
||||
return;
|
||||
|
||||
$this->fields_value = array(
|
||||
'logable_on' => $this->getFieldValue($obj, 'logable'),
|
||||
'invoice_on' => $this->getFieldValue($obj, 'invoice'),
|
||||
'hidden_on' => $this->getFieldValue($obj, 'hidden'),
|
||||
'send_email_on' => $this->getFieldValue($obj, 'send_email'),
|
||||
'shipped_on' => $this->getFieldValue($obj, 'shipped')
|
||||
);
|
||||
|
||||
return parent::initForm();
|
||||
}
|
||||
|
||||
public function initFormStatus()
|
||||
{
|
||||
$id_order_return_state = Tools::getValue('id_order_return_state');
|
||||
|
||||
// Create Object OrderReturnState
|
||||
$order_return_state = new OrderReturnState($id_order_return_state);
|
||||
|
||||
$this->fields_form = array(
|
||||
'tinymce' => true,
|
||||
'legend' => array(
|
||||
'title' => $this->l('Order statuses'),
|
||||
'image' => '../img/admin/time.gif'
|
||||
),
|
||||
'input' => array(
|
||||
array(
|
||||
'type' => 'text',
|
||||
'label' => $this->l('Status name:'),
|
||||
'name' => 'name',
|
||||
'lang' => true,
|
||||
'attributeLang' => 'name¤template',
|
||||
'size' => 40,
|
||||
'required' => true,
|
||||
'hint' => $this->l('Invalid characters: numbers and').' !<>,;?=+()@#"�{}_$%:',
|
||||
'p' => $this->l('Order return status name')
|
||||
)
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l(' Save '),
|
||||
'class' => 'button'
|
||||
)
|
||||
);
|
||||
|
||||
$this->getlanguages();
|
||||
$helper = new HelperForm();
|
||||
$helper->currentIndex = self::$currentIndex;
|
||||
$helper->token = $this->token;
|
||||
$helper->table = 'order_return_state';
|
||||
$helper->identifier = 'id_order_return_state';
|
||||
$helper->id = $order_return_state->id;
|
||||
$helper->languages = $this->_languages;
|
||||
$helper->default_form_language = $this->default_form_language;
|
||||
$helper->allow_employee_form_lang = $this->allow_employee_form_lang;
|
||||
$helper->fields_value = $this->getFieldsValue($order_return_state);
|
||||
info($helper->fields_value);
|
||||
$helper->toolbar_btn = $this->toolbar_btn;
|
||||
$this->content .= $helper->generateForm($this->fields_form);
|
||||
}
|
||||
|
||||
private function getTemplates($iso_code)
|
||||
{
|
||||
$array = array();
|
||||
if (!file_exists(_PS_ADMIN_DIR_.'/../mails/'.$iso_code))
|
||||
return false;
|
||||
$templates = scandir(_PS_ADMIN_DIR_.'/../mails/'.$iso_code);
|
||||
foreach ($templates as $key => $template)
|
||||
if (!strncmp(strrev($template), 'lmth.', 5))
|
||||
$array[] = array(
|
||||
'id' => substr($template, 0, -5),
|
||||
'name' => substr($template, 0, -5)
|
||||
);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* AdminController::init() override
|
||||
* @see AdminController::init()
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if (Tools::isSubmit('editstatus'))
|
||||
$this->display = 'editstatus';
|
||||
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
if ($this->display == 'editstatus' || $this->display == 'editstatus')
|
||||
{
|
||||
$this->content .= $this->initFormStatus();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'content' => $this->content
|
||||
));
|
||||
}
|
||||
else
|
||||
return parent::initContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display editaddresses action link
|
||||
* @param string $token the token to add to the link
|
||||
* @param int $id the identifier to add to the link
|
||||
* @return string
|
||||
*/
|
||||
public function displayEditstatusLink($token = null, $id)
|
||||
{
|
||||
if (!array_key_exists('editstatus', self::$cache_lang))
|
||||
self::$cache_lang['editstatus'] = $this->l('Edit Status');
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'href' => self::$currentIndex.
|
||||
'&'.$this->identifier.'='.$id.
|
||||
'&editstatus&token='.($token != null ? $token : $this->token),
|
||||
'action' => self::$cache_lang['editstatus'],
|
||||
));
|
||||
|
||||
return $this->context->smarty->fetch(_PS_ADMIN_DIR_.'/themes/template/statuses/list_action_edit_status.tpl');
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::isSubmit('submitAddorder_return_state'))
|
||||
{
|
||||
$id_order_return_state = (int)Tools::getValue('id_order_return_state');
|
||||
|
||||
// Create Object OrderReturnState
|
||||
$order_return_state = new OrderReturnState($id_order_return_state);
|
||||
|
||||
$order_return_state->name = array();
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $language)
|
||||
$order_return_state->name[$language['id_lang']] = Tools::getValue('name_'.$language['id_lang']);
|
||||
|
||||
// Update object
|
||||
if (!$order_return_state->save())
|
||||
$this->_errors[] = Tools::displayError('An error has occured: Can\'t save the current order return state');
|
||||
else
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('submitAdd'.$this->table))
|
||||
{
|
||||
$_POST['invoice'] = (int)Tools::getValue('invoice_on');
|
||||
$_POST['logable'] = (int)Tools::getValue('logable_on');
|
||||
$_POST['send_email'] = (int)Tools::getValue('send_email_on');
|
||||
$_POST['hidden'] = (int)Tools::getValue('hidden_on');
|
||||
$_POST['shipped'] = (int)Tools::getValue('shipped_on');
|
||||
if (!$_POST['send_email'])
|
||||
{
|
||||
$languages = Language::getLanguages(false);
|
||||
foreach ($languages as $language)
|
||||
$_POST['template_'.$language['id_lang']] = '';
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
else if (isset($_GET['delete'.$this->table]))
|
||||
{
|
||||
$order_state = new OrderState($_GET['id_order_state'], $this->context->language->id);
|
||||
if (!$order_state->isRemovable())
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
else if (isset($_POST['submitDelorder_state']))
|
||||
{
|
||||
foreach ($_POST[$this->table.'Box'] as $selection)
|
||||
{
|
||||
$order_state = new OrderState($selection, $this->context->language->id);
|
||||
if (!$order_state->isRemovable())
|
||||
{
|
||||
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (empty($this->_errors))
|
||||
return parent::postProcess();
|
||||
}
|
||||
else
|
||||
return parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -492,10 +492,9 @@ function openWin(url, title, width, height, top, left)
|
||||
newWin.focus();
|
||||
}
|
||||
|
||||
function viewTemplates(id_select, id_lang, prefix, ext)
|
||||
function viewTemplates(id_select, prefix, ext)
|
||||
{
|
||||
var id_list = document.getElementById(id_select);
|
||||
var loc = id_list.options[id_list.selectedIndex].value;
|
||||
var loc = $(id_select).val();
|
||||
if (loc != 0)
|
||||
openWin (prefix+loc+ext, 'tpl_viewing', '520', '400', '50', '300');
|
||||
return ;
|
||||
|
||||
Reference in New Issue
Block a user