From 1d9abf5c8fd8c4fcdb7a3015b35b8905d898fd1e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 3 Aug 2003 17:26:19 +0000 Subject: [PATCH] Update du contact --- htdocs/comm/action/fiche.php3 | 254 ++++++++++++++++++++++------------ 1 file changed, 162 insertions(+), 92 deletions(-) diff --git a/htdocs/comm/action/fiche.php3 b/htdocs/comm/action/fiche.php3 index d58e2af2c7a..36311e9cf3e 100644 --- a/htdocs/comm/action/fiche.php3 +++ b/htdocs/comm/action/fiche.php3 @@ -44,56 +44,59 @@ $db = new Db(); */ if ($action=='add_action') { - $contact = new Contact($db); - $contact->fetch($contactid); + if ($contactid) + { + $contact = new Contact($db); + $contact->fetch($contactid); + } $societe = new Societe($db); $societe->fetch($socid); - $actioncomm = new ActionComm($db); - - $actioncomm->date = $db->idate(mktime($HTTP_POST_VARS["achour"], - $HTTP_POST_VARS["acmin"], - 0, - $HTTP_POST_VARS["acmonth"], - $HTTP_POST_VARS["acday"], - $HTTP_POST_VARS["acyear"]) - ); - if ($actionid == 5) + if ($HTTP_POST_VARS["afaire"] <> 1) { - $actioncomm->percent = 0; + + $actioncomm = new ActionComm($db); + + $actioncomm->date = $db->idate(mktime($HTTP_POST_VARS["achour"], + $HTTP_POST_VARS["acmin"], + 0, + $HTTP_POST_VARS["acmonth"], + $HTTP_POST_VARS["acday"], + $HTTP_POST_VARS["acyear"]) + ); + if ($actionid == 5) + { + $actioncomm->percent = 0; + } + else + { + $actioncomm->percent = 100; + } + $actioncomm->priority = 2; + $actioncomm->type = $actionid; + $actioncomm->contact = $contactid; + + $actioncomm->user = $user; + + $actioncomm->societe = $socid; + $actioncomm->note = $note; + + $actioncomm->add($user); } - else - { - $actioncomm->percent = 100; - } - $actioncomm->priority = 2; - $actioncomm->type = $actionid; - $actioncomm->contact = $contactid; - - $actioncomm->user = $user; - - $actioncomm->societe = $socid; - $actioncomm->note = $note; - - $actioncomm->add($user); if ($todo == 'on' ) { $todo = new ActionComm($db); - $todo->type = 0; - $todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear)); - - $todo->libelle = $todo_label; + $todo->type = $actionid; + $todo->date = $db->idate(mktime(12,0,0,$remonth, $reday, $reyear)); + $todo->libelle = $todo_label; $todo->priority = 2; - $todo->societe = $societe->id; - $todo->contact = $contactid; - - $todo->user = $user; - - $todo->note = $todo_note; - - $todo->percent = 0; + $todo->societe = $societe->id; + $todo->contact = $contactid; + $todo->user = $user; + $todo->note = $todo_note; + $todo->percent = 0; $todo->add($user); @@ -127,6 +130,14 @@ if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] Header("Location: index.php"); } +if ($action=='update') +{ + $action = new Actioncomm($db); + $action->fetch($id); + $action->percent = $HTTP_POST_VARS["percent"]; + $action->contact->id = $HTTP_POST_VARS["scontactid"]; + $action->update(); +} /******************************************************************************/ /* */ @@ -135,21 +146,28 @@ if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] /******************************************************************************/ llxHeader(); +$html = new Form($db); /* * * * */ -if ($action=='create' && $actionid && $contactid) { - $caction = new CActioncomm(); - $caction->fetch($db, $actionid); - $contact = new Contact($db); - $contact->fetch($contactid); +if ($action=='create') +{ + $caction = new CActioncomm($db); + + if ($afaire <> 1) + { + $caction->fetch($db, $actionid); + + $contact = new Contact($db); + $contact->fetch($contactid); + } $societe = new Societe($db); $societe->get_nom($socid); - + /* * Rendez-vous * @@ -182,9 +200,7 @@ if ($action=='create' && $actionid && $contactid) { print 'Commentaire'; print ''; - - print ''; - + print ''; print ''; } /* @@ -195,36 +211,51 @@ if ($action=='create' && $actionid && $contactid) { */ else { - $html = new Form($db); - print_titre ("Action effectuée"); - print '
'; print ''; - + print ''; print ''; print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print "
Action'.$caction->libelle.'
Société'; - print ''.$societe->nom.'
Contact'.$contact->fullname.'
Date'; - print $html->select_date('','ac',1,1); - print '
Commentaire'; - print '

"; + if($afaire <> 1) + { + + print_titre ("Action effectuée"); + print ''; + + print ''; + print ''; + print ''; + print ''; + print ''; + print "
Action'.$caction->libelle.'
Société'; + print ''.$societe->nom.'
Contact'.$contact->fullname.'
Date'; + print $html->select_date('','ac',1,1); + print '
Commentaire'; + print '

"; + } print_titre ("Prochaine Action à faire"); print ''; + if($afaire <> 1) + { + print ''; + } + else + { + print ''; + print ''; + print ''; + } - print ''; print ''; + print ''; print ''; print ''; @@ -244,10 +275,8 @@ if ($action=='create' && $actionid && $contactid) { */ if ($id) { - if ($action == 'delete') { - print ''; print ''; print '
Ajouter
Société'; + print ''.$societe->nom.'
Ajouter
Date'; - print_date_select(); + print $html->select_date(); + print '
Action'; + $html->select_array("actionid", $caction->liste_array(), 0); print '
Action
Calendrier
'; @@ -267,40 +296,81 @@ if ($id) $act = new ActionComm($db); $act->fetch($id); - + $act->societe->fetch($act->societe->id); $act->author->fetch($act->author->id); $act->contact->fetch($act->contact->id); + - print_titre ("Action commerciale"); - - print '
'; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - if ($act->objet_url) - { - print ''; - print ''; + if ($action == 'edit') + { + print_titre ("Edition de la fiche action"); + print ''; + print ''; + print '
Type'.$act->type.'
Société'.$act->societe->nom.'Contact'.$act->contact->fullname.'
Auteur'.$act->author->fullname.'Date'.strftime('%d %B %Y %H:%M',$act->date).'
Objet lié'.$act->objet_url.'
'; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + if ($act->objet_url) + { + print ''; + print ''; + } + + if ($act->note) + { + print ''; + } + print ''; + print '
Type'.$act->type.'
Société'.$act->societe->nom.'Contact'; + $html->select_array("scontactid", $act->societe->contact_array(), $act->contact->id, 1); + print '
Date'.strftime('%d %B %Y %H:%M',$act->date).'Auteur'.$act->author->fullname.'
Pourcentage réalisé%
Objet lié'.$act->objet_url.'
Commentaire'; + print nl2br($act->note).'

'; } - - if ($act->note) - { - print 'Commentaire'; - print nl2br($act->note).''; + else + { + print_titre ("Action commerciale"); + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; + print ''; + if ($act->objet_url) + { + print ''; + print ''; + } + + if ($act->note) + { + print ''; + } + print '
Type'.$act->type.'
Société'.$act->societe->nom.'Contact'.$act->contact->fullname.'
Date'.strftime('%d %B %Y %H:%M',$act->date).'Auteur'.$act->author->fullname.'
Pourcentage réalisé'.$act->percent.' %
Objet lié'.$act->objet_url.'
Commentaire'; + print nl2br($act->note).'
'; } - print ''; - /* * */ print '
'; - - print ''; + print ''; + } + else + { + print 'Editer'; + } print ''; print ''; print '';
-'; + if ($action=='edit') + { + print 'Annuler---