projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implements the first API handler (/api/1/user/<user>/isRegistered). It
[platal.git]
/
include
/
validations
/
marketing.inc.php
diff --git
a/include/validations/marketing.inc.php
b/include/validations/marketing.inc.php
index
c8fbb9a
..
c0d2707
100644
(file)
--- a/
include/validations/marketing.inc.php
+++ b/
include/validations/marketing.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
08
Polytechnique.org *
+ * Copyright (C) 2003-20
10
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-26,36
+26,29
@@
class MarkReq extends Validate
public $perso;
public $perso;
- public $m_
id
;
+ public $m_
user
;
public $m_email;
public $m_email;
- public $m_nom;
- public $m_prenom;
- public $m_promo;
public $m_relance;
public $m_type;
public $m_data;
public $m_relance;
public $m_type;
public $m_data;
+ public $m_personal_notes;
- public $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
- demandeur marque sa propre adresse mail, refuser dans tous les cas.
+ public $rules = "Accepter si l'adresse
e
mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
+ demandeur marque sa propre adresse
e
mail, refuser dans tous les cas.
Ne pas marqueter au nom de Polytechnique.org plus d'une fois par an.
Sauf abus flagrant, il n'y a pas de raison de refuser des marketing perso répétés.";
// }}}
// {{{ constructor
Ne pas marqueter au nom de Polytechnique.org plus d'une fois par an.
Sauf abus flagrant, il n'y a pas de raison de refuser des marketing perso répétés.";
// }}}
// {{{ constructor
- public function __construct(
$sender, $mark_id, $email, $perso, $type, $data
)
+ public function __construct(
User &$sender, User &$mark, $email, $perso, $type, $data, $personal_notes
)
{
parent::__construct($sender, false, 'marketing');
{
parent::__construct($sender, false, 'marketing');
- $this->m_
id = $mark_id
;
+ $this->m_
user = &$mark
;
$this->m_email = $email;
$this->perso = $perso;
$this->m_type = $type;
$this->m_data = $data;
$this->m_email = $email;
$this->perso = $perso;
$this->m_type = $type;
$this->m_data = $data;
-
- $res = XDB::query('SELECT u.nom, u.prenom, u.promo
- FROM auth_user_md5 AS u
- WHERE user_id = {?}
- GROUP BY u.user_id', $mark_id);
- list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow();
+ $this->m_personal_notes = $personal_notes;
}
// }}}
}
// }}}
@@
-64,11
+57,11
@@
class MarkReq extends Validate
public function formu()
{
$res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance)
public function formu()
{
$res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance)
- FROM a
uth_user_md5 AS u
- LEFT JOIN register_pending AS p ON p.uid =
u.user_
id
- LEFT JOIN register_marketing AS m ON m.uid =
u.user_
id
- WHERE
user_
id = {?}',
-
$this->m_id
);
+ FROM a
ccounts AS a
+ LEFT JOIN register_pending AS p ON p.uid =
a.u
id
+ LEFT JOIN register_marketing AS m ON m.uid =
a.u
id
+ WHERE
a.u
id = {?}',
+
$this->m_user->id()
);
$this->m_relance = $res->fetchOneCell();
return 'include/form.valid.mark.tpl';
}
$this->m_relance = $res->fetchOneCell();
return 'include/form.valid.mark.tpl';
}
@@
-78,7
+71,7
@@
class MarkReq extends Validate
protected function _mail_subj()
{
protected function _mail_subj()
{
- return "[Polytechnique.org] Marketing de {$this->m_
prenom} {$this->m_nom} ({$this->m_promo
})";
+ return "[Polytechnique.org] Marketing de {$this->m_
user->fullName()} ({$this->m_user->promo()
})";
}
// }}}
}
// }}}
@@
-87,12
+80,14
@@
class MarkReq extends Validate
protected function _mail_body($isok)
{
if ($isok) {
protected function _mail_body($isok)
{
if ($isok) {
- return " Un mail de marketing vient d'être envoyé "
- .($this->perso ? 'en ton nom' : 'en notre nom')
- ." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à s'inscrire !\n\n"
- ."Merci de ta participation !\n";
+ return " Un email de marketing vient d'être envoyé "
+ . ($this->perso ? 'en ton nom' : 'en notre nom')
+ . " à {$this->m_user->fullName()} ({$this->m_user->promo()}) "
+ . "pour l'encourager à s'inscrire !\n\n"
+ . "Merci de ta participation !\n";
} else {
} else {
- return " Nous n'avons pas jugé bon d'envoyer de mail de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
+ return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à "
+ . "{$this->m_user->fullName()} ({$this->m_user->promo()}).";
}
}
}
}
@@
-101,7
+96,7
@@
class MarkReq extends Validate
public function commit()
{
public function commit()
{
- $market = Marketing::get($this->m_
id
, $this->m_email);
+ $market = Marketing::get($this->m_
user->id()
, $this->m_email);
if ($market == null) {
return false;
}
if ($market == null) {
return false;
}