X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fpayment%2Fmoney.inc.php;h=ecd49f507e8bb43fc8df334b49e299295b992456;hb=cab02a01771ad0f4ff3b4cec5b588cbcac3548f1;hp=93c69cbb8fbd986a148c703de66a1abd96a204c5;hpb=12262f1306059765d8625a6752364679c8625d31;p=platal.git diff --git a/modules/payment/money.inc.php b/modules/payment/money.inc.php index 93c69cb..ecd49f5 100644 --- a/modules/payment/money.inc.php +++ b/modules/payment/money.inc.php @@ -21,40 +21,34 @@ class Payment { - // {{{ properties - - var $id; - var $text; - var $url; - var $flags; - var $mail; - var $amount_min; - var $amount_max; - var $amount_def; - var $asso_id; - - var $api = null; - - // }}} - // {{{ constructor - - function Payment($ref=-1) + public $id; + public $text; + public $url; + public $flags; + public $mvarail; + public $amount_min; + public $amount_max; + public $amount_def; + public $asso_id; + + public $api = null; + + function Payment($ref = -1) { global $globals; - $r = $ref==-1 ? $globals->money->mpay_def_id : $ref; - $res = XDB::query("SELECT id, text, url, flags, mail, amount_min, amount_max, amount_def, asso_id - FROM payments WHERE id={?}", $r); + + $r = ($ref == -1) ? $globals->money->mpay_def_id : $ref; + $res = XDB::query('SELECT id, text, url, flags, mail, amount_min, amount_max, amount_def, asso_id + FROM payments + WHERE id = {?}', $r); list($this->id, $this->text, $this->url, $flags, $this->mail, $this->amount_min, $this->amount_max, $this->amount_def, $this->asso_id) = $res->fetchOneRow(); $this->amount_min = (float)$this->amount_min; $this->amount_max = (float)$this->amount_max; - $this->flags = new PlFlagSet($flags); + $this->flags = new PlFlagSet($flags); } - // }}} - // {{{ function check() - function check($value) { $v = (float)strtr($value, ',', '.'); @@ -67,21 +61,15 @@ class Payment } } - // }}} - // {{{ function init() - - function init($val, &$meth) + function init($val, $meth) { - require_once dirname(__FILE__).'/money/'.$meth->inc; + require_once dirname(__FILE__) . '/money/' . $meth->inc; $this->api = new $api($val); } - // }}} - // {{{ function prepareform() - - function prepareform() + function prepareform(User $user) { - return $this->api->prepareform($this); + return $this->api->prepareform($this, $user); } function event() @@ -98,34 +86,25 @@ class Payment } return null; } - // }}} } -// {{{ class PayMethod - class PayMethod { - // {{{ properties - - var $id; - var $text; - var $inc; - - // }}} - // {{{ constructor + public $id; + public $text; + public $inc; - function PayMethod($id=-1) + function PayMethod($id = -1) { global $globals; - $i = $id==-1 ? $globals->money->mpay_def_meth : $id; - $res = XDB::query("SELECT id,text,include FROM payment_methods WHERE id={?}", $i); + + $i = ($id == -1) ? $globals->money->mpay_def_meth : $id; + $res = XDB::query('SELECT id, text, include + FROM payment_methods + WHERE id = {?}', $i); list($this->id, $this->text, $this->inc) = $res->fetchOneRow(); } - - // }}} } -// }}} - // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>