enju_circulation 0.0.47 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/app/models/reserve.rb +9 -9
  2. data/lib/enju_circulation/controller.rb +25 -0
  3. data/lib/enju_circulation/manifestation.rb +61 -45
  4. data/lib/enju_circulation/version.rb +1 -1
  5. data/lib/enju_circulation.rb +4 -1
  6. data/spec/dummy/README.rdoc +261 -0
  7. data/spec/dummy/app/controllers/application_controller.rb +4 -13
  8. data/spec/dummy/app/models/user_group.rb +11 -0
  9. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  10. data/spec/dummy/db/migrate/001_create_patrons.rb +1 -5
  11. data/spec/dummy/db/migrate/005_create_manifestations.rb +1 -8
  12. data/spec/dummy/db/migrate/006_create_items.rb +1 -6
  13. data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
  14. data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
  15. data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
  16. data/spec/dummy/db/migrate/073_create_carrier_types.rb +1 -5
  17. data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
  18. data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
  19. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +1 -7
  20. data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +1 -5
  21. data/spec/dummy/db/migrate/20081025083323_create_countries.rb +28 -0
  22. data/spec/dummy/db/migrate/20081025083905_create_languages.rb +1 -5
  23. data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +12 -0
  24. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
  25. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
  26. data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
  27. data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
  28. data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
  29. data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
  30. data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +13 -0
  31. data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
  32. data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +11 -0
  33. data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
  34. data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
  35. data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
  36. data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
  37. data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
  38. data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
  39. data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
  40. data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
  41. data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
  42. data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
  43. data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +13 -0
  44. data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
  45. data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
  46. data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
  47. data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
  48. data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
  49. data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
  50. data/spec/dummy/db/schema.rb +246 -36
  51. data/spec/dummy/db/test.sqlite3 +0 -0
  52. data/spec/dummy/lib/enju_leaf.rb +2 -0
  53. metadata +71 -33
  54. data/lib/enju_circulation/user_group.rb +0 -10
  55. data/spec/dummy/app/models/basket.rb +0 -64
  56. data/spec/dummy/app/models/carrier_type.rb +0 -33
  57. data/spec/dummy/app/models/event.rb +0 -85
  58. data/spec/dummy/app/models/event_category.rb +0 -23
  59. data/spec/dummy/app/models/exemplify.rb +0 -45
  60. data/spec/dummy/app/models/item.rb +0 -278
  61. data/spec/dummy/app/models/language.rb +0 -4
  62. data/spec/dummy/app/models/library.rb +0 -128
  63. data/spec/dummy/app/models/library_group.rb +0 -86
  64. data/spec/dummy/app/models/manifestation.rb +0 -13
  65. data/spec/dummy/app/models/patron.rb +0 -168
  66. data/spec/dummy/app/models/patron_type.rb +0 -19
  67. data/spec/dummy/app/models/request_status_type.rb +0 -19
  68. data/spec/dummy/app/models/request_type.rb +0 -18
  69. data/spec/dummy/app/models/shelf.rb +0 -54
Binary file
@@ -6,3 +6,5 @@ require 'enju_leaf/import_file'
6
6
  require 'enju_leaf/master_model'
7
7
  require 'enju_leaf/localized_name'
8
8
  require 'enju_leaf/url_validator'
9
+ require 'enju_biblio'
10
+ require 'enju_library'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_circulation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47
4
+ version: 0.0.48
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-29 00:00:00.000000000 Z
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -521,9 +521,9 @@ files:
521
521
  - db/migrate/20111217234412_add_save_checkout_history_to_user.rb
522
522
  - db/migrate/20111218002349_add_checkout_icalendar_token_to_user.rb
523
523
  - db/migrate/20120424103932_add_librarian_id_to_checked_item.rb
524
+ - lib/enju_circulation/controller.rb
524
525
  - lib/enju_circulation/engine.rb
525
526
  - lib/enju_circulation/manifestation.rb
526
- - lib/enju_circulation/user_group.rb
527
527
  - lib/enju_circulation/version.rb
528
528
  - lib/enju_circulation.rb
529
529
  - lib/tasks/enju_circulation_tasks.rake
@@ -556,22 +556,7 @@ files:
556
556
  - spec/dummy/app/helpers/application_helper.rb
557
557
  - spec/dummy/app/mailers/notifier.rb
558
558
  - spec/dummy/app/models/ability.rb
559
- - spec/dummy/app/models/basket.rb
560
- - spec/dummy/app/models/carrier_type.rb
561
- - spec/dummy/app/models/event.rb
562
- - spec/dummy/app/models/event_category.rb
563
- - spec/dummy/app/models/exemplify.rb
564
- - spec/dummy/app/models/item.rb
565
- - spec/dummy/app/models/language.rb
566
- - spec/dummy/app/models/library.rb
567
- - spec/dummy/app/models/library_group.rb
568
- - spec/dummy/app/models/manifestation.rb
569
- - spec/dummy/app/models/patron.rb
570
- - spec/dummy/app/models/patron_type.rb
571
- - spec/dummy/app/models/request_status_type.rb
572
- - spec/dummy/app/models/request_type.rb
573
559
  - spec/dummy/app/models/role.rb
574
- - spec/dummy/app/models/shelf.rb
575
560
  - spec/dummy/app/models/user.rb
576
561
  - spec/dummy/app/models/user_group.rb
577
562
  - spec/dummy/app/models/user_has_role.rb
@@ -606,6 +591,9 @@ files:
606
591
  - spec/dummy/db/migrate/001_create_patrons.rb
607
592
  - spec/dummy/db/migrate/005_create_manifestations.rb
608
593
  - spec/dummy/db/migrate/006_create_items.rb
594
+ - spec/dummy/db/migrate/012_create_owns.rb
595
+ - spec/dummy/db/migrate/015_create_creates.rb
596
+ - spec/dummy/db/migrate/047_create_produces.rb
609
597
  - spec/dummy/db/migrate/059_create_libraries.rb
610
598
  - spec/dummy/db/migrate/069_create_shelves.rb
611
599
  - spec/dummy/db/migrate/073_create_carrier_types.rb
@@ -614,27 +602,57 @@ files:
614
602
  - spec/dummy/db/migrate/113_create_events.rb
615
603
  - spec/dummy/db/migrate/114_create_event_categories.rb
616
604
  - spec/dummy/db/migrate/120_create_baskets.rb
605
+ - spec/dummy/db/migrate/125_create_donates.rb
617
606
  - spec/dummy/db/migrate/130_create_request_status_types.rb
618
607
  - spec/dummy/db/migrate/131_create_request_types.rb
619
608
  - spec/dummy/db/migrate/149_create_message_templates.rb
620
609
  - spec/dummy/db/migrate/154_create_messages.rb
621
610
  - spec/dummy/db/migrate/20080819181903_create_message_requests.rb
611
+ - spec/dummy/db/migrate/20080830154109_create_realizes.rb
622
612
  - spec/dummy/db/migrate/20080830172106_create_exemplifies.rb
623
613
  - spec/dummy/db/migrate/20080905191442_create_patron_types.rb
614
+ - spec/dummy/db/migrate/20081025083323_create_countries.rb
624
615
  - spec/dummy/db/migrate/20081025083905_create_languages.rb
616
+ - spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb
617
+ - spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb
618
+ - spec/dummy/db/migrate/20091202124834_create_versions.rb
619
+ - spec/dummy/db/migrate/20091214131723_create_series_statements.rb
625
620
  - spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb
626
621
  - spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb
622
+ - spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb
623
+ - spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb
624
+ - spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb
625
+ - spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb
626
+ - spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb
627
+ - spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb
627
628
  - spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb
628
629
  - spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb
629
630
  - spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb
631
+ - spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb
632
+ - spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb
633
+ - spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb
634
+ - spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb
635
+ - spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb
636
+ - spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb
637
+ - spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb
638
+ - spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb
630
639
  - spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb
640
+ - spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb
631
641
  - spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb
642
+ - spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb
643
+ - spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb
644
+ - spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb
632
645
  - spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb
646
+ - spec/dummy/db/migrate/20111124110059_create_create_types.rb
647
+ - spec/dummy/db/migrate/20111124110319_create_realize_types.rb
648
+ - spec/dummy/db/migrate/20111124110355_create_produce_types.rb
649
+ - spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb
633
650
  - spec/dummy/db/migrate/20111201121844_create_roles.rb
634
651
  - spec/dummy/db/migrate/20111201155456_create_users.rb
635
652
  - spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb
636
653
  - spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb
637
654
  - spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb
655
+ - spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb
638
656
  - spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb
639
657
  - spec/dummy/db/schema.rb
640
658
  - spec/dummy/db/test.sqlite3
@@ -651,6 +669,7 @@ files:
651
669
  - spec/dummy/public/500.html
652
670
  - spec/dummy/public/favicon.ico
653
671
  - spec/dummy/Rakefile
672
+ - spec/dummy/README.rdoc
654
673
  - spec/dummy/script/delayed_job
655
674
  - spec/dummy/script/rails
656
675
  - spec/dummy/solr/conf/admin-extra.html
@@ -804,22 +823,7 @@ test_files:
804
823
  - spec/dummy/app/helpers/application_helper.rb
805
824
  - spec/dummy/app/mailers/notifier.rb
806
825
  - spec/dummy/app/models/ability.rb
807
- - spec/dummy/app/models/basket.rb
808
- - spec/dummy/app/models/carrier_type.rb
809
- - spec/dummy/app/models/event.rb
810
- - spec/dummy/app/models/event_category.rb
811
- - spec/dummy/app/models/exemplify.rb
812
- - spec/dummy/app/models/item.rb
813
- - spec/dummy/app/models/language.rb
814
- - spec/dummy/app/models/library.rb
815
- - spec/dummy/app/models/library_group.rb
816
- - spec/dummy/app/models/manifestation.rb
817
- - spec/dummy/app/models/patron.rb
818
- - spec/dummy/app/models/patron_type.rb
819
- - spec/dummy/app/models/request_status_type.rb
820
- - spec/dummy/app/models/request_type.rb
821
826
  - spec/dummy/app/models/role.rb
822
- - spec/dummy/app/models/shelf.rb
823
827
  - spec/dummy/app/models/user.rb
824
828
  - spec/dummy/app/models/user_group.rb
825
829
  - spec/dummy/app/models/user_has_role.rb
@@ -854,6 +858,9 @@ test_files:
854
858
  - spec/dummy/db/migrate/001_create_patrons.rb
855
859
  - spec/dummy/db/migrate/005_create_manifestations.rb
856
860
  - spec/dummy/db/migrate/006_create_items.rb
861
+ - spec/dummy/db/migrate/012_create_owns.rb
862
+ - spec/dummy/db/migrate/015_create_creates.rb
863
+ - spec/dummy/db/migrate/047_create_produces.rb
857
864
  - spec/dummy/db/migrate/059_create_libraries.rb
858
865
  - spec/dummy/db/migrate/069_create_shelves.rb
859
866
  - spec/dummy/db/migrate/073_create_carrier_types.rb
@@ -862,27 +869,57 @@ test_files:
862
869
  - spec/dummy/db/migrate/113_create_events.rb
863
870
  - spec/dummy/db/migrate/114_create_event_categories.rb
864
871
  - spec/dummy/db/migrate/120_create_baskets.rb
872
+ - spec/dummy/db/migrate/125_create_donates.rb
865
873
  - spec/dummy/db/migrate/130_create_request_status_types.rb
866
874
  - spec/dummy/db/migrate/131_create_request_types.rb
867
875
  - spec/dummy/db/migrate/149_create_message_templates.rb
868
876
  - spec/dummy/db/migrate/154_create_messages.rb
869
877
  - spec/dummy/db/migrate/20080819181903_create_message_requests.rb
878
+ - spec/dummy/db/migrate/20080830154109_create_realizes.rb
870
879
  - spec/dummy/db/migrate/20080830172106_create_exemplifies.rb
871
880
  - spec/dummy/db/migrate/20080905191442_create_patron_types.rb
881
+ - spec/dummy/db/migrate/20081025083323_create_countries.rb
872
882
  - spec/dummy/db/migrate/20081025083905_create_languages.rb
883
+ - spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb
884
+ - spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb
885
+ - spec/dummy/db/migrate/20091202124834_create_versions.rb
886
+ - spec/dummy/db/migrate/20091214131723_create_series_statements.rb
873
887
  - spec/dummy/db/migrate/20100211105551_add_admin_networks_to_library_group.rb
874
888
  - spec/dummy/db/migrate/20100222124420_add_allow_bookmark_external_url_to_library_group.rb
889
+ - spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb
890
+ - spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb
891
+ - spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb
892
+ - spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb
893
+ - spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb
894
+ - spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb
875
895
  - spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb
876
896
  - spec/dummy/db/migrate/20110115022329_add_position_to_library_group.rb
877
897
  - spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb
898
+ - spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb
899
+ - spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb
900
+ - spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb
901
+ - spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb
902
+ - spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb
903
+ - spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb
904
+ - spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb
905
+ - spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb
878
906
  - spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb
907
+ - spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb
879
908
  - spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb
909
+ - spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb
910
+ - spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb
911
+ - spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb
880
912
  - spec/dummy/db/migrate/20111020063828_remove_dsbl_from_library_group.rb
913
+ - spec/dummy/db/migrate/20111124110059_create_create_types.rb
914
+ - spec/dummy/db/migrate/20111124110319_create_realize_types.rb
915
+ - spec/dummy/db/migrate/20111124110355_create_produce_types.rb
916
+ - spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb
881
917
  - spec/dummy/db/migrate/20111201121844_create_roles.rb
882
918
  - spec/dummy/db/migrate/20111201155456_create_users.rb
883
919
  - spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb
884
920
  - spec/dummy/db/migrate/20111201163718_create_user_has_roles.rb
885
921
  - spec/dummy/db/migrate/20120105074911_add_isil_to_library.rb
922
+ - spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb
886
923
  - spec/dummy/db/migrate/20120224094141_create_delayed_jobs.rb
887
924
  - spec/dummy/db/schema.rb
888
925
  - spec/dummy/db/test.sqlite3
@@ -899,6 +936,7 @@ test_files:
899
936
  - spec/dummy/public/500.html
900
937
  - spec/dummy/public/favicon.ico
901
938
  - spec/dummy/Rakefile
939
+ - spec/dummy/README.rdoc
902
940
  - spec/dummy/script/delayed_job
903
941
  - spec/dummy/script/rails
904
942
  - spec/dummy/solr/conf/admin-extra.html
@@ -1,10 +0,0 @@
1
- class UserGroup < ActiveRecord::Base
2
- has_many :user_group_has_checkout_types, :dependent => :destroy
3
- has_many :checkout_types, :through => :user_group_has_checkout_types, :order => :position
4
- has_many :lending_policies
5
-
6
- validates_numericality_of :number_of_day_to_notify_due_date,
7
- :number_of_day_to_notify_overdue,
8
- :number_of_time_to_notify_overdue,
9
- :greater_than_or_equal_to => 0
10
- end
@@ -1,64 +0,0 @@
1
- class Basket < ActiveRecord::Base
2
- attr_accessible :note
3
- default_scope :order => 'baskets.id DESC'
4
- scope :will_expire, lambda {|date| {:conditions => ['created_at < ?', date]}}
5
- belongs_to :user, :validate => true
6
- has_many :accepts
7
-
8
- validates_associated :user, :on => :create
9
- # 貸出完了後にかごのユーザidは破棄する
10
- validates_presence_of :user, :on => :create
11
- validate :check_suspended
12
-
13
- attr_accessor :user_number
14
-
15
- def check_suspended
16
- if self.user
17
- errors[:base] << I18n.t('basket.this_account_is_suspended') if self.user.locked_at?
18
- else
19
- errors[:base] << I18n.t('user.not_found')
20
- end
21
- end
22
-
23
- def self.expire
24
- Basket.will_expire(Time.zone.now.beginning_of_day).destroy_all
25
- logger.info "#{Time.zone.now} baskets expired!"
26
- end
27
-
28
- if defined?(EnjuCirculation)
29
- has_many :checked_items, :dependent => :destroy
30
- has_many :items, :through => :checked_items
31
- has_many :checkouts
32
- has_many :checkins
33
-
34
- def basket_checkout(librarian)
35
- return nil if checked_items.size == 0
36
- Item.transaction do
37
- self.checked_items.each do |checked_item|
38
- checkout = self.user.checkouts.new
39
- checkout.librarian = librarian
40
- checkout.item = checked_item.item
41
- checkout.basket = self
42
- checkout.due_date = checked_item.due_date
43
- checked_item.item.checkout!(user)
44
- checkout.save!
45
- end
46
- CheckedItem.destroy_all(:basket_id => id)
47
- end
48
- end
49
- end
50
- end
51
-
52
- # == Schema Information
53
- #
54
- # Table name: baskets
55
- #
56
- # id :integer not null, primary key
57
- # user_id :integer
58
- # note :text
59
- # type :string(255)
60
- # lock_version :integer default(0), not null
61
- # created_at :datetime
62
- # updated_at :datetime
63
- #
64
-
@@ -1,33 +0,0 @@
1
- class CarrierType < ActiveRecord::Base
2
- include MasterModel
3
- default_scope :order => "position"
4
- has_many :manifestations
5
- if defined?(EnjuCirculation)
6
- has_many :carrier_type_has_checkout_types, :dependent => :destroy
7
- has_many :checkout_types, :through => :carrier_type_has_checkout_types
8
- end
9
-
10
- def mods_type
11
- case name
12
- when 'print'
13
- 'text'
14
- else
15
- # TODO: その他のタイプ
16
- 'software, multimedia'
17
- end
18
- end
19
- end
20
-
21
- # == Schema Information
22
- #
23
- # Table name: carrier_types
24
- #
25
- # id :integer not null, primary key
26
- # name :string(255) not null
27
- # display_name :text
28
- # note :text
29
- # position :integer
30
- # created_at :datetime
31
- # updated_at :datetime
32
- #
33
-
@@ -1,85 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- class Event < ActiveRecord::Base
3
- scope :closing_days, includes(:event_category).where('event_categories.name = ?', 'closed')
4
- scope :on, lambda {|datetime| where('start_at >= ? AND start_at < ?', datetime.beginning_of_day, datetime.tomorrow.beginning_of_day + 1)}
5
- scope :past, lambda {|datetime| where('end_at <= ?', Time.zone.parse(datetime).beginning_of_day)}
6
- scope :upcoming, lambda {|datetime| where('start_at >= ?', Time.zone.parse(datetime).beginning_of_day)}
7
- scope :at, lambda {|library| where(:library_id => library.id)}
8
-
9
- belongs_to :event_category, :validate => true
10
- belongs_to :library, :validate => true
11
- has_many :attachment_files, :as => :attachable
12
- has_many :picture_files, :as => :picture_attachable
13
- has_many :participates, :dependent => :destroy
14
- has_many :patrons, :through => :participates
15
- has_one :event_import_result
16
-
17
- searchable do
18
- text :name, :note
19
- integer :library_id
20
- time :created_at
21
- time :updated_at
22
- time :start_at
23
- time :end_at
24
- end
25
-
26
- validates_presence_of :name, :library, :event_category
27
- validates_associated :library, :event_category
28
- validate :check_date
29
- before_validation :set_date
30
- before_validation :set_display_name, :on => :create
31
-
32
- def self.per_page
33
- 10
34
- end
35
-
36
- def set_date
37
- if self.start_at.blank?
38
- self.start_at = Time.zone.today.beginning_of_day
39
- end
40
- if self.end_at.blank?
41
- self.end_at = Time.zone.today.end_of_day
42
- end
43
-
44
- set_all_day
45
- end
46
-
47
- def set_all_day
48
- if self.all_day
49
- self.start_at = self.start_at.beginning_of_day
50
- self.end_at = self.end_at.end_of_day
51
- end
52
- end
53
-
54
- def check_date
55
- if self.start_at and self.end_at
56
- if self.start_at >= self.end_at
57
- errors.add(:start_at)
58
- errors.add(:end_at)
59
- end
60
- end
61
- end
62
-
63
- def set_display_name
64
- self.display_name = self.name if self.display_name.blank?
65
- end
66
- end
67
-
68
- # == Schema Information
69
- #
70
- # Table name: events
71
- #
72
- # id :integer not null, primary key
73
- # library_id :integer default(1), not null
74
- # event_category_id :integer default(1), not null
75
- # name :string(255)
76
- # note :text
77
- # start_at :datetime
78
- # end_at :datetime
79
- # all_day :boolean default(FALSE), not null
80
- # deleted_at :datetime
81
- # created_at :datetime
82
- # updated_at :datetime
83
- # display_name :text
84
- #
85
-
@@ -1,23 +0,0 @@
1
- class EventCategory < ActiveRecord::Base
2
- include MasterModel
3
- default_scope :order => "position"
4
- has_many :events
5
-
6
- def self.per_page
7
- 10
8
- end
9
- end
10
-
11
- # == Schema Information
12
- #
13
- # Table name: event_categories
14
- #
15
- # id :integer not null, primary key
16
- # name :string(255) not null
17
- # display_name :text
18
- # note :text
19
- # position :integer
20
- # created_at :datetime
21
- # updated_at :datetime
22
- #
23
-