From bb09c25ba056650510abe78e52aa898ae2bdcff2 Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Tue, 3 Feb 2026 09:53:40 +0000 Subject: [PATCH 1/5] LIMS-2068: Dont allow duplicate requests to shipping service (#1027) * LIMS-2068: Dont allow duplicate requests to shipping service * LIMS-2068: Reuse ss_url variable --------- Co-authored-by: Mark Williams --- api/src/Page/Shipment.php | 4 ++++ client/src/js/modules/shipment/views/createawb.js | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/api/src/Page/Shipment.php b/api/src/Page/Shipment.php index 0019c1e77..e1021ac38 100644 --- a/api/src/Page/Shipment.php +++ b/api/src/Page/Shipment.php @@ -3451,6 +3451,10 @@ function _create_awb() && in_array($this->arg('COUNTRY'), $facility_courier_countries) && Utils::getValueOrDefault($use_shipping_service_redirect_incoming_shipments) ) { + if ($ship['EXTERNALSHIPPINGIDTOSYNCHROTRON']) { + $this->_error("Shipping service error: Booking already exists"); + return; + } try { $this->_create_shipment_shipment_request($ship, $dewars); $this->_output(array('EXTERNAL' => "1")); diff --git a/client/src/js/modules/shipment/views/createawb.js b/client/src/js/modules/shipment/views/createawb.js index 62b3e43b0..9d5373bb9 100644 --- a/client/src/js/modules/shipment/views/createawb.js +++ b/client/src/js/modules/shipment/views/createawb.js @@ -468,6 +468,14 @@ define(['backbone', return } + const ss_url = app.options.get("shipping_service_app_url_incoming") + const externalid = this.shipment.get('EXTERNALSHIPPINGIDTOSYNCHROTRON') + if (externalid && ss_url) { + const link = ss_url+'/shipment-requests/'+externalid+'/incoming' + window.location.assign(link) + return + } + var prod = null if ( ( @@ -510,7 +518,7 @@ define(['backbone', }, success: function(resp) { if ( - app.options.get("shipping_service_app_url_incoming") + ss_url && (Number(self.terms.get('ACCEPTED')) === 1) // terms.ACCEPTED could be undefined, 1, or "1" && app.options.get("facility_courier_countries").includes(country) ) { @@ -521,9 +529,7 @@ define(['backbone', app.alert({message: "Error performing redirect: external shipping id is null"}) return; } - window.location.assign( - `${app.options.get("shipping_service_app_url")}/shipment-requests/${external_id}/incoming` - ) + window.location.assign(`${ss_url}/shipment-requests/${external_id}/incoming`) }) } else { app.message({ message: 'Air Waybill Successfully Created'}) From 589f4545c99c59e501bf24325f3d811ac147b64a Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Tue, 3 Feb 2026 09:53:49 +0000 Subject: [PATCH 2/5] LIMS-2041: Remove date-fns and date-fns-tz (#1020) Co-authored-by: Mark Williams --- client/package-lock.json | 29 ++----------------- client/package.json | 2 -- .../js/modules/shipment/views/container.js | 5 ++-- .../modules/shipment/views/dewarregistry.js | 5 ++-- .../src/js/modules/stats/views/breakdown.js | 7 ++--- .../mx/shipment/views/mx-container-view.vue | 3 +- client/webpack.config.js | 1 - 7 files changed, 11 insertions(+), 41 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 3c41082c6..12a9e713e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -22,8 +22,6 @@ "d3-scale": "^3.2.3", "d3-scale-chromatic": "^2.0.0", "d3-selection": "^2.0.0", - "date-fns": "^2.16.1", - "date-fns-tz": "^1.0.12", "flot-axislabels": "^1.0.0", "flot-pie": "^1.0.0", "font-awesome": "^4.2.0", @@ -1741,6 +1739,7 @@ "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.5.tgz", "integrity": "sha512-ecjvYlnAaZ/KVneE/OdKYBYfgXV3Ptu6zQWmgEF7vwKhQnvVS6bjMD2XYgj+SNvQ1GfK/pjgokfPkC/2CO8CuA==", + "dev": true, "dependencies": { "regenerator-runtime": "^0.13.11" }, @@ -5815,29 +5814,6 @@ "node": ">=12" } }, - "node_modules/date-fns": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", - "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", - "dependencies": { - "@babel/runtime": "^7.21.0" - }, - "engines": { - "node": ">=0.11" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/date-fns" - } - }, - "node_modules/date-fns-tz": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/date-fns-tz/-/date-fns-tz-1.3.8.tgz", - "integrity": "sha512-qwNXUFtMHTTU6CFSFjoJ80W8Fzzp24LntbjFFBgL/faqds4e5mo9mftoRLgr3Vi1trISsg4awSpYVsOQCRnapQ==", - "peerDependencies": { - "date-fns": ">=2.0.0" - } - }, "node_modules/de-indent": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", @@ -14438,7 +14414,8 @@ "node_modules/regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "dev": true }, "node_modules/regenerator-transform": { "version": "0.15.1", diff --git a/client/package.json b/client/package.json index 4808d17de..befe08a72 100644 --- a/client/package.json +++ b/client/package.json @@ -70,8 +70,6 @@ "d3-scale": "^3.2.3", "d3-scale-chromatic": "^2.0.0", "d3-selection": "^2.0.0", - "date-fns": "^2.16.1", - "date-fns-tz": "^1.0.12", "flot-axislabels": "^1.0.0", "flot-pie": "^1.0.0", "font-awesome": "^4.2.0", diff --git a/client/src/js/modules/shipment/views/container.js b/client/src/js/modules/shipment/views/container.js index fc1031715..755e4a18a 100644 --- a/client/src/js/modules/shipment/views/container.js +++ b/client/src/js/modules/shipment/views/container.js @@ -19,7 +19,6 @@ define(['marionette', 'views/table', 'utils', - 'formatDate', 'utils/editable', 'templates/shipment/container.html'], function(Marionette, Backbone, @@ -40,7 +39,7 @@ define(['marionette', TableView, - utils, formatDate, + utils, Editable, template){ return Marionette.LayoutView.extend({ @@ -186,7 +185,7 @@ define(['marionette', app.alert({ message: 'Container Successfully Queued' }) self.model.set({ CONTAINERQUEUEID: resp.CONTAINERQUEUEID, - QUEUEDTIMESTAMP: formatDate.default(new Date(), 'dd-MM-yyyy HH:mm') + QUEUEDTIMESTAMP: new Date().toLocaleString() }) self.updateAutoCollection() self.sampletable.toggleAuto(true) diff --git a/client/src/js/modules/shipment/views/dewarregistry.js b/client/src/js/modules/shipment/views/dewarregistry.js index 806868bf1..e9ee0bd9a 100644 --- a/client/src/js/modules/shipment/views/dewarregistry.js +++ b/client/src/js/modules/shipment/views/dewarregistry.js @@ -6,13 +6,12 @@ define(['marionette', 'backgrid', 'views/form', 'views/filter', 'views/table', 'utils/table', - 'formatDate', 'templates/shipment/dewarregistryadd.html', 'templates/shipment/dewarregistry.html'], function(Marionette, Backgrid, DewarRegistry, DewarProposal, Proposals, LabContacts, FormView, FilterView, - TableView, table, formatDate, addtemplate, template) { + TableView, table, addtemplate, template) { var ClickableRow = table.ClickableRow.extend({ event: 'rdewar:show', @@ -49,7 +48,7 @@ define(['marionette', 'backgrid', this.ui.fc.val('') this.ui.date.val('') this.ui.serial.val('') - this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: formatDate.default(new Date(), 'yyyy-MM-dd HH:mm:ss') }) + this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: new Date().toLocaleString('sv-SE') }) this.trigger('model:saved', this.model) this.setupValidation() }, diff --git a/client/src/js/modules/stats/views/breakdown.js b/client/src/js/modules/stats/views/breakdown.js index 4a29a2f5d..dc2e055b5 100644 --- a/client/src/js/modules/stats/views/breakdown.js +++ b/client/src/js/modules/stats/views/breakdown.js @@ -1,12 +1,11 @@ define(['marionette', 'templates/stats/breakdown.html', 'utils', - 'formatDate', 'jquery', 'jquery.flot', 'jquery.flot.time', 'jquery.flot.selection', 'jquery.flot.tooltip', - ], function(Marionette, template, utils, formatDate, $) { + ], function(Marionette, template, utils, $) { return Marionette.ItemView.extend({ template: template, @@ -101,8 +100,8 @@ define(['marionette', 'templates/stats/breakdown.html', if (this.hideOverview) return var opts = this.main.getOptions() - var from = formatDate.default(opts.xaxes[0].min, 'MMMM do yyyy') - var to = formatDate.default(opts.xaxes[0].max, 'MMMM do yyyy') + var from = new Date(opts.xaxes[0].min).toLocaleDateString(); + var to = new Date(opts.xaxes[0].max).toLocaleDateString(); if (from != to) this.ui.span.text(from+' - '+to) else this.ui.span.text(from) diff --git a/client/src/js/modules/types/mx/shipment/views/mx-container-view.vue b/client/src/js/modules/types/mx/shipment/views/mx-container-view.vue index 9a24cd7fb..cf62bd2b5 100644 --- a/client/src/js/modules/types/mx/shipment/views/mx-container-view.vue +++ b/client/src/js/modules/types/mx/shipment/views/mx-container-view.vue @@ -288,7 +288,6 @@