Skip to content

Commit

Permalink
LIMS-978: Use DewarRegistry_has_Proposal table (#651)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Williams <[email protected]>
  • Loading branch information
ndg63276 and Mark Williams authored Nov 8, 2023
1 parent 529a435 commit 89b4028
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/src/Page/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ function _dewar_registry()
$tot = $this->db->pq("SELECT count(r.facilitycode) as tot
FROM dewarregistry r
LEFT OUTER JOIN dewarregistry_has_proposal rhp ON r.dewarregistryid = rhp.dewarregistryid
LEFT OUTER JOIN proposal p ON p.proposalid = r.proposalid
LEFT OUTER JOIN proposal p ON p.proposalid = rhp.proposalid
WHERE $where", $args);
$tot = intval($tot[0]['TOT']);

Expand Down Expand Up @@ -672,7 +672,11 @@ function _update_dewar_registry()
if (!$this->has_arg('FACILITYCODE'))
$this->_error('No dewar code specified');

$dew = $this->db->pq("SELECT facilitycode FROM dewarregistry WHERE facilitycode LIKE :1 AND proposalid = :2", array($this->arg('FACILITYCODE'), $this->proposalid));
$dew = $this->db->pq("SELECT facilitycode FROM dewarregistry dr
INNER JOIN dewarregistry_has_proposal drhp ON dr.dewarregistryid = drhp.dewarregistryid
WHERE dr.facilitycode LIKE :1
AND drhp.proposalid = :2",
array($this->arg('FACILITYCODE'), $this->proposalid));

if (!sizeof($dew))
$this->_error('No such dewar');
Expand Down

0 comments on commit 89b4028

Please sign in to comment.