fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10769] logistic: allokation


From: Sigurd Nes
Subject: [Fmsystem-commits] [10769] logistic: allokation
Date: Thu, 07 Feb 2013 10:28:08 +0000

Revision: 10769
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10769
Author:   sigurdne
Date:     2013-02-07 10:28:07 +0000 (Thu, 07 Feb 2013)
Log Message:
-----------
logistic: allokation

Modified Paths:
--------------
    trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
    trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
    trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
    trunk/logistic/setup/phpgw_no.lang
    trunk/logistic/setup/setup.inc.php
    trunk/logistic/setup/tables_current.inc.php
    trunk/logistic/setup/tables_update.inc.php
    trunk/logistic/templates/base/allocation/book_resources.xsl

Modified: trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php  
2013-02-06 12:38:56 UTC (rev 10768)
+++ trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php  
2013-02-07 10:28:07 UTC (rev 10769)
@@ -45,33 +45,60 @@
 
                protected function add(&$resource_alloc)
                {
-                       $cols = array(
-                               'requirement_id',
-                               'resource_id',
-                               'location_id',
-                               'create_user',
-                               'create_date'
-                       );
+                       $this->db->transaction_begin();
 
-                       $values = array(
-                               
$this->marshal($resource_alloc->get_requirement_id(), 'int'),
-                               
$this->marshal($resource_alloc->get_resource_id(), 'int'),
-                               
$this->marshal($resource_alloc->get_location_id(), 'int'),
-                               
$this->marshal($resource_alloc->get_create_user(), 'int'),
-                               $this->marshal(strtotime('now'), 'int')
+                       $value_set = array
+                       (
+                               'location_id'           => 
$resource_alloc->get_location_id(),
+                               'item_id'                       => 
$this->marshal($resource_alloc->get_resource_id(), 'int'),
+                               'activity_id'           => 
$this->marshal($resource_alloc->get_activity_id(), 'int'),
+                               'allocation_id'         => 0,//not known yet
+                               'create_user'           => 
$resource_alloc->get_create_user(),
+                               'create_date'           => time(),
+                               'start_date'            => 
$resource_alloc->get_start_date(),
+                               'end_date'                      => 
$resource_alloc->get_end_date(),
                        );
 
-                       $sql = 'INSERT INTO lg_requirement_resource_allocation 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')';
+                       $sql = 'INSERT INTO lg_calendar (' . implode(',', 
array_keys($value_set)) . ') VALUES (' . implode(',', array_values($value_set)) 
. ')';
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
                        if($result)
                        {
-                               return 
$this->db->get_last_insert_id('lg_requirement_resource_allocation', 'id');
+                               $calendar_id = 
$this->db->get_last_insert_id('lg_calendar', 'id');
                        }
                        else
                        {
                                return 0;
                        }
+
+                       $value_set = array
+                       (
+                               'requirement_id'        => 
$this->marshal($resource_alloc->get_requirement_id(), 'int'),
+                               'resource_id'           => 
$this->marshal($resource_alloc->get_resource_id(), 'int'),
+                               'location_id'           => 
$this->marshal($resource_alloc->get_location_id(), 'int'),
+       //                      'start_date'            => 
$this->marshal($resource_alloc->get_start_date(), 'int'),
+       //                      'end_date'                      => 
$this->marshal($resource_alloc->get_end_date(), 'int'),
+                               'create_user'           => 
$this->marshal($resource_alloc->get_create_user(), 'int'),
+                               'create_date'           => time(),
+                               'calendar_id'           => $calendar_id
+                       );
+
+                       $sql = 'INSERT INTO lg_requirement_resource_allocation 
(' . implode(',', array_keys($value_set)) . ') VALUES (' . implode(',', 
array_values($value_set)) . ')';
+                       $result = $this->db->query($sql, __LINE__,__FILE__);
+
+                       if($result)
+                       {
+                               $allocation_id =  
$this->db->get_last_insert_id('lg_requirement_resource_allocation', 'id');
+                               $this->db->query("UPDATE lg_calendar SET 
allocation_id = {$allocation_id} WHERE id = {$calendar_id}", __LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $allocation_id = 0;
+                       }
+
+                       $this->db->transaction_commit();
+
+                       return $allocation_id;
                }
 
                protected function update($resource_alloc)
@@ -183,37 +210,76 @@
                        return $allocation;
                }
                
-               function delete($resource_allocation_id)
+
+               /**
+               * Finds allocated items within timespan
+               *
+               */
+               public function check_calendar($location_id = 0, $ids = 
array(), $start_date, $end_date)
                {
-                       $resource_allocation_id = (int) $resource_allocation_id;
-                       $status = $this->db->query("DELETE FROM 
lg_requirement_resource_allocation WHERE id = $resource_allocation_id");
-                                       
-                       if( $status )
+                       $location_id = (int)$location_id;
+                       $values = array();
+                       $items = array();
+                       
+                       if (!$ids)
                        {
-                               return true;
+                               return $values;
                        }
-                       else
+                       $sql = "SELECT item_id, activity_id, allocation_id, 
start_date, end_date FROM lg_calendar"
+                       . " WHERE location_id = {$location_id}"
+                       . " AND item_id IN (" . implode(',', $ids) . ')'
+                       . " AND end_date >= {$start_date} AND start_date <= 
{$end_date}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
                        {
-                               return false;
+                               $item_id = $this->db->f('item_id');
+                               $items[$item_id] = true;
+                               $values[$item_id][] = array
+                               (
+                                       'start_date'    => 
$this->db->f('start_date'),
+                                       'end_date'              => 
$this->db->f('end_date'),
+                                       'activity_id'   => 
$this->db->f('activity_id'),
+                                       'allocation_id' => 
$this->db->f('allocation_id'),
+                                       'item_id'               => $item_id
+                               );
                        }
+                       return array('calendar' => $values, 'items' => $items);
                }
+
+               function delete($resource_allocation_id)
+               {
+                       $this->db->transaction_begin();
+
+                       $resource_allocation_id = (int) $resource_allocation_id;
+                       $this->db->query("DELETE FROM 
lg_requirement_resource_allocation WHERE id = $resource_allocation_id");
+                       $this->db->query("DELETE FROM lg_calendar WHERE 
allocation_id = $resource_allocation_id");
+
+                       return !!$this->db->transaction_commit();
+               }
                
                public function delete_resources($requirement_id)
                {
                        
                        echo "i delete_resources: " . $requirement_id;
                        
+                       $this->db->transaction_begin();
+
                        $requirement_id = (int) $requirement_id;
-                       $status = $this->db->query("DELETE FROM 
lg_requirement_resource_allocation WHERE requirement_id = $requirement_id");
-                                       
-                       if( $status )
+                       $this->db->query("SELECT id FROM 
lg_requirement_resource_allocation WHERE requirement_id = 
$requirement_id",__LINE__,__FILE__);
+                       $ids = array();
+                       while ($this->db->next_record())
                        {
-                               return true;
+                               $ids[] = $this->db->f('id');
                        }
-                       else
+                       
+                       if($ids)
                        {
-                               return false;
+                               $this->db->query("DELETE FROM lg_calendar WHERE 
allocation_id = IN ( " . explode(',', $id) . ')',__LINE__,__FILE__);
                        }
+                       $this->db->query("DELETE FROM 
lg_requirement_resource_allocation WHERE requirement_id = 
$requirement_id",__LINE__,__FILE__);
+
+                       return !!$this->db->transaction_commit();
                }
 
                public static function get_instance()

Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-02-06 12:38:56 UTC (rev 10768)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-02-07 10:28:07 UTC (rev 10769)
@@ -297,22 +297,10 @@
                                $allocation = new 
logistic_requirement_resource_allocation();
                        }
 
-                       $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
+//                     $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
 
                        if($requirement)
                        {
-// find allocated
-                               $allocated_objects = $this->so->get(null, null, 
null, null, null, null, array('requirement_id' => $requirement->get_id()));
-                               
-                               $allocated = array();
-                               if($allocated_objects)
-                               {
-                                       foreach ($allocated_objects as 
$allocated_object)
-                                       {
-                                               $allocated[] = 
$allocated_object->get_resource_id();
-                                       }
-                               }
-//
                                $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
 
                                $criterias_array = array();
@@ -365,10 +353,54 @@
                        }
                    
                        $allocation_suggestions = 
execMethod('property.soentity.get_eav_list', $criterias_array);
+
+//Start fuzzy
+                       $suggestion_ids = array();
+
+
+                       foreach ($allocation_suggestions as 
$allocation_suggestion)
+                       {
+                               $suggestion_ids[] = 
$allocation_suggestion['id'];
+                       }
+
+                       reset($allocation_suggestions);
+
+                       $allocated = $this->so->check_calendar($location_id, 
$suggestion_ids, $requirement->get_start_date(), $requirement->get_end_date() );
+//_debug_array($allocated);die();
+//end fuzzy
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $activities = array();
                        
                        foreach ($allocation_suggestions as 
&$allocation_suggestion)
                        {
-                               $allocation_suggestion['allocated'] = 
in_array($allocation_suggestion['id'],$allocated);
+                               
if(isset($allocated['items'][$allocation_suggestion['id']]))
+                               {
+                                       $allocation_suggestion['allocated'] = 
true;
+                                       $allocated_where = array();
+                                       $allocated_date = array();
+                                       foreach 
($allocated['calendar'][$allocation_suggestion['id']] as $calendar_entry)
+                                       {
+                                               $allocated_date[] = 
$GLOBALS['phpgw']->common->show_date($calendar_entry['start_date'] ,$dateformat)
+                                                                               
        . ' - ' . 
$GLOBALS['phpgw']->common->show_date($calendar_entry['end_date'] ,$dateformat);
+
+                                               
if(!isset($activities[$calendar_entry['activity_id']]))
+                                               {
+                                                       
$activities[$calendar_entry['activity_id']] = $this->so_activity->get_single( 
$calendar_entry['activity_id'] );
+                                               }
+                                               
+                                               
if($activities[$calendar_entry['activity_id']])
+                                               {
+                                                       $allocated_where[] = 
$activities[$calendar_entry['activity_id']]->get_name();
+                                               }
+                                               else
+                                               {
+                                                       $allocated_where[] = 
'N/A';
+                                               }
+                                       }
+
+                                       
$allocation_suggestion['allocated_date'] = implode('; ', $allocated_date);
+                                       
$allocation_suggestion['allocated_where'] = implode('; ', $allocated_where);
+                               }
                        }
 
                        $activity = $this->so_activity->get_single( 
$requirement->get_activity_id() );
@@ -392,6 +424,7 @@
                        if($requirement_id && is_numeric($requirement_id))
                        {
                                $requirement = 
$this->so_requirement->get_single($requirement_id);
+                               $activity_id = $requirement->get_activity_id();
                        }
 
                        $user_id = $GLOBALS['phpgw_info']['user']['id'];
@@ -406,6 +439,7 @@
 
                        if( count($chosen_resources) <=  $num_allowed_bookings)
                        {
+
                                foreach($chosen_resources as $resource_id)
                                {
                                        $resource_alloc = new 
logistic_requirement_resource_allocation();
@@ -413,11 +447,14 @@
                                        $resource_alloc->set_resource_id( 
$resource_id );
                                        $resource_alloc->set_location_id( 
$requirement->get_location_id() );
                                        $resource_alloc->set_create_user( 
$user_id );
+                                       $resource_alloc->set_start_date( 
$requirement->get_start_date() );
+                                       $resource_alloc->set_end_date( 
$requirement->get_start_date() );
+                                       $resource_alloc->set_activity_id( 
$activity_id );
 
                                        $resource_alloc_id = $this->so->store( 
$resource_alloc );
                                }
 
-                               $activity = 
$this->so_activity->get_single($requirement->get_activity_id()); 
+//                             $activity = 
$this->so_activity->get_single($requirement->get_activity_id()); 
 
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiactivity.view_resource_allocation', 
'activity_id' => $requirement->get_activity_id()));
                        }
@@ -433,10 +470,12 @@
 
                        $status = $this->so->delete($resource_allocation_id);
 
-                       if($status){
+                       if($status)
+                       {
                                return json_encode( array( "status" => 
"deleted" ) );
                        }
-                       else{
+                       else
+                       {
                                return json_encode( array( "status" => 
"not_deleted" ) );
                        }
                } 

Modified: trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php      
2013-02-06 12:38:56 UTC (rev 10768)
+++ trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php      
2013-02-07 10:28:07 UTC (rev 10769)
@@ -43,6 +43,9 @@
                protected $location_code;
                protected $fm_bim_item_address;
                protected $fm_bim_item_name;
+               protected $start_date;
+               protected $end_date;
+               protected $activity_id;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -145,6 +148,37 @@
                        return $this->fm_bim_item_name;
                }
 
+
+               public function set_end_date($end_date)
+               {
+                       $this->end_date = $end_date;
+               }
+
+               public function get_end_date()
+               {
+                       return $this->end_date;
+               }
+
+               public function set_start_date($start_date)
+               {
+                       $this->start_date = $start_date;
+               }
+
+               public function get_start_date()
+               {
+                       return $this->start_date;
+               }
+
+               public function set_activity_id($activity_id)
+               {
+                       $this->activity_id = $activity_id;
+               }
+
+               public function get_activity_id()
+               {
+                       return $this->activity_id;
+               }
+
                /**
                * Get a static reference to the storage object associated with 
this model object
                *
@@ -162,14 +196,16 @@
                public function serialize()
                {
                        return array(
-                               'id'                                            
                        => $this->get_id(),
-                               'resource_type_descr' => 
$this->get_resource_type_descr(),
-                               'requirement_id'                        => 
$this->get_requirement_id(),
-                               'resource_id'                           => 
$this->get_resource_id(),
-                               'location_id'                                   
=> $this->get_location_id(),
-                               'location_code'                         => 
$this->get_location_code(),
+                               'id'                                    => 
$this->get_id(),
+                               'resource_type_descr'   => 
$this->get_resource_type_descr(),
+                               'requirement_id'                => 
$this->get_requirement_id(),
+                               'resource_id'                   => 
$this->get_resource_id(),
+                               'location_id'                   => 
$this->get_location_id(),
+                               'location_code'                 => 
$this->get_location_code(),
                                'fm_bim_item_address'   => 
$this->get_fm_bim_item_address(),
-                               'fm_bim_item_name'              => 
$this->get_fm_bim_item_name()
+                               'fm_bim_item_name'              => 
$this->get_fm_bim_item_name(),
+                               'start_date'                    => 
$this->get_start_date(),
+                               'end_date'                              => 
$this->get_end_date()
                        );
                }
-       }
\ No newline at end of file
+       }

Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang  2013-02-06 12:38:56 UTC (rev 10768)
+++ trunk/logistic/setup/phpgw_no.lang  2013-02-07 10:28:07 UTC (rev 10769)
@@ -112,4 +112,6 @@
 Start date     logistic        no      Startdato
 End date       logistic        no      Sluttdato
 Responsible person     logistic        no      Ansvarlig bruker
-Responsible person for activity        logistic        no      Angi hvilken 
person som skal være ansvarlig for aktiviteten
\ No newline at end of file
+Responsible person for activity        logistic        no      Angi hvilken 
person som skal være ansvarlig for aktiviteten
+allocated date logistic        no      Allokert når
+allocated where        logistic        no      Allokert hvor

Modified: trunk/logistic/setup/setup.inc.php
===================================================================
--- trunk/logistic/setup/setup.inc.php  2013-02-06 12:38:56 UTC (rev 10768)
+++ trunk/logistic/setup/setup.inc.php  2013-02-07 10:28:07 UTC (rev 10769)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['logistic']['name'] = 'logistic';
-       $setup_info['logistic']['version'] = '0.0.4';
+       $setup_info['logistic']['version'] = '0.0.5';
        $setup_info['logistic']['app_order'] = 70;
        $setup_info['logistic']['enable'] = 1;
        $setup_info['logistic']['app_group']    = 'office';

Modified: trunk/logistic/setup/tables_current.inc.php
===================================================================
--- trunk/logistic/setup/tables_current.inc.php 2013-02-06 12:38:56 UTC (rev 
10768)
+++ trunk/logistic/setup/tables_current.inc.php 2013-02-07 10:28:07 UTC (rev 
10769)
@@ -6,7 +6,7 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(),
@@ -20,9 +20,9 @@
                                                'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'description' => array('type' 
=> 'text', 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'start_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
-                                               'end_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
+                                               'start_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => true),
+                                               'end_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => true),
                                ),
                                'pk' => array('id'),
                                'fk' => array('lg_project_type' => 
array('project_type_id' => 'id')),
@@ -36,13 +36,13 @@
                                                'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
                                                'description' => array('type' 
=> 'text', 'nullable' => false),
                                                'project_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
-                                               'start_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
-                                               'end_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
+                                               'start_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => true),
+                                               'end_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => true),
                                                'responsible_user_id' => 
array('type' => 'int', 'precision' => 4, 'nullable'=> false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                                'update_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'update_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false)
+                                               'update_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false)
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -56,12 +56,12 @@
                                'fd' => array(
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'activity_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'start_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
-                                               'end_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'start_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => false),
+                                               'end_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => false),
                                                'no_of_elements' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -77,13 +77,15 @@
                                                'requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'resource_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'calendar_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
                                                'lg_requirement' => 
array('requirement_id' => 'id'),
-                                               'phpgw_locations' => 
array('location_id' => 'location_id')
+                                               'phpgw_locations' => 
array('location_id' => 'location_id'),
+                                               'lg_calendar' => 
array('calendar_id' => 'id')
                                ),
                                'ix' => array(),
                                'uc' => array()
@@ -95,7 +97,7 @@
                                                'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'cust_attribute_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -112,7 +114,7 @@
                                                'operator' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
                                                'value' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
                                                'cust_attribute_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
@@ -127,8 +129,12 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'item_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'activity_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'allocation_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
-                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 8, 'nullable' => false),
+                                               'start_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => false),
+                                               'end_date' => array('type' => 
'int', 'precision' => 8, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(

Modified: trunk/logistic/setup/tables_update.inc.php
===================================================================
--- trunk/logistic/setup/tables_update.inc.php  2013-02-06 12:38:56 UTC (rev 
10768)
+++ trunk/logistic/setup/tables_update.inc.php  2013-02-07 10:28:07 UTC (rev 
10769)
@@ -58,4 +58,118 @@
                        return $GLOBALS['setup_info']['logistic']['currentver'];
                }
        }
+
+       $test[] = '0.0.4';
+       function logistic_upgrade0_0_4()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_project_type','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_project','start_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_project','end_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_project','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_activity','start_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_activity','end_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_activity','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_activity','update_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_requirement','start_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_requirement','end_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_requirement','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_requirement_resource_allocation','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_resource_type_requirement','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_requirement_value','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('lg_calendar','create_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','start_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','end_date',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => false
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','activity_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','allocation_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true
+               ));
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_requirement_resource_allocation','calendar_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => false,
+                       'default' => 0//FIXME
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['logistic']['currentver'] = 
'0.0.5';
+                       return $GLOBALS['setup_info']['logistic']['currentver'];
+               }
+       }
        

Modified: trunk/logistic/templates/base/allocation/book_resources.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/book_resources.xsl 2013-02-06 
12:38:56 UTC (rev 10768)
+++ trunk/logistic/templates/base/allocation/book_resources.xsl 2013-02-07 
10:28:07 UTC (rev 10769)
@@ -78,6 +78,12 @@
                                                        <span 
class="loc_id">Lokasjons id</span>
                                                <!--    <span 
class="type">Type</span> -->
                                                        <span 
class="loc_code">Lokasjons kode</span>
+                                                       <span class="loc_code">
+                                                               <xsl:value-of 
select="php:function('lang', 'allocated date')"/>
+                                                       </span>
+                                                       <span class="loc_code">
+                                                               <xsl:value-of 
select="php:function('lang', 'allocated where')"/>
+                                                       </span>
                                        </div>
                                        <xsl:for-each 
select="allocation_suggestions">
                                                
@@ -100,6 +106,8 @@
                                                        <span 
class="loc_id"><xsl:value-of select="location_id" /></span>
                                                <!--    <span 
class="type"><xsl:value-of select="type_lokale" /></span> -->
                                                        <span 
class="loc_code"><xsl:value-of select="location_code" /></span>
+                                                       <span 
class="loc_code"><xsl:value-of select="allocated_date" /></span>
+                                                       <span 
class="loc_code"><xsl:value-of select="allocated_where" /></span>
                                                </div>
                                        </xsl:for-each>
                                </div>                  




reply via email to

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