Subversion Repositories wimsdev

Rev

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