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 .= '