public function execute() { try { if (request::getInstance()->isMethod('POST') and request::getInstance()->isAjaxRequest()) { $id = request::getInstance()->getPost(loteTableClass::getNameField(loteTableClass::ID, true)); $ids = array(loteTableClass::ID => $id); loteTableClass::delete($ids, true); $this->arrayAjax = array('code' => 11, 'msg' => 'La eliminacion ha sido exitosa'); $this->defineView('delete', 'lote', session::getInstance()->getFormatOutput()); log::register(i18n::__('delete'), loteTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete', null, 'lote')); } else { log::register(i18n::__('delete'), loteTableClass::getNameTable(), i18n::__('errorDeleteBitacora')); session::getInstance()->setError(i18n::__('errorDelete')); routing::getInstance()->redirect('animal', 'indexLote'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }
public function execute() { try { if (request::getInstance()->isMethod('POST')) { $idsToDelete = request::getInstance()->getPost('chk'); foreach ($idsToDelete as $id) { $ids = array(loteTableClass::ID => $id); loteTableClass::delete($ids, true); } log::register(i18n::__('delete'), loteTableClass::getNameTable()); session::getInstance()->setSuccess(i18n::__('succesDelete')); routing::getInstance()->redirect('animal', 'indexLote'); } else { log::register(i18n::__('errorDelete'), loteTableClass::getNameTable()); session::getInstance()->setError(i18n::__('errorDeleteMasivo')); routing::getInstance()->redirect('animal', 'indexLote'); } } catch (PDOException $exc) { session::getInstance()->setFlash('exc', $exc); routing::getInstance()->forward('shfSecurity', 'exception'); } }