ig3tool 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/ui/bibliotheekwindow.rb +15 -33
  2. metadata +1 -1
@@ -65,7 +65,7 @@ module Ig3tool
65
65
 
66
66
  @books_list = @glade.get_widget("books_list")
67
67
  @loan_list = @glade.get_widget("loan_list")
68
- @loan_list.model = @loan_list_store = Gtk::ListStore.new(Object, String, String, String, String, String)
68
+ @loan_list.model = @loan_list_store = Gtk::ListStore.new(Object, String, String, String, String, String, String)
69
69
  ll = Gtk::CellRendererText.new
70
70
  @loan_list.insert_column(-1, "loan date", ll) do |tvc, cell, m ,iter|
71
71
  cell.text = Time.parse(iter[0].loan_date).strftime("%d/%m/%y")
@@ -76,6 +76,9 @@ module Ig3tool
76
76
  cell.text = date.strftime("%d/%m/%y")
77
77
  ll.foreground = "black"
78
78
  end
79
+ @loan_list.insert_column(-1, "username", ll) do |tvc, cell, m ,iter|
80
+ cell.text = $client.person_member(iter[0].member_id).username
81
+ end
79
82
  @loan_list.insert_column(-1, "memberid", ll) do |tvc, cell, m ,iter|
80
83
  cell.text = iter[0].member_id
81
84
  end
@@ -102,13 +105,11 @@ module Ig3tool
102
105
  end
103
106
 
104
107
  def select_book(widget, path, column)
105
- puts "-> select_book"
106
108
  iter = widget.model.get_iter(path)
107
109
  _show iter[0]
108
110
  end
109
111
 
110
112
  def select_loan(widget, path, column)
111
- puts "-> select_loan"
112
113
  iter = widget.model.get_iter(path)
113
114
  @loan_isbn.text = iter[0].isbn
114
115
  loan_isbn_set(nil)
@@ -118,7 +119,6 @@ module Ig3tool
118
119
 
119
120
 
120
121
  def select_section()
121
- puts "-> select_section"
122
122
  #Thread.new do
123
123
  # if @books_section.active_iter[0].nil?
124
124
  # books = nil
@@ -130,7 +130,6 @@ module Ig3tool
130
130
  end
131
131
 
132
132
  def get_fields
133
- puts "-> get_fields"
134
133
  fields = {}
135
134
  @books_fields.each do |k, f|
136
135
  fields[k] = f.text unless f.text.strip.empty?
@@ -140,7 +139,6 @@ module Ig3tool
140
139
  end
141
140
 
142
141
  def get_loan_fields
143
- puts "-> get_loan_fields"
144
142
  fields = {}
145
143
  @loan_fields.each do |k, f|
146
144
  fields[k] = f.text unless f.text.strip.empty?
@@ -149,7 +147,6 @@ module Ig3tool
149
147
  end
150
148
 
151
149
  def books_save(widget)
152
- puts "-> books_save"
153
150
  begin
154
151
  $client.bib_add!(get_fields)
155
152
  _update_books_list
@@ -162,7 +159,6 @@ module Ig3tool
162
159
 
163
160
  end
164
161
  def loan_extend(widget)
165
- puts "-> loan_extend"
166
162
  begin
167
163
  $client.bib_extend!(get_loan_fields)
168
164
  _update_loan_list
@@ -175,11 +171,9 @@ module Ig3tool
175
171
  end
176
172
 
177
173
  def hl_loan(a)
178
- puts "hl_loan: NYI"
179
174
  end
180
175
 
181
176
  def loan_return(widget)
182
- puts "-> loan_return"
183
177
  begin
184
178
  $client.bib_return!(get_loan_fields)
185
179
  _update_loan_list
@@ -192,7 +186,6 @@ module Ig3tool
192
186
  end
193
187
 
194
188
  def books_delete(widget)
195
- puts "-> books_delete"
196
189
  begin
197
190
  $client.bib_remove!(get_fields)
198
191
  _update_books_list
@@ -205,17 +198,14 @@ module Ig3tool
205
198
  end
206
199
 
207
200
  def loan_refresh(widget)
208
- puts "-> loan_refresh"
209
201
  _update_loan_list
210
202
  end
211
203
 
212
204
  def books_refresh(widget)
213
- puts "-> books_refresh"
214
205
  _update_books_list
215
206
  end
216
207
 
217
208
  def tabfocus(widget, arg0, arg1)
218
- puts "-> tabfocus"
219
209
  if arg1 == 1
220
210
  _update_loan_list
221
211
  else
@@ -224,24 +214,19 @@ module Ig3tool
224
214
  end
225
215
 
226
216
  def isbn_ins(a,b,c)
227
- puts "-> isbn_ins"
228
217
  reset_books_fields(false)
229
218
  end
230
219
  def isbn_del(a,b,c,d)
231
- puts "-> isbn_del"
232
220
  reset_books_fields(false)
233
221
  end
234
222
  def loan_isbn_ins(a,b,c,d)
235
- puts "-> loan_isbn_ins"
236
223
  @loan_title.text = ""
237
224
  end
238
225
  def loan_isbn_del(a,b,c)
239
- puts "-> loan_isbn_del"
240
226
  @loan_title.text = ""
241
227
  end
242
228
 
243
229
  def loan_isbn_set(widget)
244
- puts "-> loan_isbn_set"
245
230
  begin
246
231
  book = $client.bib_info(@loan_isbn.text)
247
232
  raise Exception, "the ig3tool imps found no such book..." if book.nil?
@@ -255,16 +240,12 @@ module Ig3tool
255
240
 
256
241
 
257
242
  def books_find(widget)
258
- puts "-> books_find"
259
- puts "start find"
260
243
  Thread.new do
261
244
  begin
262
245
  books = $client.bib_lookup(get_fields)
263
246
  if books.size == 1
264
- puts "find 1"
265
247
  _show(books.first)
266
248
  else
267
- puts "find 2"
268
249
  _update_books_list(books)
269
250
  end
270
251
  rescue Exception => e
@@ -272,11 +253,9 @@ module Ig3tool
272
253
  @books_notification.text = e.message.smaller
273
254
  end
274
255
  end
275
- puts "end find"
276
256
  end
277
257
 
278
258
  def reset_books_fields(all=true)
279
- puts "-> reset_books_fields"
280
259
  @books_isbn.text = "" if all
281
260
  @loan_isbn.text = ""
282
261
  @books_title.text = ""
@@ -291,14 +270,12 @@ module Ig3tool
291
270
  end
292
271
 
293
272
  def books_clear(widget, all=true)
294
- puts "-> books_clear"
295
273
  reset_books_fields(all)
296
274
  #_update_books_list
297
275
  end
298
276
 
299
277
 
300
278
  def loan_clear(widget, all=true)
301
- puts "-> loan_clear"
302
279
  @loan_isbn.text = ""
303
280
  @loan_memberid.text = ""
304
281
  @loan_warranty.text = "5"
@@ -308,10 +285,19 @@ module Ig3tool
308
285
  end
309
286
 
310
287
  def loan_loan(widget)
311
- puts "-> loan_loan"
312
288
  @loan_notification.text = ""
313
289
  begin
314
- $client.bib_loan!(get_loan_fields)
290
+ fields = get_loan_fields
291
+ if fields["member"] =~ /[a-zA-Z]+/
292
+ puts "username ipv barcode: #{fields["member"]}"
293
+ membership = $client.person_membership(fields["member"])
294
+ if membership.nil?
295
+ raise IG3Error, "#{fields["member"]} is not a member..."
296
+ else
297
+ fields["member"] = membership.barcode
298
+ end
299
+ end
300
+ $client.bib_loan!(fields)
315
301
  _update_loan_list
316
302
  loan_clear(nil)
317
303
  rescue Exception => e
@@ -370,7 +356,6 @@ module Ig3tool
370
356
  end
371
357
 
372
358
  def _show(book)
373
- puts "-> _show"
374
359
  @books_isbn.text = book["isbn"]
375
360
  @loan_isbn.text = book["isbn"]
376
361
  @books_title.text = book["title"]
@@ -387,7 +372,6 @@ module Ig3tool
387
372
  end
388
373
 
389
374
  def _update_books_list(books=nil, clear=true)
390
- puts "-> _update_books_list"
391
375
  @books_notification.text = "loading books..."
392
376
  @books_list_store.clear if clear
393
377
  Thread.new do
@@ -407,7 +391,6 @@ module Ig3tool
407
391
  end
408
392
 
409
393
  def _update_loan_list(clear=true)
410
- puts "-> _update_loan_list"
411
394
  @loan_list_store.clear if clear
412
395
  Thread.new do
413
396
  loans = $client.bib_loans
@@ -420,7 +403,6 @@ module Ig3tool
420
403
 
421
404
 
422
405
  def _update_sections
423
- puts "-> _update_sections"
424
406
  sections = $client.bib_sections
425
407
  sections_model = Gtk::ListStore.new(Object, String)
426
408
 
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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Pinte