Skip to content

Commit d10c549

Browse files
ndg63276Mark Williams
andauthored
LIMS-2040: Fix bug creating more than one puck (#1019)
Co-authored-by: Mark Williams <mark.williams@diamond.ac.uk>
1 parent 589f454 commit d10c549

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

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: 3 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
}

client/src/js/modules/types/mx/shipment/views/mx-container-add.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ export default {
751751
this.NAME = ''
752752
this.BARCODE = ''
753753
this.CONTAINERREGISTRYID = ''
754-
this.PARENTCONTAINERID = ''
755-
this.PARENTCONTAINERLOCATION = ''
754+
this.PARENTCONTAINERID = null
755+
this.PARENTCONTAINERLOCATION = null
756756
// Trigger default setting of UDC fields if selected
757757
this.selectQueueForUDC(this.AUTOMATED)
758758

0 commit comments

Comments
 (0)