dolibarr  13.0.2
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 // Security check
37 $id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int');
38 if ($user->socid) $id = $user->socid;
39 $result = restrictedArea($user, 'societe', $id, '&societe');
40 
41 $object = new Societe($db);
42 if ($id > 0) $object->fetch($id);
43 
44 $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
45 
46 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
47 $hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
48 
49 
50 /*
51  * Actions
52  */
53 
54 include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
55 
56 
57 /*
58  * View
59  */
60 
61 $form = new Form($db);
62 
63 $title = $langs->trans("ThirdParty").' - '.$langs->trans("Notes");
64 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name.' - '.$langs->trans("Notes");
65 $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
66 llxHeader('', $title, $help_url);
67 
68 if ($object->id > 0)
69 {
70  /*
71  * Affichage onglets
72  */
73  if (!empty($conf->notification->enabled)) $langs->load("mails");
74 
75  $head = societe_prepare_head($object);
76 
77  print dol_get_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company');
78 
79  $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
80 
81  dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
82 
83  $cssclass = 'titlefield';
84  //if ($action == 'editnote_public') $cssclass='titlefieldcreate';
85  //if ($action == 'editnote_private') $cssclass='titlefieldcreate';
86 
87  print '<div class="fichecenter">';
88 
89  print '<div class="underbanner clearboth"></div>';
90  print '<table class="border centpercent tableforfield">';
91 
92  if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
93  {
94  print '<tr><td class="'.$cssclass.'">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
95  }
96 
97  if ($object->client) {
98  print '<tr><td class="'.$cssclass.'">';
99  print $langs->trans('CustomerCode').'</td><td colspan="3">';
100  print $object->code_client;
101  $tmpcheck = $object->check_codeclient();
102  if ($tmpcheck != 0 && $tmpcheck != -5) {
103  print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
104  }
105  print '</td></tr>';
106  }
107 
108  if ($object->fournisseur) {
109  print '<tr><td class="'.$cssclass.'">';
110  print $langs->trans('SupplierCode').'</td><td colspan="3">';
111  print $object->code_fournisseur;
112  $tmpcheck = $object->check_codefournisseur();
113  if ($tmpcheck != 0 && $tmpcheck != -5) {
114  print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
115  }
116  print '</td></tr>';
117  }
118 
119  print "</table>";
120 
121  print '</div>';
122 
123  //print '<br>';
124 
125  //print '<div class="underbanner clearboth"></div>';
126  include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
127 
129 } else {
130  $langs->load("errors");
131  print $langs->trans("ErrorRecordNotFound");
132 }
133 
134 // End of page
135 llxFooter();
136 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage generation of HTML components Only common components must be here.
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59