fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16584] booking: more on allocation and dateformat


From: sigurdne
Subject: [Fmsystem-commits] [16584] booking: more on allocation and dateformat
Date: Tue, 18 Apr 2017 04:38:29 -0400 (EDT)

Revision: 16584
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16584
Author:   sigurdne
Date:     2017-04-18 04:38:29 -0400 (Tue, 18 Apr 2017)
Log Message:
-----------
booking: more on allocation and dateformat

Modified Paths:
--------------
    trunk/booking/inc/class.uiallocation.inc.php
    trunk/booking/js/booking/schedule.js

Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php        2017-04-18 08:37:25 UTC 
(rev 16583)
+++ trunk/booking/inc/class.uiallocation.inc.php        2017-04-18 08:38:29 UTC 
(rev 16584)
@@ -419,21 +419,25 @@
                        }
                        else
                        {
-//                             $dateTimeFrom = phpgw::get_var('from_', 
'string', 'POST');
-//                             $dateTimeTo = phpgw::get_var('to_', 'string', 
'POST');
+                               $dateformat =  phpgw::get_var('dateformat', 
'string');
                                $dateTimeFrom = phpgw::get_var('from_', 
'string');
                                $dateTimeTo = phpgw::get_var('to_', 'string');
-                               $dateTimeFromE = explode(" ", $dateTimeFrom[0]);
-                               $dateTimeToE = explode(" ", $dateTimeTo[0]);
-                               if (phpgw::get_var('from_', 'string') < 14)
+                               if(is_array($dateTimeFrom))
                                {
-                                       $timeFrom[] = phpgw::get_var('from_', 
'string', 'POST');
-                                       $timeTo[] = phpgw::get_var('to_', 
'string', 'POST');
+                                       $dateTimeFrom = $dateTimeFrom[0];
+                                       $dateTimeTo = $dateTimeTo[0];
                                }
+                               $dateTimeFromE = explode(" ", $dateTimeFrom);
+                               $dateTimeToE = explode(" ", $dateTimeTo);
+                               if ($dateTimeFrom < 14)
+                               {
+                                       $timeFrom = $dateTimeFrom;
+                                       $timeTo = $dateTimeTo;
+                               }
                                else
                                {
-                                       $timeFrom[] = $dateTimeFromE[1];
-                                       $timeTo[] = $dateTimeToE[1];
+                                       $timeFrom = $dateTimeFromE[1];
+                                       $timeTo = $dateTimeToE[1];
                                }
 
                                array_set_default($allocation, 'resources', 
array(phpgw::get_var('resource', 'int')));
@@ -450,11 +454,9 @@
                        $allocation['cancel_link'] = 
self::link(array('menuaction' => 'booking.uiallocation.index'));
                        array_set_default($allocation, 'cost', '0');
 
+//                     $_timeFrom = $timeFrom ? $timeFrom : '';
+                       $_timeTo = $timeTo ? $timeTo : '';
 
-
-                       $_timeFrom = $timeFrom ? $timeFrom[0] : '';
-                       $_timeTo = $timeTo ? $timeTo[0] : '';
-
                        $tabs = array();
                        $tabs['generic'] = array('label' => lang('Allocation 
New'), 'link' => '#allocation_new');
                        $active_tab = 'generic';
@@ -464,17 +466,25 @@
 
                        if ($step < 2)
                        {
-                               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                               $allocation['from_'] = date("{$dateformat} 
H:i",strtotime($dateTimeFrom[0]));
+                               if($dateformat == 'Y-m-d' && 
$_SERVER['REQUEST_METHOD'] == 'GET')
+                               {
+                                       $allocation['from_'] = 
date("{$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']} 
H:i",strtotime($dateTimeFrom));
+                                       $_timeFrom = strtotime($dateTimeFrom);
+                               }
+                               else
+                               {
+                                       $allocation['from_'] = $dateTimeFrom;
+                                       $_timeFrom = 
phpgwapi_datetime::date_to_timestamp($dateTimeFrom);
+                               }
                                if ($_SERVER['REQUEST_METHOD'] == 'POST' && 
$errors)
                                {
        //                              $allocation['from_'] = 
strftime("%H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_']));
        //                              $allocation['to_'] = strftime("%H:%M", 
strtotime($_POST['weekday'] . " " . $_POST['to_']));
-                                       $_timeFrom = $allocation['from_'];
-                                       $_timeTo = $allocation['to_'];
+       //                              $_timeFrom = $allocation['from_'];
+       //                              $_timeTo = $allocation['to_'];
                                }
 
-                               
$GLOBALS['phpgw']->jqcal2->add_listener('field_from', 'datetime', 
strtotime($dateTimeFrom[0]));
+                               
$GLOBALS['phpgw']->jqcal2->add_listener('field_from', 'datetime', $_timeFrom);
                                
$GLOBALS['phpgw']->jqcal2->add_listener('field_to', 'time', $_timeTo);
 
                                self::render_template_xsl('allocation_new', 
array('allocation' => $allocation,
@@ -487,9 +497,6 @@
                        }
                        else if ($step == 2)
                        {
-//                             
$GLOBALS['phpgw']->jqcal2->add_listener('field_from', 'time', $_timeFrom);
-//                             
$GLOBALS['phpgw']->jqcal2->add_listener('field_to', 'time', $_timeTo);
-
                                
self::render_template_xsl('allocation_new_preview', array('allocation' => 
$allocation,
                                        'step' => $step,
                                        'recurring' => $_POST['recurring'],

Modified: trunk/booking/js/booking/schedule.js
===================================================================
--- trunk/booking/js/booking/schedule.js        2017-04-18 08:37:25 UTC (rev 
16583)
+++ trunk/booking/js/booking/schedule.js        2017-04-18 08:38:29 UTC (rev 
16584)
@@ -161,7 +161,7 @@
        weekday[4] = "thursday";
        weekday[5] = "friday";
        weekday[6] = "saturday";
-       url += '&from_[]=' + state + _from + '&to_[]=' + state + _to + 
'&weekday=' + weekday[day];
+       url += '&from_[]=' + state + _from + '&to_[]=' + state + _to + 
'&weekday=' + weekday[day] + '&dateformat=Y-m-d';
        if (resource)
        {
                url += '&resource=' + resource;




reply via email to

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