Skip to content

Commit 067acb5

Browse files
authored
Merge pre-release/2026-R1.3 into master (#1035)
* LIMS-2068: Dont allow duplicate requests to shipping service (#1027) * LIMS-2041: Remove date-fns and date-fns-tz (#1020) * LIMS-2040: Fix bug creating more than one puck (#1019) * LIMS-2039: Change colour of dispensing position (#1026) * LIMS-2022: Don't hide shipment buttons (#1025)
1 parent ad33811 commit 067acb5

15 files changed

Lines changed: 75 additions & 67 deletions

File tree

api/src/Page.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,11 @@ function argOrNull($key)
649649
return $this->has_arg($key) ? $this->arg($key) : null;
650650
}
651651

652+
function argIfNotEmptyString($key)
653+
{
654+
return $this->has_arg($key) && $this->arg($key) !== '' ? $this->arg($key) : null;
655+
}
656+
652657
# ------------------------------------------------------------------------
653658
# Misc Helpers
654659

api/src/Page/Shipment.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,8 +2607,8 @@ function _add_container()
26072607
$tem = $this->has_arg('STORAGETEMPERATURE') ? $this->arg('STORAGETEMPERATURE') : null;
26082608

26092609
$crid = $this->has_arg('CONTAINERREGISTRYID') ? $this->arg('CONTAINERREGISTRYID') : null;
2610-
$pcid = $this->has_arg('PARENTCONTAINERID') ? $this->arg('PARENTCONTAINERID') : null;
2611-
$pcl = $this->has_arg('PARENTCONTAINERLOCATION') ? $this->arg('PARENTCONTAINERLOCATION') : null;
2610+
$pcid = $this->argIfNotEmptyString('PARENTCONTAINERID');
2611+
$pcl = $this->argIfNotEmptyString('PARENTCONTAINERLOCATION');
26122612

26132613
$pipeline = $this->has_arg('PROCESSINGPIPELINEID') ? $this->arg('PROCESSINGPIPELINEID') : null;
26142614
$source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null;
@@ -2640,7 +2640,7 @@ function _add_container()
26402640
if ($e->getCode() == 1062) {
26412641
$this->_error('Barcode is not unique. Please enter a different barcode.', 409);
26422642
} else {
2643-
$this->_error('An unexpected error occurred.', 500);
2643+
$this->_error('An unexpected error occurred: ' . $e->getMessage(), 500);
26442644
}
26452645
}
26462646
}
@@ -3451,6 +3451,10 @@ function _create_awb()
34513451
&& in_array($this->arg('COUNTRY'), $facility_courier_countries)
34523452
&& Utils::getValueOrDefault($use_shipping_service_redirect_incoming_shipments)
34533453
) {
3454+
if ($ship['EXTERNALSHIPPINGIDTOSYNCHROTRON']) {
3455+
$this->_error("Shipping service error: Booking already exists");
3456+
return;
3457+
}
34543458
try {
34553459
$this->_create_shipment_shipment_request($ship, $dewars);
34563460
$this->_output(array('EXTERNAL' => "1"));

client/package-lock.json

Lines changed: 3 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@
7070
"d3-scale": "^3.2.3",
7171
"d3-scale-chromatic": "^2.0.0",
7272
"d3-selection": "^2.0.0",
73-
"date-fns": "^2.16.1",
74-
"date-fns-tz": "^1.0.12",
7573
"flot-axislabels": "^1.0.0",
7674
"flot-pie": "^1.0.0",
7775
"font-awesome": "^4.2.0",

client/src/js/models/shipment.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ define(['backbone'], function (Backbone) {
1111
SHIPPINGNAME: {
1212
required: true,
1313
pattern: 'wwsdash',
14+
msg: 'The Shipment Name is required',
1415
},
1516

1617
'FCODES[]': {
1718
required: false,
1819
pattern: 'fcode',
1920
},
2021

22+
SAFETYLEVEL: {
23+
required: true,
24+
msg: 'The Safety Level field is required',
25+
},
26+
2127
DYNAMIC: {
2228
required: true,
29+
msg: 'The Scheduling field is required',
2330
},
2431

2532
FIRSTEXPERIMENTID: {
@@ -50,10 +57,11 @@ define(['backbone'], function (Backbone) {
5057

5158
SENDINGLABCONTACTID: {
5259
required: true,
60+
msg: 'The Outgoing Lab Contact field is required',
5361
},
5462

5563
RETURNLABCONTACTID: {
56-
required: true,
64+
required: false,
5765
},
5866

5967
DELIVERYAGENT_AGENTCODE: {

client/src/js/modules/imaging/views/imageviewer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,11 +1029,11 @@ define(['marionette',
10291029
if (options.o.get('DISPENSEX') && options.o.get('DISPENSEY')) {
10301030
var disx = parseInt(options.o.get('DISPENSEX'))
10311031
var disy = parseInt(options.o.get('DISPENSEY'))
1032-
this.ctx.strokeStyle = 'white'
1032+
this.ctx.strokeStyle = 'deeppink'
10331033
this.ctx.beginPath()
10341034
this.ctx.arc(disx, disy, 50, 0, 2*Math.PI)
10351035
this.ctx.stroke()
1036-
this.ctx.fillStyle = 'white'
1036+
this.ctx.fillStyle = 'deeppink'
10371037
this.ctx.fillText('D',disx-5*m, disy+5*m)
10381038
this.ctx.closePath()
10391039
}

client/src/js/modules/shipment/views/container.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ define(['marionette',
1919
'views/table',
2020

2121
'utils',
22-
'formatDate',
2322
'utils/editable',
2423
'templates/shipment/container.html'], function(Marionette,
2524
Backbone,
@@ -40,7 +39,7 @@ define(['marionette',
4039

4140
TableView,
4241

43-
utils, formatDate,
42+
utils,
4443
Editable, template){
4544

4645
return Marionette.LayoutView.extend({
@@ -186,7 +185,7 @@ define(['marionette',
186185
app.alert({ message: 'Container Successfully Queued' })
187186
self.model.set({
188187
CONTAINERQUEUEID: resp.CONTAINERQUEUEID,
189-
QUEUEDTIMESTAMP: formatDate.default(new Date(), 'dd-MM-yyyy HH:mm')
188+
QUEUEDTIMESTAMP: new Date().toLocaleString()
190189
})
191190
self.updateAutoCollection()
192191
self.sampletable.toggleAuto(true)

client/src/js/modules/shipment/views/createawb.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,14 @@ define(['backbone',
468468
return
469469
}
470470

471+
const ss_url = app.options.get("shipping_service_app_url_incoming")
472+
const externalid = this.shipment.get('EXTERNALSHIPPINGIDTOSYNCHROTRON')
473+
if (externalid && ss_url) {
474+
const link = ss_url+'/shipment-requests/'+externalid+'/incoming'
475+
window.location.assign(link)
476+
return
477+
}
478+
471479
var prod = null
472480
if (
473481
(
@@ -510,7 +518,7 @@ define(['backbone',
510518
},
511519
success: function(resp) {
512520
if (
513-
app.options.get("shipping_service_app_url_incoming")
521+
ss_url
514522
&& (Number(self.terms.get('ACCEPTED')) === 1) // terms.ACCEPTED could be undefined, 1, or "1"
515523
&& app.options.get("facility_courier_countries").includes(country)
516524
) {
@@ -521,9 +529,7 @@ define(['backbone',
521529
app.alert({message: "Error performing redirect: external shipping id is null"})
522530
return;
523531
}
524-
window.location.assign(
525-
`${app.options.get("shipping_service_app_url")}/shipment-requests/${external_id}/incoming`
526-
)
532+
window.location.assign(`${ss_url}/shipment-requests/${external_id}/incoming`)
527533
})
528534
} else {
529535
app.message({ message: 'Air Waybill Successfully Created'})

client/src/js/modules/shipment/views/dewarregistry.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ define(['marionette', 'backgrid',
66
'views/form',
77
'views/filter',
88
'views/table', 'utils/table',
9-
'formatDate',
109
'templates/shipment/dewarregistryadd.html',
1110
'templates/shipment/dewarregistry.html'],
1211
function(Marionette, Backgrid, DewarRegistry, DewarProposal,
1312
Proposals, LabContacts,
1413
FormView, FilterView,
15-
TableView, table, formatDate, addtemplate, template) {
14+
TableView, table, addtemplate, template) {
1615

1716
var ClickableRow = table.ClickableRow.extend({
1817
event: 'rdewar:show',
@@ -49,7 +48,7 @@ define(['marionette', 'backgrid',
4948
this.ui.fc.val('')
5049
this.ui.date.val('')
5150
this.ui.serial.val('')
52-
this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: formatDate.default(new Date(), 'yyyy-MM-dd HH:mm:ss') })
51+
this.model.set({ DEWARS: 0, REPORTS: 0, BLTIMESTAMP: new Date().toLocaleString('sv-SE') })
5352
this.trigger('model:saved', this.model)
5453
this.setupValidation()
5554
},

client/src/js/modules/shipment/views/shipment.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ define(['marionette',
4949
'click #add_dewar': 'addDewar',
5050
'click a.send': 'sendShipment',
5151
'click a.pdf': utils.signHandler,
52+
'click a.labels': 'printLabels',
53+
'click a.awb': 'createAWB',
5254
'click a.cancel_pickup': 'cancelPickup',
5355
'click a.ready': 'markAsReady',
5456
},
@@ -61,7 +63,6 @@ define(['marionette',
6163
sent: '.sent',
6264
booking: '.booking',
6365
dhlmessage: '.dhlmessage',
64-
buttons: '.buttons',
6566
},
6667

6768

@@ -102,13 +103,31 @@ define(['marionette',
102103
})
103104
},
104105

106+
printLabels: function(e) {
107+
e.preventDefault()
108+
const errors = this.model.validate(this.model.attributes)
109+
if (errors) {
110+
app.alert({ message: 'Cannot print labels: ' + Object.values(errors)[0] })
111+
} else {
112+
utils.signHandler(e)
113+
}
114+
},
115+
116+
createAWB: function(e) {
117+
const errors = this.model.validate(this.model.attributes)
118+
if (errors) {
119+
e.preventDefault()
120+
app.alert({ message: 'Cannot create air waybill: ' + Object.values(errors)[0] })
121+
}
122+
},
123+
105124
sendShipment: function(e) {
106125
e.preventDefault()
107126
var self = this
108127
Backbone.ajax({
109128
url: app.apiurl+'/shipment/send/'+this.model.get('SHIPPINGID'),
110129
success: function() {
111-
self.model.set({ SHIPPINGSTATUS: 'send to DLS' })
130+
self.model.set({ SHIPPINGSTATUS: 'sent to facility' })
112131
app.alert({ className: 'message notify', message: 'Shipment successfully marked as sent' })
113132
self.render()
114133
},
@@ -209,11 +228,6 @@ define(['marionette',
209228
},
210229

211230
showButtons: function() {
212-
if (this.model.get('LCOUT') && this.model.get('SAFETYLEVEL')) {
213-
this.ui.buttons.show()
214-
} else {
215-
this.ui.buttons.hide()
216-
}
217231
const status = this.model.get('SHIPPINGSTATUS')
218232
const proc = this.model.get('PROCESSING')
219233
if ((status === 'opened' || status === 'awb created' || status === 'pickup booked') && proc == 0) {
@@ -242,7 +256,7 @@ define(['marionette',
242256
this.ui.booking.html('<a class="button" href="#"><i class="fa fa-credit-card"></i> Create Air Waybill - Disabled</a>')
243257
} else if (externalid && ss_url) {
244258
const link = ss_url+'/shipment-requests/'+externalid+'/incoming'
245-
this.ui.booking.html('<a class="button shipping-service" href="'+link+'"><i class="fa fa-print"></i> Manage shipment booking</a>')
259+
this.ui.booking.html('<a class="button shipping-service" href="'+link+'"><i class="fa fa-print"></i> Manage Shipment Booking</a>')
246260
} else {
247261
this.ui.booking.html('<a class="button awb" href="/shipments/awb/sid/'+shippingid+'"><i class="fa fa-credit-card"></i> Create DHL Air Waybill</a>')
248262
}
@@ -257,13 +271,12 @@ define(['marionette',
257271
const safetylevel = this.model.get('SAFETYLEVEL')
258272
const country = this.model.get('COUNTRY')
259273
const courier = this.model.get('DELIVERYAGENT_AGENTNAME')
260-
const lcout = this.model.get('LCOUT')
261274
const fac_country_nde = app.options.get('facility_courier_countries_nde')
262275
const fac_country_link = app.options.get('facility_courier_countries_link')
263276
const fac_country = app.options.get('facility_courier_countries')
264-
if (!lcout || !safetylevel) {
265-
this.ui.dhlmessage.html('<p class="message notify">Set an Outgoing Lab Contact and Safety Level in order to manage shipping.</p>')
266-
} else if (label == '1') {
277+
const ss_url = app.options.get("shipping_service_app_url_incoming")
278+
const externalid = this.model.get('EXTERNALSHIPPINGIDTOSYNCHROTRON')
279+
if (label == '1') {
267280
this.ui.dhlmessage.html('<p class="message notify">You can print your Air Waybill by clicking &quot;Print Air Waybill&quot; below.</p>')
268281
} else if (safetylevel && safetylevel == "Red") {
269282
this.ui.dhlmessage.html('<p class="message alert">Shipping of red samples is not available through this application.</p>')
@@ -273,6 +286,8 @@ define(['marionette',
273286
this.ui.dhlmessage.html('<p class="message alert">International shipping is not available through this application. If you&apos;re arranging your own shipping, enter your tracking numbers below after booking and include printed return labels in the dewar case.</p>')
274287
} else if (courier && courier.toLowerCase().trim() != 'dhl') {
275288
this.ui.dhlmessage.html('<p class="message alert">Shipping through this application is only available using DHL.</p>')
289+
} else if (externalid && ss_url) {
290+
this.ui.dhlmessage.html('<p class="message notify">You can now manage your shipment with DHL using &quot;Manage Shipment Booking&quot; below.</p>')
276291
} else {
277292
this.ui.dhlmessage.html('<p class="message notify">You can now book your shipment with DHL using &quot;Create Air Waybill&quot; below.</p>')
278293
}

0 commit comments

Comments
 (0)