Browse Source

Merge pull request #23780 from rycks/13_fix_update_public_note_error_when_document_model_not_found

13 fix update public note error when document model not found
Laurent Destailleur 2 years ago
parent
commit
ffc9ab300b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      htdocs/core/actions_setnotes.inc.php

+ 6 - 1
htdocs/core/actions_setnotes.inc.php

@@ -60,7 +60,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, 'warnings');
+			}
 
 			if ($result < 0) {
 				dol_print_error($db, $result);