Class: Checkin
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Checkin
- Defined in:
- app/models/checkin.rb
Instance Attribute Summary collapse
-
#item_identifier ⇒ Object
Returns the value of attribute item_identifier.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#item_identifier ⇒ Object
Returns the value of attribute item_identifier.
14 15 16 |
# File 'app/models/checkin.rb', line 14 def item_identifier @item_identifier end |
Class Method Details
.per_page ⇒ Object
16 17 18 |
# File 'app/models/checkin.rb', line 16 def self.per_page 10 end |
Instance Method Details
#item_checkin(current_user) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/models/checkin.rb', line 20 def item_checkin(current_user) = '' Checkin.transaction do checkouts = Checkout.not_returned.where(:item_id => item_id).select([:id, :item_id, :user_id, :basket_id, :lock_version]) item.checkin! checkouts.each do |checkout| # TODO: ILL時の処理 checkout.checkin = self unless checkout.user.try(:save_checkout_history) checkout.user = nil end checkout.save(:validate => false) unless checkout.item.shelf.library == current_user.library << I18n.t('checkin.other_library_item') end end if item.reserved? # TODO: もっと目立たせるために別画面を表示するべき? << I18n.t('item.this_item_is_reserved') item.retain(current_user) end if item.include_supplements? << I18n.t('item.this_item_include_supplement') end # メールとメッセージの送信 #ReservationNotifier.deliver_reserved(item.manifestation.reserves.first.user, item.manifestation) #Message.create(:sender => current_user, :receiver => item.manifestation.next_reservation.user, :subject => message_template.title, :body => message_template.body, :recipient => item.manifestation.next_reservation.user) end if .present? else nil end end |