30 |
\version $Revision$ |
\version $Revision$ |
31 |
*/ |
*/ |
32 |
|
|
|
|
|
33 |
require("./pre.inc.php"); |
require("./pre.inc.php"); |
34 |
|
require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); |
35 |
|
|
36 |
|
|
37 |
if ($user->id <> $_GET["id"]) |
if ($user->id <> $_GET["id"]) |
38 |
{ |
{ |
39 |
if (! $user->rights->user->user->lire && !$user->admin) |
if (! $user->rights->user->user->lire && ! $user->admin) |
40 |
{ |
{ |
41 |
accessforbidden(); |
accessforbidden(); |
42 |
} |
} |
106 |
$edituser = new User($db,0); |
$edituser = new User($db,0); |
107 |
|
|
108 |
$edituser->nom = trim($_POST["nom"]); |
$edituser->nom = trim($_POST["nom"]); |
|
$edituser->note = trim($_POST["note"]); |
|
109 |
$edituser->prenom = trim($_POST["prenom"]); |
$edituser->prenom = trim($_POST["prenom"]); |
110 |
$edituser->login = trim($_POST["login"]); |
$edituser->login = trim($_POST["login"]); |
111 |
|
$edituser->admin = trim($_POST["admin"]); |
112 |
$edituser->office_phone = trim($_POST["office_phone"]); |
$edituser->office_phone = trim($_POST["office_phone"]); |
113 |
$edituser->office_fax = trim($_POST["office_fax"]); |
$edituser->office_fax = trim($_POST["office_fax"]); |
114 |
$edituser->user_mobile = trim($_POST["user_mobile"]); |
$edituser->user_mobile = trim($_POST["user_mobile"]); |
115 |
$edituser->email = trim($_POST["email"]); |
$edituser->email = trim($_POST["email"]); |
|
$edituser->admin = trim($_POST["admin"]); |
|
116 |
$edituser->webcal_login = trim($_POST["webcal_login"]); |
$edituser->webcal_login = trim($_POST["webcal_login"]); |
117 |
|
$edituser->note = trim($_POST["note"]); |
118 |
|
|
119 |
$db->begin(); |
$db->begin(); |
120 |
|
|
175 |
$edituser->fetch(); |
$edituser->fetch(); |
176 |
|
|
177 |
$edituser->nom = $_POST["nom"]; |
$edituser->nom = $_POST["nom"]; |
|
$edituser->note = $_POST["note"]; |
|
178 |
$edituser->prenom = $_POST["prenom"]; |
$edituser->prenom = $_POST["prenom"]; |
179 |
$edituser->login = $_POST["login"]; |
$edituser->login = $_POST["login"]; |
180 |
|
$edituser->pass = $_POST["pass"]; |
181 |
|
$edituser->admin = $_POST["admin"]; |
182 |
$edituser->office_phone = $_POST["office_phone"]; |
$edituser->office_phone = $_POST["office_phone"]; |
183 |
$edituser->office_fax = $_POST["office_fax"]; |
$edituser->office_fax = $_POST["office_fax"]; |
184 |
$edituser->user_mobile = $_POST["user_mobile"]; |
$edituser->user_mobile = $_POST["user_mobile"]; |
185 |
$edituser->email = $_POST["email"]; |
$edituser->email = $_POST["email"]; |
186 |
$edituser->admin = $_POST["admin"]; |
$edituser->note = $_POST["note"]; |
187 |
$edituser->webcal_login = $_POST["webcal_login"]; |
$edituser->webcal_login = $_POST["webcal_login"]; |
188 |
|
|
189 |
$ret=$edituser->update(); |
$ret=$edituser->update(); |
300 |
print '<tr><td valign="top">'.$langs->trans("Password").'</td>'; |
print '<tr><td valign="top">'.$langs->trans("Password").'</td>'; |
301 |
print '<td class="valeur"><input size="30" type="text" name="password" value=""></td></tr>'; |
print '<td class="valeur"><input size="30" type="text" name="password" value=""></td></tr>'; |
302 |
|
|
303 |
|
print '<tr><td valign="top">'.$langs->trans("Administrator").'</td>'; |
304 |
|
print '<td class="valeur">'; |
305 |
|
$form->selectyesnonum('admin',0); |
306 |
|
print "</td></tr>\n"; |
307 |
|
|
308 |
print '<tr><td valign="top">'.$langs->trans("Phone").'</td>'; |
print '<tr><td valign="top">'.$langs->trans("Phone").'</td>'; |
309 |
print '<td class="valeur"><input size="20" type="text" name="office_phone" value=""></td></tr>'; |
print '<td class="valeur"><input size="20" type="text" name="office_phone" value=""></td></tr>'; |
310 |
|
|
317 |
print '<tr><td valign="top">'.$langs->trans("EMail").'</td>'; |
print '<tr><td valign="top">'.$langs->trans("EMail").'</td>'; |
318 |
print '<td class="valeur"><input size="40" type="text" name="email" value=""></td></tr>'; |
print '<td class="valeur"><input size="40" type="text" name="email" value=""></td></tr>'; |
319 |
|
|
|
print '<tr><td valign="top">'.$langs->trans("Administrator").'</td>'; |
|
|
print '<td class="valeur">'; |
|
|
$form->selectyesnonum('admin',0); |
|
|
print "</td></tr>\n"; |
|
|
|
|
320 |
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>'; |
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>'; |
321 |
print "<textarea name=\"note\" rows=\"12\" cols=\"40\">"; |
print "<textarea name=\"note\" rows=\"6\" cols=\"40\">"; |
322 |
print "</textarea></td></tr>\n"; |
print "</textarea></td></tr>\n"; |
323 |
|
|
324 |
// Autres caractéristiques issus des autres modules |
// Autres caractéristiques issus des autres modules |
432 |
|
|
433 |
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>'; |
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>'; |
434 |
print '<td width="50%" class="valeur">'.$fuser->nom.'</td>'; |
print '<td width="50%" class="valeur">'.$fuser->nom.'</td>'; |
435 |
print '<td align="center" valign="middle" width="25%" rowspan="11">'; |
print '<td align="center" valign="middle" width="25%" rowspan="13">'; |
436 |
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) |
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) |
437 |
{ |
{ |
438 |
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; |
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; |
457 |
print '<td width="50%" class="error">'.$langs->trans("LoginAccountDisable").'</td></tr>'; |
print '<td width="50%" class="error">'.$langs->trans("LoginAccountDisable").'</td></tr>'; |
458 |
} |
} |
459 |
|
|
460 |
print '<tr><td width="25%" valign="top">'.$langs->trans("Phone").'</td>'; |
// Password |
461 |
print '<td width="50%" class="valeur">'.$fuser->office_phone.'</td>'; |
print '<tr><td width="25%" valign="top">'.$langs->trans("Password").'</td>'; |
462 |
print '<tr><td width="25%" valign="top">'.$langs->trans("Fax").'</td>'; |
print '<td width="50%" class="valeur">'.eregi_replace('.','*',$fuser->pass).'</td>'; |
|
print '<td width="50%" class="valeur">'.$fuser->office_fax.'</td>'; |
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Mobile").'</td>'; |
|
|
print '<td width="50%" class="valeur">'.$fuser->user_mobile.'</td>'; |
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>'; |
|
|
print '<td width="50%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>'; |
|
463 |
print "</tr>\n"; |
print "</tr>\n"; |
464 |
|
|
465 |
|
// Administrateur |
466 |
print '<tr><td width="25%" valign="top">'.$langs->trans("Administrator").'</td>'; |
print '<tr><td width="25%" valign="top">'.$langs->trans("Administrator").'</td>'; |
467 |
print '<td class="valeur">'.yn($fuser->admin); |
print '<td class="valeur">'.yn($fuser->admin); |
468 |
if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star"); |
if ($fuser->admin) print ' '.img_picto($langs->trans("Administrator"),"star"); |
469 |
print '</td>'; |
print '</td>'; |
470 |
print "</tr>\n"; |
print "</tr>\n"; |
471 |
|
|
472 |
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>'; |
// Source |
473 |
print '<td class="valeur">'.dolibarr_print_date($fuser->datec).'</td>'; |
print '<tr><td width="25%" valign="top">'.$langs->trans("Source").'</td>'; |
|
print "</tr>\n"; |
|
|
|
|
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateModification").'</td>'; |
|
|
print '<td class="valeur">'.dolibarr_print_date($fuser->datem).'</td>'; |
|
|
print "</tr>\n"; |
|
|
|
|
|
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("ContactCard").'</td>'; |
|
474 |
print '<td class="valeur">'; |
print '<td class="valeur">'; |
475 |
if ($fuser->contact_id) |
if ($fuser->societe_id) |
476 |
{ |
{ |
477 |
print '<a href="../contact/fiche.php?id='.$fuser->contact_id.'">'.$langs->trans("ContactCard").'</a>'; |
print $langs->trans("External"); |
478 |
} |
} |
479 |
else |
else |
480 |
{ |
{ |
481 |
print $langs->trans("ThisUserIsNot"); |
print $langs->trans("Internal"); |
482 |
} |
} |
483 |
print '</td>'; |
print '</td></tr>'; |
|
print "</tr>\n"; |
|
484 |
|
|
485 |
|
// Company / Contact |
486 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Company").' / '.$langs->trans("Contact").'</td>'; |
487 |
|
print '<td class="valeur">'; |
488 |
if ($fuser->societe_id > 0) |
if ($fuser->societe_id > 0) |
489 |
{ |
{ |
490 |
$societe = new Societe($db); |
$societe = new Societe($db); |
491 |
$societe->fetch($fuser->societe_id); |
$societe->fetch($fuser->societe_id); |
492 |
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Company").'</td>'; |
print '<a href="'.DOL_URL_ROOT.'/soc.php?id='.$fuser->societe_id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).'</a>'; |
493 |
print '<td colspan="2">'.$societe->nom.' </td>'; |
if ($fuser->contact_id) |
494 |
print "</tr>\n"; |
{ |
495 |
|
$contact = new Contact($db); |
496 |
|
$contact->fetch($fuser->contact_id); |
497 |
|
print ' / '.'<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->fullname,32).'</a>'; |
498 |
|
} |
499 |
|
} |
500 |
|
else |
501 |
|
{ |
502 |
|
print $langs->trans("ThisUserIsNot"); |
503 |
} |
} |
504 |
|
print '</td>'; |
505 |
|
print "</tr>\n"; |
506 |
|
|
507 |
|
// Tel, fax, portable |
508 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Phone").'</td>'; |
509 |
|
print '<td width="50%" class="valeur">'.$fuser->office_phone.'</td>'; |
510 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Fax").'</td>'; |
511 |
|
print '<td width="50%" class="valeur">'.$fuser->office_fax.'</td>'; |
512 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Mobile").'</td>'; |
513 |
|
print '<td width="50%" class="valeur">'.$fuser->user_mobile.'</td>'; |
514 |
|
|
515 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("EMail").'</td>'; |
516 |
|
print '<td width="50%" class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>'; |
517 |
|
print "</tr>\n"; |
518 |
|
|
519 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateCreation").'</td>'; |
520 |
|
print '<td class="valeur">'.dolibarr_print_date($fuser->datec).'</td>'; |
521 |
|
print "</tr>\n"; |
522 |
|
|
523 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("DateModification").'</td>'; |
524 |
|
print '<td class="valeur">'.dolibarr_print_date($fuser->datem).'</td>'; |
525 |
|
print "</tr>\n"; |
526 |
|
|
527 |
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>'; |
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Note").'</td>'; |
528 |
print '<td colspan="2" class="valeur">'.nl2br($fuser->note).' </td>'; |
print '<td colspan="2" class="valeur">'.nl2br($fuser->note).' </td>'; |
548 |
*/ |
*/ |
549 |
print '<div class="tabsAction">'; |
print '<div class="tabsAction">'; |
550 |
|
|
551 |
if ($user->admin) |
if ($user->admin || ($user->id == $fuser->id)) |
552 |
{ |
{ |
553 |
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>'; |
print '<a class="butAction" href="fiche.php?id='.$fuser->id.'&action=edit">'.$langs->trans("Edit").'</a>'; |
554 |
} |
} |
694 |
/* |
/* |
695 |
* Fiche en mode edition |
* Fiche en mode edition |
696 |
*/ |
*/ |
697 |
if ($_GET["action"] == 'edit' && $user->admin) |
if ($_GET["action"] == 'edit' && ($user->admin || ($user->id == $fuser->id))) |
698 |
{ |
{ |
699 |
|
|
700 |
print '<form action="fiche.php?id='.$fuser->id.'" method="post" name="updateuser" enctype="multipart/form-data">'; |
print '<form action="fiche.php?id='.$fuser->id.'" method="post" name="updateuser" enctype="multipart/form-data">'; |
701 |
print '<input type="hidden" name="action" value="update">'; |
print '<input type="hidden" name="action" value="update">'; |
702 |
print '<table width="100%" class="border">'; |
print '<table width="100%" class="border">'; |
703 |
|
|
704 |
|
$rowspan=11; |
705 |
|
if ($conf->global->USER_ALLOW_PASSWORD_CHANGE) $rowspan++; |
706 |
|
|
707 |
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>'; |
print '<tr><td width="25%" valign="top">'.$langs->trans("Lastname").'</td>'; |
708 |
print '<td width="50%" class="valeur"><input class="flat" size="30" type="text" name="nom" value="'.$fuser->nom.'"></td>'; |
print '<td width="50%" class="valeur"><input class="flat" size="30" type="text" name="nom" value="'.$fuser->nom.'"></td>'; |
709 |
print '<td align="center" valign="middle" width="25%" rowspan="9">'; |
print '<td align="center" valign="middle" width="25%" rowspan="'.$rowspan.'">'; |
710 |
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) |
if (file_exists($conf->users->dir_output."/".$fuser->id.".jpg")) |
711 |
{ |
{ |
712 |
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; |
print '<img width="100" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=userphoto&file='.$fuser->id.'.jpg">'; |
721 |
print "<tr>".'<td valign="top">'.$langs->trans("Firstname").'</td>'; |
print "<tr>".'<td valign="top">'.$langs->trans("Firstname").'</td>'; |
722 |
print '<td><input size="30" type="text" class="flat" name="prenom" value="'.$fuser->prenom.'"></td></tr>'; |
print '<td><input size="30" type="text" class="flat" name="prenom" value="'.$fuser->prenom.'"></td></tr>'; |
723 |
|
|
724 |
|
// Login |
725 |
print "<tr>".'<td valign="top">'.$langs->trans("Login").'</td>'; |
print "<tr>".'<td valign="top">'.$langs->trans("Login").'</td>'; |
726 |
print '<td><input size="12" maxlength="8" type="text" class="flat" name="login" value="'.$fuser->login.'"></td></tr>'; |
print '<td>'; |
727 |
|
if ($user->admin) print '<input size="12" maxlength="8" type="text" class="flat" name="login" value="'.$fuser->login.'">'; |
728 |
print "<tr>".'<td valign="top">'.$langs->trans("Phone").'</td>'; |
else print $fuser->login.'<input type="hidden" name="login" value="'.$fuser->login.'">'; |
729 |
print '<td><input size="20" type="text" name="office_phone" class="flat" value="'.$fuser->office_phone.'"></td></tr>'; |
print '</td></tr>'; |
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Fax").'</td>'; |
|
|
print '<td><input size="20" type="text" name="office_fax" class="flat" value="'.$fuser->office_fax.'"></td></tr>'; |
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("Mobile").'</td>'; |
|
|
print '<td><input size="20" type="text" name="user_mobile" class="flat" value="'.$fuser->user_mobile.'"></td></tr>'; |
|
|
|
|
|
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>'; |
|
|
print '<td><input size="30" type="text" name="email" class="flat" value="'.$fuser->email.'"></td></tr>'; |
|
730 |
|
|
731 |
|
// Pass |
732 |
|
if ($conf->global->USER_ALLOW_PASSWORD_CHANGE) |
733 |
|
{ |
734 |
|
print "<tr>".'<td valign="top">'.$langs->trans("Password").'</td>'; |
735 |
|
print '<td><input size="12" maxlength="8" type="password" class="flat" name="pass" value="'.$fuser->pass.'"></td></tr>'; |
736 |
|
} |
737 |
|
|
738 |
|
// Administrateur |
739 |
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>'; |
print "<tr>".'<td valign="top">'.$langs->trans("Administrator").'</td>'; |
740 |
if ($fuser->societe_id > 0) |
if ($fuser->societe_id > 0) |
741 |
{ |
{ |
750 |
print '</td></tr>'; |
print '</td></tr>'; |
751 |
} |
} |
752 |
|
|
753 |
|
// Source |
754 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Source").'</td>'; |
755 |
|
print '<td class="valeur">'; |
756 |
|
if ($fuser->societe_id) |
757 |
|
{ |
758 |
|
print $langs->trans("External"); |
759 |
|
} |
760 |
|
else |
761 |
|
{ |
762 |
|
print $langs->trans("Internal"); |
763 |
|
} |
764 |
|
print '</td></tr>'; |
765 |
|
|
766 |
|
// Company / Contact |
767 |
|
print '<tr><td width="25%" valign="top">'.$langs->trans("Company").' / '.$langs->trans("Contact").'</td>'; |
768 |
|
print '<td class="valeur">'; |
769 |
|
if ($fuser->societe_id > 0) |
770 |
|
{ |
771 |
|
$societe = new Societe($db); |
772 |
|
$societe->fetch($fuser->societe_id); |
773 |
|
print '<a href="'.DOL_URL_ROOT.'/soc.php?id='.$fuser->societe_id.'">'.img_object($langs->trans("ShowCompany"),'company').' '.dolibarr_trunc($societe->nom,32).'</a>'; |
774 |
|
if ($fuser->contact_id) |
775 |
|
{ |
776 |
|
$contact = new Contact($db); |
777 |
|
$contact->fetch($fuser->contact_id); |
778 |
|
print ' / '.'<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$fuser->contact_id.'">'.img_object($langs->trans("ShowContact"),'contact').' '.dolibarr_trunc($contact->fullname,32).'</a>'; |
779 |
|
} |
780 |
|
} |
781 |
|
else |
782 |
|
{ |
783 |
|
print $langs->trans("ThisUserIsNot"); |
784 |
|
} |
785 |
|
print '</td>'; |
786 |
|
print "</tr>\n"; |
787 |
|
|
788 |
|
// Tel, fax, portable |
789 |
|
print "<tr>".'<td valign="top">'.$langs->trans("Phone").'</td>'; |
790 |
|
print '<td><input size="20" type="text" name="office_phone" class="flat" value="'.$fuser->office_phone.'"></td></tr>'; |
791 |
|
|
792 |
|
print "<tr>".'<td valign="top">'.$langs->trans("Fax").'</td>'; |
793 |
|
print '<td><input size="20" type="text" name="office_fax" class="flat" value="'.$fuser->office_fax.'"></td></tr>'; |
794 |
|
|
795 |
|
print "<tr>".'<td valign="top">'.$langs->trans("Mobile").'</td>'; |
796 |
|
print '<td><input size="20" type="text" name="user_mobile" class="flat" value="'.$fuser->user_mobile.'"></td></tr>'; |
797 |
|
|
798 |
|
print "<tr>".'<td valign="top">'.$langs->trans("EMail").'</td>'; |
799 |
|
print '<td><input size="40" type="text" name="email" class="flat" value="'.$fuser->email.'"></td></tr>'; |
800 |
|
|
801 |
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>'; |
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>'; |
802 |
print '<textarea class="flat" name="note" rows="6" cols="40">'; |
print '<textarea class="flat" name="note" rows="4" cols="40">'; |
803 |
print $fuser->note; |
print $fuser->note; |
804 |
print "</textarea></td></tr>"; |
print "</textarea></td></tr>"; |
805 |
|
|
810 |
|
|
811 |
print '<tr><td align="center" colspan="3"><input value="'.$langs->trans("Save").'" class="button" type="submit"></td></tr>'; |
print '<tr><td align="center" colspan="3"><input value="'.$langs->trans("Save").'" class="button" type="submit"></td></tr>'; |
812 |
|
|
813 |
print '</table><br>'; |
print '</table>'; |
814 |
print '</form>'; |
print '</form>'; |
815 |
} |
} |
816 |
|
|
817 |
|
print '</div>'; |
818 |
} |
} |
819 |
} |
} |
820 |
|
|