Fix for rewritting code #2
authorRoland Häder <roland@mxchange.org>
Wed, 18 Nov 2009 04:22:04 +0000 (04:22 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 18 Nov 2009 04:22:04 +0000 (04:22 +0000)
inc/modules/admin/what-admins_mails.php
templates/de/html/admin/admin_admins_mails_edit_row.tpl
templates/de/html/admin/admin_admins_mails_list_row.tpl

index 3f4159727d4e8c36ae765cc537c40ff508b2b7fb..21ad2e4bdb11bfe6324953b55dcc4cd2be902cfe 100644 (file)
@@ -52,7 +52,7 @@ if (isPostRequestElementSet('edit')) {
                $SW = 2; $rowNameS = '';
                foreach (postRequestElement('sel') as $template => $sel) {
                        // First of all load data from DB
-                       $result = SQL_QUERY_ESC("SELECT `admin_id`, `id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC",
+                       $result = SQL_QUERY_ESC("SELECT `admin_id`, `id`, `mail_template` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC",
                                array($template), __FILE__, __LINE__);
                        $OUT = '';
                        $adminId2 = '0';
@@ -131,7 +131,7 @@ ORDER BY
 
                                // Update entry
                                addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET admin_id=%s WHERE `id`=%s ORDER BY `id` LIMIT 1",
-                               array($content['admin_id'], $id), __FILE__, __LINE__, false));
+                                       array($content['admin_id'], $id), __FILE__, __LINE__, false));
 
                                if (($content['admin_id'] < 1) && (isPostRequestElementSet('template', $id))) {
                                        // Remove any other admin entries
@@ -150,19 +150,27 @@ ORDER BY
                        runFilterChain('run_sqls');
 
                        // Query again...
-                       $result = SQL_QUERY("SELECT m.id, m.admin_id, a.login, m.mail_template FROM `{?_MYSQL_PREFIX?}_admins_mails` AS m, `{?_MYSQL_PREFIX?}_admins` AS a WHERE m.admin_id=a.id OR m.admin_id < 1 ORDER BY m.admin_id", __FILE__, __LINE__);
+                       $result = SQL_QUERY("SELECT
+       m.id, m.admin_id, a.login, m.mail_template
+FROM
+       `{?_MYSQL_PREFIX?}_admins_mails` AS m
+LEFT JOIN
+       `{?_MYSQL_PREFIX?}_admins` AS a
+ON
+       m.admin_id=a.id
+WHERE
+       (m.admin_id=a.id OR m.admin_id < 1) AND m.mail_template != ''
+ORDER BY
+       m.admin_id ASC,
+       m.mail_template ASC", __FILE__, __LINE__);
                } // END - if
 
                // List found entries
                $OUT = ''; $SW = 2;
-               while ($data = SQL_FETCHARRAY($result)) {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare content
-                       $content = array(
-                               'sw'   => $SW,
-                               'id'   => $data['id'],
-                               'tpl'  => $data['mail_template'],
-                               'alnk' => generateAdminLink($data['admin_id'])
-                       );
+                       $content['sw']   = $SW;
+                       $content['alnk'] = generateAdminLink($content['admin_id']);
 
                        // Load row template
                        $OUT .= loadTemplate('admin_admins_mails_list_row', true, $content);
index 2759d8134ed8f671e4526e205602aa90ad107579..0bb276ffaaa0c871c585c4dc650d340f95703d75 100644 (file)
@@ -1,7 +1,7 @@
 <tr>
        <td align="center" class="switch_sw$content[sw] bottom right">
-       $content[tpl] <input type="hidden" name="template[$content[id2]]"
-               value="$content[tpl]"></td>
+       $content[mail_template] <input type="hidden" name="template[$content[id2]]"
+               value="$content[mail_template]"></td>
        <td align="center" class="switch_sw$content[sw] bottom">
        $content[content]</td>
 </tr>
index 3d129db86066b1ae4fd73fbc2f6a4f7b624d8775..5a8d8057661663f69a79cc86c0bf59c175557c06 100644 (file)
@@ -1,9 +1,9 @@
 <tr>
        <td class="switch_sw$content[sw] bottom right" align="center">
-               <input type="checkbox" title="{--ID_SELECT--} $content[id]" name="sel[$content[tpl]]" class="admin_normal" value="1" />
+               <input type="checkbox" title="{--ID_SELECT--} $content[id]" name="sel[$content[mail_template]]" class="admin_normal" value="1" />
        </td>
        <td class="switch_sw$content[sw] bottom right" align="center">
-               $content[tpl]
+               $content[mail_template]
        </td>
        <td class="switch_sw$content[sw] bottom" align="center">
                $content[alnk]