$mailer->assign('payment', $id);
$mailer->assign('prenom', $u['prenom']);
$mailer->assign('topay', $topay);
- $mailer->assign('to', $u['email']);
+
+ if (strpos($u['email'], '@') === false) {
+ $mailer->assign('to', $u['email'] . '@' . $globals->mail->domain);
+ } else {
+ $mailer->assign('to', $u['email']);
+ }
$mailer->send();
}
}
$page->assign('bans', $bans);
}
- function getHruid($line, $partial_result, $key)
+ function getHruid($line, $key, $relation)
{
- if (!isset($partial_result['nom']) ||
- !isset($partial_result['prenom']) ||
- !isset($partial_result['promo'])) {
- return null;
+ $prenom = CSVImporter::getValue($line, 'prenom', $relation['prenom']);
+ $nom = CSVImporter::getValue($line, 'nom', $relation['nom']);
+ $promo = CSVImporter::getValue($line, 'promo', $relation['promo']);
+
+ if ($prenom != 'NULL' && $nom != 'NULL' && $promo != 'NULL') {
+ return make_forlife($prenom, $nom, $promo);
}
- return make_forlife($partial_result['prenom'], $partial_result['nom'], $partial_result['promo']);
+ return null;
}
- function getMatricule($line, $key)
+ function getMatricule($line, $key, $relation)
{
$mat = $line['matricule'];
$year = intval(substr($mat, 0, 3));
$fields = array('hruid', 'nom', 'nom_ini', 'prenom', 'naissance_ini',
'prenom_ini', 'promo', 'promo_sortie', 'flags',
'matricule', 'matricule_ax', 'perms');
+ $importer->forceValue('hruid', array($this, 'getHruid'));
$importer->forceValue('promo', $promo);
$importer->forceValue('promo_sortie', $promo + 3);
- // The hruid generation callback is set last, so that it is called once 'promo'
- // has already been computed for that line.
- $importer->forceValue('hruid', array($this, 'getHruid'));
break;
case 'ax':
$fields = array('matricule', 'matricule_ax');
$importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
}
- function idFromMail($line, $key)
+ function idFromMail($line, $key, $relation = null)
{
static $field;
global $globals;
return $id ? $id : '0';
}
- function createHash($line, $partial_result, $key)
+ function createHash($line, $key, $relation)
{
$hash = implode(time(), $line) . rand();
$hash = md5($hash);