From 1a23aaf6bfb6020596d77ea64ecb8df4c89cc3c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 4 Jul 2011 00:45:40 +0000 Subject: [PATCH] Fixes/rewrites --- inc/functions.php | 2 +- inc/language/coupon_de.php | 1 + inc/modules/admin/what-send_coupon.php | 29 ++++++++++++++------------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 7e6e5f8adb..f539b61a2d 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -266,7 +266,7 @@ function generatePassword ($length = '0', $exclude = array()) { // 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 diff --git a/inc/language/coupon_de.php b/inc/language/coupon_de.php index 1974e5cacf..53b82e28d3 100644 --- a/inc/language/coupon_de.php +++ b/inc/language/coupon_de.php @@ -57,6 +57,7 @@ addMessages(array( '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", diff --git a/inc/modules/admin/what-send_coupon.php b/inc/modules/admin/what-send_coupon.php index 9cf143b81f..84309479f8 100644 --- a/inc/modules/admin/what-send_coupon.php +++ b/inc/modules/admin/what-send_coupon.php @@ -116,24 +116,27 @@ if (isFormSent()) { // 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); } -- 2.39.2