dolibarr 19.0.4
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 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
30// Load Dolibarr environment
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
33
34
35// Load translation files required by the page
36$langs->load("companies");
37
38
39// Get parameters
40$id = GETPOST('id') ? GETPOST('id', 'int') : GETPOST('socid', 'int');
41$action = GETPOST('action', 'aZ09');
42
43
44// Initialize objects
45$object = new Societe($db);
46if ($id > 0) {
47 $object->fetch($id);
48}
49
50// Permissions
51$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
52
53// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
54$hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
55
56// Security check
57if ($user->socid > 0) {
58 unset($action);
59 $socid = $user->socid;
60}
61
62$result = restrictedArea($user, 'societe', $object->id, '&societe');
63
64
65/*
66 * Actions
67 */
68
69$parameters = array();
70$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
71if ($reshook < 0) {
72 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
73}
74if (empty($reshook)) {
75 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
76}
77
78
79/*
80 * View
81 */
82
83$form = new Form($db);
84
85$title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
86if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
87 $title = $object->name.' - '.$langs->trans("Notes");
88}
89$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
90llxHeader('', $title, $help_url);
91
92if ($object->id > 0) {
93 /*
94 * Affichage onglets
95 */
96 if (isModEnabled('notification')) {
97 $langs->load("mails");
98 }
99
100 $head = societe_prepare_head($object);
101
102 print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
103
104 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
105
106 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
107
108 $cssclass = 'titlefield';
109 //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
110 //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
111
112 print '<div class="fichecenter">';
113
114 print '<div class="underbanner clearboth"></div>';
115 print '<table class="border centpercent tableforfield">';
116
117 // Type Prospect/Customer/Supplier
118 print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
119 print $object->getTypeUrl(1);
120 print '</td></tr>';
121
122 if (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field
123 print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
124 }
125
126 if ($object->client) {
127 print '<tr><td class="'.$cssclass.'">';
128 print $langs->trans('CustomerCode').'</td><td colspan="3">';
129 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
130 $tmpcheck = $object->check_codeclient();
131 if ($tmpcheck != 0 && $tmpcheck != -5) {
132 print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
133 }
134 print '</td></tr>';
135 }
136
137 if ($object->fournisseur) {
138 print '<tr><td class="'.$cssclass.'">';
139 print $langs->trans('SupplierCode').'</td><td colspan="3">';
140 print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
141 $tmpcheck = $object->check_codefournisseur();
142 if ($tmpcheck != 0 && $tmpcheck != -5) {
143 print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
144 }
145 print '</td></tr>';
146 }
147
148 print "</table>";
149
150 print '</div>';
151
152 //print '<br>';
153
154 //print '<div class="underbanner clearboth"></div>';
155 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
156
157 print dol_get_fiche_end();
158} else {
159 $langs->load("errors");
160 print $langs->trans("ErrorRecordNotFound");
161}
162
163// End of page
164llxFooter();
165$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
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)
Return array of tabs to used on pages for third parties cards.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return 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.