* 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."/lib/trip.lib.php"); require_once(DOL_DOCUMENT_ROOT."/compta/deplacement/class/deplacement.class.php"); $langs->load("companies"); $langs->load("trips"); $id = GETPOST('id'); $ref = GETPOST('ref'); $action = GETPOST('action'); $confirm = GETPOST('confirm'); // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'deplacement', $id, ''); $object = new Deplacement($db); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($action == 'update_public' && $user->rights->deplacement->creer) { $db->begin(); $object->fetch($id); $res=$object->update_note_public($_POST["note_public"]); if ($res < 0) { $mesg='
'.$object->error.'
'; $db->rollback(); } else { $db->commit(); } } if ($action == 'update' && $user->rights->deplacement->creer) { $db->begin(); $object->fetch($id); $res=$object->update_note($_POST["note"]); if ($res < 0) { $mesg='
'.$object->error.'
'; $db->rollback(); } else { $db->commit(); } } /******************************************************************************/ /* Affichage fiche */ /******************************************************************************/ llxHeader(); $html = new Form($db); if ($id > 0 || ! empty($ref)) { $object->fetch($id, $ref); $soc = new Societe($db); $soc->fetch($object->socid); $head = trip_prepare_head($object); 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($object,'ref','',1,'ref','ref',$morehtmlref); print '
'.$langs->trans("Type").''.$langs->trans($object->type).'
'.$langs->trans("Person").''; $userfee=new User($db); $userfee->fetch($object->fk_user); print $userfee->getNomUrl(1); print '
'.$langs->trans("CompanyVisited").''; if ($soc->id) print $soc->getNomUrl(1); print '
'.$langs->trans("NotePublic").''; if ($action == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($object->note_public?nl2br($object->note_public):" "); } print "
'.$langs->trans("NotePrivate").''; if ($action == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($object->note?nl2br($object->note):" "); } print "
"; /* * Actions */ print ''; print '
'; if ($action <> 'edit' && $user->rights->deplacement->creer) { print '' . $langs->trans('Modify') . ''; } print "
"; } $db->close(); llxFooter(); ?>