protected function processBulkDelete() { if ($this->tabAccess['delete'] === '1') { if (is_array($this->boxes) && !empty($this->boxes)) { $object = new $this->className(); if (isset($object->noZeroObject) && (count(call_user_func(array($this->className, $object->noZeroObject))) <= 1 || count($_POST[$this->table . 'Box']) == count(call_user_func(array($this->className, $object->noZeroObject))))) { $this->errors[] = Tools::displayError('You need at least one object.') . ' <b>' . $this->table . '</b><br />' . Tools::displayError('You cannot delete all of the items.'); } else { $success = 1; $offers = Tools::getValue($this->table . 'Box'); if (is_array($offers) && ($count = count($offers))) { // Deleting offers can be quite long on a cheap server. Let's say 1.5 seconds by offer (I've seen it!). if (intval(ini_get('max_execution_time')) < round($count * 1.5)) { ini_set('max_execution_time', round($count * 1.5)); } if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) { $stock_manager = StockManagerFactory::getManager(); } foreach ($offers as $id_offer) { $offer = new AphOffer((int) $id_offer); if (!count($this->errors)) { if ($offer->delete()) { PrestaShopLogger::addLog(sprintf($this->l('%s deletion', 'AdminTab', false, false), $this->className), 1, null, $this->className, (int) $offer->id, true, (int) $this->context->employee->id); } else { $success = false; } } else { $success = 0; } } } if ($success) { $this->redirect_after = self::$currentIndex . '&conf=2&token=' . $this->token; } else { $this->errors[] = Tools::displayError('An error occurred while deleting this selection.'); } } } else { $this->errors[] = Tools::displayError('You must select at least one element to delete.'); } } else { $this->errors[] = Tools::displayError('You do not have permission to delete this.'); } }