* * 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 ($_POST["action"] == 'add_action') { if ($_POST["contactid"]) { $contact = new Contact($db); $contact->fetch($_POST["contactid"]); } $societe = new Societe($db); $societe->fetch($_POST["socid"]); if ($_POST["afaire"] <> 1) { $actioncomm = new ActionComm($db); $actioncomm->priority = 2; $actioncomm->type = $_POST["actionid"]; $actioncomm->date = $db->idate(mktime($_POST["heurehour"], $_POST["heuremin"], 0, $_POST["acmonth"], $_POST["acday"], $_POST["acyear"]) ); if ($_POST["actionid"] == 5) { $actioncomm->percent = 0; } else { $actioncomm->percent = 100; } $actioncomm->contact = $_POST["contactid"]; $actioncomm->user = $user; $actioncomm->societe = $_POST["socid"]; $actioncomm->note = $_POST["note"]; $actioncomm->add($user); } if ($todo == 'on' ) { $todo = new ActionComm($db); $todo->type = $_POST["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: ".$_POST["from"]); } if ($_POST["action"] == 'confirm_delete' && $_POST["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 = $_POST["percent"]; $action->contact->id = $_POST["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, $_GET["actionid"]); $contact = new Contact($db); $contact->fetch($_GET["contactid"]); } $societe = new Societe($db); $societe->get_nom($_GET["socid"]); print '
"; } } /* * * * */ if ($_GET["id"]) { if ($action == 'delete') { print '\n"; } $act = new ActionComm($db); $act->fetch($_GET["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).' | |||