* Copyright (C) 2004-2011 Laurent Destailleur * * 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, see . */ /** * \file htdocs/compta/deplacement/note.php * \ingroup trip * \brief Notes on a trip card */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"); $socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; if (!$user->rights->deplacement->lire) accessforbidden(); $langs->load("companies"); $langs->load("bills"); $langs->load("trips"); // Securiy check if ($user->societe_id > 0) { unset($_GET["action"]); $socid = $user->societe_id; } $trip = new Deplacement($db); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($_POST["action"] == 'update_public' && $user->rights->deplacement->creer) { $db->begin(); $trip->fetch($_GET["id"]); $res=$trip->update_note_public($_POST["note_public"],$user); if ($res < 0) { $mesg='
'.$fac->error.'
'; $db->rollback(); } else { $db->commit(); } } if ($_POST["action"] == 'update' && $user->rights->deplacement->creer) { $db->begin(); $trip->fetch($_GET["id"]); $res=$trip->update_note($_POST["note"],$user); if ($res < 0) { $mesg='
'.$fac->error.'
'; $db->rollback(); } else { $db->commit(); } } /******************************************************************************/ /* Affichage fiche */ /******************************************************************************/ llxHeader(); $html = new Form($db); $id = $_GET['id']; $ref= $_GET['ref']; if ($id > 0 || ! empty($ref)) { $trip = new Deplacement($db); $trip->fetch($id,$ref); $soc = new Societe($db, $trip->socid); $soc->fetch($trip->socid); $h=0; $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/fiche.php?id=$trip->id"; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; $head[$h][0] = DOL_URL_ROOT."/compta/deplacement/note.php?id=$trip->id"; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; $h++; dol_fiche_head($head, 'note', $langs->trans("TripCard"), 0, 'trip'); print ''; // Ref print ''; print ''; // Type print ''; // Who print ""; print ''; print ''; print ''; // Note publique print ''; print '"; // Note privee if (! $user->societe_id) { print ''; print '"; } print "
'.$langs->trans('Ref').''; $morehtmlref=''; print $html->showrefnav($trip,'ref','',1,'ref','ref',$morehtmlref); print '
'.$langs->trans("Type").''.$langs->trans($trip->type).'
'.$langs->trans("Person").''; $userfee=new User($db); $userfee->fetch($trip->fk_user); print $userfee->getNomUrl(1); print '
'.$langs->trans("CompanyVisited").''; if ($soc->id) print $soc->getNomUrl(1); print '
'.$langs->trans("NotePublic").''; if ($_GET["action"] == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($trip->note_public?nl2br($trip->note_public):" "); } print "
'.$langs->trans("NotePrivate").''; if ($_GET["action"] == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($trip->note?nl2br($trip->note):" "); } print "
"; /* * Actions */ print ''; print '
'; if ($user->rights->deplacement->creer && $_GET["action"] <> 'edit') { print "id&action=edit\">".$langs->trans('Modify').""; } print "
"; } $db->close(); llxFooter(); ?>