fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10499] logistic: allow transactions, fix link to new


From: Sigurd Nes
Subject: [Fmsystem-commits] [10499] logistic: allow transactions, fix link to new requirements from activity-list
Date: Fri, 09 Nov 2012 13:11:58 +0000

Revision: 10499
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10499
Author:   sigurdne
Date:     2012-11-09 13:11:58 +0000 (Fri, 09 Nov 2012)
Log Message:
-----------
logistic: allow transactions, fix link to new requirements from activity-list

Modified Paths:
--------------
    trunk/logistic/inc/class.socommon.inc.php
    trunk/logistic/inc/class.uiactivity.inc.php
    trunk/logistic/inc/class.uirequirement.inc.php

Modified: trunk/logistic/inc/class.socommon.inc.php
===================================================================
--- trunk/logistic/inc/class.socommon.inc.php   2012-11-09 13:09:04 UTC (rev 
10498)
+++ trunk/logistic/inc/class.socommon.inc.php   2012-11-09 13:11:58 UTC (rev 
10499)
@@ -36,7 +36,7 @@
 
                public function __construct()
                {
-                       $this->db                  = clone 
$GLOBALS['phpgw']->db;
+                       $this->db                       = & 
$GLOBALS['phpgw']->db;
                        $this->like                     = & $this->db->like;
                        $this->join                     = & $this->db->join;
                        $this->left_join        = & $this->db->left_join;
@@ -221,17 +221,21 @@
                        }
 
                        // test-input for break on ordered queries
-                       $db2 = clone($this->db);
+                       $db      = & $this->db;
+                       $db2 = clone $this->db;
 
                        $sql = $this->get_query($sort_field, $ascending, 
$search_for, $search_type, $filters, false);
 
                        $sql_parts = explode('1=1',$sql); // Split the query to 
insert extra condition on test for break
-                       $this->db->query($sql,__LINE__, __FILE__, false, true);
 
-                       while ($this->db->next_record()) // Runs through all of 
the results
+//                     $db->set_fetch_single(true);
+
+                       $db->query($sql,__LINE__, __FILE__);
+
+                       while ($db->next_record()) // Runs through all of the 
results
                        {
                                $should_populate_object = false; // Default 
value - we won't populate object
-                               $result_id = 
$this->unmarshal($this->db->f($id_field_name), 'int'); // The id of object
+                               $result_id = 
$this->unmarshal($db->f($id_field_name), 'int'); // The id of object
 
                                if(in_array($result_id, $added_object_ids)) // 
Object with this id already added
                                {
@@ -291,7 +295,7 @@
                                        }
                                }
                        }
-
+                       $db->set_fetch_single(false);
                        return $results;
                }
 

Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-11-09 13:09:04 UTC (rev 
10498)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-11-09 13:11:58 UTC (rev 
10499)
@@ -188,7 +188,19 @@
                                        )
                                );
 
+                       $parameters3 = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'activity_id',
+                                                       'source'        => 'id'
+                                               ),
+                                       )
+                               );
 
+
                        $data['datatable']['actions'][] = array
                                        (
                                                'my_name'               => 
'new',
@@ -208,7 +220,7 @@
                                                (
                                                        'menuaction'    => 
'logistic.uirequirement.edit'
                                                )),
-                                               'parameters'    => 
json_encode($parameters)
+                                               'parameters'    => 
json_encode($parameters3)
                                        );
 
                        $data['datatable']['actions'][] = array

Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php      2012-11-09 13:09:04 UTC 
(rev 10498)
+++ trunk/logistic/inc/class.uirequirement.inc.php      2012-11-09 13:11:58 UTC 
(rev 10499)
@@ -367,6 +367,8 @@
                                if ($activity_id && is_numeric($activity_id))
                                {
                                        $activity = 
$this->so_activity->get_single( $activity_id );
+                                       
$requirement->set_start_date($activity->get_start_date());
+                                       
$requirement->set_end_date($activity->get_end_date());
                                        $project = 
$this->so_project->get_single( $activity->get_project_id() );
                                }
                        }
@@ -439,10 +441,10 @@
                
                public function save()
                {
-                       $requirement_id = phpgw::get_var('id');
+                       $requirement_id = phpgw::get_var('id', 'int');
                        $new_location_id = phpgw::get_var('location_id');
                        
-                       if ($requirement_id && is_numeric($requirement_id))
+                       if ($requirement_id)
                        {
                                $requirement = 
$this->so->get_single($requirement_id);
                                $old_location_id = 
$requirement->get_location_id();
@@ -456,8 +458,9 @@
                        
                        if( $requirement->validate() )
                        {
-                               $db_requirement = $this->so->get_db();
-                               $db_requirement->transaction_begin();
+//                             $db_requirement = $this->so->get_db();
+//                             $db_requirement->transaction_begin();
+                               $GLOBALS['phpgw']->db->transaction_begin();
                                $requirement_id = 
$this->so->store($requirement);
                                
                                $status_delete_values = true;
@@ -469,11 +472,13 @@
                                
                                if( ($requirement_id > 0) && 
($status_delete_values) && ($status_delete_resources) )
                                {
-                                       $db_requirement->transaction_commit();
+//                                     $db_requirement->transaction_commit();
+                                       
$GLOBALS['phpgw']->db->transaction_commit();
                                }
                                else
                                {
-                                       $db_requirement->transaction_abort();
+                                       
$GLOBALS['phpgw']->db->transaction_commit();
+//                                     $db_requirement->transaction_abort();
                                }                       
                                
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement.view', 'id' => $requirement_id));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]