From e04cd242b01479feb1b2e64608a39d7c99fff347 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 4 Feb 2023 17:12:09 +0100 Subject: [PATCH 1/2] fix #21072: error message if deocument model not found --- htdocs/core/actions_setnotes.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index b9dd4194268..79ab36e1486 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -54,7 +54,12 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', $hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); $hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); - $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + //see #21072: Update a public note with a "document model not found" is not really a problem : the PDF is not created/updated + //but the note is saved, so just add a notification will be enought + $resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($resultGenDoc < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } if ($result < 0) dol_print_error($db, $result); } From 1aaec5325fce3eaf36a496087543d543b6d7672c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Sat, 4 Feb 2023 17:21:13 +0100 Subject: [PATCH 2/2] warnings is better than error --- htdocs/core/actions_setnotes.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index 79ab36e1486..5d61c49d85f 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -58,7 +58,7 @@ if ($action == 'setnote_public' && !empty($permissionnote) && !GETPOST('cancel', //but the note is saved, so just add a notification will be enought $resultGenDoc = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($resultGenDoc < 0) { - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'warnings'); } if ($result < 0) dol_print_error($db, $result);