diff --git a/api/src/Page/Shipment.php b/api/src/Page/Shipment.php index 24fbeea13..8e8249016 100644 --- a/api/src/Page/Shipment.php +++ b/api/src/Page/Shipment.php @@ -1642,12 +1642,24 @@ function _get_dewars() $order = $cols[$this->arg('sort_by')] . ' ' . $dir; } - $dewars = $this->db->paginate("SELECT CONCAT(p.proposalcode, p.proposalnumber) as prop, CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number) as firstexperiment, r.labcontactid, se.beamlineoperator as localcontact, se.beamlinename, TO_CHAR(se.startdate, 'HH24:MI DD-MM-YYYY') as firstexperimentst, d.firstexperimentid, s.shippingid, s.shippingname, d.facilitycode, count(c.containerid) as ccount, (case when se.visit_number > 0 then (CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number)) else '' end) as exp, d.code, d.barcode, d.storagelocation, d.dewarstatus, d.dewarid, d.trackingnumbertosynchrotron, d.trackingnumberfromsynchrotron, d.externalShippingIdFromSynchrotron, s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers, s.sendinglabcontactid, s.returnlabcontactid, pe.givenname, pe.familyname, s.safetylevel as shippingsafetylevel - FROM dewar d - LEFT OUTER JOIN container c ON c.dewarid = d.dewarid - INNER JOIN shipping s ON d.shippingid = s.shippingid - INNER JOIN proposal p ON p.proposalid = s.proposalid - LEFT OUTER JOIN blsession se ON d.firstexperimentid = se.sessionid + $dewars = $this->db->paginate("SELECT + CONCAT(p.proposalcode, p.proposalnumber) as prop, + CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number) as firstexperiment, + CONCAT(p.proposalcode, p.proposalnumber, '-', se2.visit_number) as udcfirstexperiment, + r.labcontactid, se.beamlineoperator as localcontact, se.beamlinename, + TO_CHAR(se.startdate, 'HH24:MI DD-MM-YYYY') as firstexperimentst, d.firstexperimentid, + s.shippingid, s.shippingname, d.facilitycode, count(c.containerid) as ccount, + (case when se.visit_number > 0 then (CONCAT(p.proposalcode, p.proposalnumber, '-', se.visit_number)) else '' end) as exp, + d.code, d.barcode, d.storagelocation, d.dewarstatus, d.dewarid, + d.trackingnumbertosynchrotron, d.trackingnumberfromsynchrotron, d.externalShippingIdFromSynchrotron, + s.deliveryagent_agentname, d.weight, d.deliveryagent_barcode, GROUP_CONCAT(c.code SEPARATOR ', ') as containers, + s.sendinglabcontactid, s.returnlabcontactid, pe.givenname, pe.familyname, s.safetylevel as shippingsafetylevel + FROM dewar d + LEFT OUTER JOIN container c ON c.dewarid = d.dewarid + INNER JOIN shipping s ON d.shippingid = s.shippingid + INNER JOIN proposal p ON p.proposalid = s.proposalid + LEFT OUTER JOIN blsession se ON d.firstexperimentid = se.sessionid + LEFT OUTER JOIN blsession se2 ON c.sessionid = se2.sessionid LEFT OUTER JOIN dewarregistry r ON r.facilitycode = d.facilitycode LEFT OUTER JOIN labcontact lc ON s.sendinglabcontactid = lc.labcontactid LEFT OUTER JOIN person pe ON lc.personid = pe.personid diff --git a/client/src/js/modules/shipment/views/dispatch.js b/client/src/js/modules/shipment/views/dispatch.js index 416375168..5e0f59999 100644 --- a/client/src/js/modules/shipment/views/dispatch.js +++ b/client/src/js/modules/shipment/views/dispatch.js @@ -112,6 +112,7 @@ define(['marionette', 'views/form', DEWARID: this.getOption('dewar').get('DEWARID'), LABCONTACTID: this.getOption('dewar').get('LABCONTACTID'), VISIT: this.getOption('dewar').get('FIRSTEXPERIMENT'), + UDCVISIT: this.getOption('dewar').get('UDCFIRSTEXPERIMENT'), // If no agent specified on inbound, default to diamond dhl DELIVERYAGENT_AGENTNAME: this.getOption('shipping').get('DELIVERYAGENT_AGENTNAME') || 'DHL' }) @@ -174,7 +175,8 @@ define(['marionette', 'views/form', }, doOnRender: function() { - this.ui.exp.html(this.visits.opts()).val(this.model.get('VISIT')) + let visit = this.model.get('VISIT') || this.model.get('UDCVISIT') + this.ui.exp.html(this.visits.opts()).val(visit) this.updateLC() this.populateCountries() this.stripPostCode()