diff --git a/main/attendance/attendance_sheet.php b/main/attendance/attendance_sheet.php
index bf3086b1a7..f4b8690d4e 100755
--- a/main/attendance/attendance_sheet.php
+++ b/main/attendance/attendance_sheet.php
@@ -116,7 +116,7 @@ if (api_is_allowed_to_edit(null, true) ||
Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'';
$actionsLeft .= ''.
Display::return_icon('export_excel.png', get_lang('ExportToXls'), '', ICON_SIZE_MEDIUM).'';
- $actionsLeft .= ''.
+ $actionsLeft .= ''.
Display::return_icon('paint.png', get_lang('DownloadQr'), '', ICON_SIZE_MEDIUM).'';
$actionsRight = $form->returnForm();
$toolbar = Display::toolbarAction('toolbar-attendance', [$actionsLeft, $actionsRight]);
diff --git a/main/attendance/index.php b/main/attendance/index.php
index 9a7d39556f..c661783c15 100755
--- a/main/attendance/index.php
+++ b/main/attendance/index.php
@@ -272,14 +272,24 @@ if (isset($_POST['action']) && $_POST['action'] == 'attendance_set_visible_selec
switch ($action) {
case 'attendance_sheet_qrcode':
- header("Content-Type: image/png");
- header("Content-Disposition: attachment; filename=AttendanceSheetQRcode.png");
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+ header('Cache-Control: no-cache, must-revalidate');
+ header('Pragma: no-cache');
$renderer = new \BaconQrCode\Renderer\Image\Png();
$renderer->setHeight(256);
$renderer->setWidth(256);
$writer = new \BaconQrCode\Writer($renderer);
$attendanceSheetLink = api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=attendance_sheet_list_no_edit&attendance_id='.$attendance_id;
- echo $writer->writeString($attendanceSheetLink);
+ $filename = "attendanceqrcode".uniqid().".png";
+ if (!is_dir(api_get_path(SYS_UPLOAD_PATH).'attendance')) {
+ @mkdir(
+ api_get_path(SYS_UPLOAD_PATH).'attendance',
+ api_get_permissions_for_new_directories(),
+ true
+ );
+ }
+ $writer->writeFile($attendanceSheetLink,api_get_path(SYS_UPLOAD_PATH).'attendance/'.$filename);
+ echo '
';
exit;
case 'attendance_list':
$attendanceController->attendance_list();