Do not make new twice

This commit is contained in:
Laurent Destailleur 2021-04-13 16:18:18 +02:00
parent 91b8ccafbb
commit d09be1f86f

View File

@ -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),