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