D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreApagarTipForn.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsApagarTipForn * * @copyright (c) year, Carlos Marques - CM */ class GreApagarTipForn { private $DadosId; private $Resultado; private $Dados; private $DadosTipFornInferior; function getResultado() { return $this->Resultado; } public function apagarTipForn($DadosId = null) { $this->DadosId = (int) $DadosId; $this->verfTipForn(); if ($this->Resultado) { $apagarTipForn = new \App\adms\Models\helper\AdmsDelete(); $apagarTipForn->exeDelete("gre_tipos_fornecedor", "WHERE id =:id", "id={$this->DadosId}"); if ($apagarTipForn->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Tipo excluido com sucesso! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Tipo não foi excluido! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } private function verfTipForn() { $verTipForn = new \App\adms\Models\helper\AdmsRead(); $verTipForn->fullRead("SELECT id FROM gre_fornecedores WHERE gre_tipos_fornecedor_id=:gre_tipo_forn_id LIMIT :limit", "gre_tipo_forn_id=" . $this->DadosId . "&limit=2"); if ($verTipForn->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: o Tipo de Fornecedor não pode ser apagado, há fornecedores cadastradas com esse tipo! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } else { $this->Resultado = true; } } }