New: Enhance form to post a new member
This commit is contained in:
parent
2bd29e26df
commit
4d65503352
@ -28,7 +28,7 @@
|
||||
* \file htdocs/filefunc.inc.php
|
||||
* \ingroup core
|
||||
* \brief File that include conf.php file and functions.lib.php
|
||||
* \version $Id$
|
||||
* \version $Id: filefunc.inc.php,v 1.16 2011/06/26 18:53:16 eldy Exp $
|
||||
*/
|
||||
|
||||
define('DOL_VERSION','3.1.0-alpha'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z)
|
||||
@ -125,9 +125,9 @@ $real_dolibarr_main_document_root=str_replace('\\','/',realpath($dolibarr_main_d
|
||||
$pathroot=$_SERVER["DOCUMENT_ROOT"];
|
||||
$paths=explode('/',str_replace('\\','/',$_SERVER["SCRIPT_NAME"]));
|
||||
$concatpath='';
|
||||
foreach($paths as $path)
|
||||
foreach($paths as $tmppath)
|
||||
{
|
||||
if ($path) $concatpath.='/'.$path;
|
||||
if ($tmppath) $concatpath.='/'.$tmppath;
|
||||
//print $real_$dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
|
||||
if ($real_dolibarr_main_document_root == realpath($pathroot.$concatpath))
|
||||
{
|
||||
|
||||
@ -76,6 +76,7 @@ EditMember=Edit member
|
||||
SubscriptionEndDate=Subscription's end date
|
||||
MembersTypeSetup=Members type setup
|
||||
NewSubscription=New subscription
|
||||
NewSubscriptionDesc=This form allows you to record your subscription as a new member of the foundation. If you want to renew your subscription being already a member, please contact foundation board instead.
|
||||
Subscription=Subscription
|
||||
Subscriptions=Subscriptions
|
||||
SubscriptionLate=Late
|
||||
@ -182,3 +183,4 @@ NewMemberForm=New member form
|
||||
SubscriptionsStatistics=Statistics on subscriptions
|
||||
NbOfSubscriptions=Number of subscriptions
|
||||
AmountOfSubscriptions=Amount of subscriptions
|
||||
TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation)
|
||||
@ -77,6 +77,7 @@ EditMember=Édition adhérent
|
||||
SubscriptionEndDate=Date de fin adhésion
|
||||
MembersTypeSetup=Configuration des types d'adhérents
|
||||
NewSubscription=Nouvelle adhésion
|
||||
NewSubscriptionDesc=Ce formulaire permet de vous enregistrer comme nouvel adhérent de l'association. Pour un renouvellement si vous êtes déjà adhérent, contacter plutôt l'association.
|
||||
Subscription=Adhésion/cotisation
|
||||
Subscriptions=Adhésions/cotisations
|
||||
SubscriptionLate=En retard
|
||||
@ -182,4 +183,5 @@ NewMemberbyWeb=Nouvel Adherent ajoute. En attente de validation
|
||||
NewMemberForm=Nouvel Adherent form
|
||||
SubscriptionsStatistics=Statistiques sur les cotisations
|
||||
NbOfSubscriptions=Nombre de cotisations
|
||||
AmountOfSubscriptions=Montant de cotisations
|
||||
AmountOfSubscriptions=Montant de cotisations
|
||||
TurnoverOrBudget=Chiffre affaire (pour société) ou Budget (asso ou collectivité)
|
||||
@ -24,7 +24,7 @@
|
||||
* \file htdocs/lib/company.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module societe
|
||||
* \ingroup societe
|
||||
* \version $Id$
|
||||
* \version $Id: company.lib.php,v 1.119 2011/06/26 18:53:16 eldy Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -208,7 +208,7 @@ function societe_admin_prepare_head($object)
|
||||
|
||||
|
||||
/**
|
||||
* Return country translated from an id or a code
|
||||
* Return country label, code or id from an id or a code
|
||||
* @param id Id or code of country
|
||||
* @param withcode 0=Return label, 1=Return code + label, 2=Return code from id
|
||||
* @param dbtouse Database handler (using in global way may fail because of conflicts with some autoload features)
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* \file htdocs/public/members/new.php
|
||||
* \ingroup member
|
||||
* \brief Example of form to add a new member
|
||||
* \version $Id$
|
||||
* \version $Id: new.php,v 1.27 2011/06/26 18:54:23 eldy Exp $
|
||||
*/
|
||||
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
@ -32,6 +32,8 @@ require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/extrafields.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->adherent->enabled)) accessforbidden('',1,1,1);
|
||||
@ -43,176 +45,206 @@ $langs->load("companies");
|
||||
$langs->load("install");
|
||||
$langs->load("other");
|
||||
|
||||
// Init vars
|
||||
$errmsg='';
|
||||
$num=0;
|
||||
$error=0;
|
||||
$backtopage=GETPOST('backtopage');
|
||||
$action=GETPOST('action');
|
||||
|
||||
|
||||
// Function for page HTML header
|
||||
function llxHeaderVierge($title, $head = "")
|
||||
function llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
global $user, $conf, $langs, $mysoc;
|
||||
top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
|
||||
print '<body id="mainbody">';
|
||||
|
||||
header("Content-type: text/html; charset=".$conf->file->character_set_client);
|
||||
// Print logo
|
||||
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
||||
|
||||
print "<html>\n";
|
||||
print "<head>\n";
|
||||
print "<title>".$title."</title>\n";
|
||||
if ($head) print $head."\n";
|
||||
print "</head>\n";
|
||||
print "<body>\n";
|
||||
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small);
|
||||
}
|
||||
elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo);
|
||||
$width=128;
|
||||
}
|
||||
elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.png'))
|
||||
{
|
||||
$urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
|
||||
}
|
||||
print '<center>';
|
||||
print '<img alt="Logo" title="" src="'.$urllogo.'" />';
|
||||
print '</center><br>';
|
||||
|
||||
print '<div style="margin-left: 50px; margin-right: 50px;">';
|
||||
}
|
||||
|
||||
// Function for page HTML footer
|
||||
function llxFooterVierge()
|
||||
{
|
||||
print "</body>\n";
|
||||
print "</html>\n";
|
||||
print '</div>';
|
||||
|
||||
print "</body>\n";
|
||||
print "</html>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$errmsg='';
|
||||
$num=0;
|
||||
$error=0;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Action called when submited page
|
||||
if ($_POST["action"] == 'add')
|
||||
if ($action == 'add')
|
||||
{
|
||||
// test si le login existe deja
|
||||
$login=$_POST["login"];
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if(!isset($_POST["login"]) || $_POST["login"]='')
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Login"))."<br>\n";
|
||||
}
|
||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$login."';";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
}
|
||||
if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='')
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n";
|
||||
}
|
||||
if (!isset($_POST["email"]) || $_POST["email"] == '' || !preg_match('/@/',$_POST["email"]))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||
}
|
||||
{
|
||||
if ($num !=0)
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
|
||||
}
|
||||
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"]!=$_POST["pass2"])
|
||||
{
|
||||
$error+=1;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
|
||||
}
|
||||
}
|
||||
if (isset($_POST["naiss"]) && $_POST["naiss"] !='')
|
||||
{
|
||||
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$_POST["naiss"]))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
|
||||
}
|
||||
}
|
||||
if (isset($public))
|
||||
{
|
||||
$public=1;
|
||||
}else{
|
||||
$public=0;
|
||||
}
|
||||
// test si le login existe deja
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
if(! GETPOST('login'))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Login"))."<br>\n";
|
||||
}
|
||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
}
|
||||
if ($num !=0)
|
||||
{
|
||||
$error+=1;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
|
||||
}
|
||||
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"]!=$_POST["pass2"])
|
||||
{
|
||||
$error+=1;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
|
||||
}
|
||||
if (! GETPOST("email"))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||
}
|
||||
}
|
||||
if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='')
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n";
|
||||
}
|
||||
if (GETPOST("email") && ! isValidEmail(GETPOST("email")))
|
||||
{
|
||||
$error+=1;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorBadEMail",GETPOST("email"))."<br>\n";
|
||||
}
|
||||
$birthday=dol_mktime($_POST["birthhour"],$_POST["birthmin"],$_POST["birthsec"],$_POST["birthmonth"],$_POST["birthday"],$_POST["birthyear"]);
|
||||
if ($_POST["birthmonth"] && empty($birthday))
|
||||
{
|
||||
$error+=1;
|
||||
$langs->load("errors");
|
||||
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
|
||||
}
|
||||
if (isset($public))
|
||||
{
|
||||
$public=1;
|
||||
}else{
|
||||
$public=0;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// email a peu pres correct et le login n'existe pas
|
||||
$adh = new Adherent($db);
|
||||
$adh->statut = -1;
|
||||
$adh->public = $_POST["public"];
|
||||
$adh->prenom = $_POST["prenom"];
|
||||
$adh->nom = $_POST["nom"];
|
||||
$adh->societe = $_POST["societe"];
|
||||
$adh->adresse = $_POST["adresse"];
|
||||
$adh->cp = $_POST["cp"];
|
||||
$adh->ville = $_POST["ville"];
|
||||
$adh->email = $_POST["email"];
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
$adh->login = $login;
|
||||
$adh->pass = $_POST["pass1"];
|
||||
}
|
||||
$adh->photo = $_POST["photo"];
|
||||
$adh->note = $_POST["note"];
|
||||
$adh->pays = $_POST["pays"];
|
||||
$adh->typeid = $_POST["type"];
|
||||
$adh->note = $_POST["comment"];
|
||||
$adh->morphy = $_POST["morphy"];
|
||||
if (preg_match('/-/',$_POST["naiss"])) $adh->naiss = dol_stringtotime($_POST["naiss"],1);
|
||||
else $adh->naiss = $_POST["naiss"];
|
||||
if (! $error)
|
||||
{
|
||||
// email a peu pres correct et le login n'existe pas
|
||||
$adh = new Adherent($db);
|
||||
$adh->statut = -1;
|
||||
$adh->public = $_POST["public"];
|
||||
$adh->prenom = $_POST["prenom"];
|
||||
$adh->nom = $_POST["nom"];
|
||||
$adh->civilite_id = $_POST["civilite_id"];
|
||||
$adh->societe = $_POST["societe"];
|
||||
$adh->adresse = $_POST["address"];
|
||||
$adh->cp = $_POST["zipcode"];
|
||||
$adh->ville = $_POST["town"];
|
||||
$adh->email = $_POST["email"];
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
$adh->login = $_POST["login"];
|
||||
$adh->pass = $_POST["pass1"];
|
||||
}
|
||||
$adh->photo = $_POST["photo"];
|
||||
$adh->note = $_POST["note"];
|
||||
$adh->pays_id = $_POST["pays_id"];
|
||||
$adh->typeid = $_POST["type"];
|
||||
$adh->note = $_POST["comment"];
|
||||
$adh->morphy = $_POST["morphy"];
|
||||
$adh->naiss = $birthday;
|
||||
|
||||
foreach($_POST as $key => $value){
|
||||
if (preg_match("/^options_/",$key)){
|
||||
$adh->array_options[$key]=$_POST[$key];
|
||||
}
|
||||
}
|
||||
foreach($_POST as $key => $value){
|
||||
if (preg_match("/^options_/",$key)){
|
||||
$adh->array_options[$key]=$_POST[$key];
|
||||
}
|
||||
}
|
||||
|
||||
$result=$adh->create($user->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
$adh->cotisation(dol_mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
}
|
||||
$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)
|
||||
{
|
||||
$result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1);
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
$result=$adh->send_an_email($conf->global->ADHERENT_AUTOREGISTER_MAIL,$conf->global->ADHERENT_AUTOREGISTER_MAIL_SUBJECT,array(),array(),array(),"","",0,-1);
|
||||
}
|
||||
|
||||
Header("Location: new.php?action=added");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg .= join('<br>',$adh->errors);
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]."?action=added");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg .= join('<br>',$adh->errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Action called after a submited was send and member created succesfully
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'added')
|
||||
// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
|
||||
// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
|
||||
if ($action == 'added')
|
||||
{
|
||||
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
|
||||
{
|
||||
llxHeaderVierge($langs->trans("NewMemberForm"));
|
||||
llxHeaderVierge($langs->trans("NewMemberForm"));
|
||||
|
||||
// Si on a pas ete redirige
|
||||
print '<br>';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print "<tr><td><FONT COLOR=\"blue\">".$langs->trans("NewMemberbyWeb")."</FONT></td></tr>\n";
|
||||
print '</table>';
|
||||
// Si on a pas ete redirige
|
||||
print '<br>';
|
||||
print '<center>';
|
||||
print $langs->trans("NewMemberbyWeb");
|
||||
print '</center>';
|
||||
|
||||
llxFooterVierge('$Date$ - $Revision$');
|
||||
exit;
|
||||
}
|
||||
llxFooterVierge('$Date: 2011/06/26 18:54:23 $ - $Revision: 1.27 $');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@ -222,85 +254,194 @@ if (isset($_GET["action"]) && $_GET["action"] == 'added')
|
||||
*/
|
||||
|
||||
$html = new Form($db);
|
||||
|
||||
$formcompany = new FormCompany($db);
|
||||
$adht = new AdherentType($db);
|
||||
$adho = new ExtraFields($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extrafields->fetch_name_optionals_label('member'); // fetch optionals attributes and labels
|
||||
|
||||
|
||||
llxHeaderVierge($langs->trans("NewSubscription"));
|
||||
|
||||
print_titre($langs->trans("NewSubscription"));
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$adho->fetch_name_optionals_label();
|
||||
print $langs->trans("NewSubscriptionDesc").'<br>';
|
||||
if (! empty($conf->global->MEMBER_NEWFORM_TEXT)) print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."<br>\n";
|
||||
|
||||
if ($errmsg != '')
|
||||
{
|
||||
print '<br>';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<th>'.$langs->trans("Error").'</th>';
|
||||
print '<tr><td class="delete"><b>'.$errmsg.'</b></td></tr>'."\n";
|
||||
// print "<FONT COLOR=\"red\">$errmsg</FONT>\n";
|
||||
print '</table>';
|
||||
}
|
||||
dol_htmloutput_errors($errmsg);
|
||||
|
||||
if (defined("ADH_TEXT_NEW_ADH") && ADH_TEXT_NEW_ADH !='')
|
||||
{
|
||||
print ADH_TEXT_NEW_ADH;
|
||||
print "<BR>\n";
|
||||
}
|
||||
print '<br>'.$langs->trans("FieldsWithAreMandatory",'*').'<br>';
|
||||
print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
|
||||
|
||||
print "<form action=\"new.php\" method=\"POST\">\n";
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(document).ready(function () {
|
||||
jQuery("#morphy").click(function() {
|
||||
if (jQuery("#morphy").val()==\'phy\') {
|
||||
jQuery("#trcompany").hide();
|
||||
}
|
||||
if (jQuery("#morphy").val()==\'mor\') {
|
||||
jQuery("#trcompany").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
jQuery("#selectpays_id").change(function() {
|
||||
document.newmember.action.value="create";
|
||||
document.newmember.submit();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
// Print form
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'."\n";
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Type").'</td><td width="35%">';
|
||||
print $html->selectarray("type", $adht->liste_array());
|
||||
print "</td>\n";
|
||||
print '</tr>'."\n";
|
||||
print '<table class="border">'."\n";
|
||||
|
||||
// Type
|
||||
if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE))
|
||||
{
|
||||
print '<tr><td width="15%">'.$langs->trans("Type").' <FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT></td><td width="35%">';
|
||||
print $html->selectarray("type", $adht->liste_array(), GETPOST('type'), 1);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
|
||||
print $adht->libelle;
|
||||
print '<input type="hidden" id="type" name="type" value="'.$conf->global->MEMBER_NEWFORM_FORCETYPE.'">';
|
||||
}
|
||||
// Moral/Physic attribute
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td>'.$langs->trans("MorPhy")."</td><td>\n";
|
||||
print $html->selectarray("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT> '.$langs->trans("Lastname").'</td><td><input type="text" name="nom" size="40" value="'.dol_escape_htmltag(GETPOST('nom')).'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT> '.$langs->trans("Firstname").'</td><td><input type="text" name="prenom" size="40" value="'.dol_escape_htmltag(GETPOST('prenom')).'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
||||
if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("MorPhy").' <FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT> </td><td>'."\n";
|
||||
print $html->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
|
||||
print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">';
|
||||
}
|
||||
// Civility
|
||||
print '<tr><td>'.$langs->trans("Civility").'</td><td>';
|
||||
print $formcompany->select_civilite(GETPOST('civilite_id'),'civilite_id').'</td></tr>'."\n";
|
||||
// Lastname
|
||||
print '<tr><td>'.$langs->trans("Lastname").' <FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT></td><td><input type="text" name="nom" size="40" value="'.dol_escape_htmltag(GETPOST('nom')).'"></td></tr>'."\n";
|
||||
// Firstname
|
||||
print '<tr><td>'.$langs->trans("Firstname").' <FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT></td><td><input type="text" name="prenom" size="40" value="'.dol_escape_htmltag(GETPOST('prenom')).'"></td></tr>'."\n";
|
||||
// Company
|
||||
print '<tr id="trcompany"><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
|
||||
// Address
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.dol_escape_htmltag(GETPOST('adresse')).'</textarea></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.dol_escape_htmltag(GETPOST('cp')).'"> <input type="text" name="ville" size="40" value="'.dol_escape_htmltag(GETPOST('ville')).'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$pays.'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT> Email</td><td><input type="text" name="email" size="40" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||
print '<textarea name="address" id="address" wrap="soft" cols="40" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address')).'</textarea></td></tr>'."\n";
|
||||
// Zip / Town
|
||||
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown(GETPOST('zipcode'),'zipcode',array('town','selectpays_id','departement_id'),6);
|
||||
print ' / ';
|
||||
print $formcompany->select_ziptown(GETPOST('town'),'town',array('zipcode','selectpays_id','departement_id'));
|
||||
print '</td></tr>';
|
||||
// Country
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td>';
|
||||
$pays_id=GETPOST('pays_id');
|
||||
if (! GETPOST('pays_id') && ! empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) $pays_id=getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE,2,$db,$langs);
|
||||
if (! GETPOST('pays_id') && ! empty($conf->geoip->enabled)) $pays_id=$pays_id; // TODO
|
||||
$pays_code=getCountry($pays_id,2,$db,$langs);
|
||||
print $html->select_country($pays_id,'pays_id');
|
||||
print '</td></tr>';
|
||||
// State
|
||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||
if ($pays_id) print $formcompany->select_state(GETPOST("departement_id"),$pays_code);
|
||||
else print '';
|
||||
print '</td></tr>';
|
||||
}
|
||||
// EMail
|
||||
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT> <FONT COLOR="blue">**</FONT></td><td><input type="text" name="email" size="40" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||
// Login
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
||||
{
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Password").'</td><td><input type="password" name="pass1" size="40"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("PasswordAgain").'</td><td><input type="password" name="pass2" size="40"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" size="20" value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Password").' <FONT COLOR="red">*</FONT></td><td><input type="password" name="pass1" size="20" value="'.GETPOST("pass1").'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("PasswordAgain").' <FONT COLOR="red">*</FONT></td><td><input type="password" name="pass2" size="20" value="'.GETPOST("pass2").'"></td></tr>'."\n";
|
||||
}
|
||||
print '<tr><td>'.$langs->trans("Birthday").'<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.dol_escape_htmltag(GETPOST('naiss')).'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="blue">**</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
|
||||
// Birthday
|
||||
print '<tr><td>'.$langs->trans("Birthday").'</td><td>';
|
||||
print $html->select_date($birthday,'birth',0,0,1,"newmember");
|
||||
print '</td></tr>'."\n";
|
||||
// Photo
|
||||
print '<tr><td>'.$langs->trans("URLPhoto").' <FONT COLOR="blue">**</FONT></td><td><input type="text" name="photo" size="40" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
|
||||
// Public
|
||||
print '<tr><td>'.$langs->trans("Public").' ?</td><td><input type="checkbox" name="public" value="1" checked></td></tr>'."\n";
|
||||
foreach($adho->attribute_label as $key=>$value){
|
||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>"."\n";
|
||||
// Extrafields
|
||||
foreach($extrafields->attribute_label as $key=>$value)
|
||||
{
|
||||
print "<tr><td>".$value."</td><td>";
|
||||
print $extrafields->showInputField($key,GETPOST('options_'.$key));
|
||||
print "</td></tr>"."\n";
|
||||
}
|
||||
// Comments
|
||||
print '<tr>';
|
||||
print '<td valign="top">'.$langs->trans("Comments").' :</td>';
|
||||
print '<td valign="top"><textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_5.'">'.dol_escape_htmltag(GETPOST('comment')).'</textarea></td>';
|
||||
print '<td valign="top"><textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_4.'">'.dol_escape_htmltag(GETPOST('comment')).'</textarea></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>'."\n";
|
||||
// Add specific fields used by Dolibarr foundation for example
|
||||
if (! empty($conf->global->MEMBER_DOLIBARR))
|
||||
{
|
||||
$arraybudget=array('50'=>'<= 100 000','100'=>'<= 200 000','200'=>'<= 500 000','400'=>'<= 1 500 000','750'=>'<= 3 000 000','1500'=>'<= 5 000 000','2000'=>'5 000 000+');
|
||||
print '<tr id="trbudget"><td>'.$langs->trans("TurnoverOrBudget").'</td><td>';
|
||||
print $html->select_array('budget', $arraybudget, GETPOST('budget'), 1);
|
||||
print ' € or $';
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
initturnover();
|
||||
jQuery("#morphy").click(function() {
|
||||
initturnover();
|
||||
});
|
||||
jQuery("#budget").change(function() {
|
||||
jQuery("#amount").val(jQuery("#budget").val());
|
||||
});
|
||||
function initturnover() {
|
||||
if (jQuery("#morphy").val()==\'phy\') {
|
||||
jQuery("#amount").val(20);
|
||||
jQuery("#trbudget").hide();
|
||||
jQuery("#trcompany").hide();
|
||||
}
|
||||
if (jQuery("#morphy").val()==\'mor\') {
|
||||
jQuery("#trbudget").show();
|
||||
jQuery("#trcompany").show();
|
||||
jQuery("#amount").val(0);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '<tr><td>'.$langs->trans("AmountOfSubscriptions").'</td><td>';
|
||||
print '<input type="text" name="amount" id="amount" class="flat" size="6" value="'.GETPOST("amount").'">';
|
||||
print ' € or $';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</form>\n";
|
||||
// Save
|
||||
print '<br><center>';
|
||||
print '<input type="submit" value="'.$langs->trans("Save").'" id="submitsave" class="button">';
|
||||
if ($backtopage)
|
||||
{
|
||||
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button">';
|
||||
}
|
||||
print '</center>';
|
||||
|
||||
print "<br></form>\n";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooterVierge('$Date$ - $Revision$');
|
||||
llxFooterVierge('$Date: 2011/06/26 18:54:23 $ - $Revision: 1.27 $');
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user