Fix: Le user de modif, la date de naissance, l'adresse et la civilit n'tait pas soit sauvegardes soit affiches dans les fiches contact.
This commit is contained in:
parent
2e60e43123
commit
78c478860f
@ -1,7 +1,7 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
*
|
||||
* 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
|
||||
@ -29,26 +29,40 @@ $error = array();
|
||||
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->socid = $_POST["socid"];
|
||||
|
||||
$contact->name = $_POST["name"];
|
||||
$contact->firstname = $_POST["firstname"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->poste = $_POST["poste"];
|
||||
$contact->address = $_POST["adresse"];
|
||||
$contact->cp = $_POST["cp"];
|
||||
$contact->ville = $_POST["ville"];
|
||||
$contact->fax = $_POST["fax"];
|
||||
$contact->note = $_POST["note"];
|
||||
$contact->email = $_POST["email"];
|
||||
$contact->phone_pro = $_POST["phone_pro"];
|
||||
$contact->phone_perso = $_POST["phone_perso"];
|
||||
$contact->phone_mobile = $_POST["phone_mobile"];
|
||||
$contact->jabberid = $_POST["jabberid"];
|
||||
|
||||
$_GET["id"] = $contact->create($user);
|
||||
if (! $_POST["name"] && ! $_POST["firstname"]) {
|
||||
array_push($error,"Le champ nom ou prénom est obligatoire");
|
||||
$_GET["id"]=0;
|
||||
// TODO Mettre lien back
|
||||
}
|
||||
else {
|
||||
$contact = new Contact($db);
|
||||
|
||||
$contact->socid = $_POST["socid"];
|
||||
|
||||
$contact->name = $_POST["name"];
|
||||
$contact->firstname = $_POST["firstname"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->poste = $_POST["poste"];
|
||||
$contact->address = $_POST["adresse"];
|
||||
$contact->cp = $_POST["cp"];
|
||||
$contact->ville = $_POST["ville"];
|
||||
if ($_POST["birthdayyear"] && $_POST["birthdayyear"]<=1970 && $_SERVER["WINDIR"]) {
|
||||
# windows does not support negative date timestamp so birthday is not support for old persons
|
||||
array_push($error,"Windows ne sachant pas gérer des dates avant 1970, les dates de naissance avant cette date ne seront pas sauvegardées");
|
||||
} else {
|
||||
$contact->birthday = mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||
}
|
||||
$contact->email = $_POST["email"];
|
||||
$contact->phone_pro = $_POST["phone_pro"];
|
||||
$contact->phone_perso = $_POST["phone_perso"];
|
||||
$contact->phone_mobile = $_POST["phone_mobile"];
|
||||
$contact->fax = $_POST["fax"];
|
||||
$contact->jabberid = $_POST["jabberid"];
|
||||
|
||||
$contact->note = $_POST["note"];
|
||||
|
||||
$_GET["id"] = $contact->create($user);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delete')
|
||||
@ -74,24 +88,27 @@ if ($_POST["action"] == 'update')
|
||||
$contact->socid = $_POST["socid"];
|
||||
$contact->name = $_POST["name"];
|
||||
$contact->firstname = $_POST["firstname"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->civilite_id = $_POST["civilite_id"];
|
||||
$contact->poste = $_POST["poste"];
|
||||
|
||||
$contact->address = $_POST["adresse"];
|
||||
$contact->cp = $_POST["cp"];
|
||||
$contact->ville = $_POST["ville"];
|
||||
|
||||
$contact->email = $_POST["email"];
|
||||
$contact->phone_pro = $_POST["phone_pro"];
|
||||
$contact->phone_perso = $_POST["phone_perso"];
|
||||
$contact->phone_mobile = $_POST["phone_mobile"];
|
||||
$contact->fax = $_POST["fax"];
|
||||
$contact->note = $_POST["note"];
|
||||
$contact->email = $_POST["email"];
|
||||
$contact->jabberid = $_POST["jabberid"];
|
||||
|
||||
$contact->birthday = mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]);
|
||||
|
||||
$contact->note = $_POST["note"];
|
||||
|
||||
$result = $contact->update($_POST["contactid"], $user);
|
||||
|
||||
$error = $contact->error;
|
||||
if ($contact->error) { array_push($error,$contact->error); }
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'create_user')
|
||||
@ -125,14 +142,17 @@ if ($_GET["id"] > 0)
|
||||
print '<a class="tab" href="info.php?id='.$_GET["id"].'">Info</a>';
|
||||
}
|
||||
else {
|
||||
print '<a href="'.$PHP_SELF.'?socid='.$_GET["socid"].'&action=create" id="active" class="tab">Général</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?socid='.$_GET["socid"].'&action=create" id="active" class="tab">Général</a>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
if ($mesg)
|
||||
|
||||
// Affiche les erreurs
|
||||
if (sizeof($error))
|
||||
{
|
||||
print '<div class="message">'.$mesg;
|
||||
print '</div>';
|
||||
print '<div class="message"><br>';
|
||||
print join("<br>",$error);
|
||||
print '<br><br></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -146,7 +166,8 @@ if ($_GET["socid"] > 0)
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
print_fiche_titre ("Création d'un nouveau contact");
|
||||
// Fiche en mode creation
|
||||
print '<br>';
|
||||
|
||||
print "<form method=\"post\" action=\"fiche.php\">";
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
@ -158,16 +179,16 @@ if ($_GET["action"] == 'create')
|
||||
print '<input type="hidden" name="socid" value="'.$objsoc->id.'">';
|
||||
}
|
||||
|
||||
print '<tr><td>Titre</td><td colspan="3">';
|
||||
print $form->select_civilite($contact->civilite_id);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Titre</td><td colspan="5">';
|
||||
print $form->select_civilite();
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Nom</td><td><input name="name" type="text" size="20" maxlength="80"></td>';
|
||||
print '<td>Prenom</td><td><input name="firstname" type="text" size="15" maxlength="80"></td>';
|
||||
|
||||
print '<td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Poste</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td>';
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td>';
|
||||
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
@ -182,6 +203,10 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Date de naissance</td><td colspan="5">';
|
||||
print $form->select_date('','birthday',0,0,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Note</td><td colspan="5"><textarea name="note" cols="60" rows="3"></textarea></td></tr>';
|
||||
print '<tr><td align="center" colspan="6"><input type="submit" value="Ajouter"></td></tr>';
|
||||
print "</table>";
|
||||
@ -189,8 +214,9 @@ if ($_GET["action"] == 'create')
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
{
|
||||
print_fiche_titre ("Edition d'un contact");
|
||||
|
||||
// Fiche en mode edition
|
||||
print '<br>';
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($_GET["id"], $user);
|
||||
|
||||
@ -207,20 +233,20 @@ elseif ($_GET["action"] == 'edit')
|
||||
print '<input type="hidden" name="socid" value="'.$objsoc->id.'">';
|
||||
}
|
||||
|
||||
print '<tr><td>Titre</td><td colspan="3">';
|
||||
print $form->select_civilite($contact->civilite_id);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>Titre</td><td colspan="5">';
|
||||
print $form->select_civilite($contact->civilite_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Nom</td><td><input name="name" type="text" size="20" maxlength="80" value="'.$contact->name.'"></td>';
|
||||
print '<td>Prénom</td><td><input name="firstname" type="text" size="15" maxlength="80" value="'.$contact->firstname.'"></td>';
|
||||
|
||||
print '<td>Tel Pro</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.$contact->phone_pro.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Poste</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td>';
|
||||
print '<tr><td>Poste/Fonction</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.$contact->poste.'"></td>';
|
||||
|
||||
print '<td>Tel Perso</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.$contact->phone_perso.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Adresse</td><td colspan="3"><input name="adresse" type="text" size="50" maxlength="80"></td>';
|
||||
print '<tr><td>Adresse</td><td colspan="3"><input name="adresse" type="text" size="50" maxlength="80" value="'.$contact->address.'"></td>';
|
||||
|
||||
print '<td>Portable</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.$contact->phone_mobile.'"></td></tr>';
|
||||
|
||||
@ -231,8 +257,19 @@ elseif ($_GET["action"] == 'edit')
|
||||
|
||||
print '<tr><td>Jabberid</td><td colspan="5"><input name="jabberid" type="text" size="50" maxlength="80" value="'.$contact->jabberid.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Note</td><td colspan="5"><textarea name="note" cols="60" rows="3"></textarea></td></tr>';
|
||||
print '<tr><td align="center" colspan="6"><input type="submit" value="Enregistrer"></td></tr>';
|
||||
print '<tr><td>Date de naissance</td><td colspan="5">';
|
||||
if ($contact->birthday) {
|
||||
print $form->select_date($contact->birthday,'birthday',0,0,0);
|
||||
} else {
|
||||
print $form->select_date(0,'birthday',0,0,1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Note</td><td colspan="5">';
|
||||
print '<textarea name="note" cols="60" rows="3">';
|
||||
print nl2br($contact->note);
|
||||
print '</textarea></td></tr>';
|
||||
print '<tr><td colspan="6" align="center"><input type="submit" value="Enregistrer"></td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print "</form>";
|
||||
@ -260,7 +297,9 @@ else
|
||||
print '<tr><td>Société : '.$objsoc->nom_url.'</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td valign="top">Titre : '.$contact->civilite."<br>";
|
||||
|
||||
//TODO Aller chercher le libellé de la civilite a partir de l'id $contact->civilite_id
|
||||
//print '<tr><td valign="top">Titre : '.$contact->civilite."<br>";
|
||||
|
||||
print '<tr><td valign="top">Nom : '.$contact->name.' '.$contact->firstname ."<br>";
|
||||
|
||||
@ -274,8 +313,6 @@ else
|
||||
if ($contact->jabberid)
|
||||
print 'Jabber : '.$contact->jabberid ."<br>";
|
||||
|
||||
print "<br>";
|
||||
|
||||
print '</td><td valign="top">';
|
||||
|
||||
if ($contact->phone_pro)
|
||||
@ -291,16 +328,18 @@ else
|
||||
print 'Fax : '.$contact->fax."<br>";
|
||||
|
||||
print '</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print nl2br($contact->note);
|
||||
if($contact->birthday && $contact->birthday > 0)
|
||||
print '<tr><td>Date de naissance : '.dolibarr_print_date($contact->birthday)."</td></tr>";
|
||||
|
||||
if (sizeof($error))
|
||||
{
|
||||
print $error[0];
|
||||
|
||||
}
|
||||
if ($contact->note) {
|
||||
print '<tr><td>';
|
||||
print nl2br($contact->note);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table><br>";
|
||||
|
||||
print "</div>";
|
||||
|
||||
if ($user->societe_id == 0)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 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
|
||||
@ -51,11 +52,13 @@ if ($contact->socid > 0)
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print 'Société : '.$objsoc->nom.'<br>';
|
||||
print 'Société : '.$objsoc->nom_url.'<br>';
|
||||
}
|
||||
|
||||
dolibarr_print_object_info($contact);
|
||||
|
||||
print "<br></div>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 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
|
||||
@ -23,17 +24,17 @@ require("./pre.inc.php");
|
||||
require("../contact.class.php");
|
||||
require (DOL_DOCUMENT_ROOT."/lib/vcard/vcard.class.php");
|
||||
|
||||
if ($HTTP_POST_VARS["action"] == 'update')
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
$contact = new Contact($db);
|
||||
$contact->id = $HTTP_POST_VARS["contactid"];
|
||||
$contact->id = $_POST["contactid"];
|
||||
|
||||
$contact->birthday = $HTTP_POST_VARS["reyear"].'-'.$HTTP_POST_VARS["remonth"].'-'.$HTTP_POST_VARS["reday"];
|
||||
$contact->birthday = $_POST["reyear"].'-'.$_POST["remonth"].'-'.$_POST["reday"];
|
||||
|
||||
|
||||
$contact->birthday_alert = $HTTP_POST_VARS["birthday_alert"];
|
||||
$contact->birthday_alert = $_POST["birthday_alert"];
|
||||
|
||||
$result = $contact->update_perso($HTTP_POST_VARS["contactid"], $user);
|
||||
$result = $contact->update_perso($_POST["contactid"], $user);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -110,15 +111,17 @@ else
|
||||
$objsoc = new Societe($db);
|
||||
$objsoc->fetch($contact->socid);
|
||||
|
||||
print 'Société : '.$objsoc->nom.'<br>';
|
||||
print 'Société : '.$objsoc->nom_url.'<br>';
|
||||
}
|
||||
|
||||
if ($contact->birthday)
|
||||
print 'Date de naissance : '.strftime("%d %B %Y",$contact->birthday);
|
||||
|
||||
if ($contact->birthday_alert)
|
||||
print ' (alerte)';
|
||||
if ($contact->birthday) {
|
||||
print 'Date de naissance : '.dolibarr_print_date($contact->birthday);
|
||||
|
||||
if ($contact->birthday_alert)
|
||||
print ' (alerte active)<br>';
|
||||
else
|
||||
print ' (alerte inactive)<br>';
|
||||
}
|
||||
print "<br>";
|
||||
|
||||
print "</div>";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user