dolibarr 24.0.0-beta
notes.tpl.php
1<?php
2/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
3 * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
4 * Copyright (C) 2014-2020 Laurent Destailleur <eldy@destailleur.fr>
5 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
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 */
35// Protection to avoid direct call of template
36if (empty($object) || !is_object($object)) {
37 print "Error, template page can't be called as URL";
38 exit(1);
39}
40'
41@phan-var-force ?int<0,1> $permissionnote
42@phan-var-force string $moreparam
43@phan-var-force ?int $colwidth
44';
45
46// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
47// $cssclass must be defined by caller. For example $cssclass='fieldtitle'
48$module = $object->element;
49$note_public = 'note_public';
50$note_private = 'note_private';
51
52if ($module == "product") {
53 '@phan-var-force Product $object';
55 $module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
56}
57$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
58// Set $permission from the $permissionnote var defined on calling page
59$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : ($user->hasRight($module, 'create') ? $user->rights->$module->create : ($user->hasRight($module, 'creer') ? $user->rights->$module->creer : 0))));
60$moreparam = (isset($moreparam) ? $moreparam : '');
61$value_public = $object->note_public;
62$value_private = $object->note_private;
63if (getDolGlobalString('MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES')) {
64 $stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
65 if (GETPOST('action', 'aZ09') == 'edit'.$note_public) {
66 $value_public = dol_concatdesc($value_public, ($value_public ? "\n" : "")."-- ".$stringtoadd);
67 if (dol_textishtml($value_public)) {
68 $value_public .= "<br>\n";
69 } else {
70 $value_public .= "\n";
71 }
72 }
73}
74if (getDolGlobalString('MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES')) {
75 $stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
76 if (GETPOST('action', 'aZ09') == 'edit'.$note_private) {
77 $value_private = dol_concatdesc($value_private, ($value_private ? "\n" : "")."-- ".$stringtoadd);
78 if (dol_textishtml($value_private)) {
79 $value_private .= "<br>\n";
80 } else {
81 $value_private .= "\n";
82 }
83 }
84}
85
86// Special cases
87if ($module == 'propal') {
88 $permission = $user->hasRight("propal", "creer");
89} elseif ($module == 'supplier_proposal') {
90 $permission = $user->hasRight("supplier_proposal", "creer");
91} elseif ($module == 'fichinter') {
92 $permission = $user->hasRight("ficheinter", "creer");
93} elseif ($module == 'project') {
94 $permission = $user->hasRight("projet", "creer");
95} elseif ($module == 'project_task') {
96 $permission = $user->hasRight("projet", "creer");
97} elseif ($module == 'invoice_supplier') {
98 if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) {
99 $permission = $user->hasRight("fournisseur", "facture", "creer");
100 } else {
101 $permission = $user->hasRight("supplier_invoice", "creer");
102 }
103} elseif ($module == 'order_supplier') {
104 if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) {
105 $permission = $user->hasRight("fournisseur", "commande", "creer");
106 } else {
107 $permission = $user->hasRight("supplier_order", "creer");
108 }
109} elseif ($module == 'societe') {
110 $permission = $user->hasRight("societe", "creer");
111} elseif ($module == 'contact') {
112 $permission = $user->hasRight("societe", "creer");
113} elseif ($module == 'shipping') {
114 $permission = $user->hasRight("expedition", "creer");
115} elseif ($module == 'product') {
116 $permission = $user->hasRight("product", "creer");
117} elseif ($module == 'service') {
118 $permission = $user->hasRight("service", "creer");
119} elseif ($module == 'ecmfiles') {
120 $permission = $user->hasRight("ecm", "setup");
121} elseif ($module == 'user') {
122 $permission = $user->hasRight("user", "self", "write");
123}
124//else dol_print_error(null,'Bad value '.$module.' for param module');
125
126if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC')) {
127 $typeofdatapub = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
128} else {
129 $typeofdatapub = 'textarea:12:95%';
130}
131if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE')) {
132 $typeofdatapriv = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
133} else {
134 $typeofdatapriv = 'textarea:12:95%';
135}
136
137print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
138print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
139print '<div class="tagtr table-border-row">'."\n";
140$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public);
141print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
142print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, (string) $value_public, $object, $permission, $typeofdatapub, $moreparam, 0, 0);
143print '</div>'."\n";
144print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
145print $form->editfieldval("NotePublic", $note_public, (string) $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n";
146print '</div>'."\n";
147print '</div>'."\n";
148if (empty($user->socid)) {
149 // Private notes (always hidden to external users)
150 print '<div class="tagtr table-border-row">'."\n";
151 $editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private);
152 print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
153 print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, (string) $value_private, $object, $permission, $typeofdatapriv, $moreparam, 0, 0);
154 print '</div>'."\n";
155 print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
156 print $form->editfieldval("NotePrivate", $note_private, (string) $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1);
157 print '</div>'."\n";
158 print '</div>'."\n";
159}
160print '</div>'."\n";
161?>
162<!-- END PHP TEMPLATE NOTES-->
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
const TYPE_SERVICE
Service.
dol_now($mode='gmt')
Return date for now.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php