private function deleteAction() { $this->page->extra_url = '&action=delete'; $id = (int) isset($_GET['id']) ? $_GET['id'] : 0; $conf_caja = conf_caja::get($id); if ($conf_caja && $this->allow_delete && $conf_caja->delete()) { $this->new_message("Configuracion de caja eliminada corectamente!"); } else { if (!$this->allow_delete) { $this->new_error_msg("No tiene permisos para eliminar en esta página"); } $this->new_error_msg("Error al eliminar configracion de caja!"); } $this->indexAction(); }
/** * Return weather a caja should be closed or not according to information on configuration page * @return bool */ public function is_usable() { $info = conf_caja::get_info(); $dateStart = DateTime::createFromFormat('H:i:s', $info->getStartTime()); $dateEnd = DateTime::createFromFormat('H:i:s', $info->getEndTime()); $date2 = new DateTime('NOW'); if ($date2 > $dateEnd && $dateStart < $dateEnd) { return false; } else { return true; } }