public function getDocumentoPend(knl_model_doc $mDoc) { $session = knl_lib_Registry::getSession(); $DocPend = knl_dao_doc_pendencia::getInstance(); $mDocPend = $DocPend->selectByUserGroupIdDoc($session->get_id_usuario(), $session->get_id_grupo(), $session->get_grupos(), $mDoc->get_id()); return $mDocPend; }
public function upsert(knl_model_doc $objmodel) { if ($objmodel->get_id() == 0) { $query = "INSERT INTO doc (id_doc_tipo,id_doc_sub_tipo,id_empresa,numero,data_doc,pag)\n VALUES ('" . $objmodel->get_id_doc_tipo() . "','" . $objmodel->get_id_doc_sub_tipo() . "','" . $objmodel->get_id_empresa() . "','" . $objmodel->get_numero() . "','" . $objmodel->get_data_doc_db() . "','" . $objmodel->get_pag() . "')"; $stmt = $this->conn->prepare($query); $stmt = $this->conn->execute($stmt); $objmodel->set_id($this->conn->Insert_ID()); } else { $query = "UPDATE doc SET \n id_doc_tipo='{$objmodel->get_id_doc_tipo()}',id_doc_sub_tipo='{$objmodel->get_id_doc_sub_tipo()}',id_empresa='{$objmodel->get_id_empresa()}',numero='{$objmodel->get_numero()}',data_doc='{$objmodel->get_data_doc_db()}',pag='{$objmodel->get_pag()}'\n WHERE id = ?"; $stmt = $this->conn->prepare($query); $stmt = $this->conn->execute($stmt, $objmodel->get_id()); } return $objmodel; }