From: Florent Bruneau Date: Sun, 28 Feb 2010 21:36:26 +0000 (+0100) Subject: Add UFC_MarketingHash. X-Git-Tag: xorg/1.0.0~332^2~143 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=48885bbe40dc2a38746c478c0a43a02c284e6bb2;p=platal.git Add UFC_MarketingHash. Signed-off-by: Florent Bruneau --- diff --git a/classes/userfilter.php b/classes/userfilter.php index c76b93a..5d07eb0 100644 --- a/classes/userfilter.php +++ b/classes/userfilter.php @@ -1309,6 +1309,25 @@ class UFC_WatchContact extends UFC_Contact } // }}} +// {{{ class UFC_MarketingHash +/** Filters users using the hash generated + * to send marketing emails to him. + */ +class UFC_MarketingHash implements UserFilterCondition +{ + private $hash; + + public function __construct($hash) + { + $this->hash = $hash; + } + + public function buildCondition(PlFilter &$uf) + { + $table = $uf->addMarketingHash(); + return XDB::format('rm.hash = {?}', $this->hash); + } +} /****************** * ORDERS @@ -2555,6 +2574,25 @@ class UserFilter extends PlFilter } return $joins; } + + + /** MARKETING + */ + private $with_rm; + public function addMarketingHash() + { + $this->requireAccounts(); + $this->with_rm = true; + } + + protected function marketingJoins() + { + if ($this->with_rm) { + return array('rm' => new PlSqlJoin(PlSqlJoin::MODE_LEFT, 'register_marketing', '$ME.uid = $UID')); + } else { + return array(); + } + } } // }}}