ig3tool 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ig3tool +1 -1
- data/lib/glade/sales.glade +84 -84
- data/lib/ui/{internewindow.rb → OLD_internewindow.rb} +0 -0
- data/lib/ui/{memberswindow.rb → OLD_memberswindow.rb} +0 -0
- data/lib/ui/{productswindow.rb → OLD_productswindow.rb} +0 -0
- data/lib/ui/gladehelper.rb +3 -2
- data/lib/ui/{newinterne.rb → interne.rb} +2 -1
- data/lib/ui/peoplewindow.rb +1 -1
- data/lib/ui/printingwindow.rb +6 -6
- data/lib/ui/protjes.rb +6 -0
- data/lib/ui/saleswindow.rb +72 -25
- data/lib/ui/toolwindow.rb +3 -3
- metadata +70 -95
- data/lib/actions/bib.rb +0 -295
- data/lib/actions/bitching.rb +0 -19
- data/lib/actions/cultuur.rb +0 -3
- data/lib/actions/interne.rb +0 -98
- data/lib/actions/kaching.rb +0 -90
- data/lib/actions/people.rb +0 -178
- data/lib/actions/printing.rb +0 -125
- data/lib/actions/product.rb +0 -154
- data/lib/bib.rb +0 -94
- data/lib/billing.rb +0 -112
- data/lib/bitching.rb +0 -49
- data/lib/config.rb +0 -19
- data/lib/horrible_hack.rb +0 -15
- data/lib/interne.rb +0 -111
- data/lib/ldap.rb +0 -104
- data/lib/log.rb +0 -25
- data/lib/membership.rb +0 -32
- data/lib/mymd5.rb +0 -95
- data/lib/people.rb +0 -143
- data/lib/printing.rb +0 -238
- data/lib/request.rb +0 -14
- data/lib/sales.rb +0 -158
- data/lib/utils.rb +0 -106
- data/lib/web.rb +0 -98
data/bin/ig3tool
CHANGED
data/lib/glade/sales.glade
CHANGED
@@ -30,51 +30,40 @@
|
|
30
30
|
<placeholder/>
|
31
31
|
</child>
|
32
32
|
<child>
|
33
|
-
<widget class="
|
33
|
+
<widget class="GtkLabel" id="label6">
|
34
34
|
<property name="visible">True</property>
|
35
|
-
<property name="
|
36
|
-
<property name="
|
37
|
-
<signal name="changed" handler="debugger_changed"/>
|
35
|
+
<property name="xalign">0</property>
|
36
|
+
<property name="label" translatable="yes">Debugger:</property>
|
38
37
|
</widget>
|
39
38
|
<packing>
|
40
|
-
<property name="left_attach">1</property>
|
41
|
-
<property name="right_attach">2</property>
|
42
39
|
<property name="top_attach">1</property>
|
43
40
|
<property name="bottom_attach">2</property>
|
41
|
+
<property name="x_options">GTK_FILL</property>
|
42
|
+
<property name="y_options"></property>
|
44
43
|
</packing>
|
45
44
|
</child>
|
46
45
|
<child>
|
47
|
-
<widget class="GtkEntry" id="
|
46
|
+
<widget class="GtkEntry" id="count">
|
48
47
|
<property name="visible">True</property>
|
49
48
|
<property name="can_focus">True</property>
|
50
|
-
<
|
49
|
+
<property name="text" translatable="yes">1</property>
|
50
|
+
<signal name="activate" handler="count_activate"/>
|
51
51
|
</widget>
|
52
52
|
<packing>
|
53
53
|
<property name="left_attach">1</property>
|
54
54
|
<property name="right_attach">2</property>
|
55
|
+
<property name="top_attach">2</property>
|
56
|
+
<property name="bottom_attach">3</property>
|
55
57
|
<property name="y_options"></property>
|
56
58
|
</packing>
|
57
59
|
</child>
|
58
60
|
<child>
|
59
|
-
<widget class="GtkLabel" id="
|
60
|
-
<property name="visible">True</property>
|
61
|
-
<property name="xalign">0</property>
|
62
|
-
<property name="label" translatable="yes">Smartzap:</property>
|
63
|
-
</widget>
|
64
|
-
<packing>
|
65
|
-
<property name="x_options">GTK_FILL</property>
|
66
|
-
<property name="y_options"></property>
|
67
|
-
</packing>
|
68
|
-
</child>
|
69
|
-
<child>
|
70
|
-
<widget class="GtkLabel" id="label7">
|
61
|
+
<widget class="GtkLabel" id="label5">
|
71
62
|
<property name="visible">True</property>
|
72
63
|
<property name="xalign">0</property>
|
73
|
-
<property name="label" translatable="yes">
|
64
|
+
<property name="label" translatable="yes">Aantal:</property>
|
74
65
|
</widget>
|
75
66
|
<packing>
|
76
|
-
<property name="left_attach">2</property>
|
77
|
-
<property name="right_attach">3</property>
|
78
67
|
<property name="top_attach">2</property>
|
79
68
|
<property name="bottom_attach">3</property>
|
80
69
|
<property name="x_options">GTK_FILL</property>
|
@@ -86,8 +75,8 @@
|
|
86
75
|
<property name="visible">True</property>
|
87
76
|
<property name="active">0</property>
|
88
77
|
<property name="items" translatable="yes">non member
|
89
|
-
member
|
90
78
|
debugger</property>
|
79
|
+
<signal name="changed" handler="member_changed"/>
|
91
80
|
<child internal-child="entry">
|
92
81
|
<widget class="GtkEntry" id="comboboxentry-entry1">
|
93
82
|
<property name="text" translatable="yes">non member</property>
|
@@ -104,12 +93,14 @@ debugger</property>
|
|
104
93
|
</packing>
|
105
94
|
</child>
|
106
95
|
<child>
|
107
|
-
<widget class="GtkLabel" id="
|
96
|
+
<widget class="GtkLabel" id="label7">
|
108
97
|
<property name="visible">True</property>
|
109
98
|
<property name="xalign">0</property>
|
110
|
-
<property name="label" translatable="yes">
|
99
|
+
<property name="label" translatable="yes">Lid:</property>
|
111
100
|
</widget>
|
112
101
|
<packing>
|
102
|
+
<property name="left_attach">2</property>
|
103
|
+
<property name="right_attach">3</property>
|
113
104
|
<property name="top_attach">2</property>
|
114
105
|
<property name="bottom_attach">3</property>
|
115
106
|
<property name="x_options">GTK_FILL</property>
|
@@ -117,31 +108,40 @@ debugger</property>
|
|
117
108
|
</packing>
|
118
109
|
</child>
|
119
110
|
<child>
|
120
|
-
<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">
|
121
123
|
<property name="visible">True</property>
|
122
124
|
<property name="can_focus">True</property>
|
123
|
-
<
|
124
|
-
<signal name="activate" handler="count_activate"/>
|
125
|
+
<signal name="activate" handler="smartzap_activate"/>
|
125
126
|
</widget>
|
126
127
|
<packing>
|
127
128
|
<property name="left_attach">1</property>
|
128
129
|
<property name="right_attach">2</property>
|
129
|
-
<property name="top_attach">2</property>
|
130
|
-
<property name="bottom_attach">3</property>
|
131
130
|
<property name="y_options"></property>
|
132
131
|
</packing>
|
133
132
|
</child>
|
134
133
|
<child>
|
135
|
-
<widget class="
|
134
|
+
<widget class="GtkComboBox" id="debugger">
|
136
135
|
<property name="visible">True</property>
|
137
|
-
<property name="
|
138
|
-
<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"/>
|
139
139
|
</widget>
|
140
140
|
<packing>
|
141
|
+
<property name="left_attach">1</property>
|
142
|
+
<property name="right_attach">2</property>
|
141
143
|
<property name="top_attach">1</property>
|
142
144
|
<property name="bottom_attach">2</property>
|
143
|
-
<property name="x_options">GTK_FILL</property>
|
144
|
-
<property name="y_options"></property>
|
145
145
|
</packing>
|
146
146
|
</child>
|
147
147
|
</widget>
|
@@ -222,27 +222,33 @@ debugger</property>
|
|
222
222
|
<property name="column_spacing">6</property>
|
223
223
|
<property name="row_spacing">3</property>
|
224
224
|
<child>
|
225
|
-
<widget class="
|
225
|
+
<widget class="GtkEntry" id="change">
|
226
226
|
<property name="visible">True</property>
|
227
|
-
<property name="
|
228
|
-
<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>
|
229
231
|
</widget>
|
230
232
|
<packing>
|
231
|
-
<property name="left_attach">
|
232
|
-
<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>
|
233
237
|
<property name="x_options">GTK_FILL</property>
|
234
238
|
<property name="y_options"></property>
|
235
239
|
</packing>
|
236
240
|
</child>
|
237
241
|
<child>
|
238
|
-
<widget class="
|
242
|
+
<widget class="GtkEntry" id="paid">
|
239
243
|
<property name="visible">True</property>
|
240
|
-
<property name="
|
241
|
-
<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"/>
|
242
248
|
</widget>
|
243
249
|
<packing>
|
244
|
-
<property name="left_attach">
|
245
|
-
<property name="right_attach">
|
250
|
+
<property name="left_attach">1</property>
|
251
|
+
<property name="right_attach">2</property>
|
246
252
|
<property name="top_attach">1</property>
|
247
253
|
<property name="bottom_attach">2</property>
|
248
254
|
<property name="x_options">GTK_FILL</property>
|
@@ -250,27 +256,31 @@ debugger</property>
|
|
250
256
|
</packing>
|
251
257
|
</child>
|
252
258
|
<child>
|
253
|
-
<widget class="
|
259
|
+
<widget class="GtkEntry" id="total">
|
254
260
|
<property name="visible">True</property>
|
255
|
-
<property name="
|
256
|
-
<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"/>
|
257
267
|
</widget>
|
258
268
|
<packing>
|
259
|
-
<property name="left_attach">
|
260
|
-
<property name="right_attach">
|
261
|
-
<property name="top_attach">2</property>
|
262
|
-
<property name="bottom_attach">3</property>
|
269
|
+
<property name="left_attach">1</property>
|
270
|
+
<property name="right_attach">2</property>
|
263
271
|
<property name="x_options">GTK_FILL</property>
|
264
272
|
<property name="y_options"></property>
|
265
273
|
</packing>
|
266
274
|
</child>
|
267
275
|
<child>
|
268
|
-
<widget class="GtkLabel" id="
|
276
|
+
<widget class="GtkLabel" id="label14">
|
269
277
|
<property name="visible">True</property>
|
270
278
|
<property name="xalign">0</property>
|
271
|
-
<property name="label" translatable="yes">
|
279
|
+
<property name="label" translatable="yes">Terug:</property>
|
272
280
|
</widget>
|
273
281
|
<packing>
|
282
|
+
<property name="top_attach">2</property>
|
283
|
+
<property name="bottom_attach">3</property>
|
274
284
|
<property name="x_options">GTK_FILL</property>
|
275
285
|
<property name="y_options"></property>
|
276
286
|
</packing>
|
@@ -289,46 +299,40 @@ debugger</property>
|
|
289
299
|
</packing>
|
290
300
|
</child>
|
291
301
|
<child>
|
292
|
-
<widget class="GtkLabel" id="
|
302
|
+
<widget class="GtkLabel" id="label12">
|
293
303
|
<property name="visible">True</property>
|
294
304
|
<property name="xalign">0</property>
|
295
|
-
<property name="label" translatable="yes">
|
305
|
+
<property name="label" translatable="yes">Totaal:</property>
|
296
306
|
</widget>
|
297
307
|
<packing>
|
298
|
-
<property name="top_attach">2</property>
|
299
|
-
<property name="bottom_attach">3</property>
|
300
308
|
<property name="x_options">GTK_FILL</property>
|
301
309
|
<property name="y_options"></property>
|
302
310
|
</packing>
|
303
311
|
</child>
|
304
312
|
<child>
|
305
|
-
<widget class="
|
313
|
+
<widget class="GtkLabel" id="label11">
|
306
314
|
<property name="visible">True</property>
|
307
|
-
<property name="
|
308
|
-
<property name="
|
309
|
-
<property name="has_frame">False</property>
|
310
|
-
<property name="width_chars">9</property>
|
311
|
-
<property name="text" translatable="yes">0.00</property>
|
312
|
-
<signal name="changed" handler="price_entries_changed"/>
|
315
|
+
<property name="xalign">0</property>
|
316
|
+
<property name="label" translatable="yes">€</property>
|
313
317
|
</widget>
|
314
318
|
<packing>
|
315
|
-
<property name="left_attach">
|
316
|
-
<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>
|
317
323
|
<property name="x_options">GTK_FILL</property>
|
318
324
|
<property name="y_options"></property>
|
319
325
|
</packing>
|
320
326
|
</child>
|
321
327
|
<child>
|
322
|
-
<widget class="
|
328
|
+
<widget class="GtkLabel" id="label10">
|
323
329
|
<property name="visible">True</property>
|
324
|
-
<property name="
|
325
|
-
<property name="
|
326
|
-
<property name="width_chars">9</property>
|
327
|
-
<signal name="changed" handler="price_entries_changed"/>
|
330
|
+
<property name="xalign">0</property>
|
331
|
+
<property name="label" translatable="yes">€</property>
|
328
332
|
</widget>
|
329
333
|
<packing>
|
330
|
-
<property name="left_attach">
|
331
|
-
<property name="right_attach">
|
334
|
+
<property name="left_attach">2</property>
|
335
|
+
<property name="right_attach">3</property>
|
332
336
|
<property name="top_attach">1</property>
|
333
337
|
<property name="bottom_attach">2</property>
|
334
338
|
<property name="x_options">GTK_FILL</property>
|
@@ -336,18 +340,14 @@ debugger</property>
|
|
336
340
|
</packing>
|
337
341
|
</child>
|
338
342
|
<child>
|
339
|
-
<widget class="
|
343
|
+
<widget class="GtkLabel" id="label9">
|
340
344
|
<property name="visible">True</property>
|
341
|
-
<property name="
|
342
|
-
<property name="
|
343
|
-
<property name="has_frame">False</property>
|
344
|
-
<property name="width_chars">9</property>
|
345
|
+
<property name="xalign">0</property>
|
346
|
+
<property name="label" translatable="yes">€</property>
|
345
347
|
</widget>
|
346
348
|
<packing>
|
347
|
-
<property name="left_attach">
|
348
|
-
<property name="right_attach">
|
349
|
-
<property name="top_attach">2</property>
|
350
|
-
<property name="bottom_attach">3</property>
|
349
|
+
<property name="left_attach">2</property>
|
350
|
+
<property name="right_attach">3</property>
|
351
351
|
<property name="x_options">GTK_FILL</property>
|
352
352
|
<property name="y_options"></property>
|
353
353
|
</packing>
|
File without changes
|
File without changes
|
File without changes
|
data/lib/ui/gladehelper.rb
CHANGED
@@ -123,11 +123,12 @@ module Ig3tool
|
|
123
123
|
def number_eval_widget(widget, fallback="")
|
124
124
|
text = widget.text
|
125
125
|
text.strip!
|
126
|
-
text.gsub! /[^\d+\/*()
|
126
|
+
text.gsub! /[^\d+\/*().-]/, ""
|
127
|
+
text.gsub! /(\D|^)\./, '\1'+'0.' # Ruby laat geen ".2" toe
|
127
128
|
if text =~ /[+\/*()-]/
|
128
129
|
text = begin eval(text).to_s rescue fallback.to_s end
|
129
130
|
else
|
130
|
-
text = text.
|
131
|
+
text = text.to_f.to_s
|
131
132
|
end
|
132
133
|
widget.text = text
|
133
134
|
end
|
@@ -105,7 +105,8 @@ module Ig3tool
|
|
105
105
|
begin
|
106
106
|
amount = @amount.text
|
107
107
|
raise Ig3tool::IG3Error, "uncorrect format for amount" unless amount =~ /\d+(\.\d{1,2}){0,1}/
|
108
|
-
|
108
|
+
message = @message.text.strip || "No Message"
|
109
|
+
$client.interne_transfer!("from" => fromusername, "to" => tousername, "amount" => @amount.text.strip.to_c, "message" => message)
|
109
110
|
_clear
|
110
111
|
_update_transactions(fromusername)
|
111
112
|
@notification.text = "transferred #{amount} EUR from #{fromusername} to #{tousername}"
|
data/lib/ui/peoplewindow.rb
CHANGED
@@ -98,8 +98,8 @@ module Ig3tool
|
|
98
98
|
def find_by_barcode(widget)
|
99
99
|
begin
|
100
100
|
barc = @barcode.text
|
101
|
-
clear_all(nil)
|
102
101
|
p = $client.person_member(barc)
|
102
|
+
clear_all(nil)
|
103
103
|
_show(p)
|
104
104
|
rescue Exception => e
|
105
105
|
@notification.text = "no user with barcode #{barc} found..."
|
data/lib/ui/printingwindow.rb
CHANGED
@@ -337,7 +337,7 @@ module Ig3tool
|
|
337
337
|
raise NotFound, "the ig3tool imps found no such user..." if person.nil?
|
338
338
|
person = person[0]
|
339
339
|
@email.text = person["email"]
|
340
|
-
@saldo.text = user["saldo"]
|
340
|
+
@saldo.text = user["saldo"].from_c.to_s
|
341
341
|
@firstname.text = person["first_name"]
|
342
342
|
@lastname.text = person["last_name"]
|
343
343
|
@status.text = $client.person_status(person["username"])
|
@@ -351,7 +351,7 @@ module Ig3tool
|
|
351
351
|
raise NotFound, "the ig3tool imps found no such user..." if person.nil? or person.empty?
|
352
352
|
person = person[0]
|
353
353
|
@email.text = person["email"]
|
354
|
-
@saldo.text = "0"
|
354
|
+
@saldo.text = "0.0"
|
355
355
|
@firstname.text = person["first_name"]
|
356
356
|
@lastname.text = person["last_name"]
|
357
357
|
@status.text = $client.person_status(person["username"])
|
@@ -374,11 +374,11 @@ module Ig3tool
|
|
374
374
|
def clear_all(widget, clearnotification=true)
|
375
375
|
@username.text = ""
|
376
376
|
@email.text = ""
|
377
|
-
@saldo.text = ""
|
377
|
+
@saldo.text = "0.0"
|
378
378
|
@firstname.text = ""
|
379
379
|
@lastname.text = ""
|
380
380
|
@notification.text = "" if clearnotification
|
381
|
-
@delta.text = ""
|
381
|
+
@delta.text = "0.0"
|
382
382
|
@apply.image = Gtk::Image.new(Gtk::Stock::APPLY, Gtk::IconSize::BUTTON)
|
383
383
|
@apply.label = Gtk::Stock::APPLY
|
384
384
|
@usernames.grab_focus
|
@@ -387,11 +387,11 @@ module Ig3tool
|
|
387
387
|
|
388
388
|
def clear_most(widget)
|
389
389
|
@email.text = ""
|
390
|
-
@saldo.text = ""
|
390
|
+
@saldo.text = "0.0"
|
391
391
|
@firstname.text = ""
|
392
392
|
@lastname.text = ""
|
393
393
|
@notification.text = ""
|
394
|
-
@delta.text = ""
|
394
|
+
@delta.text = "0.0"
|
395
395
|
@apply.image = Gtk::Image.new(Gtk::Stock::APPLY, Gtk::IconSize::BUTTON)
|
396
396
|
@apply.label = Gtk::Stock::APPLY
|
397
397
|
#@statussearch.active = -1
|
data/lib/ui/protjes.rb
CHANGED
@@ -214,6 +214,12 @@ def initialize
|
|
214
214
|
make_debugger_combo(@purchase_debugger)
|
215
215
|
make_debugger_combo(@stock_debugger)
|
216
216
|
|
217
|
+
[@purchase_amount, @purchase_price, @purchase_plebs, @purchase_debuggers,
|
218
|
+
@purchase_members, @manage_debuggers, @manage_plebs, @manage_members,
|
219
|
+
@stock_stock_new].each do |w|
|
220
|
+
make_eval_widget w
|
221
|
+
end
|
222
|
+
|
217
223
|
end
|
218
224
|
|
219
225
|
def get_debugger(widget)
|
data/lib/ui/saleswindow.rb
CHANGED
@@ -6,13 +6,15 @@ module Ig3tool
|
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
super("sales.glade")
|
9
|
-
make_debugger_combo(_get_widget("debugger"), @window)
|
10
9
|
@status = "non member"
|
11
10
|
@target = nil
|
12
11
|
|
12
|
+
@statushash = {0 => "non member", 1 => "debugger"}
|
13
|
+
@statushashi = @statushash.invert
|
14
|
+
|
13
15
|
# init items
|
14
16
|
@items = _get_widget("list")
|
15
|
-
@items.model = Gtk::ListStore.new(Integer, String, Float, Object)
|
17
|
+
@items.model = Gtk::ListStore.new(Integer, String, Float, Object, String)
|
16
18
|
r = Gtk::CellRendererText.new
|
17
19
|
@items.insert_column(-1, "Aantal", r, :text => 0)
|
18
20
|
@items.insert_column(-1, "Product", r, :text => 1)
|
@@ -20,9 +22,8 @@ module Ig3tool
|
|
20
22
|
@member_id = @glade.get_widget("member_id")
|
21
23
|
|
22
24
|
@window.show
|
23
|
-
@statushash = {1 => "member", 0 => "non-member", 2 => "debugger"}
|
24
|
-
@statushashi = @statushash.invert
|
25
25
|
|
26
|
+
make_debugger_combo(_get_widget("debugger"), @window)
|
26
27
|
make_eval_widget @glade.get_widget("count"), 1
|
27
28
|
end
|
28
29
|
|
@@ -35,7 +36,7 @@ module Ig3tool
|
|
35
36
|
when "non member"
|
36
37
|
@target = nil
|
37
38
|
@status = "non member"
|
38
|
-
|
39
|
+
@member_id.active = @statushashi[@status]
|
39
40
|
return
|
40
41
|
|
41
42
|
when "kaching"
|
@@ -49,20 +50,25 @@ module Ig3tool
|
|
49
50
|
return
|
50
51
|
|
51
52
|
# is het een debugger?
|
52
|
-
when /^[a-z]/
|
53
|
+
when /^[a-z-]/i
|
53
54
|
wanted = {"username", value, "status", "debugger"}
|
54
55
|
pers = $client.person_lookup(wanted)
|
55
56
|
|
57
|
+
if pers.empty? # XXX tijdelijk tot we nieuw zapblad hebben
|
58
|
+
wanted = {"first_name", value, "status", "debugger"}
|
59
|
+
pers = $client.person_lookup(wanted)
|
60
|
+
end
|
61
|
+
|
56
62
|
unless pers.empty?
|
57
63
|
pers = pers.first
|
58
64
|
|
59
65
|
@status = "debugger"
|
60
|
-
@member_id.active = @statushashi[@status]
|
61
66
|
@target = @debugger = pers.username
|
62
67
|
|
63
68
|
_get_widget("debugger").model.each do |m, p, i|
|
64
69
|
if i[1] == @target
|
65
70
|
_get_widget("debugger").active_iter = i
|
71
|
+
@member_id.active = @statushashi[@status]
|
66
72
|
break
|
67
73
|
end
|
68
74
|
end
|
@@ -72,11 +78,11 @@ module Ig3tool
|
|
72
78
|
|
73
79
|
# is het een member?
|
74
80
|
begin
|
75
|
-
memb = $client.
|
81
|
+
memb = $client.person_member(value)
|
76
82
|
|
77
|
-
@target =
|
83
|
+
@target = value
|
78
84
|
@status = "member"
|
79
|
-
|
85
|
+
@member_id.active = @statushashi[@status]
|
80
86
|
return
|
81
87
|
rescue Exception => e
|
82
88
|
end
|
@@ -92,7 +98,35 @@ module Ig3tool
|
|
92
98
|
end
|
93
99
|
|
94
100
|
def debugger_changed
|
95
|
-
@
|
101
|
+
@status = "debugger"
|
102
|
+
iter = _get_widget("debugger").active_iter
|
103
|
+
unless iter.nil?
|
104
|
+
@target = @debugger = iter[1]
|
105
|
+
@member_id.active = @statushashi[@status]
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def member_changed
|
110
|
+
chosen = @member_id.active_text.strip
|
111
|
+
@target = nil
|
112
|
+
|
113
|
+
case chosen
|
114
|
+
when "non member"
|
115
|
+
@status = "non member"
|
116
|
+
|
117
|
+
when "debugger"
|
118
|
+
@target = @debugger = _get_widget("debugger").active_iter[1]
|
119
|
+
@status = "debugger"
|
120
|
+
|
121
|
+
else # member
|
122
|
+
begin
|
123
|
+
memb = $client.person_member(chosen)
|
124
|
+
|
125
|
+
@target = chosen
|
126
|
+
@status = "member"
|
127
|
+
rescue NotAMember => e
|
128
|
+
end
|
129
|
+
end
|
96
130
|
end
|
97
131
|
|
98
132
|
def delete_clicked
|
@@ -130,8 +164,8 @@ module Ig3tool
|
|
130
164
|
|
131
165
|
def clear_clicked
|
132
166
|
@items.model.clear
|
133
|
-
|
134
|
-
|
167
|
+
@status = "non member"
|
168
|
+
@member_id.active = @statushashi[@status]
|
135
169
|
_update_total
|
136
170
|
end
|
137
171
|
|
@@ -146,6 +180,15 @@ module Ig3tool
|
|
146
180
|
products
|
147
181
|
end
|
148
182
|
|
183
|
+
def _get_items_with_status
|
184
|
+
products = {}
|
185
|
+
@items.model.each do |model, path, row|
|
186
|
+
recip = products[row[4]] ||= []
|
187
|
+
recip.push([row[3].barcode,row[0]])
|
188
|
+
end
|
189
|
+
products
|
190
|
+
end
|
191
|
+
|
149
192
|
def _scribble
|
150
193
|
unless @status == "debugger"
|
151
194
|
warn "not a debugger"
|
@@ -156,7 +199,7 @@ module Ig3tool
|
|
156
199
|
|
157
200
|
return if items.empty?
|
158
201
|
params = { "debugger" => @debugger,
|
159
|
-
|
202
|
+
"items" => items }
|
160
203
|
|
161
204
|
begin
|
162
205
|
$client.scribble! params
|
@@ -168,18 +211,21 @@ module Ig3tool
|
|
168
211
|
end
|
169
212
|
|
170
213
|
def _kaching
|
171
|
-
items =
|
214
|
+
items = _get_items_with_status
|
172
215
|
|
173
|
-
|
174
|
-
"items" => items,
|
175
|
-
"status" => @status }
|
216
|
+
items.each do |status, items|
|
176
217
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
218
|
+
params = { "debugger" => @debugger,
|
219
|
+
"items" => items,
|
220
|
+
"status" => status }
|
221
|
+
|
222
|
+
begin
|
223
|
+
$client.kaching! params
|
224
|
+
clear_clicked
|
225
|
+
# XXX make sound
|
226
|
+
rescue Exception => e
|
227
|
+
puts "Error: #{$!}"
|
228
|
+
end
|
183
229
|
end
|
184
230
|
end
|
185
231
|
|
@@ -190,7 +236,7 @@ module Ig3tool
|
|
190
236
|
# zoek eerst naar een bestaande entry voor prod
|
191
237
|
found = nil
|
192
238
|
@items.model.each do |model, path, row|
|
193
|
-
found = row if row[3].barcode == prod.barcode
|
239
|
+
found = row if row[3].barcode == prod.barcode and @status == row[4]
|
194
240
|
end
|
195
241
|
|
196
242
|
if found
|
@@ -203,6 +249,7 @@ module Ig3tool
|
|
203
249
|
row[1] = prod.name
|
204
250
|
row[2] = qty * prod.send(_price).to_f / 100
|
205
251
|
row[3] = prod
|
252
|
+
row[4] = @status
|
206
253
|
end
|
207
254
|
|
208
255
|
_get_widget("count").text = "1"
|