From 004ff79e4c5f3740d13b342ae8678f7680f96f3f Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 30 Dec 2010 23:45:09 +0100 Subject: [PATCH] Adds AX approval date to groups. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/group.php | 3 +++ modules/xnetgrp.php | 10 ++++++++-- templates/xnetgrp/asso.tpl | 2 +- templates/xnetgrp/edit.tpl | 3 ++- upgrade/1.1.0/04_xnetgrp.sql | 3 +++ 5 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 upgrade/1.1.0/04_xnetgrp.sql diff --git a/classes/group.php b/classes/group.php index b5f4500..48be876 100644 --- a/classes/group.php +++ b/classes/group.php @@ -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) diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index b894d64..76be456 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -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')) { diff --git a/templates/xnetgrp/asso.tpl b/templates/xnetgrp/asso.tpl index 0119ece..d7a1904 100644 --- a/templates/xnetgrp/asso.tpl +++ b/templates/xnetgrp/asso.tpl @@ -82,7 +82,7 @@ {if $asso->ax} - groupe agréé par l'AX + groupe agréé par l'AX {if $asso->axDate}le {$asso->axDate}{/if} {/if} diff --git a/templates/xnetgrp/edit.tpl b/templates/xnetgrp/edit.tpl index dabde07..f6cbaf7 100644 --- a/templates/xnetgrp/edit.tpl +++ b/templates/xnetgrp/edit.tpl @@ -79,7 +79,8 @@ + groupe agréé par l'AX le + (ex: 01/01/1970) diff --git a/upgrade/1.1.0/04_xnetgrp.sql b/upgrade/1.1.0/04_xnetgrp.sql new file mode 100644 index 0000000..3b32205 --- /dev/null +++ b/upgrade/1.1.0/04_xnetgrp.sql @@ -0,0 +1,3 @@ +ALTER TABLE groups ADD COLUMN axDate DATE DEFAULT NULL; + +-- vim:set syntax=mysql: -- 2.1.4