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


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)


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', 1 ); ?>
RS

obrigado Americo, deu certo.
 
  1. <?php
  2. Fatal error: Uncaught 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!