fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6529] merge 6525:6528 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6529] merge 6525:6528 from trunk
Date: Mon, 01 Nov 2010 18:05:53 +0000

Revision: 6529
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6529
Author:   sigurdne
Date:     2010-11-01 18:05:52 +0000 (Mon, 01 Nov 2010)
Log Message:
-----------
merge 6525:6528 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/setup/default_records.inc.php
    branches/Version-1_0-branch/booking/setup/tables_current.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.menu.inc.php
    branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528

Modified: branches/Version-1_0-branch/booking/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/default_records.inc.php   
2010-11-01 13:10:56 UTC (rev 6528)
+++ branches/Version-1_0-branch/booking/setup/default_records.inc.php   
2010-11-01 18:05:52 UTC (rev 6529)
@@ -1,18 +1,24 @@
 <?php
-       $GLOBALS['phpgw_setup']->oProc->query(
-               "CREATE OR REPLACE VIEW bb_document_view ".
-               "AS SELECT bb_document.id AS id, bb_document.name AS name, 
bb_document.owner_id AS owner_id, bb_document.category AS category, 
bb_document.description AS description, bb_document.type AS type ".
-               "FROM ". 
-                       "((SELECT *, 'building' as type from 
bb_document_building) UNION ALL (SELECT *, 'resource' as type from 
bb_document_resource)) ".
-               "as bb_document;"
-       );
+       switch ( $GLOBALS['phpgw_info']['server']['db_type'] )
+       {
+               case 'postgres':
+                       $GLOBALS['phpgw_setup']->oProc->query(
+                               "CREATE OR REPLACE VIEW bb_document_view ".
+                               "AS SELECT bb_document.id AS id, 
bb_document.name AS name, bb_document.owner_id AS owner_id, 
bb_document.category AS category, bb_document.description AS description, 
bb_document.type AS type ".
+                               "FROM ". 
+                                       "((SELECT *, 'building' as type from 
bb_document_building) UNION ALL (SELECT *, 'resource' as type from 
bb_document_resource)) ".
+                               "as bb_document;"
+                       );
 
-       $GLOBALS['phpgw_setup']->oProc->query(
-               "CREATE OR REPLACE VIEW bb_application_association AS ".
-               "SELECT 'booking' AS type, application_id, id, from_, to_ FROM 
bb_booking WHERE application_id IS NOT NULL ".
-               "UNION ".
-               "SELECT 'allocation' AS type, application_id, id, from_, to_ 
FROM bb_allocation  WHERE application_id IS NOT NULL ".
-               "UNION ".
-               "SELECT 'event' AS type, application_id, id, from_, to_ FROM 
bb_event  WHERE application_id IS NOT NULL"
-       );
-
+                       $GLOBALS['phpgw_setup']->oProc->query(
+                               "CREATE OR REPLACE VIEW 
bb_application_association AS ".
+                               "SELECT 'booking' AS type, application_id, id, 
from_, to_ FROM bb_booking WHERE application_id IS NOT NULL ".
+                               "UNION ".
+                               "SELECT 'allocation' AS type, application_id, 
id, from_, to_ FROM bb_allocation  WHERE application_id IS NOT NULL ".
+                               "UNION ".
+                               "SELECT 'event' AS type, application_id, id, 
from_, to_ FROM bb_event  WHERE application_id IS NOT NULL"
+                       );
+                       break;
+               default:
+                       //do nothing for now
+       }

Modified: branches/Version-1_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2010-11-01 13:10:56 UTC (rev 6528)
+++ branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2010-11-01 18:05:52 UTC (rev 6529)
@@ -166,8 +166,8 @@
                                'active' => array('type' => 'int', 'nullable' 
=> False,'precision' => '4', 'default' => 1),
                                'display_in_dashboard' => array('type' => 
'int', 'nullable' => False, 'precision' => '4', 'default' => 1),
                                'status' => array('type' => 'text', 
'nullable'=> False),
-                               'created' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'now'),
-                               'modified' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'now'),
+                               'created' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'current_timestamp'),
+                               'modified' => array('type' => 'timestamp', 
'nullable'=> False),
                                'frontend_modified' => array('type' => 
'timestamp', 'nullable'=> True),
                                'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'activity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
@@ -331,7 +331,7 @@
                                'time' => array('type' => 'timestamp', 
'nullable' => False),
                                'author' => array('type' => 'text', 'nullable' 
=> False),
                                'comment' => array('type' => 'text', 'nullable' 
=> False),
-                               'type' => array('type' => 'text', 'nullable' => 
False, 'default'=>'comment'),
+                               'type' => array('type' => 'varchar',  
'precision' => '20', 'nullable' => false, 'default' => 'comment'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(
@@ -586,7 +586,7 @@
                                'time' => array('type' => 'timestamp', 
'nullable' => False),
                                'author' => array('type' => 'text', 'nullable' 
=> False),
                                'comment' => array('type' => 'text', 'nullable' 
=> False),
-                               'type' => array('type' => 'text', 'nullable' => 
False, 'default'=>'comment'),
+                               'type' => array('type' => 'varchar',  
'precision' => '20', 'nullable' => false, 'default' => 'comment'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(
@@ -733,7 +733,7 @@
                'bb_billing_sequential_number_generator' => array(
                        'fd' => array(
                                'id'            => array('type' => 'auto', 
'nullable' => False),
-                               'name'   => array('type' => 'text', 'nullable' 
=> False),
+                               'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => False),// FIXME
                                'value' => array('type' => 'int', 'precision' 
=> '4', 'nullable' => False, 'default' => 0),
                        ),
                        'pk' => array('id'),
@@ -752,8 +752,8 @@
                                'phone' => array('type' => 
'varchar','precision' => '50','nullable' => true),
                                'email' => array('type' => 
'varchar','precision' => '50','nullable' => true),
                                'message' => array('type' => 'text', 'nullable' 
=> False),
-                               'type' => array('type' => 'text', 'nullable' => 
False, 'default'=>'message'),
-                               'status' => array('type' => 'text', 'nullable' 
=> False, 'default'=>'NEW'),
+                               'type' => array('type' => 'varchar',  
'precision' => '20', 'nullable' => false, 'default' => 'comment'),
+                               'status' => array('type' => 'varchar',  
'precision' => '20', 'nullable' => false, 'default' => 'NEW'),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.menu.inc.php 2010-11-01 
13:10:56 UTC (rev 6528)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.menu.inc.php 2010-11-01 
18:05:52 UTC (rev 6529)
@@ -343,6 +343,15 @@
                public function get_local_menu($app = '')
                {
                        $app = $app ? $app : 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       switch ( $app )
+                       {
+                               case 'home':
+                               case 'login':
+                                       return array();
+                               default:
+                                       // nothing
+                       }
+
                        if(!$menu = 
$GLOBALS['phpgw']->session->appsession($GLOBALS['phpgw_info']['flags']['menu_selection'],
 "menu_{$app}"))
                        {
                                $menu_gross = 
execMethod("{$app}.menu.get_menu",'horisontal');

Modified: branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php   
2010-11-01 13:10:56 UTC (rev 6528)
+++ branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php   
2010-11-01 18:05:52 UTC (rev 6529)
@@ -70,7 +70,7 @@
                
                
                
-               public function result_unit_exist($result_unit)
+               public function result_unit_exist($result_unit, $level)
                {
                        if(isset($result_unit) && is_numeric($result_unit))
                        {
@@ -78,6 +78,7 @@
                                $table = "V_ORG_ENHET";
                                $db = $this->get_db();
                                $sql = "SELECT $column FROM $table WHERE 
V_ORG_ENHET.RESULTATENHET = $result_unit";
+                               if($level) $sql = "$sql AND 
V_ORG_ENHET.ORG_NIVAA = $level";
                                $db->query($sql,__LINE__,__FILE__);
                                if($db->next_record())
                                {
@@ -90,7 +91,7 @@
                        return false;
                }
                
-               public function org_unit_exist($org_unit_id)
+               public function org_unit_exist($org_unit_id, $level)
                {
                        if(isset($org_unit_id) && is_numeric($org_unit_id))
                        {
@@ -98,6 +99,7 @@
                                $table = "V_ORG_ENHET";
                                $db = $this->get_db();
                                $sql = "SELECT $column FROM $table WHERE 
V_ORG_ENHET.ORG_ENHET_ID = $org_unit_id";
+                               if($level) $sql = "$sql AND 
V_ORG_ENHET.ORG_NIVAA = $level";
                                $db->query($sql,__LINE__,__FILE__);
                                if($db->next_record())
                                {

Modified: branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2010-11-01 13:10:56 UTC (rev 6528)
+++ branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2010-11-01 18:05:52 UTC (rev 6529)
@@ -172,7 +172,7 @@
        {
                $bofelles = rental_bofellesdata::get_instance();
                
-               $result_objects = rental_soparty::get_instance()->get();
+               $parties = rental_soparty::get_instance()->get();
                $result_count = rental_soparty::get_instance()->get_count();
                
                echo "Total number of parties: {$result_count}";
@@ -183,73 +183,46 @@
                        $count_result_unit_number = 0;
                        $count_identifier = 0;
                        $count_responsibility = 0;
-                       $unit_found = false;
-                       
-                       //for all parties
-                       foreach ($result_objects as $party) {
+
+                       foreach ($parties as $party) {
                                $unit_found = false;
-                               //if the party is an has not set "org_enhet_id"
-                               if(isset($party) && !$party->get_org_enhet_id())
-                               {
-                                       $serialized = 
$party->serialize($contract);
+                               $fellesdata = NULL;
+
+                               if(isset($party)) {
                                        $sync_data = $party->get_sync_data();
 
-                                       //find a relevant org_enehet_id
-                                       $unit_name_and_id = 
$bofelles->result_unit_exist($sync_data['result_unit_number']);
-                                       if(!$unit_name_and_id)
-                                       {
-                                               $unit_name_and_id = 
$bofelles->result_unit_exist($party->get_identifier());
-                                       }
-                                       else{
+                                       $fellesdata = 
$bofelles->result_unit_exist($sync_data['result_unit_number'],4);
+                                       if ($fellesdata) {
+                                               echo "Unit id found 
{$fellesdata['UNIT_ID']} by result unit number check. The unit name is 
{$fellesdata['UNIT_NAME']}<br />";
                                                $count_result_unit_number++;
-                                               
-                                               $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
-                                               $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
-                                               echo "Unit id found 
{$unit_id_echo} by result unit number check. The unit name is 
{$unit_name_echo}";
-                                               
-                                               $unit_found = true;
-                                       }
-                                       
-                                       if(!$unit_name_and_id)
-                                       {
-                                               $unit_name_and_id = 
$bofelles->responsibility_id_exist($sync_data['responsibility_id']);
-                                       }
-                                       else if(!$unit_found){
-                                               $count_identifier++;
-                                               $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
-                                               $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
-                                               echo "Unit id found 
{$unit_id_echo} by identifier check. The unit name is {$unit_name_echo}";
-                                               $unit_found = true;
-                                       }
-                                       
-                                       if(isset($unit_name_and_id))
-                                       {
-                                               if(!$unit_found){
-                                                       $unit_id_echo = 
$unit_name_and_id['UNIT_ID'];
-                                                       $unit_name_echo = 
$unit_name_and_id['UNIT_NAME'];
-                                                       echo "Unit id found 
{$unit_id_echo} by responsibility id check. The unit name is {$unit_name_echo}";
-                                                       $count_responsibility++;
+                                       } else {
+                                               $fellesdata = 
$bofelles->result_unit_exist($party->get_identifier(),4);
+                                               if ($fellesdata) {
+                                                       echo "Unit id found 
{$fellesdata['UNIT_ID']} by identifier check. The unit name is 
{$fellesdata['UNIT_NAME']}<br />";
+                                                       $count_identifier++;
+                                               } else {
+                                                       $fellesdata = 
$bofelles->responsibility_id_exist($sync_data['responsibility_id']);
+                                                       if ($fellesdata) {
+                                                               echo "Unit id 
found {$fellesdata['UNIT_ID']} by responsibility id check. The unit name is 
{$fellesdata['UNIT_NAME']}<br />";
+                                                               
$count_responsibility++;
+                                                       }
                                                }
-                                               
-                                               $unit_id = 
$unit_name_and_id['UNIT_ID'];
-                                               $unit_name = 
$unit_name_and_id['UNIT_NAME'];
-                                               
-                                               //if unit_id is found set it to 
the party
-                                               if(isset($unit_id) && 
is_numeric($unit_id))
-                                               {
-                                                       
$party->set_org_enhet_id($unit_id);
-                                                       
rental_soparty::get_instance()->store($party);
-                                                       $count++;
-                                               }
                                        }
+
+                                       if ($fellesdata && 
isset($fellesdata['UNIT_ID']) && is_numeric($fellesdata['UNIT_ID'])) {
+                                               
$party->set_org_enhet_id($unit_id);
+                                               
rental_soparty::get_instance()->store($party);
+                                       }
                                }
                        }
-                       echo "Number of parties found through result unit 
number {$count_result_unit_number}";
-                       echo "Number of parties found through identifier 
{$count_identifier}";
-                       echo "Number of parties found through responsibility id 
{$count_responsibility}";
-                       echo "Number of parties that have been updated 
{$count}";
+
+                       echo "Number of parties found through result unit 
number {$count_result_unit_number}<br />";
+                       echo "Number of parties found through identifier 
{$count_identifier}<br />";
+                       echo "Number of parties found through responsibility id 
{$count_responsibility}<br />";
+                       echo "Number of parties that have been updated 
{$count}<br />";
                }
-       }
+       }
+       
 
        /**
         * Add action links for the context menu of the list item




reply via email to

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