Index: FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGTIA1.m
===================================================================
--- FOIAVistA/trunk/r/IMAGING-MAG-ZMAG/MAGGTIA1.m	(revision 631)
+++ FOIAVistA/tag/r/IMAGING-MAG-ZMAG/MAGGTIA1.m	(revision 636)
@@ -1,5 +1,4 @@
 MAGGTIA1 ;WOIFO/GEK - RPC Call to Add Image File entry ; [ 06/20/2001 08:56 ]
- ;;3.0;IMAGING;**21,8,59**;Nov 27, 2007;Build 20
- ;;Per VHA Directive 2004-038, this routine should not be modified.
+ ;;3.0;IMAGING;**21,8**;Sep 15, 2004
  ;; +---------------------------------------------------------------+
  ;; | Property of the US Government.                                |
@@ -33,6 +32,6 @@
  . D ACTION^MAGGTAU("MOD^"_$P(^MAG(2005,+MAGMOD,0),U,7)_"^"_+$G(MAGMOD)) ; This is the Image IEN
  ;
- ; There are incidents of using an IEN from a deleted image
- ;  these next lines are to stop the problem.
+ ; There are incidents of using an IEN from a deleted image (still)
+ ;  these next lines are TESTING for now.  To stop the problem.
  S GIEN=$O(^MAG(2005," "),-1)+1
  S DIEN=$O(^MAG(2005.1," "),-1)+1
@@ -56,12 +55,13 @@
  ;   we Return the IEN with NO Filename. Groups don't get Filename
  ;
- I MAGGR S MAGRY=MAGGDA_U,Z="" D  G C1
+ I MAGGR S MAGRY=MAGGDA_U,Z="" D  Q
  . F  S Z=$O(MAGGR(Z)) Q:Z=""  S $P(^MAG(2005,Z,0),U,10)=MAGGDA
  . D CLEAN
  ;
  S X=$G(MAGGFDA(2005,"+1,",14)) I +X D
- . ; If here: This image is a member of a Group
- . ;   -Modify the Group Parent, add DA to it's group
- . ;   -Also set 'Series Number' and 'Image Number' if they exist;
+ . ; We're here beceause this image is a member of a Group
+ . ;   so we will modify the Group Parent, adding this to it's group
+ . ; HERE we will also send the 'Series Number' and 'Image Number' if
+ . ; they exist;
  . K MAGGFDA
  . S Y="+2,"_X_","
@@ -72,6 +72,8 @@
  . D UPDATE^DIE("S","MAGGFDA","MAGGIEN","MAGGXE")
  ;
- ; Now get the Image file name. DOS FILE name
- ; The ENTRY in Image File has been made, if any errors from here on
+ ;
+ ;
+ ; now get the Image file name. DOS FILE name
+ ; ENTRY in Image File has been made, if any errors from here on
  ;  then we have to delete the image entry.
  I $D(MAGGFDA(2005,"+1,",1)) S MAGGFNM=MAGGFDA(2005,"+1,",1) G C1
@@ -93,33 +95,14 @@
  ;
 C1 ; we jump here if we already had a Filename sent
+ ;
  K MAGGFDA
  ; 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.
  ;
- ;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)
- . S ^MAG(2005,MAGGDA,40)=INDXD
- . S ^MAGIXCVT(2006.96,MAGGDA)=2 ; Flag. Says fields were converted Patch 59
- . ; TRKING ID  TRKID =   MAGGFDA(2005,"+1,",108)
- . D ACTION^MAGGTAU("INDEX-ALL^"_$P(^MAG(2005,MAGGDA,0),"^",7)_"^"_MAGGDA) ;_"$$"_MAGGFDA(2005,"+1,",108))
- . D ENTRY^MAGLOG("INDEX-ALL",DUZ,MAGGDA,"P59",$P(^MAG(2005,MAGGDA,0),"^",7),1)
- . 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 ENTRY^MAGLOG("INDEX-42",DUZ,MAGGDA,"P59",$P(^MAG(2005,MAGGDA,0),"^",7),1)
- . Q
+ ;-This is being deferred to a later patch.
+ ;-I '$D(^MAG(2005,MAGGDA,40)) D
+ ;-. D ONE^MAGSCNVI(MAGGDA)
+ ;-. D ACTION^MAGGTAU("DFTINDX^^"_MAGGDA)
+ ;
  ;** ABS and JB image queues AREN'T SET WHEN ADDING AN IMAGE. 
  ;** IT IS DONE IN A SEPERATE CALL 
@@ -136,17 +119,15 @@
  ; 
  ;  We return the IEN ^ DRIVE:DIR ^ FILE.EXT
- ;   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
- ;  4/23/98 to include hierarchical directory structure -- PMK
+ ;  Modified 4/23/98 to include hierarchial directory structure -- PMK
  ;
- I 'MAGGR D
- . S MAGDHASH=$$DIRHASH^MAGFILEB(MAGGFNM,MAGREF)
- . S MAGRY=MAGGDA_U_MAGGDRV_MAGDHASH_U_MAGGFNM
- . ; For now, BIG files are in same directory as FullRes (or PACS) file
- . I $G(MAGBIG) D
- . . S X=$P(MAGGFNM,".",1)_".BIG"
- . . S MAGRY=MAGRY_U_MAGGDRV_MAGDHASH_U_X
- . . Q
+ S MAGDHASH=$$DIRHASH^MAGFILEB(MAGGFNM,MAGREF)
+ S MAGRY=MAGGDA_U_MAGGDRV_MAGDHASH_U_MAGGFNM
+ ; For now, BIG files are in same directory as FullRes (or PACS) file
+ I $G(MAGBIG) D
+ . S X=$P(MAGGFNM,".",1)_".BIG"
+ . S MAGRY=MAGRY_U_MAGGDRV_MAGDHASH_U_X
  . Q
  ;
