Skip to content

Commit

Permalink
LIMS-932: Send proposal when creating shipments in shipping service (#…
Browse files Browse the repository at this point in the history
…646)

* LIMS-932: Send proposal when creating shipments in shipping service

* Use proposal from db query rather than args

---------

Co-authored-by: John Holt <John.Holt@diamond.ac.uk>
  • Loading branch information
MattPrit and John Holt authored Aug 21, 2023
1 parent 2da5639 commit e01bf45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ function _dispatch_dewar_in_shipping_service($dispatch_info, $dewar)

try {
if ($create === true) {
$shipment_data["proposal"] = $dewar["PROPOSAL"];
$response = $this->shipping_service->create_shipment($shipment_data);
} else {
$this->shipping_service->update_shipment($dispatch_info['DEWARID'], $shipment_data, ShippingService::JOURNEY_FROM_FACILITY);
Expand Down Expand Up @@ -1006,7 +1007,7 @@ function _dispatch_dewar()
}

$dew = $this->db->pq(
"SELECT d.dewarid, d.barcode, d.storagelocation, d.dewarstatus, s.shippingid
"SELECT d.dewarid, d.barcode, d.storagelocation, d.dewarstatus, s.shippingid, CONCAT(p.proposalcode, p.proposalnumber) as proposal
FROM dewar d
INNER JOIN shipping s ON s.shippingid = d.shippingid
INNER JOIN proposal p ON p.proposalid = s.proposalid
Expand Down Expand Up @@ -2679,9 +2680,10 @@ function($dewar) {return array("external_id" => $dewar["DEWARID"]);},
array_map(function($key) use ($user_shipment_role) {return $user_shipment_role."_".$key;},
array_keys($contact)),
$contact);
$shipment_data = array_merge($response, $shipment_data, $relabelled_contact);
$this->shipping_service->update_shipment($shipment["SHIPPINGID"], $shipment_data, ShippingService::JOURNEY_TO_FACILITY);
$shipment_update_data = array_merge($response, $shipment_data, $relabelled_contact);
$this->shipping_service->update_shipment($shipment["SHIPPINGID"], $shipment_update_data, ShippingService::JOURNEY_TO_FACILITY);
} catch (\Exception $e) {
$shipment_data["proposal"] = $shipment["PROP"];
$shipment_data["contact"] = $contact;
$response = $this->shipping_service->create_shipment_by_journey_type($shipment_data, $journey_type);
}
Expand Down

0 comments on commit e01bf45

Please sign in to comment.