[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15301] booking: date handling
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15301] booking: date handling |
Date: |
Fri, 17 Jun 2016 13:33:47 +0000 (UTC) |
Revision: 15301
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15301
Author: sigurdne
Date: 2016-06-17 13:33:46 +0000 (Fri, 17 Jun 2016)
Log Message:
-----------
booking: date handling
Modified Paths:
--------------
trunk/booking/inc/class.uiallocation.inc.php
trunk/booking/inc/class.uiapplication.inc.php
trunk/booking/inc/class.uievent.inc.php
Modified: trunk/booking/inc/class.uiallocation.inc.php
===================================================================
--- trunk/booking/inc/class.uiallocation.inc.php 2016-06-17 00:12:13 UTC
(rev 15300)
+++ trunk/booking/inc/class.uiallocation.inc.php 2016-06-17 13:33:46 UTC
(rev 15301)
@@ -299,17 +299,26 @@
$from_date = $_POST['from_'];
$to_date = $_POST['to_'];
+ $from_date_arr = explode(' ', $_POST['from_']);
+ $to_date_arr = explode(' ', $_POST['to_']);
+ if(!isset($_POST['weekday']))
+ {
+ $_POST['weekday'] = strtolower
(date('l', phpgwapi_datetime::date_to_timestamp($_POST['from_'])));
+ }
+
$weekday = $_POST['weekday'];
- $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_']));
- $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $_POST['to_']));
+// $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_']));
+// $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $_POST['to_']));
+ $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $from_date_arr[1]));
+ $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $to_date_arr[1]));
- if (($_POST['weekday'] != 'sunday' && date('w')
> date('w', strtotime($_POST['weekday']))) || (date('w') == 'sunday' &&
date('w') < date('w', strtotime($_POST['weekday']))))
+ if (($_POST['weekday'] != 'sunday' && date('w')
> date('w', strtotime($_POST['weekday']))) || (date('w') == '0' && date('w') <
date('w', strtotime($_POST['weekday']))))
{
- if (phpgw::get_var('weekday', 'string')
== '')
+ if (!phpgw::get_var('weekday',
'string', 'POST'))
{
- $allocation['from_'] =
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_'])
- 60 * 60 * 24 * 7);
- $allocation['to_'] =
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday'] . " " . $_POST['to_']) -
60 * 60 * 24 * 7);
+ $allocation['from_'] =
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday'] . " " .
$from_date_arr[1]) - 60 * 60 * 24 * 7);
+ $allocation['to_'] =
strftime("%Y-%m-%d %H:%M", strtotime($_POST['weekday'] . " " . $to_date_arr[1])
- 60 * 60 * 24 * 7);
}
}
$_POST['from_'] = $allocation['from_'];
@@ -409,7 +418,7 @@
array_set_default($allocation, 'building_name',
phpgw::get_var('building_name', 'string'));
array_set_default($allocation, 'from_',
$timeFrom);
array_set_default($allocation, 'to_', $timeTo);
- $weekday = phpgw::get_var('weekday', 'string');
+ $weekday = phpgw::get_var('weekday', 'string',
'POST');
}
$this->flash_form_errors($errors);
Modified: trunk/booking/inc/class.uiapplication.inc.php
===================================================================
--- trunk/booking/inc/class.uiapplication.inc.php 2016-06-17 00:12:13 UTC
(rev 15300)
+++ trunk/booking/inc/class.uiapplication.inc.php 2016-06-17 13:33:46 UTC
(rev 15301)
@@ -943,8 +943,8 @@
}
}
$event = array();
- $event[] = array('from_', $date['from_']);
- $event[] = array('to_', $date['to_']);
+ $event[] = array('from_',
pretty_timestamp($date['from_']));
+ $event[] = array('to_', pretty_timestamp($date['to_']));
$event[] = array('cost', '0');
$event[] = array('application_id', $application['id']);
$event[] = array('reminder', '0');
Modified: trunk/booking/inc/class.uievent.inc.php
===================================================================
--- trunk/booking/inc/class.uievent.inc.php 2016-06-17 00:12:13 UTC (rev
15300)
+++ trunk/booking/inc/class.uievent.inc.php 2016-06-17 13:33:46 UTC (rev
15301)
@@ -363,18 +363,28 @@
$event = array('customer_internal' => 0);
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
-
array_set_default($_POST, 'from_', array());
array_set_default($_POST, 'to_', array());
- foreach ($_POST['from_'] as &$from)
+ if(isset($_POST['from_']))
{
- $from = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($from));
+ if(is_array($_POST['from_']))
+ {
+ foreach ($_POST['from_'] as
&$from)
+ {
+ $from = date("Y-m-d
H:i:s", phpgwapi_datetime::date_to_timestamp($from));
+ }
+ foreach ($_POST['to_'] as &$to)
+ {
+ $to = date("Y-m-d
H:i:s", phpgwapi_datetime::date_to_timestamp($to));
+ }
+ }
+ else
+ {
+ $_POST['from_'] = date("Y-m-d
H:i:s", phpgwapi_datetime::date_to_timestamp($_POST['from_']));
+ $_POST['to_'] = date("Y-m-d
H:i:s", phpgwapi_datetime::date_to_timestamp($_POST['to_']));
+ }
}
- foreach ($_POST['to_'] as &$to)
- {
- $to = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($to));
- }
$event['dates'] = array_map(array(self,
'_combine_dates'), $_POST['from_'], $_POST['to_']);
@@ -1020,6 +1030,10 @@
{
$this->bo->so->delete_event($event_id);
}
+ else
+ {
+ phpgwapi_cache::message_set('Mangler rettighet
for å slette', 'error');
+ }
if (isset($application_id))
{
$this->redirect(array('menuaction' =>
'booking.uiapplication.show', 'id' => $application_id));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15301] booking: date handling,
sigurdne <=