ig3tool 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ig3tool +17 -21
- data/lib/actions/bib.rb +295 -0
- data/lib/actions/bitching.rb +19 -0
- data/lib/actions/cultuur.rb +3 -0
- data/lib/actions/interne.rb +98 -0
- data/lib/actions/kaching.rb +90 -0
- data/lib/actions/people.rb +178 -0
- data/lib/actions/printing.rb +125 -0
- data/lib/actions/product.rb +154 -0
- data/lib/bib.rb +94 -0
- data/lib/billing.rb +112 -0
- data/lib/bitching.rb +49 -0
- data/lib/config.rb +19 -0
- data/lib/glade/cola_light_small.png +0 -0
- data/lib/glade/cola_light_xsmall.png +0 -0
- data/lib/glade/cola_small.png +0 -0
- data/lib/glade/cola_xsmall.png +0 -0
- data/lib/glade/doos_small.png +0 -0
- data/lib/glade/doos_xsmall.png +0 -0
- data/lib/glade/icons/cola_light_small.png +0 -0
- data/lib/glade/icons/cola_light_xsmall.png +0 -0
- data/lib/glade/icons/cola_small.png +0 -0
- data/lib/glade/icons/cola_xsmall.png +0 -0
- data/lib/glade/icons/doos_small.png +0 -0
- data/lib/glade/icons/doos_xsmall.png +0 -0
- data/lib/glade/icons/piggy_small.png +0 -0
- data/lib/glade/icons/piggy_xsmall.png +0 -0
- data/lib/glade/money_small.png +0 -0
- data/lib/glade/money_xsmall.png +0 -0
- data/lib/glade/newinterne.glade +504 -0
- data/lib/glade/piggy_small.png +0 -0
- data/lib/glade/piggy_xsmall.png +0 -0
- data/lib/glade/sales.glade +89 -87
- data/lib/horrible_hack.rb +15 -0
- data/lib/interne.rb +111 -0
- data/lib/ldap.rb +104 -0
- data/lib/log.rb +25 -0
- data/lib/membership.rb +32 -0
- data/lib/mymd5.rb +95 -0
- data/lib/people.rb +143 -0
- data/lib/printing.rb +238 -0
- data/lib/request.rb +14 -0
- data/lib/sales.rb +158 -0
- data/lib/ui/automaatwindow.rb +2 -2
- data/lib/ui/bibliotheekwindow.rb +16 -17
- data/lib/ui/bibwindow.rb +15 -15
- data/lib/ui/gladehelper.rb +20 -6
- data/lib/ui/internewindow.rb +12 -9
- data/lib/ui/loginwindow.rb +2 -4
- data/lib/ui/memberswindow.rb +9 -9
- data/lib/ui/newinterne.rb +258 -0
- data/lib/ui/peoplewindow.rb +14 -16
- data/lib/ui/printenwindow.rb +11 -11
- data/lib/ui/printingwindow.rb +19 -20
- data/lib/ui/productswindow.rb +27 -15
- data/lib/ui/saleswindow.rb +21 -8
- data/lib/ui/toolwindow.rb +5 -3
- data/lib/utils.rb +106 -0
- data/lib/web.rb +98 -0
- metadata +48 -3
Binary file
|
Binary file
|
data/lib/glade/sales.glade
CHANGED
@@ -17,19 +17,6 @@
|
|
17
17
|
<property name="n_columns">4</property>
|
18
18
|
<property name="column_spacing">12</property>
|
19
19
|
<property name="row_spacing">6</property>
|
20
|
-
<child>
|
21
|
-
<widget class="GtkComboBox" id="debugger">
|
22
|
-
<property name="visible">True</property>
|
23
|
-
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
24
|
-
<property name="active">0</property>
|
25
|
-
</widget>
|
26
|
-
<packing>
|
27
|
-
<property name="left_attach">1</property>
|
28
|
-
<property name="right_attach">2</property>
|
29
|
-
<property name="top_attach">1</property>
|
30
|
-
<property name="bottom_attach">2</property>
|
31
|
-
</packing>
|
32
|
-
</child>
|
33
20
|
<child>
|
34
21
|
<placeholder/>
|
35
22
|
</child>
|
@@ -43,37 +30,40 @@
|
|
43
30
|
<placeholder/>
|
44
31
|
</child>
|
45
32
|
<child>
|
46
|
-
<widget class="
|
33
|
+
<widget class="GtkLabel" id="label6">
|
47
34
|
<property name="visible">True</property>
|
48
|
-
<property name="
|
49
|
-
<
|
35
|
+
<property name="xalign">0</property>
|
36
|
+
<property name="label" translatable="yes">Debugger:</property>
|
50
37
|
</widget>
|
51
38
|
<packing>
|
52
|
-
<property name="
|
53
|
-
<property name="
|
39
|
+
<property name="top_attach">1</property>
|
40
|
+
<property name="bottom_attach">2</property>
|
41
|
+
<property name="x_options">GTK_FILL</property>
|
54
42
|
<property name="y_options"></property>
|
55
43
|
</packing>
|
56
44
|
</child>
|
57
45
|
<child>
|
58
|
-
<widget class="
|
46
|
+
<widget class="GtkEntry" id="count">
|
59
47
|
<property name="visible">True</property>
|
60
|
-
<property name="
|
61
|
-
<property name="
|
48
|
+
<property name="can_focus">True</property>
|
49
|
+
<property name="text" translatable="yes">1</property>
|
50
|
+
<signal name="activate" handler="count_activate"/>
|
62
51
|
</widget>
|
63
52
|
<packing>
|
64
|
-
<property name="
|
53
|
+
<property name="left_attach">1</property>
|
54
|
+
<property name="right_attach">2</property>
|
55
|
+
<property name="top_attach">2</property>
|
56
|
+
<property name="bottom_attach">3</property>
|
65
57
|
<property name="y_options"></property>
|
66
58
|
</packing>
|
67
59
|
</child>
|
68
60
|
<child>
|
69
|
-
<widget class="GtkLabel" id="
|
61
|
+
<widget class="GtkLabel" id="label5">
|
70
62
|
<property name="visible">True</property>
|
71
63
|
<property name="xalign">0</property>
|
72
|
-
<property name="label" translatable="yes">
|
64
|
+
<property name="label" translatable="yes">Aantal:</property>
|
73
65
|
</widget>
|
74
66
|
<packing>
|
75
|
-
<property name="left_attach">2</property>
|
76
|
-
<property name="right_attach">3</property>
|
77
67
|
<property name="top_attach">2</property>
|
78
68
|
<property name="bottom_attach">3</property>
|
79
69
|
<property name="x_options">GTK_FILL</property>
|
@@ -85,7 +75,8 @@
|
|
85
75
|
<property name="visible">True</property>
|
86
76
|
<property name="active">0</property>
|
87
77
|
<property name="items" translatable="yes">non member
|
88
|
-
member
|
78
|
+
member
|
79
|
+
debugger</property>
|
89
80
|
<child internal-child="entry">
|
90
81
|
<widget class="GtkEntry" id="comboboxentry-entry1">
|
91
82
|
<property name="text" translatable="yes">non member</property>
|
@@ -102,12 +93,14 @@ member</property>
|
|
102
93
|
</packing>
|
103
94
|
</child>
|
104
95
|
<child>
|
105
|
-
<widget class="GtkLabel" id="
|
96
|
+
<widget class="GtkLabel" id="label7">
|
106
97
|
<property name="visible">True</property>
|
107
98
|
<property name="xalign">0</property>
|
108
|
-
<property name="label" translatable="yes">
|
99
|
+
<property name="label" translatable="yes">Lid:</property>
|
109
100
|
</widget>
|
110
101
|
<packing>
|
102
|
+
<property name="left_attach">2</property>
|
103
|
+
<property name="right_attach">3</property>
|
111
104
|
<property name="top_attach">2</property>
|
112
105
|
<property name="bottom_attach">3</property>
|
113
106
|
<property name="x_options">GTK_FILL</property>
|
@@ -115,31 +108,40 @@ member</property>
|
|
115
108
|
</packing>
|
116
109
|
</child>
|
117
110
|
<child>
|
118
|
-
<widget class="
|
111
|
+
<widget class="GtkLabel" id="label1">
|
112
|
+
<property name="visible">True</property>
|
113
|
+
<property name="xalign">0</property>
|
114
|
+
<property name="label" translatable="yes">Smartzap:</property>
|
115
|
+
</widget>
|
116
|
+
<packing>
|
117
|
+
<property name="x_options">GTK_FILL</property>
|
118
|
+
<property name="y_options"></property>
|
119
|
+
</packing>
|
120
|
+
</child>
|
121
|
+
<child>
|
122
|
+
<widget class="GtkEntry" id="smartzap">
|
119
123
|
<property name="visible">True</property>
|
120
124
|
<property name="can_focus">True</property>
|
121
|
-
<
|
122
|
-
<signal name="activate" handler="count_activate"/>
|
125
|
+
<signal name="activate" handler="smartzap_activate"/>
|
123
126
|
</widget>
|
124
127
|
<packing>
|
125
128
|
<property name="left_attach">1</property>
|
126
129
|
<property name="right_attach">2</property>
|
127
|
-
<property name="top_attach">2</property>
|
128
|
-
<property name="bottom_attach">3</property>
|
129
130
|
<property name="y_options"></property>
|
130
131
|
</packing>
|
131
132
|
</child>
|
132
133
|
<child>
|
133
|
-
<widget class="
|
134
|
+
<widget class="GtkComboBox" id="debugger">
|
134
135
|
<property name="visible">True</property>
|
135
|
-
<property name="
|
136
|
-
<property name="
|
136
|
+
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
137
|
+
<property name="active">0</property>
|
138
|
+
<signal name="changed" handler="debugger_changed"/>
|
137
139
|
</widget>
|
138
140
|
<packing>
|
141
|
+
<property name="left_attach">1</property>
|
142
|
+
<property name="right_attach">2</property>
|
139
143
|
<property name="top_attach">1</property>
|
140
144
|
<property name="bottom_attach">2</property>
|
141
|
-
<property name="x_options">GTK_FILL</property>
|
142
|
-
<property name="y_options"></property>
|
143
145
|
</packing>
|
144
146
|
</child>
|
145
147
|
</widget>
|
@@ -220,27 +222,33 @@ member</property>
|
|
220
222
|
<property name="column_spacing">6</property>
|
221
223
|
<property name="row_spacing">3</property>
|
222
224
|
<child>
|
223
|
-
<widget class="
|
225
|
+
<widget class="GtkEntry" id="change">
|
224
226
|
<property name="visible">True</property>
|
225
|
-
<property name="
|
226
|
-
<property name="
|
227
|
+
<property name="can_focus">True</property>
|
228
|
+
<property name="editable">False</property>
|
229
|
+
<property name="has_frame">False</property>
|
230
|
+
<property name="width_chars">9</property>
|
227
231
|
</widget>
|
228
232
|
<packing>
|
229
|
-
<property name="left_attach">
|
230
|
-
<property name="right_attach">
|
233
|
+
<property name="left_attach">1</property>
|
234
|
+
<property name="right_attach">2</property>
|
235
|
+
<property name="top_attach">2</property>
|
236
|
+
<property name="bottom_attach">3</property>
|
231
237
|
<property name="x_options">GTK_FILL</property>
|
232
238
|
<property name="y_options"></property>
|
233
239
|
</packing>
|
234
240
|
</child>
|
235
241
|
<child>
|
236
|
-
<widget class="
|
242
|
+
<widget class="GtkEntry" id="paid">
|
237
243
|
<property name="visible">True</property>
|
238
|
-
<property name="
|
239
|
-
<property name="
|
244
|
+
<property name="can_focus">True</property>
|
245
|
+
<property name="has_frame">False</property>
|
246
|
+
<property name="width_chars">9</property>
|
247
|
+
<signal name="changed" handler="price_entries_changed"/>
|
240
248
|
</widget>
|
241
249
|
<packing>
|
242
|
-
<property name="left_attach">
|
243
|
-
<property name="right_attach">
|
250
|
+
<property name="left_attach">1</property>
|
251
|
+
<property name="right_attach">2</property>
|
244
252
|
<property name="top_attach">1</property>
|
245
253
|
<property name="bottom_attach">2</property>
|
246
254
|
<property name="x_options">GTK_FILL</property>
|
@@ -248,27 +256,31 @@ member</property>
|
|
248
256
|
</packing>
|
249
257
|
</child>
|
250
258
|
<child>
|
251
|
-
<widget class="
|
259
|
+
<widget class="GtkEntry" id="total">
|
252
260
|
<property name="visible">True</property>
|
253
|
-
<property name="
|
254
|
-
<property name="
|
261
|
+
<property name="can_focus">True</property>
|
262
|
+
<property name="editable">False</property>
|
263
|
+
<property name="has_frame">False</property>
|
264
|
+
<property name="width_chars">9</property>
|
265
|
+
<property name="text" translatable="yes">0.00</property>
|
266
|
+
<signal name="changed" handler="price_entries_changed"/>
|
255
267
|
</widget>
|
256
268
|
<packing>
|
257
|
-
<property name="left_attach">
|
258
|
-
<property name="right_attach">
|
259
|
-
<property name="top_attach">2</property>
|
260
|
-
<property name="bottom_attach">3</property>
|
269
|
+
<property name="left_attach">1</property>
|
270
|
+
<property name="right_attach">2</property>
|
261
271
|
<property name="x_options">GTK_FILL</property>
|
262
272
|
<property name="y_options"></property>
|
263
273
|
</packing>
|
264
274
|
</child>
|
265
275
|
<child>
|
266
|
-
<widget class="GtkLabel" id="
|
276
|
+
<widget class="GtkLabel" id="label14">
|
267
277
|
<property name="visible">True</property>
|
268
278
|
<property name="xalign">0</property>
|
269
|
-
<property name="label" translatable="yes">
|
279
|
+
<property name="label" translatable="yes">Terug:</property>
|
270
280
|
</widget>
|
271
281
|
<packing>
|
282
|
+
<property name="top_attach">2</property>
|
283
|
+
<property name="bottom_attach">3</property>
|
272
284
|
<property name="x_options">GTK_FILL</property>
|
273
285
|
<property name="y_options"></property>
|
274
286
|
</packing>
|
@@ -287,46 +299,40 @@ member</property>
|
|
287
299
|
</packing>
|
288
300
|
</child>
|
289
301
|
<child>
|
290
|
-
<widget class="GtkLabel" id="
|
302
|
+
<widget class="GtkLabel" id="label12">
|
291
303
|
<property name="visible">True</property>
|
292
304
|
<property name="xalign">0</property>
|
293
|
-
<property name="label" translatable="yes">
|
305
|
+
<property name="label" translatable="yes">Totaal:</property>
|
294
306
|
</widget>
|
295
307
|
<packing>
|
296
|
-
<property name="top_attach">2</property>
|
297
|
-
<property name="bottom_attach">3</property>
|
298
308
|
<property name="x_options">GTK_FILL</property>
|
299
309
|
<property name="y_options"></property>
|
300
310
|
</packing>
|
301
311
|
</child>
|
302
312
|
<child>
|
303
|
-
<widget class="
|
313
|
+
<widget class="GtkLabel" id="label11">
|
304
314
|
<property name="visible">True</property>
|
305
|
-
<property name="
|
306
|
-
<property name="
|
307
|
-
<property name="has_frame">False</property>
|
308
|
-
<property name="width_chars">9</property>
|
309
|
-
<property name="text" translatable="yes">0.00</property>
|
310
|
-
<signal name="changed" handler="price_entries_changed"/>
|
315
|
+
<property name="xalign">0</property>
|
316
|
+
<property name="label" translatable="yes">€</property>
|
311
317
|
</widget>
|
312
318
|
<packing>
|
313
|
-
<property name="left_attach">
|
314
|
-
<property name="right_attach">
|
319
|
+
<property name="left_attach">2</property>
|
320
|
+
<property name="right_attach">3</property>
|
321
|
+
<property name="top_attach">2</property>
|
322
|
+
<property name="bottom_attach">3</property>
|
315
323
|
<property name="x_options">GTK_FILL</property>
|
316
324
|
<property name="y_options"></property>
|
317
325
|
</packing>
|
318
326
|
</child>
|
319
327
|
<child>
|
320
|
-
<widget class="
|
328
|
+
<widget class="GtkLabel" id="label10">
|
321
329
|
<property name="visible">True</property>
|
322
|
-
<property name="
|
323
|
-
<property name="
|
324
|
-
<property name="width_chars">9</property>
|
325
|
-
<signal name="changed" handler="price_entries_changed"/>
|
330
|
+
<property name="xalign">0</property>
|
331
|
+
<property name="label" translatable="yes">€</property>
|
326
332
|
</widget>
|
327
333
|
<packing>
|
328
|
-
<property name="left_attach">
|
329
|
-
<property name="right_attach">
|
334
|
+
<property name="left_attach">2</property>
|
335
|
+
<property name="right_attach">3</property>
|
330
336
|
<property name="top_attach">1</property>
|
331
337
|
<property name="bottom_attach">2</property>
|
332
338
|
<property name="x_options">GTK_FILL</property>
|
@@ -334,18 +340,14 @@ member</property>
|
|
334
340
|
</packing>
|
335
341
|
</child>
|
336
342
|
<child>
|
337
|
-
<widget class="
|
343
|
+
<widget class="GtkLabel" id="label9">
|
338
344
|
<property name="visible">True</property>
|
339
|
-
<property name="
|
340
|
-
<property name="
|
341
|
-
<property name="has_frame">False</property>
|
342
|
-
<property name="width_chars">9</property>
|
345
|
+
<property name="xalign">0</property>
|
346
|
+
<property name="label" translatable="yes">€</property>
|
343
347
|
</widget>
|
344
348
|
<packing>
|
345
|
-
<property name="left_attach">
|
346
|
-
<property name="right_attach">
|
347
|
-
<property name="top_attach">2</property>
|
348
|
-
<property name="bottom_attach">3</property>
|
349
|
+
<property name="left_attach">2</property>
|
350
|
+
<property name="right_attach">3</property>
|
349
351
|
<property name="x_options">GTK_FILL</property>
|
350
352
|
<property name="y_options"></property>
|
351
353
|
</packing>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Base
|
3
|
+
# Deze methode laat toe TOCH primary keys te hebben.
|
4
|
+
def self.set_nonauto_primary_key(field)
|
5
|
+
set_primary_key field
|
6
|
+
define_method (field.to_s+"_before_type_cast").to_sym do; end
|
7
|
+
alias_method field.to_s+"=", :id=
|
8
|
+
end
|
9
|
+
|
10
|
+
def attributes_protected_by_default
|
11
|
+
[] # STERF.
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
data/lib/interne.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
module Ig3tool
|
2
|
+
class Interne < ActiveRecord::Base
|
3
|
+
|
4
|
+
set_table_name "internes"
|
5
|
+
set_nonauto_primary_key "username"
|
6
|
+
|
7
|
+
belongs_to :person,
|
8
|
+
:class_name => "Person",
|
9
|
+
:foreign_key => "username"
|
10
|
+
|
11
|
+
validates_uniqueness_of :username
|
12
|
+
validates_presence_of :username, :saldo, :afgesloten, :person
|
13
|
+
|
14
|
+
|
15
|
+
def afgesloten?
|
16
|
+
not afgesloten.zero?
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def print(amount, message)
|
21
|
+
check_amount(amount)
|
22
|
+
log_transaction(amount, self.username, "IG Printsys", message)
|
23
|
+
decrease(amount)
|
24
|
+
end
|
25
|
+
|
26
|
+
def refundprint(amount, message)
|
27
|
+
check_amount(amount)
|
28
|
+
log_transaction(amount, "IG Printsys", self.username, message)
|
29
|
+
increase(amount)
|
30
|
+
end
|
31
|
+
|
32
|
+
def buy(amount, message)
|
33
|
+
check_amount(amount)
|
34
|
+
log_transaction(amount, self.username, "IG Shop", message)
|
35
|
+
decrease(amount)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def deposit(who, amount, message)
|
40
|
+
check_amount(amount)
|
41
|
+
log_transaction(amount, who, self.username, message)
|
42
|
+
increase(amount)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def retract(who, amount, message)
|
47
|
+
check_amount(amount)
|
48
|
+
log_transaction(amount, self.username, who, message)
|
49
|
+
decrease(amount)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def log_transaction(amount, from, to, message)
|
56
|
+
it = InterneTransaction.new
|
57
|
+
it.donor = from
|
58
|
+
it.recipient = to
|
59
|
+
it.amount = amount
|
60
|
+
it.time = Time.now
|
61
|
+
it.message = message
|
62
|
+
it.save!
|
63
|
+
end
|
64
|
+
|
65
|
+
def check_amount(amount)
|
66
|
+
if amount < 0
|
67
|
+
raise NoPositiveAmount
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
# XXX : send automatic warning mail when saldo < 0 :)
|
74
|
+
# muhahaha
|
75
|
+
def decrease(amount)
|
76
|
+
if not afgesloten?
|
77
|
+
Interne.transaction do
|
78
|
+
reload()
|
79
|
+
self.saldo -= amount
|
80
|
+
save!
|
81
|
+
end
|
82
|
+
else
|
83
|
+
raise Afgesloten
|
84
|
+
end
|
85
|
+
rescue
|
86
|
+
raise TransactionFailed
|
87
|
+
end
|
88
|
+
|
89
|
+
def increase(amount)
|
90
|
+
if not afgesloten?
|
91
|
+
Interne.transaction do
|
92
|
+
reload()
|
93
|
+
self.saldo += amount
|
94
|
+
save!
|
95
|
+
end
|
96
|
+
else
|
97
|
+
raise Afgesloten
|
98
|
+
end
|
99
|
+
rescue
|
100
|
+
raise TransactionFailed
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
class InterneTransaction < ActiveRecord::Base
|
105
|
+
|
106
|
+
set_table_name "internes_transactions"
|
107
|
+
validates_presence_of :amount, :time, :message, :donor, :recipient
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|