Merge pull request #23438 from leninrivas/patch-10

NEW constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT
This commit is contained in:
Laurent Destailleur 2023-01-13 23:22:04 +01:00 committed by GitHub
commit d1fb24bff7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
*
* 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
@ -1929,7 +1930,7 @@ if ($action == 'create') {
print '<tr class="field_note_public">';
print '<td class="titlefieldcreate tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td class="valuefieldcreate">';
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null));
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : (!empty($conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT) ? $conf->global->PROPALE_ADDON_NOTE_PUBLIC_DEFAULT : null)), 'restricthtml');
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);

View File

@ -16,6 +16,7 @@
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
*
* 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
@ -5740,15 +5741,16 @@ abstract class CommonObject
*
* @param string $fieldname Name of field
* @param string $alternatevalue Alternate value to use
* @param string $type Type of data
* @return string|string[] Default value (can be an array if the GETPOST return an array)
**/
public function getDefaultCreateValueFor($fieldname, $alternatevalue = null)
public function getDefaultCreateValueFor($fieldname, $alternatevalue = null, $type = 'alphanohtml')
{
global $conf, $_POST;
// If param here has been posted, we use this value first.
if (GETPOSTISSET($fieldname)) {
return GETPOST($fieldname, 'alphanohtml', 3);
return GETPOST($fieldname, $type, 3);
}
if (isset($alternatevalue)) {