[-] BO : FixBug #PSCFV-9859 Carriers free shipping inline edit

This commit is contained in:
jeromenadaud committed 2013-08-01 15:14:14 +02:00
1 parent 48067e1a3d
commit 550aa01faf
1 file changed
+16 -5
+16 -5
View File
@@ -87,11 +87,7 @@ class AdminCarriersControllerCore extends AdminController
'is_free' => array( 'is_free' => array(
'title' => $this->l('Free Shipping'), 'title' => $this->l('Free Shipping'),
'align' => 'center', 'align' => 'center',
'icon' => array( 'active' => 'isFree',
0 => 'disabled.gif',
1 => 'enabled.gif',
'default' => 'disabled.gif'
),
'type' => 'bool', 'type' => 'bool',
'orderby' => false, 'orderby' => false,
'width' => 150 'width' => 150
@@ -534,6 +530,10 @@ class AdminCarriersControllerCore extends AdminController
else else
$this->errors[] = Tools::displayError('You do not have permission to edit this.'); $this->errors[] = Tools::displayError('You do not have permission to edit this.');
} }
else if (isset($_GET['isFree'.$this->table]))
{
$this->processIsFree();
}
else else
{ {
if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox'))) if ((Tools::isSubmit('submitDel'.$this->table) && in_array(Configuration::get('PS_CARRIER_DEFAULT'), Tools::getValue('carrierBox')))
@@ -566,6 +566,17 @@ class AdminCarriersControllerCore extends AdminController
} }
} }
public function processIsFree()
{
$carrier = new Carrier($this->id_object);
if (!Validate::isLoadedObject($carrier))
$this->errors[] = Tools::displayError('An error occurred while updating carrier information.');
$carrier->is_free = $carrier->is_free ? 0 : 1;
if (!$carrier->update())
$this->errors[] = Tools::displayError('An error occurred while updating carrier information.');
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token);
}
/** /**
* Overload the property $fields_value * Overload the property $fields_value
* *