dolibarr  16.0.5
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 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31 
32 $action = GETPOST('action', 'aZ09');
33 
34 $langs->load("companies");
35 
36 $id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int');
37 
38 $object = new Societe($db);
39 if ($id > 0) {
40  $object->fetch($id);
41 }
42 
43 $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
44 
45 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
46 $hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
47 
48 // Security check
49 if ($user->socid > 0) {
50  unset($action);
51  $socid = $user->socid;
52 }
53 $result = restrictedArea($user, 'societe', $object->id, '&societe');
54 
55 
56 /*
57  * Actions
58  */
59 $reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
60 if ($reshook < 0) {
61  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
62 }
63 if (empty($reshook)) {
64  include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
65 }
66 
67 
68 /*
69  * View
70  */
71 
72 $form = new Form($db);
73 
74 $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
75 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
76  $title = $object->name.' - '.$langs->trans("Notes");
77 }
78 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
79 llxHeader('', $title, $help_url);
80 
81 if ($object->id > 0) {
82  /*
83  * Affichage onglets
84  */
85  if (!empty($conf->notification->enabled)) {
86  $langs->load("mails");
87  }
88 
89  $head = societe_prepare_head($object);
90 
91  print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
92 
93  $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
94 
95  dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
96 
97  $cssclass = 'titlefield';
98  //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
99  //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
100 
101  print '<div class="fichecenter">';
102 
103  print '<div class="underbanner clearboth"></div>';
104  print '<table class="border centpercent tableforfield">';
105 
106  // Type Prospect/Customer/Supplier
107  print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
108  print $object->getTypeUrl(1);
109  print '</td></tr>';
110 
111  if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
112  print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
113  }
114 
115  if ($object->client) {
116  print '<tr><td class="'.$cssclass.'">';
117  print $langs->trans('CustomerCode').'</td><td colspan="3">';
118  print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
119  $tmpcheck = $object->check_codeclient();
120  if ($tmpcheck != 0 && $tmpcheck != -5) {
121  print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
122  }
123  print '</td></tr>';
124  }
125 
126  if ($object->fournisseur) {
127  print '<tr><td class="'.$cssclass.'">';
128  print $langs->trans('SupplierCode').'</td><td colspan="3">';
129  print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
130  $tmpcheck = $object->check_codefournisseur();
131  if ($tmpcheck != 0 && $tmpcheck != -5) {
132  print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
133  }
134  print '</td></tr>';
135  }
136 
137  print "</table>";
138 
139  print '</div>';
140 
141  //print '<br>';
142 
143  //print '<div class="underbanner clearboth"></div>';
144  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
145 
146  print dol_get_fiche_end();
147 } else {
148  $langs->load("errors");
149  print $langs->trans("ErrorRecordNotFound");
150 }
151 
152 // End of page
153 llxFooter();
154 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
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
showValueWithClipboardCPButton
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
Definition: functions.lib.php:11087
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
societe_prepare_head
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
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
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
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