diff --git a/htdocs/adherents/fiche.php b/htdocs/adherents/fiche.php index a4566137ce7..f544797d1b7 100644 --- a/htdocs/adherents/fiche.php +++ b/htdocs/adherents/fiche.php @@ -44,6 +44,20 @@ $langs->load("users"); $user->getrights('adherent'); +// Defini si peux creer un utilisateur ou gerer groupe sur un utilisateur +$canadduser=$user->rights->adherent->creer; +// Defini si peux lire/modifier info user ou mot de passe +if ($_GET["rowid"]) +{ + $caneditfield=$user->rights->adherent->creer; + $caneditpassword=$user->rights->adherent->creer; +} +if (! $user->rights->adherent->lire) +{ + accessforbidden(); +} + + $adh = new Adherent($db); $adho = new AdherentOptions($db); $errmsg=''; @@ -128,7 +142,6 @@ if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POS $adh->phone_mobile= $_POST["phone_mobile"]; $adh->email = $_POST["email"]; $adh->naiss = $datenaiss; - $adh->photo = $_POST["photo"]; $adh->typeid = $_POST["type"]; $adh->commentaire = $_POST["comment"]; @@ -149,6 +162,7 @@ if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POS $adh->array_options[$key]=addslashes($_POST[$key]); } } + $result=$adh->update($user,0); if ($result >= 0 && ! sizeof($adh->errors)) { @@ -161,6 +175,23 @@ if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POS } } + if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) + { + // If photo is provided + if (! is_dir($conf->adherent->dir_output)) + { + create_exdir($conf->adherent->dir_output); + } + if (is_dir($conf->adherent->dir_output)) + { + $newfile=$conf->adherent->dir_output . "/" . $adh->id . ".jpg"; + if (! doliMoveFileUpload($_FILES['photo']['tmp_name'],$newfile)) + { + $message .= '
'.$langs->trans("ErrorFailedToSaveFile").'
'; + } + } + } + Header("Location: fiche.php?rowid=".$adh->id); exit; } @@ -563,7 +594,7 @@ if ($action == 'edit') dolibarr_fiche_head($head, 'general', $langs->trans("Member")); - print '
'; + print ''; print ""; print ""; print "statut."\">"; @@ -576,34 +607,49 @@ if ($action == 'edit') print ''.$langs->trans("Ref").''.$adh->id.' '; // Nom - print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Lastname").'*'; + // Photo - $rowspan=17; + $rowspan=16; $rowspan+=sizeof($adho->attribute_label); - print ''; - print ' '; + print ''; + if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg")) + { + print ''; + } + else + { + print ''; + } + if ($caneditfield) + { + print '

'; + print '
'.$langs->trans("PhotoFile").'
'; + print ''; + print '
'; + } print ''; print ''; // Prenom - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Firstname").'*'; print ''; // Login - print ''.$langs->trans("Login").''; + print ''.$langs->trans("Login").'*'; // Password - print ''.$langs->trans("Password").''; + print ''.$langs->trans("Password").'*'; // Type - print ''.$langs->trans("Type").''; + print ''.$langs->trans("Type").'*'; $htmls->select_array("type", $adht->liste_array(), $adh->typeid); print ""; // Physique-Moral $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); - print "".$langs->trans("Person").""; + print "".$langs->trans("Person")."*"; $htmls->select_array("morphy", $morphys, $adh->morphy); print ""; @@ -639,9 +685,6 @@ if ($action == 'edit') $htmls->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'update'); print "\n"; - // Url photo - print 'URL photo'; - // Profil public print "".$langs->trans("Public")."\n"; print $htmls->selectyesno("public",$adh->public,1); @@ -678,7 +721,7 @@ if ($action == 'create') print_titre($langs->trans("NewMember")); - print "\n"; + print ''; print ''; print ''; @@ -759,8 +802,7 @@ if ($action == 'create') $htmls->select_date(($adh->naiss ? $adh->naiss : -1),'naiss','','',1,'add'); print "\n"; - // Url photo - print ''; + // Attribut optionnels foreach($adho->attribute_label as $key=>$value) { print "\n"; @@ -875,7 +917,7 @@ if ($rowid && $action != 'edit') } - print ''; + print ''; print '
Url photo
$value
'; // Ref @@ -885,17 +927,26 @@ if ($rowid && $action != 'edit') print ''; // Nom - print ''; - $rowspan=19+sizeof($adho->attribute_label); - print ''; + print ''; print ''; // Prenom - print ''; + print ''; // Login - print ''; + print ''; + $rowspan=16+sizeof($adho->attribute_label); + print ''; + print ''; // Password print ''; @@ -928,14 +979,11 @@ if ($rowid && $action != 'edit') print ''; // EMail - print ''; + print ''; // Date naissance print ''; - // URL - print ''; - // Public print ''; diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 73231e5b642..dffac1af90f 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -958,10 +958,21 @@ class User $adh=new Adherent($this->db); $result=$adh->fetch($this->fk_member); - // \TODO Mettre parametres + $adh->prenom=$this->prenom; + $adh->nom=$this->nom; + $adh->login=$this->login; + $adh->pass=$this->pass; + $adh->societe=$this->societe_id; + + $adh->email=$this->email; $adh->phone=$this->office_phone; $adh->phone_perso=$this->office_fax; $adh->phone_mobile=$this->user_mobile; + + $adh->commentaire=$user->note; + + $adh->user_id=$this->id; + $adh->user_login=$this->login; $result=$adh->update($user,0); if ($result < 0) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index ffa0dc95f59..9a58e97dae6 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -267,7 +267,7 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $caneditfield) if (isset($_FILES['photo']['tmp_name']) && trim($_FILES['photo']['tmp_name'])) { - // Si une photo est fournie avec le formulaire + // If photo is provided if (! is_dir($conf->users->dir_output)) { create_exdir($conf->users->dir_output); @@ -1157,7 +1157,7 @@ else } print ''; - // Prenom + // Prenom print "".''; print '
'.$langs->trans("Lastname").''.$adh->nom.' '; - print ' 
'.$langs->trans("Lastname").''.$adh->nom.' 
'.$langs->trans("Firstname").''.$adh->prenom.' 
'.$langs->trans("Firstname").''.$adh->prenom.' 
'.$langs->trans("Login").''.$adh->login.' 
'.$langs->trans("Login").''.$adh->login.' '; + if (file_exists($conf->adherent->dir_output."/".$adh->id.".jpg")) + { + print ''; + } + else + { + print ''; + } + print '
'.$langs->trans("Password").''.eregi_replace('.','*',$adh->pass).'
'.$langs->trans("PhoneMobile").''.$adh->phone_mobile.'
'.$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'*':'').''.$adh->email.' 
'.$langs->trans("EMail").''.$adh->email.' 
'.$langs->trans("Birthday").''.dolibarr_print_date($adh->naiss,'day').' 
URL Photo'.$adh->photo.' 
'.$langs->trans("Public").''.yn($adh->public).'
'.$langs->trans("Firstname").''; if ($caneditfield && !$fuser->ldap_sid) @@ -1403,4 +1403,4 @@ function dolValidElement($element) { } llxFooter('$Date$ - $Revision$'); -?> \ No newline at end of file +?> diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 68b3a9f81b3..77369299659 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -72,6 +72,13 @@ if ($modulepart) $accessallowed=1; $original_file=$conf->users->dir_output.'/'.$original_file; } + + // Wrapping pour les photos adherents + if ($modulepart == 'memberphoto') + { + $accessallowed=1; + $original_file=$conf->adherent->dir_output.'/'.$original_file; + } // Wrapping pour les apercu factures if ($modulepart == 'apercufacture')