* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin * * 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. */ /** * \file htdocs/comm/propal/note.php * \ingroup propale * \brief Fiche d'information sur une proposition commerciale * \version $Id$ */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php"); $langs->load('propal'); $langs->load('compta'); $langs->load('bills'); $id = isset($_GET["id"])?$_GET["id"]:''; // Security check if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'propale', $id, 'propal'); /******************************************************************************/ /* Actions */ /******************************************************************************/ if ($_POST["action"] == 'update_public' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET["id"]); $db->begin(); $res=$propal->update_note_public($_POST["note_public"],$user); if ($res < 0) { $mesg='
'.$propal->error.'
'; $db->rollback(); } else { $db->commit(); } } if ($_POST['action'] == 'update' && $user->rights->propale->creer) { $propal = new Propal($db); $propal->fetch($_GET["id"]); $db->begin(); $res=$propal->update_note($_POST["note"],$user); if ($res < 0) { $mesg='
'.$propal->error.'
'; $db->rollback(); } else { $db->commit(); } } /******************************************************************************/ /* Affichage fiche */ /******************************************************************************/ llxHeader(); $html = new Form($db); $id = $_GET["id"]; $ref= $_GET["ref"]; if ($id > 0 || ! empty($ref)) { if ($mesg) print $mesg; $now=gmmktime(); $propal = new Propal($db); if ($propal->fetch($id, $ref)) { $societe = new Societe($db); if ( $societe->fetch($propal->socid) ) { $head = propal_prepare_head($propal); dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); print ''; $linkback="".$langs->trans("BackToList").""; // Ref print ''; // Ref client print ''; print ''; // Customer if ( is_null($propal->client) ) $propal->fetch_thirdparty(); print ""; print ''; // Ligne info remises tiers print ''; // Date print ''; print ''; // Date fin propal print ''; print ''; print ''; // Note publique print ''; print '"; // Note privee if (! $user->societe_id) { print ''; print '"; } print "
'.$langs->trans('Ref').''; print $html->showrefnav($propal,'ref',$linkback,1,'ref','ref',''); print '
'; print ''; print '
'; print $langs->trans('RefCustomer').''; print '
'; print '
'; print $propal->ref_client; print '
".$langs->trans("Company")."'.$propal->client->getNomUrl(1).'
'.$langs->trans('Discounts').''; if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$societe->getAvailableDiscounts(); print '. '; if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->monnaie)); else print $langs->trans("CompanyHasNoAbsoluteDiscount"); print '.'; print '
'.$langs->trans('Date').''; print dol_print_date($propal->date,'daytext'); print '
'.$langs->trans('DateEndPropal').''; if ($propal->fin_validite) { print dol_print_date($propal->fin_validite,'daytext'); if ($propal->statut == 1 && $propal->fin_validite < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late")); } else { print $langs->trans("Unknown"); } print '
'.$langs->trans("NotePublic").' :'; if ($_GET["action"] == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($propal->note_public?nl2br($propal->note_public):" "); } print "
'.$langs->trans("NotePrivate").' :'; if ($_GET["action"] == 'edit') { print '
'; print ''; print ''; print '
"; print ''; print '
'; } else { print ($propal->note?nl2br($propal->note):" "); } print "
"; print ''; /* * Actions */ print '
'; if ($user->rights->propale->creer && $_GET['action'] <> 'edit') { print ''.$langs->trans('Modify').''; } print '
'; } } } $db->close(); llxFooter('$Date$ - $Revision: 1.15 '); ?>