fossil 0.1.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/Rakefile +19 -0
- data/VERSION +1 -0
- data/fossil.gemspec +136 -0
- data/lib/models/ac_qualification.rb +91 -0
- data/lib/models/aircraft.rb +397 -0
- data/lib/models/aircraft_cost.rb +65 -0
- data/lib/models/aircraft_document.rb +41 -0
- data/lib/models/aircraft_log.rb +179 -0
- data/lib/models/aircraft_maint.rb +93 -0
- data/lib/models/aircraft_note.rb +115 -0
- data/lib/models/aircraft_rate.rb +124 -0
- data/lib/models/aircraft_time.rb +87 -0
- data/lib/models/aircraft_type.rb +159 -0
- data/lib/models/airport.rb +256 -0
- data/lib/models/airport_cost.rb +46 -0
- data/lib/models/airport_fbo.rb +98 -0
- data/lib/models/airport_fuel.rb +78 -0
- data/lib/models/airport_service.rb +90 -0
- data/lib/models/ap_operational_msg.rb +33 -0
- data/lib/models/audit_trail.rb +26 -0
- data/lib/models/btrieve_code_name.rb +104 -0
- data/lib/models/cargo.rb +39 -0
- data/lib/models/check_group.rb +17 -0
- data/lib/models/checklist.rb +98 -0
- data/lib/models/city_pair.rb +43 -0
- data/lib/models/code.rb +57 -0
- data/lib/models/comment.rb +30 -0
- data/lib/models/comments2.rb +20 -0
- data/lib/models/company_information.rb +565 -0
- data/lib/models/contact.rb +42 -0
- data/lib/models/contract.rb +53 -0
- data/lib/models/contract_item.rb +58 -0
- data/lib/models/cost_center.rb +16 -0
- data/lib/models/crew_activity.rb +42 -0
- data/lib/models/crew_currency_by_cct.rb +255 -0
- data/lib/models/crew_currency_gen.rb +84 -0
- data/lib/models/crew_duty.rb +128 -0
- data/lib/models/crew_history_item.rb +132 -0
- data/lib/models/crew_information.rb +137 -0
- data/lib/models/crew_leg.rb +127 -0
- data/lib/models/crew_training_group.rb +33 -0
- data/lib/models/crew_training_item.rb +146 -0
- data/lib/models/crew_training_log.rb +39 -0
- data/lib/models/crew_trip.rb +60 -0
- data/lib/models/currency_rate.rb +27 -0
- data/lib/models/exp_record.rb +75 -0
- data/lib/models/field_list.rb +25 -0
- data/lib/models/flight_log_expense.rb +90 -0
- data/lib/models/flt_cas.rb +52 -0
- data/lib/models/flt_crew.rb +80 -0
- data/lib/models/flt_data.rb +132 -0
- data/lib/models/flt_exp.rb +57 -0
- data/lib/models/flt_leg.rb +125 -0
- data/lib/models/group_cost.rb +22 -0
- data/lib/models/icaocode.rb +23 -0
- data/lib/models/language.rb +50 -0
- data/lib/models/leg_request.rb +39 -0
- data/lib/models/leg_time.rb +100 -0
- data/lib/models/logbook.rb +95 -0
- data/lib/models/maint_time.rb +44 -0
- data/lib/models/msg_itin.rb +42 -0
- data/lib/models/msg_trip.rb +56 -0
- data/lib/models/no_fly_list.rb +37 -0
- data/lib/models/note.rb +27 -0
- data/lib/models/one_cost.rb +98 -0
- data/lib/models/passenger.rb +336 -0
- data/lib/models/passenger_rate.rb +51 -0
- data/lib/models/passport.rb +35 -0
- data/lib/models/patient.rb +144 -0
- data/lib/models/pax_ap_serv.rb +30 -0
- data/lib/models/pax_note.rb +109 -0
- data/lib/models/personnel.rb +192 -0
- data/lib/models/place.rb +54 -0
- data/lib/models/planner.rb +57 -0
- data/lib/models/quote.rb +465 -0
- data/lib/models/quote_leg.rb +401 -0
- data/lib/models/report_define.rb +34 -0
- data/lib/models/report_filter.rb +56 -0
- data/lib/models/report_user.rb +54 -0
- data/lib/models/requirements_limit.rb +405 -0
- data/lib/models/sifl_table.rb +43 -0
- data/lib/models/sms.rb +106 -0
- data/lib/models/training_course.rb +34 -0
- data/lib/models/training_group.rb +21 -0
- data/lib/models/training_item.rb +102 -0
- data/lib/models/travel_request.rb +51 -0
- data/lib/models/trip.rb +342 -0
- data/lib/models/trip_leg.rb +1149 -0
- data/lib/models/trip_passenger.rb +188 -0
- data/lib/models/update.rb +38 -0
- data/lib/models/user_information.rb +248 -0
- data/lib/models/user_log.rb +23 -0
- data/lib/models/vendor.rb +93 -0
- data/lib/models/vendor_document.rb +97 -0
- data/lib/models/visa.rb +36 -0
- data/lib/sequel/code_group.rb +89 -0
- data/lib/sequel/fos_dates.rb +54 -0
- data/lib/sequel/metaprogramming.rb +8 -0
- data/lib/sequel/model_patch.rb +277 -0
- data/lib/sequel/pervasive_adapter.rb +214 -0
- data/lib/sequel/serializer/json_serializer.rb +129 -0
- data/lib/sequel/serializer/serializer.rb +94 -0
- data/lib/sequel/serializer/xml_serializer.rb +393 -0
- metadata +157 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
class UserLog < Sequel::Model(:'user log')
|
2
|
+
|
3
|
+
#### BEGIN GENERATED SECTION ####
|
4
|
+
set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
|
5
|
+
|
6
|
+
column_alias :crew, :'crew'
|
7
|
+
column_alias :internal0, :'internal0'
|
8
|
+
column_alias :internal1, :'internal1'
|
9
|
+
column_alias :internal2, :'internal2'
|
10
|
+
column_alias :internal3, :'internal3'
|
11
|
+
column_alias :internal4, :'internal4'
|
12
|
+
column_alias :kid_comm, :'kid - comm'
|
13
|
+
column_alias :kid_date, :'kid - date'
|
14
|
+
column_alias :kid_mult, :'kid - mult'
|
15
|
+
column_alias :kid_time, :'kid - time'
|
16
|
+
column_alias :kid_user, :'kid - user'
|
17
|
+
column_alias :license_number, :'license number'
|
18
|
+
column_alias :login_date, :'login date'
|
19
|
+
column_alias :login_time, :'login time'
|
20
|
+
column_alias :user_id, :'user id'
|
21
|
+
#### END GENERATED SECTION ####
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
class Vendor < Sequel::Model(:'vendors')
|
2
|
+
# NOTE - Count of instances as of 06/01/2009 => 316
|
3
|
+
|
4
|
+
#### BEGIN GENERATED SECTION ####
|
5
|
+
set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
|
6
|
+
|
7
|
+
column_alias :account_number, :'account number'
|
8
|
+
column_alias :addl_insured_doc, :'addl insured doc'
|
9
|
+
column_alias :address_1, :'address 1'
|
10
|
+
column_alias :address_2, :'address 2'
|
11
|
+
column_alias :address_3, :'address 3'
|
12
|
+
column_alias :aircraft_specs, :'aircraft specs'
|
13
|
+
column_alias :aircraft_vendor, :'aircraft vendor'
|
14
|
+
column_alias :airport_id, :'airport id'
|
15
|
+
column_alias :airport_id_prefix, :'airport id prefix'
|
16
|
+
column_alias :airport_service, :'airport service'
|
17
|
+
column_alias :approval_1, :'approval 1'
|
18
|
+
column_alias :approval_2, :'approval 2'
|
19
|
+
column_alias :approval_3, :'approval 3'
|
20
|
+
column_alias :approved, :'approved'
|
21
|
+
column_alias :approved_date, :'approved date'
|
22
|
+
column_alias :base_code, :'base code'
|
23
|
+
column_alias :bill_address, :'bill address'
|
24
|
+
column_alias :bill_address_3, :'bill address 3'
|
25
|
+
column_alias :bill_apt_suite, :'bill apt suite'
|
26
|
+
column_alias :bill_city, :'bill city'
|
27
|
+
column_alias :bill_country, :'bill country'
|
28
|
+
column_alias :bill_state, :'bill state'
|
29
|
+
column_alias :bill_zip, :'bill zip'
|
30
|
+
column_alias :call_sign, :'call sign'
|
31
|
+
column_alias :certificate_135_doc, :'certificate 135 doc'
|
32
|
+
column_alias :certificate_name, :'certificate name'
|
33
|
+
column_alias :city, :'city'
|
34
|
+
column_alias :company_1, :'company 1'
|
35
|
+
column_alias :company_2, :'company 2'
|
36
|
+
column_alias :company_code, :'company code'
|
37
|
+
column_alias :company_info, :'company info'
|
38
|
+
column_alias :company_key, :'company key'
|
39
|
+
column_alias :computer_system, :'computer system'
|
40
|
+
column_alias :country, :'country'
|
41
|
+
column_alias :crew_faa_8410, :'crew faa 8410'
|
42
|
+
column_alias :faa_air_carrier, :'faa air carrier'
|
43
|
+
column_alias :faa_drug_doc, :'faa drug doc'
|
44
|
+
column_alias :faa_office, :'faa office'
|
45
|
+
column_alias :faa_repair_station, :'faa repair station'
|
46
|
+
column_alias :fax, :'fax'
|
47
|
+
column_alias :federal_id_num, :'federal id num'
|
48
|
+
column_alias :federal_number, :'federal number'
|
49
|
+
column_alias :flog_exp_vendor, :'flog exp vendor'
|
50
|
+
column_alias :inactive, :'inactive'
|
51
|
+
column_alias :insurance_doc, :'insurance doc'
|
52
|
+
column_alias :internal0, :'internal0'
|
53
|
+
column_alias :internal01, :'internal01'
|
54
|
+
column_alias :internal02, :'internal02'
|
55
|
+
column_alias :internal03, :'internal03'
|
56
|
+
column_alias :internal04, :'internal04'
|
57
|
+
column_alias :kid_comm, :'kid - comm'
|
58
|
+
column_alias :kid_date, :'kid - date'
|
59
|
+
column_alias :kid_mult, :'kid - mult'
|
60
|
+
column_alias :kid_time, :'kid - time'
|
61
|
+
column_alias :kid_user, :'kid - user'
|
62
|
+
column_alias :ops_specs, :'ops specs'
|
63
|
+
column_alias :part_135_number, :'part 135 number'
|
64
|
+
column_alias :password, :'password'
|
65
|
+
column_alias :pay_method, :'pay method'
|
66
|
+
column_alias :phone, :'phone'
|
67
|
+
column_alias :problem, :'problem'
|
68
|
+
column_alias :purchase_order_num, :'purchase order num'
|
69
|
+
column_alias :qualification, :'qualification'
|
70
|
+
column_alias :repair_station_no, :'repair station no'
|
71
|
+
column_alias :state, :'state'
|
72
|
+
column_alias :state_number, :'state number'
|
73
|
+
column_alias :terms, :'terms'
|
74
|
+
column_alias :updated_date, :'updated date'
|
75
|
+
column_alias :username, :'username'
|
76
|
+
column_alias :vendor_id, :'vendor id'
|
77
|
+
column_alias :vendor_number, :'vendor number'
|
78
|
+
column_alias :vendor_signoff, :'vendor signoff'
|
79
|
+
column_alias :vendor_status, :'vendor status'
|
80
|
+
column_alias :vendor_type, :'vendor type'
|
81
|
+
column_alias :web_page, :'web page'
|
82
|
+
column_alias :zip, :'zip'
|
83
|
+
column_alias :key0, :'key0'
|
84
|
+
column_alias :key1, :'key1'
|
85
|
+
column_alias :key2, :'key2'
|
86
|
+
column_alias :key3, :'key3'
|
87
|
+
column_alias :key4, :'key4'
|
88
|
+
column_alias :key5, :'key5'
|
89
|
+
column_alias :key6, :'key6'
|
90
|
+
column_alias :key7, :'key7'
|
91
|
+
#### END GENERATED SECTION ####
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
class VendorDocument < Sequel::Model(:'vendor documents')
|
2
|
+
# helper accessors for creating vendor document
|
3
|
+
# filename_prefix helps set up the path to the document
|
4
|
+
attr_accessor :doc_type_value, :doc_filename_prefix, :doc_filename, :doc_type
|
5
|
+
alias :file_name :doc_filename
|
6
|
+
alias :file_name= :doc_filename=
|
7
|
+
|
8
|
+
# Developpers must have the ability to set the PK programmatically
|
9
|
+
unrestrict_primary_key
|
10
|
+
|
11
|
+
# Code associations
|
12
|
+
code_association :type, :document_type, :aircraft_document
|
13
|
+
|
14
|
+
def validate
|
15
|
+
validates_presence [:doc_type_value, :doc_filename_prefix, :file_name, :trip_number, :doc_date, :doc_type]
|
16
|
+
end
|
17
|
+
|
18
|
+
def after_initialize
|
19
|
+
if new?
|
20
|
+
set_kids
|
21
|
+
set_other_vars
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_kids
|
26
|
+
self.kid_date=Date.today.to_fos_days
|
27
|
+
self.kid_time=Time.now.as_minutes
|
28
|
+
self.kid_comm=0
|
29
|
+
self.kid_mult=1
|
30
|
+
self.kid_user="ADMN"
|
31
|
+
end
|
32
|
+
|
33
|
+
def set_other_vars
|
34
|
+
if doc_date.is_a?(String)
|
35
|
+
self.doc_date= Date.parse(doc_date)
|
36
|
+
end
|
37
|
+
self.doc_date= doc_date.to_fos_days if doc_date.is_a?(Date)
|
38
|
+
self.renew_days=0
|
39
|
+
self.category=0
|
40
|
+
self.cost=0
|
41
|
+
self.status_code=0
|
42
|
+
self.acct_number=""
|
43
|
+
self.paid_date=0
|
44
|
+
self.paid=0
|
45
|
+
self.billed_date=0
|
46
|
+
self.image_name=File.join(doc_filename_prefix, doc_filename) if doc_filename
|
47
|
+
self.doc_type= VendorDocument.get_all_types.find{|type| type.value == doc_type_value}
|
48
|
+
self.document_type=doc_type.value if doc_type
|
49
|
+
end
|
50
|
+
|
51
|
+
###### helper aliases for crewres to submit new vendor documents #########
|
52
|
+
column_alias :trip_number, :number, :type => :integer
|
53
|
+
column_alias :description, :name
|
54
|
+
|
55
|
+
#### BEGIN GENERATED SECTION ####
|
56
|
+
set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
|
57
|
+
|
58
|
+
column_alias :acct_number, :'acct number'
|
59
|
+
column_alias :billed, :'billed'
|
60
|
+
column_alias :billed_date, :'billed date'
|
61
|
+
column_alias :category, :'category'
|
62
|
+
column_alias :cost, :'cost'
|
63
|
+
column_alias :doc_date, :'doc date'
|
64
|
+
column_alias :document_type, :'document type'
|
65
|
+
column_alias :exp_date, :'exp date'
|
66
|
+
column_alias :image_name, :'image name'
|
67
|
+
column_alias :inactive, :'inactive'
|
68
|
+
column_alias :internal0, :'internal0'
|
69
|
+
column_alias :internal01, :'internal01'
|
70
|
+
column_alias :internal02, :'internal02'
|
71
|
+
column_alias :internal03, :'internal03'
|
72
|
+
column_alias :internal04, :'internal04'
|
73
|
+
column_alias :internal2, :'internal2'
|
74
|
+
column_alias :kid_comm, :'kid - comm'
|
75
|
+
column_alias :kid_date, :'kid - date'
|
76
|
+
column_alias :kid_mult, :'kid - mult'
|
77
|
+
column_alias :kid_time, :'kid - time'
|
78
|
+
column_alias :kid_user, :'kid - user'
|
79
|
+
column_alias :name, :'name'
|
80
|
+
column_alias :number, :'number'
|
81
|
+
column_alias :paid, :'paid'
|
82
|
+
column_alias :paid_date, :'paid date'
|
83
|
+
column_alias :renew_days, :'renew days'
|
84
|
+
column_alias :status_code, :'status code'
|
85
|
+
column_alias :vendor_id, :'vendor id'
|
86
|
+
column_alias :vendor_kid_comm, :'vendor kid - comm'
|
87
|
+
column_alias :vendor_kid_date, :'vendor kid - date'
|
88
|
+
column_alias :vendor_kid_mult, :'vendor kid - mult'
|
89
|
+
column_alias :vendor_kid_time, :'vendor kid - time'
|
90
|
+
column_alias :vendor_kid_user, :'vendor kid - user'
|
91
|
+
column_alias :key0, :'key0'
|
92
|
+
column_alias :key1, :'key1'
|
93
|
+
column_alias :key2, :'key2'
|
94
|
+
column_alias :key3, :'key3'
|
95
|
+
column_alias :key4, :'key4'
|
96
|
+
#### END GENERATED SECTION ####
|
97
|
+
end
|
data/lib/models/visa.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class Visa < Sequel::Model(:'visa')
|
2
|
+
|
3
|
+
#### BEGIN GENERATED SECTION ####
|
4
|
+
set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time']
|
5
|
+
|
6
|
+
column_alias :city, :'city'
|
7
|
+
column_alias :country, :'country'
|
8
|
+
column_alias :country_code, :'country code'
|
9
|
+
column_alias :date_expire2, :'date expire2'
|
10
|
+
column_alias :date_expire2_days, :'date expire2 days'
|
11
|
+
column_alias :date_expires, :'date expires'
|
12
|
+
column_alias :date_issued, :'date issued'
|
13
|
+
column_alias :entries, :'entries'
|
14
|
+
column_alias :entries_used, :'entries used'
|
15
|
+
column_alias :iata_country_code, :'iata country code'
|
16
|
+
column_alias :inactive, :'inactive'
|
17
|
+
column_alias :internal_2, :'internal 2'
|
18
|
+
column_alias :internal01, :'internal01'
|
19
|
+
column_alias :internal1, :'internal1'
|
20
|
+
column_alias :kid_comm, :'kid - comm'
|
21
|
+
column_alias :kid_date, :'kid - date'
|
22
|
+
column_alias :kid_mult, :'kid - mult'
|
23
|
+
column_alias :kid_time, :'kid - time'
|
24
|
+
column_alias :kid_user, :'kid - user'
|
25
|
+
column_alias :passport_number, :'passport number'
|
26
|
+
column_alias :personnel_kid_comm, :'personnel kid - comm'
|
27
|
+
column_alias :personnel_kid_date, :'personnel kid - date'
|
28
|
+
column_alias :personnel_kid_mult, :'personnel kid - mult'
|
29
|
+
column_alias :personnel_kid_time, :'personnel kid - time'
|
30
|
+
column_alias :personnel_kid_user, :'personnel kid - user'
|
31
|
+
column_alias :visa_number, :'visa number'
|
32
|
+
column_alias :visa_type, :'visa type'
|
33
|
+
column_alias :internal0, :'internal0'
|
34
|
+
#### END GENERATED SECTION ####
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module CodeGroup
|
2
|
+
def CodeGroup.activity_type() 'act_type____'; end
|
3
|
+
def CodeGroup.aircraft_owner() 'ownertyp____'; end
|
4
|
+
def CodeGroup.aircraft_type_rating() 'ac_rating___'; end
|
5
|
+
def CodeGroup.aircraft_hour_type() 'hr_type_____'; end
|
6
|
+
def CodeGroup.aircraft_maintenance_category() 'acmaint_cat_'; end
|
7
|
+
def CodeGroup.aircraft_maintenance_prog() 'man_prog____'; end
|
8
|
+
def CodeGroup.aircraft_maintenance_type() 'acmaint_type'; end
|
9
|
+
def CodeGroup.aircraft_size() 'ac_size_____'; end
|
10
|
+
def CodeGroup.airport_access() 'ap_access___'; end
|
11
|
+
def CodeGroup.airport_cost() 'ap_cost_____'; end
|
12
|
+
def CodeGroup.airport_facility() 'ap_faclity__'; end
|
13
|
+
def CodeGroup.airport_lighting() 'light_code__'; end
|
14
|
+
def CodeGroup.aircraft_status() 'ac_status___'; end
|
15
|
+
def CodeGroup.aircraft_note_type() 'acnote_type_'; end
|
16
|
+
def CodeGroup.aircraft_document() 'acdoc_type__'; end
|
17
|
+
def CodeGroup.aircraft_rate() 'ac_rate_____'; end
|
18
|
+
def CodeGroup.airline_code() 'airline_____'; end
|
19
|
+
def CodeGroup.airway_status() 'airway_stat_'; end
|
20
|
+
def CodeGroup.area() 'loc_________'; end
|
21
|
+
def CodeGroup.calculation_type() 'ac_calc_____'; end
|
22
|
+
def CodeGroup.cancellation_code() 'canc_code___'; end
|
23
|
+
def CodeGroup.car_rental_code() 'car_rental__'; end
|
24
|
+
def CodeGroup.category() 'cat_no______'; end
|
25
|
+
def CodeGroup.certification() 'cert________'; end
|
26
|
+
def CodeGroup.checklist_category() 'cklist_cat__'; end
|
27
|
+
def CodeGroup.checklist_reset() 'cklist_reset'; end
|
28
|
+
def CodeGroup.checklist_type() 'cklist_type_'; end
|
29
|
+
def CodeGroup.klass() 'class_______'; end
|
30
|
+
def CodeGroup.company() return 'company_id__'; end
|
31
|
+
def CodeGroup.cost_unit() 'cost_unit___'; end
|
32
|
+
def CodeGroup.credit_card() 'creditcard__'; end
|
33
|
+
def CodeGroup.crew_card() 'crew_card___'; end
|
34
|
+
def CodeGroup.crew_card_status() 'crewcardstat'; end
|
35
|
+
def CodeGroup.crew_line() 'crew_line___'; end
|
36
|
+
def CodeGroup.crew_log_field() 'logbook_fld_'; end
|
37
|
+
def CodeGroup.crew_type() 'crew_type___'; end
|
38
|
+
def CodeGroup.crew_unit() 'crew_unit___'; end
|
39
|
+
def CodeGroup.currency() 'currency____'; end
|
40
|
+
def CodeGroup.customs_area() 'cust_area___'; end
|
41
|
+
def CodeGroup.delay_reason() 'delay_reason'; end
|
42
|
+
def CodeGroup.department() 'department__'; end
|
43
|
+
def CodeGroup.division() 'division____'; end
|
44
|
+
def CodeGroup.flight() 'flight_id___'; end
|
45
|
+
def CodeGroup.flight_plan() 'flight_plan_'; end
|
46
|
+
def CodeGroup.flight_log_expense_payment() 'exp_pay_meth'; end
|
47
|
+
def CodeGroup.flight_log_expense_type() 'exp_type____'; end
|
48
|
+
def CodeGroup.flight_log_expense_unit() 'exp_unit____'; end
|
49
|
+
def CodeGroup.fuel() 'fuel_code___'; end
|
50
|
+
def CodeGroup.fuel_type() 'fuel_typ____'; end
|
51
|
+
def CodeGroup.group() 'group_______'; end
|
52
|
+
def CodeGroup.hotel_code() 'hotel_card__'; end
|
53
|
+
def CodeGroup.language() 'language____'; end
|
54
|
+
def CodeGroup.lead_source() 'lead_source_'; end
|
55
|
+
def CodeGroup.location() 'location____'; end
|
56
|
+
def CodeGroup.marital_status() 'marital_____'; end
|
57
|
+
def CodeGroup.medical_certification() 'medclas_____'; end
|
58
|
+
def CodeGroup.military_status() 'military____'; end
|
59
|
+
def CodeGroup.misc_ap_service_type() 'serv_type___'; end
|
60
|
+
def CodeGroup.passenger_position() 'pax_pos_____'; end
|
61
|
+
def CodeGroup.passenger_status() 'pax_stat____'; end
|
62
|
+
def CodeGroup.passenger_rate() 'pax_rate____'; end
|
63
|
+
def CodeGroup.passport_type() 'passport_typ'; end
|
64
|
+
def CodeGroup.passenger_note_type() 'paxnote_type'; end
|
65
|
+
def CodeGroup.place_code() 'place_code__'; end
|
66
|
+
def CodeGroup.planner_type() 'pax_info____'; end
|
67
|
+
def CodeGroup.position() 'position____'; end
|
68
|
+
def CodeGroup.privilege() 'priv_no_____'; end
|
69
|
+
def CodeGroup.pulse_description() 'pulse_desc__'; end
|
70
|
+
def CodeGroup.purpose() 'purpose_____'; end
|
71
|
+
def CodeGroup.quote_report() 'removal_rsn_'; end
|
72
|
+
def CodeGroup.quote_report_format() 'qt_rpt_fmt__'; end
|
73
|
+
def CodeGroup.radio_classification() 'radclas_____'; end
|
74
|
+
def CodeGroup.reason() 'reason______'; end
|
75
|
+
def CodeGroup.reason_not_booked() 'not_booked__'; end
|
76
|
+
def CodeGroup.reg_qualification() 'reg_qual____'; end
|
77
|
+
def CodeGroup.reverser_type() 'rev_typ_____'; end
|
78
|
+
def CodeGroup.scheduled_report() 'part_stat___'; end
|
79
|
+
def CodeGroup.security_loc() 'security_loc'; end
|
80
|
+
def CodeGroup.special_qualification() 'spec_qual___'; end
|
81
|
+
def CodeGroup.status() 'status______'; end
|
82
|
+
def CodeGroup.training_school() 'trn_school__'; end
|
83
|
+
def CodeGroup.trip_approval() 'approval____'; end
|
84
|
+
def CodeGroup.trip_type() 'trip_type___'; end
|
85
|
+
def CodeGroup.vendor_status() 'vendor_stat_'; end
|
86
|
+
def CodeGroup.vendor_type() 'vend_type___'; end
|
87
|
+
def CodeGroup.visa_type() 'visa_type___'; end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class Date
|
2
|
+
FOS_JD_OFFSET_DAYS = Date.parse('1899-12-31').jd
|
3
|
+
DATE_FORMATS[:mdy] = "%m/%d/%Y"
|
4
|
+
|
5
|
+
def self.from_fos_days(days)
|
6
|
+
self.jd(FOS_JD_OFFSET_DAYS + days)
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_fos_days
|
10
|
+
jd - FOS_JD_OFFSET_DAYS
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Time
|
15
|
+
DATE_FORMATS[:hm] = "%H:%M"
|
16
|
+
|
17
|
+
alias :original_to_s :to_s
|
18
|
+
def to_s(args=nil)
|
19
|
+
args = :hm unless args
|
20
|
+
self.original_to_s(args)
|
21
|
+
end
|
22
|
+
|
23
|
+
# creates utc time from minutes
|
24
|
+
def self.from_fos_time(minutes)
|
25
|
+
DateTime.new(2000,1,1).advance(:minutes=>minutes).to_time
|
26
|
+
end
|
27
|
+
|
28
|
+
def as_minutes
|
29
|
+
hour*60 + min
|
30
|
+
end
|
31
|
+
|
32
|
+
def in_hundredths
|
33
|
+
return 0 if hour + min == 0
|
34
|
+
minutes = hour*60 + min
|
35
|
+
val = "#{minutes/60}.#{((100*(minutes.modulo(60)))/60).to_s.rjust(2,'0')}"
|
36
|
+
BigDecimal.new(val, 2).round(1).to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def in_hundredths_rounded_XOJET_style
|
40
|
+
return 0 if hour + min == 0
|
41
|
+
# It was determined that "ODD" increments of .05 (ie .15, .35, .55, .75, .95) of an hour (ie. 9,21,33,45,57 minutes) rounded UP whereas even increments of .05 rounded DOWN - sn
|
42
|
+
minutes = hour*60 + min
|
43
|
+
(minutes/60.0 + ([9, 21, 33, 45, 57].include?( min ) ? 0.001 : -0.001)).round(2)
|
44
|
+
#minutes/60.0
|
45
|
+
end
|
46
|
+
|
47
|
+
def in_tenths_rounded_XOJET_style
|
48
|
+
return 0 if hour + min == 0
|
49
|
+
# It was determined that "ODD" increments of .05 (ie .15, .35, .55, .75, .95) of an hour (ie. 9,21,33,45,57 minutes) rounded UP whereas even increments of .05 rounded DOWN - sn
|
50
|
+
minutes = hour*60 + min
|
51
|
+
(minutes/60.0 + ([9, 21, 33, 45, 57].include?( min ) ? 0.01 : -0.01)).round(1)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
require File.join(RAILS_ROOT, 'lib', 'sequel', 'serializer', 'serializer.rb')
|
2
|
+
|
3
|
+
class Sequel::Model
|
4
|
+
include Sequel::Serialization # our own custom serializer
|
5
|
+
include ActionView::Helpers::NumberHelper
|
6
|
+
|
7
|
+
self.use_transactions=false
|
8
|
+
plugin :validation_helpers
|
9
|
+
|
10
|
+
def fill_hash(arr)
|
11
|
+
arr.inject({}) do |hash,column|
|
12
|
+
hash[column]= self.send(column) if self.respond_to?(column)
|
13
|
+
hash
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
|
19
|
+
def pk_for_select(options={})
|
20
|
+
table = options[:table] || table_name
|
21
|
+
use_alias = options[:alias]
|
22
|
+
primary_key.collect do |k|
|
23
|
+
if use_alias
|
24
|
+
k.qualify(table).as("#{table}_#{k}")
|
25
|
+
else
|
26
|
+
k.qualify(table)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_accessor :datatypes, :aliases
|
32
|
+
|
33
|
+
def clear_schema
|
34
|
+
db_schema.clear
|
35
|
+
@datatypes = {}
|
36
|
+
@aliases = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def n_to_o(assoc_name, options)
|
40
|
+
association(:many_to_one, assoc_name, options)
|
41
|
+
end
|
42
|
+
|
43
|
+
def o_to_n(assoc_name, options)
|
44
|
+
association(:one_to_many, assoc_name, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def association(assoc_type, assoc_name, options)
|
48
|
+
class_name = options[:class]
|
49
|
+
prefix = options[:prefix]
|
50
|
+
case assoc_type
|
51
|
+
when :one_to_many
|
52
|
+
key = primary_key
|
53
|
+
graph_conditions = { :"#{prefix} kid - date" => :'kid - date', :"#{prefix} kid - time" => :'kid - time', :"#{prefix} kid - user" => :'kid - user', :"#{prefix} kid - mult" => :'kid - mult', :"#{prefix} kid - comm" => :'kid - comm' }
|
54
|
+
dataset_filter = proc { class_name.to_s.constantize.filter( :"#{prefix} kid - date"=>self[:'kid - date'], :"#{prefix} kid - time"=>self[:'kid - time'], :"#{prefix} kid - user"=>self[:'kid - user'], :"#{prefix} kid - mult"=>self[:'kid - mult'], :"#{prefix} kid - comm"=>self[:'kid - comm']) }
|
55
|
+
eager_load_proc =
|
56
|
+
proc do |key_hash, parents, associations|
|
57
|
+
id_map = {}
|
58
|
+
filter_args = Hash.new{|k,v| k[v]=[]}
|
59
|
+
parents.each do |p|
|
60
|
+
key_arr = []
|
61
|
+
primary_key.each do |k|
|
62
|
+
key_arr << p[k]
|
63
|
+
filter_args[k] << p[k]
|
64
|
+
end
|
65
|
+
id_map[key_arr] = p
|
66
|
+
end
|
67
|
+
parent_keys = graph_conditions.keys
|
68
|
+
filter_expr = Sequel::SQL::BooleanExpression.new(
|
69
|
+
:OR,
|
70
|
+
*id_map.keys.map{|k| [ [graph_conditions.keys[0], k[0]], [graph_conditions.keys[1], k[1]], [graph_conditions.keys[2], k[2]], [graph_conditions.keys[3], k[3]], [graph_conditions.keys[4], k[4]] ].sql_expr}
|
71
|
+
)
|
72
|
+
class_name.to_s.constantize.filter(filter_expr).all do |h|
|
73
|
+
parent_key_values = parent_keys.collect{|k| h[k]}
|
74
|
+
if d = id_map[parent_key_values]
|
75
|
+
d.associations[assoc_name] = [] unless d.associations[assoc_name]
|
76
|
+
d.associations[assoc_name] << h
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
when :many_to_one
|
82
|
+
key = nil
|
83
|
+
graph_conditions = { :'kid - date'=>:"#{prefix} kid - date", :'kid - time'=>:"#{prefix} kid - time", :'kid - user'=>:"#{prefix} kid - user", :'kid - mult'=>:"#{prefix} kid - mult", :'kid - comm'=>:"#{prefix} kid - comm" }
|
84
|
+
dataset_filter = proc { class_name.to_s.constantize.filter( :"kid - date"=>self[:"#{prefix} kid - date"], :"kid - time"=>self[:"#{prefix} kid - time"], :"kid - user"=>self[:"#{prefix} kid - user"], :"kid - mult"=>self[:"#{prefix} kid - mult"], :"kid - comm"=>self[:"#{prefix} kid - comm"]) }
|
85
|
+
eager_load_proc =
|
86
|
+
proc do |key_hash, parents, associations|
|
87
|
+
id_map = {}
|
88
|
+
filter_args = Hash.new{|k,v| k[v]=[]}
|
89
|
+
parents.each do |p|
|
90
|
+
key_arr = []
|
91
|
+
primary_key.each do |k|
|
92
|
+
key_arr << p[k]
|
93
|
+
filter_args[k] << p[k]
|
94
|
+
end
|
95
|
+
id_map[key_arr] = p
|
96
|
+
end
|
97
|
+
parent_to_child_keys = graph_conditions.keys
|
98
|
+
filter_expr = Sequel::SQL::BooleanExpression.new(
|
99
|
+
:OR,
|
100
|
+
*id_map.keys.map{|k| [ [parent_to_child_keys[0], k[0]], [parent_to_child_keys[1], k[1]], [parent_to_child_keys[2], k[2]], [parent_to_child_keys[3], k[3]], [parent_to_child_keys[4], k[4]] ].sql_expr}
|
101
|
+
)
|
102
|
+
class_name.to_s.constantize.filter(filter_expr).all do |h|
|
103
|
+
parent_key_values = parent_to_child_keys.collect{|k| h[k]}
|
104
|
+
id_map[parent_key_values].associations[assoc_name] = h
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
graph_conditions.merge!(options[:graph_only_conditions]) if options[:graph_only_conditions]
|
109
|
+
send(assoc_type, assoc_name, :key=> key, :class => class_name, :dataset=> dataset_filter, :graph_only_conditions=>graph_conditions, :eager_loader => eager_load_proc )
|
110
|
+
end
|
111
|
+
|
112
|
+
# for creating an association to the 'Codes' table
|
113
|
+
def code_association(assoc_name, column_name_holding_code, code_group_name)
|
114
|
+
# create the many to one association
|
115
|
+
send(:many_to_one, assoc_name, :class=>:Code, :key=>nil,
|
116
|
+
# dataset adds
|
117
|
+
:dataset=>proc {
|
118
|
+
value = self[column_name_holding_code] || send(column_name_holding_code)
|
119
|
+
Code.filter(:'value'=> value, :name=>CodeGroup.send(code_group_name))
|
120
|
+
},
|
121
|
+
# graph_only_conditions add the join conditions when using eager_graph in query
|
122
|
+
:graph_only_conditions => { :'value'=> column_name_holding_code, :name=>CodeGroup.send(code_group_name)}
|
123
|
+
)
|
124
|
+
|
125
|
+
# create the :get_all method to find all codes of the code group name
|
126
|
+
meta_def "get_all_#{assoc_name.to_s.pluralize}" do
|
127
|
+
Code.get_codes(CodeGroup.send(code_group_name))
|
128
|
+
end
|
129
|
+
# add a delegator that calls for the code, and one for description
|
130
|
+
delegate :code, :to=> assoc_name, :prefix=>true, :allow_nil => true
|
131
|
+
delegate :description, :to=> assoc_name, :prefix=>true, :allow_nil => true
|
132
|
+
end
|
133
|
+
|
134
|
+
def column_def_datetime(datetime_column_name, date_column, time_column)
|
135
|
+
inst_def datetime_column_name do
|
136
|
+
date = send(:[], date_column)
|
137
|
+
time = send(:[], time_column)
|
138
|
+
date = Date.from_fos_days(date) if date.is_a? Fixnum
|
139
|
+
loc_time = date.to_time
|
140
|
+
time_utc = Time.gm(loc_time.year, loc_time.month, loc_time.day)
|
141
|
+
time_utc + time.minutes
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# column_alias :'bad_name', :'bad name', :type=>:date # can set type here if you like
|
146
|
+
def column_alias(new_column_name, old_column_name, options={})
|
147
|
+
@aliases ||= {}
|
148
|
+
@aliases[new_column_name]= old_column_name
|
149
|
+
|
150
|
+
# define a getter method on the model class for the aliased column name
|
151
|
+
# will get value from old_column_name
|
152
|
+
inst_def new_column_name do
|
153
|
+
send(:[], old_column_name)
|
154
|
+
end
|
155
|
+
# define a setter method on the model class with the aliased column name
|
156
|
+
# will actually set value to old_column_name
|
157
|
+
inst_def "#{new_column_name}=" do |value|
|
158
|
+
send(:[]=, old_column_name, value)
|
159
|
+
end
|
160
|
+
|
161
|
+
if options[:type]
|
162
|
+
column_type(new_column_name, options[:type])
|
163
|
+
column_type(old_column_name, options[:type])
|
164
|
+
else
|
165
|
+
column_type(new_column_name, :string)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# set the column type to an existing column
|
170
|
+
# column_type :'bad name', :datetime
|
171
|
+
def column_type(name, type)
|
172
|
+
@datatypes = model.db_schema
|
173
|
+
# if things went wrong and the db_schema could not load up
|
174
|
+
# have to set up the datatypes entry manually
|
175
|
+
@datatypes[name] = {} unless @datatypes[name]
|
176
|
+
@datatypes[name][:type] = type
|
177
|
+
end
|
178
|
+
|
179
|
+
# define a method to get the value of set the column as a certain type
|
180
|
+
# Used like this in a Model class.
|
181
|
+
#
|
182
|
+
# column_view :'column_name', :date
|
183
|
+
# column_view :'column_name', :time
|
184
|
+
# column_view :'column_name', :time, :custom_method_name
|
185
|
+
# column_view :'column_name', :currency
|
186
|
+
# column_view :'column_name', :boolean
|
187
|
+
#
|
188
|
+
# defines methods for getting new value in the type you requested from
|
189
|
+
# the column_name. The type should be :time, :date, :currency, or :boolean
|
190
|
+
#
|
191
|
+
# For example:
|
192
|
+
# column_name :eta_local, :date, the methods created are:
|
193
|
+
#
|
194
|
+
# eta_local_date => returns a Date
|
195
|
+
# eta_local_date_view => returns a Date formatted y-m-d
|
196
|
+
# eta_local_date_view_mdy => returns a Date formatted m/d/y
|
197
|
+
# eta_local_date_view_mdy_ipc => returns a Date formatted m/d/y with first 0 chopped
|
198
|
+
# ie. instead of 08/07/2009 .. it will be 8/07/2009
|
199
|
+
#
|
200
|
+
# column_name :eta_local, :time, the methods created are:
|
201
|
+
#
|
202
|
+
# eta_local_time => returns a Time
|
203
|
+
# eta_local_time_view => returns a Time formatted H:M
|
204
|
+
#
|
205
|
+
# column_name :price, :currency, the method created is:
|
206
|
+
#
|
207
|
+
# price_currency => which returns a currecy formatted value 12.15 ( no dollar sign )
|
208
|
+
#
|
209
|
+
# column_name :item_total, :delimited, the method created is:
|
210
|
+
#
|
211
|
+
# item_total_delimited => which returns a delimited formatted value 12.15 ( no dollar sign )
|
212
|
+
#
|
213
|
+
# column_name :paid, :boolean, the method created is:
|
214
|
+
#
|
215
|
+
# paid_boolean => which returns a string ("False" / "True") for values ( 0 / 1 )
|
216
|
+
#
|
217
|
+
def column_view(column_name, type, custom_method_name=nil)
|
218
|
+
raise(StandardError,"Expect the type to be either :date, :time, :currency, :precision or :boolean") unless [:date, :time, :currency, :precision, :boolean].include? type
|
219
|
+
# will get value from old_column_name
|
220
|
+
method_name = custom_method_name || "#{column_name}_#{type.to_s}"
|
221
|
+
|
222
|
+
# the method that returns the column value as a Date or Time value
|
223
|
+
inst_def method_name do
|
224
|
+
column_value = send(column_name)
|
225
|
+
case type
|
226
|
+
when :date
|
227
|
+
Date.from_fos_days(column_value) if column_value
|
228
|
+
when :time
|
229
|
+
Time.utc(0) + column_value.minutes if column_value
|
230
|
+
when :currency
|
231
|
+
number_to_currency( (column_value || 0).to_f/100, :unit=>'', :precision=>2)
|
232
|
+
when :precision
|
233
|
+
# precision wont do delimiter .. so send to currency
|
234
|
+
number_to_currency( (column_value || 0).to_f/100, :unit=>'', :precision=>2)
|
235
|
+
when :boolean
|
236
|
+
return "True" if column_value and ( column_value == 1 or column_value == true )
|
237
|
+
"False"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
method_view_name = method_name.to_s + "_view"
|
242
|
+
# now the view method for all except currency, delimited or boolean
|
243
|
+
unless type == (:currency or :delimited or :boolean)
|
244
|
+
inst_def method_view_name do
|
245
|
+
value = send(method_name)
|
246
|
+
value.to_s if value
|
247
|
+
end
|
248
|
+
end
|
249
|
+
# extra view method for date type
|
250
|
+
if type == :date
|
251
|
+
method_view_name = method_name.to_s + "_view_mdy"
|
252
|
+
# method that returns the column value as a Date in mdy format
|
253
|
+
inst_def method_view_name do
|
254
|
+
column_value = send(column_name)
|
255
|
+
return nil unless column_value
|
256
|
+
Date.from_fos_days(column_value).to_s(:mdy)
|
257
|
+
end
|
258
|
+
method_view_name = method_name.to_s + "_view_mdy_ipc"
|
259
|
+
# method that returns the column value as a Date in mdy format
|
260
|
+
inst_def method_view_name do
|
261
|
+
column_value = send(column_name)
|
262
|
+
return nil unless column_value
|
263
|
+
date_str = Date.from_fos_days(column_value).to_s(:mdy)
|
264
|
+
date_str.slice!(3) if date_str[3] == 48 # if the fourth char is 0 ( ascii value 48 ) remove it
|
265
|
+
date_str.slice!(0) if date_str[0] == 48 # if the first char is 0 ( ascii value 48 ) remove it
|
266
|
+
date_str
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
def select_fields(table, *fields)
|
272
|
+
dataset.select_fields(table, *fields)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|