// Generates a human-readable timestamp from the Uni* stamp
function generateDateTime ($time, $mode = '0') {
// If the stamp is zero it mostly didn't "happen"
- if ($time == '0') {
+ if (($time == '0') || (is_null($time))) {
// Never happend
return '{--NEVER_HAPPENED--}';
} // END - if
'ADMIN_SEND_COUPON' => "Gutschein versenden",
'ADMIN_SEND_COUPON_POINTS_NOT_ENTERED' => "Bitte geben Sie eine Vergütung (in {?POINTS?}) ein.",
'ADMIN_SEND_COUPON_DESCRIPTION_NOT_ENTERED' => "Bitte geben Sie eine kurze Beschreibung (oder einen Hinweis an Ihre Mitglieder) ein.",
+ 'ADMIN_SEND_COUPON_DONE' = "Es wurde ein Gutschein an alle empfangsbereiten Mitglieder versendet.",
// Admin - More
'ADMIN_LIST_CASHED_COUPONS_TITLE' => "Administrative Auflistung aller Gutscheine",
// Rember this user for the admin email
$adminUserids[] = $userid;
} // END - while
+
+ // Prepare content for template
+ $content = array(
+ 'userids' => implode(',', $adminUserids),
+ 'userid_count' => count($adminUserids),
+ 'coupon_id' => $couponId,
+ 'points' => bigintval(postRequestParameter('points')),
+ 'coupon_description' => postRequestParameter('coupon_description'),
+ 'coupon_expired' => generateDateTime($expirationTime, '0')
+ );
+
+ // Send admin notification
+ sendAdminNotification('{--ADMIN_COUPON_SUBJECT--}', 'admin_coupon_code', $content);
+
+ // Coupon has been sent
+ displayMessage('{--ADMIN_SEND_COUPON_DONE--}');
} else {
// No user was found
displayMessage('{--ADMIN_SEND_COUPON_USER_404--}');
}
- // Prepare content for template
- $content = array(
- 'userids' => implode(',', $adminUserids),
- 'userid_count' => count($adminUserids),
- 'coupon_id' => $couponId,
- 'points' => bigintval(postRequestParameter('points')),
- 'coupon_description' => postRequestParameter('coupon_description'),
- 'coupon_expired' => generateDateTime($expirationTime, '0')
- );
-
- // Send admin notification
- sendAdminNotification('{--ADMIN_COUPON_SUBJECT--}', 'admin_coupon_code', $content);
-
// Free result
SQL_FREERESULT($result);
}