[21191] Improvement: sorting choice values for custom fields, cats at locations 4746:5203

Sigurd Nes <[email protected]> Wed, 14 Apr 2010 19:16:53 +0000
Newsgroups gmane.comp.web.phpgroupware.cvs
Message-ID <[email protected]>
Revision: 21191
          http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=21191
Author:   sigurdne
Date:     2010-04-14 19:16:53 +0000 (Wed, 14 Apr 2010)
Log Message:
-----------
Improvement: sorting choice values for custom fields, cats at locations 4746:5203

Modified Paths:
--------------
    people/sigurdne/modules/phpgwapi/trunk/setup/setup.inc.php
    people/sigurdne/modules/phpgwapi/trunk/setup/tables_current.inc.php
    people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php

Modified: people/sigurdne/modules/phpgwapi/trunk/setup/setup.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/setup/setup.inc.php	2010-04-14 19:13:14 UTC (rev 21190)
+++ people/sigurdne/modules/phpgwapi/trunk/setup/setup.inc.php	2010-04-14 19:16:53 UTC (rev 21191)
@@ -12,7 +12,7 @@
 	// Basic information about this app
 	$setup_info['phpgwapi']['name']      = 'phpgwapi';
 	$setup_info['phpgwapi']['title']     = 'phpgwapi';
-	$setup_info['phpgwapi']['version']   = '0.9.17.525';
+	$setup_info['phpgwapi']['version']   = '0.9.17.527';
 	$setup_info['phpgwapi']['versions']['current_header'] = '1.30';
 	$setup_info['phpgwapi']['versions']['system'] = '1.0';
 	$setup_info['phpgwapi']['enable']    = 3;

Modified: people/sigurdne/modules/phpgwapi/trunk/setup/tables_current.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/setup/tables_current.inc.php	2010-04-14 19:13:14 UTC (rev 21190)
+++ people/sigurdne/modules/phpgwapi/trunk/setup/tables_current.inc.php	2010-04-14 19:16:53 UTC (rev 21191)
@@ -1,7 +1,7 @@
 <?php
 	/**
 	* Setup
-	* @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc. http://www.fsf.org/
+	* @copyright Copyright (C) 2003-2010 Free Software Foundation, Inc. http://www.fsf.org/
 	* @license http://www.gnu.org/licenses/gpl.html GNU General Public License
 	* @package phpgwapi
 	* @subpackage setup
@@ -206,7 +206,8 @@
 				'cat_name' => array('type' => 'varchar','precision' => '150','nullable' => False),
 				'cat_description' => array('type' => 'varchar','precision' => 255,'nullable' => False),
 				'cat_data' => array('type' => 'text'),
-				'last_mod' => array('type' => 'int','precision' => 4,'nullable' => False,'default' => '0')
+				'last_mod' => array('type' => 'int','precision' => 4,'default' => '0','nullable' => False),
+				'location_id' => array('type' => 'int','precision' => 4,'default' => '0','nullable' => True),
 			),
 			'pk' => array('cat_id'),
 			'fk' => array(),
@@ -572,7 +573,8 @@
 				'location_id' => array('type' => 'int','precision' => 4,'nullable' => false),
 				'attrib_id' => array('type' => 'int','precision' => 4,'nullable' => false),
 				'id' => array('type' => 'int','precision' => 4,'nullable' => false),
-				'value' => array('type' => 'text','nullable' => false)
+				'value' => array('type' => 'text','nullable' => false),
+				'choice_sort' => array('type' => 'int','precision' => 4,'nullable' => false, 'default' => 0)
 			),
 			'pk' => array('location_id', 'attrib_id', 'id'),
 			'fk' => array(),

Modified: people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php
===================================================================
--- people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php	2010-04-14 19:13:14 UTC (rev 21190)
+++ people/sigurdne/modules/phpgwapi/trunk/setup/tables_update.inc.php	2010-04-14 19:16:53 UTC (rev 21191)
@@ -1316,7 +1316,7 @@
 		$GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_cust_field_types(cust_field_type_descr) VALUES(\'date\')');
 		$GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_cust_field_types(cust_field_type_descr) VALUES(\'list\')');
 		$GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_cust_field_types(cust_field_type_descr) VALUES(\'db lookup\')');
-		
+
 		if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
 		{
 			$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.17.501';
@@ -1664,7 +1664,7 @@
 		{
 			$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.17.511';
 			return $GLOBALS['setup_info']['phpgwapi']['currentver'];
-		}	
+		}
 	}	
 
 
@@ -1694,7 +1694,7 @@
 			return $GLOBALS['setup_info']['phpgwapi']['currentver'];
 		}
 	}
-
+	
 	$test[] = '0.9.17.512';
 	function phpgwapi_upgrade0_9_17_512()
 	{
@@ -2635,3 +2635,51 @@
 		}
 	}
 
+	$test[] = '0.9.17.525';
+	/**
+	* Add sorting to attribute choice
+	*
+	* @return string the new version number
+	*/
+	function phpgwapi_upgrade0_9_17_525()
+	{
+		$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cust_choice','choice_sort',array(
+			'type' => 'int',
+			'precision' => '4',
+			'nullable' => True,
+			'default'	=> 0
+		));
+
+		if ( $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit() )
+		{
+			$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.17.526';
+			return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+		}
+	}
+
+	$test[] = '0.9.17.526';
+	/**
+	* Add location_id to categories
+	*
+	* @return string the new version number
+	*/
+	function phpgwapi_upgrade0_9_17_526()
+	{
+		$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+		$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_categories','location_id',array(
+			'type' => 'int',
+			'precision' => '4',
+			'nullable' => True,
+			'default'	=> 0
+		));
+
+		if ( $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit() )
+		{
+			$GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.17.527';
+			return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+		}
+	}
+