Skip to content

Commit

Permalink
Update expenses.php
Browse files Browse the repository at this point in the history
Downloaded filename was hardcoded and assumed only ever PDF would be uploaded and downloads any jpg/png as a PDF filename. Fix takes into account the database filename and extension and updated iconography for more general file indication.
  • Loading branch information
ThaMunsta authored Sep 26, 2024
1 parent 0cd7e7a commit e3df5c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion expenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@
if (empty($expense_receipt)) {
$receipt_attached = "";
} else {
$receipt_attached = "<a class='text-secondary mr-2' target='_blank' href='uploads/expenses/$expense_receipt' download='$expense_date-$vendor_name-$category_name-$expense_id.pdf'><i class='fa fa-file-pdf'></i></a>";
$path_info = pathinfo($expense_receipt);
$ext = $path_info['extension'];
$receipt_attached = "<a class='text-secondary mr-2' target='_blank' href='uploads/expenses/$expense_receipt' download='$expense_date-$vendor_name-$category_name-$expense_id.$ext'><i class='fa fa-file'></i></a>";
}

?>
Expand Down

0 comments on commit e3df5c0

Please sign in to comment.