[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14203] modify receiving dates from GET/POST
From: |
Saul |
Subject: |
[Fmsystem-commits] [14203] modify receiving dates from GET/POST |
Date: |
Sat, 17 Oct 2015 00:35:41 +0000 |
Revision: 14203
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14203
Author: psaul
Date: 2015-10-17 00:35:40 +0000 (Sat, 17 Oct 2015)
Log Message:
-----------
modify receiving dates from GET/POST
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
branches/dev-syncromind/booking/inc/class.uibooking.inc.php
Modified: branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
2015-10-17 00:32:57 UTC (rev 14202)
+++ branches/dev-syncromind/booking/inc/class.uiallocation.inc.php
2015-10-17 00:35:40 UTC (rev 14203)
@@ -477,8 +477,8 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
- $_POST['from_'] = date("Y-m-d H:i:s",
strtotime(str_replace("/", "-", $_POST['from_'])));
- $_POST['to_'] = date("Y-m-d H:i:s",
strtotime(str_replace("/", "-", $_POST['to_'])));
+ $_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_']));
array_set_default($_POST, 'resources', array());
$allocation = array_merge($allocation,
extract_values($_POST, $this->fields));
$organization =
$this->organization_bo->read_single(intval(phpgw::get_var('organization_id',
'POST')));
@@ -486,11 +486,11 @@
$errors = $this->bo->validate($allocation);
- if($errors)
+ if(!$errors)
{
try {
$receipt =
$this->bo->update($allocation);
- $this->bo->so->update_id_string();
+
$this->bo->so->update_id_string();
$this->send_mailnotification_to_organization($organization, lang('Allocation
changed'), phpgw::get_var('mail', 'POST'));
$this->redirect(array('menuaction' => 'booking.uiallocation.show',
'id'=>$allocation['id']));
} catch (booking_unauthorized_exception
$e) {
@@ -499,8 +499,8 @@
}
}
- $allocation['from_'] = date($this->dateFormat." H:i",
strtotime($allocation['from_']));
- $allocation['to_'] = date($this->dateFormat." H:i",
strtotime($allocation['to_']));
+ $allocation['from_'] =
pretty_timestamp($allocation['from_']);
+ $allocation['to_'] =
pretty_timestamp($allocation['to_']);
$this->flash_form_errors($errors);
self::add_javascript('booking', 'booking',
'allocation.js');
@@ -532,6 +532,11 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
+
+ $_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_']));
+ $_POST['repeat_until'] = date("Y-m-d",
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+
$from_date = $_POST['from_'];
$to_date = $_POST['to_'];
@@ -586,13 +591,13 @@
if ($err)
{
-
$invalid_dates[$i]['from_'] = $fromdate;
-
$invalid_dates[$i]['to_'] = $todate;
+
$invalid_dates[$i]['from_'] = pretty_timestamp($fromdate);
+
$invalid_dates[$i]['to_'] = pretty_timestamp($todate);
}
else
{
-
$valid_dates[$i]['from_'] = $fromdate;
-
$valid_dates[$i]['to_'] = $todate;
+
$valid_dates[$i]['from_'] = pretty_timestamp($fromdate);
+
$valid_dates[$i]['to_'] = pretty_timestamp($todate);
if ($step == 3)
{
$stat =
$this->bo->so->delete_allocation($id);
@@ -606,8 +611,13 @@
}
}
}
+
$this->flash_form_errors($errors);
self::add_javascript('booking', 'booking',
'allocation.js');
+
+ $allocation['from_'] =
pretty_timestamp($allocation['from_']);
+ $allocation['to_'] =
pretty_timestamp($allocation['to_']);
+
$allocation['resources_json'] =
json_encode(array_map('intval', $allocation['resources']));
$allocation['cancel_link'] =
self::link(array('menuaction' => 'booking.uiallocation.show', 'id' =>
$allocation['id']));
$allocation['application_link'] =
self::link(array('menuaction' => 'booking.uiapplication.show', 'id' =>
$allocation['application_id']));
@@ -636,8 +646,8 @@
'outseason' => $_POST['outseason'],
'interval' => $_POST['field_interval'],
'repeat_until' =>
$_POST['repeat_until'],
- 'from_date' => $from_date,
- 'to_date' => $to_date,
+ 'from_date' =>
pretty_timestamp($from_date),
+ 'to_date' => pretty_timestamp($to_date),
'valid_dates' => $valid_dates,
'invalid_dates' => $invalid_dates
));
Modified: branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-10-17 00:32:57 UTC (rev 14202)
+++ branches/dev-syncromind/booking/inc/class.uiapplication.inc.php
2015-10-17 00:35:40 UTC (rev 14203)
@@ -657,12 +657,10 @@
$application = $this->extract_form_data();
foreach ($_POST['from_'] as &$from) {
- $timestamp =
strtotime(str_replace("/","-",$from));
- $from = date("Y-m-d H:i:s",$timestamp);
+ $from = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($from));
}
foreach ($_POST['to_'] as &$to) {
- $timestamp =
strtotime(str_replace("/","-",$to));
- $to = date("Y-m-d H:i:s",$timestamp);
+ $to = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($to));
}
$application['dates'] = array_map(array(self,
'_combine_dates'), $_POST['from_'], $_POST['to_']);
@@ -703,9 +701,13 @@
$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.")."<br />".
- lang("Please
check your Spam Filter if you are missing mail."));
+ phpgwapi_cache::message_set(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.")."<br />".
+ lang("Please check your Spam
Filter if you are missing mail."
+ ));
+// $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.")."<br />".
+// lang("Please
check your Spam Filter if you are missing mail."));
$this->redirect(array('menuaction' =>
$this->url_prefix . '.show', 'id'=>$receipt['id'],
'secret'=>$application['secret']));
}
}
@@ -732,7 +734,7 @@
if(phpgw::get_var('from_', 'GET'))
{
foreach (phpgw::get_var('from_', 'GET') as $k =>
$v) {
- $_GET['from_'][$k] = date($this->dateFormat."
H:i", strtotime($_GET['from_'][$k]));
+ $_GET['from_'][$k] =
pretty_timestamp($_GET['from_'][$k]);
$_GET['to_'][$k] = date($this->dateFormat."
H:i", strtotime($_GET['to_'][$k]));
}
$default_dates = array_map(array(self,
'_combine_dates'), phpgw::get_var('from_', '', 'GET'), phpgw::get_var('to_',
'', 'GET'));
@@ -830,12 +832,10 @@
$errors = $this->validate($application);
foreach ($_POST['from_'] as &$from) {
- $timestamp =
strtotime(str_replace("/","-",$from));
- $from = date("Y-m-d H:i:s",$timestamp);
+ $from = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($from));
}
foreach ($_POST['to_'] as &$to) {
- $timestamp =
strtotime(str_replace("/","-",$to));
- $to = date("Y-m-d H:i:s",$timestamp);
+ $to = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($to));
}
$application['dates'] = array_map(array(self,
'_combine_dates'), $_POST['from_'], $_POST['to_']);
@@ -849,10 +849,21 @@
}
}
+// foreach ($application['dates'] as &$date) {
+// $date['from_'] = date($this->dateFormat." H:i",
strtotime($date['from_']));
+// $date['to_'] = date($this->dateFormat." H:i",
strtotime($date['to_']));
+// }
+
+// foreach ($application['dates'] as &$date) {
+// $date['from_'] = date("d/m/Y H:i",
phpgwapi_datetime::date_to_timestamp($date['from_']));
+// $date['to_'] = date($this->dateFormat. " H:i",
phpgwapi_datetime::date_to_timestamp($date['to_']));
+// }
+
foreach ($application['dates'] as &$date) {
- $date['from_'] = date($this->dateFormat." H:i",
strtotime($date['from_']));
- $date['to_'] = date($this->dateFormat." H:i",
strtotime($date['to_']));
+ $date['from_'] = pretty_timestamp($date['from_']);
+ $date['to_'] = pretty_timestamp($date['to_']);
}
+
// foreach ($application['dates']['to_'] as &$to) {
// $to = date($this->dateFormat." H:i",
strtotime($to));
// }
Modified: branches/dev-syncromind/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-17
00:32:57 UTC (rev 14202)
+++ branches/dev-syncromind/booking/inc/class.uibooking.inc.php 2015-10-17
00:35:40 UTC (rev 14203)
@@ -322,9 +322,14 @@
$booking['building_id'] = phpgw::get_var('building_id',
'int', 'GET');
$booking['resources'] = phpgw::get_var('resources',
'int', 'GET');
#The string replace is a workaround for a problem at
Bergen Kommune
-
+
$booking['from_'] =
str_replace('%3A',':',phpgw::get_var('from_', 'str', 'GET'));
$booking['to_'] =
str_replace('%3A',':',phpgw::get_var('to_', 'str', 'GET'));
+ foreach ($booking['from_'] as $k => $v) {
+ $booking['from_'][$k] =
pretty_timestamp($booking['from_'][$k]);
+ $booking['to_'][$k] =
pretty_timestamp($booking['to_'][$k]);
+ }
+
$time_from = explode(" ",phpgw::get_var('from_', 'str',
'GET'));
$time_to = explode(" ",phpgw::get_var('to_', 'str',
'GET'));
@@ -353,6 +358,10 @@
}
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
+ $_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_']));
+ $_POST['repeat_until'] = date("Y-m-d H:i:s",
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+
$today = getdate();
$booking = extract_values($_POST,
$this->fields);
@@ -360,6 +369,9 @@
$booking['from_'] = date("Y-m-d
H:i:s",$timestamp);
$timestamp = strtotime($booking['to_']);
$booking['to_'] = date("Y-m-d
H:i:s",$timestamp);
+
+ $booking['from_'] =
pretty_timestamp($booking['from_']);
+ $booking['to_'] =
pretty_timestamp($booking['to_']);
if(strlen($_POST['from_']) < 6)
{
@@ -458,13 +470,13 @@
if ($err)
{
-
$invalid_dates[$i]['from_'] = $fromdate;
-
$invalid_dates[$i]['to_'] = $todate;
+
$invalid_dates[$i]['from_'] = pretty_timestamp($fromdate);
+
$invalid_dates[$i]['to_'] = pretty_timestamp($todate);
}
else
{
-
$valid_dates[$i]['from_'] = $fromdate;
- $valid_dates[$i]['to_']
= $todate;
+
$valid_dates[$i]['from_'] = pretty_timestamp($fromdate);
+ $valid_dates[$i]['to_']
= pretty_timestamp($todate);
if ($step == 3)
{
if(
$noallocation ) {
@@ -572,9 +584,9 @@
'recurring' => $_POST['recurring'],
'outseason' => $_POST['outseason'],
'interval' => $_POST['field_interval'],
- 'repeat_until' =>
$_POST['repeat_until'],
- 'from_date' => $_POST['from_'],
- 'to_date' => $_POST['to_'],
+ 'repeat_until' =>
pretty_timestamp($_POST['repeat_until']),
+ 'from_date' =>
pretty_timestamp($_POST['from_']),
+ 'to_date' =>
pretty_timestamp($_POST['to_']),
'valid_dates' => $valid_dates,
'invalid_dates' => $invalid_dates,
'groups' => $groups,
@@ -629,6 +641,10 @@
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
+
+ $_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_']));
+
array_set_default($_POST, 'resources', array());
$booking = array_merge($booking,
extract_values($_POST, $this->fields));
$booking['allocation_id'] =
$booking['allocation_id'] ? $booking['allocation_id'] : null;
@@ -646,6 +662,10 @@
}
}
}
+
+ $booking['from_'] = pretty_timestamp($booking['from_']);
+ $booking['to_'] = pretty_timestamp($booking['to_']);
+
$this->flash_form_errors($errors);
self::add_javascript('booking', 'booking',
'booking.js');
$booking['resources_json'] =
json_encode(array_map('intval', $booking['resources']));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14203] modify receiving dates from GET/POST,
Saul <=