From: Roland Häder Date: Sun, 20 Jan 2013 10:50:45 +0000 (+0000) Subject: Rewrote email if tasks has been purged X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=commitdiff_plain;h=419ba600363225629d5b81162e3fc9b52cb2dda2 Rewrote email if tasks has been purged --- diff --git a/.gitattributes b/.gitattributes index 281179139a..2298f2bd41 100644 --- a/.gitattributes +++ b/.gitattributes @@ -980,6 +980,8 @@ templates/de/emails/admin/admin_newsletter_reset.tpl svneol=native#text/plain templates/de/emails/admin/admin_order_normal.tpl svneol=native#text/plain templates/de/emails/admin/admin_payout_request.tpl svneol=native#text/plain templates/de/emails/admin/admin_payout_request_banner.tpl svneol=native#text/plain +templates/de/emails/admin/admin_purge_task.tpl svneol=native#text/plain +templates/de/emails/admin/admin_purge_task_row.tpl svneol=native#text/plain templates/de/emails/admin/admin_purge_user_server_name_log.tpl svneol=native#text/plain templates/de/emails/admin/admin_purge_user_subid_log.tpl svneol=native#text/plain templates/de/emails/admin/admin_rallye_expired.tpl svneol=native#text/plain diff --git a/inc/functions.php b/inc/functions.php index 431a5bccb0..ef0c2f1b8e 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2727,9 +2727,18 @@ function translateTaskType ($taskType) { return translateGeneric('ADMIN_TASK_TYPE', $taskType); } -//----------------------------------------------------------------------------- -// Automatically re-created functions, all taken from user comments on www.php.net -//----------------------------------------------------------------------------- +// "Translates" task status to a human-readable version +function translateTaskStatus ($taskStatus) { + // Return it + return translateGeneric('ADMIN_TASK_STATUS', $taskStatus); +} + +/* + *----------------------------------------------------------------------------- + * Automatically re-created functions, all taken from user comments on + * www.php.net + *----------------------------------------------------------------------------- + */ if (!function_exists('html_entity_decode')) { // Taken from documentation on www.php.net function html_entity_decode ($string) { diff --git a/inc/language/de.php b/inc/language/de.php index cd82b60112..709a5ffc6b 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -587,10 +587,17 @@ addMessages(array( 'ADMIN_ENTER_REDIRECT_URL' => "URL eingeben, wenn abgelehnt werden soll", 'MEMBER_REFERRAL_BANNER_404' => "Es sind noch keine Werbebanner eingerichtet worden. Bitte verwenden Sie solange Ihren Referral-Link.", 'ADMIN_ID_404' => "ID %s nicht gefunden.", + + // Columns for listing tasks 'ADMIN_ASSIGNED_ADMIN' => "Zugewiesener Admin", + 'ADMIN_ASSIGNED_ADMIN_EMAIL' => "Admin", 'ADMIN_MEMBER_USERID' => "ID des Mitgliedes", + 'ADMIN_MEMBER_USERID_EMAIL' => "Mitglied-Id", 'ADMIN_TASK_TYPE' => "Aufgabenbereich", + 'ADMIN_TASK_TYPE_EMAIL' => "Aufgabenbereich", 'ADMIN_TASK_CREATED' => "Aufgabe erstellt", + 'ADMIN_TASK_CREATED_EMAIL' => "Erstellt", + 'ADMIN_NO_ADMIN_ASSIGNED' => "Kein Admin-Login zugewiesen.", 'ADMIN_UNKNOWN_TASK_TYPE' => "Unbekannter Aufgabentyp %s für Aufgabe %s erkannt.", 'ADMIN_TASK_SYSTEM_WELCOME' => "Task-Management Ihres {?mt_word2?}", diff --git a/inc/language/task_de.php b/inc/language/task_de.php index 8f0d38b10b..ee72b0a625 100644 --- a/inc/language/task_de.php +++ b/inc/language/task_de.php @@ -86,6 +86,16 @@ addMessages(array( 'ADMIN_TASK_LIST_ACCOUNT_NO_REFERRAL_TITLE' => "Es wurden Accounts ohne Werber-Id (refid=0) gefunden.", 'ADMIN_TASK_LIST_NOTIFICATIONS' => "Alle Benachrichtigungen", 'ADMIN_TASK_LIST_NOTIFICATIONS_TITLE' => "Es sind ausgesandte,vergütete Benachrichtigungen vorhanden.", + + // Task status + 'ADMIN_TASK_STATUS_NEW' => "Neu", + 'ADMIN_TASK_STATUS_OPEN' => "Offen", + 'ADMIN_TASK_STATUS_SOLVED' => "Erledigt", + 'ADMIN_TASK_STATUS_CLOSED' => "Geschlossen", + 'ADMIN_TASK_STATUS_DELETED' => "Gelöscht", + 'ADMIN_TASK_STATUS_NULL' => "Null (!)", + 'ADMIN_TASK_STATUS_EMPTY' => "Leer (!)", + 'ADMIN_TASK_STATUS_UNKNOWN' => "Unbekannt (%s)", )); // [EOF] diff --git a/inc/purge/purge-tasks.php b/inc/purge/purge-tasks.php index 0c70c91ab0..5e6b8aa561 100644 --- a/inc/purge/purge-tasks.php +++ b/inc/purge/purge-tasks.php @@ -41,29 +41,58 @@ if (!defined('__SECURITY')) { } // END - if // Abort if autopurge is not active or disabled by admin -if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive())) { +if ((!isExtensionActive('autopurge')) || (!isAutoPurgingActive()) || (getConfig('ap_tasks_notify') == 'N')) { // Abort here return FALSE; } // END - if // Check version (must be >= 0.1.9) if ((isExtensionInstalledAndNewer('task', '0.1.9')) && (getConfig('autopurge_tasks') == 'Y')) { - // Purge deleted tasks (no notification to admin) - SQL_QUERY("DELETE LOW_PRIORITY + // Select all tasks that needs purging + $result = SQL_QUERY("SELECT + `id`, + `assigned_admin`, + `userid`, + `status`, + `task_type`, + `subject`, + `task_created` FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `status`='DELETED' AND (UNIX_TIMESTAMP() - `task_created`) >= {?ap_tasks_time?}", __FILE__, __LINE__); - // Get deleted rows - $deletedTasks = SQL_AFFECTEDROWS(); - // Send out a notification? - if (($deletedTasks > 0) && (getConfig('ap_tasks_notify') == 'Y')) { + if (!SQL_HASZERONUMS($result)) { + // Init output and load all rows + $output = ''; $ids = array(); + while ($row = SQL_FETCHARRAY($result)) { + // "Translate" creation timestamp + $row['task_created'] = generateDateTime($row['task_created'], '1'); + + // Load row template + $output .= loadEmailTemplate('admin_purge_task_row', $row); + + // Remember id number for deletion + array_push($ids, $row['id']); + } // END - while + + // Init content array + $content = array( + 'count' => SQL_NUMROWS($result), + 'rows' => $output + ); + + // Delete all tasks + SQL_QUERY('DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_task_system` WHERE `id` IN (' . implode(', ', $ids) . ')'); + // Send out email to admin - sendAdminNotification('{--ADMIN_AUTOPURGE_TASKS_SUBJECT--}', 'admin_autopurge_tsks', $deletedTasks); + sendAdminNotification('{--ADMIN_AUTOPURGE_TASKS_SUBJECT--}', 'admin_purge_task', $content); } // END - if + + // Free result + SQL_FREERESULT($result); } // END - if // diff --git a/install/tables.sql b/install/tables.sql index 66c8c9c0b2..0cc24a4e58 100644 --- a/install/tables.sql +++ b/install/tables.sql @@ -186,7 +186,7 @@ CREATE TABLE `{?_MYSQL_PREFIX?}_task_system` ( `assigned_admin` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `userid` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `status` ENUM('NEW','OPEN','SOLVED','CLOSED','DELETED') NOT NULL DEFAULT 'NEW', - `task_type` VARCHAR(255) NOT NULL DEFAULT 'FIRST_USER', + `task_type` VARCHAR(255) NOT NULL DEFAULT 'UNKNOWN', `subject` VARCHAR(255) NOT NULL DEFAULT '', `text` LONGTEXT NOT NULL, `task_created` VARCHAR(10) NOT NULL DEFAULT 0, diff --git a/templates/de/emails/admin/admin_autopurge_tsks.tpl b/templates/de/emails/admin/admin_autopurge_tsks.tpl index 053dafadb9..84d1ed3b8c 100644 --- a/templates/de/emails/admin/admin_autopurge_tsks.tpl +++ b/templates/de/emails/admin/admin_autopurge_tsks.tpl @@ -1,8 +1 @@ -Hallo Administrator, - -In Ihrem {?mt_word?} wurden $content Aufgaben gelöscht. - -Mit freundlichen Grüßen, - Ihr {?MAIN_TITLE?} Script - -{?URL?}/admin.php +@DEPRECATED diff --git a/templates/de/emails/admin/admin_purge_task.tpl b/templates/de/emails/admin/admin_purge_task.tpl new file mode 100644 index 0000000000..047ad6602e --- /dev/null +++ b/templates/de/emails/admin/admin_purge_task.tpl @@ -0,0 +1,14 @@ +Hallo Administrator, + +In Ihrem {?mt_word?} wurden $content[count] Aufgaben gelöscht. + +-------------------------------------------------------------------------- + {--ID_SELECT--} | {--ADMIN_ASSIGNED_ADMIN_EMAIL--} | {--ADMIN_MEMBER_USERID_EMAIL--} | {--ADMIN_TASK_INFOS_EMAIL--} | {--ADMIN_TASK_TYPE_EMAIL--} | {--ADMIN_TASK_CREATED_EMAIL--} +-------------------------------------------------------------------------- +$content[rows] +-------------------------------------------------------------------------- + +Mit freundlichen Grüßen, + Ihr {?MAIN_TITLE?} Script + +{?URL?}/admin.php diff --git a/templates/de/emails/admin/admin_purge_task_row.tpl b/templates/de/emails/admin/admin_purge_task_row.tpl new file mode 100644 index 0000000000..746e35ccde --- /dev/null +++ b/templates/de/emails/admin/admin_purge_task_row.tpl @@ -0,0 +1 @@ +$content[id] | {%pipe,convertZeroToNull=$content[assigned_admin]%} | {%pipe,convertZeroToNull=$content[userid]%} | {%pipe,translateTaskStatus=$content[task_type]%} | {%pipe,translateTaskType=$content[task_status]%} | $content[task_created] diff --git a/templates/de/html/ext/ext_network.tpl b/templates/de/html/ext/ext_network.tpl index e1a77f2ebb..eb5405f09a 100644 --- a/templates/de/html/ext/ext_network.tpl +++ b/templates/de/html/ext/ext_network.tpl @@ -37,3 +37,9 @@ href="http://forum.mxchange.org/topic-462.html" rel="external">in diesem Forum. Es wird dann bald im Mailer-Projekt eingebunden. + +
+ Vorraussetzungen: Diese Erweiterunge benötigt iconv, + damit die von den Werbenetzwerken verwendeten Zeichensätze nach UTF-8 + konvertiert werden können. +