Subversion Repositories wimsdev

Rev

Rev 12488 | Rev 14335 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
9960 guerimand 1
$techvar=$[$techvar*1]
2
nblocalvar=!itemcnt $tv_listlocal
3
!if ($techvar<1 or $techvar>$nblocalvar)
12488 bpr 4
  error=badtechvarnumber
5
  job=listvar
6
  !changeto $job.proc
7
  !exit
9960 guerimand 8
!endif
9
 
10
!if $stechvar=$empty
12488 bpr 11
  stechvar=$techvar
12
  !reset tc_abandon,tc_set
13
  don=!record $stechvar of wimshome/log/classes/$wims_class/.techvar
14
  !distribute line $don into ol_name,ol_value
15
  tc_name=$ol_name
16
  tc_value=$ol_value
9960 guerimand 17
!endif
18
 
19
!if $tc_abandon!=$empty
12488 bpr 20
  !reset tc_abandon,tc_value,tc_name,tc_set,stechvar
21
  job=listvar
22
  !changeto $job.proc
23
  !exit
9960 guerimand 24
!endif
25
 
26
!if $tc_set!=$empty
12488 bpr 27
  !! check name validity
28
  tc_name=!text select 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in $tc_name
29
  tc_name=!nospace $tc_name
30
  tc_name=!lower $tc_name
31
  n=!charcnt $tc_name
32
  !if $n>$MAXcharname or $n<1
33
	  error=badnamelen
34
	  !reset tc_set
35
	  !exit
36
  !endif
9960 guerimand 37
 
12488 bpr 38
  !! check list of name already in use
39
  !if $tc_name isitemof $tv_listallname and $tc_name!=$ol_name
40
	  error=namealreadyuse
41
	  !reset tc_set
42
	  !exit
43
  !endif
9960 guerimand 44
 
12488 bpr 45
  !! check list of value
46
  tc_value=!listuniq $tc_value
47
  tc_value=!listcomplement _EMPTY_ in $tc_value
48
  n=!itemcnt $tc_value
49
  !if $n<1 or $n>$MAXnbvalue
50
	  error=badvaluenb
51
	  !reset tc_set
52
	  !exit
53
  !endif
54
  !! old list must be include (or delete value not in use in the class TODO).
55
  !! il y a une amélioration à faire pour poster un message et effacer les valeurs qui ne sont plus disponibles.
56
  li=!listcomplement $tc_value in $ol_value
57
  !if $li!=$empty
58
	  error=valuedisappear
59
	  !reset tc_set
60
  !endif
61
  !! save
62
  donnees=$empty
63
  !for k=1 to $nblocalvar
64
    !if $k=$stechvar
65
  	  donnees=!append line :$tc_name\
9960 guerimand 66
$tc_value to $donnees
12488 bpr 67
	  !else
9960 guerimand 68
	    tmp=!record $k of wimshome/log/classes/$wims_class/.techvar
69
	    donnees=!append line :$tmp to $donnees
12488 bpr 70
	  !endif
71
  !next k
72
  !filewrite wimshome/log/classes/$wims_class/.techvar $donnees
73
  !if $ol_name!=$tc_name
74
    nb=!recordcnt wimshome/log/classes/$tv_Sclass/.indextechvar
75
  	donnees=$empty
76
  	!for k=1 to $nb
77
  	  tmp=!record $k of wimshome/log/classes/$tv_Sclass/.indextechvar
78
  	  !if $(tmp[2])=$wims_class and $(tmp[3])=$stechvar
79
  		  donnees=!append line :$tc_name,$wims_class,$stechvar to $donnees
80
  	  !else
81
  		  donnees=!append line :$tmp to $donnees
82
  	  !endif
9960 guerimand 83
    !next k
12488 bpr 84
  	!filewrite wimshome/log/classes/$tv_Sclass/.indextechvar $donnees
85
  !endif
86
  !restart module=adm/class/techvar
9960 guerimand 87
!endif