Lançado Adianti Framework 7.6!
Clique aqui para saber mais
como descobrir onde está o erro. Bom dia, criei pelo studio uma aplicação de mestre/detalhe vertor, não mexi nada somente criei automatico. ao executar a classe da esse erro, que não mostra o que está errado, nem linha onde esta o erro como devo proceder? ...
RS
como descobrir onde está o erro.  
Bom dia, criei pelo studio uma aplicação de mestre/detalhe vertor, não mexi nada
somente criei automatico.

ao executar a classe da esse erro, que não mostra o que está errado, nem linha onde esta o erro

como devo proceder?

  1. <?php
  1. <?php
  2. /**
  3.  * LoteLancamentoForm Master/Detail
  4.  * @author  <your name here>
  5.  */
  6. class LoteLancamentoForm extends TPage
  7. {
  8.     protected $form// form
  9.     protected $fieldlist;
  10.     
  11.     /**
  12.      * Class constructor
  13.      * Creates the page and the registration form
  14.      */
  15.     function __construct($param)
  16.     {
  17.         parent::__construct($param);
  18.         
  19.         // creates the form
  20.         $this->form = new TForm('form_LoteLancamento');
  21.         $panel_master = new TPanelGroup'LoteLancamento' );
  22.         $vbox = new TVBox;
  23.         $vbox->style 'width: 100%';
  24.         $this->form->add($panel_master);
  25.         $panel_master->add($vbox);
  26.         
  27.         $table_general = new TTable;
  28.         $table_general->width '100%';
  29.         
  30.         $frame_general = new TFrame;
  31.         $frame_general->class 'tframe tframe-custom';
  32.         $frame_general->setLegend('LoteLancamento');
  33.         $frame_general->style 'background:whiteSmoke';
  34.         $frame_general->add($table_general);
  35.         
  36.         $frame_details = new TFrame;
  37.         $frame_details->class 'tframe tframe-custom';
  38.         $frame_details->setLegend('CustosLancamentos');
  39.         
  40.         $vbox->add$frame_general );
  41.         $vbox->add$frame_details );
  42.         
  43.         // master fields
  44.         $Id_lote = new TEntry('Id_lote');
  45.         $lote_competencia = new TEntry('lote_competencia');
  46.         $lote_vencimento = new TDate('lote_vencimento');
  47.         $lote_tipo_custo = new TEntry('lote_tipo_custo');
  48.         
  49.         // sizes
  50.         $Id_lote->setSize('50%');
  51.         $lote_competencia->setSize('100%');
  52.         $lote_vencimento->setSize('50%');
  53.         $lote_tipo_custo->setSize('50%');
  54.         if (!empty($Id_lote))
  55.         {
  56.             $Id_lote->setEditable(FALSE);
  57.         }
  58.         
  59.         // add form fields to be handled by form
  60.         $this->form->addField($Id_lote);
  61.         $this->form->addField($lote_competencia);
  62.         $this->form->addField($lote_vencimento);
  63.         $this->form->addField($lote_tipo_custo);
  64.         
  65.         // add form fields to the screen
  66.         $table_general->addRowSet( new TLabel('Id Lote'), $Id_lote );
  67.         $table_general->addRowSet( new TLabel('Lote Competencia'), $lote_competencia );
  68.         $table_general->addRowSet( new TLabel('Lote Vencimento'), $lote_vencimento );
  69.         $table_general->addRowSet( new TLabel('Lote Tipo Custo'), $lote_tipo_custo );
  70.         
  71.         
  72.         
  73.         // detail fields
  74.         $this->fieldlist = new TFieldList;
  75.         $this->fieldlist->enableSorting();
  76.         $frame_details->add($this->fieldlist);
  77.         
  78.         $id_custo = new TEntry('list_id_custo[]');
  79.        //  $id_custo = new TDBCombo('list_id_custo[]','conpusis','Custos','id','{codigo} - {custo} - [{secretarias->siglas}]');
  80.         $valor = new TEntry('list_valor[]');
  81.         $obs = new TText('list_obs[]');
  82.         $id_custo->setSize('50%');
  83.         $valor->setSize('50%');
  84.         $obs->setSize('100%');
  85.         $this->fieldlist->addField'<b>Custo</b>'$id_custo);
  86.         $this->fieldlist->addField'<b>Valor</b>'$valor);
  87.         $this->fieldlist->addField'<b>Observação</b>'$obs);
  88.         $this->form->addField($id_custo);
  89.         $this->form->addField($valor);
  90.         $this->form->addField($obs);
  91.         
  92.         // create an action button (save)
  93.         $save_button TButton::create('save', array($this'onSave'),  _t('Save'), 'fa:save blue');
  94.         $new_button  TButton::create('new',  array($this'onClear'), _t('Clear'),  'fa:eraser red');
  95.         
  96.         $this->form->addField($save_button);
  97.         $this->form->addField($new_button);
  98.         
  99.         //$id_custo->enableSearch();
  100.         
  101.         $panel_master->addFooterTHBox::pack($save_button$new_button) );
  102.         
  103.         // create the page container
  104.         $container = new TVBox;
  105.         $container->style 'width: 100%';
  106.         //$container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
  107.         $container->add($this->form);
  108.         parent::add($container);
  109.     }
  110.     
  111.     /**
  112.      * Executed whenever the user clicks at the edit button da datagrid
  113.      */
  114.     function onEdit($param)
  115.     {
  116.         try
  117.         {
  118.             TTransaction::open('conpusis');
  119.             
  120.             if (isset($param['key']))
  121.             {
  122.                 $key $param['key'];
  123.                 
  124.                 $object = new LoteLancamento($key);
  125.                 $this->form->setData($object);
  126.                 
  127.                 $items  CustosLancamentos::where('id_lote''='$key)->load();
  128.                 
  129.                 $this->fieldlist->addHeader();
  130.                 if ($items)
  131.                 {
  132.                     foreach($items  as $item )
  133.                     {
  134.                         $detail = new stdClass;
  135.                         $detail->list_id_custo $item->id_custo;
  136.                         $detail->list_valor $item->valor;
  137.                         $detail->list_obs $item->obs;
  138.                         $this->fieldlist->addDetail($detail);
  139.                     }
  140.                     
  141.                     $this->fieldlist->addCloneAction();
  142.                 }
  143.                 else
  144.                 {
  145.                     $this->onClear($param);
  146.                 }
  147.                 
  148.                 TTransaction::close(); // close transaction
  149.             }
  150.         }
  151.         catch (Exception $e// in case of exception
  152.         {
  153.             new TMessage('error'$e->getMessage());
  154.             TTransaction::rollback();
  155.         }
  156.     }
  157.     
  158.     /**
  159.      * Clear form
  160.      */
  161.     public function onClear($param)
  162.     {
  163.         $this->fieldlist->addHeader();
  164.         $this->fieldlist->addDetail( new stdClass );
  165.         $this->fieldlist->addCloneAction();
  166.     }
  167.     
  168.     /**
  169.      * Save the LoteLancamento and the CustosLancamentos's
  170.      */
  171.     public static function onSave($param)
  172.     {
  173.         try
  174.         {
  175.             TTransaction::open('conpusis');
  176.             
  177.             $id = (int) $param['Id_lote'];
  178.             $master = new LoteLancamento;
  179.             $master->fromArray$param);
  180.             $master->store(); // save master object
  181.             
  182.             // delete details
  183.             CustosLancamentos::where('id_lote''='$master->Id_lote)->delete();
  184.             
  185.             if( !empty($param['list_id_custo']) AND is_array($param['list_id_custo']) )
  186.             {
  187.                 foreach( $param['list_id_custo'] as $row => $id_custo)
  188.                 {
  189.                     if (!empty($id_custo))
  190.                     {
  191.                         $detail = new CustosLancamentos;
  192.                         $detail->id_lote $master->Id_lote;
  193.                         $detail->id_custo $param['list_id_custo'][$row];
  194.                         $detail->valor $param['list_valor'][$row];
  195.                         $detail->obs $param['list_obs'][$row];
  196.                         $detail->store();
  197.                     }
  198.                 }
  199.             }
  200.             
  201.             $data = new stdClass;
  202.             $data->Id_lote $master->Id_lote;
  203.             TForm::sendData('form_LoteLancamento'$data);
  204.             TTransaction::close(); // close the transaction
  205.             
  206.             new TMessage('info'TAdiantiCoreTranslator::translate('Record saved'));
  207.         }
  208.         catch (Exception $e// in case of exception
  209.         {
  210.             new TMessage('error'$e->getMessage());
  211.             TTransaction::rollback();
  212.         }
  213.     }
  214. }
  215. ?>


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)


AC

Bom dia.

Dê uma olhada nos dados de conexão com o BD, confirme o nome do arquivo passado como parâmetro no TTransaction:open...
Para que o PHP te mostre o erro, coloque essa linha no início do seu arquivo init.php:
  1. <?php ini_set'display_errors'); ?>
RS

obrigado Americo, deu certo.
  1. <?php
  2. Fatal errorUncaught Error: Class 'TFieldList' not found in /var/www/html/conpusis/app/control/conpusis/LoteLancamentoForm.class.php:75 Stack trace#0 /var/www/html/conpusis/lib/adianti/core/AdiantiCoreApplication.php(60): LoteLancamentoForm->__construct(Array) #1 /var/www/html/conpusis/engine.php(34): Adianti\Core\AdiantiCoreApplication::run(true) #2 /var/www/html/conpusis/engine.php(53): TApplication::run(true) #3 {main} thrown in /var/www/html/conpusis/app/control/conpusis/LoteLancamentoForm.class.php on line 75
  3. ?>
AC

Fico feliz em ajudar, mano!