dolibarr 18.0.6
note.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2003,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 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
32
33$action = GETPOST('action', 'aZ09');
34
35// Load translation files required by the page
36$langs->load("companies");
37
38$id = GETPOST('id', 'int');
39
40$object = new Contact($db);
41if ($id > 0) {
42 $object->fetch($id);
43}
44
45// Security check
46if ($user->socid > 0) {
47 if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
49 }
50}
51$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
52
53
54$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
55
56// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
57// $hookmanager->initHooks(array('contactcard')); -> Name conflict with product/card.php
58$hookmanager->initHooks(array('contactnote'));
59
60
61/*
62 * Actions
63 */
64
65$parameters = array();
66$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
67if ($reshook < 0) {
68 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
69}
70if (empty($reshook)) {
71 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
72}
73
74
75/*
76 * View
77 */
78
79$now = dol_now();
80
81$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
82
83$form = new Form($db);
84
85$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
86llxHeader('', $title, $help_url);
87
88if ($id > 0) {
89 /*
90 * Affichage onglets
91 */
92 if (isModEnabled('notification')) {
93 $langs->load("mails");
94 }
95
96 $head = contact_prepare_head($object);
97
98 print dol_get_fiche_head($head, 'note', $title, -1, 'contact');
99
100 $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
101
102 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
103 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
104 $morehtmlref .= '</a>';
105
106 $morehtmlref .= '<div class="refidno">';
107 if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
108 $objsoc = new Societe($db);
109 $objsoc->fetch($object->socid);
110 // Thirdparty
111 if ($objsoc->id > 0) {
112 $morehtmlref .= $objsoc->getNomUrl(1);
113 } else {
114 $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
115 }
116 }
117 $morehtmlref .= '</div>';
118
119 dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
120
121 $cssclass = 'titlefield';
122 //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
123 //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
124
125 print '<div class="fichecenter">';
126 print '<div class="underbanner clearboth"></div>';
127
128 print '<table class="border centpercent tableforfield">';
129
130 // Civility
131 print '<tr><td class="'.$cssclass.'">'.$langs->trans("UserTitle").'</td><td>';
132 print $object->getCivilityLabel();
133 print '</td></tr>';
134
135 print "</table>";
136
137
138 $cssclass = "titlefield";
139 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
140
141 print '</div>';
142
143 print dol_get_fiche_end();
144}
145
146llxFooter();
147$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:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage contact/addresses.
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
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.
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.
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.