Commit dacae6bb1f792f95b94577f6a2325c7b35bf60ca

Authored by Yago Regis + Greg Ouyama
Committed by Rafael Santos
1 parent dd9df0ab
Exists in master

Issue: 18 - Recuperacao de dados durante a edicao de colecao e inicio da padroni…

…zacao dos detalhes dos itens da biblioteca
ieducar/intranet/educar_acervo_colecao_cad.php
... ... @@ -79,6 +79,16 @@ class indice extends clsCadastro
79 79 foreach( $registro AS $campo => $val ) // passa todos os valores obtidos no registro para atributos do objeto
80 80 $this->$campo = $val;
81 81  
  82 + $obj_obra = new clsPmieducarAcervoColecao($this->cod_acervo_colecao);
  83 + $det_obra = $obj_obra->detalhe();
  84 +
  85 + $obj_biblioteca = new clsPmieducarBiblioteca($det_obra["ref_cod_biblioteca"]);
  86 + $obj_det = $obj_biblioteca->detalhe();
  87 +
  88 + $this->ref_cod_instituicao = $obj_det["ref_cod_instituicao"];
  89 + $this->ref_cod_escola = $obj_det["ref_cod_escola"];
  90 + $this->ref_cod_biblioteca = $obj_det["cod_biblioteca"];
  91 +
82 92 $obj_permissoes = new clsPermissoes();
83 93 if( $obj_permissoes->permissao_excluir( 593, $this->pessoa_logada, 11 ) )
84 94 {
... ...
ieducar/intranet/educar_acervo_colecao_det.php
... ... @@ -69,17 +69,82 @@ class indice extends clsDetalhe
69 69  
70 70 $tmp_obj = new clsPmieducarAcervoColecao( $this->cod_acervo_colecao );
71 71 $registro = $tmp_obj->detalhe();
  72 +
  73 + if( class_exists( "clsPmieducarBiblioteca" ) )
  74 + {
  75 + $obj_ref_cod_biblioteca = new clsPmieducarBiblioteca( $registro["ref_cod_biblioteca"] );
  76 + $det_ref_cod_biblioteca = $obj_ref_cod_biblioteca->detalhe();
  77 + $registro["ref_cod_biblioteca"] = $det_ref_cod_biblioteca["nm_biblioteca"];
  78 + if( class_exists( "clsPmieducarInstituicao" ) )
  79 + {
  80 + $registro["ref_cod_instituicao"] = $det_ref_cod_biblioteca["ref_cod_instituicao"];
  81 + $obj_ref_cod_instituicao = new clsPmieducarInstituicao( $registro["ref_cod_instituicao"] );
  82 + $det_ref_cod_instituicao = $obj_ref_cod_instituicao->detalhe();
  83 + $registro["ref_cod_instituicao"] = $det_ref_cod_instituicao["nm_instituicao"];
  84 + }
  85 + else
  86 + {
  87 + $registro["ref_cod_instituicao"] = "Erro na geracao";
  88 + echo "<!--\nErro\nClasse nao existente: clsPmieducarInstituicao\n-->";
  89 + }
  90 + }
  91 +
  92 + if( class_exists( "clsPmieducarEscola" ) )
  93 + {
  94 + $registro["ref_cod_escola"] = $det_ref_cod_biblioteca["ref_cod_escola"];
  95 + $obj_ref_cod_escola = new clsPmieducarEscola( $registro["ref_cod_escola"] );
  96 + $det_ref_cod_escola = $obj_ref_cod_escola->detalhe();
  97 + $idpes = $det_ref_cod_escola["ref_idpes"];
  98 + if ($idpes)
  99 + {
  100 + $obj_escola = new clsPessoaJuridica( $idpes );
  101 + $obj_escola_det = $obj_escola->detalhe();
  102 + $registro["ref_cod_escola"] = $obj_escola_det["fantasia"];
  103 + }
  104 + else
  105 + {
  106 + $obj_escola = new clsPmieducarEscolaComplemento( $registro["ref_cod_escola"] );
  107 + $obj_escola_det = $obj_escola->detalhe();
  108 + $registro["ref_cod_escola"] = $obj_escola_det["nm_escola"];
  109 + }
  110 + }
  111 +
  112 + $obj_permissoes = new clsPermissoes();
  113 + $nivel_usuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
  114 +
72 115  
73 116 if( ! $registro )
74 117 {
75 118 header( "location: educar_acervo_colecao_lst.php" );
76 119 die();
77 120 }
  121 +
  122 + if ($nivel_usuario == 1)
  123 + {
  124 + if( $registro["ref_cod_instituicao"] )
  125 + {
  126 + $this->addDetalhe( array( "Institui&ccedil;&atilde;o", "{$registro["ref_cod_instituicao"]}") );
  127 + }
  128 + }
  129 +
  130 + if ($nivel_usuario == 1 || $nivel_usuario == 2)
  131 + {
  132 + if( $registro["ref_cod_escola"] )
  133 + {
  134 + $this->addDetalhe( array( "Escola", "{$registro["ref_cod_escola"]}") );
  135 + }
  136 + }
78 137  
  138 + if( $registro["ref_cod_biblioteca"] )
  139 + {
  140 + $this->addDetalhe( array( "Biblioteca", "{$registro["ref_cod_biblioteca"]}") );
  141 + }
  142 +
79 143 if( $registro["cod_acervo_colecao"] )
80 144 {
81 145 $this->addDetalhe( array( "C&oacute;digo Cole&ccedil;&atilde;o", "{$registro["cod_acervo_colecao"]}") );
82 146 }
  147 +
83 148 if( $registro["nm_colecao"] )
84 149 {
85 150 $this->addDetalhe( array( "Cole&ccedil;&atilde;o", "{$registro["nm_colecao"]}") );
... ... @@ -88,6 +153,7 @@ class indice extends clsDetalhe
88 153 {
89 154 $this->addDetalhe( array( "Descri&ccedil;&atilde;o", "{$registro["descricao"]}") );
90 155 }
  156 +
91 157  
92 158 $obj_permissoes = new clsPermissoes();
93 159 if( $obj_permissoes->permissao_cadastra( 593, $this->pessoa_logada, 11 ) )
... ...