@@ -71,7 +71,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
7171 itemId : 'targetFolder' ,
7272 allowBlank : false ,
7373 displayField : 'Name' ,
74- valueField : 'EntityId ' ,
74+ valueField : 'Path ' ,
7575 triggerAction : 'all' ,
7676 queryMode : 'local' ,
7777 forceSelection : true ,
@@ -121,6 +121,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
121121 return ;
122122 }
123123
124+ var targetFolderId = win . down ( '#targetFolder' ) . store . findRecord ( 'Path' , targetFolder ) . get ( 'EntityId' ) ;
124125 Ext4 . Msg . wait ( 'Saving...' ) ;
125126 LABKEY . Query . selectRows ( {
126127 schemaName : 'study' ,
@@ -160,7 +161,7 @@ Ext4.define('MCC.window.MarkShippedWindow', {
160161 }
161162
162163 // If going to a new LK folder, we're creating a whole new record:
163- if ( targetFolder . toUpperCase ( ) !== LABKEY . Security . currentContainer . id . toUpperCase ( ) || newId !== row . Id ) {
164+ if ( targetFolderId . toUpperCase ( ) !== LABKEY . Security . currentContainer . id . toUpperCase ( ) || newId !== row . Id ) {
164165 commands . push ( {
165166 command : 'insert' ,
166167 containerPath : targetFolder ,
@@ -223,10 +224,26 @@ Ext4.define('MCC.window.MarkShippedWindow', {
223224 objectId : null
224225 } ]
225226 } ) ;
227+
228+ // And also add an arrival record:
229+ commands . push ( {
230+ command : 'insert' ,
231+ containerPath : targetFolder ,
232+ schemaName : 'study' ,
233+ queryName : 'Arrival' ,
234+ rows : [ {
235+ Id : newId ,
236+ date : effectiveDate ,
237+ source : centerName ,
238+ QCState : null ,
239+ QCStateLabel : 'Completed' ,
240+ objectId : null
241+ } ]
242+ } ) ;
226243 }
227244
228245 // Do this insert if we're using a new container, or if the animal is being assigned a new ID
229- if ( targetFolder . toUpperCase ( ) !== LABKEY . Security . currentContainer . id . toUpperCase ( ) || newId !== row . Id ) {
246+ if ( targetFolderId . toUpperCase ( ) !== LABKEY . Security . currentContainer . id . toUpperCase ( ) || newId !== row . Id ) {
230247 commands . push ( {
231248 command : 'insert' ,
232249 containerPath : targetFolder ,
0 commit comments