Skip to content

Commit bb09c25

Browse files
ndg63276Mark Williams
andauthored
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 <mark.williams@diamond.ac.uk>
1 parent ad33811 commit bb09c25

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

api/src/Page/Shipment.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/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'})

0 commit comments

Comments
 (0)