Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: fix jspdf versions from PR#7429 #7447

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,7 @@ assets:
script: jszip.min.js
jspdf:
basePath: '%assets_static_relative%/jspdf/dist/'
script: jspdf.min.js
jspdfdebug:
basePath: '%assets_static_relative%/jspdf/dist/'
script: jspdf.debug.js
script: jspdf.umd.min.js
jstiff:
basePath: '%assets_static_relative%/tiff/'
script: tiff.min.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ function getLayoutRes()
$form_city = '';
$form_postcode = '';
$form_countrycode = '';
$form_regdate = DateToYYYYMMDD(trim($_POST['regdate']));
$form_regdate = DateToYYYYMMDD(trim($_POST['regdate'] ?? ''));
newPatientData(
$_POST["db_id"],
$_POST["db_id"] ?? '',
$_POST["title"] ?? '',
$form_fname,
$form_lname,
Expand Down Expand Up @@ -160,16 +160,16 @@ function getLayoutUOR($form_id, $field_id)
$_POST = $data;
unset($data);
}
$form_pubpid = $_POST['pubpid'] ? trim($_POST['pubpid']) : '';
$form_title = $_POST['title'] ? trim($_POST['title']) : '';
$form_fname = $_POST['fname'] ? trim($_POST['fname']) : '';
$form_mname = $_POST['mname'] ? trim($_POST['mname']) : '';
$form_lname = $_POST['lname'] ? trim($_POST['lname']) : '';
$form_refsource = $_POST['refsource'] ? trim($_POST['refsource']) : '';
$form_sex = $_POST['sex'] ? trim($_POST['sex']) : '';
$form_refsource = $_POST['refsource'] ? trim($_POST['refsource']) : '';
$form_dob = $_POST['DOB'] ? trim($_POST['DOB']) : '';
$form_regdate = $_POST['regdate'] ? trim($_POST['regdate']) : date('Y-m-d');
$form_pubpid = $_POST['pubpid'] ?? '' ? trim($_POST['pubpid']) : '';
$form_title = $_POST['title'] ?? '' ? trim($_POST['title']) : '';
$form_fname = $_POST['fname'] ?? '' ? trim($_POST['fname']) : '';
$form_mname = $_POST['mname'] ?? '' ? trim($_POST['mname']) : '';
$form_lname = $_POST['lname'] ?? '' ? trim($_POST['lname']) : '';
$form_refsource = $_POST['refsource'] ?? '' ? trim($_POST['refsource']) : '';
$form_sex = $_POST['sex'] ?? '' ? trim($_POST['sex']) : '';
$form_refsource = $_POST['refsource'] ?? '' ? trim($_POST['refsource']) : '';
$form_dob = $_POST['DOB'] ?? '' ? trim($_POST['DOB']) : '';
$form_regdate = $_POST['regdate'] ?? '' ? trim($_POST['regdate']) : date('Y-m-d');

?>
<!DOCTYPE html>
Expand Down
10 changes: 7 additions & 3 deletions interface/modules/custom_modules/oe-module-faxsms/messageUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,21 @@ function showPrint(base64, _contentType = 'image/tiff') {

// Function to convert images to PDF and return a base64
async function convertImagesToPdf(images, filename = 'fax-tiff-to-pdf.pdf') {
const {jsPDF} = window.jspdf;
const doc = new jsPDF();
const pageHeight = doc.internal.pageSize.getHeight();
doc.internal.write.isEvalSupported = false;
const pageHeight = doc.internal.pageSize.height;
const pageWidth = doc.internal.pageSize.width;

for (let i = 0; i < images.length; i++) {
if (i !== 0) {
doc.addPage();
}
doc.addImage(images[i], 'JPEG', 10, 10, 190, pageHeight - 20);
doc.addImage(images[i], 'JPEG', 0, 0, pageWidth, pageHeight);
}

return doc.output('datauristring').split(',')[1]; // Return only the Base64 part
// Return the PDF as base64 string
return doc.output('datauristring').split(',')[1];
}

function showDocument(_base64, _contentType = 'image/tiff') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function forwardFax(): string

$content = $fax->FaxImage;
$c_header = $fax->DocumentParams->Type;
$ext = $c_header == 'application/pdf' ? 'pdf' : ($c_header == 'image/tiff' || $c_header == 'image/tif' ? 'tiff' : 'txt');
$ext = $c_header == 'application/pdf' ? '.pdf' : ($c_header == 'image/tiff' || $c_header == 'image/tif' ? '.tiff' : '.txt');
$filepath = $this->baseDir . "/send/" . ($jobId . $ext);

if (!file_exists($this->baseDir . '/send')) {
Expand Down Expand Up @@ -430,7 +430,7 @@ public function viewFax(): string
throw new Exception(sprintf('Directory "%s" was not created', $faxStoreDir));
}

$file_name = "{$faxStoreDir}/Fax_{$docId}." . ($c_header == 'application/pdf' ? 'pdf' : ($c_header == 'image/tiff' ? 'tiff' : 'txt'));
$file_name = "{$faxStoreDir}/Fax_{$docId}" . ($c_header == 'application/pdf' ? '.pdf' : ($c_header == 'image/tiff' ? '.tiff' : '.txt'));
file_put_contents($file_name, base64_decode($faxImage));
$this->setSession('where', $file_name);
$this->setFaxDeleted($apiResponse->JobId);
Expand Down
Loading
Loading