Subversion Repositories wimsdev

Rev

Rev 15774 | 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
 
15774 guerimand 26
!! -------- makelist of variable can be deleted (not in use in the structure by any participant
27
!if / isin $wims_class
28
  cls=$wims_superclass
29
!else
30
  cls=$wims_class
31
!endif
32
code=!item $stechvar of $tv_listlocalcode
33
nbol=!itemcnt $ol_value
34
flags=!values 0 for v=1 to $nbol
35
u=1
36
nbu=!recordcnt wimshome/log/classes/$cls/.userlist
37
flagcnt=0
38
!while $u<=$nbu and $flagcnt<$nbol
39
  l=!record $u of wimshome/log/classes/$cls/.userlist
40
  l=!item 3 of $l
41
  tmp=!defof user_techvar_$code in wimshome/log/classes/$cls/.users/$l
42
  !if $tmp!=$empty
43
    p=!positionof item $tmp in $ol_value
44
    !if $(flags[$p])=0
45
      flags=!replace item number $p by 1 in $flags
46
      !increase flagcnt
47
    !endif
48
  !endif
49
  !increase u
50
!endwhile
51
!reset del_values
52
!for k=1 to $nbol
53
  !if $(flags[$k])=0
54
    del_values=!append item $(ol_value[$k]) to $del_values
55
  !endif
56
!next k
57
 
9960 guerimand 58
!if $tc_set!=$empty
12488 bpr 59
  !! check name validity
60
  tc_name=!text select 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in $tc_name
61
  tc_name=!nospace $tc_name
62
  tc_name=!lower $tc_name
63
  n=!charcnt $tc_name
64
  !if $n>$MAXcharname or $n<1
14335 bpr 65
    error=badnamelen
66
    !reset tc_set
67
    !exit
12488 bpr 68
  !endif
9960 guerimand 69
 
12488 bpr 70
  !! check list of name already in use
71
  !if $tc_name isitemof $tv_listallname and $tc_name!=$ol_name
14335 bpr 72
    error=namealreadyuse
73
    !reset tc_set
74
    !exit
12488 bpr 75
  !endif
9960 guerimand 76
 
12488 bpr 77
  !! check list of value
78
  tc_value=!listuniq $tc_value
15772 guerimand 79
  tc_value=!listcomplement _EMPTY_,EMPTY,EMPTY_,_EMPTY in $tc_value
12488 bpr 80
  n=!itemcnt $tc_value
81
  !if $n<1 or $n>$MAXnbvalue
14335 bpr 82
    error=badvaluenb
83
    !reset tc_set
84
    !exit
12488 bpr 85
  !endif
15774 guerimand 86
 
12488 bpr 87
  !! old list must be include (or delete value not in use in the class TODO).
88
  !! il y a une amélioration à faire pour poster un message et effacer les valeurs qui ne sont plus disponibles.
89
  li=!listcomplement $tc_value in $ol_value
15774 guerimand 90
  li=!listcomplement $del_values in $li
12488 bpr 91
  !if $li!=$empty
14335 bpr 92
    error=valuedisappear
15772 guerimand 93
    tc_value=$ol_value
14335 bpr 94
    !reset tc_set
15772 guerimand 95
    !exit
12488 bpr 96
  !endif
15774 guerimand 97
 
98
!! --------- save new data
12488 bpr 99
  donnees=$empty
100
  !for k=1 to $nblocalvar
101
    !if $k=$stechvar
14335 bpr 102
      donnees=!append line :$tc_name\
9960 guerimand 103
$tc_value to $donnees
14335 bpr 104
    !else
105
      tmp=!record $k of wimshome/log/classes/$wims_class/.techvar
106
      donnees=!append line :$tmp to $donnees
107
    !endif
12488 bpr 108
  !next k
109
  !filewrite wimshome/log/classes/$wims_class/.techvar $donnees
110
  !if $ol_name!=$tc_name
111
    nb=!recordcnt wimshome/log/classes/$tv_Sclass/.indextechvar
14335 bpr 112
    donnees=$empty
113
    !for k=1 to $nb
114
      tmp=!record $k of wimshome/log/classes/$tv_Sclass/.indextechvar
115
      !if $(tmp[2])=$wims_class and $(tmp[3])=$stechvar
116
        donnees=!append line :$tc_name,$wims_class,$stechvar to $donnees
117
      !else
118
        donnees=!append line :$tmp to $donnees
119
      !endif
9960 guerimand 120
    !next k
14335 bpr 121
    !filewrite wimshome/log/classes/$tv_Sclass/.indextechvar $donnees
15960 guerimand 122
    wims_class_log=techvar rename $ol_name became $tc_name with values $tc_value
123
  !else
124
    wims_class_log=techvar $ol_name new list values : $tc_value
12488 bpr 125
  !endif
126
  !restart module=adm/class/techvar
9960 guerimand 127
!endif