dolibarr/htdocs/comm/propal/note.php

161 lines
5.2 KiB
PHP
Raw Normal View History

<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
2013-04-09 17:18:07 +02:00
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
2004-03-05 17:10:16 +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
* the Free Software Foundation; either version 3 of the License, or
2004-03-05 17:10:16 +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-03 02:45:22 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2004-03-05 17:10:16 +01:00
*/
/**
* \file htdocs/comm/propal/note.php
2013-12-14 01:28:59 +01:00
* \ingroup propal
* \brief Fiche d'information sur une proposition commerciale
2009-08-05 20:11:27 +02:00
*/
2004-03-05 17:10:16 +01:00
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
$langs->load('propal');
2005-09-11 13:49:43 +02:00
$langs->load('compta');
$langs->load('bills');
2004-03-05 17:10:16 +01:00
$id = GETPOST('id','int');
$ref=GETPOST('ref','alpha');
$action=GETPOST('action','alpha');
2004-03-05 17:10:16 +01: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;
$result = restrictedArea($user, 'propale', $id, 'propal');
2008-02-24 14:18:40 +01:00
$object = new Propal($db);
2008-02-24 14:18:40 +01:00
2004-03-05 17:10:16 +01:00
/******************************************************************************/
/* Actions */
/******************************************************************************/
2012-07-02 19:30:37 +02:00
if ($action == 'setnote_public' && $user->rights->propale->creer)
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
2012-07-02 19:30:37 +02:00
if ($result < 0) dol_print_error($db,$object->error);
}
2013-04-09 17:18:07 +02:00
else if ($action == 'setnote_private' && $user->rights->propale->creer)
2012-07-02 19:30:37 +02:00
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
2012-07-02 19:30:37 +02:00
if ($result < 0) dol_print_error($db,$object->error);
2004-03-05 17:10:16 +01:00
}
2004-03-05 17:10:16 +01:00
/******************************************************************************/
/* Affichage fiche */
2004-03-05 17:10:16 +01:00
/******************************************************************************/
2012-07-28 17:34:21 +02:00
llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
$form = new Form($db);
if ($id > 0 || ! empty($ref))
2004-03-05 17:10:16 +01:00
{
if ($mesg) print $mesg;
2009-08-05 19:49:12 +02:00
2012-03-23 18:19:50 +01:00
$now=dol_now();
2009-08-05 19:49:12 +02:00
if ($object->fetch($id, $ref))
2004-03-05 17:10:16 +01:00
{
$societe = new Societe($db);
if ( $societe->fetch($object->socid) )
{
$head = propal_prepare_head($object);
2009-08-05 19:49:12 +02:00
dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal');
print '<table class="border" width="100%">';
2012-07-28 17:20:17 +02:00
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
2009-08-05 19:49:12 +02:00
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
print '</td></tr>';
// Ref client
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans('RefCustomer').'</td><td align="left">';
print '</td>';
print '</tr></table>';
print '</td><td colspan="3">';
print $object->ref_client;
print '</td>';
print '</tr>';
// Customer
if ( is_null($object->client) )
$object->fetch_thirdparty();
print "<tr><td>".$langs->trans("Company")."</td>";
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
2009-08-05 19:49:12 +02:00
// Ligne info remises tiers
2009-08-05 20:11:27 +02:00
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
if ($societe->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getAvailableDiscounts();
print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.';
print '</td></tr>';
2009-08-05 19:49:12 +02:00
// Date
2009-08-05 20:11:27 +02:00
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">';
print dol_print_date($object->date,'daytext');
2009-08-05 20:11:27 +02:00
print '</td>';
print '</tr>';
// Date fin propal
print '<tr>';
print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">';
if ($object->fin_validite)
2009-08-05 20:11:27 +02:00
{
print dol_print_date($object->fin_validite,'daytext');
if ($object->statut == 1 && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
2009-08-05 20:11:27 +02:00
}
else
{
print $langs->trans("Unknown");
}
print '</td>';
print '</tr>';
print "</table>";
2012-03-17 18:27:31 +01:00
print '<br>';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
dol_fiche_end();
}
2009-08-05 20:11:27 +02:00
}
2004-03-05 17:10:16 +01:00
}
llxFooter();
$db->close();
2004-03-05 17:10:16 +01:00
?>