Bugfix: Fehler bei neu erstellten Accounts und deren Autoresponder Kosmetik: Abgeschaltete Autoresponder werden in der Übersichtsseite nicht mehr aufgeführt
bernd

bernd commited on 2012-02-25 15:26:11
Zeige 3 geänderte Dateien mit 26 Einfügungen und 23 Löschungen.


git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2210 87cf0b9e-d624-0410-a070-f6ee81989793
... ...
@@ -23,7 +23,7 @@ else {
23 23
 }
24 24
 
25 25
 
26
-$is_autoresponder = is_array($account['autoresponder']);
26
+$is_autoresponder = is_array($account['autoresponder']) && $account['autoresponder']['valid_from'] != NULL;
27 27
 $is_forward = (count($account['forwards']) > 0);
28 28
 $is_mailbox = ($account['password'] != NULL  ||  $id == 0);
29 29
 $numforwards = max(count($account['forwards']), 1);
... ...
@@ -214,27 +214,6 @@ function save_vmail_account($account)
214 214
     }
215 215
   }
216 216
 
217
-  if (is_array($account['autoresponder'])) {
218
-    $ar = $account['autoresponder'];
219
-    $valid_from = maybe_null($ar['valid_from']);
220
-    $valid_until = maybe_null($ar['valid_until']);
221
-    $fromname = maybe_null( mysql_real_escape_string($ar['fromname']) );
222
-    $fromaddr = NULL;
223
-    if ($ar['fromaddr']) {
224
-      $fromaddr = mysql_real_escape_string(check_emailaddr($ar['fromaddr']));
225
-    }
226
-    $fromaddr = maybe_null( $fromaddr );
227
-    $subject = maybe_null( mysql_real_escape_string($ar['subject']));
228
-    $message = mysql_real_escape_string($ar['message']);
229
-    $quote = "'inline'";
230
-    if ($ar['quote'] == 'attach')
231
-      $quote = "'attach'";
232
-    elseif ($ar['quote'] == NULL)
233
-      $quote = 'NULL';
234
-    db_query("REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
235
-             "VALUES ({$account['id']}, {$valid_from}, {$valid_until}, {$fromname}, {$fromaddr}, {$subject}, '{$message}', {$quote})");
236
-  }
237
-    
238 217
   $password='NULL';
239 218
   if ($account['password'] != '')
240 219
   {
... ...
@@ -311,6 +290,30 @@ function save_vmail_account($account)
311 290
     $query .= "WHERE id={$id} LIMIT 1;";
312 291
     db_query($query); 
313 292
   }
293
+
294
+  if (is_array($account['autoresponder'])) {
295
+    $ar = $account['autoresponder'];
296
+    $valid_from = maybe_null($ar['valid_from']);
297
+    $valid_until = maybe_null($ar['valid_until']);
298
+    $fromname = maybe_null( mysql_real_escape_string($ar['fromname']) );
299
+    $fromaddr = NULL;
300
+    if ($ar['fromaddr']) {
301
+      $fromaddr = mysql_real_escape_string(check_emailaddr($ar['fromaddr']));
302
+    }
303
+    $fromaddr = maybe_null( $fromaddr );
304
+    $subject = maybe_null( mysql_real_escape_string($ar['subject']));
305
+    $message = mysql_real_escape_string($ar['message']);
306
+    $quote = "'inline'";
307
+    if ($ar['quote'] == 'attach')
308
+      $quote = "'attach'";
309
+    elseif ($ar['quote'] == NULL)
310
+      $quote = 'NULL';
311
+    db_query("REPLACE INTO mail.vmail_autoresponder (account, valid_from, valid_until, fromname, fromaddr, subject, message, quote) ".
312
+             "VALUES ({$id}, {$valid_from}, {$valid_until}, {$fromname}, {$fromaddr}, {$subject}, '{$message}', {$quote})");
313
+  }
314
+    
315
+
316
+
314 317
   if (! $newaccount)
315 318
     db_query("DELETE FROM mail.vmail_forward WHERE account={$id}");
316 319
 
... ...
@@ -86,7 +86,7 @@ if (count($sorted_by_domains) > 0)
86 86
             $valid_until = $acc['autoresponder']['valid_until'];
87 87
             if ($valid_from == NULL) {
88 88
               // Autoresponder abgeschaltet
89
-              array_push($actions, "<strike>Automatische Antwort versenden</strike> (Abgeschaltet)");
89
+              //array_push($actions, "<strike>Automatische Antwort versenden</strike> (Abgeschaltet)");
90 90
             } elseif ($valid_from > $now) {
91 91
               array_push($actions, "<strike>Automatische Antwort versenden</strike> (Wird aktiviert am {$valid_from})");
92 92
             } elseif ($valid_until == NULL) {
93 93