PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/htdocs/fichinter/note.php

https://github.com/zeert/dolibarr
PHP | 102 lines | 48 code | 25 blank | 29 comment | 13 complexity | de953dc5f0216d1a58bbbdbc04da5eaf MD5 | raw file
  1<?php
  2/* Copyright (C) 2005-2012	Regis Houssin	<regis@dolibarr.fr>
  3 * Copyright (C) 2011-2012	Juanjo Menent	<jmenent@2byte.es>
  4 *
  5 * This program is free software; you can redistribute it and/or modify
  6 * it under the terms of the GNU General Public License as published by
  7 * the Free Software Foundation; either version 2 of the License, or
  8 * (at your option) any later version.
  9 *
 10 * This program is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 * GNU General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 17 */
 18
 19/**
 20 *	\file       htdocs/fichinter/note.php
 21 *	\ingroup    fichinter
 22 *	\brief      Fiche d'information sur une fiche d'intervention
 23 */
 24
 25require("../main.inc.php");
 26require_once(DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php");
 27require_once(DOL_DOCUMENT_ROOT."/core/lib/fichinter.lib.php");
 28
 29$langs->load('companies');
 30$langs->load("interventions");
 31
 32$id = GETPOST('id','int');
 33$ref = GETPOST('ref', 'alpha');
 34$action=GETPOST('action','alpha');
 35
 36// Security check
 37if ($user->societe_id) $socid=$user->societe_id;
 38$result = restrictedArea($user, 'ficheinter', $id, 'fichinter');
 39
 40$object = new Fichinter($db);
 41$object->fetch($id,$ref);
 42
 43
 44/*
 45 * Actions
 46 */
 47
 48if ($action == 'setnote_public' && $user->rights->ficheinter->creer)
 49{
 50	$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
 51	if ($result < 0) dol_print_error($db,$object->error);
 52}
 53
 54else if ($action == 'setnote_private' && $user->rights->ficheinter->creer)
 55{
 56	$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES));
 57	if ($result < 0) dol_print_error($db,$object->error);
 58}
 59
 60
 61/*
 62 * View
 63 */
 64
 65llxHeader();
 66
 67$form = new Form($db);
 68
 69if ($id > 0 || ! empty($ref))
 70{
 71	dol_htmloutput_mesg($mesg);
 72
 73	$societe = new Societe($db);
 74	if ($societe->fetch($object->socid))
 75	{
 76		$head = fichinter_prepare_head($object);
 77		dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
 78
 79		print '<table class="border" width="100%">';
 80
 81		$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
 82
 83		print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
 84		print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
 85		print '</td></tr>';
 86
 87		// Company
 88		print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
 89
 90		print "</table>";
 91
 92		print '<br>';
 93
 94		include(DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php');
 95
 96		dol_fiche_end();
 97	}
 98}
 99
100llxFooter();
101$db->close();
102?>