2007-06-22 14:36:50 +02:00
|
|
|
|
<?php
|
2009-05-02 16:26:54 +02:00
|
|
|
|
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
2011-05-17 20:58:59 +02:00
|
|
|
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
2007-06-22 14:36:50 +02:00
|
|
|
|
*
|
|
|
|
|
|
* 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
|
2011-08-01 01:45:11 +02:00
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2007-06-22 14:36:50 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2010-02-27 14:37:13 +01:00
|
|
|
|
* \file htdocs/fichinter/note.php
|
|
|
|
|
|
* \ingroup fichinter
|
|
|
|
|
|
* \brief Fiche d'information sur une fiche d'intervention
|
2008-11-02 23:23:13 +01:00
|
|
|
|
*/
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2010-03-27 16:06:19 +01:00
|
|
|
|
require("../main.inc.php");
|
2010-04-28 14:24:06 +02:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php");
|
2007-06-22 14:36:50 +02:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT."/lib/fichinter.lib.php");
|
|
|
|
|
|
|
|
|
|
|
|
$langs->load('companies');
|
2011-07-02 19:33:24 +02:00
|
|
|
|
$langs->load("interventions");
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
$fichinterid = GETPOST("id");
|
|
|
|
|
|
$action=GETPOST("action");
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2008-02-24 14:18:40 +01:00
|
|
|
|
// Security check
|
2008-02-25 21:03:21 +01:00
|
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
2008-02-24 14:18:40 +01:00
|
|
|
|
$result = restrictedArea($user, 'ficheinter', $fichinterid, 'fichinter');
|
|
|
|
|
|
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
/* Actions */
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($action == 'update_public' && $user->rights->ficheinter->creer)
|
2007-06-22 14:36:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
$fichinter = new Fichinter($db);
|
2011-05-17 20:58:59 +02:00
|
|
|
|
$fichinter->fetch($fichinterid);
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
|
|
|
|
|
$db->begin();
|
2008-11-02 23:23:13 +01:00
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
$res=$fichinter->update_note_public(GETPOST("note_public"),$user);
|
2007-06-22 14:36:50 +02:00
|
|
|
|
if ($res < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
|
|
|
|
|
$db->rollback();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$db->commit();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($action == 'update' && $user->rights->ficheinter->creer)
|
2007-06-22 14:36:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
$fichinter = new Fichinter($db);
|
2011-05-17 20:58:59 +02:00
|
|
|
|
$fichinter->fetch($fichinterid);
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
|
|
|
|
|
$db->begin();
|
|
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
$res=$fichinter->update_note(GETPOST("note_private"),$user);
|
2007-06-22 14:36:50 +02:00
|
|
|
|
if ($res < 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
$mesg='<div class="error">'.$fichinter->error.'</div>';
|
|
|
|
|
|
$db->rollback();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$db->commit();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
/* Affichage fiche */
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
|
|
|
|
|
|
$html = new Form($db);
|
|
|
|
|
|
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($fichinterid)
|
2007-06-22 14:36:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
if ($mesg) print $mesg;
|
2008-11-02 23:23:13 +01:00
|
|
|
|
|
2007-06-22 14:36:50 +02:00
|
|
|
|
$fichinter = new Fichinter($db);
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ( $fichinter->fetch($fichinterid) )
|
2007-06-22 14:36:50 +02:00
|
|
|
|
{
|
|
|
|
|
|
$societe = new Societe($db);
|
|
|
|
|
|
if ( $societe->fetch($fichinter->socid) )
|
|
|
|
|
|
{
|
|
|
|
|
|
$head = fichinter_prepare_head($fichinter);
|
2010-02-27 14:37:13 +01:00
|
|
|
|
dol_fiche_head($head, 'note', $langs->trans('InterventionCard'), 0, 'intervention');
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<table class="border" width="100%">';
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$fichinter->ref.'</td></tr>';
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
2010-02-27 14:37:13 +01:00
|
|
|
|
// Soci<63>t<EFBFBD>
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td></tr>';
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
|
|
|
|
|
// Note publique
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
2007-06-22 14:36:50 +02:00
|
|
|
|
print '<td valign="top" colspan="3">';
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($action == 'edit')
|
2008-11-02 23:23:13 +01:00
|
|
|
|
{
|
|
|
|
|
|
print '<form method="post" action="note.php?id='.$fichinter->id.'">';
|
2009-05-17 10:01:54 +02:00
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<input type="hidden" name="action" value="update_public">';
|
|
|
|
|
|
print '<textarea name="note_public" cols="80" rows="8">'.$fichinter->note_public."</textarea><br>";
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print ($fichinter->note_public?nl2br($fichinter->note_public):" ");
|
|
|
|
|
|
}
|
2007-06-22 14:36:50 +02:00
|
|
|
|
print "</td></tr>";
|
2008-11-02 23:23:13 +01:00
|
|
|
|
|
2010-02-27 14:37:13 +01:00
|
|
|
|
// Note priv<69>e
|
2007-06-22 14:36:50 +02:00
|
|
|
|
if (! $user->societe_id)
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
|
|
|
|
|
print '<td valign="top" colspan="3">';
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($action == 'edit')
|
2008-11-02 23:23:13 +01:00
|
|
|
|
{
|
|
|
|
|
|
print '<form method="post" action="note.php?id='.$fichinter->id.'">';
|
2009-05-17 10:01:54 +02:00
|
|
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
|
|
|
print '<textarea name="note_private" cols="80" rows="8">'.$fichinter->note_private."</textarea><br>";
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
|
}
|
2007-06-22 14:36:50 +02:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print ($fichinter->note_private?nl2br($fichinter->note_private):" ");
|
2007-06-22 14:36:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
print "</td></tr>";
|
|
|
|
|
|
}
|
2010-02-27 14:37:13 +01:00
|
|
|
|
|
2008-11-02 23:23:13 +01:00
|
|
|
|
print "</table>";
|
2007-06-22 14:36:50 +02:00
|
|
|
|
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Actions
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
print '<div class="tabsAction">';
|
2011-05-17 20:58:59 +02:00
|
|
|
|
if ($user->rights->ficheinter->creer && GETPOST("action") <> 'edit')
|
2007-06-22 14:36:50 +02:00
|
|
|
|
{
|
2008-01-11 00:59:58 +01:00
|
|
|
|
print '<a class="butAction" href="note.php?id='.$fichinter->id.'&action=edit">'.$langs->trans('Modify').'</a>';
|
2007-06-22 14:36:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
}
|
2008-11-02 23:23:13 +01:00
|
|
|
|
}
|
2007-06-22 14:36:50 +02:00
|
|
|
|
}
|
|
|
|
|
|
$db->close();
|
2011-08-27 16:24:16 +02:00
|
|
|
|
llxFooter();
|
2007-06-22 14:36:50 +02:00
|
|
|
|
?>
|