* * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ require("./pre.inc.php"); require("../../contact.class.php"); require("../../lib/webcal.class.php"); require("../../cactioncomm.class.php"); require("../../actioncomm.class.php"); /* * Sécurité accés client */ if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } /* * * * */ if ($HTTP_POST_VARS["action"] == 'add_action') { if ($contactid) { $contact = new Contact($db); $contact->fetch($contactid); } $societe = new Societe($db); $societe->fetch($socid); if ($HTTP_POST_VARS["afaire"] <> 1) { $actioncomm = new ActionComm($db); $actioncomm->priority = 2; $actioncomm->type = $HTTP_POST_VARS["actionid"]; $actioncomm->date = $db->idate(mktime($HTTP_POST_VARS["heurehour"], $HTTP_POST_VARS["heuremin"], 0, $HTTP_POST_VARS["acmonth"], $HTTP_POST_VARS["acday"], $HTTP_POST_VARS["acyear"]) ); if ($HTTP_POST_VARS["actionid"] == 5) { $actioncomm->percent = 0; } else { $actioncomm->percent = 100; } $actioncomm->contact = $contactid; $actioncomm->user = $user; $actioncomm->societe = $socid; $actioncomm->note = $note; $actioncomm->add($user); } if ($todo == 'on' ) { $todo = new ActionComm($db); $todo->type = $HTTP_POST_VARS["nextactionid"]; $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->add($user); if ($conf->webcal && $todo_webcal == 'on') { $webcal = new Webcal(); $webcal->heure = $heurehour . $heuremin . '00'; $webcal->duree = ($dureehour * 60) + $dureemin; if ($actionid == 5) { $libelle = "Rendez-vous avec ".$contact->fullname; $libelle .= "\n" . $todo->libelle; } else { $libelle = $todo->libelle; } $webcal->add($user, $todo->date, $societe->nom, $libelle); } } // Header("Location: ".DOL_URL_ROOT."/comm/fiche.php?socid=$socid"); Header("Location: ".$HTTP_POST_VARS["from"]); } if ($HTTP_POST_VARS["action"] == 'confirm_delete' && $HTTP_POST_VARS["confirm"] == yes) { $actioncomm = new ActionComm($db); $actioncomm->delete($id); 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(); } /******************************************************************************/ /* */ /* Fin des Actions */ /* */ /******************************************************************************/ llxHeader(); $html = new Form($db); /* * * * */ if ($_GET["action"] == 'create') { $caction = new CActioncomm($db); if ($afaire <> 1) { $caction->fetch($db, $actionid); $contact = new Contact($db); $contact->fetch($_GET["contactid"]); } $societe = new Societe($db); $societe->get_nom($socid); print '
'; print ''; print ''; print ''."\n"; /* * Rendez-vous * */ if ($_GET["actionid"] == 5) { print ''."\n"; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Rendez-vous
Société'; print ''.$societe->nom.'
Contact'.$contact->fullname.'
Date'; $html= new Form($db); $html->select_date('','ac'); print '
Heure'; print_heure_select("heure",8,20); print '
Durée'; print_duree_select("duree"); print '
Commentaire'; print '
'; } /* * * Action autre que rendez-vous * * */ else { print ''; 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 ''; if (defined("MAIN_MODULE_WEBCALENDAR") && MAIN_MODULE_WEBCALENDAR) { print ''; } print ''; print '
Ajouter
Société'; print ''.$societe->nom.'
Date'; print $html->select_date(); print '
Action'; $html->select_array("nextactionid", $caction->liste_array(), 0); print '
Action
Calendrier
Commentaire'; print '
'; print '

'; print ""; } } /* * * * */ if ($id) { if ($action == 'delete') { print '
'; print ''; print ''; print ''; print '\n"; print ''; print '
Supprimer l\'action
Etes-vous sur de vouloir supprimer cette action ?'; $htmls = new Form($db); $htmls->selectyesno("confirm","no"); print "
'; print "
\n"; } $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); if ($_GET["action"] == 'edit') { print_titre ("Edition de la fiche action"); print '
'; print ''; print ''; 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).'
'; } 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 '
'; if ($_GET["action"] == 'edit') { print 'Annuler'; } else { print 'Editer'; } print 'Supprimer'; print '
'; } $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$"); ?>