]> git.mxchange.org Git - mailer.git/commitdiff
Rewrote email if tasks has been purged
authorRoland Häder <roland@mxchange.org>
Sun, 20 Jan 2013 10:50:45 +0000 (10:50 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 20 Jan 2013 10:50:45 +0000 (10:50 +0000)
.gitattributes
inc/functions.php
inc/language/de.php
inc/language/task_de.php
inc/purge/purge-tasks.php
install/tables.sql
templates/de/emails/admin/admin_autopurge_tsks.tpl
templates/de/emails/admin/admin_purge_task.tpl [new file with mode: 0644]
templates/de/emails/admin/admin_purge_task_row.tpl [new file with mode: 0644]
templates/de/html/ext/ext_network.tpl

index 281179139a099a422f021e5a47a4ced8dd2be830..2298f2bd416c2dfbefcca416334d7413fb8eca51 100644 (file)
@@ -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
index 431a5bccb0cd10eb6c1b2bf24ed27a102683da84..ef0c2f1b8ed2c4b2eeee9a9352007dcbc932043e 100644 (file)
@@ -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) {
index cd82b60112c25a3d1cd89521109556bd853f322d..709a5ffc6b04a253154b72a4c0705f0e4c67e892 100644 (file)
@@ -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 <span class=\"data\">%s</span> 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 <span class=\"data\">%s</span> f&uuml;r Aufgabe <span class=\"data\">%s</span> erkannt.",
        'ADMIN_TASK_SYSTEM_WELCOME' => "Task-Management Ihres {?mt_word2?}",
index 8f0d38b10be2af9cbe86248c3cc5ff2d72fc0e35..ee72b0a625d90f74a5c77a5ae40561640adc711c 100644 (file)
@@ -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&uuml;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&ouml;scht",
+       'ADMIN_TASK_STATUS_NULL' => "Null (!)",
+       'ADMIN_TASK_STATUS_EMPTY' => "Leer (!)",
+       'ADMIN_TASK_STATUS_UNKNOWN' => "Unbekannt (%s)",
 ));
 
 // [EOF]
index 0c70c91ab05b98448b70b692728b1cd7db849975..5e6b8aa5617c4b23d4499190ddeff4869f67a217 100644 (file)
@@ -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
 
 //
index 66c8c9c0b2b400eaf69ad03dd84f4c9d60cabde9..0cc24a4e5882b2ee36acdf73de2535140ff0f7e3 100644 (file)
@@ -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,
index 053dafadb98a033629c08ac41301418f1521f4e3..84d1ed3b8c770f702d44f3f65fc969cf97cfed41 100644 (file)
@@ -1,8 +1 @@
-Hallo Administrator,
-
-In Ihrem {?mt_word?} wurden $content Aufgaben gel&ouml;scht.
-
-Mit freundlichen Gr&uuml;&szlig;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 (file)
index 0000000..047ad66
--- /dev/null
@@ -0,0 +1,14 @@
+Hallo Administrator,
+
+In Ihrem {?mt_word?} wurden $content[count] Aufgaben gel&ouml;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&uuml;&szlig;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 (file)
index 0000000..746e35c
--- /dev/null
@@ -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]
index e1a77f2ebb2b1c37fbc3b7e275e70710119bb730..eb5405f09a72dd50fc5de1d02f97db06fa78de10 100644 (file)
@@ -37,3 +37,9 @@
         href="http://forum.mxchange.org/topic-462.html" rel="external">in diesem
        Forum</a>. Es wird dann bald im Mailer-Projekt eingebunden.
 </div>
+
+<div class="para">
+       <strong>Vorraussetzungen:</strong> Diese Erweiterunge ben&ouml;tigt iconv,
+       damit die von den Werbenetzwerken verwendeten Zeichens&auml;tze nach UTF-8
+       konvertiert werden k&ouml;nnen.
+</div>