2
0
forked from Wavyzz/dolibarr

New: Add list of members in a member type card

New: Can make email for third party or users required
This commit is contained in:
Laurent Destailleur
2010-01-08 17:33:30 +00:00
parent 303021154b
commit 5db8f59209
17 changed files with 500 additions and 182 deletions

View File

@@ -257,9 +257,9 @@ class Adherent extends CommonObject
global $conf,$langs; global $conf,$langs;
// Check parameters // Check parameters
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($this->email)) if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
{ {
$langs->load("companies"); $langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email); $this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1; return -1;
} }
@@ -377,9 +377,10 @@ class Adherent extends CommonObject
dol_syslog("Adherent::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", email=".$this->email); dol_syslog("Adherent::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass.", email=".$this->email);
// Verification parametres // Check parameters
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($this->email)) if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email))
{ {
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email); $this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1; return -1;
} }
@@ -887,7 +888,7 @@ class Adherent extends CommonObject
function fetch_login($login) function fetch_login($login)
{ {
global $conf; global $conf;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
$sql.= " WHERE login='".$login."'"; $sql.= " WHERE login='".$login."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@@ -1070,7 +1071,7 @@ class Adherent extends CommonObject
return -1; return -1;
} }
} }
/** /**
* \brief Fonction qui recupere les donnees optionelles de l'adherent * \brief Fonction qui recupere les donnees optionelles de l'adherent
@@ -1080,16 +1081,16 @@ class Adherent extends CommonObject
{ {
$options = new AdherentOptions($this->db); $options = new AdherentOptions($this->db);
$optionsArray = $options->fetch_name_optionals_label(); $optionsArray = $options->fetch_name_optionals_label();
$tab=array(); $tab=array();
$sql = "SELECT rowid"; $sql = "SELECT rowid";
foreach ($optionsArray as $name => $label) foreach ($optionsArray as $name => $label)
{ {
$sql.= ", ".$name; $sql.= ", ".$name;
} }
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_options"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_options";
$sql.= " WHERE fk_member=".$rowid; $sql.= " WHERE fk_member=".$rowid;
@@ -1832,7 +1833,7 @@ class Adherent extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql.= " WHERE a.statut > 0"; $sql.= " WHERE a.statut > 0";
$sql.= " AND a.entity = ".$conf->entity; $sql.= " AND a.entity = ".$conf->entity;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -375,7 +375,7 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
$adh->user_id = $userid; $adh->user_id = $userid;
$adh->fk_soc = $socid; $adh->fk_soc = $socid;
$adh->public = $public; $adh->public = $public;
foreach($_POST as $key => $value) foreach($_POST as $key => $value)
{ {
if (preg_match("/^options_/",$key)) if (preg_match("/^options_/",$key))
@@ -410,14 +410,17 @@ if ($_POST["action"] == 'add' && $user->rights->adherent->creer)
} }
if (empty($nom)) { if (empty($nom)) {
$error++; $error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname"))."<br>\n";
} }
if ($morphy != 'mor' && (!isset($prenom) || $prenom=='')) { if ($morphy != 'mor' && (!isset($prenom) || $prenom=='')) {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n"; $langs->load("errors");
$errmsg .= $langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname"))."<br>\n";
} }
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
$error++; $error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n"; $errmsg .= $langs->trans("ErrorBadEMail",$email)."<br>\n";
} }
if (empty($pass)) { if (empty($pass)) {

View File

@@ -33,61 +33,75 @@ $langs->load("members");
$rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"];
if ($_REQUEST["button_removefilter"])
{
$_GET["search_nom"]="";
$_REQUEST["search_nom"]="";
$_GET["search_prenom"]="";
$_REQUEST["search_prenom"]="";
$_GET["type"]="";
$_REQUEST["type"]="";
$_GET["search_email"]="";
$_REQUEST["search_email"]="";
$sall="";
}
/* /*
* Actions * Actions
*/ */
if ($user->rights->adherent->configurer && $_POST["action"] == 'add') if ($user->rights->adherent->configurer && $_POST["action"] == 'add')
{ {
if ($_POST["button"] != $langs->trans("Cancel")) if ($_POST["button"] != $langs->trans("Cancel"))
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->libelle = trim($_POST["libelle"]); $adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $adht->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]); $adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
if ($adht->libelle) if ($adht->libelle)
{ {
$id=$adht->create($user->id); $id=$adht->create($user->id);
if ($id > 0) if ($id > 0)
{ {
Header("Location: type.php"); Header("Location: type.php");
exit; exit;
} }
else else
{ {
$mesg=$adht->error; $mesg=$adht->error;
$_GET["action"] = 'create'; $_GET["action"] = 'create';
} }
} }
else else
{ {
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label"));
$_GET["action"] = 'create'; $_GET["action"] = 'create';
} }
} }
} }
if ($user->rights->adherent->configurer && $_POST["action"] == 'update') if ($user->rights->adherent->configurer && $_POST["action"] == 'update')
{ {
if ($_POST["button"] != $langs->trans("Cancel")) if ($_POST["button"] != $langs->trans("Cancel"))
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->id = $_POST["rowid"]; $adht->id = $_POST["rowid"];
$adht->libelle = trim($_POST["libelle"]); $adht->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $adht->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]); $adht->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $adht->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $adht->vote = trim($_POST["vote"]);
$adht->update($user->id); $adht->update($user->id);
Header("Location: type.php?rowid=".$_POST["rowid"]); Header("Location: type.php?rowid=".$_POST["rowid"]);
exit; exit;
} }
} }
if ($user->rights->adherent->configurer && $_GET["action"] == 'delete') if ($user->rights->adherent->configurer && $_GET["action"] == 'delete')
@@ -123,55 +137,55 @@ $form=new Form($db);
if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
{ {
print_fiche_titre($langs->trans("MembersTypeSetup")); print_fiche_titre($langs->trans("MembersTypeSetup"));
$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote"; $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>'; print '<td>'.$langs->trans("Ref").'</td>';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
print '<td align="center">'.$langs->trans("SubscriptionRequired").'</td>'; print '<td align="center">'.$langs->trans("SubscriptionRequired").'</td>';
print '<td align="center">'.$langs->trans("VoteAllowed").'</td>'; print '<td align="center">'.$langs->trans("VoteAllowed").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=True;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>'; print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>'.$objp->libelle.'</td>'; print '<td>'.$objp->libelle.'</td>';
print '<td align="center">'.yn($objp->cotisation).'</td>'; print '<td align="center">'.yn($objp->cotisation).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>'; print '<td align="center">'.yn($objp->vote).'</td>';
print '<td><a href="type.php?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>'; print '<td><a href="type.php?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
print "</tr>"; print "</tr>";
$i++; $i++;
} }
print "</table>"; print "</table>";
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
/* /*
* Barre d'actions * Barre d'actions
* *
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// New type // New type
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
@@ -179,14 +193,14 @@ if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit')
print "<a class=\"butAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>"; print "<a class=\"butAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>";
} }
print "</div>"; print "</div>";
} }
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Cr<EFBFBD>ation d'un type adherent */ /* Creation d'un type adherent */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
@@ -237,6 +251,7 @@ if ($_GET["action"] == 'create')
print "</form>\n"; print "</form>\n";
print "</table>\n"; print "</table>\n";
} }
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Edition de la fiche */ /* Edition de la fiche */
@@ -244,57 +259,57 @@ if ($_GET["action"] == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
if ($rowid > 0) if ($rowid > 0)
{ {
if ($_GET["action"] != 'edit') if ($_GET["action"] != 'edit')
{ {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->id = $rowid; $adht->id = $rowid;
$adht->fetch($rowid); $adht->fetch($rowid);
$h=0; $h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id; $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<td>'; print '<td>';
print $form->showrefnav($adht,'rowid'); print $form->showrefnav($adht,'rowid');
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>'; print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($adht->cotisation); print yn($adht->cotisation);
print '</tr>'; print '</tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($adht->vote); print yn($adht->vote);
print '</tr>'; print '</tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print nl2br($adht->note)."</td></tr>"; print nl2br($adht->note)."</td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($adht->mail_valid)."</td></tr>"; print nl2br($adht->mail_valid)."</td></tr>";
print '</table>'; print '</table>';
print '</div>'; print '</div>';
/* /*
* Barre d'actions * Barre d'actions
* *
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Edit // Edit
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
@@ -303,7 +318,7 @@ if ($rowid > 0)
} }
// Add // Add
print "<a class=\"butAction\" href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?action=create&typeid=".$adht->id."\">".$langs->trans("AddMember")."</a>";
// Delete // Delete
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
@@ -311,50 +326,302 @@ if ($rowid > 0)
print "<a class=\"butActionDelete\" href=\"type.php?action=delete&rowid=".$adht->id."\">".$langs->trans("DeleteType")."</a>"; print "<a class=\"butActionDelete\" href=\"type.php?action=delete&rowid=".$adht->id."\">".$langs->trans("DeleteType")."</a>";
} }
print "</div>"; print "</div>";
}
if ($_GET["action"] == 'edit')
{
$htmls = new Form($db);
$adht = new AdherentType($db);
$adht->id = $rowid;
$adht->fetch($rowid);
$h=0; // Show list of members (nearly same code than in page liste.php)
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id; $membertypestatic=new AdherentType($db);
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); $sql = "SELECT d.rowid, d.login, d.prenom, d.nom, d.societe, ";
$sql.= " ".$db->pdate("d.datefin")." as datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity = ".$conf->entity;
if ($sall)
{
$sql.=" AND (d.prenom like '%".$sall."%' OR d.nom like '%".$sall."%' OR d.societe like '%".$sall."%'";
$sql.=" OR d.email like '%".$sall."%' OR d.login like '%".$sall."%' OR d.adresse like '%".$sall."%'";
$sql.=" OR d.ville like '%".$sall."%' OR d.note like '%".$sall."%')";
}
//if ($_REQUEST["type"] > 0)
//{
//$sql.=" AND t.rowid=".$_REQUEST["type"];
$sql.=" AND t.rowid=".$adht->id;
//}
if (isset($_GET["statut"]))
{
$sql.=" AND d.statut in ($statut)"; // Peut valoir un nombre ou liste de nombre separes par virgules
}
if ( $_POST["action"] == 'search')
{
if (isset($_POST['search']) && $_POST['search'] != ''){
$sql.= " AND (d.prenom LIKE '%".$_POST['search']."%' OR d.nom LIKE '%".$_POST['search']."%')";
}
}
if ($_GET["search_nom"])
{
$sql.= " AND (d.prenom LIKE '%".$_GET["search_nom"]."%' OR d.nom LIKE '%".$_GET["search_nom"]."%')";
}
if ($_GET["search_login"])
{
$sql.= " AND d.login LIKE '%".$_GET["search_login"]."%'";
}
if ($_GET["search_email"])
{
$sql.= " AND (d.email LIKE '%".$_GET["search_email"]."%')";
}
if ($filter == 'uptodate')
{
$sql.=" AND datefin >= ".$db->idate(mktime());
}
if ($filter == 'outofdate')
{
$sql.=" AND datefin < ".$db->idate(mktime());
}
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db);
}
// Add order and limit
$sql.= " ".$db->order($sortfield,$sortorder);
$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$titre=$langs->trans("MembersList");
if (isset($_GET["statut"]))
{
if ($statut == '-1,1') { $titre=$langs->trans("MembersListQualified"); }
if ($statut == '-1') { $titre=$langs->trans("MembersListToValid"); }
if ($statut == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); }
if ($statut == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); }
if ($statut == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); }
if ($statut == '0') { $titre=$langs->trans("MembersListResiliated"); }
}
elseif ($_POST["action"] == 'search') {
$titre=$langs->trans("MembersListQualified");
}
if ($_REQUEST["type"] > 0)
{
$membertype=new AdherentType($db);
$result=$membertype->fetch($_REQUEST["type"]);
$titre.=" (".$membertype->libelle.")";
}
$param="";
if (isset($_GET["statut"])) $param.="&statut=".$_GET["statut"];
if (isset($_GET["search_nom"])) $param.="&search_nom=".$_GET["search_nom"];
if (isset($_GET["search_login"])) $param.="&search_login=".$_GET["search_login"];
if (isset($_GET["search_email"])) $param.="&search_email=".$_GET["search_email"];
if (isset($_GET["filter"])) $param.="&filter=".$_GET["filter"];
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
}
print '<br>';
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),"liste.php","d.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),"liste.php","d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),"liste.php","d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),"liste.php","d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"liste.php","d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),"liste.php","d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),"liste.php","",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<input class="flat" type="hidden" name="rowid" value="'.$rowid.'" size="12"></td>';
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_nom" value="'.$_REQUEST["search_nom"].'" size="12"></td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$_REQUEST["search_login"].'" size="7"></td>';
// Type
/*print '<td class="liste_titre">';
$listetype=$membertypestatic->liste_array();
$form->select_array("type", $listetype, $_REQUEST["type"], 1, 0, 0, 0, '', 0, 12);
print '</td>';
*/
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$_REQUEST["search_email"].'" size="12"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
print '&nbsp; <input type="image" value="button_removefilter" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" alt="'.$langs->trans("RemoveFilter").'">';
print '</td>';
print "</tr>\n";
print '</form>';
$var=True;
while ($i < $num && $i < $conf->liste_limit)
{
$objp = $db->fetch_object($resql);
$adh=new Adherent($db);
// Nom
$var=!$var;
print "<tr $bc[$var]>";
if ($objp->societe != '')
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom,12)." / ".dol_trunc($objp->societe,12)."</a></td>\n";
}
else
{
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".img_object($langs->trans("ShowMember"),"user").' '.$objp->prenom." ".dol_trunc($objp->nom)."</a></td>\n";
}
// Login
print "<td>".$objp->login."</td>\n";
// Type
/*print '<td nowrap="nowrap">';
$membertypestatic->id=$objp->type_id;
$membertypestatic->libelle=$objp->type;
print $membertypestatic->getNomUrl(1,12);
print '</td>';
*/
// Moral/Physique
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
// Statut
print '<td nowrap="nowrap">';
print $adh->LibStatut($objp->statut,$objp->cotisation,$objp->datefin,2);
print "</td>";
// Date fin cotisation
if ($objp->datefin)
{
print '<td align="center" nowrap="nowrap">';
if ($objp->datefin < time() && $objp->statut > 0)
{
print dol_print_date($objp->datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
else
{
print dol_print_date($objp->datefin,'day');
}
print '</td>';
}
else
{
print '<td align="left" nowrap="nowrap">';
if ($objp->cotisation == 'yes')
{
print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning();
}
else
{
print '&nbsp;';
}
print '</td>';
}
// Actions
print '<td align="center">';
if ($user->rights->adherent->creer)
{
print "<a href=\"fiche.php?rowid=$objp->rowid&action=edit&return=liste.php\">".img_edit()."</a>";
}
print '&nbsp;';
if ($user->rights->adherent->supprimer)
{
print "<a href=\"fiche.php?rowid=$objp->rowid&action=resign&return=liste.php\">".img_picto($langs->trans("Resiliate"),'disable.png')."</a>";
}
print "</td>";
print "</tr>\n";
$i++;
}
print "</table>\n";
if ($num > $conf->liste_limit)
{
print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'');
}
}
else
{
dol_print_error($db);
}
}
if ($_GET["action"] == 'edit')
{
$htmls = new Form($db);
$adht = new AdherentType($db);
$adht->id = $rowid;
$adht->fetch($rowid);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">'; $h=0;
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>'; $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>'; dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $htmls->selectyesno("cotisation",$adht->cotisation,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
print $htmls->selectyesno("vote",$adht->vote,1); print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '</td></tr>'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%">';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->note."</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $htmls->selectyesno("cotisation",$adht->cotisation,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $htmls->selectyesno("vote",$adht->vote,1);
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print "<textarea name=\"comment\" wrap=\"soft\" cols=\"90\" rows=\"3\">".$adht->note."</textarea></td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
if ($conf->fckeditor->enabled) if ($conf->fckeditor->enabled)
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
@@ -367,14 +634,14 @@ if ($rowid > 0)
print dol_htmlentitiesbr_decode($adht->mail_valid); print dol_htmlentitiesbr_decode($adht->mail_valid);
print '</textarea>'; print '</textarea>';
} }
print "</td></tr>"; print "</td></tr>";
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp;'; print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> &nbsp; &nbsp;';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print "</form>"; print "</form>";
} }
} }
$db->close(); $db->close();

View File

@@ -858,13 +858,15 @@ if ($step == 4 && $datatoimport)
// Info field // Info field
print '<td style="font-weight: normal" align="right">'; print '<td style="font-weight: normal" align="right">';
$filecolumn=$array_match_database_to_file[$code]; $filecolumn=$array_match_database_to_file[$code];
// Source field info
$htmltext ='<b><u>'.$langs->trans("FieldSource").'</u></b><br>'; $htmltext ='<b><u>'.$langs->trans("FieldSource").'</u></b><br>';
if ($filecolumn > sizeof($fieldssource)) $htmltext.=$langs->trans("DataComeFromNoWhere").'<br>'; if ($filecolumn > sizeof($fieldssource)) $htmltext.=$langs->trans("DataComeFromNoWhere").'<br>';
else else
{ {
if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion
{ {
$htmltext.=$langs->trans("DataComeFromFileFieldNb",$filecolumn).'<br>'; $filecolumntoshow=$filecolumn;
$htmltext.=$langs->trans("DataComeFromFileFieldNb",$filecolumntoshow).'<br>';
} }
else else
{ {
@@ -875,6 +877,7 @@ if ($step == 4 && $datatoimport)
$example=$objimport->array_import_examplevalues[0][$code]; $example=$objimport->array_import_examplevalues[0][$code];
if ($example) $htmltext.='<br>'.$langs->trans("SourceExample").': <b>'.$example.'</b><br>'; if ($example) $htmltext.='<br>'.$langs->trans("SourceExample").': <b>'.$example.'</b><br>';
$htmltext.='<br>'; $htmltext.='<br>';
// Target field info
$htmltext.='<b><u>'.$langs->trans("FieldTarget").'</u></b><br>'; $htmltext.='<b><u>'.$langs->trans("FieldTarget").'</u></b><br>';
if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion if (empty($objimport->array_import_convertvalue[0][$code])) // If source file does not need convertion
{ {

View File

@@ -256,7 +256,7 @@ class MenuTop {
} }
// Tools // Tools
if ($conf->mailing->enabled || $conf->export->enabled || $conf->global->MAIN_MODULE_IMPORT || $conf->global->MAIN_MODULE_DOMAIN) if ($conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->global->MAIN_MODULE_DOMAIN)
{ {
$langs->load("other"); $langs->load("other");
@@ -271,7 +271,7 @@ class MenuTop {
} }
$idsel='id="mainmenu_tools" '; $idsel='id="mainmenu_tools" ';
if ($user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire) if ($user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire || $user->rights->import->run)
{ {
print '<td class="tmenu">'; print '<td class="tmenu">';
print '<a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a>'; print '<a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a>';

View File

@@ -256,7 +256,7 @@ class MenuTop {
} }
// Tools // Tools
if ($conf->mailing->enabled || $conf->export->enabled || $conf->global->MAIN_MODULE_IMPORT || $conf->global->MAIN_MODULE_DOMAIN) if ($conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->global->MAIN_MODULE_DOMAIN)
{ {
$langs->load("other"); $langs->load("other");
@@ -271,7 +271,7 @@ class MenuTop {
} }
$idsel='id="mainmenu_tools" '; $idsel='id="mainmenu_tools" ';
if ($user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire) if ($user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire || $user->rights->import->run)
{ {
print '<td class="tmenu">'; print '<td class="tmenu">';
print '<a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a>'; print '<a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/index.php?mainmenu=tools&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Tools").'</a>';

View File

@@ -1,7 +1,5 @@
# Dolibarr language file - en_US - companies # Dolibarr language file - en_US - companies
CHARSET=UTF-8 CHARSET=UTF-8
ErrorBadEMail=EMail %s is wrong
ErrorBadUrl=Url %s is wrong
ErrorCompanyNameAlreadyExists=Company name %s already exists. Choose another one. ErrorCompanyNameAlreadyExists=Company name %s already exists. Choose another one.
ErrorPrefixAlreadyExists=Prefix %s already exists. Choose another one. ErrorPrefixAlreadyExists=Prefix %s already exists. Choose another one.
ErrorSetACountryFirst=Set the country first ErrorSetACountryFirst=Set the country first

View File

@@ -1,8 +1,10 @@
# Dolibarr language file - en_US - errors # Dolibarr language file - en_US - errors
CHARSET=UTF-8 CHARSET=UTF-8
MenuManager=Menu manager
Error=Error Error=Error
Errors=Errors Errors=Errors
MenuManager=Menu manager ErrorBadEMail=EMail %s is wrong
ErrorBadUrl=Url %s is wrong
ErrorLoginAlreadyExists=Login %s already exists. ErrorLoginAlreadyExists=Login %s already exists.
ErrorGroupAlreadyExists=Group %s already exists. ErrorGroupAlreadyExists=Group %s already exists.
ErrorRecordNotFound=Record not found. ErrorRecordNotFound=Record not found.

View File

@@ -1,7 +1,5 @@
# Dolibarr language file - fr_FR - companies # Dolibarr language file - fr_FR - companies
CHARSET=UTF-8 CHARSET=UTF-8
ErrorBadEMail=e-mail %s invalide
ErrorBadUrl=Url %s invalide
ErrorCompanyNameAlreadyExists=Le nom de société %s existe déjà. Veuillez en choisir un autre. ErrorCompanyNameAlreadyExists=Le nom de société %s existe déjà. Veuillez en choisir un autre.
ErrorPrefixAlreadyExists=Le préfixe %s existe déjà. Veuillez en choisir un autre. ErrorPrefixAlreadyExists=Le préfixe %s existe déjà. Veuillez en choisir un autre.
ErrorSetACountryFirst=Définissez d'abord le pays ErrorSetACountryFirst=Définissez d'abord le pays

View File

@@ -1,8 +1,10 @@
# Dolibarr language file - fr_FR - errors # Dolibarr language file - fr_FR - errors
CHARSET=UTF-8 CHARSET=UTF-8
MenuManager=Gestionnaire de menu
Error=Erreur Error=Erreur
Errors=Erreurs Errors=Erreurs
MenuManager=Gestionnaire de menu ErrorBadEMail=e-mail %s invalide
ErrorBadUrl=Url %s invalide
ErrorLoginAlreadyExists=Le login %s existe déjà. ErrorLoginAlreadyExists=Le login %s existe déjà.
ErrorGroupAlreadyExists=Le groupe %s existe déjà. ErrorGroupAlreadyExists=Le groupe %s existe déjà.
ErrorRecordNotFound=Enregistrement non trouvé. ErrorRecordNotFound=Enregistrement non trouvé.

View File

@@ -109,7 +109,7 @@ EMailTextOrderApproved=Commande %s approuvée
EMailTextOrderApprovedBy=Commande %s approuvée par %s EMailTextOrderApprovedBy=Commande %s approuvée par %s
EMailTextOrderRefused=Commande %s réfusée EMailTextOrderRefused=Commande %s réfusée
EMailTextOrderRefusedBy=Commande %s réfusée par %s EMailTextOrderRefusedBy=Commande %s réfusée par %s
ImportedWithSet=Lot d'importation ImportedWithSet=Lot d'importation (Import key)
DolibarrNotification=Notification automatique DolibarrNotification=Notification automatique
##### Bookmark ##### ##### Bookmark #####

View File

@@ -774,7 +774,11 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid=
$newemail.='">'; $newemail.='">';
$newemail.=dol_trunc($email,$max); $newemail.=dol_trunc($email,$max);
$newemail.='</a>'; $newemail.='</a>';
if ($showinvalid && ! isValidEmail($email)) $newemail.=img_warning($langs->trans("ErrorBadEMail",$email)); if ($showinvalid && ! isValidEmail($email))
{
$langs->load("errors");
$newemail.=img_warning($langs->trans("ErrorBadEMail",$email));
}
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create) if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
{ {

View File

@@ -66,6 +66,7 @@ $langs->load("paybox");
$langs->load("dict"); $langs->load("dict");
$langs->load("bills"); $langs->load("bills");
$langs->load("companies"); $langs->load("companies");
$langs->load("errors");
// Input are: // Input are:
// type ('invoice','order','contractline'), // type ('invoice','order','contractline'),

View File

@@ -135,18 +135,21 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
if (! empty($soc->email) && ! isValidEMail($soc->email)) if (! empty($soc->email) && ! isValidEMail($soc->email))
{ {
$error = 1; $error = 1;
$langs->load("errors");
$soc->error = $langs->trans("ErrorBadEMail",$soc->email); $soc->error = $langs->trans("ErrorBadEMail",$soc->email);
$_GET["action"] = $_POST["action"]=='add'?'create':'edit'; $_GET["action"] = $_POST["action"]=='add'?'create':'edit';
} }
if (! empty($soc->url) && ! isValidUrl($soc->url)) if (! empty($soc->url) && ! isValidUrl($soc->url))
{ {
$error = 1; $error = 1;
$langs->load("errors");
$soc->error = $langs->trans("ErrorBadUrl",$soc->url); $soc->error = $langs->trans("ErrorBadUrl",$soc->url);
$_GET["action"] = $_POST["action"]=='add'?'create':'edit'; $_GET["action"] = $_POST["action"]=='add'?'create':'edit';
} }
if ($soc->fournisseur && ! $conf->fournisseur->enabled) if ($soc->fournisseur && ! $conf->fournisseur->enabled)
{ {
$error = 1; $error = 1;
$langs->load("errors");
$soc->error = $langs->trans("ErrorSupplierModuleNotEnabled"); $soc->error = $langs->trans("ErrorSupplierModuleNotEnabled");
$_GET["action"] = $_POST["action"]=='add'?'create':'edit'; $_GET["action"] = $_POST["action"]=='add'?'create':'edit';
} }
@@ -184,6 +187,10 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$result=$contact->create($user); $result=$contact->create($user);
} }
} }
else
{
$mesg=$soc->error;
}
if ($result >= 0) if ($result >= 0)
{ {
@@ -504,7 +511,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>';
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>';
print '<tr><td>'.$langs->trans('EMail').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>'; print '<tr><td>'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>';
print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>'; print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>';
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>'; print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
@@ -853,7 +860,7 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>'; print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>';
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>'; print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>';
print '<tr><td>'.$langs->trans('EMail').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>'; print '<tr><td>'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>';
print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>'; print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>';
print '<tr>'; print '<tr>';

View File

@@ -150,6 +150,14 @@ class Societe extends CommonObject
dol_syslog("Societe::create ".$this->nom); dol_syslog("Societe::create ".$this->nom);
// Check parameters
if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email))
{
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
$this->db->begin(); $this->db->begin();
// For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts) // For automatic creation during create action (not used by Dolibarr GUI, can be used by scripts)
@@ -368,6 +376,14 @@ class Societe extends CommonObject
$this->code_compta=trim($this->code_compta); $this->code_compta=trim($this->code_compta);
$this->code_compta_fournisseur=trim($this->code_compta_fournisseur); $this->code_compta_fournisseur=trim($this->code_compta_fournisseur);
// Check parameters
if (! empty($conf->global->SOCIETE_MAIL_REQUIRED) && ! isValidEMail($this->email))
{
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
// Check name is required and codes are ok or unique. // Check name is required and codes are ok or unique.
// If error, this->errors[] is filled // If error, this->errors[] is filled
$result = $this->verify(); $result = $this->verify();

View File

@@ -699,6 +699,14 @@ class User extends CommonObject
dol_syslog("User::Create login=".$this->login.", user=".(is_object($user)?$user->id:''), LOG_DEBUG); dol_syslog("User::Create login=".$this->login.", user=".(is_object($user)?$user->id:''), LOG_DEBUG);
// Check parameters
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
{
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
$error=0; $error=0;
$this->db->begin(); $this->db->begin();
@@ -991,6 +999,14 @@ class User extends CommonObject
} }
$this->admin = $this->admin?$this->admin:0; $this->admin = $this->admin?$this->admin:0;
// Check parameters
if (! empty($conf->global->USER_MAIL_REQUIRED) && ! isValidEMail($this->email))
{
$langs->load("errors");
$this->error = $langs->trans("ErrorBadEMail",$this->email);
return -1;
}
$this->db->begin(); $this->db->begin();
// Mise a jour autres infos // Mise a jour autres infos

View File

@@ -167,7 +167,6 @@ if ($_POST["action"] == 'add' && $canadduser)
$db->begin(); $db->begin();
$id = $edituser->create($user); $id = $edituser->create($user);
if ($id > 0) if ($id > 0)
{ {
if (isset($_POST['password']) && trim($_POST['password'])) if (isset($_POST['password']) && trim($_POST['password']))
@@ -184,7 +183,8 @@ if ($_POST["action"] == 'add' && $canadduser)
{ {
$langs->load("errors"); $langs->load("errors");
$db->rollback(); $db->rollback();
$message='<div class="error">'.join('<br>',$edituser->errors).'</div>'; if (is_array($edituser->errors) && sizeof($edituser->errors)) $message='<div class="error">'.join('<br>',$langs->trans($edituser->errors)).'</div>';
else $message='<div class="error">'.$langs->trans($edituser->error).'</div>';
$action="create"; // Go back to create page $action="create"; // Go back to create page
} }
@@ -653,7 +653,7 @@ if (($action == 'create') || ($action == 'adduserldap'))
print '</td></tr>'; print '</td></tr>';
// EMail // EMail
print '<tr><td valign="top">'.$langs->trans("EMail").'</td>'; print '<tr><td valign="top">'.$langs->trans("EMail").($conf->global->USER_MAIL_REQUIRED?'*':'').'</td>';
print '<td>'; print '<td>';
if ($ldap_mail) if ($ldap_mail)
{ {
@@ -945,7 +945,7 @@ else
print '<td>'.dol_print_phone($fuser->office_fax,'',0,0,1).'</td>'; print '<td>'.dol_print_phone($fuser->office_fax,'',0,0,1).'</td>';
// EMail // EMail
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>'; print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").($conf->global->USER_MAIL_REQUIRED?'*':'').'</td>';
print '<td>'.dol_print_email($fuser->email,0,0,1).'</td>'; print '<td>'.dol_print_email($fuser->email,0,0,1).'</td>';
print "</tr>\n"; print "</tr>\n";