dolibarr 21.0.0-alpha
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 *
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
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
33
34$action = GETPOST('action', 'aZ09');
35
36// Load translation files required by the page
37$langs->load("companies");
38
39$id = GETPOSTINT('id');
40
41$object = new Contact($db);
42if ($id > 0) {
43 $object->fetch($id);
44}
45
46// Security check
47if ($user->socid > 0) {
48 if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
50 }
51}
52
53// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
54$hookmanager->initHooks(array('contactnote'));
55
56$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
57
58$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
59
60/*
61 * Actions
62 */
63
64$parameters = array();
65$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
66if ($reshook < 0) {
67 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
68}
69if (empty($reshook)) {
70 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
71}
72
73
74/*
75 * View
76 */
77
78$now = dol_now();
79
80$title = $langs->trans("ContactNotes");
81
82$form = new Form($db);
83
84$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
85
86llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-societe page-contact-card_note');
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 (!getDolGlobalString('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();
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
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: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.
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.