dolibarr 21.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) 2024 Alexandre Spangaro <alexandre@inovea-conseil.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
30// Load Dolibarr environment
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
34
43// Load translation files required by the page
44$langs->load("companies");
45
46$action = GETPOST('action', 'aZ09');
47
48$id = GETPOSTINT('id');
49
50$object = new Contact($db);
51if ($id > 0) {
52 $object->fetch($id);
53}
54
55// Security check
56if ($user->socid > 0) {
57 if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
59 }
60}
61
62// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
63$hookmanager->initHooks(array('contactnote'));
64
65$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
66
67$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
68
69/*
70 * Actions
71 */
72
73$parameters = array();
74$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
75if ($reshook < 0) {
76 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
77}
78if (empty($reshook)) {
79 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
80}
81
82
83/*
84 * View
85 */
86
87$now = dol_now();
88
89$title = $langs->trans("ContactNotes");
90
91$form = new Form($db);
92
93$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
94
95llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-societe page-contact-card_note');
96
97if ($id > 0) {
98 /*
99 * Show tabs
100 */
101 if (isModEnabled('notification')) {
102 $langs->load("mails");
103 }
104
105 $head = contact_prepare_head($object);
106
107 print dol_get_fiche_head($head, 'note', $title, -1, 'contact');
108
109 $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
110
111 $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
112 $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
113 $morehtmlref .= '</a>';
114
115 $morehtmlref .= '<div class="refidno">';
116 if (!getDolGlobalString('SOCIETE_DISABLE_CONTACTS')) {
117 $objsoc = new Societe($db);
118 $objsoc->fetch($object->socid);
119 // Thirdparty
120 if ($objsoc->id > 0) {
121 $morehtmlref .= $objsoc->getNomUrl(1);
122 } else {
123 $morehtmlref .= '<span class="opacitymedium">'.$langs->trans("ContactNotLinkedToCompany").'</span>';
124 }
125 }
126 $morehtmlref .= '</div>';
127
128 dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
129
130 $cssclass = 'titlefield';
131 //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
132 //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
133
134 print '<div class="fichecenter">';
135 print '<div class="underbanner clearboth"></div>';
136
137 print '<table class="border centpercent tableforfield">';
138
139 // Civility
140 print '<tr><td class="'.$cssclass.'">'.$langs->trans("UserTitle").'</td><td>';
141 print $object->getCivilityLabel();
142 print '</td></tr>';
143
144 print "</table>";
145
146
147 $cssclass = "titlefield";
148 include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
149
150 print '</div>';
151
152 print dol_get_fiche_end();
153}
154
155llxFooter();
156$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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:71
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.
llxFooter()
Footer empty.
Definition document.php:107
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.
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.
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.