[*] BO : you can now affect a zone to multiple countries and to multiple states
This commit is contained in:
@@ -996,3 +996,15 @@ if (Tools::isSubmit('ajaxUpdateTaxRule'))
|
||||
die(Tools::jsonEncode($output));
|
||||
}
|
||||
|
||||
if (Tools::isSubmit('getZones'))
|
||||
{
|
||||
$zones = Zone::getZones();
|
||||
$html = '<select id="zone_to_affect" name="zone_to_affect">';
|
||||
foreach ($zones as $z)
|
||||
{
|
||||
$html .= '<option value="'.$z['id_zone'].'">'.$z['name'].'</option>';
|
||||
}
|
||||
$html .= '</select>';
|
||||
$array = array('hasError' => false, 'errors' => '', 'data' => $html);
|
||||
die(Tools::jsonEncode($html));
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
{*
|
||||
* 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: 9432 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
</table>
|
||||
{if $bulk_actions}
|
||||
<p>
|
||||
{if $bulk_actions|count > 1}
|
||||
<select id="select_submitBulk" name="select_submitBulk">
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
<option value="{$key}">{$params.text}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="submit" class="button" name="submitBulk" id="submitBulk" value="{l s='Apply'}" />
|
||||
{else}
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
{if $key == 'affectzone'}
|
||||
<select id="zone_to_affect" name="zone_to_affect">
|
||||
{foreach $zones as $z}
|
||||
<option value="{$z['id_zone']}">{$z['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
<input type="submit" class="button" name="submitBulk{$key}{$table}" value="{$params.text}" {if isset($params.confirm)}onclick="return confirm('{$params.confirm}');"{/if} />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="token" value="{$token}" />
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
var confirmation = new Array();
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
{if isset($params.confirm)}
|
||||
confirmation['{$key}{$table}'] = "{$params.confirm}";
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
$(document).ready(function(){
|
||||
{if $bulk_actions|count > 1}
|
||||
$('#submitBulk').click(function(){
|
||||
if (confirmation[$(this).val()])
|
||||
return confirm(confirmation[$(this).val()]);
|
||||
else
|
||||
return true;
|
||||
});
|
||||
$('#select_submitBulk').change(function(){
|
||||
if ($(this).val() == 'affectzone')
|
||||
loadZones();
|
||||
else if (loaded)
|
||||
$('#zone_to_affect').fadeOut('slow');
|
||||
});
|
||||
{/if}
|
||||
});
|
||||
var loaded = false;
|
||||
function loadZones()
|
||||
{
|
||||
if (!loaded)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php',
|
||||
data: 'getZones=true&token={$token}',
|
||||
async : true,
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var html = $(data);
|
||||
html.hide();
|
||||
$('#select_submitBulk').after(html);
|
||||
html.fadeIn('slow');
|
||||
}
|
||||
});
|
||||
loaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#zone_to_affect').fadeIn('slow');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,107 @@
|
||||
{*
|
||||
* 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: 9432 $
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
</table>
|
||||
{if $bulk_actions}
|
||||
<p>
|
||||
{if $bulk_actions|count > 1}
|
||||
<select id="select_submitBulk" name="select_submitBulk">
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
<option value="{$key}">{$params.text}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="submit" class="button" name="submitBulk" id="submitBulk" value="{l s='Apply'}" />
|
||||
{else}
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
{if $key == 'affectzone'}
|
||||
<select id="zone_to_affect" name="zone_to_affect">
|
||||
{foreach $zones as $z}
|
||||
<option value="{$z['id_zone']}">{$z['name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
{/if}
|
||||
<input type="submit" class="button" name="submitBulk{$key}{$table}" value="{$params.text}" {if isset($params.confirm)}onclick="return confirm('{$params.confirm}');"{/if} />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="token" value="{$token}" />
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
var confirmation = new Array();
|
||||
{foreach $bulk_actions as $key => $params}
|
||||
{if isset($params.confirm)}
|
||||
confirmation['{$key}{$table}'] = "{$params.confirm}";
|
||||
{/if}
|
||||
{/foreach}
|
||||
|
||||
$(document).ready(function(){
|
||||
{if $bulk_actions|count > 1}
|
||||
$('#submitBulk').click(function(){
|
||||
if (confirmation[$(this).val()])
|
||||
return confirm(confirmation[$(this).val()]);
|
||||
else
|
||||
return true;
|
||||
});
|
||||
$('#select_submitBulk').change(function(){
|
||||
if ($(this).val() == 'affectzone')
|
||||
loadZones();
|
||||
else if (loaded)
|
||||
$('#zone_to_affect').fadeOut('slow');
|
||||
});
|
||||
{/if}
|
||||
});
|
||||
var loaded = false;
|
||||
function loadZones()
|
||||
{
|
||||
if (!loaded)
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php',
|
||||
data: 'getZones=true&token={$token}',
|
||||
async : true,
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var html = $(data);
|
||||
html.hide();
|
||||
$('#select_submitBulk').after(html);
|
||||
html.fadeIn('slow');
|
||||
}
|
||||
});
|
||||
loaded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#zone_to_affect').fadeIn('slow');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -263,6 +263,7 @@ class AdminControllerCore extends Controller
|
||||
25 => $this->l('Images successfully moved'),
|
||||
26 => $this->l('Cover selection saved'),
|
||||
27 => $this->l('Image shop association modified'),
|
||||
28 => $this->l('Zone affected to the selection successfully'),
|
||||
);
|
||||
if (!$this->identifier) $this->identifier = 'id_'.$this->table;
|
||||
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier;
|
||||
@@ -324,6 +325,7 @@ class AdminControllerCore extends Controller
|
||||
/**
|
||||
* Check rights to view the current tab
|
||||
*
|
||||
* @param bool $disable
|
||||
* @return boolean
|
||||
*/
|
||||
public function viewAccess($disable = false)
|
||||
@@ -1808,6 +1810,12 @@ class AdminControllerCore extends Controller
|
||||
$this->boxes = Tools::getValue($this->table.'Box');
|
||||
break;
|
||||
}
|
||||
else if(Tools::isSubmit('submitBulk'))
|
||||
{
|
||||
$this->action = 'bulk'.Tools::getValue('select_submitBulk');
|
||||
$this->boxes = Tools::getValue($this->table.'Box');
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!empty($this->options) && empty($this->fieldsDisplay))
|
||||
$this->display = 'options';
|
||||
@@ -2524,6 +2532,23 @@ EOF;
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function processBulkaffectzone($token)
|
||||
{
|
||||
if (is_array($this->boxes) && !empty($this->boxes))
|
||||
{
|
||||
$object = new $this->className();
|
||||
$result = $object->affectZoneToSelection(Tools::getValue($this->table.'Box'), Tools::getValue('zone_to_affect'));
|
||||
|
||||
if ($result)
|
||||
$this->redirect_after = self::$currentIndex.'&conf=28&token='.$token;
|
||||
$this->_errors[] = Tools::displayError('An error occurred while affecting a zone to the selection.');
|
||||
}
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to affect a new zone.');
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO delete method after AdminProducts cleanup
|
||||
* Display flags in forms for translations
|
||||
|
||||
@@ -336,4 +336,18 @@ class CountryCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'country`
|
||||
WHERE `id_country` = '.(int)$id_country);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids_countries
|
||||
* @param $id_zone
|
||||
* @return bool
|
||||
*/
|
||||
public function affectZoneToSelection($ids_countries, $id_zone)
|
||||
{
|
||||
// cast every array values to int (security)
|
||||
$ids_countries = array_map('intval', $ids_countries);
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'country` SET `id_zone` = '.(int)$id_zone.' WHERE `id_country` IN ('.implode(',', $ids_countries).')
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,6 +591,7 @@ class HelperListCore extends Helper
|
||||
'shop_link_type' => $this->shopLinkType,
|
||||
'has_actions' => !empty($this->actions),
|
||||
'has_bulk_actions' => !empty($this->bulk_actions),
|
||||
'bulk_actions' => $this->bulk_actions,
|
||||
'table_id' => isset($table_id) ? $table_id : null,
|
||||
'table_dnd' => isset($table_dnd) ? $table_dnd : null,
|
||||
'name' => isset($name) ? $name : null,
|
||||
|
||||
@@ -200,5 +200,19 @@ class StateCore extends ObjectModel
|
||||
FROM `'._DB_PREFIX_.'state`
|
||||
WHERE `id_state` = '.(int)($id_state));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids_states
|
||||
* @param $id_zone
|
||||
* @return bool
|
||||
*/
|
||||
public function affectZoneToSelection($ids_states, $id_zone)
|
||||
{
|
||||
// cast every array values to int (security)
|
||||
$ids_states = array_map('intval', $ids_states);
|
||||
return Db::getInstance()->execute('
|
||||
UPDATE `'._DB_PREFIX_.'state` SET `id_zone` = '.(int)$id_zone.' WHERE `id_state` IN ('.implode(',', $ids_states).')
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,12 @@ class AdminCountriesControllerCore extends AdminController
|
||||
|
||||
$this->context = Context::getContext();
|
||||
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
$this->bulk_actions = array('delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?')),
|
||||
'affectzone' => array(
|
||||
'text' => $this->l('Affect a new zone'))
|
||||
);
|
||||
|
||||
$this->fieldImageSettings = array(
|
||||
'name' => 'logo',
|
||||
@@ -127,6 +132,7 @@ class AdminCountriesControllerCore extends AdminController
|
||||
$this->_select = 'z.`name` AS zone';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
|
||||
|
||||
$this->tpl_list_vars['zones'] = Zone::getZones();
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,12 @@ class AdminStatesControllerCore extends AdminController
|
||||
if (!Tools::getValue('realedit'))
|
||||
$this->deleted = false;
|
||||
|
||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||
$this->bulk_actions = array('delete' => array(
|
||||
'text' => $this->l('Delete selected'),
|
||||
'confirm' => $this->l('Delete selected items?')),
|
||||
'affectzone' => array(
|
||||
'text' => $this->l('Affect a new zone'))
|
||||
);
|
||||
|
||||
$this->fieldsDisplay = array(
|
||||
'id_state' => array(
|
||||
@@ -84,6 +89,7 @@ class AdminStatesControllerCore extends AdminController
|
||||
$this->_select = 'z.`name` AS zone';
|
||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = a.`id_zone`)';
|
||||
|
||||
$this->tpl_list_vars['zones'] = Zone::getZones();
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ $_LANG['authentication_39916f579f264041641c122e68e545d5'] = 'Vous devez enregist
|
||||
$_LANG['authentication_fe66abce284ec8589e7d791185b5c442'] = 'Téléphone domicile';
|
||||
$_LANG['authentication_41c2fff4867cc204120f001e7af20f7a'] = 'Téléphone portable';
|
||||
$_LANG['authentication_6c1c4d5a22e3d6ed8385e7287233396f'] = 'Donnez un titre à cette adresse pour la retrouver plus facilement';
|
||||
$_LANG['authentication_0557fa923dcee4d0f86b1409f5c2167f'] = 'Retour';
|
||||
$_LANG['authentication_0ba7583639a274c434bbe6ef797115a4'] = 'S\'inscrire';
|
||||
$_LANG['best-sales_3cb29f0ccc5fd220a97df89dafe46290'] = 'Meilleures ventes';
|
||||
$_LANG['best-sales_32af07c9205de16855c50c3d20a51698'] = 'Pas de meilleure vente pour le moment.';
|
||||
@@ -163,6 +164,7 @@ $_LANG['errors_cb5e100e5a9a3e7f6d1fd97512215282'] = 'erreur';
|
||||
$_LANG['errors_0557fa923dcee4d0f86b1409f5c2167f'] = 'Retour';
|
||||
$_LANG['guest-tracking_77cd9fa27c50288413e2ead667fdda84'] = 'Suivez votre commande';
|
||||
$_LANG['guest-tracking_b5a4f215d9c7e8fbc20532f1e7e03e9e'] = 'Créez votre compte client';
|
||||
$_LANG['guest-tracking_c2f0859d6f7e84914b60403fa423e9ad'] = 'Votre compte invité a bien été transformé en compte client. Vous pouvez maintenant vous identifier';
|
||||
$_LANG['guest-tracking_71860c77c6745379b0d44304d66b6a13'] = 'page';
|
||||
$_LANG['guest-tracking_109636f722b8fccc95d072b2760a6282'] = 'Transformez votre compte invité en compte client et profitez de :';
|
||||
$_LANG['guest-tracking_7661b3dd0ed101708b4c5ba8948ef03d'] = 'Un accès personnel sécurisé';
|
||||
@@ -284,12 +286,8 @@ $_LANG['order-carrier_674bb1e64d73fb88b873caf79ba06128'] = '(lire)';
|
||||
$_LANG['order-carrier_e085dcd05d73bdd5afe338e5b6e42a18'] = 'Choisissez votre mode de livraison';
|
||||
$_LANG['order-carrier_c8c4080207cd4f02548c8cb6285bd16b'] = 'Aucun transporteur nécessaire pour cette commande';
|
||||
$_LANG['order-carrier_0fce1189b263c211a8239fb0e9df004d'] = 'J\'accepte de recevoir ma commande dans un emballage recyclé';
|
||||
$_LANG['order-carrier_8f90815af11493295587f91f571c2f95'] = 'Il n\'y a pas de transporteur disponible qui délivre à cette adresse.';
|
||||
$_LANG['order-carrier_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
|
||||
$_LANG['order-carrier_a82be0f551b8708bc08eb33cd9ded0cf'] = 'Informations';
|
||||
$_LANG['order-carrier_3601146c4e948c32b6424d2c0a7f0118'] = 'Prix';
|
||||
$_LANG['order-carrier_21034ae6d01a83e702839a72ba8a77b0'] = 'HT';
|
||||
$_LANG['order-carrier_1f87346a16cf80c372065de3c54c86d9'] = 'TTC';
|
||||
$_LANG['order-carrier_21034ae6d01a83e702839a72ba8a77b0'] = 'HT';
|
||||
$_LANG['order-carrier_0d9175fe89fb80d815e7d03698b6e83a'] = 'Cadeau';
|
||||
$_LANG['order-carrier_ea3bd794dfeb4537c194ee43899516ed'] = 'Je souhaite que ma commande soit emballée dans un papier-cadeau.';
|
||||
$_LANG['order-carrier_5c2dfd55fea1f5c6adef500fcb6403b4'] = 'Supp. de';
|
||||
@@ -336,6 +334,10 @@ $_LANG['order-detail_d8ea8f57bff2e29a27f3821ae74968bd'] = 'télécharger ce prod
|
||||
$_LANG['order-detail_aec9b5b1c2f91ccdef8e25f5f1dac86a'] = 'Télécharger le produit';
|
||||
$_LANG['order-detail_f8f5730f2ee46b88120ff192190fb7cd'] = 'Bons de réduction :';
|
||||
$_LANG['order-detail_336d5ebc5436534e61d16e63ddfca327'] = '-';
|
||||
$_LANG['order-detail_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
|
||||
$_LANG['order-detail_8c489d0946f66d17d73f26366a4bf620'] = 'Poids';
|
||||
$_LANG['order-detail_552a0d8c17d95d5dbdc0c28217024f5a'] = 'Frais d\'envoi';
|
||||
$_LANG['order-detail_5068c162a60b5859f973f701333f45c5'] = 'Numéro de suivi';
|
||||
$_LANG['order-detail_3956298bcfc047e15b0e0d218492ce09'] = 'Retour de marchandise';
|
||||
$_LANG['order-detail_ac8f8f0de7595f3e4e813e3a1065a061'] = 'Si vous désirez nous retourner un ou plusieurs produits, merci de cocher chacun d\'entre eux et de spécifier un motif de retour, puis de valider.';
|
||||
$_LANG['order-detail_f70389e39824fbcf34c2382a1ba9a458'] = 'Générer un retour';
|
||||
@@ -557,6 +559,8 @@ $_LANG['product_a134618182b99ff9151d7e0b6b92410a'] = '(ne sera pas compris dans
|
||||
$_LANG['product_fe3838c7c11aa406dd956566e17360d5'] = 'par';
|
||||
$_LANG['product_ea23e12cae068315b351f8d36d432d76'] = 'Référence :';
|
||||
$_LANG['product_2c59ffd0a6631127450d729861975719'] = 'Quantité :';
|
||||
$_LANG['product_a6bff806eca0f27ddc2118218517e690'] = 'Vous devez ajouter';
|
||||
$_LANG['product_c21bcb13b1b623890223d6498e650078'] = 'comme quantité minimale pour acheter ce produit.';
|
||||
$_LANG['product_8c751c4aab0db0b811cdfbddf0b4ea56'] = 'Disponibilité :';
|
||||
$_LANG['product_100f1a22cb79da8d72ce3379a4e834ed'] = 'Produit disponible le: ';
|
||||
$_LANG['product_4b98be16b76b0941840140f2043432a9'] = 'pièce disponible';
|
||||
@@ -659,8 +663,6 @@ $_LANG['shopping-cart_bcc7582c9a66be8187578997794a9c1f'] = 'Code :';
|
||||
$_LANG['shopping-cart_f7b96335c6a33477579e43f3da368507'] = 'Profitez de nos offres :';
|
||||
$_LANG['shopping-cart_af0f5bdc5be121b9307687aeeae38c17'] = 'Adresse de livraison';
|
||||
$_LANG['shopping-cart_601d8c4b9f72fc1862013c19b677a499'] = 'Adresse de facturation';
|
||||
$_LANG['shopping-cart_f8617a92ba0a0a4eabee724eab7c9f48'] = 'Transporteur :';
|
||||
$_LANG['shopping-cart_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur';
|
||||
$_LANG['shopping-cart_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Suivant';
|
||||
$_LANG['shopping-cart_300225ee958b6350abc51805dab83c24'] = 'Continuer mes achats';
|
||||
$_LANG['sitemap_5813ce0ec7196c492c97596718f71969'] = 'Plan du site';
|
||||
|
||||
Reference in New Issue
Block a user