diff --git a/api/src/Page.php b/api/src/Page.php index a5ee4c334..efb2d1cbb 100644 --- a/api/src/Page.php +++ b/api/src/Page.php @@ -649,6 +649,11 @@ function argOrNull($key) return $this->has_arg($key) ? $this->arg($key) : null; } + function argIfNotEmptyString($key) + { + return $this->has_arg($key) && $this->arg($key) !== '' ? $this->arg($key) : null; + } + # ------------------------------------------------------------------------ # Misc Helpers diff --git a/api/src/Page/Shipment.php b/api/src/Page/Shipment.php index 0019c1e77..396c4b430 100644 --- a/api/src/Page/Shipment.php +++ b/api/src/Page/Shipment.php @@ -2607,8 +2607,8 @@ function _add_container() $tem = $this->has_arg('STORAGETEMPERATURE') ? $this->arg('STORAGETEMPERATURE') : null; $crid = $this->has_arg('CONTAINERREGISTRYID') ? $this->arg('CONTAINERREGISTRYID') : null; - $pcid = $this->has_arg('PARENTCONTAINERID') ? $this->arg('PARENTCONTAINERID') : null; - $pcl = $this->has_arg('PARENTCONTAINERLOCATION') ? $this->arg('PARENTCONTAINERLOCATION') : null; + $pcid = $this->argIfNotEmptyString('PARENTCONTAINERID'); + $pcl = $this->argIfNotEmptyString('PARENTCONTAINERLOCATION'); $pipeline = $this->has_arg('PROCESSINGPIPELINEID') ? $this->arg('PROCESSINGPIPELINEID') : null; $source = $this->has_arg('SOURCE') ? $this->arg('SOURCE') : null; @@ -2640,7 +2640,7 @@ function _add_container() if ($e->getCode() == 1062) { $this->_error('Barcode is not unique. Please enter a different barcode.', 409); } else { - $this->_error('An unexpected error occurred.', 500); + $this->_error('An unexpected error occurred: ' . $e->getMessage(), 500); } } } diff --git a/client/src/js/modules/types/mx/shipment/views/mx-container-add.vue b/client/src/js/modules/types/mx/shipment/views/mx-container-add.vue index 6c60d3878..c2875533a 100644 --- a/client/src/js/modules/types/mx/shipment/views/mx-container-add.vue +++ b/client/src/js/modules/types/mx/shipment/views/mx-container-add.vue @@ -751,8 +751,8 @@ export default { this.NAME = '' this.BARCODE = '' this.CONTAINERREGISTRYID = '' - this.PARENTCONTAINERID = '' - this.PARENTCONTAINERLOCATION = '' + this.PARENTCONTAINERID = null + this.PARENTCONTAINERLOCATION = null // Trigger default setting of UDC fields if selected this.selectQueueForUDC(this.AUTOMATED)