@@ -98,6 +98,7 @@ class Shipment extends Page
9898 'LASTMINUTEBEAMTIME ' => '1?|Yes|No ' ,
9999 'DEWARGROUPING ' => '.* ' ,
100100 'EXTRASUPPORTREQUIREMENT ' => '.* ' ,
101+ 'ONSITEUSERS ' => '.* ' ,
101102 'MULTIAXISGONIOMETRY ' => '1?|Yes|No ' ,
102103 'ENCLOSEDHARDDRIVE ' => '1?|Yes|No ' ,
103104 'ENCLOSEDTOOLS ' => '1?|Yes|No ' ,
@@ -112,7 +113,7 @@ class Shipment extends Page
112113 // Container fields
113114 'DEWARID ' => '\d+ ' ,
114115 'CAPACITY ' => '\d+ ' ,
115- 'CONTAINERTYPE ' => '([\w\-])+ ' ,
116+ 'CONTAINERTYPE ' => '([\s\ w\-])+ ' ,
116117 'NAME ' => '([\w\-])+ ' ,
117118 'SCHEDULEID ' => '\d+ ' ,
118119 'SCREENID ' => '\d+ ' ,
@@ -165,6 +166,7 @@ class Shipment extends Page
165166 'LASTMINUTEBEAMTIME ' ,
166167 'DEWARGROUPING ' ,
167168 'EXTRASUPPORTREQUIREMENT ' ,
169+ 'ONSITEUSERS ' ,
168170 'MULTIAXISGONIOMETRY ' ,
169171 'ENCLOSEDHARDDRIVE ' ,
170172 'ENCLOSEDTOOLS ' ,
@@ -406,7 +408,9 @@ function _get_shipments()
406408 $ extra_json = json_decode ($ s ['EXTRA ' ], true );
407409 if (is_null ($ extra_json )) {
408410 $ extra_json = array ();
409- foreach ($ this ->extra_arg_list as $ arg ) {
411+ }
412+ foreach ($ this ->extra_arg_list as $ arg ) {
413+ if (!array_key_exists ($ arg , $ extra_json )) {
410414 $ extra_json [$ arg ] = "" ;
411415 }
412416 }
@@ -2581,27 +2585,36 @@ function _add_container()
25812585 $ pipeline = $ this ->has_arg ('PROCESSINGPIPELINEID ' ) ? $ this ->arg ('PROCESSINGPIPELINEID ' ) : null ;
25822586 $ source = $ this ->has_arg ('SOURCE ' ) ? $ this ->arg ('SOURCE ' ) : null ;
25832587
2584- $ this ->db ->pq (
2585- "INSERT INTO container (containerid,dewarid,code,bltimestamp,capacity,containertype,scheduleid,screenid,ownerid,requestedimagerid,comments,barcode,experimenttype,storagetemperature,containerregistryid,prioritypipelineid,source)
2586- VALUES (s_container.nextval,:1,:2,CURRENT_TIMESTAMP,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,IFNULL(:15,CURRENT_USER)) RETURNING containerid INTO :id " ,
2587- array ($ this ->arg ('DEWARID ' ), $ this ->arg ('NAME ' ), $ cap , $ this ->arg ('CONTAINERTYPE ' ), $ sch , $ scr , $ own , $ rid , $ com , $ bar , $ ext , $ tem , $ crid , $ pipeline , $ source )
2588- );
2588+ try {
2589+ $ this ->db ->pq (
2590+ "INSERT INTO container (containerid,dewarid,code,bltimestamp,capacity,containertype,scheduleid,screenid,ownerid,requestedimagerid,comments,barcode,experimenttype,storagetemperature,containerregistryid,prioritypipelineid,source)
2591+ VALUES (s_container.nextval,:1,:2,CURRENT_TIMESTAMP,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,IFNULL(:15,CURRENT_USER)) RETURNING containerid INTO :id " ,
2592+ array ($ this ->arg ('DEWARID ' ), $ this ->arg ('NAME ' ), $ cap , $ this ->arg ('CONTAINERTYPE ' ), $ sch , $ scr , $ own , $ rid , $ com , $ bar , $ ext , $ tem , $ crid , $ pipeline , $ source )
2593+ );
25892594
2590- $ cid = $ this ->db ->id ();
2595+ $ cid = $ this ->db ->id ();
25912596
2592- if ($ this ->has_arg ('SCHEDULEID ' )) {
2593- $ sh = $ this ->app ->container ['imagingShared ' ];
2594- $ sh ->_generate_schedule (array (
2595- 'CONTAINERID ' => $ cid ,
2596- 'SCHEDULEID ' => $ this ->arg ('SCHEDULEID ' ),
2597- ));
2598- }
2597+ if ($ this ->has_arg ('SCHEDULEID ' )) {
2598+ $ sh = $ this ->app ->container ['imagingShared ' ];
2599+ $ sh ->_generate_schedule (array (
2600+ 'CONTAINERID ' => $ cid ,
2601+ 'SCHEDULEID ' => $ this ->arg ('SCHEDULEID ' ),
2602+ ));
2603+ }
25992604
2600- if ($ this ->has_arg ('AUTOMATED ' )) {
2601- $ this ->db ->pq ("INSERT INTO containerqueue (containerid, personid) VALUES (:1, :2) " , array ($ cid , $ this ->user ->personId ));
2602- }
2605+ if ($ this ->has_arg ('AUTOMATED ' )) {
2606+ $ this ->db ->pq ("INSERT INTO containerqueue (containerid, personid) VALUES (:1, :2) " , array ($ cid , $ this ->user ->personId ));
2607+ }
2608+
2609+ $ this ->_output (array ('CONTAINERID ' => $ cid ));
26032610
2604- $ this ->_output (array ('CONTAINERID ' => $ cid ));
2611+ } catch (Exception $ e ) {
2612+ if ($ e ->getCode () == 1062 ) {
2613+ $ this ->_error ('Barcode is not unique. Please enter a different barcode. ' , 409 );
2614+ } else {
2615+ $ this ->_error ('An unexpected error occurred. ' , 500 );
2616+ }
2617+ }
26052618 }
26062619
26072620
@@ -2748,7 +2761,7 @@ function _get_container_types()
27482761 $ where .= ' AND ct.proposaltype = :1 ' ;
27492762 array_push ($ args , $ this ->arg ('PROPOSALTYPE ' ));
27502763 }
2751- $ rows = $ this ->db ->pq ("SELECT ct.containerTypeId, name, ct.proposalType, ct.capacity, ct.wellPerRow, ct.dropPerWellX, ct.dropPerWellY, ct.dropHeight, ct.dropWidth, ct.wellDrop FROM ContainerType ct WHERE $ where " , $ args );
2764+ $ rows = $ this ->db ->pq ("SELECT ct.containerTypeId, name, ct.proposalType, ct.capacity, ct.wellPerRow, ct.dropPerWellX, ct.dropPerWellY, ct.dropHeight, ct.dropWidth, ct.wellDrop, ct.dropOffsetX, ct.dropOffsetY FROM ContainerType ct WHERE $ where " , $ args );
27522765 $ this ->_output (array ('total ' => count ($ rows ), 'data ' => $ rows ));
27532766 }
27542767
@@ -3117,6 +3130,7 @@ function _add_shipment()
31173130 }
31183131 $ dewar_grouping = $ this ->has_arg ('DEWARGROUPING ' ) ? $ this ->arg ('DEWARGROUPING ' ) : '' ;
31193132 $ extra_support_requirement = $ this ->has_arg ('EXTRASUPPORTREQUIREMENT ' ) ? $ this ->arg ('EXTRASUPPORTREQUIREMENT ' ) : '' ;
3133+ $ onsite_users = $ this ->has_arg ('ONSITEUSERS ' ) ? $ this ->arg ('ONSITEUSERS ' ) : '' ;
31203134 $ multi_axis_goniometry = null ;
31213135 if ($ this ->has_arg ('MULTIAXISGONIOMETRY ' )) {
31223136 $ multi_axis_goniometry = $ this ->arg ('MULTIAXISGONIOMETRY ' ) ? "Yes " : "No " ;
@@ -3131,6 +3145,7 @@ function _add_shipment()
31313145 "LASTMINUTEBEAMTIME " => $ last_minute_beamtime ,
31323146 "DEWARGROUPING " => $ dewar_grouping ,
31333147 "EXTRASUPPORTREQUIREMENT " => $ extra_support_requirement ,
3148+ "ONSITEUSERS " => $ onsite_users ,
31343149 "MULTIAXISGONIOMETRY " => $ multi_axis_goniometry
31353150 );
31363151
0 commit comments