2006-02-17 00:25:41 +01:00
|
|
|
<?php
|
2012-03-18 11:13:01 +01:00
|
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
|
|
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
2006-02-17 00:25:41 +01: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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2006-02-17 00:25:41 +01:00
|
|
|
* (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/>.
|
2006-02-17 00:25:41 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-27 17:14:31 +02:00
|
|
|
* \file htdocs/contrat/note.php
|
|
|
|
|
* \ingroup contrat
|
|
|
|
|
* \brief Fiche de notes sur un contrat
|
|
|
|
|
*/
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2010-03-27 15:50:05 +01:00
|
|
|
require ("../main.inc.php");
|
2012-08-22 23:11:24 +02:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
2006-02-17 00:25:41 +01:00
|
|
|
|
|
|
|
|
$langs->load("companies");
|
|
|
|
|
$langs->load("contracts");
|
|
|
|
|
|
2012-07-02 19:30:37 +02:00
|
|
|
$action=GETPOST('action','alpha');
|
|
|
|
|
$confirm=GETPOST('confirm','alpha');
|
|
|
|
|
$socid=GETPOST('socid','int');
|
2012-03-18 11:13:01 +01:00
|
|
|
$id=GETPOST('id','int');
|
|
|
|
|
$ref=GETPOST('ref','alpha');
|
|
|
|
|
|
2008-02-25 17:30:43 +01:00
|
|
|
// Security check
|
2008-02-25 21:03:21 +01:00
|
|
|
if ($user->societe_id) $socid=$user->societe_id;
|
2012-03-18 11:13:01 +01:00
|
|
|
$result=restrictedArea($user,'contrat',$id);
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
$object = new Contrat($db);
|
|
|
|
|
$object->fetch($id,$ref);
|
2006-02-17 00:25:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* Actions */
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
if ($action == 'setnote_public' && $user->rights->contrat->creer)
|
2006-02-17 00:25:41 +01:00
|
|
|
{
|
2013-04-20 06:35:11 +02:00
|
|
|
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_public')), ENT_QUOTES),'_public');
|
2012-03-18 11:13:01 +01:00
|
|
|
if ($result < 0) dol_print_error($db,$object->error);
|
2006-02-17 00:25:41 +01:00
|
|
|
}
|
|
|
|
|
|
2013-04-09 17:18:07 +02:00
|
|
|
else if ($action == 'setnote_private' && $user->rights->contrat->creer)
|
2006-02-17 00:25:41 +01:00
|
|
|
{
|
2013-04-10 10:58:38 +02:00
|
|
|
$result=$object->update_note(dol_html_entity_decode(dol_htmlcleanlastbr(GETPOST('note_private')), ENT_QUOTES),'_private');
|
2012-03-18 11:13:01 +01:00
|
|
|
if ($result < 0) dol_print_error($db,$object->error);
|
2006-02-17 00:25:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
/* Affichage fiche */
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
|
|
llxHeader();
|
|
|
|
|
|
2011-11-08 10:18:45 +01:00
|
|
|
$form = new Form($db);
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
if ($id > 0 || ! empty($ref))
|
2006-02-17 00:25:41 +01:00
|
|
|
{
|
2011-09-11 20:35:38 +02:00
|
|
|
dol_htmloutput_mesg($mesg);
|
2009-08-05 20:22:40 +02:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
$object->fetch_thirdparty();
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
$head = contract_prepare_head($object);
|
2006-02-17 00:25:41 +01:00
|
|
|
|
|
|
|
|
$hselected = 2;
|
|
|
|
|
|
2009-08-05 20:22:40 +02:00
|
|
|
dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract');
|
2006-02-17 00:25:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
print '<table class="border" width="100%">';
|
|
|
|
|
|
2012-07-28 20:59:57 +02:00
|
|
|
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/liste.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
|
|
|
|
|
2006-02-17 00:25:41 +01:00
|
|
|
// Reference
|
2012-07-28 20:59:57 +02:00
|
|
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '').'</td></tr>';
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2006-06-22 02:35:29 +02:00
|
|
|
// Societe
|
2006-02-17 00:25:41 +01:00
|
|
|
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
2012-03-18 11:13:01 +01:00
|
|
|
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
2006-06-22 02:35:29 +02:00
|
|
|
|
|
|
|
|
// Ligne info remises tiers
|
|
|
|
|
print '<tr><td>'.$langs->trans('Discount').'</td><td>';
|
2013-06-16 21:31:21 +02:00
|
|
|
if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent);
|
2006-06-22 02:35:29 +02:00
|
|
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
2012-03-18 11:13:01 +01:00
|
|
|
$absolute_discount=$object->thirdparty->getAvailableDiscounts();
|
2006-06-22 02:35:29 +02:00
|
|
|
print '. ';
|
2011-11-23 14:55:36 +01:00
|
|
|
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
|
2006-06-22 02:35:29 +02:00
|
|
|
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
|
|
|
|
print '.';
|
|
|
|
|
print '</td></tr>';
|
2012-10-14 13:18:52 +02:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
print "</table>";
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2012-03-18 11:13:01 +01:00
|
|
|
print '<br>';
|
2006-02-17 00:25:41 +01:00
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
2012-03-18 11:13:01 +01:00
|
|
|
|
|
|
|
|
dol_fiche_end();
|
2006-02-17 00:25:41 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-08-27 16:24:16 +02:00
|
|
|
llxFooter();
|
2012-03-18 11:13:01 +01:00
|
|
|
$db->close();
|
2006-02-17 00:25:41 +01:00
|
|
|
?>
|