ig3tool 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/glade/protjes.glade +35 -11
- data/lib/glade/sales.glade +120 -119
- data/lib/lib/util.rb +6 -0
- data/lib/ui/bibliotheekwindow.rb +132 -52
- data/lib/ui/interne.rb +1 -1
- data/lib/ui/printingwindow.rb +29 -6
- data/lib/ui/protjes.rb +42 -14
- data/lib/ui/saleswindow.rb +15 -12
- metadata +2 -7
- data/lib/ui/OLD_bibwindow.rb +0 -537
- data/lib/ui/OLD_internewindow.rb +0 -129
- data/lib/ui/OLD_memberswindow.rb +0 -327
- data/lib/ui/OLD_printenwindow.rb +0 -329
- data/lib/ui/OLD_productswindow.rb +0 -193
data/lib/ui/bibliotheekwindow.rb
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
require 'time'
|
2
2
|
|
3
|
-
begin
|
4
|
-
require "amazon/search"
|
5
|
-
$amazon_loaded = 1
|
6
|
-
rescue Exception => e
|
7
|
-
STDERR.puts "Ruby/Amazon kon niet geladen worden: " + e.to_s
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
|
12
3
|
module Ig3tool
|
13
4
|
|
14
5
|
class BibliotheekWindow < GladeHelper
|
@@ -68,10 +59,10 @@ module Ig3tool
|
|
68
59
|
@loan_list.model = @loan_list_store = Gtk::ListStore.new(Object, String, String, String, String, String, String)
|
69
60
|
ll = Gtk::CellRendererText.new
|
70
61
|
@loan_list.insert_column(-1, "loan date", ll) do |tvc, cell, m ,iter|
|
71
|
-
cell.text =
|
62
|
+
cell.text = iter[0].loan_date.strftime("%d/%m/%y")
|
72
63
|
end
|
73
64
|
@loan_list.insert_column(-1, "return on", ll) do |tvc, cell, m ,iter|
|
74
|
-
date =
|
65
|
+
date = iter[0].return_date
|
75
66
|
ll.foreground = "red" if date > Time.now
|
76
67
|
cell.text = date.strftime("%d/%m/%y")
|
77
68
|
ll.foreground = "black"
|
@@ -244,7 +235,11 @@ module Ig3tool
|
|
244
235
|
Thread.new do
|
245
236
|
begin
|
246
237
|
books = $client.bib_lookup(get_fields)
|
247
|
-
|
238
|
+
puts books
|
239
|
+
case books.size
|
240
|
+
when 0 #book not found in db
|
241
|
+
_lookup_isbnbook(@books_isbn.text)
|
242
|
+
when 1
|
248
243
|
_show(books.first)
|
249
244
|
else
|
250
245
|
_update_books_list(books)
|
@@ -288,16 +283,16 @@ module Ig3tool
|
|
288
283
|
def loan_loan(widget)
|
289
284
|
@loan_notification.text = ""
|
290
285
|
begin
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
286
|
+
fields = get_loan_fields
|
287
|
+
if fields["member"] =~ /[a-zA-Z]+/
|
288
|
+
puts "username ipv barcode: #{fields["member"]}"
|
289
|
+
membership = $client.person_membership(fields["member"])
|
290
|
+
if membership.nil?
|
291
|
+
raise IG3Error, "#{fields["member"]} is not a member..."
|
292
|
+
else
|
293
|
+
fields["member"] = membership.barcode
|
294
|
+
end
|
295
|
+
end
|
301
296
|
$client.bib_loan!(fields)
|
302
297
|
_update_loan_list
|
303
298
|
loan_clear(nil)
|
@@ -318,44 +313,129 @@ module Ig3tool
|
|
318
313
|
private
|
319
314
|
|
320
315
|
|
316
|
+
def _lookup_amazon_isbn(isbn,update = true)
|
317
|
+
begin
|
318
|
+
require 'amazon/aws/search'
|
319
|
+
rescue Exception => e
|
320
|
+
STDERR.puts "Ruby/Amazon/Aws/Search kon niet geladen worden: " + e.to_s
|
321
|
+
return {}
|
322
|
+
end
|
323
|
+
#voor amazon bestaan der 2 libs die sterk op elkaar lijke qua naam
|
324
|
+
#juiste is: http://www.caliban.org/ruby/ruby-aws/
|
321
325
|
|
322
|
-
|
323
|
-
|
324
|
-
|
326
|
+
bookhsh = {}
|
327
|
+
token = "1857ZGN71N9Z8AV4HE02" #verplaats naar client
|
328
|
+
associate = "wwwinfogroepb-20"
|
329
|
+
#return false unless _isbn?(true,isbn) # Indien strenge test faalt
|
330
|
+
# You need a amazon-dev-token in client.rb
|
331
|
+
#token = CONFIG['amazon-dev-token']
|
332
|
+
#return unless $amazon_loaded and token.instance_of?(String) and not token.empty?
|
325
333
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
334
|
+
begin
|
335
|
+
#req = Amazon::Search::Request.new(CONFIG["amazon-dev-token"],CONFIG["amazon-associates-id"])
|
336
|
+
req = Amazon::AWS::Search::Request.new(token,associate)
|
337
|
+
il = Amazon::AWS::ItemLookup.new("ASIN", {'ItemId' => isbn} )
|
338
|
+
rg = Amazon::AWS::ResponseGroup.new
|
339
|
+
res = req.search(il,rg)
|
340
|
+
#dont ask, feel free to improve (numlock)
|
341
|
+
books = res['item_lookup_response'].to_h
|
342
|
+
moar_book = books['items'].to_h
|
343
|
+
no_idea = moar_book['item']
|
344
|
+
book = no_idea['item_attributes'].to_h
|
345
|
+
|
346
|
+
title = book['product_name'].to_s.strip
|
347
|
+
author = book['author'].to_s.strip
|
348
|
+
publisher = book['manufacturer'].to_s.strip
|
349
|
+
|
350
|
+
bookhsh.store(:title, title) if title
|
351
|
+
bookhsh.store(:author, author) if author
|
352
|
+
bookhsh.store(:publisher, publisher) if publisher
|
353
|
+
|
354
|
+
if update
|
355
|
+
@books_title.text = title
|
356
|
+
@books_author.text = author
|
357
|
+
@books_publisher.text = publisher
|
358
|
+
@books_isbn.text = isbn
|
335
359
|
end
|
360
|
+
bookhsh
|
361
|
+
rescue Exception => e
|
362
|
+
STDERR.puts e.message
|
363
|
+
@books_notification.text = "Fout: Lookup Amazon: #{e.message.smaller}"
|
364
|
+
{}
|
336
365
|
end
|
366
|
+
end
|
337
367
|
|
338
|
-
|
339
|
-
|
340
|
-
|
368
|
+
def _lookup_isbndb_isbn(isbn,update = true)
|
369
|
+
def fetch(uri_string, limit) #follow redirects
|
370
|
+
raise "Server loop" if limit < 0
|
371
|
+
response = Net::HTTP.get_response(URI.parse(uri_string))
|
372
|
+
case response
|
373
|
+
when Net::HTTPSuccess then response
|
374
|
+
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
|
375
|
+
else
|
376
|
+
response.error!
|
377
|
+
end
|
378
|
+
end
|
379
|
+
def process_book(doc,isbn,update)
|
380
|
+
bookhsh = {}
|
381
|
+
doc.elements.each("ISBNdb/BookList/BookData"){|book|
|
382
|
+
#oh god, but title etc has no specific id in the xml, so can't filter on it
|
383
|
+
#processes all the books, although only 1 book should be returned by the server as we search for isbn
|
384
|
+
book.elements.each("Title"){ |_title|
|
385
|
+
title = _title.text.strip
|
386
|
+
bookhsh.store(:title, title) if title
|
387
|
+
}
|
388
|
+
book.elements.each("AuthorsText"){ |_author|
|
389
|
+
author = _author.text.strip
|
390
|
+
bookhsh.store(:author,author) if author
|
391
|
+
}
|
392
|
+
book.each_element_with_attribute("publisher_id"){ |_pub|
|
393
|
+
pub = _pub.text.strip
|
394
|
+
bookhsh.store(:publisher,pub) if pub
|
395
|
+
}
|
396
|
+
}
|
397
|
+
if update
|
398
|
+
@books_author.text = bookhsh[:author]
|
399
|
+
@books_title.text = bookhsh[:title]
|
400
|
+
@books_publisher.text = bookhsh[:publisher]
|
401
|
+
@books_isbn.text = isbn
|
402
|
+
end
|
403
|
+
return bookhsh
|
404
|
+
end
|
341
405
|
|
342
406
|
begin
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
@books_title.text = book['product_name'].to_s.strip
|
350
|
-
@books_author.text = book['authors'].join(', ').strip if !book['authors'] and book['authors'].class == "Array" # opgelet, niets wegdoen!
|
351
|
-
@books_publisher.text = book['manufacturer'].to_s.strip
|
352
|
-
@books_year.text = book['release_date'].to_s.strip
|
353
|
-
rescue
|
354
|
-
puts e.backtrace
|
355
|
-
_print_msg "Fout: Lookup Amazon: #{$!}", "ISBN: #{isbn}"
|
407
|
+
require 'net/http'
|
408
|
+
require 'rexml/document'
|
409
|
+
rescue Exception => e
|
410
|
+
STDERR.puts "Ruby/ISBN-DB kon niet geladen worden: " + e.to_s
|
411
|
+
{}
|
356
412
|
end
|
413
|
+
|
414
|
+
#move to client (or just leave it here as you really can't do any harm with this key)
|
415
|
+
key = "Y42N22G5"
|
416
|
+
url = "http://isbndb.com/api/books.xml?"
|
417
|
+
|
418
|
+
isbnquery = "index1=isbn&value1=#{isbn}"
|
419
|
+
response = fetch("#{url}access_key=#{key}&#{isbnquery}", 10)
|
420
|
+
doc = REXML::Document.new(response.body)
|
421
|
+
puts "#{url}access_key=#{key}&#{isbnquery}"
|
422
|
+
return process_book(doc,isbn,update)
|
423
|
+
|
424
|
+
rescue Exception => e
|
425
|
+
#in case of an error we return empty hash == no book
|
426
|
+
STDERR.puts e.message
|
427
|
+
@books_notification.text = "Fout: Lookup ISBNDB: #{e.message.smaller}"
|
428
|
+
{}
|
429
|
+
end
|
430
|
+
|
431
|
+
def _lookup_isbnbook(isbn, update = true)
|
432
|
+
bookhsh = {}
|
433
|
+
bookhsh = _lookup_amazon_isbn(isbn,update) if isbn.size == 10
|
434
|
+
bookhsh = _lookup_isbndb_isbn(isbn,update) if bookhsh.size == 0
|
435
|
+
return bookhsh #hash, either empty or :title, :author, :publisher avail
|
357
436
|
end
|
358
437
|
|
438
|
+
|
359
439
|
def _show(book)
|
360
440
|
@books_isbn.text = book["isbn"]
|
361
441
|
@loan_isbn.text = book["isbn"]
|
@@ -375,7 +455,7 @@ module Ig3tool
|
|
375
455
|
def _update_books_list(books=nil, clear=true)
|
376
456
|
@books_notification.text = "loading books..."
|
377
457
|
@books_list_store.clear if clear
|
378
|
-
Thread.new do
|
458
|
+
Thread.new do
|
379
459
|
books = $client.bib_books if books.nil?
|
380
460
|
unless books.empty?
|
381
461
|
books.each do |b|
|
@@ -393,7 +473,7 @@ module Ig3tool
|
|
393
473
|
|
394
474
|
def _update_loan_list(clear=true)
|
395
475
|
@loan_list_store.clear if clear
|
396
|
-
Thread.new do
|
476
|
+
Thread.new do
|
397
477
|
loans = $client.bib_loans
|
398
478
|
loans.each do |b|
|
399
479
|
@loan_list_store.append[0] = b
|
data/lib/ui/interne.rb
CHANGED
@@ -27,7 +27,7 @@ module Ig3tool
|
|
27
27
|
@transactions.model = @transactions_store = Gtk::ListStore.new(Object, String, String, String, String, String)
|
28
28
|
l = Gtk::CellRendererText.new
|
29
29
|
@transactions.insert_column(-1, "time", l) do |tvc, cell, m, iter|
|
30
|
-
cell.text =
|
30
|
+
cell.text = iter[0].time.strftime("%d/%m/%y %H:%M")
|
31
31
|
end
|
32
32
|
@transactions.insert_column(-1, "amount", l) do |tvc, cell, m, iter|
|
33
33
|
cell.text = iter[0].amount.from_c.to_s
|
data/lib/ui/printingwindow.rb
CHANGED
@@ -133,7 +133,17 @@ module Ig3tool
|
|
133
133
|
@log_menu = Gtk::Menu.new
|
134
134
|
log_menu_refund_item = Gtk::MenuItem.new("refund")
|
135
135
|
log_menu_show_item = Gtk::MenuItem.new("show")
|
136
|
+
log_menu_reprint_item = Gtk::MenuItem.new("reprint")
|
136
137
|
# Treeview heeft default Mode Gtk::SELECTION_SINGLE
|
138
|
+
log_menu_reprint_item.signal_connect("activate") {
|
139
|
+
@filteredlog.selection.selected_each do |model, path, iter|
|
140
|
+
logentry = iter[0]
|
141
|
+
# do reprint stuff
|
142
|
+
$client.print_reprint!({ "logid" => logentry["id"]})
|
143
|
+
@notification.text = "attempting reprint of job #{logentry["job"]} for #{logentry["username"]}"
|
144
|
+
_update_log
|
145
|
+
end
|
146
|
+
}
|
137
147
|
log_menu_show_item.signal_connect("activate") {
|
138
148
|
@filteredlog.selection.selected_each do |model, path, iter|
|
139
149
|
logentry = iter[0]
|
@@ -158,7 +168,8 @@ module Ig3tool
|
|
158
168
|
}
|
159
169
|
|
160
170
|
@log_menu.append(log_menu_show_item)
|
161
|
-
@log_menu.append(log_menu_refund_item)
|
171
|
+
@log_menu.append(log_menu_refund_item)
|
172
|
+
@log_menu.append(log_menu_reprint_item)
|
162
173
|
@log_menu.show_all
|
163
174
|
|
164
175
|
end
|
@@ -167,7 +178,17 @@ module Ig3tool
|
|
167
178
|
@log_big_menu = Gtk::Menu.new
|
168
179
|
log_menu_refund_item = Gtk::MenuItem.new("refund")
|
169
180
|
log_menu_show_item = Gtk::MenuItem.new("show")
|
181
|
+
log_menu_reprint_item = Gtk::MenuItem.new("reprint")
|
170
182
|
# Treeview heeft default Mode Gtk::SELECTION_SINGLE
|
183
|
+
log_menu_reprint_item.signal_connect("activate") {
|
184
|
+
@filteredlog.selection.selected_each do |model, path, iter|
|
185
|
+
logentry = iter[0]
|
186
|
+
# do reprint stuff
|
187
|
+
$client.print_reprint!({ "logid" => logentry["id"]})
|
188
|
+
@notification.text = "attempting reprint of job #{logentry["job"]} for #{logentry["username"]}"
|
189
|
+
_update_log
|
190
|
+
end
|
191
|
+
}
|
171
192
|
log_menu_show_item.signal_connect("activate") {
|
172
193
|
@log.selection.selected_each do |model, path, iter|
|
173
194
|
logentry = iter[0]
|
@@ -194,6 +215,7 @@ module Ig3tool
|
|
194
215
|
|
195
216
|
@log_big_menu.append(log_menu_show_item)
|
196
217
|
@log_big_menu.append(log_menu_refund_item)
|
218
|
+
@log_big_menu.append(log_menu_reprint_item)
|
197
219
|
@log_big_menu.show_all
|
198
220
|
|
199
221
|
end
|
@@ -513,10 +535,11 @@ module Ig3tool
|
|
513
535
|
clear_all(nil)
|
514
536
|
else
|
515
537
|
begin
|
516
|
-
amount = @delta.text.strip.gsub(/,/, ".")
|
517
|
-
|
518
|
-
|
519
|
-
|
538
|
+
#amount = @delta.text.strip.gsub(/,/, ".")
|
539
|
+
amount = @delta.text.strip
|
540
|
+
#if amount.to_f < 0
|
541
|
+
# quick_message("\n the ig3tool imps do not accept negative values... \n")
|
542
|
+
#else
|
520
543
|
$client.print_update!({:username => @username.text,
|
521
544
|
:first_name => @firstname.text,
|
522
545
|
:last_name => @lastname.text,
|
@@ -527,7 +550,7 @@ module Ig3tool
|
|
527
550
|
Thread.new do
|
528
551
|
refresh(true)
|
529
552
|
end
|
530
|
-
end
|
553
|
+
#end
|
531
554
|
rescue Exception => e
|
532
555
|
@notification.text = (e.class.to_s + " - " + e.message).smaller
|
533
556
|
end
|
data/lib/ui/protjes.rb
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
require 'time'
|
2
2
|
|
3
|
+
class String
|
4
|
+
|
5
|
+
def to_boolean
|
6
|
+
return true if (self == "t" or self.to_i != 0)
|
7
|
+
return false
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
3
11
|
|
4
12
|
module Ig3tool
|
5
13
|
|
@@ -25,6 +33,7 @@ def initialize
|
|
25
33
|
@add_stock = @glade.get_widget("add_stock")
|
26
34
|
@add_prodcat = @glade.get_widget("add_prodcat")
|
27
35
|
@add_categories = @glade.get_widget("add_categories")
|
36
|
+
@continuous_stock = @glade.get_widget("continuous_stock_check")
|
28
37
|
|
29
38
|
@categories = $client.product_categories.collect {|x| x.name}.sort
|
30
39
|
|
@@ -96,7 +105,7 @@ def initialize
|
|
96
105
|
@purchase_log.model = @purchase_log_store = Gtk::ListStore.new(Object, String, String, String, String, String)
|
97
106
|
l = Gtk::CellRendererText.new
|
98
107
|
@purchase_log.insert_column(-1, "time", l) do |tvc, cell, m, iter|
|
99
|
-
cell.text =
|
108
|
+
cell.text = iter[0].time.strftime("%d/%m/%y")
|
100
109
|
end
|
101
110
|
@purchase_log.insert_column(-1, "barcode", l) do |tvc, cell, m, iter|
|
102
111
|
cell.text = iter[0].product
|
@@ -127,7 +136,7 @@ def initialize
|
|
127
136
|
@spurchase_log.model = @spurchase_log_store = Gtk::ListStore.new(Object, String, String, String, String, String, String)
|
128
137
|
l = Gtk::CellRendererText.new
|
129
138
|
@spurchase_log.insert_column(-1, "time", l) do |tvc, cell, m, iter|
|
130
|
-
cell.text =
|
139
|
+
cell.text = iter[0].time.strftime("%d/%m/%y")
|
131
140
|
end
|
132
141
|
@spurchase_log.insert_column(-1, "barcode", l) do |tvc, cell, m, iter|
|
133
142
|
cell.text = iter[0].product
|
@@ -189,6 +198,8 @@ def initialize
|
|
189
198
|
@slog_categories.model = cat6_model
|
190
199
|
@slog_categories.active = 0
|
191
200
|
|
201
|
+
@continuous_stock.active = false
|
202
|
+
|
192
203
|
toggle_purchase_fields(false)
|
193
204
|
_add_clear
|
194
205
|
_purchase_clear
|
@@ -203,14 +214,6 @@ def initialize
|
|
203
214
|
@handler4 = @purchase_price.signal_connect("changed"){ price_amount_changed }
|
204
215
|
@handler5 = @purchase_amount.signal_connect("changed"){ price_amount_changed }
|
205
216
|
|
206
|
-
%w(focus-out-event activate).each do |s|
|
207
|
-
@purchase_amount.signal_connect s do
|
208
|
-
if @purchase_price.text.strip.to_c == 0
|
209
|
-
@purchase_price.text = (@purchase_amount.text.strip.to_i * @purchase_debuggers_orig.text.to_f).to_s
|
210
|
-
end
|
211
|
-
false
|
212
|
-
end
|
213
|
-
end
|
214
217
|
#@handler8 = @add_categories.signal_connect("changed"){ refresh }
|
215
218
|
@handler9 = @purchase_categories.signal_connect("changed"){ refresh }
|
216
219
|
@handler10 = @stock_categories.signal_connect("changed"){ refresh }
|
@@ -229,6 +232,17 @@ def initialize
|
|
229
232
|
make_eval_widget w
|
230
233
|
end
|
231
234
|
|
235
|
+
# Update prices after amount change
|
236
|
+
%w(focus-out-event activate).each do |s|
|
237
|
+
@purchase_amount.signal_connect s do
|
238
|
+
number_eval_widget(@purchase_amount, "0.0")
|
239
|
+
if @purchase_price.text.strip.to_c == 0
|
240
|
+
@purchase_price.text = (@purchase_amount.text.strip.to_i * @purchase_debuggers_orig.text.to_f).to_s
|
241
|
+
end
|
242
|
+
false
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
232
246
|
@handler69 = @purchase_debugger.signal_connect("changed"){ purchase_debugger_changed }
|
233
247
|
@debugger_stamp = nil
|
234
248
|
|
@@ -269,7 +283,7 @@ end
|
|
269
283
|
@purchase_debuggers.text = new.to_i.from_c.to_s
|
270
284
|
@purchase_members.text = afronden(newm).from_c.to_s
|
271
285
|
@purchase_plebs.text = afronden(newp).from_c.to_s
|
272
|
-
|
286
|
+
#@purchase_accept.active = true
|
273
287
|
rescue Exception => e
|
274
288
|
@purchase_debuggers.text = new.to_i.from_c.to_s
|
275
289
|
@purchase_members.text = afronden(new.to_i).from_c.to_s
|
@@ -550,7 +564,12 @@ end
|
|
550
564
|
raise Needed, "please scan a barcode" if @add_barcode.text.strip.empty?
|
551
565
|
raise Needed, "please enter a descriptive name" if @add_name.text.strip.empty?
|
552
566
|
raise Needed, "please select a category" if @add_prodcat.active == -1
|
553
|
-
|
567
|
+
if @continuous_stock.active?
|
568
|
+
cs = 1
|
569
|
+
else
|
570
|
+
cs = 0
|
571
|
+
end
|
572
|
+
$client.product_save!("barcode" => @add_barcode.text.strip, "name" => @add_name.text.strip, "continuous_stock" => cs, "dprice" => @manage_debuggers.text.strip.to_c, "mprice" => @manage_members.text.strip.to_c, "nmprice" => @manage_plebs.text.strip.to_c, "category" => @categories[@add_prodcat.active])
|
554
573
|
_update_add_products(false)
|
555
574
|
@add_notification.text = "the imps saved the product!"
|
556
575
|
_add_clear(false)
|
@@ -615,6 +634,9 @@ end
|
|
615
634
|
@add_barcode.text = prod.barcode
|
616
635
|
@add_stock.text = prod.stock
|
617
636
|
@add_name.text = prod.name
|
637
|
+
puts prod.continuous_stock.class
|
638
|
+
puts prod.continuous_stock
|
639
|
+
@continuous_stock.active = prod.continuous_stock.to_boolean
|
618
640
|
@add_prodcat.active = @categories.index(prod.category)
|
619
641
|
rescue Exception => e
|
620
642
|
@add_notification.text = e.message
|
@@ -635,11 +657,16 @@ end
|
|
635
657
|
@purchase_name.text = prod.name
|
636
658
|
@purchase_category.text = prod.category
|
637
659
|
price_amount_changed
|
638
|
-
|
660
|
+
if prod.continuous_stock.to_boolean
|
661
|
+
toggle_purchase_fields(false)
|
662
|
+
@purchase_notification.text = "this product has a continuous stock"
|
663
|
+
else
|
664
|
+
toggle_purchase_fields(true)
|
665
|
+
end
|
639
666
|
Thread.new do
|
640
667
|
ps = $client.product_purchases(barcode)
|
641
668
|
last_purchase = ps.first
|
642
|
-
date =
|
669
|
+
date = last_purchase.time.strftime("%d/%m/%y")
|
643
670
|
@purchase_last.text = date
|
644
671
|
end
|
645
672
|
rescue Exception => e
|
@@ -811,6 +838,7 @@ end
|
|
811
838
|
@add_name.text = ""
|
812
839
|
@add_prodcat.active = -1
|
813
840
|
@add_notification.text = "" if all
|
841
|
+
@continuous_stock.active = false
|
814
842
|
end
|
815
843
|
|
816
844
|
def _purchase_clear(all=true)
|
data/lib/ui/saleswindow.rb
CHANGED
@@ -9,7 +9,7 @@ module Ig3tool
|
|
9
9
|
@status = "non member"
|
10
10
|
@target = nil
|
11
11
|
|
12
|
-
@statushash = {0 => "non member", 1 => "debugger"}
|
12
|
+
@statushash = {0 => "non member", 1 => "debugger", 2 => "member"}
|
13
13
|
@statushashi = @statushash.invert
|
14
14
|
|
15
15
|
# init items
|
@@ -115,20 +115,21 @@ module Ig3tool
|
|
115
115
|
jaar = Time.werkjaar % 100
|
116
116
|
lidkaartx = sprintf("^00%02d%02d", jaar, jaar+1).to_re
|
117
117
|
if value =~ lidkaartx # yay! fascets! (fascisme?)
|
118
|
-
|
118
|
+
begin
|
119
|
+
$client.person_member(value)
|
120
|
+
# als deze lidkaart overeenkomt met een member =>
|
121
|
+
# zet value op member
|
122
|
+
@target = value
|
123
|
+
@status = "member"
|
124
|
+
@member_id.active = @statushashi[@status]
|
125
|
+
puts "member found.."
|
126
|
+
rescue Ig3tool::NotAMember => e
|
127
|
+
# alst gene member is => verkoop een lidkaart :)
|
128
|
+
value = "lidkaart"
|
129
|
+
end
|
119
130
|
end
|
120
131
|
end
|
121
132
|
|
122
|
-
# is het een member?
|
123
|
-
begin
|
124
|
-
memb = $client.person_member(value)
|
125
|
-
|
126
|
-
@target = value
|
127
|
-
@status = "member"
|
128
|
-
@member_id.active = @statushashi[@status]
|
129
|
-
return
|
130
|
-
rescue Exception => e
|
131
|
-
end
|
132
133
|
|
133
134
|
# is het een product?
|
134
135
|
begin
|
@@ -155,6 +156,7 @@ module Ig3tool
|
|
155
156
|
end
|
156
157
|
|
157
158
|
def member_changed
|
159
|
+
puts "member_changed"
|
158
160
|
chosen = @member_id.active_text.strip
|
159
161
|
@target = nil
|
160
162
|
|
@@ -176,6 +178,7 @@ module Ig3tool
|
|
176
178
|
|
177
179
|
@target = chosen
|
178
180
|
@status = "member"
|
181
|
+
puts "member found.."
|
179
182
|
rescue NotAMember => e
|
180
183
|
end
|
181
184
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ig3tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pinte
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-11-25 00:00:00 +01:00
|
13
13
|
default_executable: ig3tool
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -34,22 +34,17 @@ files:
|
|
34
34
|
- lib/lib
|
35
35
|
- lib/glade
|
36
36
|
- bin/ig3tool
|
37
|
-
- lib/ui/OLD_internewindow.rb
|
38
|
-
- lib/ui/OLD_memberswindow.rb
|
39
37
|
- lib/ui/loginwindow.rb
|
40
38
|
- lib/ui/toolwindow.rb
|
41
39
|
- lib/ui/saleswindow.rb
|
42
40
|
- lib/ui/printingwindow.rb
|
43
|
-
- lib/ui/OLD_productswindow.rb
|
44
41
|
- lib/ui/automaatwindow.rb
|
45
42
|
- lib/ui/peoplewindow.rb
|
46
43
|
- lib/ui/protjes.rb
|
47
44
|
- lib/ui/messagebox.rb
|
48
45
|
- lib/ui/gladehelper.rb
|
49
46
|
- lib/ui/bibliotheekwindow.rb
|
50
|
-
- lib/ui/OLD_printenwindow.rb
|
51
47
|
- lib/ui/interne.rb
|
52
|
-
- lib/ui/OLD_bibwindow.rb
|
53
48
|
- lib/lib/errors.rb
|
54
49
|
- lib/lib/util.rb
|
55
50
|
- lib/glade/stock_bookmark_klein.png
|