0b0531dc302025d0159ae03208223edb37dc17c3
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 require_once 'diogenes/diogenes.flagset.inc.php';
43 function Payment($ref=-1)
46 $r = $ref==-1 ?
$globals->money
->mpay_def_id
: $ref;
47 $res = XDB
::query("SELECT id, text, url, flags, mail, montant_min, montant_max, montant_def, asso_id
48 FROM {$globals->money->mpay_tprefix}paiements WHERE id={?}", $r);
49 list($this->id
, $this->text
, $this->url
, $flags, $this->mail
,
50 $this->montant_min
, $this->montant_max
, $this->montant_def
, $this->asso_id
) = $res->fetchOneRow();
52 $this->montant_min
= (float)$this->montant_min
;
53 $this->montant_max
= (float)$this->montant_max
;
54 $this->flags
= new Flagset($flags);
60 // {{{ function check()
62 function check($value)
64 $v = (float)strtr($value, ',', '.');
65 if ($this->montant_min
> $v) {
66 return "Montant inférieur au minimum autorisé ({$this->montant_min}).";
67 } elseif ($v > $this->montant_max
) {
68 return "Montant supérieur au maximum autorisé ({$this->montant_max}).";
75 // {{{ function init()
77 function init($val, &$meth)
79 require_once('money/'.$meth->inc
);
80 $this->api
= new $api($val);
84 // {{{ function prepareform()
86 function prepareform()
88 return $this->api
->prepareform($this);
94 $res = XDB
::query("SELECT eid, a.diminutif FROM groupex.evenements AS e, groupex.asso AS a WHERE e.asso_id = {?} AND a.id = {?}", $this->asso_id
, $this->asso_id
);
95 return $res->fetchOneAssoc();
102 // {{{ class PayMethod
115 function PayMethod($id=-1)
118 $i = $id==-1 ?
$globals->money
->mpay_def_meth
: $id;
119 $res = XDB
::query("SELECT id,text,include FROM {$globals->money->mpay_tprefix}methodes WHERE id={?}", $i);
120 list($this->id
, $this->text
, $this->inc
) = $res->fetchOneRow();
128 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: