Fix emails/send JS for users without contacts.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 2 Mar 2013 17:26:29 +0000 (18:26 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 2 Mar 2013 17:26:31 +0000 (18:26 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
templates/emails/send.tpl

index 88c9f32..0a321b6 100644 (file)
     var form = document.forms.form_mail;
     var toc = "";
     var ccc = "";
-    for (var i = 0 ; i < form['to_contacts[]'].length ; ++i) {
-      toc += form['to_contacts[]'].options[i].value + ";";
-    }
-    for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) {
-      ccc += form['cc_contacts[]'].options[i].value + ";";
+    if (form['to_contacts[]'] != undefined) {
+      for (var i = 0 ; i < form['to_contacts[]'].length ; ++i) {
+        toc += form['to_contacts[]'].options[i].value + ";";
+      }
+      for (var i = 0 ; i < form['cc_contacts[]'].length ; ++i) {
+        ccc += form['cc_contacts[]'].options[i].value + ";";
+      }
     }
     $.xpost("emails/send",
            { save: true,