diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index a92d3ca7d5a..90f05b864f2 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -25,7 +25,7 @@
* \file htdocs/adherents/class/adherent.class.php
* \ingroup member
* \brief File of class to manage members of a foundation
- * \version $Id$
+ * \version $Id: adherent.class.php,v 1.44 2011/07/03 16:55:31 eldy Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@@ -274,7 +274,7 @@ class Adherent extends CommonObject
$sql.= " VALUES (";
$sql.= " '".$this->db->idate($this->datec)."'";
$sql.= ", ".($this->login?"'".$this->db->escape($this->login)."'":"null");
- $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be create by a guest or a script
+ $sql.= ", ".($user->id>0?$user->id:"null"); // Can be null because member can be createb by a guest or a script
$sql.= ", null, null, '".$this->morphy."'";
$sql.= ", '".$this->typeid."'";
$sql.= ", ".$conf->entity;
@@ -288,6 +288,7 @@ class Adherent extends CommonObject
if ($id > 0)
{
$this->id=$id;
+ $this->ref=$id;
// Update minor fields
$result=$this->update($user,1,1); // nosync is 1 to avoid update data of user
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 47f4ec5df96..2058244178c 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -306,7 +306,7 @@ ConnectionTimeout=Connexion timeout
ResponseTimeout=Response timeout
SmsTestMessage=Test message from __PHONEFROM__ to __PHONETO__
ModuleMustBeEnabledFirst=Module %s must be enabled first before using this feature.
-SecurityToken=Security token
+SecurityToken=Key to encrypt urls
# Modules
Module0Name=Users & groups
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 933c1c78700..d03c568bef9 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de connexion
ResponseTimeout=Timeout de réponse
SmsTestMessage=Message de test de __PHONEFROM__ vers __PHONETO__
ModuleMustBeEnabledFirst=Le module %s doit etre activé pour utiliser cette fonction.
-SecurityToken=Jeton de sécurité
+SecurityToken=Clé de cryptage des url
# Modules= undefined
Module0Name= Utilisateurs & groupes
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index d2099e5b124..9bbe93d951f 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -22,7 +22,7 @@
* \file htdocs/public/members/new.php
* \ingroup member
* \brief Example of form to add a new member
- * \version $Id: new.php,v 1.30 2011/07/03 16:00:19 eldy Exp $
+ * \version $Id: new.php,v 1.31 2011/07/03 16:55:31 eldy Exp $
*
* Note that you can add following constant to change behaviour of page
* MEMBER_NEWFORM_AMOUNT Default amount for autosubscribe form
@@ -110,15 +110,14 @@ function llxFooterVierge()
-
/*
* Actions
*/
-// Action called when submited page
+// Action called when page is submited
if ($action == 'add')
{
- // test si le login existe deja
+ // test if login already exists
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
if(! GETPOST('login'))
@@ -221,33 +220,38 @@ if ($action == 'add')
$result=$adh->create($user->id);
if ($result > 0)
{
- if ($cotisation > 0)
- {
- $adh->cotisation(dol_mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
- }
-
// Send email to say it has been created and will be validated soon...
- if ($conf->global->ADHERENT_AUTOREGISTER_MAIL && $conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT)
+ if (! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL) && ! empty($conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT))
{
$result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1);
}
- if ($backtopage)
+ if ($backtopage) $urlback=$backtopage;
+ else if ($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION) $urlback=$conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
+ else $urlback=$_SERVER["PHP_SELF"]."?action=added";
+
+ if (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
{
- Header("Location: ".$backtopage);
- exit;
- }
- else if ($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)
- {
- // Si conf->global->MEMBER_URL_REDIRECT_SBUSCRIPTION defini, faire redirect sur page.
- Header("Location: ".$conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION);
- exit;
- }
- else
- {
- Header("Location: ".$_SERVER["PHP_SELF"]."?action=added");
- exit;
+ if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox')
+ {
+ $urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?source=membersubscription&ref='.$adh->ref;
+ if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
+ }
+ else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
+ {
+ $urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.$adh->ref;
+ if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
+ }
+ else
+ {
+ dol_print_error('',"Autosubscribe form is setup to ask an online payment for a not managed online payment");
+ exit;
+ }
}
+
+ dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
+ Header("Location: ".$urlback);
+ exit;
}
else
{
@@ -269,7 +273,7 @@ if ($action == 'added')
print $langs->trans("NewMemberbyWeb");
print '';
- llxFooterVierge('$Date: 2011/07/03 16:00:19 $ - $Revision: 1.30 $');
+ llxFooterVierge('$Date: 2011/07/03 16:55:31 $ - $Revision: 1.31 $');
exit;
}
@@ -344,7 +348,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE))
else
{
$adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
- print $adht->libelle;
+ //print $adht->libelle;
print '';
}
// Moral/Physic attribute
@@ -498,5 +502,5 @@ print " \n";
$db->close();
-llxFooterVierge('$Date: 2011/07/03 16:00:19 $ - $Revision: 1.30 $');
+llxFooterVierge('$Date: 2011/07/03 16:55:31 $ - $Revision: 1.31 $');
?>