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

Pacotão Dominando o Adianti Framework 7
O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado! Versão 7.4


Dominando o Adianti 7 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.        
  6.         
  7.         parent :: _construct();
  8.         $this->form = new TQuickForm('form atletas');
  9.         $this->form->setFormTitle('Cadastrar Atletas');
  10.         $this->form->class 'tform';
  11.         
  12.         $id = new TEntry('id');
  13.         $nome = new TEntry('nome');
  14.         $nacionalidade = new TEntry('nacionalidade');
  15.         
  16.         $id -> setEditable(false);
  17.         
  18.         $this->form->addQuickFild('id',$id,100);
  19.         $this->form->addQuickFild('nome',$nome,100);
  20.         $this->form->addQuickFild('nacionalidade',$nacionalidade,100);
  21.         
  22.         $save = new TAction(array($this,'onSave'));
  23.         $this->form->addQuickAction('Salvar',$save,'icon_save.png');
  24.         
  25.         parent :: add($this->form);
  26.     
  27.     
  28.     
  29.     
  30.     }
  31.         
  32.         public function onSave(){
  33.     
  34.     
  35.     
  36.     
  37.         }
  38. }