dolibarr 24.0.0-beta
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
7 * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
8 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
31// Load Dolibarr environment
32require '../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
34
43// Load translation files required by the page
44$langs->load("companies");
45
46
47// Get parameters
48$id = GETPOST('id') ? GETPOSTINT('id') : GETPOSTINT('socid');
49$action = GETPOST('action', 'aZ09');
50
51
52// Initialize objects
53$object = new Societe($db);
54if ($id > 0) {
55 $object->fetch($id);
56}
57
58// Permissions
59$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
60
61// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
62$hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
63
64// Security check
65if ($user->socid > 0) {
66 unset($action);
67 $socid = $user->socid;
68}
69
70$result = restrictedArea($user, 'societe', $object->id, '&societe');
71
72
73/*
74 * Actions
75 */
76
77$parameters = array();
78$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
79if ($reshook < 0) {
80 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
81}
82if (empty($reshook)) {
83 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
84}
85
86
87/*
88 * View
89 */
90
91$form = new Form($db);
92
93$title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
94if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', getDolGlobalString('MAIN_HTML_TITLE')) && $object->name) {
95 $title = $object->name.' - '.$langs->trans("Notes");
96}
97$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
98llxHeader('', $title, $help_url);
99
100if ($object->id > 0) {
101 /*
102 * Show tabs
103 */
104
105 $head = societe_prepare_head($object);
106
107 print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
108
109 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
110
111 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
112
113 $cssclass = 'titlefield';
114 //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
115 //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
116
117 print '<div class="fichecenter">';
118
119 print '<div class="underbanner clearboth"></div>';
120 print '<table class="border centpercent tableforfield">';
121
122 // Type Prospect/Customer/Supplier
123 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
124 print $object->getTypeUrl(1);
125 print '</td></tr>';
126
127 if ($object->client) {
128 print '<tr><td class="'.$cssclass.'">';
129 print $langs->trans('CustomerCode').'</td><td colspan="3">';
130 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
131 $tmpcheck = $object->check_codeclient();
132 if ($tmpcheck != 0 && $tmpcheck != -5) {
133 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
134 }
135 print '</td></tr>';
136 }
137
138 if ($object->fournisseur) {
139 print '<tr><td class="'.$cssclass.'">';
140 print $langs->trans('SupplierCode').'</td><td colspan="3">';
141 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
142 $tmpcheck = $object->check_codefournisseur();
143 if ($tmpcheck != 0 && $tmpcheck != -5) {
144 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
145 }
146 print '</td></tr>';
147 }
148
149 print "</table>";
150
151 print '</div>';
152
153 //print '<br>';
154
155 //print '<div class="underbanner clearboth"></div>';
156 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
157
158 print dol_get_fiche_end();
159} else {
160 $langs->load("errors");
161 print $langs->trans("ErrorRecordNotFound");
162}
163
164// End of page
165llxFooter();
166$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.