dolibarr/htdocs/societe/note.php

132 lines
4.1 KiB
PHP
Raw Normal View History

2004-10-20 23:06:45 +02:00
<?php
2005-01-11 15:49:43 +01:00
/* Copyright (C) 2001-2003,2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
2010-06-30 17:39:47 +02:00
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
2013-04-09 17:18:07 +02:00
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
2003-09-23 11:56:10 +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 3 of the License, or
2003-09-23 11:56:10 +02: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:19:04 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2003-09-23 11:56:10 +02:00
*/
2009-06-30 02:01:47 +02:00
/**
2012-03-19 22:06:28 +01:00
* \file htdocs/societe/note.php
2009-06-30 02:01:47 +02:00
* \brief Tab for notes on third party
* \ingroup societe
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2003-09-23 11:56:10 +02:00
2012-03-19 22:06:28 +01:00
$action = GETPOST('action');
$langs->load("companies");
2008-02-24 14:18:40 +01:00
// Security check
$id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
2013-04-09 17:18:07 +02:00
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe', $id, '&societe');
2011-01-30 17:29:12 +01:00
$object = new Societe($db);
2013-04-09 17:18:07 +02:00
if ($id > 0) $object->fetch($id);
2011-01-30 17:29:12 +01:00
2009-06-30 02:01:47 +02:00
/*
* Actions
*/
2013-04-09 17:18:07 +02:00
/******************************************************************************/
/* Actions */
/******************************************************************************/
2013-05-29 13:31:57 +02:00
if ($action == 'setnote_public' && $user->rights->societe->creer)
{
2013-04-09 17:18:07 +02:00
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES),'_public');
2013-04-09 17:18:07 +02:00
if ($result < 0) setEventMessage($object->error,'errors');
2003-09-23 11:56:10 +02:00
}
2005-11-11 17:37:53 +01:00
2013-05-29 13:31:57 +02:00
else if ($action == 'setnote_private' && $user->rights->societe->creer)
2013-04-09 17:18:07 +02:00
{
$object->fetch($id);
$result=$object->update_note(dol_html_entity_decode(GETPOST('note_private'), ENT_QUOTES),'_private');
2013-04-09 17:18:07 +02:00
if ($result < 0) setEventMessage($object->error,'errors');
}
2005-11-11 17:37:53 +01:00
2003-09-23 11:56:10 +02:00
/*
2009-06-30 02:01:47 +02:00
* View
2003-09-23 11:56:10 +02:00
*/
$form = new Form($db);
2004-02-08 12:51:38 +01:00
2011-05-01 20:56:41 +02:00
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ThirdParty").' - '.$langs->trans("Notes"),$help_url);
2009-06-30 02:01:47 +02:00
2013-04-09 17:18:07 +02:00
if ($id > 0)
2005-11-11 17:37:53 +01:00
{
2011-07-13 18:24:57 +02:00
/*
* Affichage onglets
*/
2012-09-15 10:01:35 +02:00
if (! empty($conf->notification->enabled)) $langs->load("mails");
$head = societe_prepare_head($object);
2011-07-13 18:24:57 +02:00
dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company');
2009-06-30 02:01:47 +02:00
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
2011-07-13 18:24:57 +02:00
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
2009-06-30 02:01:47 +02:00
2011-07-13 18:24:57 +02:00
print '<table class="border" width="100%">';
2006-06-03 18:11:35 +02:00
print '<tr><td width="25%">'.$langs->trans('ThirdPartyName').'</td>';
2011-07-13 18:24:57 +02:00
print '<td colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom');
2011-07-13 18:24:57 +02:00
print '</td></tr>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
}
if ($object->client)
2009-06-30 02:01:47 +02:00
{
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() <> 0) print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
print '</td></tr>';
}
if ($object->fournisseur)
2009-06-30 02:01:47 +02:00
{
print '<tr><td>';
print $langs->trans('SupplierCode').'</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() <> 0) print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
print '</td></tr>';
}
print "</table>";
2013-04-10 16:08:38 +02:00
2013-04-09 17:18:07 +02:00
print '<br>';
2013-04-10 16:08:38 +02:00
$colwidth='25';
2013-04-09 17:18:07 +02:00
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
2013-04-10 16:08:38 +02:00
2012-03-19 22:06:28 +01:00
dol_fiche_end();
2003-09-23 11:56:10 +02:00
}
llxFooter();
2003-09-23 11:56:10 +02:00
$db->close();
2013-04-09 17:18:07 +02:00
?>