Merge commit 'origin/master' into account
[platal.git] / modules / payment / money / cyberpaiement.inc.php
index c79935c..a394563 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -49,10 +49,8 @@ class CyberPayment
 
         $roboturl = str_replace("https://","http://", $globals->baseurl)
             . '/' . $platal->ns . "payment/cyber_return/".S::v('uid')."?comment=".urlencode(Env::v('comment'))."&CHAMPBPX";
-        $req = XDB::query("SELECT IF(nom_usage!='', nom_usage, nom) AS nom
-                             FROM auth_user_md5
-                            WHERE user_id = {?}",S::v('uid'));
-        $name = $req->fetchOneCell();
+        $user = S::user();
+        $name = $user->lastName();
 
         // on constuit la reference de la transaction
         $prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id();
@@ -74,7 +72,7 @@ class CyberPayment
             'CHAMP101' => replace_accent(S::v('prenom')),
             'CHAMP102' => '.',
             'CHAMP103' => '.',
-            'CHAMP104' => S::v('bestalias').'@' . $globals->mail->domain,
+            'CHAMP104' => S::user()->bestEmail(),
             'CHAMP106' => '.',
             'CHAMP107' => '.',
             'CHAMP108' => '.',