[Vtigercrm-commits] [vtiger development] #7333: Create custom view fails

vtiger development vtiger-tickets at trac.vtiger.com
Thu Jan 19 04:31:43 PST 2012


#7333: Create custom view fails
-------------------------+--------------------------------------------------
 Reporter:  stefanczech  |       Owner:  developer 
     Type:  defect       |      Status:  new       
 Priority:  unassigned   |   Milestone:  Unassigned
Component:  vtigercrm    |     Version:  5.3.0     
 Severity:  Medium       |    Keywords:            
-------------------------+--------------------------------------------------
 When creating a new custom view (filter) for example in the Potentials
 view, PHP reports 2 errors, both for the file \modules\CustomView\Save.php
 on lines 137 and 195.
 Message: Invalid argument supplied for foreach().

 The problem seems to be, that if no advanced filter for the view is
 selected, the both variables $advft_criteria and $advft_criteria_groups
 are not an empty array which could be handled in the foreach-loop.

 This problem was solved in our system by changing the code in Save.php
 starting in line 84 from


 {{{
   $advft_criteria = $_REQUEST['advft_criteria'];
   $advft_criteria = $json->decode($advft_criteria);

   $advft_criteria_groups = $_REQUEST['advft_criteria_groups'];
   $advft_criteria_groups = $json->decode($advft_criteria_groups);
 }}}

 to

 {{{
   $advft_criteria = $_REQUEST['advft_criteria'];
   $advft_criteria = $json->decode($advft_criteria);
   if ($advft_criteria == "")
   {
     $advft_criteria = array();
   }

   $advft_criteria_groups = $_REQUEST['advft_criteria_groups'];
   $advft_criteria_groups = $json->decode($advft_criteria_groups);
   if ($advft_criteria_groups == "")
   {
     $advft_criteria_groups = array();
   }
 }}}

 Maybe there is a better solution, but this works here.

-- 
Ticket URL: <http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7333>
vtiger development <http://trac.vtiger.com/>
vtiger CRM



More information about the vtigercrm-commits mailing list