2004-10-19 22:35:36 +02:00
|
|
|
|
<?php
|
2005-01-07 22:18:52 +01:00
|
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2007-12-02 18:59:06 +01:00
|
|
|
|
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
2004-07-21 17:34:35 +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
|
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
*
|
|
|
|
|
|
* $Id$
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2005-07-10 19:27:19 +02:00
|
|
|
|
/**
|
|
|
|
|
|
\file htdocs/compta/facture/note.php
|
2004-08-14 15:00:55 +02:00
|
|
|
|
\ingroup facture
|
|
|
|
|
|
\brief Fiche de notes sur une facture
|
|
|
|
|
|
\version $Revision$
|
2004-07-21 17:34:35 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
require("./pre.inc.php");
|
2005-12-03 18:18:35 +01:00
|
|
|
|
require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php');
|
|
|
|
|
|
|
2006-09-13 20:56:30 +02:00
|
|
|
|
$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:"";
|
2004-07-21 17:34:35 +02:00
|
|
|
|
|
|
|
|
|
|
if (!$user->rights->facture->lire)
|
|
|
|
|
|
accessforbidden();
|
|
|
|
|
|
|
2004-09-18 14:33:45 +02:00
|
|
|
|
$langs->load("companies");
|
2004-09-18 19:56:30 +02:00
|
|
|
|
$langs->load("bills");
|
2004-07-21 17:34:35 +02:00
|
|
|
|
|
2006-02-12 16:54:21 +01:00
|
|
|
|
// S<>curit<69> acc<63>s
|
2004-07-21 17:34:35 +02:00
|
|
|
|
if ($user->societe_id > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
unset($_GET["action"]);
|
2006-09-13 20:56:30 +02:00
|
|
|
|
$socid = $user->societe_id;
|
2004-07-21 17:34:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-01-14 21:55:20 +01:00
|
|
|
|
|
2005-09-03 14:47:56 +02:00
|
|
|
|
$fac = new Facture($db);
|
|
|
|
|
|
$fac->fetch($_GET["facid"]);
|
2005-02-05 22:40:03 +01:00
|
|
|
|
|
2005-01-14 21:55:20 +01:00
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
/* Actions */
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
2006-02-12 16:54:21 +01:00
|
|
|
|
if ($_POST["action"] == 'update_public' && $user->rights->facture->creer)
|
|
|
|
|
|
{
|
|
|
|
|
|
$db->begin();
|
|
|
|
|
|
|
2008-02-24 18:01:48 +01:00
|
|
|
|
$res=$fac->update_note_public($_POST["note_public"],$user);
|
2006-02-12 16:54:21 +01:00
|
|
|
|
if ($res < 0)
|
|
|
|
|
|
{
|
2006-02-12 17:23:43 +01:00
|
|
|
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
2006-02-12 16:54:21 +01:00
|
|
|
|
$db->rollback();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$db->commit();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
if ($_POST["action"] == 'update' && $user->rights->facture->creer)
|
|
|
|
|
|
{
|
2006-02-12 16:54:21 +01:00
|
|
|
|
$db->begin();
|
|
|
|
|
|
|
2008-02-24 18:01:48 +01:00
|
|
|
|
$res=$fac->update_note($_POST["note"],$user);
|
2006-02-12 16:54:21 +01:00
|
|
|
|
if ($res < 0)
|
|
|
|
|
|
{
|
2006-02-12 17:23:43 +01:00
|
|
|
|
$mesg='<div class="error">'.$fac->error.'</div>';
|
2006-02-12 16:54:21 +01:00
|
|
|
|
$db->rollback();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
$db->commit();
|
|
|
|
|
|
}
|
2004-07-21 17:34:35 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2005-02-05 22:40:03 +01:00
|
|
|
|
|
2006-02-12 16:54:21 +01:00
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
/******************************************************************************/
|
2006-02-12 16:54:21 +01:00
|
|
|
|
/* Affichage fiche */
|
2004-07-21 17:34:35 +02:00
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
2005-01-14 21:55:20 +01:00
|
|
|
|
llxHeader();
|
|
|
|
|
|
|
2005-09-03 14:47:56 +02:00
|
|
|
|
$html = new Form($db);
|
2005-01-14 21:55:20 +01:00
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
if ($_GET["facid"])
|
|
|
|
|
|
{
|
2006-09-13 20:56:30 +02:00
|
|
|
|
$soc = new Societe($db, $fac->socid);
|
|
|
|
|
|
$soc->fetch($fac->socid);
|
2005-12-03 18:18:35 +01:00
|
|
|
|
|
|
|
|
|
|
$head = facture_prepare_head($fac);
|
2008-04-17 13:30:04 +02:00
|
|
|
|
dolibarr_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"));
|
2005-09-03 14:47:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
|
2005-12-03 17:56:04 +01:00
|
|
|
|
// Reference
|
2007-12-02 18:59:06 +01:00
|
|
|
|
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$fac->ref.'</td></tr>';
|
2005-12-03 17:56:04 +01:00
|
|
|
|
|
2006-05-25 18:06:14 +02:00
|
|
|
|
// Soci<63>t<EFBFBD>
|
2005-09-03 14:47:56 +02:00
|
|
|
|
print '<tr><td>'.$langs->trans("Company").'</td>';
|
2006-06-03 18:04:32 +02:00
|
|
|
|
print '<td colspan="3">'.$soc->getNomUrl(1,'compta').'</td>';
|
2005-09-03 14:47:56 +02:00
|
|
|
|
|
2006-02-12 16:54:21 +01:00
|
|
|
|
// Note publique
|
|
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
|
|
|
|
|
|
print '<td valign="top" colspan="3">';
|
|
|
|
|
|
if ($_GET["action"] == 'edit')
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<form method="post" action="note.php?facid='.$fac->id.'">';
|
|
|
|
|
|
print '<input type="hidden" name="action" value="update_public">';
|
|
|
|
|
|
print '<textarea name="note_public" cols="80" rows="8">'.$fac->note_public."</textarea><br>";
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print ($fac->note_public?nl2br($fac->note_public):" ");
|
|
|
|
|
|
}
|
|
|
|
|
|
print "</td></tr>";
|
2005-09-03 14:47:56 +02:00
|
|
|
|
|
2006-02-12 16:54:21 +01:00
|
|
|
|
// Note priv<69>e
|
2006-08-19 00:03:47 +02:00
|
|
|
|
if (! $user->societe_id)
|
2006-02-12 16:54:21 +01:00
|
|
|
|
{
|
2006-08-19 00:03:47 +02:00
|
|
|
|
print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
|
|
|
|
|
|
print '<td valign="top" colspan="3">';
|
|
|
|
|
|
if ($_GET["action"] == 'edit')
|
|
|
|
|
|
{
|
|
|
|
|
|
print '<form method="post" action="note.php?facid='.$fac->id.'">';
|
|
|
|
|
|
print '<input type="hidden" name="action" value="update">';
|
|
|
|
|
|
print '<textarea name="note" cols="80" rows="8">'.$fac->note."</textarea><br>";
|
|
|
|
|
|
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
|
|
|
|
|
print '</form>';
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
print ($fac->note?nl2br($fac->note):" ");
|
|
|
|
|
|
}
|
|
|
|
|
|
print "</td></tr>";
|
2006-02-12 16:54:21 +01:00
|
|
|
|
}
|
2006-08-19 00:03:47 +02:00
|
|
|
|
|
2005-09-03 14:47:56 +02:00
|
|
|
|
print "</table>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Actions
|
|
|
|
|
|
*/
|
|
|
|
|
|
print '</div>';
|
|
|
|
|
|
print '<div class="tabsAction">';
|
|
|
|
|
|
|
|
|
|
|
|
if ($user->rights->facture->creer && $_GET["action"] <> 'edit')
|
|
|
|
|
|
{
|
2008-01-11 00:59:58 +01:00
|
|
|
|
print "<a class=\"butAction\" href=\"note.php?facid=$fac->id&action=edit\">".$langs->trans('Modify')."</a>";
|
2005-09-03 14:47:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
}
|
2005-02-05 22:40:03 +01:00
|
|
|
|
|
2004-07-21 17:34:35 +02:00
|
|
|
|
$db->close();
|
2005-02-05 22:40:03 +01:00
|
|
|
|
|
2005-07-11 02:49:16 +02:00
|
|
|
|
llxFooter('$Date$ - $Revision$');
|
2004-07-21 17:34:35 +02:00
|
|
|
|
?>
|