Outputs iso-8859-1 in addresses list as excel cannot open utf-8 csv properly.
[platal.git] / classes / address.php
index 871526a..af0e2f0 100644 (file)
@@ -685,7 +685,7 @@ class Address
         return (!$this->text || $this->text == '');
     }
 
-    public function save()
+    public function save($notify_ungeocoded = true)
     {
         if (!$this->isEmpty()) {
             XDB::execute('INSERT IGNORE INTO  profile_addresses (pid, jobid, groupid, type, id, flags, text, postalText, pub, comment,
@@ -704,7 +704,7 @@ class Address
                                               VALUES  ({?}, {?}, {?}, {?}, {?}, {?})',
                                  $this->pid, $this->jobid, $this->groupid, $this->type, $this->id, $component_id);
                 }
-            } else {
+            } elseif ($notify_ungeocoded) {
                 // If the address was not geocoded, notifies it to the appropriate ML.
                 $mailer = new PlMailer('profile/no_geocoding.mail.tpl');
                 $mailer->assign('text', $this->text);
@@ -878,9 +878,9 @@ class Address
     }
 
     static public function iterate(array $pids = array(), array $types = array(),
-                                   array $jobids = array(), $visibility = null)
+                                   array $jobids = array(), $visibility = null, $where = null)
     {
-        return new AddressIterator($pids, $types, $jobids, $visibility);
+        return new AddressIterator($pids, $types, $jobids, $visibility, $where);
     }
 }
 
@@ -895,9 +895,12 @@ class AddressIterator implements PlIterator
 {
     private $dbiter;
 
-    public function __construct(array $pids, array $types, array $jobids, $visibility)
+    public function __construct(array $pids, array $types, array $jobids, $visibility, $_where)
     {
         $where = array();
+        if (!is_null($_where)) {
+            $where[] = $_where;
+        }
         if (count($pids) != 0) {
             $where[] = XDB::format('(pa.pid IN {?})', $pids);
         }