From: Stéphane Jacob Date: Mon, 30 Apr 2012 16:23:57 +0000 (+0200) Subject: Adds a distinct flag for ax snail mails. X-Git-Tag: xorg/1.1.5~6 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f75a1212e621e79fd2a773e7e45d0ef4442d410a;p=platal.git Adds a distinct flag for ax snail mails. Signed-off-by: Stéphane Jacob --- diff --git a/classes/address.php b/classes/address.php index e5f677c..47ce17c 100644 --- a/classes/address.php +++ b/classes/address.php @@ -726,6 +726,32 @@ class Address $req = new AddressReq(S::user(), $this->toFormArray(), $this->pid, $this->jobid, $this->groupid, $this->type, $this->id); $req->submit(); } + + if ($this->pid != 0) { + $this->updateAxMail(); + } + } + } + + private function updateAxMail() + { + XDB::execute("UPDATE profile_addresses + SET flags = REPLACE(flags, 'ax_mail', '') + WHERE pid = {?}", + $this->pid); + + $ax_mail = XDB::fetchOneAssoc("SELECT pid, jobid, groupid, type, id + FROM profile_addresses + WHERE pub IN ('public', 'ax') AND FIND_IN_SET('mail', flags) AND pid = {?} + ORDER BY NOT FIND_IN_SET('current', flags), + FIND_IN_SET('secondary', flags), type = 'job'", + $this->pid); + + if ($ax_mail) { + XDB::execute("UPDATE profile_addresses + SET flags = CONCAT(flags, ',ax_mail') + WHERE pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}", + $ax_mail['pid'], $ax_mail['jobid'], $ax_mail['groupid'], $ax_mail['type'], $ax_mail['id']); } } diff --git a/upgrade/1.1.5/09_addresses.sql b/upgrade/1.1.5/09_addresses.sql new file mode 100644 index 0000000..1ee3aa0 --- /dev/null +++ b/upgrade/1.1.5/09_addresses.sql @@ -0,0 +1,3 @@ +ALTER TABLE profile_addresses MODIFY COLUMN flags SET('current','temporary','secondary','mail','cedex','deliveryIssue', 'ax_mail') DEFAULT NULL; + +-- vim:set syntax=mysql: diff --git a/upgrade/1.1.5/README b/upgrade/1.1.5/README new file mode 100644 index 0000000..ef75029 --- /dev/null +++ b/upgrade/1.1.5/README @@ -0,0 +1,2 @@ +Please run (in bin/): ./formatAddresses.php -t p -r a +