fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7209] bkbooking: updated filter function on some lis


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7209] bkbooking: updated filter function on some lists and some minor bugfixes
Date: Mon, 11 Apr 2011 13:42:35 +0000

Revision: 7209
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7209
Author:   kjell
Date:     2011-04-11 13:42:35 +0000 (Mon, 11 Apr 2011)
Log Message:
-----------
bkbooking: updated filter function on some lists and some minor bugfixes

Modified Paths:
--------------
    trunk/booking/inc/class.boapplication.inc.php
    trunk/booking/inc/class.bosystem_message.inc.php
    trunk/booking/inc/class.soallocation.inc.php
    trunk/booking/inc/class.soapplication.inc.php
    trunk/booking/inc/class.sosystem_message.inc.php
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uiapplication.inc.php
    trunk/booking/inc/class.uidashboard.inc.php
    trunk/booking/inc/class.uievent.inc.php
    trunk/booking/inc/class.uisystem_message.inc.php
    trunk/booking/jasper/templates/application.jrxml
    trunk/booking/setup/phpgw_no.lang
    trunk/booking/setup/setup.inc.php
    trunk/booking/setup/tables_current.inc.php
    trunk/booking/setup/tables_update.inc.php
    trunk/booking/templates/base/application.xsl
    trunk/booking/templates/base/datatable.xsl
    trunk/bookingfrontend/inc/class.uibooking.inc.php
    trunk/bookingfrontend/setup/setup.inc.php

Modified: trunk/booking/inc/class.boapplication.inc.php
===================================================================
--- trunk/booking/inc/class.boapplication.inc.php       2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.boapplication.inc.php       2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -101,9 +101,16 @@
                        if ($building_id = phpgw::get_var('filter_building_id', 
'int', 'GET', false)) {
                                $where_clauses[] = "(%%table%%.id IN (SELECT 
DISTINCT a.id FROM bb_application a, bb_application_resource ar, bb_resource r 
WHERE ar.application_id = a.id AND ar.resource_id = r.id AND r.building_id = 
".intval($building_id)."))";
                        }
-                       
+#                      if ($type = phpgw::get_var('type') != 'not') {
+#                    $params['filters']['type'] = phpgw::get_var('type');      
 
+#            }
+
+                       if ($status = phpgw::get_var('status') != 'not') {
+                    $params['filters']['status'] = phpgw::get_var('status');   
    
+            }
+
                        $params['filters']['where'] = $where_clauses;
-                       
+
                        return $this->so->read($params);
                }
 

Modified: trunk/booking/inc/class.bosystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.bosystem_message.inc.php    2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.bosystem_message.inc.php    2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -19,14 +19,39 @@
                {
                        $this->db = & $GLOBALS['phpgw']->db;
                        $messages =  array(); 
-                       
-                       if (!is_null($for_case_officer_id)) {
-                               $sql = "SELECT id, type, status, title, name, 
created, building_id FROM bb_system_message WHERE status ='NEW' ORDER BY id 
DESC";
-                       }
-                       else {
-                               $sql = "SELECT id, type, status, title, name, 
created, building_id FROM bb_system_message ORDER BY id DESC";
-                       }
 
+#                      if ($type = phpgw::get_var('type', 'string', 'GET', 
false) != 'not') {
+#                    $params['filters']['type'] = phpgw::get_var('type');      
 
+#            }
+
+#                      if ($status = phpgw::get_var('status', 'string', 'GET', 
false) != 'not') {
+#                    $params['filters']['status'] = phpgw::get_var('status');  
     
+#            }
+
+#            if (is_set($params['filters']['type'])) {
+#                $filter = " WHERE type = ".$params['filters']['type']." ";
+#                if (is_set($params['filters']['status'])) {
+#                    $filter = $filter." AND ".$params['filters']['status']." 
";
+#                }
+#            } elseif  (is_set($params['filters']['status'])) {
+#            if  (is_set($params['filters']['status'])) {
+#                $filter = " WHERE status = '".$params['filters']['status']."' 
";
+#            } else {
+               $filter = "";
+#            }
+            
+
+                       $sql = "SELECT id, type, status, title, name, created, 
building_id FROM bb_system_message ".$filter." ORDER BY id DESC";
+
+                       ob_start();
+                       $myFile = "/tmp/debug2.txt";
+                       $fh = fopen($myFile, 'w') or die("can't open file");
+                       echo "<pre>\ntestdata:\n";print_r($sql);
+                       $op = ob_get_contents();
+                       fwrite($fh, $op);
+                       fclose($fh);
+                       ob_end_clean();
+
                        $external_site_address = 
isset($config->config_data['external_site_address']) && 
$config->config_data['external_site_address'] ? 
$config->config_data['external_site_address'] : 
$GLOBALS['phpgw_info']['server']['webserver_url'];
                        $this->db->query($sql);
                        $data = $this->db->resultSet;

Modified: trunk/booking/inc/class.soallocation.inc.php
===================================================================
--- trunk/booking/inc/class.soallocation.inc.php        2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.soallocation.inc.php        2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -18,6 +18,7 @@
                        parent::__construct('bb_allocation', 
                                array(
                                        'id'                    => array('type' 
=> 'int'),
+                    'id_string' => array('type' => 'string', 'required' => 
false, 'default' => '0', 'query' => true),
                                        'active'                => array('type' 
=> 'int', 'required' => true),
                                        'application_id'        => array('type' 
=> 'int', 'required' => false),
                                        'organization_id'               => 
array('type' => 'int', 'required' => true),
@@ -145,7 +146,88 @@
                                $errors['season_boundary'] = lang("This booking 
is not within the selected season");
                        }
                }
-               
+
+               function get_building($id)
+               {
+                       $this->db->limit_query("SELECT name FROM bb_building 
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('name', false);
+               }
+
+               function get_buildings()
+               {
+            $results = array();
+                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
+                       $this->db->query("SELECT id, name FROM bb_building 
WHERE active != 0 ORDER BY name ASC", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false),
+                                                          'name' => 
$this->db->f('name', false));
+                       }
+                       return $results;
+               }
+
+               function get_organization($id)
+               {
+                       $this->db->limit_query("SELECT id FROM bb_organization 
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('id', false);
+               }
+
+               function get_organizations()
+               {
+            $results = array();
+                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
+                       $this->db->query("SELECT id, name FROM bb_organization 
WHERE active = 1 ORDER BY name ASC", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false),
+                                                          'name' => 
$this->db->f('name', false));
+                       }
+                       return $results;
+               }
+
+               function get_season($id)
+               {
+                       $this->db->limit_query("SELECT id FROM bb_season where 
id=" . intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('id', false);
+               }
+
+               function get_seasons($build_id)
+               {
+            $results = array();
+                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
+            if (isset($build_id)) {
+                       $this->db->query("SELECT id, name FROM bb_season WHERE 
status NOT IN ('ARCHIVED') AND building_id = ($build_id) ORDER BY name ASC", 
__LINE__, __FILE__);
+            } else {
+                       $this->db->query("SELECT id, name FROM bb_season WHERE 
status NOT IN ('ARCHIVED') ORDER BY name ASC", __LINE__, __FILE__);
+            }
+
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false),
+                                                          'name' => 
$this->db->f('name', false));
+                       }
+                       return $results;
+               }
+
+               public function update_id_string() {
+                       $table_name = $this->table_name;
+                       $db = $this->db;
+                       $sql = "UPDATE $table_name SET id_string = cast(id AS 
varchar)";
+                       $db->query($sql, __LINE__, __FILE__);
+               }
+       
                public function find_expired() {
                        $table_name = $this->table_name;
                        $db = $this->db;

Modified: trunk/booking/inc/class.soapplication.inc.php
===================================================================
--- trunk/booking/inc/class.soapplication.inc.php       2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.soapplication.inc.php       2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -8,6 +8,7 @@
                        parent::__construct('bb_application', 
                                array(
                                        'id'            => array('type' => 
'int'),
+                    'id_string' => array('type' => 'string', 'required' => 
false, 'default' => '0', 'query' => true),
                                        'active'        => array('type' => 
'int'),
                                        'display_in_dashboard' => array('type' 
=> 'int'),
                                        'type'          => array('type' => 
'string'),
@@ -113,6 +114,63 @@
                        return array('id' => $this->db->f('id', false),
                                                 'name' => $this->db->f('name', 
false));
                }
+
+               function get_building($id)
+               {
+                       $this->db->limit_query("SELECT name FROM bb_building 
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('name', false);
+               }
+
+               function get_buildings()
+               {
+            $results = array();
+                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
+                       $this->db->query("SELECT id, name FROM bb_building 
WHERE active != 0 ORDER BY name ASC", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false),
+                                                          'name' => 
$this->db->f('name', false));
+                       }
+                       return $results;
+               }
+
+        function get_activities_main_level()
+        {
+                   $results = array();
+                       $results[]  = array('id' =>0,'name' => lang('Not 
selected'));
+                       $this->db->query("SELECT id,name FROM bb_activity WHERE 
parent_id is NULL", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false), 'name' => $this->db->f('name', false));
+                       }
+                       return $results;
+
+        }
+        function get_activities($id)
+        {
+                       $results = array();
+                       $this->db->query("select id from bb_activity where id = 
($id) or  parent_id = ($id) or parent_id in (select id from bb_activity where 
parent_id = ($id))", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = 
$this->_unmarshal($this->db->f('id', false), 'int');
+                       }
+                       return $results;
+
+        }
+
+               public function update_id_string() {
+                       $table_name = $this->table_name;
+                       $db = $this->db;
+                       $sql = "UPDATE $table_name SET id_string = cast(id AS 
varchar)";
+                       $db->query($sql, __LINE__, __FILE__);
+               }
+             
+
+
                
                /**
                 * Check if a given timespan is available for bookings or 
allocations

Modified: trunk/booking/inc/class.sosystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.sosystem_message.inc.php    2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.sosystem_message.inc.php    2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -12,15 +12,26 @@
                                        'title' => array('type' => 'string', 
'query' => true, 'required' => true),
                                        'display_in_dashboard' => array('type' 
=> 'int', 'nullable' => False, 'precision' => '4', 'default' => 1),
                                        'building_id' => array('type' => 'int', 
'precision' => '4'),
-                                       'name' => array('type' => 
'string','nullable' => False),
+                                       'building_name' => array('type' => 
'string','nullable' => False, 'query' => true,),
+                                       'name' => array('type' => 
'string','nullable' => False, 'query' => true,),
                                        'phone' => array('type' => 
'string','nullable' => False, 'default'=>''),
                                        'email' => array('type' => 
'string','nullable' => False, 'default'=>''),
                                        'message' => array('type' => 'string', 
'required' => true),
-                                       'type' => array('type' => 'string', 
'default' => 'message'),
-                                       'status' => array('type' => 'string', 
'default' => 'NEW')
+                                       'type' => array('type' => 'string', 
'default' => 'message', 'query' => true),
+                                       'status' => array('type' => 'string', 
'default' => 'NEW', 'query' => true)
                                )
                        );
                }
+
+               function get_building($id)
+               {
+                       $this->db->limit_query("SELECT name FROM bb_building 
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
+                       if(!$this->db->next_record())
+                       {
+                               return False;
+                       }
+                       return $this->db->f('name', false);
+               }
                
        }
 

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.uiallocation.inc.php        2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -38,10 +38,26 @@
                        self::add_javascript('booking', 'booking', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
+            $build_id = phpgw::get_var('buildings', 'int', 'REQUEST', null);
                        $data = array(
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'buildings',
+                                'text' => lang('Building').':',
+                                'list' => $this->bo->so->get_buildings(),
+                                                       ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'organizations',
+                                'text' => lang('Organization').':',
+                                'list' => $this->bo->so->get_organizations(),
+                                                       ),
+#                                                      array('type' => 
'filter', 
+#                                                              'name' => 
'seasons',
+#                                'text' => lang('Season').':',
+#                                'list' => 
$this->bo->so->get_seasons($build_id),
+#                                                      ),
                                                        array('type' => 'text', 
                                                                'name' => 
'query'
                                                        ),
@@ -102,13 +118,48 @@
                                        'href' => self::link(array('menuaction' 
=> 'booking.uiallocation.add'))
                                ));
                        }
-                       
+               
                        self::render_template('datatable', $data);
                }
 
                public function index_json()
                {
-                       $allocations = $this->bo->read();
+                       if(isset($_SESSION['showall']))
+                       {
+                       unset($filters['building_name']);
+                unset($filters['organization_id']);
+                unset($filters['season_id']);
+                       } else {
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0) {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('organizations', 'int', 
'REQUEST', null);
+                if ($testdata2 != 0) {
+                    $filters['organization_id'] = 
$this->bo->so->get_organization(phpgw::get_var('organizations', 'int', 
'REQUEST', null));        
+                } else {
+                    unset($filters['organization_id']);
+                }
+                $testdata3 =  phpgw::get_var('seasons', 'int', 'REQUEST', 
null);
+                if ($testdata3 != 0) {
+                    $filters['season_id'] = 
$this->bo->so->get_season(phpgw::get_var('seasons', 'int', 'REQUEST', null));   
     
+                } else {
+                    unset($filters['season_id']);                
+                }
+            }
+            
+                       $params = array(
+                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'query' => phpgw::get_var('query'),
+                               'sort'  => phpgw::get_var('sort'),
+                               'dir'   => phpgw::get_var('dir'),
+                               'filters' => $filters
+                       );
+
+                       $allocations = $this->bo->so->read($params);
                        array_walk($allocations["results"], array($this, 
"_add_links"), "booking.uiallocation.show");
 
                        foreach($allocations['results'] as &$allocation)
@@ -116,6 +167,7 @@
                                $allocation['from_'] = 
pretty_timestamp($allocation['from_']);
                                $allocation['to_'] = 
pretty_timestamp($allocation['to_']);
                        }
+
                        return $this->yui_results($allocations);
                }
 
@@ -159,6 +211,7 @@
                                {
                                        try {
                                                $receipt = 
$this->bo->add($allocation);
+                        $this->bo->so->update_id_string();
                                                
$this->redirect(array('menuaction' => 'booking.uiallocation.show', 
'id'=>$receipt['id']));
                                        } catch (booking_unauthorized_exception 
$e) {
                                                $errors['global'] = lang('Could 
not add object due to insufficient permissions');
@@ -204,6 +257,7 @@
                                        }
                                        if ($step == 3) 
                                        {
+                        $this->bo->so->update_id_string();
                                                
$this->redirect(array('menuaction' => 'booking.uiallocation.show', 
'id'=>$receipt['id']));
                                        }
                                }

Modified: trunk/booking/inc/class.uiapplication.inc.php
===================================================================
--- trunk/booking/inc/class.uiapplication.inc.php       2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.uiapplication.inc.php       2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -139,6 +139,7 @@
                        self::add_javascript('booking', 'booking', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
+
                        $data = array(
                                'form' => array(
                                        'toolbar' => array(
@@ -148,6 +149,38 @@
                                                                'value' => 
lang('New application'),
                                                                'href' => 
self::link(array('menuaction' => 'booking.uiapplication.add'))
                                                        ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'status',
+                                'text' => lang('Status').':',
+                                'list' => array(
+                                    array(
+                                        'id' => 'NEW',
+                                        'name' => lang('NEW')
+                                    ), 
+                                    array(
+                                        'id' => 'PENDING',
+                                        'name' =>  lang('PENDING')
+                                    ), 
+                                    array(
+                                        'id' => 'REJECTED',
+                                        'name' => lang('REJECTED')
+                                    ), 
+                                    array(
+                                        'id' => 'ACCEPTED',
+                                        'name' => lang('ACCEPTED')
+                                    )
+                                )
+                            ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'buildings',
+                                'text' => lang('Building').':',
+                                'list' => $this->bo->so->get_buildings(),
+                                                       ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'activities',
+                                'text' => lang('Activity').':',
+                                'list' => 
$this->bo->so->get_activities_main_level(),
+                                                       ),
                                                        array('type' => 'text', 
                                                                'name' => 
'query'
                                                        ),
@@ -161,7 +194,7 @@
                                                                'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
                                                                'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
                                                        ),
-                                               )
+                                               ),
                                        ),
                                ),
                                'datatable' => array(
@@ -205,8 +238,9 @@
                                                        'hidden' => true
                                                )
                                        )
-                               )
+                               ),
                        );
+
                        self::render_template('datatable', $data);
                }
 
@@ -223,7 +257,34 @@
                        if(isset($_SESSION['showall']))
                        {
                                $filters['status'] = array('NEW', 
'PENDING','REJECTED', 'ACCEPTED');
-                       }
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0) {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
+                if ($testdata2 != 0) {
+                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['activity_id']);                
+                }
+                
+                       } else {
+                $filters['status'] = phpgw::get_var('status');
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0) {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
+                if ($testdata2 != 0) {
+                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['activity_id']);                
+                }
+            }
 
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
@@ -235,6 +296,7 @@
                        );
 
                        $applications = $this->bo->so->read($params);
+
                        foreach($applications['results'] as &$application)
                        {
                                $application['status'] = 
lang($application['status']);
@@ -254,6 +316,7 @@
                                }
                        }
                        array_walk($applications["results"], array($this, 
"_add_links"), "booking.uiapplication.show");
+
                        return $this->yui_results($applications);
                }
                
@@ -377,6 +440,7 @@
                                        $receipt = $this->bo->add($application);
                                        $application['id'] = $receipt['id'];
                                        
$this->bo->send_notification($application, true);
+                    $this->bo->so->update_id_string();
                                        $this->flash(lang("Your application has 
now been registered and a confirmation email has been sent to you.")."<br />".
                                                                 lang("A Case 
officer will review your application as soon as possible."));
                                        $this->redirect(array('menuaction' => 
$this->url_prefix . '.show', 'id'=>$receipt['id'], 
'secret'=>$application['secret']));

Modified: trunk/booking/inc/class.uidashboard.inc.php
===================================================================
--- trunk/booking/inc/class.uidashboard.inc.php 2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/booking/inc/class.uidashboard.inc.php 2011-04-11 13:42:35 UTC (rev 
7209)
@@ -68,11 +68,62 @@
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'status',
+                                'text' => lang('Status').':',
+                                'list' => array(
+                                    array(
+                                        'id' => 'not',
+                                        'name' => lang('Not selected')
+                                    ), 
+                                    array(
+                                        'id' => 'NEW',
+                                        'name' => lang('NEW')
+                                    ), 
+                                    array(
+                                        'id' => 'PENDING',
+                                        'name' =>  lang('PENDING')
+                                    ), 
+                                    array(
+                                        'id' => 'REJECTED',
+                                        'name' => lang('REJECTED')
+                                    ), 
+                                    array(
+                                        'id' => 'ACCEPTED',
+                                        'name' => lang('ACCEPTED')
+                                    ),
+                                    array(
+                                        'id' => 'CLOSED',
+                                        'name' => lang('CLOSED')
+                                    )
+                                )
+                            ),
+#                                                      array('type' => 
'filter', 
+#                                                              'name' => 
'type',
+#                                'text' => lang('Type').':',
+#                                'list' => array(
+#                                    array(
+#                                        'id' => 'not',
+#                                        'name' => lang('Not selected')
+#                                    ), 
+#                                    array(
+#                                        'id' => 'application',
+#                                        'name' => lang('Application')
+#                                    ), 
+#                                    array(
+#                                        'id' => 'message',
+#                                        'name' => lang('Message')
+#                                    ), 
+#                                )
+#                            ),
                                                        array('type' => 
'autocomplete', 
                                                                'name' => 
'building',
                                                                'ui' => 
'building',
                                                                'text' => 
lang('Building').':',
                                                        ),
+                                                       array('type' => 'text', 
+                                                               'name' => 
'query'
+                                                       ),
                                                        array(
                                                                'type' => 
'submit',
                                                                'name' => 
'search',

Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php     2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/booking/inc/class.uievent.inc.php     2011-04-11 13:42:35 UTC (rev 
7209)
@@ -51,6 +51,16 @@
                                                                'value' => 
lang('New event'),
                                                                'href' => 
self::link(array('menuaction' => 'booking.uievent.add'))
                                                        ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'buildings',
+                                'text' => lang('Building').':',
+                                'list' => $this->bo->so->get_buildings(),
+                                                       ),
+                                                       array('type' => 
'filter', 
+                                                               'name' => 
'activities',
+                                'text' => lang('Activity').':',
+                                'list' => 
$this->bo->so->get_activities_main_level(),
+                                                       ),
                                                        array('type' => 'text', 
                                                                'name' => 
'query'
                                                        ),
@@ -110,8 +120,36 @@
                }
 
                public function index_json()
+
                {
-                       $events = $this->bo->read();
+                       if(isset($_SESSION['showall']))
+                       {
+                       unset($filters['building_name']);
+                unset($filters['activity_id']);
+                       } else {
+                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                if ($testdata != 0) {
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['building_name']);                
+                }
+                $testdata2 =  phpgw::get_var('activities', 'int', 'REQUEST', 
null);
+                if ($testdata2 != 0) {
+                    $filters['activity_id'] = 
$this->bo->so->get_activities(phpgw::get_var('activities', 'int', 'REQUEST', 
null));        
+                } else {
+                    unset($filters['activity_id']);                
+                }
+            }
+            
+                       $params = array(
+                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'query' => phpgw::get_var('query'),
+                               'sort'  => phpgw::get_var('sort'),
+                               'dir'   => phpgw::get_var('dir'),
+                               'filters' => $filters
+                       );
+                       $events = $this->bo->so->read($params);
 
                        foreach($events['results'] as &$event)
                        {
@@ -366,12 +404,14 @@
                                                if ($allids) 
                                                { 
                                                        
$this->bo->so->update_comment($allids);
+                            $this->bo->so->update_id_string();
                                                }
                                        }
                                        else
                                        {
                                                $this->add_comment($event, 
lang('Event was created'));
                                                $receipt = 
$this->bo->add($event);
+                        $this->bo->so->update_id_string();
                                        }
                                        $this->redirect(array('menuaction' => 
'booking.uievent.edit', 'id'=>$receipt['id'], 'secret'=>$event['secret'], 
'warnings'=>$errors));
                                }

Modified: trunk/booking/inc/class.uisystem_message.inc.php
===================================================================
--- trunk/booking/inc/class.uisystem_message.inc.php    2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/inc/class.uisystem_message.inc.php    2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -140,6 +140,7 @@
                                $date = new DateTime(phpgw::get_var('date'));
                                $system_message = array();
                                $system_message['building_id'] = 
intval(phpgw::get_var('building_id', 'GET'));
+                               $system_message['building_name'] = 
$this->bo->so->get_building($system_message['building_id']);
                                $system_message['created'] =  
$date->format('Y-m-d  H:m');
                                $system_message['cancel_link'] = 
self::link(array('menuaction' => 'booking.uisystem_message.index'));
                        }

Modified: trunk/booking/jasper/templates/application.jrxml
===================================================================
--- trunk/booking/jasper/templates/application.jrxml    2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/jasper/templates/application.jrxml    2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -212,7 +212,7 @@
                                <textElement>
                                        <font pdfFontName="Helvetica" 
isPdfEmbedded="true"/>
                                </textElement>
-                               <textFieldExpression 
class="java.lang.String"><![CDATA["Status: " + ( $F{application_status} == 
"ACCEPTED" ? "Bekreftet" : $F{application_status} )]]></textFieldExpression>
+                               <textFieldExpression 
class="java.lang.String"><![CDATA["Status: " + ( $F{application_status} == 
"ACCEPTED" ? "AKSEPTERT" : $F{application_status} )]]></textFieldExpression>
                        </textField>
                        <textField>
                                <reportElement x="84" y="326" width="455" 
height="13"/>

Modified: trunk/booking/setup/phpgw_no.lang
===================================================================
--- trunk/booking/setup/phpgw_no.lang   2011-04-11 12:55:34 UTC (rev 7208)
+++ trunk/booking/setup/phpgw_no.lang   2011-04-11 13:42:35 UTC (rev 7209)
@@ -458,7 +458,7 @@
 Close  booking no      Lukk
 CLOSED booking no      LUKKET
 Show all applications  booking no      Vis alle søknader
-Show all messages      booking no      Vis all beskjeder
+Show all messages      booking no      Vis alle beskjeder
 Show only messages assigned to me      booking no      Vis bare mine beskjeder
 E-mail address booking no      E-postadresse
 Confirm e-mail address booking no      Bekreft e-postadressen
@@ -488,4 +488,6 @@
 Allocations  with existing allocations or bookings (%1)        booking no      
Tildeinger med eksisterende tildelinger eller bookinger (%1)
 Contact information name is to long. max 50 characters booking no      Navn i 
kontakt informasjon er for langt. Maks 50 tegn
 Show in portal booking no      Vis i portal
-NB! No data will be saved, if you navigate away you will loose all.    booking 
no      NB! Ingen data er lagret, viss du navigerer vekk så mister du alt.
+NB! No data will be saved, if you navigate away you will loose all.    booking 
no      NB! Ingen data er lagret.
+Activity       booking no      Aktiviteter
+Not selected   booking no      Ikke valgt

Modified: trunk/booking/setup/setup.inc.php
===================================================================
--- trunk/booking/setup/setup.inc.php   2011-04-11 12:55:34 UTC (rev 7208)
+++ trunk/booking/setup/setup.inc.php   2011-04-11 13:42:35 UTC (rev 7209)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.05';
+       $setup_info['booking']['version'] = '0.2.06';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';

Modified: trunk/booking/setup/tables_current.inc.php
===================================================================
--- trunk/booking/setup/tables_current.inc.php  2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/booking/setup/tables_current.inc.php  2011-04-11 13:42:35 UTC (rev 
7209)
@@ -168,6 +168,7 @@
                'bb_application' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'id_string' => array('type' => 'varchar', 
'nullable' => False, 'default' => '0'),
                                '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),
@@ -200,6 +201,7 @@
                'bb_allocation' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'id_string' => array('type' => 'varchar', 
'nullable' => False, 'default' => '0'),
                                'active' => array('type' => 'int', 'nullable' 
=> False,'precision' => '4', 'default' => 1),
                                'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'application_id' => array('type' => 
'int','precision' => '4','nullable' => True),
@@ -514,6 +516,7 @@
                'bb_event' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto','nullable' => 
False),
+                               'id_string' => array('type' => 'varchar', 
'nullable' => False, 'default' => '0'),
                                'active' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '1'),
                                'activity_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'description' => array('type' => 
'text','nullable' => False),
@@ -753,6 +756,7 @@
                                'created' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
                                'display_in_dashboard' => array('type' => 
'int', 'nullable' => False, 'precision' => '4', 'default' => 1),
                                'building_id' => array('type' => 'int', 
'precision' => '4'),
+                               'building_name' => array('type' => 'varchar', 
'precision' => '50','nullable' => False),
                                'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => False),
                                'phone' => array('type' => 
'varchar','precision' => '50','nullable' => true),
                                'email' => array('type' => 
'varchar','precision' => '50','nullable' => true),

Modified: trunk/booking/setup/tables_update.inc.php
===================================================================
--- trunk/booking/setup/tables_update.inc.php   2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/booking/setup/tables_update.inc.php   2011-04-11 13:42:35 UTC (rev 
7209)
@@ -2457,7 +2457,7 @@
 
        $test[] = '0.2.04';
        /**
-       * Update booking version from 0.2.02 to 0.2.03
+       * Update booking version from 0.2.03 to 0.2.04
        * Add custom fields to request
        * 
        */
@@ -2479,3 +2479,33 @@
                }
        }
 
+       $test[] = '0.2.05';
+       /**
+       * Update booking version from 0.2.04 to 0.2.05
+       * Add custom fields to request
+       * 
+       */
+       function booking_upgrade0_2_05()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE 
bb_event ADD COLUMN id_string varchar(20) NOT NULL DEFAULT '0'");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE bb_event 
SET id_string = cast(id AS varchar)");
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE 
bb_allocation ADD COLUMN id_string varchar(20) NOT NULL DEFAULT '0'");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE 
bb_allocation SET id_string = cast(id AS varchar)");
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE 
bb_application ADD COLUMN id_string varchar(20) NOT NULL DEFAULT '0'");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE 
bb_application SET id_string = cast(id AS varchar)");
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("ALTER TABLE 
bb_system_message ADD COLUMN building_name varchar(50) NOT NULL DEFAULT 
'changeme'");
+               $GLOBALS['phpgw_setup']->oProc->m_odb->query("UPDATE 
bb_system_message SET building_name = b2.name FROM bb_building b2 WHERE EXISTS 
(SELECT 1 FROM bb_building b, bb_system_message a WHERE a.building_id = b.id 
AND b2.id=b.id AND bb_system_message.id=a.id)");
+       
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.06';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }
+

Modified: trunk/booking/templates/base/application.xsl
===================================================================
--- trunk/booking/templates/base/application.xsl        2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/booking/templates/base/application.xsl        2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -148,8 +148,10 @@
                                        </xsl:if>
                                        
                                        <option><xsl:value-of 
select="php:function('lang', '- Actions -')" /></option>
+<!--
                                        <option><xsl:value-of 
select="php:function('lang', 'Create allocation')" /></option>
                                        <option><xsl:value-of 
select="php:function('lang', 'Create booking')" /></option>
+-->
                                        <option><xsl:value-of 
select="php:function('lang', 'Create event')" /></option>
                                </select>
                                </xsl:if>

Modified: trunk/booking/templates/base/datatable.xsl
===================================================================
--- trunk/booking/templates/base/datatable.xsl  2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/booking/templates/base/datatable.xsl  2011-04-11 13:42:35 UTC (rev 
7209)
@@ -109,6 +109,17 @@
                                                </script>
                                        </td>
                                </xsl:when>
+                               <xsl:when test="type = 'filter'">
+                                       <td valign="top">
+                    <xsl:variable name="name"><xsl:value-of 
select="name"/></xsl:variable>
+                       <select name="{$name}" 
onMouseout="window.status='';return true;">
+                        <xsl:for-each select="list">
+                               <xsl:variable name="id"><xsl:value-of 
select="id"/></xsl:variable>
+                                   <option value="{$id}"><xsl:value-of 
select="name"/></option>
+                        </xsl:for-each>
+                       </select>
+                    </td>
+                               </xsl:when>
                                <xsl:otherwise>
                                        <td valign="top">
                                        <input id="innertoolbar">
@@ -165,7 +176,6 @@
                </div>
        </form>
 </xsl:template>
-
 <xsl:template match="form">
        <form id="queryForm">
                <xsl:attribute name="method">

Modified: trunk/bookingfrontend/inc/class.uibooking.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.uibooking.inc.php   2011-04-11 12:55:34 UTC 
(rev 7208)
+++ trunk/bookingfrontend/inc/class.uibooking.inc.php   2011-04-11 13:42:35 UTC 
(rev 7209)
@@ -137,7 +137,7 @@
 #                                              $errors['booking'] = lang('Can 
not create a booking in the past');
 #                                      }
 #                              } 
-                               if (!$season_id &&  $_POST['outseason'] == 'on')
+                               if (!$season['id'] &&  $_POST['outseason'] == 
'on')
                                {
                                        $errors['booking'] = lang('This booking 
is not connected to a season');
                                }       

Modified: trunk/bookingfrontend/setup/setup.inc.php
===================================================================
--- trunk/bookingfrontend/setup/setup.inc.php   2011-04-11 12:55:34 UTC (rev 
7208)
+++ trunk/bookingfrontend/setup/setup.inc.php   2011-04-11 13:42:35 UTC (rev 
7209)
@@ -21,7 +21,7 @@
 
        $setup_info['bookingfrontend']['depends'][] = array(
                'appname' => 'booking',
-               'versions' => Array('0.2.00', 
'0.2.01','0.2.02','0.2.03','0.2.04','0.2.05')
+               'versions' => Array('0.2.00', 
'0.2.01','0.2.02','0.2.03','0.2.04','0.2.05','0.2.06')
        );
 
        $setup_info['bookingfrontend']['depends'][] = array(




reply via email to

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