Merge pull request #13525 from TobiasSekan/ConfirmDeleteOnFactureCard

NEW Confirm file delete on fracture card
This commit is contained in:
Laurent Destailleur 2020-04-08 14:53:19 +02:00 committed by GitHub
commit 3a024124e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 3 deletions

View File

@ -3983,6 +3983,20 @@ elseif ($id > 0 || !empty($ref))
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250);
}
if ($action == "remove_file_comfirm")
{
$file = GETPOST('file', 'alpha');
$formconfirm = $form->formconfirm(
$_SERVER["PHP_SELF"].'?facid='.$object->id.'&file='.$file,
$langs->trans('DeleteFileHeader'),
$langs->trans('DeleteFileText')."<br><br>".$file,
'remove_file',
'',
'no',
2);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid, 'remainingtopay' => &$resteapayer);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -5359,7 +5373,11 @@ elseif ($id > 0 || !empty($ref))
$genallowed = $usercanread;
$delallowed = $usercancreate;
print $formfile->showdocuments('facture', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
print $formfile->showdocuments(
'facture', $filename, $filedir, $urlsource, $genallowed,
$delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '',
$soc->default_lang, '', $object, 0, 'remove_file_comfirm');
$somethingshown = $formfile->numoffiles;
// Show links to link elements

View File

@ -331,9 +331,10 @@ class FormFile
* @param string $morepicto Add more HTML content into cell with picto
* @param Object $object Object when method is called from an object card.
* @param int $hideifempty Hide section of generated files if there is no file
* @param string $removeaction (optional) The action to remove a file
* @return string Output string with HTML array of documents (might be empty string)
*/
public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0)
public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0, $removeaction = 'remove_file')
{
// Deprecation warning
if (!empty($iconPDF)) {
@ -859,7 +860,7 @@ class FormFile
if ($delallowed)
{
$tmpurlsource = preg_replace('/#[a-zA-Z0-9_]*$/', '', $urlsource);
$out .= '<a href="'.$tmpurlsource.((strpos($tmpurlsource, '?') === false) ? '?' : '&amp;').'action=remove_file&amp;file='.urlencode($relativepath);
$out .= '<a href="'.$tmpurlsource.((strpos($tmpurlsource, '?') === false) ? '?' : '&amp;').'action='.$removeaction.'&amp;file='.urlencode($relativepath);
$out .= ($param ? '&amp;'.$param : '');
//$out.= '&modulepart='.$modulepart; // TODO obsolete ?
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?

View File

@ -1022,3 +1022,5 @@ SelectYourGraphOptionsFirst=Wählen Sie Ihre Diagrammoptionen aus, um ein Diagra
Measures=Maße
XAxis=X-Achse
YAxis=Y-Achse
DeleteFileHeader=Dateilöschung bestätigen
DeleteFileText=Möchten sie diese Datei wirklich löschen?

View File

@ -1026,3 +1026,5 @@ Measures=Measures
XAxis=X-Axis
YAxis=Y-Axis
StatusOfRefMustBe=Status of %s must be %s
DeleteFileHeader=Confirm file delete
DeleteFileText=Do you really want delete this file?