Author: p.juanpablo
Date: 2010-01-11 19:17:51 +0100 (Mon, 11 Jan 2010)
New Revision: 26487

Added:
   plugins/dcPropelReportsPlugin/trunk/CHANGELOG
Modified:
   
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportQueryListerner.class.php
   plugins/dcPropelReportsPlugin/trunk/lib/form/dcReportTableForm.class.php
   plugins/dcPropelReportsPlugin/trunk/package.xml
Log:
Fixed a problem in dc_report_table module, when add first table to a report

Added: plugins/dcPropelReportsPlugin/trunk/CHANGELOG
===================================================================
--- plugins/dcPropelReportsPlugin/trunk/CHANGELOG                               
(rev 0)
+++ plugins/dcPropelReportsPlugin/trunk/CHANGELOG       2010-01-11 18:17:51 UTC 
(rev 26487)
@@ -0,0 +1,5 @@
+Version 0.1.1
+  * Fixed problem in dc_report_table module, when add first table to query
+
+Version 0.1.0
+ * First Release

Modified: 
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportQueryListerner.class.php
===================================================================
--- 
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportQueryListerner.class.php  
    2010-01-11 17:42:00 UTC (rev 26486)
+++ 
plugins/dcPropelReportsPlugin/trunk/lib/dcPropelReportQueryListerner.class.php  
    2010-01-11 18:17:51 UTC (rev 26487)
@@ -25,7 +25,14 @@
                
$criteria->add(dcReportTablePeer::DC_REPORT_QUERY_ID,$user->getAttribute('dc_report_query/current_report'));
                $criteria->addAscendingOrderByColumn(dcReportTablePeer::ID);
     }
-       return $criteria;
+    
+    if ($event->getSubject() instanceof autoDc_report_filterActions)  
+    { 
+               $user = sfContext::getInstance()->getUser();
+               
$criteria->add(dcReportFilterPeer::DC_REPORT_QUERY_ID,$user->getAttribute('dc_report_query/current_report'));
+    }
+
+    return $criteria;
   }
   
 }

Modified: 
plugins/dcPropelReportsPlugin/trunk/lib/form/dcReportTableForm.class.php
===================================================================
--- plugins/dcPropelReportsPlugin/trunk/lib/form/dcReportTableForm.class.php    
2010-01-11 17:42:00 UTC (rev 26486)
+++ plugins/dcPropelReportsPlugin/trunk/lib/form/dcReportTableForm.class.php    
2010-01-11 18:17:51 UTC (rev 26487)
@@ -115,6 +115,8 @@
 
   public function checkLeftTable($validator,&$values)
   {
+    $ltable=$this->getLeftTable(); 
+    if (is_null($ltable)) return $values;
     
     $table = null;
     $id = $values['dc_report_table_left'];
@@ -168,48 +170,62 @@
 
   protected function initializeRelations()
   {
-    $criteria=new Criteria();
-    $criteria->add(dcReportTablePeer::DC_REPORT_QUERY_ID, 
$this->getObject()->getDcReportQueryId());
-    $criteria->addAscendingOrderByColumn(dcReportTablePeer::PROPEL_NAME);
-    $this->setWidget('dc_report_table_left', new 
sfWidgetFormPropelChoice(array('model'=>'dcReportTable', 
'criteria'=>$criteria)));
+   
+    $this->setWidget('join_type',new sfWidgetFormChoice(array(
+    'choices'=>dcReportRelation::getJoinTypes()
+    )));
+ 
+    $ltable=$this->getLeftTable(); 
+    if (is_null($ltable))
+    {
+           $this->setWidget('dc_report_table_left',new 
sfWidgetFormChoice(array(
+             'choices'=>array()
+           )));
+           $this->setWidget('column_left',new sfWidgetFormChoice(array(
+             'choices'=>array()
+           )));
+           $this->setValidator('dc_report_table_left',new sfValidatorPass());  
+           
+            
$this->getWidget('dc_report_table_left')->setAttribute('disabled',true);
+           $this->getWidget('column_left')->setAttribute('disabled',true);
+           $this->getWidget('join_type')->setAttribute('disabled',true);
+    }
 
-    $table=$this->getLeftTable();
+    else {
+           $criteria=new Criteria();
+           $criteria->add(dcReportTablePeer::DC_REPORT_QUERY_ID, 
$this->getObject()->getDcReportQueryId());
+           
$criteria->addAscendingOrderByColumn(dcReportTablePeer::PROPEL_NAME);
+           $this->setWidget('dc_report_table_left', new 
sfWidgetFormPropelChoice(array('model'=>'dcReportTable', 
'criteria'=>$criteria)));
 
-    
$this->getWidget('dc_report_table_left')->setDefault(!is_null($table)?$table->getId():null);
+           $table=$this->getLeftTable();
 
+           
$this->getWidget('dc_report_table_left')->setDefault(!is_null($table)?$table->getId():null);
 
-    $this->getWidget('dc_report_table_left')->setAttribute('onchange',
-        remote_function(array(
-        'url'=>'dc_report_table/getColumnOptionsForTable',
-        'loading'  => "$('dc_report_table_column_left').disable()",
-        'complete' => 
"dc_propel_relation_update_columns_JSON(request,$('dc_report_table_column_left'));$('dc_report_table_column_left').enable()",
-        'with'=>"'table='+$(this).getValue()"
-      )));
 
-    
-    $this->setValidator('dc_report_table_left',new sfValidatorPropelChoice(
-          array(
-            'model'=>'dcReportTable',
-            'criteria' => $criteria,
-          ),
-          array(
-            'invalid' => "Left side table is not valid"
-          )
-        )
-     );
+           $this->getWidget('dc_report_table_left')->setAttribute('onchange',
+               remote_function(array(
+               'url'=>'dc_report_table/getColumnOptionsForTable',
+               'loading'  => "$('dc_report_table_column_left').disable()",
+               'complete' => 
"dc_propel_relation_update_columns_JSON(request,$('dc_report_table_column_left'));$('dc_report_table_column_left').enable()",
+               'with'=>"'table='+$(this).getValue()"
+             )));
 
-
-    $this->setWidget('column_left',new sfWidgetFormChoice(array(
-      
'choices'=>!is_null($table)?$this->getColumnsForTable($table->getPropelName()):array(),
-    )));
     
-
+           $this->setValidator('dc_report_table_left',new 
sfValidatorPropelChoice(
+                 array(
+                   'model'=>'dcReportTable',
+                   'criteria' => $criteria,
+                 ),
+                 array(
+                   'invalid' => "Left side table is not valid"
+                 )
+               )
+            );
+           $this->setWidget('column_left',new sfWidgetFormChoice(array(
+             
'choices'=>!is_null($table)?$this->getColumnsForTable($table->getPropelName()):array(),
+           )));
     
-    $this->setWidget('join_type',new sfWidgetFormChoice(array(
-    'choices'=>dcReportRelation::getJoinTypes()
-    )));
- 
-
+   }
         $this->setValidator('join_type',new sfValidatorPass());
        $this->setValidator('column_left',new sfValidatorPass());
   }

Modified: plugins/dcPropelReportsPlugin/trunk/package.xml
===================================================================
--- plugins/dcPropelReportsPlugin/trunk/package.xml     2010-01-11 17:42:00 UTC 
(rev 26486)
+++ plugins/dcPropelReportsPlugin/trunk/package.xml     2010-01-11 18:17:51 UTC 
(rev 26487)
@@ -25,7 +25,7 @@
  <date>2010-01-06</date>
  <time>16:30:00</time>
  <version>
-  <release>0.1.0</release>
+  <release>0.1.1</release>
   <api>1.2.0</api>
  </version>
  <stability>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to