Skip to content
Snippets Groups Projects
Commit e626d331 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

New: Can edit options of autosubscribe form for member module

parent 47a41153
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -306,7 +306,7 @@ ConnectionTimeout=Connexion timeout
ResponseTimeout=Response timeout
SmsTestMessage=Test message from __PHONEFROM__ to __PHONETO__
ModuleMustBeEnabledFirst=Module <b>%s</b> must be enabled first before using this feature.
SecurityToken=Security token
SecurityToken=Key to encrypt urls
# Modules
Module0Name=Users & groups
......
......@@ -307,7 +307,7 @@ ConnectionTimeout=Timeout de connexion
ResponseTimeout=Timeout de réponse
SmsTestMessage=Message de test de __PHONEFROM__ vers __PHONETO__
ModuleMustBeEnabledFirst=Le module <b>%s</b> doit etre activé pour utiliser cette fonction.
SecurityToken=Jeton de sécurité
SecurityToken=Clé de cryptage des url
# Modules= undefined
Module0Name= Utilisateurs & groupes
......
......@@ -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)
{
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
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: ".$_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 '</center>';
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 '<input type="hidden" id="type" name="type" value="'.$conf->global->MEMBER_NEWFORM_FORCETYPE.'">';
}
// Moral/Physic attribute
......@@ -498,5 +502,5 @@ print "<br></form>\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 $');
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment