Index: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGSIA.m
===================================================================
--- FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGGSIA.m	(revision 631)
+++ FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGSIA.m	(revision 636)
@@ -1,5 +1,4 @@
 MAGGSIA ;WOIFO/GEK - Imaging RPC Broker calls. Add/Modify Image entry ; [ 12/27/2000 10:49 ]
- ;;3.0;IMAGING;**7,21,8,59**;Nov 27, 2007;Build 20
- ;;Per VHA Directive 2004-038, this routine should not be modified.
+ ;;3.0;IMAGING;**7,21,8**;Sep 15, 2004
  ;; +---------------------------------------------------------------+
  ;; | Property of the US Government.                                |
@@ -45,5 +44,5 @@
  ;    CALLING ROUTINE is responsible for RENAMING THE IMAGE FILE on DISK
  ;      TO THE NEW FILE NAME RETURNED BY THIS CALL.
- ;      Changed to include hierarchical directory hash  - PMK 04/23/98
+ ;      Changed to include hierarchial directory hash  - PMK 04/23/98
  ;----------------------------------------------------------------
  N MAGGFDA,MAGGDRV,MAGGRP,MAGCHLD,GRPCT,MAGGDA,MAGGFNM
@@ -64,5 +63,4 @@
  I '$D(MAGGFDA(2005,"+1,")) S MAGRY(0)="0^No data to file.  Operation CANCELED." Q
  ;
- ;Q:'$$VALINDEX^MAGGSIV1(.MAGRY,$G(MAGGFDA(2005,"+1,",42)),$G(MAGGFDA(2005,"+1,",44)),$G(MAGGFDA(2005,"+1,",43)))
  ;  Check on some possible problems: required fields, create default values etc.
  D PRE^MAGGSIA1(.MAGERR,.MAGGFDA,MAGGRP,.MAGGDRV,.MAGREF) I $L(MAGERR) S MAGRY(0)=MAGERR Q
@@ -88,5 +86,5 @@
  ; IF a group, UpDate the GROUP PARENT in each Group Object and QUIT
  ;  The Return (MAGRY(0)) will be IEN with NO Filename. Groups don't get Filename
- I MAGGRP D  G C1
+ I MAGGRP D  Q
  . D UPDCHLD^MAGGSIM(.MAGCHLD,MAGGDA)
  . S MAGRY(0)=MAGGDA_U
@@ -95,8 +93,10 @@
  ; ENTRY in Image File has been made, if any errors from here on
  ;  then we have to delete the image entry.
- ;  IF This image is a member of a Group, Update the Group Entry with new child.
- S X=$G(MAGGFDA(2005,"+1,",14)) I +X D  I $L(MAGERR) Q
- . D UPDPAR^MAGGSIM(.MAGERR,X,.MAGACT,MAGGDA)
- . I $L(MAGERR) S MAGRY(0)=MAGERR D CLEAN
+ ; New Index Field Check.  If this entry doesn't have the Index fields introduced
+ ;   in 3.0.8 then we use the Patch 17 conversion API call to generate default values.
+ ;-This is being deferred to a later patch.
+ ;-I '$D(^MAG(2005,MAGGDA,40)) D
+ ;-. D ONE^MAGSCNVI(MAGGDA)
+ ;-. D ACTION^MAGGTAU("DFTINDX^"_MAGGFDA(2005,"+1,",5)_"^"_MAGGDA)
  ;
  ; Now generate the Image FileName. This is passed back to the calling app, 
@@ -120,52 +120,27 @@
  . . D CLEAN
  ;
-C1 ; 59 
- K MAGGFDA ; P59.
- ;P59 Now we Auto-Generate the Index Fields, if they don't exist for this entry
- I '$D(^MAG(2005,MAGGDA,40)) D
- . N INDXD
- . D GENIEN^MAGXCVI(MAGGDA,.INDXD)
- . D COMIEN^MAGXCVC(MAGGDA,.INDXD)
- . S ^MAGIXCVT(2006.96,MAGGDA)=1 ; Flag. Says fields were converted by index generation
- . ; TRKING ID  TRKID =   MAGGFDA(2005,"+1,",108)
- . ;;D ACTION^MAGGTAU("GENINDX^"_MAGGFDA(2005,"+1,",5)_"^"_MAGGDA_"$$"_MAGGFDA(2005,"+1,",108))
- . D ACTION^MAGGTAU("INDEX-ALL^"_$P(^MAG(2005,MAGGDA,0),"^",7)_"^"_MAGGDA_"$$"_$P(^MAG(2005,MAGGDA,100),"^",5))
- . Q
  ;
- ;P59 If TYPE INDEX is missing we Auto-Generate Index Type and other missing Index Term values.
- I '$P(^MAG(2005,MAGGDA,40),"^",3) D
- . N INDXD,OLD40,N40
- . S (N40,OLD40)=^MAG(2005,MAGGDA,40)
- . D GENIEN^MAGXCVI(MAGGDA,.INDXD)
- . ; If Origin doesn't exist in existing, this will put V in. 
- . I $P(INDXD,"^",6)="" S $P(INDXD,"^",6)="V"
- . ; We're not changing existing values of Spec,Proc or Origin 
- . F J=1:1:6 I '$L($P(N40,"^",J)) S $P(N40,"^",J)=$P(INDXD,"^",J)
- . ;Validate the merged Spec and Proc, if  not valid, revert back to old Spec and Proc
- . I '$$VALINDEX^MAGGSIV1(.X,$P(N40,"^",3),$P(N40,"^",5),$P(N40,"^",4)) S $P(N40,"^",4,5)=$P(OLD40,"^",4,5)
- . S ^MAG(2005,MAGGDA,40)=N40
- . ;;D ACTION^MAGGTAU("INDEX-42^"_$P(^MAG(2005,MAGGDA,0),"^",7)_"^"_MAGGDA) ;_"$$"_MAGGFDA(2005,"+1,",108))
- . D ACTION^MAGGTAU("INDEX-42^"_$P(^MAG(2005,MAGGDA,0),"^",7)_"^"_MAGGDA_"$$"_$P(^MAG(2005,MAGGDA,100),"^",5))
- . D ENTRY^MAGLOG("INDEX-42",DUZ,MAGGDA,"P59",$P(^MAG(2005,MAGGDA,0),"^",7),1)
- . Q
+ ;
+ ;  IF This image is a member of a Group, Update the Group Entry with new child.
+ S X=$G(MAGGFDA(2005,"+1,",14)) I +X D  I $L(MAGERR) Q
+ . D UPDPAR^MAGGSIM(.MAGERR,X,.MAGACT,MAGGDA)
+ . I $L(MAGERR) S MAGRY(0)=MAGERR D CLEAN
+ ;
  ;** ABS and JB image queues AREN'T SET WHEN ADDING AN IMAGE. 
  ;** RPC =-> 'MAG ABSJB' after abstract is/isn't created on the workstation
  ;
  ;  The Return is:  IEN ^ DRIVE:DIR ^ FILE.EXT [^ DRIVE:DIR ^ FILE.BIG]
- ;   example:  487^C:\IMAGE\^DC000487.TIF
+ ;   i.e  487^C:\IMAGE\^DC000487.TIF
  ;  The calling routine is responsible for renaming/naming the file
  ;   to the returned DRIVE:\DIR\FILENAME.EXT
  ;
- ; Modified 4/23/98 to include hierarchical directory structure -- PMK
- I 'MAGGRP D
- . S MAGDHASH=$$DIRHASH^MAGFILEB(MAGGFNM,MAGREF)
- . ; For now, BIG files are in same directory as FullRes (or PACS) file
- . S MAGRY(0)=MAGGDA_U_MAGGDRV_MAGDHASH_U_MAGGFNM
- . ; If BIG file also, add it's Drive, Hash, Filename to end of Return string.
- . I $G(MAGACT("BIG")) D
- . . S X=$P(MAGGFNM,".",1)_".BIG"
- . . S MAGRY(0)=MAGRY(0)_U_MAGGDRV_MAGDHASH_U_X
- . . Q
- . Q
+ ; Modified 4/23/98 to include hierarchial directory structure -- PMK
+ S MAGDHASH=$$DIRHASH^MAGFILEB(MAGGFNM,MAGREF)
+ ; For now, BIG files are in same directory as FullRes (or PACS) file
+ S MAGRY(0)=MAGGDA_U_MAGGDRV_MAGDHASH_U_MAGGFNM
+ ; If BIG file also, add it's Drive, Hash, Filename to end of Return string.
+ I $G(MAGACT("BIG")) D
+ . S X=$P(MAGGFNM,".",1)_".BIG"
+ . S MAGRY(0)=MAGRY(0)_U_MAGGDRV_MAGDHASH_U_X
  ;
 CLEAN ; Called as tag
