Indicates delivery issues on addresses (Closes #1356).
authorStéphane Jacob <sj@m4x.org>
Sat, 27 Nov 2010 21:35:00 +0000 (22:35 +0100)
committerStéphane Jacob <sj@m4x.org>
Sat, 27 Nov 2010 21:35:52 +0000 (22:35 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/address.php
templates/profile/adresses.address.tpl
upgrade/1.0.2/00_address.sql [new file with mode: 0644]
upgrade/1.0.2/connect.db.inc.php [new symlink]

index c3c0dea..d5f7f87 100644 (file)
@@ -81,12 +81,13 @@ class Address
     public $pub = 'private';
 
     // Database's fields required for 'home' addresses.
-    public $flags = null; // 'current', 'temporary', 'secondary', 'mail', 'cedex'
+    public $flags = null; // 'current', 'temporary', 'secondary', 'mail', 'cedex', 'deliveryIssue'
     public $comment = null;
     public $current = null;
     public $temporary = null;
     public $secondary = null;
     public $mail = null;
+    public $deliveryIssue = null;
 
     // Remaining fields that do not belong to profile_addresses.
     public $phones = array();
@@ -105,7 +106,7 @@ class Address
         if (!is_null($this->flags)) {
             $this->flags = new PlFlagSet($this->flags);
         } else {
-            static $flags = array('current', 'temporary', 'secondary', 'mail');
+            static $flags = array('current', 'temporary', 'secondary', 'mail', 'deliveryIssue');
 
             $this->flags = new PlFlagSet();
             foreach ($flags as $flag) {
@@ -211,7 +212,7 @@ class Address
             $address['pub'] = $this->pub;
         }
         if ($this->type == self::LINK_PROFILE) {
-            static $flags = array('current', 'temporary', 'secondary', 'mail', 'cedex');
+            static $flags = array('current', 'temporary', 'secondary', 'mail', 'cedex', 'deliveryIssue');
 
             foreach ($flags as $flag) {
                 $address[$flag] = $this->flags->hasFlag($flag);
@@ -231,11 +232,12 @@ class Address
         }
         if ($this->type == self::LINK_PROFILE) {
             static $flags = array(
-                'current'   => 'actuelle',
-                'temporary' => 'temporaire',
-                'secondary' => 'secondaire',
-                'mail'      => 'conctactable par courier',
-                'cedex'     => 'type cédex',
+                'current'       => 'actuelle',
+                'temporary'     => 'temporaire',
+                'secondary'     => 'secondaire',
+                'mail'          => 'conctactable par courier',
+                'deliveryIssue' => 'n\'habite pas à l\'adresse indiquée',
+                'cedex'         => 'type cédex',
             );
 
             $address .= ', commentaire : ' . $this->comment;
index 82ee6d4..207b1e0 100644 (file)
             on peut {if $isMe}m'{/if}y envoyer du courrier par la poste
           </label>
         </div>
+        {if !t($isMe)}
+        <div>
+          <label>
+            <input type="checkbox" name="{$prefname}[deliveryIssue]" {if $address.deliveryIssue}checked="checked"{/if} />
+            n'habite pas à l'adresse indiquée
+          </label>
+        </div>
+        {else}
+        <div style="display: none"><input type="hidden" name="deliveryIssue" value="{$address.deliveryIssue}" /></div>
+        {/if}
         <div>
           <label>
             Commentaire&nbsp;:
diff --git a/upgrade/1.0.2/00_address.sql b/upgrade/1.0.2/00_address.sql
new file mode 100644 (file)
index 0000000..c5621b8
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE profile_addresses MODIFY COLUMN flags SET('current','temporary','secondary','mail','cedex', 'deliveryIssue') DEFAULT NULL;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.2/connect.db.inc.php b/upgrade/1.0.2/connect.db.inc.php
new file mode 120000 (symlink)
index 0000000..442fab7
--- /dev/null
@@ -0,0 +1 @@
+../../bin/connect.db.inc.php
\ No newline at end of file