fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14892] fix billing


From: Sigurd Nes
Subject: [Fmsystem-commits] [14892] fix billing
Date: Wed, 06 Apr 2016 13:16:02 +0000

Revision: 14892
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14892
Author:   sigurdne
Date:     2016-04-06 13:16:01 +0000 (Wed, 06 Apr 2016)
Log Message:
-----------
fix billing

Modified Paths:
--------------
    trunk/booking/inc/class.bocompleted_reservation_export.inc.php
    trunk/booking/inc/class.socompleted_reservation_export.inc.php
    trunk/booking/inc/class.uiapplication.inc.php
    trunk/booking/inc/class.uicommon.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
    trunk/booking/inc/class.uiseason.inc.php
    trunk/booking/js/booking/completed_reservation.js
    trunk/booking/templates/base/completed_reservation_export_form.xsl

Modified: trunk/booking/inc/class.bocompleted_reservation_export.inc.php
===================================================================
--- trunk/booking/inc/class.bocompleted_reservation_export.inc.php      
2016-04-04 07:52:36 UTC (rev 14891)
+++ trunk/booking/inc/class.bocompleted_reservation_export.inc.php      
2016-04-06 13:16:01 UTC (rev 14892)
@@ -1,5 +1,6 @@
 <?php
        phpgw::import_class('booking.bocommon');
+       phpgw::import_class('phpgwapi.datetime');
 
        class booking_bocompleted_reservation_export extends booking_bocommon
        {
@@ -21,7 +22,8 @@
                        //'filter' is removed nor do we want it to, so we build 
that filter manually here:
                        if ($filter_to = phpgw::get_var('filter_to', 'string', 
'REQUEST', null))
                        {
-                               $where_clauses[] = "%%table%%" . sprintf(".to_ 
<= '%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($filter_to));
+                               $to_date = date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($filter_to));
+                               $where_clauses[] = "%%table%%" . sprintf(".to_ 
<= '%s 23:59:59'", $GLOBALS['phpgw']->db->db_addslashes($to_date));
                        }
 
                        if (count($where_clauses) > O)

Modified: trunk/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
--- trunk/booking/inc/class.socompleted_reservation_export.inc.php      
2016-04-04 07:52:36 UTC (rev 14891)
+++ trunk/booking/inc/class.socompleted_reservation_export.inc.php      
2016-04-06 13:16:01 UTC (rev 14892)
@@ -1,6 +1,7 @@
 <?php
        phpgw::import_class('booking.socommon');
        phpgw::import_class('booking.sopermission');
+       phpgw::import_class('phpgwapi.datetime');
 
        class booking_socompleted_reservation_export extends booking_socommon
        {
@@ -64,9 +65,10 @@
 
                protected function _get_search_to_date( &$entity )
                {
-                       $to_date = (isset($entity['to_']) && 
!empty($entity['to_']) ? $entity['to_'] : date('Y-m-d'));
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $to_date = isset($entity['to_']) && $entity['to_'] ? 
$entity['to_'] : date($dateformat);
 
-                       $to_date = date('Y-m-d', strtotime($to_date));
+                       $to_date = date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($to_date));
 
                        if (strtotime($to_date) > strtotime('tomorrow'))
                        {

Modified: trunk/booking/inc/class.uiapplication.inc.php
===================================================================
--- trunk/booking/inc/class.uiapplication.inc.php       2016-04-04 07:52:36 UTC 
(rev 14891)
+++ trunk/booking/inc/class.uiapplication.inc.php       2016-04-06 13:16:01 UTC 
(rev 14892)
@@ -311,7 +311,7 @@
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'booking.uiapplication.index',
                                                'phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 
'created', 'dir' => 'asc'),
+                                       'sorted_by' => array('key' => 4, 'dir' 
=> 'asc'),//created
                                        'field' => array(
                                                array(
                                                        'key' => 'id',

Modified: trunk/booking/inc/class.uicommon.inc.php
===================================================================
--- trunk/booking/inc/class.uicommon.inc.php    2016-04-04 07:52:36 UTC (rev 
14891)
+++ trunk/booking/inc/class.uicommon.inc.php    2016-04-06 13:16:01 UTC (rev 
14892)
@@ -257,9 +257,13 @@
                        $this->store_flash_msgs();
 
                        if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend')
+                       {
                                
$GLOBALS['phpgw']->redirect_link('/bookingfrontend/', $link_data);
+                       }
                        else
+                       {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+                       }
                }
 
                public function create_error_stack( $errors = array() )

Modified: trunk/booking/inc/class.uicompleted_reservation.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation.inc.php     2016-04-04 
07:52:36 UTC (rev 14891)
+++ trunk/booking/inc/class.uicompleted_reservation.inc.php     2016-04-06 
13:16:01 UTC (rev 14892)
@@ -4,6 +4,7 @@
 
        phpgw::import_class('booking.uidocument_building');
        phpgw::import_class('booking.uipermission_building');
+       phpgw::import_class('phpgwapi.datetime');
 
 //     phpgw::import_class('phpgwapi.uicommon_jquery');
 
@@ -129,6 +130,7 @@
                        self::add_javascript('booking', 'booking', 
'completed_reservation.js');
 
                        $data = array(
+                               'datatable_name' => lang('booking') . ': ' . 
lang('Completed'),
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
@@ -163,16 +165,17 @@
                                        'list_actions' => array(
                                                'item' => array(
                                                        array(
-                                                               'type' => 
'submit',
+                                                               'type' => 
'button',
                                                                'name' => 
'export',
                                                                'value' => 
lang('Export') . '...',
+                                                               'onClick' => 
"export_completed_reservations();"
                                                        ),
                                                )
                                        ),
                                ),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
+                                       'sorted_by' => array('key' => 0, 'dir' 
=> 'desc'),//id
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
@@ -322,12 +325,12 @@
                        }
 
                        $filter_to = phpgw::get_var('to', 'string', 'REQUEST', 
null);
+                       $to_date = $filter_to ? $filter_to : 
phpgw::get_var('filter_to', 'string', 'REQUEST', null);
 
-                       if ($filter_to)
+                       if ($to_date)
                        {
-                               $filter_to2 = split("/", $filter_to);
-                               $filter_to = $filter_to2[1] . "/" . 
$filter_to2[0] . "/" . $filter_to2[2];
-                               $filters['where'][] = "%%table%%" . 
sprintf(".to_ <= '%s 23:59:59'", 
$GLOBALS['phpgw']->db->db_addslashes($filter_to));
+                               $filter_to2 = date('Y-m-d', 
phpgwapi_datetime::date_to_timestamp($to_date));
+                               $filters['where'][] = "%%table%%" . 
sprintf(".to_ <= '%s 23:59:59'", 
$GLOBALS['phpgw']->db->db_addslashes($filter_to2));
                        }
 
                        if 
(!isset($GLOBALS['phpgw_info']['user']['apps']['admin']) && // admin users 
should have access to all buildings

Modified: trunk/booking/inc/class.uicompleted_reservation_export.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation_export.inc.php      
2016-04-04 07:52:36 UTC (rev 14891)
+++ trunk/booking/inc/class.uicompleted_reservation_export.inc.php      
2016-04-06 13:16:01 UTC (rev 14892)
@@ -102,8 +102,10 @@
                        $GLOBALS['phpgw']->jqcal->add_listener('filter_to');
                        phpgwapi_jquery::load_widget('datepicker');
 
+                       self::add_javascript('booking', 'booking', 
'completed_reservation_export.js');
 
                        $data = array(
+                               'datatable_name' => lang('booking') . ': ' . 
lang('Exported Files'),
                                'form' => array(
                                        'toolbar' => array(
                                                'item' => array(
@@ -128,7 +130,7 @@
                                ),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
+                                       'sorted_by' => array('key' => 0, 'dir' 
=> 'desc'),//id
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
@@ -193,9 +195,11 @@
                                $data['form']['list_actions'] = array(
                                        'item' => array(
                                                array(
-                                                       'type' => 'submit',
+                                                       'type' => 'button',
                                                        'name' => 
'generate_files',
                                                        'value' => 
lang('Generate files') . '...',
+                                                       'onClick' => 
"generatefiles();"
+
                                                ),
                                        )
                                );
@@ -204,8 +208,6 @@
                        $filters_to = strtotime(extract_values($_GET, 
array("filter_to")));
                        $data['filters'] = date("Y-m-d", $filters_to);
 
-
-//                     $this->render_template('datatable', $data);
                        self::render_template_xsl('datatable_jquery', $data);
                }
 
@@ -249,7 +251,9 @@
                                        $_sort = array('created_on', 'id');
                                        break;
                                default:
-                                       $_sort = $sort;
+                                       $_sort = array('created_on', 'id');
+//                                     $_sort = $sort;
+                                       $dir = 'DESC';
                                        break;
                        }
 
@@ -398,7 +402,6 @@
                {
                        //Values passed in from the "Export"-action in 
uicompleted_reservation.index
                        $export = extract_values($_GET, $this->fields);
-
                        $errors = array();
                        if ($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
@@ -429,10 +432,15 @@
                                $export['to_'] = date('Y-m-d');
                        }
 
+                       //$this->flash_form_errors($errors);
+
+                       foreach ($errors as $key => $value)
+                       {
+                               phpgwapi_cache::message_set($value, 'error');
+                       }
+
                        $this->pre_validate($export);
 
-                       $this->flash_form_errors($errors);
-
                        $cancel_params = array('ui' => 'completed_reservation');
                        if ($export_key = $this->get_export_key())
                        {
@@ -440,8 +448,9 @@
                        }
 
                        $export['cancel_link'] = $this->link_to('index', 
$cancel_params);
+                       phpgwapi_jquery::load_widget('autocomplete');
 
-                       
$this->render_template('completed_reservation_export_form', array('new_form' => 
true,
+                       
self::render_template_xsl('completed_reservation_export_form', array('new_form' 
=> true,
                                'export' => $export));
                }
        }
\ No newline at end of file

Modified: trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php
===================================================================
--- trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php 
2016-04-04 07:52:36 UTC (rev 14891)
+++ trunk/booking/inc/class.uicompleted_reservation_export_file.inc.php 
2016-04-06 13:16:01 UTC (rev 14892)
@@ -73,9 +73,10 @@
                        }
 
                        $data = array(
+                               'datatable_name' => lang('booking') . ': ' . 
lang('Generated Files'),
                                'datatable' => array(
                                        'source' => $this->link_to('index', 
array('phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 'id', 
'dir' => 'desc'),
+                                       'sorted_by' => array('key' => 0, 'dir' 
=> 'desc'),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',

Modified: trunk/booking/inc/class.uiseason.inc.php
===================================================================
--- trunk/booking/inc/class.uiseason.inc.php    2016-04-04 07:52:36 UTC (rev 
14891)
+++ trunk/booking/inc/class.uiseason.inc.php    2016-04-06 13:16:01 UTC (rev 
14892)
@@ -63,7 +63,7 @@
                                ),
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'booking.uiseason.index', 'phpgw_return_as' => 
'json')),
-                                       'sorted_by' => array('key' => 'to_', 
'dir' => 'desc'),
+                                       'sorted_by' => array('key' => 5, 'dir' 
=> 'desc'),//to_
                                        'field' => array(
                                                array(
                                                        'key' => 'name',

Modified: trunk/booking/js/booking/completed_reservation.js
===================================================================
--- trunk/booking/js/booking/completed_reservation.js   2016-04-04 07:52:36 UTC 
(rev 14891)
+++ trunk/booking/js/booking/completed_reservation.js   2016-04-06 13:16:01 UTC 
(rev 14892)
@@ -15,4 +15,18 @@
 function requestWithBuildingFilter(sQuery)
 {
        return 'query=' + sQuery + (seasonFilterBuildingId ? 
'&filter_building_id=' + seasonFilterBuildingId : '');
+}
+
+function export_completed_reservations()
+{
+       var oArgs = {
+               menuaction:'booking.uicompleted_reservation_export.add',
+               building_id:$('#filter_building_id').val(),
+               building_name: $('#filter_building_name').val(),
+               season_id:$('#filter_season_id').val(),
+               season_name:$('#filter_season_name').val(),
+               to_: $('#filter_to').val()
+       };
+       var requestUrl = phpGWLink('index.php', oArgs);
+       window.open(requestUrl, '_self');
 }
\ No newline at end of file

Modified: trunk/booking/templates/base/completed_reservation_export_form.xsl
===================================================================
--- trunk/booking/templates/base/completed_reservation_export_form.xsl  
2016-04-04 07:52:36 UTC (rev 14891)
+++ trunk/booking/templates/base/completed_reservation_export_form.xsl  
2016-04-06 13:16:01 UTC (rev 14892)
@@ -24,7 +24,7 @@
                </dl>
 
                <xsl:call-template name="msgbox"/>
-               <xsl:call-template name="yui_booking_i18n"/>
+               <!--xsl:call-template name="yui_booking_i18n"/-->
 
                <form action="" method="POST">
                        <dl class="form-col">




reply via email to

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