[21023] Improvement: fetchmode assoc 4686:4746

Sigurd Nes <[email protected]> Sun, 07 Feb 2010 10:44:40 +0000
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 21023
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21023
Author:   sigurdne
Date:     2010-02-07 10:44:40 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Improvement: fetchmode assoc 4686:4746

Modified Paths:
--------------
    people/sigurdne/modules/projects/trunk/inc/class.boprojecthours.inc.php
    people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
    people/sigurdne/modules/projects/trunk/inc/class.soprojecthours.inc.php
    people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
    people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php

Modified: people/sigurdne/modules/projects/trunk/inc/class.boprojecthours.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.boprojecthours.inc.php	2010-02-07 10:44:14 UTC (rev 21022)
+++ people/sigurdne/modules/projects/trunk/inc/class.boprojecthours.inc.php	2010-02-07 10:44:40 UTC (rev 21023)
@@ -875,8 +875,8 @@
 				{
 					if( $matrix[$i]['id'] == $hoursResult->f(1) )
 					{
-				//		$matrix[$i]['days'][$hoursResult->f(0)] = $hoursResult->f(2);
-						$matrix[$i]['days'][date("Ymd",$hoursResult->f(0))] = $hoursResult->f(2);
+				//		$matrix[$i]['days'][$hoursResult->f('day')] = $hoursResult->f('_time');
+						$matrix[$i]['days'][date("Ymd",$hoursResult->f('day'))] = $hoursResult->f('_time');
 						break;
 					}
 				}

Modified: people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php	2010-02-07 10:44:14 UTC (rev 21022)
+++ people/sigurdne/modules/projects/trunk/inc/class.soconfig.inc.php	2010-02-07 10:44:40 UTC (rev 21023)
@@ -264,11 +264,11 @@
 				$additon = " and type='accounting'";
 			}
 
-			$this->db->query("select count(*) from $p_table where $column" . $additon,__LINE__,__FILE__);
+			$this->db->query("select count(*) as cnt from $p_table where $column" . $additon,__LINE__,__FILE__);
 
 			$this->db->next_record();
 
-			if ($this->db->f(0))
+			if ($this->db->f('cnt'))
 			{
 				return True;
 			}
@@ -733,7 +733,7 @@
 			$this->db->query('SELECT event_extra from phpgw_p_events where event_name=' . "'" . $event_name . "'",__LINE__,__FILE__);
 			$this->db->next_record();
 
-			return $this->db->f(0);
+			return $this->db->f('event_extra');
 		}
 
 		function list_surcharges( $charge_id = 0 )

Modified: people/sigurdne/modules/projects/trunk/inc/class.soprojecthours.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.soprojecthours.inc.php	2010-02-07 10:44:14 UTC (rev 21022)
+++ people/sigurdne/modules/projects/trunk/inc/class.soprojecthours.inc.php	2010-02-07 10:44:40 UTC (rev 21023)
@@ -725,7 +725,7 @@
 		{
 			// Nice SQL-Statement Kai
 //			$sql  = 'SELECT UNIX_TIMESTAMP(FROM_UNIXTIME(start_date,"%Y%m%d")) as day, project_id, sum(minutes) + sum(t_journey) ';
-			$sql  = 'SELECT start_date as day, project_id, sum(minutes) + sum(t_journey) ';
+			$sql  = 'SELECT start_date as day, project_id, sum(minutes) + sum(t_journey) as _time';
 			$sql .= 'FROM phpgw_p_hours ';
 			$sql .= 'WHERE employee='.(int)$employee.' AND start_date >= '.(int)$start_date.' AND start_date <= '.((int)$end_date + 86400).' ';
 			$sql .= 'GROUP BY project_id, day ';

Modified: people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php	2010-02-07 10:44:14 UTC (rev 21022)
+++ people/sigurdne/modules/projects/trunk/inc/class.soprojects.inc.php	2010-02-07 10:44:40 UTC (rev 21023)
@@ -919,10 +919,10 @@
 					$column = 'project_id';
 					$equal  = '=';
 			}
-			$this->db->query('SELECT count(*) from phpgw_p_projects where ' . $column . '=' . $column_val . $editexists,__LINE__,__FILE__);
+			$this->db->query('SELECT count(*) as cnt from phpgw_p_projects where ' . $column . '=' . $column_val . $editexists,__LINE__,__FILE__);
 			$this->db->next_record();
 
-			if ( $this->db->f(0) )
+			if ( $this->db->f('cnt') )
 			{
 				return true;
 			}
@@ -968,9 +968,9 @@
 		{
 			$prefix = 'P-' . $this->year . '-';
 
-			$this->db->query("select max(p_number) from phpgw_p_projects where p_number like ('$prefix%') and parent=0");
+			$this->db->query("select max(p_number) as current from phpgw_p_projects where p_number like ('$prefix%') and parent=0");
 			$this->db->next_record();
-			$max = $this->add_leading_zero( substr( $this->db->f(0), -4 ) );
+			$max = $this->add_leading_zero( substr( $this->db->f('current'), -4 ) );
 
 			return $prefix . $max;
 		}
@@ -988,9 +988,9 @@
 			$this->db->next_record();
 			$prefix = $this->db->f('p_number') . '/';
 
-			$this->db->query("select max(p_number) from phpgw_p_projects where p_number like ('$prefix%')");
+			$this->db->query("select max(p_number) as current from phpgw_p_projects where p_number like ('$prefix%')");
 			$this->db->next_record();
-			$max = $this->add_leading_zero( substr( $this->db->f(0), -4 ) );
+			$max = $this->add_leading_zero( substr( $this->db->f('current'), -4 ) );
 
 			return $prefix . $max;
 		}
@@ -999,9 +999,9 @@
 		{
 			$prefix = 'A-' . $this->year . '-';
 
-			$this->db->query("select max(a_number) from phpgw_p_activities where a_number like ('$prefix%')");
+			$this->db->query("select max(a_number) as current from phpgw_p_activities where a_number like ('$prefix%')");
 			$this->db->next_record();
-			$max = $this->add_leading_zero( substr( $this->db->f(0), -4 ) );
+			$max = $this->add_leading_zero( substr( $this->db->f('current'), -4 ) );
 
 			return $prefix . $max;
 		}
@@ -1009,9 +1009,9 @@
 		function create_deliveryid()
 		{
 			$prefix = 'D-' . $this->year . '-';
-			$this->db->query("select max(d_number) from phpgw_p_delivery where d_number like ('$prefix%')");
+			$this->db->query("select max(d_number) as current from phpgw_p_delivery where d_number like ('$prefix%')");
 			$this->db->next_record();
-			$max = $this->add_leading_zero( substr( $this->db->f(0), -4 ) );
+			$max = $this->add_leading_zero( substr( $this->db->f('current'), -4 ) );
 
 			return $prefix . $max;
 		}
@@ -1019,9 +1019,9 @@
 		function create_invoiceid()
 		{
 			$prefix = 'I-' . $this->year . '-';
-			$this->db->query("select max(i_number) from phpgw_p_invoice where i_number like ('$prefix%')");
+			$this->db->query("select max(i_number) as current from phpgw_p_invoice where i_number like ('$prefix%')");
 			$this->db->next_record();
-			$max = $this->add_leading_zero( substr( $this->db->f(0), -4 ) );
+			$max = $this->add_leading_zero( substr( $this->db->f('current'), -4 ) );
 
 			return $prefix . $max;
 		}
@@ -1290,7 +1290,7 @@
 
 			if ( $this->db->f($item_id) )
 			{
-				return $this->db->f(0);
+				return $this->db->f($item_id);
 			}
 		}
 
@@ -1322,7 +1322,7 @@
 			$this->db->query( "SELECT $item FROM $table WHERE $column=" . $item_id,__LINE__,__FILE__ );
 			if ( $this->db->next_record() )
 			{
-				return $this->db->f(0);
+				return $this->db->f($item);
 			}
 		}
 
@@ -1401,7 +1401,7 @@
 			{
 				while( $this->db->next_record() )
 				{
-					$location = ltrim($this->db->f(0), '.'); 
+					$location = ltrim($this->db->f('name'), '.'); 
 					$parts = explode('.', $location);
 					$projects[] = $parts[1];
 				}
@@ -1469,7 +1469,7 @@
 
 			while($this->db->next_record())
 			{
-				$members[] = $this->db->f(0);
+				$members[] = $this->db->f('acl_account');
 			}
 
 			if (is_array($members) && in_array($this->account,$members))

Modified: people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php	2010-02-07 10:44:14 UTC (rev 21022)
+++ people/sigurdne/modules/projects/trunk/setup/tables_update.inc.php	2010-02-07 10:44:40 UTC (rev 21023)
@@ -33,9 +33,9 @@
 	{
 		$GLOBALS['phpgw_setup']->db->HaltOnError = False;
 
-		$GLOBALS['phpgw_setup']->db->query("SELECT COUNT($column) FROM $table");
+		$GLOBALS['phpgw_setup']->db->query("SELECT COUNT($column) as cnt FROM $table");
 		$GLOBALS['phpgw_setup']->db->next_record();
-		if (!$GLOBALS['phpgw_setup']->db->f(0))
+		if (!$GLOBALS['phpgw_setup']->db->f('cnt'))
 		{
 			if ($GLOBALS['DEBUG']) { echo '<br>' . $table . ' has no column named ' . $column; }
 			return False;