//added bulk action for enable or disable item

This commit is contained in:
vAugagneur
2012-06-04 12:00:09 +00:00
parent 79d7996c65
commit b9e27705df
11 changed files with 147 additions and 37 deletions
+40
View File
@@ -2527,6 +2527,46 @@ class AdminControllerCore extends Controller
else
return false;
}
/**
* Enable multiple items
*
* @return boolean true if succcess
*/
protected function processBulkEnableSelection()
{
return $this->processBulkStatusSelection(1);
}
/**
* Disable multiple items
*
* @return boolean true if succcess
*/
protected function processBulkDisableSelection()
{
return $this->processBulkStatusSelection(0);
}
/**
* Toggle status of multiple items
*
* @return boolean true if succcess
*/
protected function processBulkStatusSelection($status)
{
$result = true;
if (is_array($this->boxes) && !empty($this->boxes))
{
foreach ($this->boxes as $id)
{
$object = new $this->className((int)$id);
$object->active = (int)$status;
$result &= $object->update();
}
}
return $result;
}
protected function processBulkAffectZone()
{
@@ -44,7 +44,11 @@ class AdminCarriersControllerCore 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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->fieldImageSettings = array(
'name' => 'logo',
@@ -39,14 +39,14 @@ class AdminCountriesControllerCore extends AdminController
$this->requiredDatabase = true;
$this->context = Context::getContext();
$this->bulk_actions = array('delete' => array(
'text' => $this->l('Delete selected'),
'confirm' => $this->l('Delete selected items?')),
'affectzone' => array(
'text' => $this->l('Assign to a new zone'))
);
$this->bulk_actions = array(
'delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection')),
'affectzone' => array('text' => $this->l('Assign to a new zone'))
);
$this->fieldImageSettings = array(
'name' => 'logo',
'dir' => 'st'
@@ -51,7 +51,11 @@ class AdminCurrenciesControllerCore extends AdminController
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => 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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->fields_options = array(
'change' => array(
@@ -91,7 +91,11 @@ class AdminLanguagesControllerCore extends AdminController
)
);
$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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->specificConfirmDelete = $this->l('When you delete a language, all related translations in the database will be deleted. Are you sure you want to delete this language?');
parent::__construct();
+8 -8
View File
@@ -41,14 +41,14 @@ 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?')),
'affectzone' => array(
'text' => $this->l('Affect a new zone'))
);
$this->bulk_actions = array(
'delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection')),
'affectzone' => array('text' => $this->l('Affect a new zone'))
);
$this->fields_list = array(
'id_state' => array(
'title' => $this->l('ID'),
+6 -1
View File
@@ -58,7 +58,11 @@ class AdminStoresControllerCore extends AdminController
'active' => array('title' => $this->l('Enabled'), 'width' => 70, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => 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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->fields_options = array(
'general' => array(
@@ -496,6 +500,7 @@ class AdminStoresControllerCore extends AdminController
'type' => 'text'
),
);
return $formFields;
}
@@ -59,7 +59,11 @@ class AdminTaxRulesGroupControllerCore extends AdminController
)
);
$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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
parent::__construct();
}
+51 -11
View File
@@ -34,13 +34,19 @@ class AdminTaxesControllerCore extends AdminController
$this->lang = true;
$this->addRowAction('edit');
$this->addRowAction('delete');
$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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->fields_list = array(
'id_tax' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'rate' => array('title' => $this->l('Rate'), 'align' => 'center', 'suffix' => '%', 'width' => 50),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
'id_tax' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 'auto'),
'rate' => array('title' => $this->l('Rate'), 'align' => 'center', 'suffix' => '%', 'width' => 50),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
);
$ecotax_desc = '';
if (Configuration::get('PS_USE_ECOTAX'))
@@ -50,18 +56,52 @@ class AdminTaxesControllerCore extends AdminController
'general' => array(
'title' => $this->l('Tax options'),
'fields' => array(
'PS_TAX' => array('title' => $this->l('Enable tax:'), 'desc' => $this->l('Select whether or not to include tax on purchases'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_DISPLAY' => array('title' => $this->l('Display tax in cart:'), 'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'), 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_ADDRESS_TYPE' => array('title' => $this->l('Base on:'), 'cast' => 'pSQL', 'type' => 'select', 'list' => array(array('name' => $this->l('Invoice Address'), 'id' => 'id_address_invoice'), array('name' => $this->l('Delivery Address'), 'id' => 'id_address_delivery')), 'identifier' => 'id'),
'PS_USE_ECOTAX' => array('title' => $this->l('Use ecotax'), 'desc' => $ecotax_desc, 'validation' => 'isBool', 'cast' => 'intval', 'type' => 'bool'),
'PS_TAX' => array(
'title' => $this->l('Enable tax:'),
'desc' => $this->l('Select whether or not to include tax on purchases'),
'cast' => 'intval', 'type' => 'bool'),
'PS_TAX_DISPLAY' => array(
'title' => $this->l('Display tax in cart:'),
'desc' => $this->l('Select whether or not to display tax on a distinct line in the cart'),
'cast' => 'intval',
'type' => 'bool'),
'PS_TAX_ADDRESS_TYPE' => array(
'title' => $this->l('Base on:'),
'cast' => 'pSQL',
'type' => 'select',
'list' => array(
array(
'name' => $this->l('Invoice Address'),
'id' => 'id_address_invoice'
),
array(
'name' => $this->l('Delivery Address'),
'id' => 'id_address_delivery')
),
'identifier' => 'id'
),
'PS_USE_ECOTAX' => array(
'title' => $this->l('Use ecotax'),
'desc' => $ecotax_desc,
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
),
'submit' => array()
),
);
if (Configuration::get('PS_USE_ECOTAX'))
$this->fields_options['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array('title' => $this->l('Ecotax:'), 'desc' => $this->l('The tax to apply on the ecotax (e.g. French ecotax: 19.6%).'),
'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_tax', 'identifier' => 'id_tax_rules_group', 'list' => TaxRulesGroup::getTaxRulesGroupsForOptions());
$this->fields_options['general']['fields']['PS_ECOTAX_TAX_RULES_GROUP_ID'] = array(
'title' => $this->l('Ecotax:'),
'desc' => $this->l('The tax to apply on the ecotax (e.g. French ecotax: 19.6%).'),
'cast' => 'intval',
'type' => 'select',
'identifier' => 'id_tax',
'identifier' => 'id_tax_rules_group',
'list' => TaxRulesGroup::getTaxRulesGroupsForOptions()
);
parent::__construct();
}
@@ -39,7 +39,13 @@ class AdminWebserviceControllerCore extends AdminController
$this->edit = true;
$this->delete = true;
$this->id_lang_default = Configuration::get('PS_LANG_DEFAULT');
$this->bulk_actions = array(
'delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
$this->fields_list = array(
'key' => array(
'title' => $this->l('Key'),
+7 -4
View File
@@ -34,7 +34,7 @@ class AdminZonesControllerCore extends AdminController
$this->table = 'zone';
$this->className = 'Zone';
$this->lang = false;
$this->fields_list = array(
'id_zone' => array(
'title' => $this->l('ID'),
@@ -54,9 +54,12 @@ class AdminZonesControllerCore extends AdminController
'orderby' => 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?')),
'enableSelection' => array('text' => $this->l('Enable selection')),
'disableSelection' => array('text' => $this->l('Disable selection'))
);
parent::__construct();
}