summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-14 00:26:05 +0200
committermsquare <msquare@notrademark.de>2018-10-31 13:43:23 +0100
commit57932be4287d0ea6235137f1a86f07cbb06dd35b (patch)
treea059d6eb765ad511c6e2224211aab3bb0a57abdf /includes/pages
parent4e09ee3eb255160c88a378375d69123a3e000497 (diff)
Moved arrival_date to state
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/admin_arrive.php12
-rw-r--r--includes/pages/user_settings.php2
2 files changed, 6 insertions, 8 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php
index f06c2c55..40b8bf44 100644
--- a/includes/pages/admin_arrive.php
+++ b/includes/pages/admin_arrive.php
@@ -29,9 +29,8 @@ function admin_arrive()
$user_source = User::find($user_id);
if ($user_source) {
$user_source->state->arrived = false;
+ $user_source->state->arrival_date = null;
$user_source->state->save();
- $user_source->personalData->arrival_date = null;
- $user_source->personalData->save();
engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source));
success(__('Reset done. Angel has not arrived.'));
@@ -44,8 +43,7 @@ function admin_arrive()
$user_source = User::find($user_id);
if ($user_source) {
$user_source->state->arrived = true;
- $user_source->state->save();
- $user_source->personalData->arrival_date = new Carbon\Carbon();
+ $user_source->state->arrival_date = new Carbon\Carbon();
$user_source->personalData->save();
engelsystem_log('User set has arrived: ' . User_Nick_render($user_source));
@@ -89,7 +87,7 @@ function admin_arrive()
$usr['rendered_planned_departure_date'] = '-';
}
$usr['rendered_planned_arrival_date'] = $usr->personalData->planned_arrival_date->format('Y-m-d');
- $usr['rendered_arrival_date'] = $usr->personalData->arrival_date ? $usr->personalData->arrival_date->format('Y-m-d') : '-';
+ $usr['rendered_arrival_date'] = $usr->state->arrival_date ? $usr->state->arrival_date->format('Y-m-d') : '-';
$usr['arrived'] = $usr->state->arrived ? __('yes') : '';
$usr['actions'] = $usr->state->arrived == 1
? '<a href="' . page_link_to(
@@ -101,8 +99,8 @@ function admin_arrive()
['arrived' => $usr->id, 'search' => $search]
) . '">' . __('arrived') . '</a>';
- if ($usr->personalData->arrival_date) {
- $day = $usr->personalData->arrival_date->format('Y-m-d');
+ if ($usr->state->arrival_date) {
+ $day = $usr->state->arrival_date->format('Y-m-d');
if (!isset($arrival_count_at_day[$day])) {
$arrival_count_at_day[$day] = 0;
}
diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php
index fbcd8baf..bc97099e 100644
--- a/includes/pages/user_settings.php
+++ b/includes/pages/user_settings.php
@@ -57,7 +57,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
if ($request->has('planned_departure_date')) {
$tmp = parse_date('Y-m-d H:i', $request->input('planned_departure_date') . ' 00:00');
- $result = User_validate_planned_departure_date($user_source->personalData->arrival_date->getTimestamp(), $tmp);
+ $result = User_validate_planned_departure_date($user_source->state->arrival_date->getTimestamp(), $tmp);
$user_source->personalData->planned_departure_date = Carbon::createFromTimestamp($result->getValue());
if (!$result->isValid()) {
$valid = false;