mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix: Creation from public form works again
This commit is contained in:
parent
359e5c15ff
commit
fca2f764ff
|
|
@ -64,6 +64,7 @@ For users:
|
|||
- Fix: A lot of fixes in PDF generators.
|
||||
- Fix: Bad line/pagebreak with long description of products on PDF.
|
||||
- Fix: Option force invoice date to validation date working correctly.
|
||||
- Fix: Creation of a member from the example public page works.
|
||||
|
||||
For translators:
|
||||
- Added 10 more new language files.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
*
|
||||
|
|
@ -136,7 +136,7 @@ class Adherent extends CommonObject
|
|||
\remarks %INFOS% : l'ensemble des attributs de cet adherent
|
||||
\remarks %SERVEUR% : URL du serveur web
|
||||
\remarks etc..
|
||||
*/
|
||||
*/
|
||||
function send_an_email($text,$subject,
|
||||
$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),
|
||||
$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=-1, $errors_to='')
|
||||
|
|
@ -274,8 +274,9 @@ class Adherent extends CommonObject
|
|||
$sql.= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type)";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= " '".$this->db->idate($this->datec)."',";
|
||||
$sql.= " '".addslashes($this->login)."',";
|
||||
$sql.= " '".$user->id."',null,null,'".$this->morphy."',";
|
||||
$sql.= " '".$this->login."',";
|
||||
$sql.= " ".($user->id>0?$user->id:"null").","; // Can be null because member can be create by a guest
|
||||
$sql.= " null,null,'".$this->morphy."',";
|
||||
$sql.= " '".$this->typeid."'";
|
||||
$sql.= ")";
|
||||
|
||||
|
|
@ -310,6 +311,7 @@ class Adherent extends CommonObject
|
|||
|
||||
if (sizeof($this->errors))
|
||||
{
|
||||
dol_syslog("Adherent::create ".join(',',$this->errors), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
|
@ -322,6 +324,7 @@ class Adherent extends CommonObject
|
|||
else
|
||||
{
|
||||
$this->error='Failed to get last insert id';
|
||||
dol_syslog("Adherent::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
|
@ -329,6 +332,7 @@ class Adherent extends CommonObject
|
|||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("Adherent::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -383,7 +387,7 @@ class Adherent extends CommonObject
|
|||
$sql.= ", naiss=" .($this->naiss?"'".$this->db->idate($this->naiss)."'":"null");
|
||||
if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation
|
||||
if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent
|
||||
$sql.= ", fk_user_mod=".$user->id;
|
||||
$sql.= ", fk_user_mod=".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("Adherent::update sql=".$sql);
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/admin/adherent.php
|
||||
\ingroup adherent
|
||||
\brief Page d'administration/configuration du module Adherent
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/admin/adherent.php
|
||||
* \ingroup adherent
|
||||
* \brief Page d'administration/configuration du module Adherent
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||
|
|
@ -34,7 +34,7 @@ $langs->load("admin");
|
|||
$langs->load("members");
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$typeconst=array('yesno','texte','chaine');
|
||||
|
|
@ -71,12 +71,13 @@ if ($_GET["action"] == 'unset')
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
/*
|
||||
* Interface de configuration de certaines variables de la partie adherent
|
||||
*/
|
||||
|
||||
$var=True;
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
|
@ -157,23 +158,23 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
|||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||
{
|
||||
$lien=img_tick().' ';
|
||||
$lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales rattache au theme Mailman
|
||||
$constantes=array('ADHERENT_MAILMAN_LISTS',
|
||||
$lien=img_tick().' ';
|
||||
$lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales rattache au theme Mailman
|
||||
$constantes=array('ADHERENT_MAILMAN_LISTS',
|
||||
'ADHERENT_MAILMAN_LISTS_COTISANT',
|
||||
'ADHERENT_MAILMAN_ADMINPW',
|
||||
'ADHERENT_MAILMAN_SERVER',
|
||||
'ADHERENT_MAILMAN_UNSUB_URL',
|
||||
'ADHERENT_MAILMAN_URL'
|
||||
);
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien,'');
|
||||
form_constantes($constantes);
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien,'');
|
||||
form_constantes($constantes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien,'');
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("Mailman - Systeme de mailing listes",$lien,'');
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
|
|
@ -187,145 +188,149 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
|||
$var=!$var;
|
||||
if ($conf->global->ADHERENT_USE_SPIP)
|
||||
{
|
||||
$lien=img_tick().' ';
|
||||
$lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales rattache au theme Mailman
|
||||
$constantes=array('ADHERENT_USE_SPIP_AUTO',
|
||||
$lien=img_tick().' ';
|
||||
$lien.='<a href="adherent.php?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
|
||||
// Edition des varibales globales rattache au theme Mailman
|
||||
$constantes=array('ADHERENT_USE_SPIP_AUTO',
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
'ADHERENT_SPIP_DB',
|
||||
'ADHERENT_SPIP_USER',
|
||||
'ADHERENT_SPIP_PASS'
|
||||
);
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien,'');
|
||||
form_constantes($constantes);
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien,'');
|
||||
form_constantes($constantes);
|
||||
}
|
||||
else
|
||||
{
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien,'');
|
||||
$lien='<a href="adherent.php?action=set&value=1&name=ADHERENT_USE_SPIP">'.$langs->trans("Activate").'</a>';
|
||||
print_fiche_titre("SPIP - Systeme de publication en ligne",$lien,'');
|
||||
}
|
||||
|
||||
print "<hr>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
* Edition des varibales globales non rattache a un theme specifique
|
||||
* Edition des variables globales non rattache a un theme specifique
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
'ADHERENT_CARD_HEADER_TEXT',
|
||||
'ADHERENT_CARD_TEXT',
|
||||
'ADHERENT_CARD_FOOTER_TEXT',
|
||||
'ADHERENT_ETIQUETTE_TYPE'
|
||||
);
|
||||
print_fiche_titre($langs->trans("Other"),'','');
|
||||
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
|
||||
'ADHERENT_AUTOREGISTER_MAIL',
|
||||
'ADHERENT_MAIL_VALID_SUBJECT',
|
||||
'ADHERENT_MAIL_VALID',
|
||||
'ADHERENT_MAIL_COTIS_SUBJECT',
|
||||
'ADHERENT_MAIL_COTIS',
|
||||
'ADHERENT_MAIL_RESIL_SUBJECT',
|
||||
'ADHERENT_MAIL_RESIL',
|
||||
'ADHERENT_MAIL_FROM',
|
||||
'ADHERENT_CARD_HEADER_TEXT',
|
||||
'ADHERENT_CARD_TEXT',
|
||||
'ADHERENT_CARD_FOOTER_TEXT',
|
||||
'ADHERENT_ETIQUETTE_TYPE'
|
||||
);
|
||||
print_fiche_titre($langs->trans("Other"),'','');
|
||||
|
||||
print $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%,';
|
||||
print '%SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%,';
|
||||
//print '%INFOS%'; Deprecated
|
||||
print '<br>';
|
||||
print $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%,';
|
||||
print '%SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%,';
|
||||
//print '%INFOS%'; Deprecated
|
||||
print '<br>';
|
||||
|
||||
form_constantes($constantes);
|
||||
form_constantes($constantes);
|
||||
|
||||
|
||||
$db->close();
|
||||
$db->close();
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
|
||||
function form_constantes($tableau)
|
||||
{
|
||||
// Variables globales
|
||||
global $db,$bc,$langs;
|
||||
$form = new Form($db);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
function form_constantes($tableau)
|
||||
{
|
||||
// Variables globales
|
||||
global $db,$bc,$langs;
|
||||
$form = new Form($db);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Value").'</td>';
|
||||
print '<td>'.$langs->trans("Type").'</td>';
|
||||
print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
foreach($tableau as $const){
|
||||
$sql = "SELECT rowid, name, value, type, note FROM ".MAIN_DB_PREFIX."const WHERE name='$const'";
|
||||
$result = $db->query($sql);
|
||||
if ($result && ($db->num_rows() == 1)) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form action="adherent.php" method="POST">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="'.$obj->name.'">';
|
||||
print '<input type="hidden" name="constnote" value="'.nl2br($obj->note).'">';
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Affiche nom constante
|
||||
print '<td>';
|
||||
print $langs->trans("Desc".$obj->name) != ("Desc".$obj->name) ? $langs->trans("Desc".$obj->name) : $obj->note;
|
||||
print "</td>\n";
|
||||
|
||||
if ($obj->name == 'ADHERENT_ETIQUETTE_TYPE')
|
||||
foreach($tableau as $const)
|
||||
{
|
||||
print '<td>';
|
||||
// List of possible labels. Values must exists in
|
||||
// file htdocs/adherents/PDF_Card.class.php
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
|
||||
$pdfcardstatic=new PDF_card('5160',1,1,'mm');
|
||||
$arrayoflabels=array_keys($pdfcardstatic->_Avery_Labels);
|
||||
$sql = "SELECT rowid, name, value, type, note FROM ".MAIN_DB_PREFIX."const WHERE name='".$const."'";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form action="adherent.php" method="POST">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<input type="hidden" name="constname" value="'.$obj->name.'">';
|
||||
print '<input type="hidden" name="constnote" value="'.nl2br($obj->note).'">';
|
||||
|
||||
$form->select_array('constvalue',$arrayoflabels,$obj->value,1,0,1);
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Affiche nom constante
|
||||
print '<td>';
|
||||
print $langs->trans("Desc".$const) != ("Desc".$const) ? $langs->trans("Desc".$const) : $obj->note;
|
||||
print "</td>\n";
|
||||
|
||||
if ($const == 'ADHERENT_ETIQUETTE_TYPE')
|
||||
{
|
||||
print '<td>';
|
||||
// List of possible labels. Values must exists in
|
||||
// file htdocs/adherents/PDF_Card.class.php
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/modules/member/PDF_card.class.php');
|
||||
$pdfcardstatic=new PDF_card('5160',1,1,'mm');
|
||||
$arrayoflabels=array_keys($pdfcardstatic->_Avery_Labels);
|
||||
|
||||
$form->select_array('constvalue',$arrayoflabels,$obj->value,1,0,1);
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->type == 'yesno')
|
||||
{
|
||||
print $form->selectyesno('constvalue',$obj->value,1);
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),0);
|
||||
}
|
||||
elseif ($obj->type == 'texte')
|
||||
{
|
||||
print '<textarea class="flat" name="constvalue" cols="35" rows="5" wrap="soft">';
|
||||
print $obj->value;
|
||||
print "</textarea>\n";
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" class="flat" size="30" name="constvalue" value="'.$obj->value.'">';
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),2);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button"> ';
|
||||
// print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</form>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
if ($obj->type == 'yesno')
|
||||
{
|
||||
print $form->selectyesno('constvalue',$obj->value,1);
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),0);
|
||||
}
|
||||
elseif ($obj->type == 'texte')
|
||||
{
|
||||
print '<textarea class="flat" name="constvalue" cols="35" rows="5" wrap="soft">';
|
||||
print $obj->value;
|
||||
print "</textarea>\n";
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" class="flat" size="30" name="constvalue" value="'.$obj->value.'">';
|
||||
print '</td><td>';
|
||||
$form->select_array('consttype',array('yesno','texte','chaine'),2);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align="center">';
|
||||
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Update").'" name="Button"> ';
|
||||
// print '<a href="adherent.php?name='.$const.'&action=unset">'.img_delete().'</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</form>';
|
||||
$i++;
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ AddSubscription=Ajout adhésion
|
|||
ShowSubscription=Afficher adhésion
|
||||
MemberModifiedInDolibarr=Adhérent modifié dans Dolibarr
|
||||
SendAnEMailToMember=Envoyer email d'information à l'adhérent
|
||||
DescADHERENT_AUTOREGISTER_MAIL_SUBJECT=Sujet du mail envoyé en cas d'autoinscription d'un invité
|
||||
DescADHERENT_AUTOREGISTER_MAIL=Mail envoyé en cas d'autoinscription d'un invité
|
||||
DescADHERENT_MAIL_VALID_SUBJECT=Sujet du mail de validation adhérent
|
||||
DescADHERENT_MAIL_VALID=Mail de validation adhérent
|
||||
DescADHERENT_MAIL_COTIS_SUBJECT=Sujet du mail de validation cotisation
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/public/members/new.php
|
||||
\ingroup adherent
|
||||
\brief Form example to add a new member
|
||||
\version $Id$
|
||||
* \file htdocs/public/members/new.php
|
||||
* \ingroup adherent
|
||||
* \brief Form example to add a new member
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("../../master.inc.php");
|
||||
|
|
@ -31,13 +31,16 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php");
|
|||
require_once(DOL_DOCUMENT_ROOT."/adherents/adherent_options.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.form.class.php");
|
||||
|
||||
// Define lang object automatically using browser language
|
||||
$langs->setDefaultLang('auto');
|
||||
|
||||
// Load translation files
|
||||
$langs->load("main");
|
||||
$langs->load("members");
|
||||
$langs->load("companies");
|
||||
|
||||
|
||||
// Function for page HTML header
|
||||
function llxHeaderVierge($title, $head = "")
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
|
@ -50,6 +53,7 @@ function llxHeaderVierge($title, $head = "")
|
|||
print "<body>\n";
|
||||
}
|
||||
|
||||
// Function for page HTML footer
|
||||
function llxFooter()
|
||||
{
|
||||
print "</body>\n";
|
||||
|
|
@ -57,7 +61,7 @@ function llxFooter()
|
|||
}
|
||||
|
||||
|
||||
$adho = new AdherentOptions($db);
|
||||
|
||||
$errmsg='';
|
||||
$num=0;
|
||||
$error=0;
|
||||
|
|
@ -67,43 +71,53 @@ $error=0;
|
|||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Action called when submited page
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
// test si le login existe deja
|
||||
$login=$_POST["login"];
|
||||
if(!isset($_POST["login"]) || $_POST["login"]='')
|
||||
{
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Login $login vide. Veuillez en positionner un<BR>\n";
|
||||
$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) {
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows();
|
||||
}
|
||||
if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]==''){
|
||||
if (!isset($_POST["nom"]) || !isset($_POST["prenom"]) || $_POST["prenom"]=='' || $_POST["nom"]=='')
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Nom et Prenom obligatoires<BR>\n";
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name"))."<br>\n";
|
||||
}
|
||||
if (!isset($_POST["email"]) || $_POST["email"] == '' || !ereg('@',$_POST["email"])){
|
||||
if (!isset($_POST["email"]) || $_POST["email"] == '' || !ereg('@',$_POST["email"]))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Adresse Email invalide<BR>\n";
|
||||
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||
}
|
||||
if ($num !=0){
|
||||
if ($num !=0)
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Login ".$login." deja utilise. Veuillez en changer<BR>\n";
|
||||
$errmsg .= $langs->trans("ErrorLoginAlreadyUsed")."<br>\n";
|
||||
}
|
||||
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"]!=$_POST["pass2"]){
|
||||
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"]!=$_POST["pass2"])
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Password invalide<BR>\n";
|
||||
$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"])){
|
||||
if (isset($_POST["naiss"]) && $_POST["naiss"] !='')
|
||||
{
|
||||
if (!preg_match("/^\d\d\d\d-\d\d-\d\d$/",$_POST["naiss"]))
|
||||
{
|
||||
$error+=1;
|
||||
$errmsg .="Date de naissance invalide (Format AAAA-MM-JJ)<BR>\n";
|
||||
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
|
||||
}
|
||||
}
|
||||
if (isset($public)){
|
||||
if (isset($public))
|
||||
{
|
||||
$public=1;
|
||||
}else{
|
||||
$public=0;
|
||||
|
|
@ -143,59 +157,72 @@ if ($_POST["action"] == 'add')
|
|||
{
|
||||
if ($cotisation > 0)
|
||||
{
|
||||
$adh->cotisation(mktime(12, 0 , 0, $remonth, $reday, $reyear), $cotisation);
|
||||
$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);
|
||||
}
|
||||
|
||||
// Envoi d'un Email de confirmation au nouvel adherent
|
||||
$adh->send_an_email($email,$conf->adherent->email_new,$conf->adherent->email_new_subject);
|
||||
Header("Location: new.php?action=added");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$errmsg .= join('<br>',$adh->errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On vient de s'inscrire avec succes
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'added' && $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)
|
||||
// Action called after a submited was send and member created succesfully
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'added')
|
||||
{
|
||||
// Si conf->global->MEMBER_URL_REDIRECT_SBUSCRIPTION defini, faire redirect sur page.
|
||||
Header("Location: ".$conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION);
|
||||
exit;
|
||||
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("New member form");
|
||||
|
||||
// Si on a pas ete redirige
|
||||
print '<br>';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print "<tr><td><FONT COLOR=\"blue\">Nouvel Adherent ajoute. En attente de validation</FONT></td></tr>\n";
|
||||
print '</table>';
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeaderVierge("New member form");
|
||||
$html = new Form($db);
|
||||
|
||||
print_titre($langs->trans("NewMember"));
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation d'une fiche
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
$adht = new AdherentType($db);
|
||||
$adho = new AdherentOptions($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$adho->fetch_name_optionals_label();
|
||||
|
||||
if (isset($_GET["action"]) && $_GET["action"] == 'added')
|
||||
{
|
||||
// Si on a pas ete redirige
|
||||
print '<br>';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print "<tr><td><FONT COLOR=\"blue\">Nouvel Adherent ajoute. En attente de validation</FONT></td></tr>\n";
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($errmsg != '')
|
||||
{
|
||||
print '<br>';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<th>Erreur dans le formulaire</th>';
|
||||
print "<tr><td class=\"delete\"><b>'.$errmsg.'</b></td></tr>\n";
|
||||
print '<tr><td class="delete"><b>'.$errmsg.'</b></td></tr>'."\n";
|
||||
// print "<FONT COLOR=\"red\">$errmsg</FONT>\n";
|
||||
print '</table>';
|
||||
}
|
||||
|
|
@ -213,13 +240,13 @@ print "</ul><BR>\n";
|
|||
print "<form action=\"new.php\" method=\"POST\">\n";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">';
|
||||
print '<table cellspacing="0" border="1" width="100%" cellpadding="3">'."\n";
|
||||
|
||||
print '<tr><td width="15%">'.$langs->trans("Type").'</td><td width="35%">';
|
||||
$html->select_array("type", $adht->liste_array());
|
||||
print "</td>\n";
|
||||
|
||||
print '<td width="50%" valign="top">'.$langs->trans("Comments").' :</td></tr>';
|
||||
print '<td width="50%" valign="top">'.$langs->trans("Comments").' :</td></tr>'."\n";
|
||||
|
||||
$morphys["phy"] = "Physique";
|
||||
$morphys["mor"] = "Morale";
|
||||
|
|
@ -227,26 +254,26 @@ print '<tr><td>'.$langs->trans("MorPhy")."</td><td>\n";
|
|||
$html->select_array("morphy", $morphys);
|
||||
print "</td>\n";
|
||||
|
||||
print '<td valign="top" rowspan="14"><textarea name="comment" wrap="soft" cols="40" rows="25">'.$comment.'</textarea></td></tr>';
|
||||
print '<td valign="top" rowspan="14"><textarea name="comment" wrap="soft" cols="40" rows="25">'.$comment.'</textarea></td></tr>'."\n";
|
||||
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> '.$langs->trans("Surname").'</td><td><input type="text" name="prenom" size="40" value="'.$prenom.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> '.$langs->trans("Surname").'</td><td><input type="text" name="prenom" size="40" value="'.$prenom.'"></td></tr>'."\n";
|
||||
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> '.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$nom.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td><input type="text" name="societe" size="40" value="'.$societe.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>';
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adresse.'</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.$cp.'"> <input type="text" name="ville" size="40" value="'.$ville.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Country").'</td><td><input type="text" name="pays" size="40" value="'.$pays.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> Email</td><td><input type="text" name="email" size="40" value="'.$email.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Password").'</td><td><input type="password" name="pass1" size="40"><BR><input type="password" name="pass2" size="40"></td></tr>';
|
||||
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$naiss.'"></td></tr>';
|
||||
print '<tr><td><FONT COLOR="blue">*</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.$photo.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Public").' ?</td><td><input type="checkbox" name="public" checked></td></tr>';
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> <FONT COLOR="blue">*</FONT> '.$langs->trans("Name").'</td><td><input type="text" name="nom" size="40" value="'.$nom.'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td><input type="text" name="societe" size="40" value="'.$societe.'"></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
|
||||
print '<textarea name="adresse" wrap="soft" cols="40" rows="3">'.$adresse.'</textarea></td></tr>'."\n";
|
||||
print '<tr><td>'.$langs->trans("Zip").'/'.$langs->trans("Town").'</td><td><input type="text" name="cp" size="8" value="'.$cp.'"> <input type="text" name="ville" size="40" value="'.$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="'.$email.'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Login").'</td><td><input type="text" name="login" size="40" value="'.$login.'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="red">*</FONT> '.$langs->trans("Password").'</td><td><input type="password" name="pass1" size="40"><BR><input type="password" name="pass2" size="40"></td></tr>'."\n";
|
||||
print '<tr><td>Date de naissance<BR>Format AAAA-MM-JJ</td><td><input type="text" name="naiss" size="40" value="'.$naiss.'"></td></tr>'."\n";
|
||||
print '<tr><td><FONT COLOR="blue">*</FONT> URL Photo</td><td><input type="text" name="photo" size="40" value="'.$photo.'"></td></tr>'."\n";
|
||||
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";
|
||||
print "<tr><td>$value</td><td><input type=\"text\" name=\"options_$key\" size=\"40\"></td></tr>"."\n";
|
||||
}
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'"></td></tr>'."\n";
|
||||
print "</table>\n";
|
||||
|
||||
print "</form>\n";
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ ALTER TABLE llx_adherent ADD UNIQUE INDEX uk_adherent_login (login);
|
|||
ALTER TABLE llx_adherent add column fk_soc integer NULL after societe;
|
||||
ALTER TABLE llx_adherent ADD INDEX idx_adherent_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_adherent ADD CONSTRAINT adherent_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid);
|
||||
ALTER TABLE llx_adherent modify column fk_user_author integer NULL;
|
||||
|
||||
ALTER TABLE llx_societe drop column rubrique;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
-- ===================================================================
|
||||
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
-- Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -53,7 +53,7 @@ create table llx_adherent
|
|||
datevalid datetime, -- date de validation
|
||||
datec datetime, -- date de creation
|
||||
tms timestamp, -- date de modification
|
||||
fk_user_author integer NOT NULL,
|
||||
fk_user_author integer, -- can be null because member can be create by a guest
|
||||
fk_user_mod integer,
|
||||
fk_user_valid integer
|
||||
)type=innodb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user