Inscrições abertas para nosso Webinar anual Adianti Framework 2024!
Clique aqui para saber mais
Changeman não lista os chamados Prezados, tudo bem? Temos o changeman funcionando certinho e de repente, nao carrega mais os chamados no DataGrid. Temos essa linha: Conseguimos gravar, porém parou de listar os chamados na tela. Alguem poderia nos dar uma ajuda, abaixo codigo completo: ...
EB
Changeman não lista os chamados  
Prezados, tudo bem?

Temos o changeman funcionando certinho e de repente, nao carrega mais os chamados no DataGrid.
Temos essa linha:

  1. <?php 
  2.         $panel->add($this->datagrid);
  3. ?>


Conseguimos gravar, porém parou de listar os chamados na tela.

Alguem poderia nos dar uma ajuda, abaixo codigo completo:
  1. <?php
  2. /**
  3.  * IssueList Listing
  4.  * @author  <your name here>
  5.  */
  6. class IssueList extends TStandardList
  7. {
  8.     protected $form;     // registration form
  9.     protected $datagrid// listing
  10.     protected $pageNavigation;
  11.     protected $loaded;
  12.     
  13.     /**
  14.      * Class constructor
  15.      * Creates the page, the form and the listing
  16.      */
  17.     public function __construct()
  18.     {
  19.         parent::__construct();
  20.         
  21.         parent::setActiveRecord('Issue');
  22.         parent::setDatabase('changeman');
  23.         parent::setDefaultOrder('id''desc');
  24.         parent::addFilterField('id_status''=''id_status');
  25.         parent::addFilterField('id_project''=''id_project');
  26.         parent::addFilterField('id_priority''=''id_priority');
  27.         parent::addFilterField('id_category''=''id_category');
  28.         parent::addFilterField('title''like''title');
  29.         
  30.         TTransaction::open('permission');
  31.         $user SystemUser::newFromLogin(TSession::getValue('login'));
  32.         $is_admin    $user->checkInGroup( new SystemGroup(1) );
  33.         $is_manager  $user->checkInGroup( new SystemGroup(3) );
  34.         $is_member   $user->checkInGroup( new SystemGroup(4) );
  35.         $is_customer $user->checkInGroup( new SystemGroup(5) );
  36.         TTransaction::close();
  37.         
  38.         var_dump($is_admin);
  39.         var_dump($is_manager);
  40.         var_dump($is_member);
  41.         if ( $is_admin OR $is_manager OR $is_member )
  42.         {
  43.             parent::addFilterField('id_user''=''id_user');
  44.             //var_dump($user);
  45.         }
  46.         
  47.         // creates the form
  48.         $this->form = new BootstrapFormBuilder('form_search_Issue');
  49.         $this->form->setFormTitle_t('Issues') );
  50.         
  51.         $criteria = new TCriteria;
  52.         $criteria->add(new TFilter('active''=''Y'), TExpression::OR_OPERATOR);
  53.         $criteria->add(new TFilter('active''IS'NULL), TExpression::OR_OPERATOR);
  54.         
  55.         // create the form fields
  56.         $filter_status    = new TDBCombo('id_status''changeman''Status''id''description_translated');
  57.         $filter_project   = new TDBCombo('id_project''changeman''Project''id''description');
  58.         $filter_priority  = new TDBCombo('id_priority''changeman''Priority''id''description_translated');
  59.         $filter_category  = new TDBCombo('id_category''changeman''Category''id''description_translated');
  60.         $filter_user      = new TDBCombo('id_user''permission''SystemUser''id''name''name'$criteria);
  61.         $filter_title     = new TEntry('title');
  62.         $filter_user->enableSearch();
  63.         $filter_title->setSize('100%');
  64.         $filter_status->setSize('100%');
  65.         $filter_project->setSize('100%');
  66.         $filter_priority->setSize('100%');
  67.         $filter_category->setSize('100%');
  68.         $filter_user->setSize('100%');
  69.         
  70.         $this->form->addFields( [new TLabel(_t('Status'))], [$filter_status], [new TLabel(_t('Project'))], [$filter_project] );
  71.         $this->form->addFields( [new TLabel(_t('Priority'))], [$filter_priority], [new TLabel(_t('Category'))], [$filter_category] );
  72.         
  73.         if ( $is_admin OR $is_manager OR $is_member )
  74.         {
  75.             $this->form->addFields( [new TLabel(_t('Title'))], [$filter_title], [new TLabel(_t('User'))], [$filter_user]);
  76.         }
  77.         else
  78.         {
  79.             $this->form->addFields( [new TLabel(_t('Title'))], [$filter_title]);
  80.         }
  81.         
  82.         $btn $this->form->addAction_t('Find'), new TAction(array($this'onSearch')), 'fa:search' );
  83.         $btn->class 'btn btn-sm btn-primary';
  84.         $this->form->addActionLink_t('New'), new TAction(array('NewIssueForm''onEdit')), 'fa:plus-square green' );
  85.         
  86.         $this->form->setDataTSession::getValue('Issue_filter_data') );
  87.         
  88.         // creates a DataGrid
  89.         $this->datagrid = new BootstrapDatagridWrapper(new TDataGrid);
  90.         $this->datagrid->datatable 'true';
  91.         $this->datagrid->width '100%';
  92.         $this->datagrid->enablePopover(_t('Abstract'), '<table width="500px"><tr><td style="vertical-align:top"><b>'._t('Description').'</b><br>' '{description}' '</td><td style="vertical-align:top"><b>'._t('Solution').'</b><br>' '{solution} </td></tr></table>');
  93.         $this->datagrid->setHeight(320);
  94.         
  95.         // creates the datagrid columns
  96.         $id            = new TDataGridColumn('id''ID''right'40);
  97.         $id_project    = new TDataGridColumn('project_name'_t('Project'), 'left'NULL);
  98.         $title         = new TDataGridColumn('title'_t('Title'), 'left'NULL);
  99.         $id_status     = new TDataGridColumn('status_name'_t('Status'), 'left'NULL);
  100.         $id_priority   = new TDataGridColumn('priority_name'_t('Priority'), 'left'NULL);
  101.         $id_category   = new TDataGridColumn('category_name'_t('Category'), 'left'NULL);
  102.         $register_date = new TDataGridColumn('register_date'_t('Start date'), 'left'NULL);
  103.         $id_user       = new TDataGridColumn('user_name'_t('User'), 'left'NULL);
  104.         $id_status->setTransformer( array($this'setStatusColor') );
  105.         $id_category->setTransformer( array($this'setCatColor') );
  106.         $id_priority->setTransformer( array($this'setPriColor') );
  107.         $id_project->setTransformer( array($this'setProjColor') );
  108.         
  109.         // creates the datagrid actions
  110.         $order1= new TAction(array($this'onReload'));
  111.         $order2= new TAction(array($this'onReload'));
  112.         $order3= new TAction(array($this'onReload'));
  113.         $order4= new TAction(array($this'onReload'));
  114.         $order5= new TAction(array($this'onReload'));
  115.         $order6= new TAction(array($this'onReload'));
  116.         $order7= new TAction(array($this'onReload'));
  117.         $order8= new TAction(array($this'onReload'));
  118.         
  119.         // define the ordering parameters
  120.         $order1->setParameter('order''id');
  121.         $order2->setParameter('order''title');
  122.         $order3->setParameter('order''id_status');
  123.         $order4->setParameter('order''id_priority');
  124.         $order5->setParameter('order''id_category');
  125.         $order6->setParameter('order''register_date');
  126.         
  127.         // assign the ordering actions
  128.         $id->setAction($order1);
  129.         $title->setAction($order2);
  130.         $id_status->setAction($order3);
  131.         $id_priority->setAction($order4);
  132.         $id_category->setAction($order5);
  133.         $register_date->setAction($order6);
  134.         
  135.         // add the columns to the DataGrid
  136.         $this->datagrid->addColumn($id);
  137.         $this->datagrid->addColumn($id_project);
  138.         $this->datagrid->addColumn($title);
  139.         $this->datagrid->addColumn($id_status);
  140.         $this->datagrid->addColumn($id_priority);
  141.         $this->datagrid->addColumn($id_category);
  142.         $this->datagrid->addColumn($register_date);
  143.         
  144.         if ($is_customer)
  145.         {
  146.             parent::setCriteriaTCriteria::create( ['id_user' => $user->id] ) );
  147.         }
  148.         
  149.         if ( $is_admin OR $is_manager )
  150.         {
  151.             // creates two datagrid actions
  152.             $class 'UpdateIssueForm';
  153.             $action1 = new TDataGridAction(array($class'onEdit'));
  154.             $action1->setLabel(_t('Edit'));
  155.             $action1->setImage('fa:pencil-square-o blue fa-lg');
  156.             $action1->setField('id');
  157.             
  158.             $action2 = new TDataGridAction(array($this'onDelete'));
  159.             $action2->setLabel(_t('Delete'));
  160.             $action2->setImage('fa:trash-o red fa-lg');
  161.             $action2->setField('id');
  162.             
  163.             $this->datagrid->addColumn($id_user);
  164.             
  165.             // add the actions to the datagrid
  166.             $this->datagrid->addAction($action1);
  167.             $this->datagrid->addAction($action2);
  168.         }
  169.         else if ($is_member)
  170.         {
  171.             // creates two datagrid actions
  172.             $class 'UpdateIssueForm';
  173.             $action1 = new TDataGridAction(array($class'onEdit'));
  174.             $action1->setLabel(_t('Edit'));
  175.             $action1->setImage('fa:pencil-square-o blue fa-lg');
  176.             $action1->setField('id');
  177.             
  178.             $this->datagrid->addColumn($id_user);
  179.             
  180.             // add the actions to the datagrid
  181.             $this->datagrid->addAction($action1);
  182.         }
  183.         // creates two datagrid actions
  184.         $class 'ViewIssueForm';
  185.         $action3 = new TDataGridAction(array($class'onView'));
  186.         $action3->setLabel(_t('View'));
  187.         $action3->setImage('fa:search');
  188.         $action3->setField('id');
  189.         
  190.         $class 'NoteForm';
  191.         $action4 = new TDataGridAction(array($class'onEdit'));
  192.         $action4->setLabel(_t('Comment'));
  193.         $action4->setImage('fa:plus-square green');
  194.         $action4->setField('id');
  195.         
  196.         // add the actions to the datagrid
  197.         $this->datagrid->addAction($action3);
  198.         $this->datagrid->addAction($action4);
  199.         
  200.         // create the datagrid model
  201.         $this->datagrid->createModel();
  202.         
  203.         // creates the page navigation
  204.         $this->pageNavigation = new TPageNavigation;
  205.         $this->pageNavigation->enableCounters();
  206.         $this->pageNavigation->setAction(new TAction(array($this'onReload')));
  207.         $this->pageNavigation->setWidth($this->datagrid->getWidth());
  208.         
  209.         $panel = new TPanelGroup;
  210.         $panel->add($this->datagrid);
  211.         $panel->addFooter($this->pageNavigation);
  212.         
  213.         // creates the page structure using a vbox
  214.         $container = new TVBox;
  215.         $container->style 'width: 100%';
  216.         $container->add(new TXMLBreadCrumb('menu.xml'__CLASS__));
  217.         $container->add($this->form);
  218.         $container->add($panel);
  219.         // add the vbox inside the page
  220.         parent::add($container);
  221.     }
  222.     
  223.     public function setProjColor($proje$object$row)
  224.     {
  225.         $color $object->project_color;
  226.         if ($color)
  227.         {
  228.             $div = new TElement('span');
  229.             $div->style "text-shadow:none; font-size:12px; background: $color; border-radius:4px; padding:3px; color: white;";
  230.             $div->add($proje);
  231.             return $div;
  232.         }
  233.         else
  234.         {
  235.             return $proje;
  236.         }
  237.     }
  238.     /**
  239.      * Set status color
  240.      */    
  241.     public function setStatusColor($status$object$row)
  242.     {
  243.         $color $object->status_color;
  244.         if ($color)
  245.         {
  246.             $div = new TElement('span');
  247.             $div->style "text-shadow:none; font-size:12px; background: $color; border-radius:4px; padding:3px; color: white;";
  248.             $div->add($status);
  249.             return $div;
  250.         }
  251.         else
  252.         {
  253.             return $status;
  254.         }
  255.     }
  256.     public function setCatColor($categoria$object$row)
  257.     {
  258.         $color $object->cat_color;
  259.         if ($color)
  260.         {
  261.             $div = new TElement('span');
  262.             $div->style "text-shadow:none; font-size:12px; background: $color; border-radius:4px; padding:3px; color: white;";
  263.             $div->add($categoria);
  264.             return $div;
  265.         }
  266.         else
  267.         {
  268.             return $categoria;
  269.         }
  270.     }
  271.     
  272.     public function setPriColor($priori$object$row)
  273.     {
  274.         $color $object->pri_color;
  275.         if ($color)
  276.         {
  277.             $div = new TElement('span');
  278.             $div->style "text-shadow:none; font-size:12px; background: $color; border-radius:4px; padding:3px; color: white;";
  279.             $div->add($priori);
  280.             return $div;
  281.         }
  282.         else
  283.         {
  284.             return $priori;
  285.         }
  286.     }
  287.     /**
  288.      * Delete a record
  289.      */
  290.     function Delete($param)
  291.     {
  292.         try
  293.         {
  294.             TTransaction::open('permission');
  295.             $user SystemUser::newFromLogin(TSession::getValue('login'));
  296.             $is_admin   $user->checkInGroup( new SystemGroup(1) );
  297.             $is_manager $user->checkInGroup( new SystemGroup(3) );
  298.             TTransaction::close();
  299.             
  300.             // security check
  301.             if (!$is_admin AND !$is_manager)
  302.             {
  303.                 throw new Exception(_t('Permission denied'));
  304.             }
  305.             
  306.             // get the parameter $key
  307.             $key $param['key'];
  308.             // open a transaction with database 'changeman'
  309.             TTransaction::open('changeman');
  310.             
  311.             // instantiates object Issue
  312.             $object = new Issue($key);
  313.             
  314.             // deletes the object from the database
  315.             $object->delete();
  316.             
  317.             // close the transaction
  318.             TTransaction::close();
  319.             
  320.             // reload the listing
  321.             $this->onReload();
  322.             
  323.             // shows the success message
  324.             new TMessage('info'TAdiantiCoreTranslator::translate('Record deleted'));
  325.         }
  326.         catch (Exception $e// in case of exception
  327.         {
  328.             // shows the exception error message
  329.             new TMessage('error'$e->getMessage());
  330.             
  331.             // undo all pending operations
  332.             TTransaction::rollback();
  333.         }
  334.     }
  335.     function onClear()
  336.     {
  337.          $this->onSearch();
  338.     }
  339.    /** 
  340.      * method show()
  341.      * Shows the page
  342.      */
  343.     public function show()
  344.     {
  345.         // check if the datagrid is already loaded
  346.         if (!$this->loaded)
  347.         {
  348.             $this->onReload();
  349.         }
  350.         parent::show();
  351.     }
  352.     
  353. }

Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (1)


EB

Olá pessoal, encontrei o problema, comentei a linha 92, conforme abaixo:

  1. <?php
  2.         $this->datagrid->enablePopover(_t('Abstract'), '<table width="500px"><tr><td style="vertical-align:top"><b>'._t('Description').'</b><br>' '{description}' '</td><td style="vertical-align:top"><b>'._t('Solution').'</b><br>' '{solution} </td></tr></table>');
  3. ?>


Ficou assim:
  1. <?php
  2.         //$this->datagrid->enablePopover(_t('Abstract'), '<table width="500px"><tr><td style="vertical-align:top"><b>'._t('Description').'</b><br>' . '{description}' . '</td><td style="vertical-align:top"><b>'._t('Solution').'</b><br>' . '{solution} </td></tr></table>');
  3. ?>


Ainda não sei o motivo, mas vamos ficar sem Popover, o que pra nós não há problemas.
Fica a dica para alguém que esteja passando pelo mesmo problema.

Att.,
Ed

Editado 25/05/2024 (há 5 meses) - Ver alterações