diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 1b3e9822106..ee8951864c0 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -105,7 +105,7 @@ class html_cerfafr extends ModeleDon else { $donref = dol_sanitizeFileName($don->ref); - $dir = $conf->don->dir_output . "/" . get_exdir($donref,2,0,1,$don,'donation') . "/" . dol_sanitizeFileName($don->ref); + $dir = $conf->don->dir_output . "/" . $donref; $file = $dir . "/" . $donref . ".html"; } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 323f36bd609..b56171b8796 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -229,6 +229,25 @@ if ($action == 'set_paid') setEventMessage($object->error, 'errors'); } } +// Remove file in doc form +if ($action == 'remove_file') +{ + $object = new Don($db, 0, $_GET['id']); + if ($object->fetch($id)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $object->fetch_thirdparty(); + + $langs->load("other"); + $upload_dir = $conf->don->dir_output; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file,0,0,0,$object); + if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); + else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); + $action=''; + } +} /* * Build doc @@ -743,13 +762,11 @@ if (! empty($id) && $action != 'edit') /* * Documents generes */ - $filename=dol_sanitizeFileName($object->id); - $filedir=$conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER['PHP_SELF'].'?rowid='.$object->id; - // $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer); - // $delallowed=$user->rights->facture->supprimer; - $genallowed=1; - $delallowed=0; + $filename = dol_sanitizeFileName($object->id); + $filedir = $conf->don->dir_output . "/" . dol_sanitizeFileName($object->id); + $urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id; + $genallowed = ($object->statut == 2 && ($object->paid == 0 || $user->admin) && $user->rights->don->creer); + $delallowed = $user->rights->don->supprimer; $var=true; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 87534a6162f..b3b884cbd7e 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -695,7 +695,6 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> dol_fiche_head(''); print '
| ' . $langs->trans("VATRate") . ' | '; @@ -774,7 +773,6 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights-> } print ' |