diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-11-02 15:36:44 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-11-02 18:03:40 +0100 |
commit | 15751f9c7a31e9375b5b8f6ce126f35c7244eb48 (patch) | |
tree | 1e4aedcb12e586b30c8e8215cdde15f12e0dd29e /includes/pages | |
parent | 88f3bafa5e41217b5a7dd49271429099515de9c8 (diff) |
Fix error when accessing undefined date
Closes #491 (Edit User fails when User never logged in before)
Diffstat (limited to 'includes/pages')
-rw-r--r-- | includes/pages/admin_arrive.php | 13 | ||||
-rw-r--r-- | includes/pages/admin_user.php | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/includes/pages/admin_arrive.php b/includes/pages/admin_arrive.php index 870522e2..2b4d7a3f 100644 --- a/includes/pages/admin_arrive.php +++ b/includes/pages/admin_arrive.php @@ -81,13 +81,12 @@ function admin_arrive() } $usr->name = User_Nick_render($usr); - if ($usr->personalData->planned_departure_date) { - $usr['rendered_planned_departure_date'] = $usr->personalData->planned_departure_date->format('Y-m-d'); - } else { - $usr['rendered_planned_departure_date'] = '-'; - } - $usr['rendered_planned_arrival_date'] = $usr->personalData->planned_arrival_date->format('Y-m-d'); - $usr['rendered_arrival_date'] = $usr->state->arrival_date ? $usr->state->arrival_date->format('Y-m-d') : '-'; + $plannedDepartureDate = $usr->personalData->planned_departure_date; + $arrivalDate = $usr->state->arrival_date; + $plannedArrivalDate = $usr->personalData->planned_arrival_date; + $usr['rendered_planned_departure_date'] = $plannedDepartureDate ? $plannedDepartureDate->format('Y-m-d') : '-'; + $usr['rendered_planned_arrival_date'] = $plannedArrivalDate ? $plannedArrivalDate->format('Y-m-d') : '-'; + $usr['rendered_arrival_date'] = $arrivalDate ? $arrivalDate->format('Y-m-d') : '-'; $usr['arrived'] = $usr->state->arrived ? __('yes') : ''; $usr['actions'] = $usr->state->arrived == 1 ? '<a href="' . page_link_to( diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 3e3722be..958563a0 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -50,7 +50,7 @@ function admin_user() $html .= '<table>' . "\n"; $html .= ' <tr><td>Nick</td><td>' . '<input size="40" name="eNick" value="' . $user_source->name . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>Last login</td><td><p class="help-block">' - . $user_source->last_login_at->format('Y-m-d H:i') + . ($user_source->last_login_at ? $user_source->last_login_at->format('Y-m-d H:i') : '-') . '</p></td></tr>' . "\n"; $html .= ' <tr><td>Name</td><td>' . '<input size="40" name="eName" value="' . $user_source->personalData->last_name . '" class="form-control"></td></tr>' . "\n"; $html .= ' <tr><td>Vorname</td><td>' . '<input size="40" name="eVorname" value="' . $user_source->personalData->first_name . '" class="form-control"></td></tr>' . "\n"; |