From d09be1f86ff9f1a34fa1372768f7783aef5203b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 13 Apr 2021 16:18:18 +0200 Subject: [PATCH] Do not make new twice --- htdocs/core/tpl/document_actions_post_headers.tpl.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 0dc0962af56..4a43da6d6cc 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -76,9 +76,6 @@ if ($action == 'delete') { ); } -$formfile = new FormFile($db); - - // We define var to enable the feature to add prefix of uploaded files. // Caller of this include can make // $savingdocmask=dol_sanitizeFileName($object->ref).'-__file__'; @@ -115,6 +112,10 @@ if (!isset($savingdocmask) || !empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_ } } +if (!is_object($formfile)) { + $formfile = new FormFile($db); +} + // Show upload form (document and links) $formfile->form_attach_new_file( $_SERVER["PHP_SELF"].'?id='.$object->id.(empty($withproject) ? '' : '&withproject=1').(empty($moreparam) ? '' : $moreparam),