fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7363] bkbooking: some small bugfixes and updates


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [7363] bkbooking: some small bugfixes and updates
Date: Thu, 09 Jun 2011 14:08:43 +0000

Revision: 7363
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7363
Author:   kjell
Date:     2011-06-09 14:08:42 +0000 (Thu, 09 Jun 2011)
Log Message:
-----------
bkbooking:  some small bugfixes and updates

Modified Paths:
--------------
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/inc/class.uicompleted_reservation.inc.php
    trunk/booking/inc/class.uicompleted_reservation_export.inc.php
    trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php

Added Paths:
-----------
    trunk/booking/js/booking/allocation_list.js

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2011-06-07 21:41:26 UTC 
(rev 7362)
+++ trunk/booking/inc/class.uiallocation.inc.php        2011-06-09 14:08:42 UTC 
(rev 7363)
@@ -36,6 +36,7 @@
                        if(phpgw::get_var('phpgw_return_as') == 'json') {
                                return $this->index_json();
                        }
+                       self::add_javascript('booking', 'booking', 
'allocation_list.js');
                        self::add_javascript('booking', 'booking', 
'datatable.js');
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
@@ -44,20 +45,36 @@
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
-                                                       array('type' => 
'filter', 
-                                                               'name' => 
'buildings',
-                                'text' => lang('Building').':',
-                                'list' => $this->bo->so->get_buildings(),
+                                                       array('type' => 
'autocomplete', 
+                                                               'name' => 
'building',
+                                                               'ui' => 
'building',
+                                                               'text' => 
lang('Building').':',
+                                                               'onItemSelect' 
=> 'updateBuildingFilter',
+                                                               
'onClearSelection' => 'clearBuildingFilter'
                                                        ),
+                                                       array('type' => 
'autocomplete', 
+                                                               'name' => 
'season',
+                                                               'ui' => 
'season',
+                                                               'text' => 
lang('Season').':',
+                                                               
'requestGenerator' => 'requestWithBuildingFilter',
+                                                       ),
                                                        array('type' => 
'filter', 
                                                                'name' => 
'organizations',
                                 'text' => lang('Organization').':',
                                 'list' => $this->bo->so->get_organizations(),
                                                        ),
 #                                                      array('type' => 
'filter', 
+#                                                              'name' => 
'buildings',
+#                                'text' => lang('Building').':',
+#                                'list' => $this->bo->so->get_buildings(),
+#                                                              'onItemSelect' 
=> 'updateBuildingFilter',
+#                                                              
'onClearSelection' => 'clearBuildingFilter'
+#                                                      ),
+#                                                      array('type' => 
'filter', 
 #                                                              'name' => 
'seasons',
 #                                'text' => lang('Season').':',
 #                                'list' => 
$this->bo->so->get_seasons($build_id),
+#                                                              
'requestGenerator' => 'requestWithBuildingFilter',
 #                                                      ),
                                                        array('type' => 'text', 
                                                                'name' => 
'query'
@@ -119,7 +136,7 @@
                                        'href' => self::link(array('menuaction' 
=> 'booking.uiallocation.add'))
                                ));
                        }
-               
+                       $data['filters'] = $this->export_filters;
                        self::render_template('datatable', $data);
                }
 
@@ -131,9 +148,9 @@
                 unset($filters['organization_id']);
                 unset($filters['season_id']);
                        } else {
-                $testdata =  phpgw::get_var('buildings', 'int', 'REQUEST', 
null);
+                $testdata =  phpgw::get_var('filter_building_id', 'int', 
'REQUEST', null);
                 if ($testdata != 0) {
-                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('buildings', 'int', 'REQUEST', 
null));        
+                    $filters['building_name'] = 
$this->bo->so->get_building(phpgw::get_var('filter_building_id', 'int', 
'REQUEST', null));        
                 } else {
                     unset($filters['building_name']);                
                 }
@@ -143,9 +160,9 @@
                 } else {
                     unset($filters['organization_id']);
                 }
-                $testdata3 =  phpgw::get_var('seasons', 'int', 'REQUEST', 
null);
+                $testdata3 =  phpgw::get_var('filter_season_id', 'int', 
'REQUEST', null);
                 if ($testdata3 != 0) {
-                    $filters['season_id'] = 
$this->bo->so->get_season(phpgw::get_var('seasons', 'int', 'REQUEST', null));   
     
+                    $filters['season_id'] = 
$this->bo->so->get_season(phpgw::get_var('filter_season_id', 'int', 'REQUEST', 
null));        
                 } else {
                     unset($filters['season_id']);                
                 }

Modified: trunk/booking/inc/class.uicompleted_reservation.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation.inc.php     2011-06-07 
21:41:26 UTC (rev 7362)
+++ trunk/booking/inc/class.uicompleted_reservation.inc.php     2011-06-09 
14:08:42 UTC (rev 7363)
@@ -152,6 +152,7 @@
                                ),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
+                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
@@ -380,7 +381,9 @@
                        $this->add_default_display_data($reservation);
                        $this->install_customer_identifier_ui($reservation);
                        $show_edit_button = false;
-                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+                       $building_role = 
$this->bo->accessable_buildings($GLOBALS['phpgw_info']['user']['id']);
+
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || 
in_array($reservation['building_id'],$building_role))
                        {
                                $show_edit_button = true;
                        }
@@ -423,11 +426,13 @@
                public function edit() {
                        //TODO: Display hint to user about primary type of 
customer identifier
                        
-                       if 
(!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) )
+                       $building_role = 
$this->bo->accessable_buildings($GLOBALS['phpgw_info']['user']['id']);
+                       $reservation = 
$this->bo->read_single(phpgw::get_var('id', 'GET'));
+
+                       if ( 
!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && 
!in_array($reservation['building_id'],$building_role))
                        {
                        $this->redirect_to('show', array('id' => 
phpgw::get_var('id', 'GET')));
                        }
-                       $reservation = 
$this->bo->read_single(phpgw::get_var('id', 'GET'));
                        
                        if (((int)$reservation['exported']) !== 0) {
                                //Cannot edit already exported reservation

Modified: trunk/booking/inc/class.uicompleted_reservation_export.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation_export.inc.php      
2011-06-07 21:41:26 UTC (rev 7362)
+++ trunk/booking/inc/class.uicompleted_reservation_export.inc.php      
2011-06-09 14:08:42 UTC (rev 7363)
@@ -113,6 +113,7 @@
                                ),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
+                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',

Modified: trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php 
2011-06-07 21:41:26 UTC (rev 7362)
+++ trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php 
2011-06-09 14:08:42 UTC (rev 7363)
@@ -78,7 +78,7 @@
                                ),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 
'created_on', 'dir' => 'desc'),
+                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',

Added: trunk/booking/js/booking/allocation_list.js
===================================================================
--- trunk/booking/js/booking/allocation_list.js                         (rev 0)
+++ trunk/booking/js/booking/allocation_list.js 2011-06-09 14:08:42 UTC (rev 
7363)
@@ -0,0 +1,15 @@
+var seasonFilterBuildingId = false;
+
+function updateBuildingFilter(sType, aArgs) {
+       YAHOO.util.Dom.get("filter_season_name").value = ""; 
+       YAHOO.util.Dom.get("filter_season_id").value = "";
+       seasonFilterBuildingId = aArgs[2].id;
+}
+
+function clearBuildingFilter() {
+       seasonFilterBuildingId = false;
+}
+
+function requestWithBuildingFilter(sQuery) {
+       return 'query=' + sQuery + (seasonFilterBuildingId ? 
'&filter_building_id='+seasonFilterBuildingId : '');
+}




reply via email to

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