Permissão Negada TSeekButton Boa Tarde Pessoal, tudo bem? Configurei o TSeekButton, conforme alguns post no forum,, já cadastrei a rotina de Seek na rotina de programa concedendo para admin e user, porém aparece permissão negada. Alguém poderia me ajudar? Agradeço desde já Obrigado! Abaixo segue meu código. ...
SV
Permissão Negada TSeekButton  
Boa Tarde Pessoal, tudo bem?

Configurei o TSeekButton, conforme alguns post no forum,, já cadastrei a rotina de Seek na rotina de programa concedendo para admin e user, porém aparece permissão negada.

Alguém poderia me ajudar?

Agradeço desde já

Obrigado!


Abaixo segue meu código.

 
  1. <?php
  2. /**
  3. * SystemUnitForm Form
  4. * @author <your name here>
  5. */
  6. class SystemUnitForm extends TPage
  7. {
  8. protected $form; // form
  9. /**
  10. * Form constructor
  11. * @param $param Request
  12. */
  13. public function __construct( $param )
  14. {
  15. parent::__construct();
  16. // creates the form
  17. $this->form = new BootstrapFormBuilder('form_SystemUnit');
  18. $this->form->setFormTitle('Filial');
  19. $this->form->setFieldSizes('100%');
  20. $this->form->appendPage('Basic');
  21. // create the form fields
  22. $id = new TEntry('id');
  23. $name = new TEntry('name');
  24. $fantasia = new TEntry('fantasia');
  25. $tipopessoa = new TCombo('tipopessoa');
  26. $cnpj = new TEntry('cnpj');
  27. $rg = new TEntry('rg');
  28. $inscmunicipal = new TEntry('inscmunicipal');
  29. $cnaeprincipal = new TSeekButton('cnaeprincipal');
  30. $codigoregime = new TCombo('codigoregime');
  31. $cep = new TEntry('cep');
  32. $cidade = new TEntry('cidade');
  33. $uf = new TEntry('uf');
  34. $endereco = new TEntry('endereco');
  35. $numero = new TEntry('numero');
  36. $complemento = new TEntry('complemento');
  37. $bairro = new TEntry('bairro');
  38. $contato = new TEntry('contato');
  39. $fone = new TEntry('fone');
  40. $celular = new TEntry('celular');
  41. $email = new TEntry('email');
  42. $emailcobranca = new TEntry('emailcobranca');
  43. $site = new TEntry('site');
  44. $tipopessoa->addItems(['J'=>'Jurídica', 'F'=>'Física']);
  45. $codigoregime->addItems(['1'=>'1-Simples Nacional',
  46. '2'=>'2-Simples Nacional - excesso de sublimite da receita bruta',
  47. '3'=>'3-Regime Normal']);
  48. //acao do cep
  49. $action_cep = new TAction(array($this,'onCep'));
  50. $cep->setExitAction($action_cep);
  51. //*****************************************************
  52. //SEEK
  53. //*****************************************************
  54. $obj = new TabelaCnaeSeek;
  55. $action_cnae = new TAction( array( $obj, 'onreload' ) );
  56. $cnaeprincipal->setAction($action_cnae);
  57. // add the fields
  58. $row = $this->form->addFields([ new TLabel('Código') , $id ] );
  59. $row->layout = ['col-sm-2'];
  60. $row = $this->form->addFields([ new TLabel('Empresa') , $name ],
  61. [ new TLabel('Nome Fantasia') , $fantasia ],
  62. [ new TLabel('Tipo'), $tipopessoa ]);
  63. $row->layout = ['col-sm-5','col-sm-5','col-sm-2'];
  64. $row = $this->form->addFields([ new TLabel('CNPJ/CPF') , $cnpj ],
  65. [ new TLabel('IE/RG') , $rg ],
  66. [ new TLabel('Insc. Municipal') , $inscmunicipal ] );
  67. $row->layout = ['col-sm-3','col-sm-3','col-sm-3'];
  68. $row = $this->form->addFields( [ new TLabel('CNAE') , $cnaeprincipal ],
  69. [ new TLabel('Cód. Regime Tributário') , $codigoregime ] );
  70. $row->layout = ['col-sm-3','col-sm-3'];
  71. $label2 = new TLabel('Endereço', '#5A73DB', 12, '');
  72. $label2->style='text-align:left;border-bottom:1px solid #c0c0c0;width:100%';
  73. $this->form->addContent( [$label2] );
  74. $row = $this->form->addFields( [ new TLabel('CEP'), $cep ],
  75. [ new TLabel('Cidade'), $cidade ],
  76. [ new TLabel('UF'), $uf ],
  77. [ new TLabel('Endereço'), $endereco ],
  78. [ new TLabel('Nr'), $numero ]);
  79. $row->layout = ['col-sm-2','col-sm-2','col-sm-1','col-sm-6','col-sm-1' ];
  80. $this->form->addFields( );
  81. $this->form->addFields( [ new TLabel('Complemento') ], [ $complemento ] );
  82. $this->form->addFields( [ new TLabel('Bairro') ], [ $bairro ] );
  83. $this->form->addFields( [ new TLabel('Contato') ], [ $contato ] );
  84. $this->form->addFields( [ new TLabel('Fone') ], [ $fone ] );
  85. $this->form->addFields( [ new TLabel('Celular') ], [ $celular ] );
  86. $this->form->addFields( [ new TLabel('Email') ], [ $email ] );
  87. $this->form->addFields( [ new TLabel('Emailcobranca') ], [ $emailcobranca ] );
  88. $this->form->addFields( [ new TLabel('Site') ], [ $site ] );
  89. /*/ set sizes
  90. $id->setSize('100%');
  91. $name->setSize('100%');
  92. $fantasia->setSize('100%');
  93. $tipopessoa->setSize('100%');
  94. $cnpj->setSize('100%');
  95. $rg->setSize('100%');
  96. $inscmunicipal->setSize('100%');
  97. $cnaeprincipal->setSize('100%');
  98. $codigoregime->setSize('100%');
  99. $cep->setSize('100%');
  100. $cidade->setSize('100%');
  101. $uf->setSize('100%');
  102. $endereco->setSize('100%');
  103. $numero->setSize('100%');
  104. $complemento->setSize('100%');
  105. $bairro->setSize('100%');
  106. $contato->setSize('100%');
  107. $fone->setSize('100%');
  108. $celular->setSize('100%');
  109. $email->setSize('100%');
  110. $emailcobranca->setSize('100%');
  111. $site->setSize('100%');
  112. */
  113. if (!empty($id))
  114. {
  115. $id->setEditable(FALSE);
  116. }
  117. /** samples
  118. $fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
  119. $fieldX->setSize( '100%' ); // set size
  120. **/
  121. // create the form actions
  122. $btn = $this->form->addAction(_t('Save'), new TAction([$this, 'onSave']), 'fa:floppy-o');
  123. $btn->class = 'btn btn-sm btn-primary';
  124. $this->form->addAction(_t('New'), new TAction([$this, 'onEdit']), 'fa:eraser red');
  125. // vertical box container
  126. $container = new TVBox;
  127. $container->style = 'width: 100%';
  128. //$container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  129. $container->add($this->form);
  130. parent::add($container);
  131. }
  132. /**
  133. * Save form data
  134. * @param $param Request
  135. */
  136. public function onSave( $param )
  137. {
  138. try
  139. {
  140. TTransaction::open('empresa'); // open a transaction
  141. /**
  142. // Enable Debug logger for SQL operations inside the transaction
  143. TTransaction::setLogger(new TLoggerSTD); // standard output
  144. TTransaction::setLogger(new TLoggerTXT('log.txt')); // file
  145. **/
  146. $this->form->validate(); // validate form data
  147. $data = $this->form->getData(); // get form data as array
  148. $object = new SystemUnit; // create an empty object
  149. $object->fromArray( (array) $data); // load the object with data
  150. $object->store(); // save the object
  151. // get the generated id
  152. $data->id = $object->id;
  153. $this->form->setData($data); // fill form data
  154. TTransaction::close(); // close the transaction
  155. new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
  156. }
  157. catch (Exception $e) // in case of exception
  158. {
  159. new TMessage('error', $e->getMessage()); // shows the exception error message
  160. $this->form->setData( $this->form->getData() ); // keep form data
  161. TTransaction::rollback(); // undo all pending operations
  162. }
  163. }
  164. /**
  165. * Clear form data
  166. * @param $param Request
  167. */
  168. public function onClear( $param )
  169. {
  170. $this->form->clear(TRUE);
  171. }
  172. /**
  173. * Load object to form data
  174. * @param $param Request
  175. */
  176. public function onEdit( $param )
  177. {
  178. try
  179. {
  180. if (isset($param['key']))
  181. {
  182. $key = $param['key']; // get the parameter $key
  183. TTransaction::open('empresa'); // open a transaction
  184. $object = new SystemUnit($key); // instantiates the Active Record
  185. $this->form->setData($object); // fill the form
  186. TTransaction::close(); // close the transaction
  187. }
  188. else
  189. {
  190. $this->form->clear(TRUE);
  191. }
  192. }
  193. catch (Exception $e) // in case of exception
  194. {
  195. new TMessage('error', $e->getMessage()); // shows the exception error message
  196. TTransaction::rollback(); // undo all pending operations
  197. }
  198. }
  199. public static function onCep($param)
  200. {
  201. $resultado = @file_get_contents('http://republicavirtual.com.br/web_cep.php?cep='.urlencode($param['cep']).'&formato=query_string');
  202. var_dump($resultado);
  203. if(!$resultado){
  204. $resultado = "&resultado=0&resultado_txt=erro+ao+buscar+cep";
  205. }
  206. parse_str($resultado, $retorno);
  207. $obj = new StdClass;
  208. $obj->endereco = strtoupper($retorno['tipo_logradouro'].' '.$retorno['logradouro']);
  209. $obj->bairro = strtoupper($retorno['bairro']);
  210. $obj->cidade = strtoupper($retorno['cidade']);
  211. $obj->uf = strtoupper($retorno['uf']);
  212. TForm::sendData('form_SystemUnit', $obj);
  213. }
  214. }
  215. ?>

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (3)


NR

Nesses casos geralmente é algum detalhezinho, como nome da classe por exemplo. Confira se o programa cadastrado corresponde exatamente ao nome da classe. E você chegou a sair e entrar novamente do sistema para testar?
AK

Estou com o mesmo erro.
AK

a minha classe :

 
  1. <?php
  2. class CadastroAtletasForm extends TPage{
  3. private $form;
  4. public function _construct(){
  5. parent :: _construct();
  6. $this->form = new TQuickForm('form atletas');
  7. $this->form->setFormTitle('Cadastrar Atletas');
  8. $this->form->class = 'tform';
  9. $id = new TEntry('id');
  10. $nome = new TEntry('nome');
  11. $nacionalidade = new TEntry('nacionalidade');
  12. $id -> setEditable(false);
  13. $this->form->addQuickFild('id',$id,100);
  14. $this->form->addQuickFild('nome',$nome,100);
  15. $this->form->addQuickFild('nacionalidade',$nacionalidade,100);
  16. $save = new TAction(array($this,'onSave'));
  17. $this->form->addQuickAction('Salvar',$save,'icon_save.png');
  18. parent :: add($this->form);
  19. }
  20. public function onSave(){
  21. }
  22. }