gestion 1.9.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +48 -0
  3. data/.project +14 -0
  4. data/Binaries/adduser_to_buzz +15 -0
  5. data/Binaries/backup +7 -0
  6. data/Binaries/check_gestion +8 -0
  7. data/Binaries/gestion.gnumail +22 -0
  8. data/Binaries/gestion.logrotate +34 -0
  9. data/Binaries/gestion.service +12 -0
  10. data/Binaries/gestion_update.rb +183 -0
  11. data/Binaries/gestion_update.service +10 -0
  12. data/Binaries/get_compta +11 -0
  13. data/Binaries/kill_gestion +16 -0
  14. data/Binaries/ldap/add_indexes +51 -0
  15. data/Binaries/ldap/backup +2 -0
  16. data/Binaries/ldap/install_ldap +92 -0
  17. data/Binaries/ldap/restore +7 -0
  18. data/Binaries/lib_backup +5 -0
  19. data/Binaries/log_scan_errors +8 -0
  20. data/Binaries/loop_gestion +64 -0
  21. data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
  22. data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
  23. data/Binaries/reboot +5 -0
  24. data/Binaries/restore +3 -0
  25. data/Binaries/restore_do +22 -0
  26. data/Binaries/sort_events +31 -0
  27. data/Binaries/start_gestion +18 -0
  28. data/Binaries/swipe_gestion +18 -0
  29. data/Binaries/update_africompta +21 -0
  30. data/Binaries/update_users +3 -0
  31. data/Diplomas.src/accredited.odg +0 -0
  32. data/Diplomas.src/diploma.odg +0 -0
  33. data/Diplomas.src/label.odg +0 -0
  34. data/Diplomas.src/presence_sheet.ods +0 -0
  35. data/Diplomas.src/presence_sheet_small.ods +0 -0
  36. data/Diplomas.src/student_card.odg +0 -0
  37. data/Doc/130514-it-ideas.odt +0 -0
  38. data/Doc/Compta-cash.mm +179 -0
  39. data/Doc/General.odt +0 -0
  40. data/Entities/AccessGroups.rb +117 -0
  41. data/Entities/Activity.rb +178 -0
  42. data/Entities/ChatMsg.rb +142 -0
  43. data/Entities/Classroom.rb +11 -0
  44. data/Entities/Client.rb +19 -0
  45. data/Entities/Computer.rb +21 -0
  46. data/Entities/ConfigBase.rb +280 -0
  47. data/Entities/Course.rb +1588 -0
  48. data/Entities/CourseType.rb +171 -0
  49. data/Entities/DFiles.rb +466 -0
  50. data/Entities/FilesManage.rb +226 -0
  51. data/Entities/Grade.rb +186 -0
  52. data/Entities/Internet.rb +300 -0
  53. data/Entities/Netdev.rb +10 -0
  54. data/Entities/Person.rb +1175 -0
  55. data/Entities/Plug.rb +98 -0
  56. data/Entities/Quiz.rb +33 -0
  57. data/Entities/Recharges.rb +37 -0
  58. data/Entities/Report.rb +136 -0
  59. data/Entities/Room.rb +12 -0
  60. data/Entities/SMS.rb +30 -0
  61. data/Entities/ScheduleType.rb +33 -0
  62. data/Entities/Share.rb +120 -0
  63. data/Entities/Task.rb +51 -0
  64. data/Entities/Ticket.rb +72 -0
  65. data/Entities/Usage.rb +143 -0
  66. data/Entities/Worker.rb +29 -0
  67. data/Files/apache-profeda.conf +36 -0
  68. data/Files/label.erb +121 -0
  69. data/Files/label_notfound.erb +64 -0
  70. data/Files/label_notpassed.erb +84 -0
  71. data/Files/mobileinfo.erb +115 -0
  72. data/Files/smb.conf +333 -0
  73. data/Files/timetable.html +36 -0
  74. data/Files/timetable.js +239 -0
  75. data/Gemfile +12 -0
  76. data/Gemfile.dev +12 -0
  77. data/Gemfile.dev.lock +127 -0
  78. data/Gemfile.lock +127 -0
  79. data/Gemfile.prod +8 -0
  80. data/Gestion +35 -0
  81. data/Gestion.rb +220 -0
  82. data/INSTALL +40 -0
  83. data/Images/connection.xcf +0 -0
  84. data/Images/connection_no.png +0 -0
  85. data/Images/connection_wait.png +0 -0
  86. data/Images/connection_yes.png +0 -0
  87. data/Paths/Exas.rb +13 -0
  88. data/Paths/Files.rb +19 -0
  89. data/Paths/GetDiplomas.rb +20 -0
  90. data/Paths/Info.rb +114 -0
  91. data/Paths/Label.rb +187 -0
  92. data/Paths/MobileInfo.rb +19 -0
  93. data/Paths/internetCash.rb +34 -0
  94. data/Paths/internetWifi.rb +54 -0
  95. data/README.md +60 -0
  96. data/Rakefile +13 -0
  97. data/TODO +1391 -0
  98. data/Test/.gitignore +3 -0
  99. data/Test/Diplomas/base_gestion.odt +0 -0
  100. data/Test/Diplomas/base_report.odt +0 -0
  101. data/Test/Diplomas/carte_etudiant.odg +0 -0
  102. data/Test/Diplomas/exam_language.odt +0 -0
  103. data/Test/Diplomas/label.odg +0 -0
  104. data/Test/Diplomas/presence_sheet.ods +0 -0
  105. data/Test/Diplomas/presence_sheet_small.ods +0 -0
  106. data/Test/Diplomas/student_card.odg +0 -0
  107. data/Test/Manual/testMerge +18 -0
  108. data/Test/config_test.yaml +26 -0
  109. data/Test/db.testGestion +0 -0
  110. data/Test/dfiles/descs/avg-rescue.desc +10 -0
  111. data/Test/dfiles/descs/avg.desc +8 -0
  112. data/Test/dfiles/descs/driver.desc +8 -0
  113. data/Test/dfiles/descs/linuxmint.desc +7 -0
  114. data/Test/dfiles/files/avg-160203.exe +1 -0
  115. data/Test/dfiles/files/avg.iso +1 -0
  116. data/Test/dfiles/files/driver.exe +1 -0
  117. data/Test/dfiles/index_post.html +3 -0
  118. data/Test/dfiles/index_pre.html +8 -0
  119. data/Test/dfiles/priorities +5 -0
  120. data/Test/ge_activity.rb +124 -0
  121. data/Test/ge_chat.rb +106 -0
  122. data/Test/ge_compta.rb +67 -0
  123. data/Test/ge_configbase.rb +54 -0
  124. data/Test/ge_course.rb +1114 -0
  125. data/Test/ge_dfiles.rb +121 -0
  126. data/Test/ge_filesmanage.rb +180 -0
  127. data/Test/ge_info.rb +27 -0
  128. data/Test/ge_internet.rb +246 -0
  129. data/Test/ge_login.rb +55 -0
  130. data/Test/ge_person.rb +373 -0
  131. data/Test/ge_qvinfo.rb +28 -0
  132. data/Test/ge_report.rb +97 -0
  133. data/Test/ge_share.rb +27 -0
  134. data/Test/ge_sms.rb +34 -0
  135. data/Test/ge_tasks.rb +19 -0
  136. data/Test/ge_usage.rb +168 -0
  137. data/Test/ge_view.rb +46 -0
  138. data/Test/multiconf-captive +29 -0
  139. data/Test/test.conf +7 -0
  140. data/Test/test.rb +49 -0
  141. data/Test/test_bytes.png +0 -0
  142. data/VERSION +140 -0
  143. data/Views/Admin/Backup.rb +91 -0
  144. data/Views/Admin/Configuration.rb +44 -0
  145. data/Views/Admin/Credit.rb +32 -0
  146. data/Views/Admin/FilesManage.rb +219 -0
  147. data/Views/Admin/Function.rb +39 -0
  148. data/Views/Admin/Power.rb +49 -0
  149. data/Views/Admin/Printer.rb +37 -0
  150. data/Views/Admin/Server.rb +252 -0
  151. data/Views/Admin/Tabs.rb +5 -0
  152. data/Views/Admin/Update.rb +73 -0
  153. data/Views/Admin/UpdateSystem.rb +26 -0
  154. data/Views/Cashbox/Activity.rb +191 -0
  155. data/Views/Cashbox/Course.rb +141 -0
  156. data/Views/Cashbox/Credit.rb +79 -0
  157. data/Views/Cashbox/Report.rb +115 -0
  158. data/Views/Cashbox/Service.rb +105 -0
  159. data/Views/Cashbox/Tabs.rb +10 -0
  160. data/Views/Compta/Accounts.rb +36 -0
  161. data/Views/Compta/Course.rb +96 -0
  162. data/Views/Compta/Show.rb +6 -0
  163. data/Views/Compta/Transfer.rb +66 -0
  164. data/Views/Course/Diploma.rb +203 -0
  165. data/Views/Course/Grade.rb +401 -0
  166. data/Views/Course/Modify.rb +447 -0
  167. data/Views/Course/Print.rb +94 -0
  168. data/Views/Course/Responsible.rb +44 -0
  169. data/Views/Course/Stats.rb +76 -0
  170. data/Views/Course/Students.rb +92 -0
  171. data/Views/Course/Tabs.rb +220 -0
  172. data/Views/Internet/Access.rb +134 -0
  173. data/Views/Internet/ClassEdit.rb +24 -0
  174. data/Views/Internet/ClassUsers.rb +81 -0
  175. data/Views/Internet/Config.rb +32 -0
  176. data/Views/Internet/Mobile.rb +213 -0
  177. data/Views/Internet/Recharges.rb +49 -0
  178. data/Views/Internet/Tabs.rb +6 -0
  179. data/Views/Inventory/Computer.rb +24 -0
  180. data/Views/Inventory/Room.rb +18 -0
  181. data/Views/Inventory/Tabs.rb +9 -0
  182. data/Views/Inventory/TicketClosed.rb +7 -0
  183. data/Views/Inventory/TicketOpen.rb +23 -0
  184. data/Views/Library/Person.rb +36 -0
  185. data/Views/Library/Tabs.rb +7 -0
  186. data/Views/Network/Block.rb +87 -0
  187. data/Views/Network/Netdevs.rb +21 -0
  188. data/Views/Network/Restriction.rb +37 -0
  189. data/Views/Network/Share.rb +167 -0
  190. data/Views/Network/Tables.rb +28 -0
  191. data/Views/Network/Tabs.rb +6 -0
  192. data/Views/Person/Admin.rb +99 -0
  193. data/Views/Person/Center.rb +48 -0
  194. data/Views/Person/Course.rb +72 -0
  195. data/Views/Person/Modify.rb +153 -0
  196. data/Views/Person/Tabs.rb +162 -0
  197. data/Views/Report/ComptaExecutive.rb +221 -0
  198. data/Views/Report/ComptaFlat.rb +79 -0
  199. data/Views/Report/ReportCourse.rb +47 -0
  200. data/Views/Report/Tabs.rb +8 -0
  201. data/Views/Report/Usage.rb +52 -0
  202. data/Views/Report/UsageCases.rb +59 -0
  203. data/Views/Self/Cash.rb +67 -0
  204. data/Views/Self/Chat.rb +55 -0
  205. data/Views/Self/Concours.rb +109 -0
  206. data/Views/Self/Email.rb +34 -0
  207. data/Views/Self/Internet.rb +255 -0
  208. data/Views/Self/Results.rb +17 -0
  209. data/Views/Self/Services.rb +85 -0
  210. data/Views/Self/Show.rb +47 -0
  211. data/Views/Self/Tabs.rb +5 -0
  212. data/Views/Special/DFileEdit.rb +13 -0
  213. data/Views/Special/PlugEdit.rb +56 -0
  214. data/Views/Special/Tabs.rb +6 -0
  215. data/Views/Special/Vnc.rb +39 -0
  216. data/Views/Task/Client.rb +21 -0
  217. data/Views/Task/Edit.rb +33 -0
  218. data/Views/Task/List.rb +55 -0
  219. data/Views/Task/Tabs.rb +9 -0
  220. data/Views/Task/Worker.rb +30 -0
  221. data/Views/Template/Activity.rb +33 -0
  222. data/Views/Template/CourseType.rb +63 -0
  223. data/Views/Template/ScheduleType.rb +29 -0
  224. data/Views/Template/Tabs.rb +5 -0
  225. data/Views/Welcome.rb +121 -0
  226. data/config.yaml.default +36 -0
  227. data/po/Gestion-ar.po +2356 -0
  228. data/po/Gestion-en.mo +0 -0
  229. data/po/Gestion-en.po +4363 -0
  230. data/po/Gestion-fr.mo +0 -0
  231. data/po/Gestion-fr.po +4345 -0
  232. data/po/traduction-ar.rtf +76 -0
  233. metadata +381 -0
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+ %w( QooxView AfriCompta LibNet Network/lib Hilink/lib HelperClasses/lib Gestion ).each { |l|
3
+ $LOAD_PATH.push "../../../#{l}"
4
+ }
5
+ $LOAD_PATH.push "."
6
+
7
+ =begin
8
+ Due to a problem in the CSV-save module, most of the CSV-data hasn't been saved!!
9
+ This was mostly a problem for the sign-ups of the students that were missing
10
+ in the courses.
11
+ =end
12
+
13
+ DEBUG_LVL=1
14
+ $config_file='config.yaml'
15
+
16
+ require 'QooxView'
17
+ require 'ACQooxView'
18
+ require 'LibNet'
19
+ require 'Label'
20
+ ACQooxView.load_entities
21
+
22
+ unless File.exists? 'data/'
23
+ dputs(0) { "Didn't find data/-directory, aborting" }
24
+ exit -1
25
+ end
26
+
27
+ QooxView.init('../../Entities', '../../Views')
28
+
29
+ course_accounts = []
30
+
31
+ CourseTypes.search_all().each { |ct|
32
+ if ct.account_base
33
+ ct.account_base.accounts.each { |a|
34
+ course_accounts.push a
35
+ }
36
+ end
37
+ }
38
+
39
+ course_accounts.uniq!
40
+
41
+ Courses.search_all().each { |c|
42
+ if ca = c.entries
43
+ if course_accounts.index ca
44
+ course_accounts.delete ca
45
+ puts "Linked: #{c.name}"
46
+ puts "Students before: #{c.students.sort.to_s}"
47
+ std = ca.movements.select { |m| m.desc =~ /^For student/ }.map{|m|
48
+ m.desc.match( /.* ([^ :]*):.*/ )[1]}.uniq
49
+ puts "Students in compta: #{std.sort.to_s}"
50
+ c.students = ( c.students + std ).sort.uniq
51
+ puts "Merged : #{c.students.sort.to_s}"
52
+ else
53
+ puts "Not linked: #{c.name}"
54
+ end
55
+ elsif c.name =~ /_14/
56
+ puts "Missing link: #{c.name}"
57
+ end
58
+ }
59
+
60
+ Entities.save_all
61
+
62
+ begin
63
+ course_accounts.each { |ca|
64
+ if ca.path =~ /14/ and ca.movements.length > 0
65
+ puts "Not linked: #{ca.path}"
66
+ if c = Courses.match_by_name( ca.name )
67
+ puts "Late finding: #{ca.path} - #{c.name}"
68
+ end
69
+ ca.movements.each{|m|
70
+ puts m.to_json
71
+ }
72
+ end
73
+ }
74
+ end
@@ -0,0 +1,26 @@
1
+ #!/bin/bash
2
+ if [ ! -f Persons.csv ]; then
3
+ echo Please run in data-directory!
4
+ exit
5
+ fi
6
+
7
+ cp Persons.csv Persons.csv.backup.$( date +%Y%m%d-%M%H )
8
+
9
+ # First we read everything in
10
+ slapcat | egrep "(^MaN-Internet-Cash|^cn|^uidNumber)" | grep -B 2 MaN | grep -v -- "--" > cash
11
+
12
+ # Then we clean up Persons.csv
13
+ perl -pi -e "s/.credit_due[^,]*,//" Persons.csv
14
+
15
+ # Finally we set every cash
16
+ while read one; do
17
+ read two
18
+ read three
19
+ echo -e "$one\n$two\n$three" | sort | sed -e "s/.* //" > cash.tmp
20
+ while read cn; do
21
+ read cash
22
+ read uid
23
+ echo cn is $cn with uid=$uid and $cash CFAs;
24
+ perl -pi -e "s/(.person_id..$uid[^0-9])/\"credit\":$cash,\1/" Persons.csv
25
+ done < cash.tmp
26
+ done < cash
data/Binaries/reboot ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ sleep 2
4
+ pkill -9 -f ruby.*Gestion
5
+ reboot
data/Binaries/restore ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ nohup $( dirname $0 )/restore_do $1 &
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ . $( dirname $0 )/lib_backup
4
+ . /etc/gestion.conf
5
+ DATE=$1
6
+
7
+ #sleep 2
8
+ #touch /tmp/stop_gestion
9
+ #$WDIR/Binaries/kill_gestion
10
+ #sleep 2
11
+
12
+ systemctl stop gestion
13
+ sleep 5
14
+ touch /tmp/stop_gestion
15
+ $WDIR/Binaries/kill_gestion
16
+ echo Going to restore $BACKUP_DIR/$DATE > /tmp/restore
17
+ tar -C ${DATADIR:-/var/lib/gestion} -Pxzf $BACKUP_DIR/$DATE
18
+
19
+ sleep 5
20
+ systemctl start gestion
21
+
22
+ #$WDIR/Binaries/start_gestion
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ ORDER="chat course_payment ActivityPayments AddCash cashbox_course grade grades diploma \
4
+ course person Welcome"
5
+
6
+ if [ ! "$1" -o ! "$2" ]; then
7
+ echo Syntax: $0 in.log out.log
8
+ exit 1
9
+ fi
10
+
11
+ EVENTS_IN=$1
12
+ EVENTS_OUT=$2
13
+
14
+ if [ ! -f $EVENTS_IN ]; then
15
+ echo "$EVENTS_IN doesn't exist"
16
+ exit 1
17
+ fi
18
+
19
+ SRC=/tmp/events_src.log
20
+ OTHER=/tmp/events_dst.log
21
+ cp $EVENTS_IN $SRC
22
+ rm -f $EVENTS_OUT
23
+
24
+ for field in $ORDER; do
25
+ # echo Sorting for field $field
26
+ grep " $field: " $SRC >> $EVENTS_OUT
27
+ grep -v " $field: " $SRC > $OTHER
28
+ mv $OTHER $SRC
29
+ done
30
+ echo "-----------------------" >> $EVENTS_OUT
31
+ sort -k 3 $SRC >> $EVENTS_OUT
@@ -0,0 +1,18 @@
1
+ #!/bin/bash
2
+
3
+ test -x /etc/init.d/blink-fast && /etc/init.d/blink-fast start
4
+ . /etc/environment
5
+ export LANG
6
+ export LC_ALL
7
+ date >> /var/log/start_gestion
8
+ set >> /var/log/start_gestion
9
+ logger -s "Starting Gestion"
10
+ sleep 2
11
+ cd $( dirname $0 )/..
12
+ pwd >> /var/log/start_gestion
13
+ if pgrep -f ruby.*Gestion; then
14
+ Binaries/kill_gestion
15
+ fi
16
+ logger -s "Starting new Gestion"
17
+ sudo -i screen -S Gestion -d -s /usr/bin/bash -m $( pwd )/Binaries/loop_gestion
18
+ echo $! > /var/run/gestion.pid
@@ -0,0 +1,18 @@
1
+ #!/bin/bash
2
+
3
+ WDIR=$( dirname ${BASH_SOURCE[0]} )
4
+
5
+ if [ "$1" = "-f" ]; then
6
+ shift
7
+ $WDIR/kill_gestion
8
+ sleep 2
9
+ mv $WDIR/../data /var/tmp/data.$( date +%s )
10
+ if [ "$1" ]; then
11
+ $WDIR/restore $1
12
+ else
13
+ $WDIR/start_gestion
14
+ fi
15
+ else
16
+ echo Not doing swipe - use the '-f' parameter
17
+ exit 1
18
+ fi
@@ -0,0 +1,21 @@
1
+ #!/bin/bash
2
+
3
+ echo This is not used for the moment - just kept for
4
+ echo future reference in case the column-names need
5
+ echo to change...
6
+
7
+ exit 1
8
+
9
+ cp db.testGestion.orig db.testGestion
10
+
11
+ cat - > sqlite.cmd <<EOF
12
+ PRAGMA writable_schema = 1;
13
+ UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE "compta_accounts" ("account_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "parent_id" integer, "name" varchar(255), "desc" text, "global_id" varchar(255), "total" varchar(255), "multiplier" float, "index" integer)' WHERE NAME = 'compta_accounts';
14
+ UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE "compta_movements" ("movement_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "account_src_id" integer NOT NULL, "account_dst_id" integer NOT NULL, "value" real, "desc" varchar(255), "date" date, "revision" integer, "global_id" varchar(255), "index" integer)' WHERE NAME = 'compta_movements';
15
+ UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE "compta_users" ("user_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "full" varchar(255), "pass" varchar(255), "account_index" integer, "movement_index" integer)' WHERE NAME = 'compta_users';
16
+ PRAGMA writable_schema = 0;
17
+ .quit
18
+ EOF
19
+ echo .quit | sqlite3 -init sqlite.cmd $1
20
+
21
+ echo .dump | sqlite3 $1
@@ -0,0 +1,3 @@
1
+ !/bin/bash
2
+ wget -q -O- --post-data "username=$1&password=$2" http://cours.markas-al-nour.org/login/index.php > /dev/null
3
+ echo $@ >> /tmp/update_users
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,179 @@
1
+ <map version="0.9.0">
2
+ <!--To view this file, download free mind mapping software Freeplane from http://freeplane.sourceforge.net -->
3
+ <node TEXT="Compta" ID="ID_1373652054" CREATED="1375460748765" MODIFIED="1375460753057">
4
+ <hook NAME="MapStyle" max_node_width="600"/>
5
+ <node TEXT="Views" POSITION="right" ID="ID_1258978740" CREATED="1375460753836" MODIFIED="1375460755120">
6
+ <node TEXT="ComptaCourse" ID="ID_1947432729" CREATED="1375460758941" MODIFIED="1375460761120">
7
+ <node TEXT="Search by course" ID="ID_1172449143" CREATED="1375460762461" MODIFIED="1375460809029">
8
+ <richcontent TYPE="NOTE">
9
+ <html>
10
+ <head>
11
+
12
+ </head>
13
+ <body>
14
+ <p>
15
+ offer list like CourseTab
16
+ </p>
17
+ </body>
18
+ </html></richcontent>
19
+ </node>
20
+ <node TEXT="Search by student" ID="ID_892630374" CREATED="1375460813003" MODIFIED="1375461037857">
21
+ <richcontent TYPE="NOTE">
22
+ <html>
23
+ <head>
24
+
25
+ </head>
26
+ <body>
27
+ <p>
28
+ Updated if clicked on course
29
+ </p>
30
+ </body>
31
+ </html></richcontent>
32
+ </node>
33
+ <node TEXT="Pay" ID="ID_1998407710" CREATED="1375461037850" MODIFIED="1375461049048">
34
+ <richcontent TYPE="NOTE">
35
+ <html>
36
+ <head>
37
+
38
+ </head>
39
+ <body>
40
+ <p>
41
+ prints receit
42
+ </p>
43
+ </body>
44
+ </html></richcontent>
45
+ </node>
46
+ <node TEXT="Add manual receit" ID="ID_338147804" CREATED="1375461050161" MODIFIED="1375461053813"/>
47
+ </node>
48
+ <node TEXT="ComptaService" ID="ID_662432531" CREATED="1375460758941" MODIFIED="1375461066626">
49
+ <node TEXT="Pay" ID="ID_13579623" CREATED="1375461037850" MODIFIED="1375461049048">
50
+ <richcontent TYPE="NOTE">
51
+ <html>
52
+ <head>
53
+
54
+ </head>
55
+ <body>
56
+ <p>
57
+ prints receit
58
+ </p>
59
+ </body>
60
+ </html></richcontent>
61
+ </node>
62
+ <node TEXT="Move PersonCash" ID="ID_1926602512" CREATED="1375461086039" MODIFIED="1375461091096"/>
63
+ <node TEXT="Move SelfServices" ID="ID_1990164522" CREATED="1375461091662" MODIFIED="1375461096490"/>
64
+ <node TEXT="Add manual receit" ID="ID_919067297" CREATED="1375461050161" MODIFIED="1375461053813"/>
65
+ </node>
66
+ <node TEXT="ComptaCash" ID="ID_1584009219" CREATED="1375461111714" MODIFIED="1375461115734">
67
+ <node TEXT="Print" ID="ID_1536490968" CREATED="1375461116211" MODIFIED="1375461121590">
68
+ <node TEXT="Daily checklist" ID="ID_1033771005" CREATED="1375461121923" MODIFIED="1375461145248">
69
+ <richcontent TYPE="NOTE">
70
+ <html>
71
+ <head>
72
+
73
+ </head>
74
+ <body>
75
+ <p>
76
+ With signature for &quot;OK&quot;
77
+ </p>
78
+ <p>
79
+ Allow for printing of days, weeks
80
+ </p>
81
+ </body>
82
+ </html></richcontent>
83
+ </node>
84
+ <node TEXT="Course-lists" ID="ID_1102569461" CREATED="1375461145242" MODIFIED="1375461154495">
85
+ <richcontent TYPE="NOTE">
86
+ <html>
87
+ <head>
88
+
89
+ </head>
90
+ <body>
91
+ <p>
92
+ only print changed courses
93
+ </p>
94
+ </body>
95
+ </html></richcontent>
96
+ </node>
97
+ <node TEXT="Library-lists" ID="ID_313754190" CREATED="1375461154489" MODIFIED="1375461169062">
98
+ <richcontent TYPE="NOTE">
99
+ <html>
100
+ <head>
101
+
102
+ </head>
103
+ <body>
104
+ <p>
105
+ only print last sheet
106
+ </p>
107
+ </body>
108
+ </html></richcontent>
109
+ </node>
110
+ <node TEXT="Move SelfCash" ID="ID_604769849" CREATED="1375461169233" MODIFIED="1375461180348"/>
111
+ </node>
112
+ </node>
113
+ <node TEXT="ComptaAdmin" ID="ID_1188322166" CREATED="1379581289830" MODIFIED="1379581291833">
114
+ <node TEXT="Print manual sheets" ID="ID_397624358" CREATED="1379581365278" MODIFIED="1379581381208"/>
115
+ <node TEXT="Manage lost sheets" ID="ID_999379367" CREATED="1379581381862" MODIFIED="1379581387728"/>
116
+ </node>
117
+ <node TEXT="CourseCompta" ID="ID_892736667" CREATED="1375461216487" MODIFIED="1375461220346">
118
+ <node TEXT="Change money per course" ID="ID_1386173998" CREATED="1375461220855" MODIFIED="1375461224200"/>
119
+ <node TEXT="Move students to other courses" ID="ID_503441439" CREATED="1375461225229" MODIFIED="1375461229706"/>
120
+ </node>
121
+ <node TEXT="AdminService" ID="ID_58796879" CREATED="1375461234942" MODIFIED="1375461240600">
122
+ <node TEXT="Change costs for services" ID="ID_179134349" CREATED="1375461241150" MODIFIED="1375461249593"/>
123
+ <node TEXT="add and remove new services" ID="ID_1111616537" CREATED="1375461250414" MODIFIED="1375461303693">
124
+ <richcontent TYPE="NOTE">
125
+ <html>
126
+ <head>
127
+
128
+ </head>
129
+ <body>
130
+ <p>
131
+ Have once (special fee), multiple (CDs, print, ...), daily, weekly services
132
+ </p>
133
+ </body>
134
+ </html></richcontent>
135
+ </node>
136
+ </node>
137
+ <node TEXT="AdminAccounts" ID="ID_260369204" CREATED="1379588717973" MODIFIED="1379588721280">
138
+ <node TEXT="Edit different accounts for different services" ID="ID_657135979" CREATED="1379588721741" MODIFIED="1379588733240"/>
139
+ </node>
140
+ <node TEXT="CourseDiploma" ID="ID_1841349214" CREATED="1375461311313" MODIFIED="1375461315545">
141
+ <node TEXT="Add column &quot;paid&quot;" ID="ID_686128343" CREATED="1375461315960" MODIFIED="1375461323562"/>
142
+ </node>
143
+ <node TEXT="CourseTabs" ID="ID_1657862182" CREATED="1379583222647" MODIFIED="1379583227978">
144
+ <node TEXT="When adding, add also the corresponding account" ID="ID_1585632095" CREATED="1379583228559" MODIFIED="1379583241997"/>
145
+ </node>
146
+ </node>
147
+ <node TEXT="Payments" POSITION="left" ID="ID_1876632421" CREATED="1375461332330" MODIFIED="1375461333920">
148
+ <node TEXT="Receits" ID="ID_612380965" CREATED="1375461334372" MODIFIED="1375461336503">
149
+ <node TEXT="Is always printed out twice" ID="ID_116581679" CREATED="1375461339093" MODIFIED="1375461355658">
150
+ <richcontent TYPE="NOTE">
151
+ <html>
152
+ <head>
153
+
154
+ </head>
155
+ <body>
156
+ <p>
157
+ One for the archives, one for the student
158
+ </p>
159
+ </body>
160
+ </html></richcontent>
161
+ </node>
162
+ <node TEXT="Fields" ID="ID_1523419689" CREATED="1375461355652" MODIFIED="1375461360982">
163
+ <node TEXT="Name of student" ID="ID_1076775739" CREATED="1375461361500" MODIFIED="1375461365278"/>
164
+ <node TEXT="Name of receiver" ID="ID_576269462" CREATED="1375461366211" MODIFIED="1375461372126"/>
165
+ <node TEXT="Subject" ID="ID_529830863" CREATED="1375461376537" MODIFIED="1375461382734"/>
166
+ <node TEXT="Date" ID="ID_291785192" CREATED="1375461383115" MODIFIED="1375461384565"/>
167
+ <node TEXT="Amount" ID="ID_129543000" CREATED="1375461384875" MODIFIED="1375461386029"/>
168
+ <node TEXT="Id" ID="ID_859282044" CREATED="1375461386282" MODIFIED="1375461389358"/>
169
+ <node TEXT="QRcode for verification" ID="ID_1373775432" CREATED="1375461389866" MODIFIED="1375461393965"/>
170
+ </node>
171
+ </node>
172
+ <node TEXT="Manual receits" ID="ID_1017256078" CREATED="1375461398730" MODIFIED="1375461401571">
173
+ <node TEXT="Only printable from accountant" ID="ID_937775751" CREATED="1375461402170" MODIFIED="1375461410357"/>
174
+ <node TEXT="in case of malfunctioning" ID="ID_1382316541" CREATED="1375461411306" MODIFIED="1375461426142"/>
175
+ <node TEXT="Have signature and stamp instead of QRcode" ID="ID_677144629" CREATED="1375461426971" MODIFIED="1375461435166"/>
176
+ </node>
177
+ </node>
178
+ </node>
179
+ </map>
data/Doc/General.odt ADDED
Binary file
@@ -0,0 +1,117 @@
1
+ # Defines groups for access to the internet
2
+
3
+ class AccessGroups < Entities
4
+ def setup_data
5
+ value_str :name
6
+ value_list_single :members
7
+ value_list_drop :action, '%w( allow allow_else_block block )'
8
+ value_int :priority
9
+ value_int :limit_day_mo
10
+ value_list_single :access_times, '[]'
11
+ end
12
+
13
+ def listp_name
14
+ search_all_.sort { |a, b|
15
+ b.priority.to_i <=> a.priority.to_i
16
+ }.collect { |ag|
17
+ ag.priority ||= '10'
18
+ [ag.accessgroup_id, "#{ag.priority.rjust(2, '0')}:#{ag.name}"]
19
+ }
20
+ end
21
+
22
+ def self.allow_user(user, time)
23
+ dputs(4) { "Searching for #{user} at #{time}" }
24
+ if user.class == Person
25
+ user = user.login_name
26
+ end
27
+ search_all_.sort { |a, b|
28
+ b.priority.to_i <=> a.priority.to_i
29
+ }.each { |ag|
30
+ match_user = true
31
+ if ag.members.class == Array and ag.members.size > 0
32
+ dputs(5) { "members.index is #{ag.members.index(user).inspect}" }
33
+ match_user = ag.members.index(user) != nil
34
+ end
35
+ match_time = ag.time_in_atimes(time)
36
+ limit_ok = true
37
+ if (limit = ag.limit_day_mo.to_i) > 0
38
+ limit_ok = Network::Captive.usage_daily.to_i / 1e6 <= limit
39
+ end
40
+ dputs(4) { "Checking #{ag.name}, u,t = #{match_user},#{match_time}" }
41
+ dputs(4) { "Action is #{ag.action[0].inspect}, members = #{ag.members.inspect}" }
42
+ case ag.action[0]
43
+ when /allow_else_block/
44
+ dputs(4) { 'allow_else_block' }
45
+ return [true, "#{ag.name}"] if (match_time and match_user and limit_ok)
46
+ return [false, "Over limit of #{ag.limit_day_mo}Mo in rule **#{ag.name}**"] if not limit_ok
47
+ return [false, "Blocked by rule **#{ag.name}**"] if match_user
48
+ when /block/
49
+ dputs(4) { 'block' }
50
+ return [false, "Blocked by rule **#{ag.name}**"] if (match_time and match_user)
51
+ when /allow/
52
+ dputs(4) { 'allow' }
53
+ return [true, "#{ag.name}"] if (match_time and match_user and limit_ok)
54
+ end
55
+ }
56
+ dputs(4) { 'Nothing found - must be OK' }
57
+ return [true, 'default']
58
+ end
59
+
60
+ def self.allow_user_now(user)
61
+ self.allow_user(user, Time.now)
62
+ end
63
+ end
64
+
65
+ class AccessGroup < Entity
66
+
67
+ def self.time_in_atime(t, a)
68
+ dow_raw, start_raw, stop_raw = a.split(';')
69
+ {:di => 0, :lu => 1, :ma => 2, :me => 3, :je => 4, :ve => 5, :sa => 6}.each { |k, v|
70
+ dow_raw.gsub!(/#{k}/, "#{v}")
71
+ }
72
+ dputs(4) { "dow_raw is #{dow_raw}" }
73
+ dow = []
74
+ dow_raw.split(',').each { |d|
75
+ if d =~ /(.)-(.)/
76
+ b, e = $1.to_i, $2.to_i
77
+ if e < b
78
+ e += 7
79
+ end
80
+ (b..e).each { |i|
81
+ dow.push(i % 7)
82
+ }
83
+ else
84
+ dow.push d.to_i
85
+ end
86
+ }
87
+ start_raw = start_raw.split(':')
88
+ start = start_raw[0].to_i * 60 + start_raw[1].to_i
89
+ stop_raw = stop_raw.split(':')
90
+ stop = stop_raw[0].to_i * 60 + stop_raw[1].to_i
91
+ if stop == 0
92
+ stop = 24 * 60
93
+ end
94
+ time = t.hour * 60 + t.min
95
+ time_dow = t.wday
96
+ dputs(4) { "dow:#{dow.inspect} - start:#{start} - stop:#{stop}" }
97
+ dputs(4) { "time: #{time} - time_dow:#{time_dow}" }
98
+
99
+ # If we start in the evening and end in the morning...
100
+ if start > stop and time < stop
101
+ return (dow.index((time_dow + 6) % 7)) != nil
102
+ end
103
+ (dow.index(time_dow) and start <= time and time < stop) == true
104
+ end
105
+
106
+ def time_in_atimes(t)
107
+ if access_times
108
+ ret = false
109
+ access_times.each { |a|
110
+ ret = (ret or AccessGroup.time_in_atime(t, a))
111
+ }
112
+ return ret
113
+ else
114
+ return true
115
+ end
116
+ end
117
+ end