Adds AX approval date to groups.
authorStéphane Jacob <sj@m4x.org>
Thu, 30 Dec 2010 22:45:09 +0000 (23:45 +0100)
committerStéphane Jacob <sj@m4x.org>
Thu, 30 Dec 2010 22:45:09 +0000 (23:45 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/group.php
modules/xnetgrp.php
templates/xnetgrp/asso.tpl
templates/xnetgrp/edit.tpl
upgrade/1.1.0/04_xnetgrp.sql [new file with mode: 0644]

index b5f4500..48be876 100644 (file)
@@ -37,6 +37,9 @@ class Group
         }
         $this->id = intval($this->data['id']);
         $this->shortname = $this->data['diminutif'];
+        if (!is_null($this->axDate)) {
+            $this->axDate = format_datetime($this->axDate, '%d/%m/%Y');
+        }
     }
 
     public function __get($name)
index b894d64..76be456 100644 (file)
@@ -184,11 +184,17 @@ class XnetGrpModule extends PLModule
                     $page->trigError('Ni le nom ni le diminutif du groupe ne peuvent être vide.');
                     return;
                 }
+                $axDate = make_datetime(Post::v('axDate'));
+                if (Post::t('axDate') != '') {
+                    $axDate = make_datetime(Post::v('axDate'))->format('Y-m-d');
+                } else {
+                    $axDate = null;
+                }
                 XDB::execute(
                     "UPDATE  groups
                         SET  nom={?}, diminutif={?}, cat={?}, dom={?},
                              descr={?}, site={?}, mail={?}, resp={?},
-                             forum={?}, mail_domain={?}, ax={?}, pub={?},
+                             forum={?}, mail_domain={?}, ax={?}, axDate = {?}, pub={?},
                              sub_url={?}, inscriptible={?}, unsub_url={?},
                              flags={?}
                       WHERE  id={?}",
@@ -197,7 +203,7 @@ class XnetGrpModule extends PLModule
                       Post::v('descr'), $site,
                       Post::v('mail'), Post::v('resp'),
                       Post::v('forum'), Post::v('mail_domain'),
-                      Post::has('ax'), Post::v('pub'),
+                      Post::has('ax'), $axDate, Post::v('pub'),
                       Post::v('sub_url'), Post::v('inscriptible'),
                       Post::v('unsub_url'), $flags, $globals->asso('id'));
                 if (Post::v('mail_domain')) {
index 0119ece..d7a1904 100644 (file)
@@ -82,7 +82,7 @@
   {if $asso->ax}
   <tr>
     <td class="titre center" colspan="2">
-      groupe agréé par l'AX
+      groupe agréé par l'AX {if $asso->axDate}le {$asso->axDate}{/if}
     </td>
   </tr>
   {/if}
index dabde07..f6cbaf7 100644 (file)
@@ -79,7 +79,8 @@
     <tr>
       <td class="titre center" colspan="2">
         <label><input type="checkbox" value="1" name="ax" {if $asso->ax}checked="checked"{/if} />
-        groupe agréé par l'AX</label>
+        groupe agréé par l'AX</label> le <input type="text" size="10" maxlength="10" value="{$asso->axDate}" name="axDate" />
+        <small>(ex: 01/01/1970)</small>
       </td>
     </tr>
   </table>
diff --git a/upgrade/1.1.0/04_xnetgrp.sql b/upgrade/1.1.0/04_xnetgrp.sql
new file mode 100644 (file)
index 0000000..3b32205
--- /dev/null
@@ -0,0 +1,3 @@
+ALTER TABLE groups ADD COLUMN axDate DATE DEFAULT NULL;
+
+-- vim:set syntax=mysql: