dolibarr  16.0.5
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 require '../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
31 
32 $action = GETPOST('action', 'aZ09');
33 
34 // Load translation files required by the page
35 $langs->load("companies");
36 
37 $id = GETPOST('id', 'int');
38 
39 $object = new Contact($db);
40 if ($id > 0) {
41  $object->fetch($id);
42 }
43 
44 // Security check
45 if ($user->socid > 0) {
46  if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
48  }
49 }
50 $result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
51 
52 
53 $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
54 
55 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
56 // $hookmanager->initHooks(array('contactcard')); -> Name conflict with product/card.php
57 $hookmanager->initHooks(array('contactnote'));
58 
59 
60 /*
61  * Actions
62  */
63 $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
64 if ($reshook < 0) {
65  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
66 }
67 if (empty($reshook)) {
68  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
69 }
70 
71 
72 /*
73  * View
74  */
75 
76 $now = dol_now();
77 
78 $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
79 
80 $form = new Form($db);
81 
82 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
83 llxHeader('', $title, $help_url);
84 
85 if ($id > 0) {
86  /*
87  * Affichage onglets
88  */
89  if (!empty($conf->notification->enabled)) {
90  $langs->load("mails");
91  }
92 
93  $head = contact_prepare_head($object);
94 
95  print dol_get_fiche_head($head, 'note', $title, -1, 'contact');
96 
97  $linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
98 
99  $morehtmlref = '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$object->id.'" class="refid">';
100  $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
101  $morehtmlref .= '</a>';
102 
103  $morehtmlref .= '<div class="refidno">';
104  if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
105  $objsoc = new Societe($db);
106  $objsoc->fetch($object->socid);
107  // Thirdparty
108  $morehtmlref .= $langs->trans('ThirdParty').' : ';
109  if ($objsoc->id > 0) {
110  $morehtmlref .= $objsoc->getNomUrl(1);
111  } else {
112  $morehtmlref .= $langs->trans("ContactNotLinkedToCompany");
113  }
114  }
115  $morehtmlref .= '</div>';
116 
117  dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
118 
119  $cssclass = 'titlefield';
120  //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
121  //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
122 
123  print '<div class="fichecenter">';
124  print '<div class="underbanner clearboth"></div>';
125 
126  print '<table class="border centpercent tableforfield">';
127 
128  // Civility
129  print '<tr><td class="'.$cssclass.'">'.$langs->trans("UserTitle").'</td><td>';
130  print $object->getCivilityLabel();
131  print '</td></tr>';
132 
133  print "</table>";
134 
135 
136  $cssclass = "titlefield";
137  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
138 
139  print '</div>';
140 
141  print dol_get_fiche_end();
142 }
143 
144 llxFooter();
145 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dol_banner_tab
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.
Definition: functions.lib.php:2046
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
Contact
Class to manage contact/addresses.
Definition: contact.class.php:40
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
contact_prepare_head
contact_prepare_head(Contact $object)
Prepare array with list of tabs.
Definition: contact.lib.php:33
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59