2012-03-16 09:39:32 +01:00
|
|
|
<?php
|
2018-10-27 14:43:12 +02:00
|
|
|
/* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
2017-07-25 12:44:55 +02:00
|
|
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
2020-02-09 18:28:34 +01:00
|
|
|
* Copyright (C) 2014-2020 Laurent Destailleur <eldy@destailleur.fr>
|
2025-02-03 20:06:32 +01:00
|
|
|
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
2025-01-13 20:04:35 +01:00
|
|
|
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
2012-03-16 09:39:32 +01:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2012-03-16 09:39:32 +01:00
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2019-09-23 21:55:30 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2012-03-16 09:39:32 +01:00
|
|
|
*/
|
2024-11-04 23:53:20 +01:00
|
|
|
/**
|
2025-02-03 20:06:32 +01:00
|
|
|
* @var ?CommonObject $object
|
2024-11-04 23:53:20 +01:00
|
|
|
* @var Form $form
|
|
|
|
|
* @var Translate $langs
|
|
|
|
|
* @var User $user
|
|
|
|
|
*
|
2025-02-03 20:06:32 +01:00
|
|
|
* @var ?int<0,1> $permissionnote
|
|
|
|
|
* @var string $moreparam
|
|
|
|
|
* @var ?int $colwidth
|
2024-11-04 23:53:20 +01:00
|
|
|
* @var string $cssclass
|
|
|
|
|
*/
|
2017-12-21 13:32:16 +01:00
|
|
|
// Protection to avoid direct call of template
|
2019-11-13 19:37:08 +01:00
|
|
|
if (empty($object) || !is_object($object)) {
|
2017-12-21 13:32:16 +01:00
|
|
|
print "Error, template page can't be called as URL";
|
2024-03-16 23:08:15 +01:00
|
|
|
exit(1);
|
2017-12-21 13:32:16 +01:00
|
|
|
}
|
2025-01-13 20:04:35 +01:00
|
|
|
'
|
|
|
|
|
@phan-var-force ?int<0,1> $permissionnote
|
|
|
|
|
@phan-var-force string $moreparam
|
|
|
|
|
@phan-var-force ?int $colwidth
|
|
|
|
|
';
|
2017-12-21 13:32:16 +01:00
|
|
|
|
2017-09-29 17:43:32 +02:00
|
|
|
// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
|
2021-03-24 11:00:26 +01:00
|
|
|
// $cssclass must be defined by caller. For example $cssclass='fieldtitle'
|
2017-07-25 12:44:55 +02:00
|
|
|
$module = $object->element;
|
|
|
|
|
$note_public = 'note_public';
|
2013-04-09 17:18:07 +02:00
|
|
|
$note_private = 'note_private';
|
2012-03-18 02:01:23 +01:00
|
|
|
|
2022-10-26 11:38:07 +02:00
|
|
|
if ($module == "product") {
|
|
|
|
|
$module = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
|
|
|
|
}
|
2020-02-13 10:44:08 +01:00
|
|
|
$colwidth = (isset($colwidth) ? $colwidth : (empty($cssclass) ? '25' : ''));
|
2017-09-29 17:43:32 +02:00
|
|
|
// Set $permission from the $permissionnote var defined on calling page
|
2024-02-09 15:58:49 +01:00
|
|
|
$permission = (isset($permissionnote) ? $permissionnote : (isset($permission) ? $permission : ($user->hasRight($module, 'create') ? $user->rights->$module->create : ($user->hasRight($module, 'creer') ? $user->rights->$module->creer : 0))));
|
2020-02-13 10:44:08 +01:00
|
|
|
$moreparam = (isset($moreparam) ? $moreparam : '');
|
|
|
|
|
$value_public = $object->note_public;
|
|
|
|
|
$value_private = $object->note_private;
|
2023-11-27 11:39:32 +01:00
|
|
|
if (getDolGlobalString('MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES')) {
|
2020-02-13 10:44:08 +01:00
|
|
|
$stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
2021-02-23 22:03:23 +01:00
|
|
|
if (GETPOST('action', 'aZ09') == 'edit'.$note_public) {
|
2020-02-13 10:44:08 +01:00
|
|
|
$value_public = dol_concatdesc($value_public, ($value_public ? "\n" : "")."-- ".$stringtoadd);
|
2021-02-23 22:03:23 +01:00
|
|
|
if (dol_textishtml($value_public)) {
|
|
|
|
|
$value_public .= "<br>\n";
|
|
|
|
|
} else {
|
|
|
|
|
$value_public .= "\n";
|
|
|
|
|
}
|
2014-01-10 01:31:23 +01:00
|
|
|
}
|
2014-01-20 00:31:32 +01:00
|
|
|
}
|
2023-11-27 11:39:32 +01:00
|
|
|
if (getDolGlobalString('MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES')) {
|
2020-02-13 10:44:08 +01:00
|
|
|
$stringtoadd = dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
|
2021-02-23 22:03:23 +01:00
|
|
|
if (GETPOST('action', 'aZ09') == 'edit'.$note_private) {
|
2020-02-13 10:44:08 +01:00
|
|
|
$value_private = dol_concatdesc($value_private, ($value_private ? "\n" : "")."-- ".$stringtoadd);
|
2021-02-23 22:03:23 +01:00
|
|
|
if (dol_textishtml($value_private)) {
|
|
|
|
|
$value_private .= "<br>\n";
|
|
|
|
|
} else {
|
|
|
|
|
$value_private .= "\n";
|
|
|
|
|
}
|
2014-01-10 01:31:23 +01:00
|
|
|
}
|
|
|
|
|
}
|
2012-03-18 00:59:24 +01:00
|
|
|
|
|
|
|
|
// Special cases
|
2020-05-21 16:00:12 +02:00
|
|
|
if ($module == 'propal') {
|
2022-10-29 12:51:51 +02:00
|
|
|
$permission = $user->hasRight("propal", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'supplier_proposal') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("supplier_proposal", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'fichinter') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("ficheinter", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'project') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("projet", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'project_task') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("projet", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'invoice_supplier') {
|
2023-11-27 11:39:32 +01:00
|
|
|
if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("fournisseur", "facture", "creer");
|
2021-04-12 07:37:34 +02:00
|
|
|
} else {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("supplier_invoice", "creer");
|
2021-04-12 07:37:34 +02:00
|
|
|
}
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'order_supplier') {
|
2023-11-27 11:39:32 +01:00
|
|
|
if (!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("fournisseur", "commande", "creer");
|
2021-04-12 07:37:34 +02:00
|
|
|
} else {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("supplier_order", "creer");
|
2021-04-12 07:37:34 +02:00
|
|
|
}
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'societe') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("societe", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'contact') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("societe", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'shipping') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("expedition", "creer");
|
2020-05-21 16:00:12 +02:00
|
|
|
} elseif ($module == 'product') {
|
2022-11-17 10:55:46 +01:00
|
|
|
$permission = $user->hasRight("product", "creer");
|
2022-10-26 11:38:07 +02:00
|
|
|
} elseif ($module == 'service') {
|
|
|
|
|
$permission = $user->hasRight("service", "creer");
|
2020-11-24 18:54:59 +01:00
|
|
|
} elseif ($module == 'ecmfiles') {
|
2022-10-26 11:38:07 +02:00
|
|
|
$permission = $user->hasRight("ecm", "setup");
|
2022-09-03 11:07:47 +02:00
|
|
|
} elseif ($module == 'user') {
|
|
|
|
|
$permission = $user->hasRight("user", "self", "write");
|
2020-05-21 16:00:12 +02:00
|
|
|
}
|
2024-01-20 09:22:38 +01:00
|
|
|
//else dol_print_error(null,'Bad value '.$module.' for param module');
|
2012-03-16 09:39:32 +01:00
|
|
|
|
2023-11-27 11:39:32 +01:00
|
|
|
if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC')) {
|
2021-12-16 10:22:43 +01:00
|
|
|
$typeofdatapub = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
|
|
|
|
} else {
|
|
|
|
|
$typeofdatapub = 'textarea:12:95%';
|
|
|
|
|
}
|
2023-11-27 11:39:32 +01:00
|
|
|
if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE')) {
|
2021-12-16 10:22:43 +01:00
|
|
|
$typeofdatapriv = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
|
|
|
|
} else {
|
|
|
|
|
$typeofdatapriv = 'textarea:12:95%';
|
|
|
|
|
}
|
2014-08-14 17:27:28 +02:00
|
|
|
|
2017-06-26 23:06:24 +02:00
|
|
|
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
2019-03-29 16:18:47 +01:00
|
|
|
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
|
2020-08-02 17:09:21 +02:00
|
|
|
print '<div class="tagtr table-border-row">'."\n";
|
2020-11-18 16:23:08 +01:00
|
|
|
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public);
|
|
|
|
|
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
2025-01-13 20:04:35 +01:00
|
|
|
print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, 0, 0);
|
2020-08-02 17:09:21 +02:00
|
|
|
print '</div>'."\n";
|
2020-11-18 16:23:08 +01:00
|
|
|
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
|
2021-12-16 10:22:43 +01:00
|
|
|
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n";
|
2020-08-02 17:09:21 +02:00
|
|
|
print '</div>'."\n";
|
|
|
|
|
print '</div>'."\n";
|
2019-10-31 20:46:31 +01:00
|
|
|
if (empty($user->socid)) {
|
2020-02-09 18:28:34 +01:00
|
|
|
// Private notes (always hidden to external users)
|
2019-05-21 13:27:45 +02:00
|
|
|
print '<div class="tagtr table-border-row">'."\n";
|
2020-11-18 16:23:08 +01:00
|
|
|
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private);
|
|
|
|
|
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
2025-01-13 20:04:35 +01:00
|
|
|
print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, 0, 0);
|
2017-06-26 23:06:24 +02:00
|
|
|
print '</div>'."\n";
|
2020-11-18 16:23:08 +01:00
|
|
|
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
|
2021-12-16 10:22:43 +01:00
|
|
|
print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1);
|
2017-06-26 23:06:24 +02:00
|
|
|
print '</div>'."\n";
|
|
|
|
|
print '</div>'."\n";
|
2017-08-21 12:52:47 +02:00
|
|
|
}
|
2017-06-26 23:06:24 +02:00
|
|
|
print '</div>'."\n";
|
2012-03-16 09:39:32 +01:00
|
|
|
?>
|
2012-03-17 23:32:28 +01:00
|
|
|
<!-- END PHP TEMPLATE NOTES-->
|