caboose-rets 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/caboose_rets/admin_media.js +7 -7
  3. data/app/assets/javascripts/caboose_rets/caboose_rets.js +8 -8
  4. data/app/controllers/caboose_rets/agents_controller.rb +67 -75
  5. data/app/controllers/caboose_rets/offices_controller.rb +4 -4
  6. data/app/controllers/caboose_rets/open_houses_controller.rb +3 -3
  7. data/app/controllers/caboose_rets/properties_controller.rb +160 -0
  8. data/app/controllers/caboose_rets/rets_controller.rb +2 -2
  9. data/app/controllers/caboose_rets/rets_media_controller.rb +13 -13
  10. data/app/controllers/caboose_rets/saved_properties_controller.rb +35 -35
  11. data/app/models/caboose_rets/agent.rb +42 -55
  12. data/app/models/caboose_rets/agent_meta.rb +7 -7
  13. data/app/models/caboose_rets/media.rb +63 -57
  14. data/app/models/caboose_rets/office.rb +35 -21
  15. data/app/models/caboose_rets/open_house.rb +15 -15
  16. data/app/models/caboose_rets/property.rb +203 -0
  17. data/app/models/caboose_rets/rets_importer.rb +193 -233
  18. data/app/models/caboose_rets/rets_importer_bak.rb +77 -77
  19. data/app/models/caboose_rets/rets_importer_old.rb +625 -0
  20. data/app/models/caboose_rets/saved_property.rb +4 -4
  21. data/app/models/caboose_rets/saved_search.rb +36 -33
  22. data/app/models/caboose_rets/schema.rb +324 -855
  23. data/app/models/caboose_rets/schema_past.rb +918 -0
  24. data/app/models/caboose_rets/search_option.rb +6 -6
  25. data/app/views/caboose/blocks/_layout_rets.html.erb +9 -6
  26. data/app/views/caboose/blocks/_rets_agent_listings.html.erb +3 -3
  27. data/app/views/caboose_rets/agents/index.html.erb +23 -40
  28. data/app/views/caboose_rets/media/admin_property_media.html.erb +2 -2
  29. data/app/views/caboose_rets/{residential → properties}/_search_form.html.erb +42 -42
  30. data/app/views/caboose_rets/{residential → properties}/admin_edit.html.erb +7 -7
  31. data/app/views/caboose_rets/{land → properties}/admin_index.html.erb +11 -11
  32. data/app/views/caboose_rets/properties/details.html.erb +127 -0
  33. data/app/views/caboose_rets/{land → properties}/index.html.erb +0 -0
  34. data/app/views/caboose_rets/{residential/residential_not_exists.html.erb → properties/property_not_exists.html.erb} +4 -5
  35. data/app/views/caboose_rets/{residential → properties}/test_form.html.erb +1 -1
  36. data/app/views/caboose_rets/rets/admin_import_form.html.erb +1 -1
  37. data/config/routes.rb +70 -55
  38. data/lib/caboose-rets.rb +1 -1
  39. data/lib/caboose_rets/engine.rb +3 -3
  40. data/lib/caboose_rets/version.rb +1 -1
  41. data/lib/rets/base/core.rb +1 -1
  42. data/lib/rets/base/sax_search.rb +1 -1
  43. data/lib/tasks/caboose_rets.rake +106 -17
  44. metadata +16 -50
  45. data/app/controllers/caboose_rets/commercial_controller.rb +0 -349
  46. data/app/controllers/caboose_rets/land_controller.rb +0 -144
  47. data/app/controllers/caboose_rets/multi_family_controller.rb +0 -107
  48. data/app/controllers/caboose_rets/residential_controller.rb +0 -163
  49. data/app/models/caboose_rets/commercial_property.rb +0 -214
  50. data/app/models/caboose_rets/land_property.rb +0 -144
  51. data/app/models/caboose_rets/multi_family_property.rb +0 -199
  52. data/app/models/caboose_rets/residential_property.rb +0 -236
  53. data/app/views/caboose/blocks/_rets_commercial_details.html.erb +0 -192
  54. data/app/views/caboose/blocks/_rets_commercial_headers.html.erb +0 -17
  55. data/app/views/caboose/blocks/_rets_commercial_index.html.erb +0 -71
  56. data/app/views/caboose/blocks/_rets_commercial_row.html.erb +0 -39
  57. data/app/views/caboose/blocks/_rets_commercial_search_form.html.erb +0 -201
  58. data/app/views/caboose/blocks/_rets_land_details.html.erb +0 -165
  59. data/app/views/caboose/blocks/_rets_land_index.html.erb +0 -63
  60. data/app/views/caboose/blocks/_rets_land_row.html.erb +0 -58
  61. data/app/views/caboose/blocks/_rets_land_search_form.html.erb +0 -194
  62. data/app/views/caboose/blocks/_rets_multifamily_details.html.erb +0 -161
  63. data/app/views/caboose/blocks/_rets_multifamily_index.html.erb +0 -63
  64. data/app/views/caboose/blocks/_rets_multifamily_row.html.erb +0 -56
  65. data/app/views/caboose/blocks/_rets_multifamily_search_form.html.erb +0 -273
  66. data/app/views/caboose/blocks/_rets_openhouse_details.html.erb +0 -12
  67. data/app/views/caboose/blocks/_rets_openhouses_index.html.erb +0 -79
  68. data/app/views/caboose/blocks/_rets_residential_details.html.erb +0 -243
  69. data/app/views/caboose/blocks/_rets_residential_index.html.erb +0 -65
  70. data/app/views/caboose/blocks/_rets_residential_row.html.erb +0 -59
  71. data/app/views/caboose/blocks/_rets_residential_search_form.html.erb +0 -304
  72. data/app/views/caboose_rets/commercial/admin_edit.html.erb +0 -269
  73. data/app/views/caboose_rets/commercial/admin_index.html.erb +0 -51
  74. data/app/views/caboose_rets/commercial/admin_new.html.erb +0 -57
  75. data/app/views/caboose_rets/commercial/details.html.erb +0 -0
  76. data/app/views/caboose_rets/commercial/index.html.erb +0 -87
  77. data/app/views/caboose_rets/land/admin_edit.html.erb +0 -156
  78. data/app/views/caboose_rets/land/details.html.erb +0 -0
  79. data/app/views/caboose_rets/multi_family/admin_edit.html.erb +0 -211
  80. data/app/views/caboose_rets/multi_family/admin_index.html.erb +0 -46
  81. data/app/views/caboose_rets/residential/admin_index.html.erb +0 -46
  82. data/app/views/caboose_rets/residential/details.html.erb +0 -0
  83. data/app/views/caboose_rets/residential/index.html.erb +0 -0
@@ -0,0 +1,918 @@
1
+
2
+ class CabooseRets::Schema < Caboose::Utilities::Schema
3
+
4
+ def self.removed_columns
5
+ {
6
+ CabooseRets::CommercialProperty => [ :virtual_tour ],
7
+ CabooseRets::ResidentialProperty => [ :virtual_tour ],
8
+ CabooseRets::ResidentialProperty => [ :acreage_temp ]
9
+ }
10
+ end
11
+
12
+ def self.indexes
13
+ {
14
+ CabooseRets::Media => [:media_id]
15
+ }
16
+ end
17
+
18
+ # The schema of the database
19
+ # { Model => [[name, data_type, options]] }
20
+ def self.schema
21
+ {
22
+ CabooseRets::Agent => [
23
+ [ :beeper_phone , :string ],
24
+ [ :last_name , :string ],
25
+ [ :member_email , :string ],
26
+ [ :phone_home_fax , :string ],
27
+ [ :car_phone , :string ],
28
+ [ :la_code , :string ],
29
+ [ :member_page , :string ],
30
+ [ :phone_pager , :string ],
31
+ [ :date_created , :string ],
32
+ [ :lo_code , :string ],
33
+ [ :member_status , :string ],
34
+ [ :phone_second_home , :string ],
35
+ [ :date_modified , :string ],
36
+ [ :mail_addr1 , :string ],
37
+ [ :nrds_id , :string ],
38
+ [ :phone_toll_free , :string ],
39
+ [ :defaultemail , :string ],
40
+ [ :mail_addr2 , :string ],
41
+ [ :office_phone , :string ],
42
+ [ :phone_voice_mail , :string ],
43
+ [ :fax_phone , :string ],
44
+ [ :mail_city , :string ],
45
+ [ :other_phone , :string ],
46
+ [ :phone_voice_pager , :string ],
47
+ [ :first_name , :string ],
48
+ [ :mail_state , :string ],
49
+ [ :phone_change_date , :string ],
50
+ [ :photo_count , :string ],
51
+ [ :home_phone , :string ],
52
+ [ :mail_zip , :string ],
53
+ [ :phone_direct_office , :string ],
54
+ [ :photo_date_modified , :string ]
55
+ ],
56
+ CabooseRets::AgentMeta => [
57
+ [ :la_code , :string ],
58
+ [ :hide , :boolean , { :default => false }],
59
+ [ :bio , :text ],
60
+ [ :contact_info , :text ],
61
+ [ :assistant_to , :string ],
62
+ [ :designation , :string ],
63
+ [ :image_location , :string ],
64
+ [ :image , :attachment ]
65
+ ],
66
+ CabooseRets::CommercialProperty => [
67
+ [ :acreage , :text ],
68
+ [ :adjoining_land_use , :text ],
69
+ [ :agent_notes , :text ],
70
+ [ :agent_other_contact_desc , :text ],
71
+ [ :agent_other_contact_phone , :text ],
72
+ [ :annual_taxes , :text ],
73
+ [ :approx_age , :text ],
74
+ [ :area , :text ],
75
+ [ :banner , :text ],
76
+ [ :baths , :text ],
77
+ [ :baths_full , :text ],
78
+ [ :baths_half , :text ],
79
+ [ :bedrooms , :text ],
80
+ [ :bom_date , :text ],
81
+ [ :book_number , :text ],
82
+ [ :book_page , :text ],
83
+ [ :book_type , :text ],
84
+ [ :box_on_unit , :text ],
85
+ [ :box_on_unit_yn , :text ],
86
+ [ :business_included_yn , :text ],
87
+ [ :buyer_broker , :text ],
88
+ [ :buyer_broker_type , :text ],
89
+ [ :buyer_city , :text ],
90
+ [ :buyer_name , :text ],
91
+ [ :buyer_state , :text ],
92
+ [ :buyer_zip , :text ],
93
+ [ :category , :text ],
94
+ [ :city , :text ],
95
+ [ :city_code , :text ],
96
+ [ :co_la_code , :text ],
97
+ [ :co_lo_code , :text ],
98
+ [ :co_sa_code , :text ],
99
+ [ :co_so_code , :text ],
100
+ [ :contacts , :text ],
101
+ [ :contr_broker , :text ],
102
+ [ :contr_broker_type , :text ],
103
+ [ :county , :text ],
104
+ [ :current_price , :integer, { :default => 0 }],
105
+ [ :date_created , :text ],
106
+ [ :date_leased , :text ],
107
+ [ :date_modified , :text ],
108
+ [ :df_yn , :text ],
109
+ [ :directions , :text ],
110
+ [ :display_address_yn , :text ],
111
+ [ :dom , :text ],
112
+ [ :elem_school , :text ],
113
+ [ :expenses_assoc , :text ],
114
+ [ :expenses_ins , :text ],
115
+ [ :expenses_maint , :text ],
116
+ [ :expenses_mgmt , :text ],
117
+ [ :expenses_other , :text ],
118
+ [ :expenses_tax , :text ],
119
+ [ :expenses_utility , :text ],
120
+ [ :expire_date , :text ],
121
+ [ :flood_plain , :text ],
122
+ [ :ftr_building , :text ],
123
+ [ :ftr_building_type , :text ],
124
+ [ :ftr_closing , :text ],
125
+ [ :ftr_cooling , :text ],
126
+ [ :ftr_docs_on_file , :text ],
127
+ [ :ftr_exterior , :text ],
128
+ [ :ftr_financing , :text ],
129
+ [ :ftr_flooring , :text ],
130
+ [ :ftr_heating , :text ],
131
+ [ :ftr_interior , :text ],
132
+ [ :ftr_internet , :text ],
133
+ [ :ftr_lease_terms , :text ],
134
+ [ :ftr_property_desc , :text ],
135
+ [ :ftr_roof , :text ],
136
+ [ :ftr_sale_terms , :text ],
137
+ [ :ftr_sewer , :text ],
138
+ [ :ftr_showing , :text ],
139
+ [ :ftr_sprinkler , :text ],
140
+ [ :ftr_style , :text ],
141
+ [ :ftr_utilities , :text ],
142
+ [ :ftr_utilities_rental , :text ],
143
+ [ :ftr_water , :text ],
144
+ [ :geo_precision , :text ],
145
+ [ :georesult , :text ],
146
+ [ :high_school , :text ],
147
+ [ :hoa_fee , :text ],
148
+ [ :hoa_fee_yn , :text ],
149
+ [ :hoa_term , :text ],
150
+ [ :income_gross , :text ],
151
+ [ :income_net , :text ],
152
+ [ :income_other , :text ],
153
+ [ :income_rental , :text ],
154
+ [ :internet_yn , :text ],
155
+ [ :la_code , :text ],
156
+ [ :leased_through , :text ],
157
+ [ :legal_block , :text ],
158
+ [ :legal_lot , :text ],
159
+ [ :legals , :text ],
160
+ [ :list_date , :text ],
161
+ [ :list_price , :text ],
162
+ [ :listing_type , :text ],
163
+ [ :lo_code , :text ],
164
+ [ :lockbox_yn , :text ],
165
+ [ :lot_dimensions , :text ],
166
+ [ :lot_dimensions_source , :text ],
167
+ [ :media_flag , :text ],
168
+ [ :middle_school , :text ],
169
+ [ :mls_acct , :text ],
170
+ [ :municipality , :text ],
171
+ [ :negotiable_price , :boolean ],
172
+ [ :num_units , :text ],
173
+ [ :num_units_occupied , :text ],
174
+ [ :off_mkt_date , :text ],
175
+ [ :off_mkt_days , :text ],
176
+ [ :office_notes , :text ],
177
+ [ :orig_lp , :text ],
178
+ [ :other_fee , :text ],
179
+ [ :other_fee_type , :text ],
180
+ [ :owner_name , :text ],
181
+ [ :owner_phone , :text ],
182
+ [ :parcel_id , :text ],
183
+ [ :pending_date , :text ],
184
+ [ :photo_count , :text ],
185
+ [ :photo_date_modified , :text ],
186
+ [ :photo_description , :text ],
187
+ [ :photo_instr , :text ],
188
+ [ :posession , :text ],
189
+ [ :price_change_date , :text ],
190
+ [ :price_sqft , :text ],
191
+ [ :proj_close_date , :text ],
192
+ [ :prop_desc , :text ],
193
+ [ :prop_id , :text ],
194
+ [ :prop_type , :text ],
195
+ [ :remarks , :text ],
196
+ [ :road_frontage_ft , :text ],
197
+ [ :sa_code , :text ],
198
+ [ :sale_lease , :text ],
199
+ [ :sale_notes , :text ],
200
+ [ :so_code , :text ],
201
+ [ :sold_date , :text ],
202
+ [ :sold_price , :text ],
203
+ [ :sold_terms , :text ],
204
+ [ :sqft_source , :text ],
205
+ [ :state , :text ],
206
+ [ :status , :text ],
207
+ [ :status_date , :text ],
208
+ [ :status_flag , :text ],
209
+ [ :street , :text ],
210
+ [ :street_dir , :text ],
211
+ [ :street_name , :text ],
212
+ [ :street_num , :text ],
213
+ [ :sub_agent , :text ],
214
+ [ :sub_agent_type , :text ],
215
+ [ :sub_area , :text ],
216
+ [ :subdivision , :text ],
217
+ [ :take_photo_yn , :text ],
218
+ [ :third_party_comm_yn , :text ],
219
+ [ :tot_heat_sqft , :text ],
220
+ [ :tour_date , :text ],
221
+ [ :tour_submit_date , :text ],
222
+ [ :type_detailed , :text ],
223
+ [ :u1_dims , :text ],
224
+ [ :u1_free_standing_yn , :text ],
225
+ [ :u1_sqft_manuf , :text ],
226
+ [ :u1_sqft_office , :text ],
227
+ [ :u1_sqft_retail , :text ],
228
+ [ :u1_sqft_total , :text ],
229
+ [ :u1_sqft_warehouse , :text ],
230
+ [ :u1_year_built , :text ],
231
+ [ :u2_dims , :text ],
232
+ [ :u2_free_standing_yn , :text ],
233
+ [ :u2_sqft_manuf , :text ],
234
+ [ :u2_sqft_office , :text ],
235
+ [ :u2_sqft_retail , :text ],
236
+ [ :u2_sqft_total , :text ],
237
+ [ :u2_sqft_warehouse , :text ],
238
+ [ :u2_year_built , :text ],
239
+ [ :u3_dims , :text ],
240
+ [ :u3_free_standing_yn , :text ],
241
+ [ :u3_sqft_manuf , :text ],
242
+ [ :u3_sqft_office , :text ],
243
+ [ :u3_sqft_retail , :text ],
244
+ [ :u3_sqft_total , :text ],
245
+ [ :u3_sqft_warehouse , :text ],
246
+ [ :u3_year_built , :text ],
247
+ [ :unit_num , :text ],
248
+ [ :upload_source , :text ],
249
+ [ :vacancy_rate , :text ],
250
+ [ :vacant_yn , :text ],
251
+ [ :valuation_yn , :text ],
252
+ [ :vt_yn , :text ],
253
+ [ :waterfront_yn , :text ],
254
+ [ :withdrawn_date , :text ],
255
+ [ :year_built , :text ],
256
+ [ :zip , :text ],
257
+ [ :zoning_northport , :text ],
258
+ [ :zoning_tusc , :text ],
259
+ [ :latitude , :float ],
260
+ [ :longitude , :float ]
261
+ ],
262
+ CabooseRets::LandProperty => [
263
+ [ :acreage , :text ],
264
+ [ :acreage_source , :text ],
265
+ [ :adjoining_land_use , :text ],
266
+ [ :agent_notes , :text ],
267
+ [ :agent_other_contact_desc , :text ],
268
+ [ :agent_other_contact_phone , :text ],
269
+ [ :annual_taxes , :text ],
270
+ [ :area , :text ],
271
+ [ :bom_date , :text ],
272
+ [ :book_number , :text ],
273
+ [ :book_page , :text ],
274
+ [ :book_type , :text ],
275
+ [ :buyer_broker , :text ],
276
+ [ :buyer_broker_type , :text ],
277
+ [ :buyer_name , :text ],
278
+ [ :category , :text ],
279
+ [ :city , :text ],
280
+ [ :city_code , :text ],
281
+ [ :co_la_code , :text ],
282
+ [ :co_lo_code , :text ],
283
+ [ :co_sa_code , :text ],
284
+ [ :co_so_code , :text ],
285
+ [ :contacts , :text ],
286
+ [ :contr_broker , :text ],
287
+ [ :contr_broker_type , :text ],
288
+ [ :converted , :text ],
289
+ [ :county , :text ],
290
+ [ :current_price , :integer, { :default => 0 }],
291
+ [ :date_created , :text ],
292
+ [ :date_modified , :text ],
293
+ [ :df_yn , :text ],
294
+ [ :directions , :text ],
295
+ [ :display_address_yn , :text ],
296
+ [ :dom , :text ],
297
+ [ :elem_school , :text ],
298
+ [ :expire_date , :text ],
299
+ [ :ftr_access , :text ],
300
+ [ :ftr_docs_on_file , :text ],
301
+ [ :ftr_existing_struct , :text ],
302
+ [ :ftr_extras , :text ],
303
+ [ :ftr_internet , :text ],
304
+ [ :ftr_lotdesc , :text ],
305
+ [ :ftr_mineralrights , :text ],
306
+ [ :ftr_possibleuse , :text ],
307
+ [ :ftr_restrictions , :text ],
308
+ [ :ftr_sewer , :text ],
309
+ [ :ftr_showing , :text ],
310
+ [ :ftr_terms , :text ],
311
+ [ :ftr_topography , :text ],
312
+ [ :ftr_utils , :text ],
313
+ [ :ftr_zoning , :text ],
314
+ [ :geo_precision , :text ],
315
+ [ :georesult , :text ],
316
+ [ :high_school , :text ],
317
+ [ :internet_yn , :text ],
318
+ [ :la_code , :text ],
319
+ [ :legal_block , :text ],
320
+ [ :legal_lot , :text ],
321
+ [ :legal_section , :text ],
322
+ [ :legals , :text ],
323
+ [ :list_date , :text ],
324
+ [ :list_price , :text ],
325
+ [ :listing_type , :text ],
326
+ [ :lo_code , :text ],
327
+ [ :lot_dim_source , :text ],
328
+ [ :lot_dimensions , :text ],
329
+ [ :media_flag , :text ],
330
+ [ :middle_school , :text ],
331
+ [ :mls_acct , :text ],
332
+ [ :municipality , :text ],
333
+ [ :off_mkt_date , :text ],
334
+ [ :off_mkt_days , :text ],
335
+ [ :office_notes , :text ],
336
+ [ :orig_lp , :text ],
337
+ [ :orig_price , :text ],
338
+ [ :other_fee , :text ],
339
+ [ :other_fee_type , :text ],
340
+ [ :owner_name , :text ],
341
+ [ :owner_phone , :text ],
342
+ [ :parcel_id , :text ],
343
+ [ :pending_date , :text ],
344
+ [ :photo_count , :text ],
345
+ [ :photo_date_modified , :text ],
346
+ [ :price_change_date , :text ],
347
+ [ :price_sqft , :text ],
348
+ [ :proj_close_date , :text ],
349
+ [ :prop_id , :text ],
350
+ [ :prop_type , :text ],
351
+ [ :remarks , :text ],
352
+ [ :road_frontage_ft , :text ],
353
+ [ :sa_code , :text ],
354
+ [ :sale_lease , :text ],
355
+ [ :sale_notes , :text ],
356
+ [ :so_code , :text ],
357
+ [ :sold_date , :text ],
358
+ [ :sold_price , :text ],
359
+ [ :sold_terms , :text ],
360
+ [ :state , :text ],
361
+ [ :status , :text ],
362
+ [ :status_date , :text ],
363
+ [ :status_flag , :text ],
364
+ [ :street , :text ],
365
+ [ :street_dir , :text ],
366
+ [ :street_name , :text ],
367
+ [ :street_num , :text ],
368
+ [ :sub_agent , :text ],
369
+ [ :sub_agent_type , :text ],
370
+ [ :subdivision , :text ],
371
+ [ :third_party_comm_yn , :text ],
372
+ [ :unit_num , :text ],
373
+ [ :upload_source , :text ],
374
+ [ :valuation_yn , :text ],
375
+ [ :vt_yn , :text ],
376
+ [ :waterfront , :text ],
377
+ [ :waterfront_yn , :text ],
378
+ [ :wf_feet , :text ],
379
+ [ :withdrawn_date , :text ],
380
+ [ :zip , :text ],
381
+ [ :zoning_northport , :text ],
382
+ [ :zoning_tusc , :text ],
383
+ [ :latitude , :float ],
384
+ [ :longitude , :float ]
385
+ ],
386
+ CabooseRets::Media => [
387
+ [ :date_modified , :string ],
388
+ [ :file_name , :string ],
389
+ [ :media_id , :string ],
390
+ [ :media_order , :integer , { :default => 0 }],
391
+ [ :media_remarks , :text ],
392
+ [ :media_type , :string ],
393
+ [ :mls_acct , :string ],
394
+ [ :url , :text ],
395
+ [ :image , :attachment ],
396
+ [ :file , :attachment ]
397
+ ],
398
+ CabooseRets::MultiFamilyProperty => [
399
+ [ :acreage , :text ],
400
+ [ :agent_notes , :text ],
401
+ [ :agent_other_contact_desc , :text ],
402
+ [ :agent_other_contact_phone , :text ],
403
+ [ :annual_taxes , :text ],
404
+ [ :area , :text ],
405
+ [ :bom_date , :text ],
406
+ [ :book_number , :text ],
407
+ [ :book_page , :text ],
408
+ [ :book_type , :text ],
409
+ [ :box_on_unit , :text ],
410
+ [ :buyer_broker , :text ],
411
+ [ :buyer_broker_type , :text ],
412
+ [ :buyer_name , :text ],
413
+ [ :category , :text ],
414
+ [ :city , :text ],
415
+ [ :city_code , :text ],
416
+ [ :contacts , :text ],
417
+ [ :contr_broker , :text ],
418
+ [ :contr_broker_type , :text ],
419
+ [ :county , :text ],
420
+ [ :co_la_code , :text ],
421
+ [ :co_lo_code , :text ],
422
+ [ :co_sa_code , :text ],
423
+ [ :co_so_code , :text ],
424
+ [ :current_price , :integer ],
425
+ [ :date_created , :text ],
426
+ [ :date_leased , :text ],
427
+ [ :date_modified , :text ],
428
+ [ :df_yn , :text ],
429
+ [ :directions , :text ],
430
+ [ :display_address_yn , :text ],
431
+ [ :dom , :text ],
432
+ [ :elem_school , :text ],
433
+ [ :expenses_association , :text ],
434
+ [ :expenses_insurance , :text ],
435
+ [ :expenses_maintenance , :text ],
436
+ [ :expenses_management , :text ],
437
+ [ :expenses_other , :text ],
438
+ [ :expenses_tax , :text ],
439
+ [ :expire_date , :text ],
440
+ [ :flood_plain , :text ],
441
+ [ :ftr_building_type , :text ],
442
+ [ :ftr_construction , :text ],
443
+ [ :ftr_cooling , :text ],
444
+ [ :ftr_exterior , :text ],
445
+ [ :ftr_exterioramenit , :text ],
446
+ [ :ftr_floors , :text ],
447
+ [ :ftr_heating , :text ],
448
+ [ :ftr_interior , :text ],
449
+ [ :ftr_rent_incl , :text ],
450
+ [ :ftr_roof , :text ],
451
+ [ :ftr_roof_age , :text ],
452
+ [ :ftr_showing , :text ],
453
+ [ :ftr_utils , :text ],
454
+ [ :ftr_zoning , :text ],
455
+ [ :georesult , :text ],
456
+ [ :geo_precision , :text ],
457
+ [ :high_school , :text ],
458
+ [ :hoa_fee , :text ],
459
+ [ :hoa_fee_yn , :text ],
460
+ [ :hoa_term , :text ],
461
+ [ :income , :text ],
462
+ [ :income_other , :text ],
463
+ [ :income_rent , :text ],
464
+ [ :internet_yn , :text ],
465
+ [ :la_code , :text ],
466
+ [ :legals , :text ],
467
+ [ :limited_service_yn , :text ],
468
+ [ :listing_type , :text ],
469
+ [ :list_date , :text ],
470
+ [ :list_price , :text ],
471
+ [ :lot_dimensions , :text ],
472
+ [ :lot_dimensions_source , :text ],
473
+ [ :lo_code , :text ],
474
+ [ :management , :text ],
475
+ [ :media_flag , :text ],
476
+ [ :middle_school , :text ],
477
+ [ :mls_acct , :text ],
478
+ [ :municipality , :text ],
479
+ [ :num_units , :text ],
480
+ [ :num_units_occupied , :text ],
481
+ [ :office_notes , :text ],
482
+ [ :off_mkt_date , :text ],
483
+ [ :off_mkt_days , :text ],
484
+ [ :orig_lp , :text ],
485
+ [ :orig_price , :text ],
486
+ [ :other_fee , :text ],
487
+ [ :other_fee_type , :text ],
488
+ [ :owner_name , :text ],
489
+ [ :owner_phone , :text ],
490
+ [ :parcel_id , :text ],
491
+ [ :pending_date , :text ],
492
+ [ :photo_count , :text ],
493
+ [ :photo_date_modified , :text ],
494
+ [ :price_change_date , :text ],
495
+ [ :price_sqft , :text ],
496
+ [ :proj_close_date , :text ],
497
+ [ :prop_id , :text ],
498
+ [ :prop_type , :text ],
499
+ [ :remarks , :text ],
500
+ [ :sale_notes , :text ],
501
+ [ :sale_rent , :text ],
502
+ [ :sa_code , :text ],
503
+ [ :sold_date , :text ],
504
+ [ :sold_price , :text ],
505
+ [ :sold_terms , :text ],
506
+ [ :so_code , :text ],
507
+ [ :state , :text ],
508
+ [ :status , :text ],
509
+ [ :status_date , :text ],
510
+ [ :status_flag , :text ],
511
+ [ :street , :text ],
512
+ [ :street_dir , :text ],
513
+ [ :street_name , :text ],
514
+ [ :street_num , :text ],
515
+ [ :subdivision , :text ],
516
+ [ :sub_agent , :text ],
517
+ [ :sub_agent_type , :text ],
518
+ [ :third_party_comm_yn , :text ],
519
+ [ :tot_heat_sqft , :text ],
520
+ [ :u1_baths , :text ],
521
+ [ :u1_num , :text ],
522
+ [ :u1_occ , :text ],
523
+ [ :u1_rent , :text ],
524
+ [ :u1_sqft , :text ],
525
+ [ :u1_yn , :text ],
526
+ [ :u2_baths , :text ],
527
+ [ :u2_num , :text ],
528
+ [ :u2_occ , :text ],
529
+ [ :u2_rent , :text ],
530
+ [ :u2_sqft , :text ],
531
+ [ :u2_yn , :text ],
532
+ [ :u3_baths , :text ],
533
+ [ :u3_num , :text ],
534
+ [ :u3_occ , :text ],
535
+ [ :u3_rent , :text ],
536
+ [ :u3_sqft , :text ],
537
+ [ :u3_yn , :text ],
538
+ [ :u4_baths , :text ],
539
+ [ :u4_num , :text ],
540
+ [ :u4_occ , :text ],
541
+ [ :u4_rent , :text ],
542
+ [ :u4_sqft , :text ],
543
+ [ :u4_yn , :text ],
544
+ [ :u5_baths , :text ],
545
+ [ :u5_num , :text ],
546
+ [ :u5_occ , :text ],
547
+ [ :u5_rent , :text ],
548
+ [ :u5_sqft , :text ],
549
+ [ :u5_yn , :text ],
550
+ [ :u6_baths , :text ],
551
+ [ :u6_num , :text ],
552
+ [ :u6_occ , :text ],
553
+ [ :u6_rent , :text ],
554
+ [ :u6_sqft , :text ],
555
+ [ :u6_yn , :text ],
556
+ [ :u7_baths , :text ],
557
+ [ :u7_num , :text ],
558
+ [ :u7_occ , :text ],
559
+ [ :u7_rent , :text ],
560
+ [ :u7_sqft , :text ],
561
+ [ :u7_yn , :text ],
562
+ [ :u8_num , :text ],
563
+ [ :u8_occ , :text ],
564
+ [ :u8_rent , :text ],
565
+ [ :u8_sqft , :text ],
566
+ [ :u8_yn , :text ],
567
+ [ :unit_num , :text ],
568
+ [ :upload_source , :text ],
569
+ [ :valuation_yn , :text ],
570
+ [ :vt_yn , :text ],
571
+ [ :withdrawn_date , :text ],
572
+ [ :year_built , :text ],
573
+ [ :zip , :text ],
574
+ [ :latitude , :float ],
575
+ [ :longitude , :float ]
576
+ ],
577
+ CabooseRets::Office => [
578
+ [ :lo_date_created , :string ],
579
+ [ :lo_date_modified , :string ],
580
+ [ :lo_email , :string ],
581
+ [ :lo_fax_phone , :string ],
582
+ [ :lo_idx_yn , :string ],
583
+ [ :lo_code , :string ],
584
+ [ :lo_mailaddr1 , :string ],
585
+ [ :lo_mailaddr2 , :string ],
586
+ [ :lo_mailcity , :string ],
587
+ [ :lo_mailstate , :string ],
588
+ [ :lo_mailzip , :string ],
589
+ [ :lo_main_lo_code , :string ],
590
+ [ :lo_name , :string ],
591
+ [ :lo_other_phone , :string ],
592
+ [ :lo_page , :string ],
593
+ [ :lo_phone , :string ],
594
+ [ :lo_status , :string ],
595
+ [ :photo_count , :string ],
596
+ [ :photo_date_modified , :string ]
597
+ ],
598
+ CabooseRets::OfficeMeta => [
599
+ [ :lo_code , :string ],
600
+ [ :image , :attachment ]
601
+ ],
602
+ CabooseRets::OpenHouse => [
603
+ [ :comments , :string ],
604
+ [ :date_created , :string ],
605
+ [ :date_modified , :string ],
606
+ [ :end_time , :string ],
607
+ [ :la_code , :string ],
608
+ [ :mls_acct , :string ],
609
+ [ :open_house_date , :string ],
610
+ [ :open_house_type , :string ],
611
+ [ :perpetual_yn , :string ],
612
+ [ :prop_type , :string ],
613
+ [ :start_time , :string ]
614
+ ],
615
+ CabooseRets::ResidentialProperty => [
616
+ [ :bedrooms , :text ],
617
+ [ :dom , :text ],
618
+ [ :ftr_pool , :text ],
619
+ [ :rm_other3_desc , :text ],
620
+ [ :baths_full , :text ],
621
+ [ :ftr_diningroom , :text ],
622
+ [ :ftr_porchpatio , :text ],
623
+ [ :rm_other3_name , :text ],
624
+ [ :baths_half , :text ],
625
+ [ :directions , :text ],
626
+ [ :ftr_possession , :text ],
627
+ [ :rm_other4 , :text ],
628
+ [ :baths , :text ],
629
+ [ :display_address_yn , :text ],
630
+ [ :current_price , :integer, { :default => 0 }],
631
+ [ :rm_other4_desc , :text ],
632
+ [ :avm_automated_sales_disabled , :text ],
633
+ [ :ftr_drive , :text ],
634
+ [ :price_change_date , :text ],
635
+ [ :rm_other4_name , :text ],
636
+ [ :avm_instant_valuation_disabled , :text ],
637
+ [ :elem_school , :text ],
638
+ [ :price_sqft , :text ],
639
+ [ :rm_recrm , :text ],
640
+ #[ :acreage , :text ],
641
+ [ :acreage , :float, { :default => 0.0 }],
642
+ #[ :acreage_temp , :float, { :default => 0.0 }],
643
+ [ :expire_date , :text ],
644
+ [ :prop_type , :text ],
645
+ [ :rm_recrm_desc , :text ],
646
+ [ :ftr_age , :text ],
647
+ [ :ftr_exterior , :text ],
648
+ [ :rm_bath1 , :text ],
649
+ [ :rm_study , :text ],
650
+ [ :agent_notes , :text ],
651
+ [ :ftr_citycommunit , :text ],
652
+ [ :rm_bath1_desc , :text ],
653
+ [ :rm_study_desc , :text ],
654
+ [ :agent_other_contact_desc , :text ],
655
+ [ :ftr_fireplace , :text ],
656
+ [ :rm_bath2 , :text ],
657
+ [ :rm_sun , :text ],
658
+ [ :agent_other_contact_phone , :text ],
659
+ [ :flood_plain , :text ],
660
+ [ :rm_bath2_desc , :text ],
661
+ [ :rm_sun_desc , :text ],
662
+ [ :annual_taxes , :text ],
663
+ [ :foreclosure_yn , :text ],
664
+ [ :rm_bath3 , :text ],
665
+ [ :remarks , :text ],
666
+ [ :internet_yn , :text ],
667
+ [ :georesult , :text ],
668
+ [ :rm_bath3_desc , :text ],
669
+ [ :right_red_date , :text ],
670
+ [ :ftr_appliances , :text ],
671
+ [ :ftr_garage , :text ],
672
+ [ :rm_br1 , :text ],
673
+ [ :ftr_roof , :text ],
674
+ [ :tot_heat_sqft , :text ],
675
+ [ :geo_precision , :text ],
676
+ [ :rm_br1_desc , :text ],
677
+ [ :status_flag , :text ],
678
+ [ :area , :text ],
679
+ [ :ftr_hoaamenities , :text ],
680
+ [ :rm_br2 , :text ],
681
+ [ :hoa_fee , :text ],
682
+ [ :ftr_hoaincludes , :text ],
683
+ [ :rm_br2_desc , :text ],
684
+ [ :sale_notes , :text ],
685
+ [ :hoa_term , :text ],
686
+ [ :hoa_fee_yn , :text ],
687
+ [ :rm_br3 , :text ],
688
+ [ :ftr_terms , :text ],
689
+ [ :ftr_attic , :text ],
690
+ [ :ftr_heating , :text ],
691
+ [ :rm_br3_desc , :text ],
692
+ [ :sale_lease , :text ],
693
+ [ :ftr_docs_on_file , :text ],
694
+ [ :high_school , :text ],
695
+ [ :rm_br4 , :text ],
696
+ [ :owner_name , :text ],
697
+ [ :bom_date , :text ],
698
+ [ :homestead_yn , :text ],
699
+ [ :rm_br4_desc , :text ],
700
+ [ :owner_phone , :text ],
701
+ [ :basement_yn , :text ],
702
+ [ :ftr_interior , :text ],
703
+ [ :rm_br5 , :text ],
704
+ [ :sa_code , :text ],
705
+ [ :ftr_basement , :text ],
706
+ [ :lease_exp_date , :text ],
707
+ [ :rm_br5_desc , :text ],
708
+ [ :so_code , :text ],
709
+ [ :book_number , :text ],
710
+ [ :ftr_landscaping , :text ],
711
+ [ :rm_brkfst , :text ],
712
+ [ :ftr_sewer , :text ],
713
+ [ :book_page , :text ],
714
+ [ :ftr_laundry , :text ],
715
+ [ :rm_brkfst_desc , :text ],
716
+ [ :ftr_showing , :text ],
717
+ [ :book_type , :text ],
718
+ [ :legals , :text ],
719
+ [ :rm_den , :text ],
720
+ [ :sold_date , :text ],
721
+ [ :buyer_name , :text ],
722
+ [ :levels , :text ],
723
+ [ :rm_den_desc , :text ],
724
+ [ :sold_price , :text ],
725
+ [ :city_code , :text ],
726
+ [ :list_price , :text ],
727
+ [ :rm_dining , :text ],
728
+ [ :sold_terms , :text ],
729
+ [ :converted , :text ],
730
+ [ :list_date , :text ],
731
+ [ :rm_dining_desc , :text ],
732
+ [ :sqft_source , :text ],
733
+ [ :currentlease_yn , :text ],
734
+ [ :status , :text ],
735
+ [ :rm_family , :text ],
736
+ [ :state , :text ],
737
+ [ :category , :text ],
738
+ [ :listing_type , :text ],
739
+ [ :rm_family_desc , :text ],
740
+ [ :street_dir , :text ],
741
+ [ :city , :text ],
742
+ [ :la_code , :text ],
743
+ [ :rm_foyer , :text ],
744
+ [ :street_name , :text ],
745
+ [ :co_la_code , :text ],
746
+ [ :lo_code , :text ],
747
+ [ :rm_foyer_desc , :text ],
748
+ [ :street_num , :text ],
749
+ [ :co_lo_code , :text ],
750
+ [ :ftr_lotdesc , :text ],
751
+ [ :rm_great , :text ],
752
+ [ :style , :text ],
753
+ [ :co_so_code , :text ],
754
+ [ :lot_dimensions , :text ],
755
+ [ :rm_great_desc , :text ],
756
+ [ :subdivision , :text ],
757
+ [ :co_sa_code , :text ],
758
+ [ :mls_acct , :text ],
759
+ [ :rm_kitchen , :text ],
760
+ [ :take_photo_yn , :text ],
761
+ [ :buyer_broker , :text ],
762
+ [ :master_bed_lvl , :text ],
763
+ [ :rm_kitchen2 , :text ],
764
+ [ :upload_source , :text ],
765
+ [ :buyer_broker_type , :text ],
766
+ [ :middle_school , :text ],
767
+ [ :rm_kitchen2_desc , :text ],
768
+ [ :unit_num , :text ],
769
+ [ :sub_agent , :text ],
770
+ [ :ftr_miscellaneous , :text ],
771
+ [ :rm_kitchen_desc , :text ],
772
+ [ :valuation_yn , :text ],
773
+ [ :sub_agent_type , :text ],
774
+ [ :other_fee , :text ],
775
+ [ :rm_laundry , :text ],
776
+ [ :third_party_comm_yn , :text ],
777
+ [ :contr_broker , :text ],
778
+ [ :off_mkt_date , :text ],
779
+ [ :rm_laundry_desc , :text ],
780
+ [ :vt_yn , :text ],
781
+ [ :contr_broker_type , :text ],
782
+ [ :off_mkt_days , :text ],
783
+ [ :rm_living , :text ],
784
+ [ :ftr_warrantyprogrm , :text ],
785
+ [ :construction_date_comp , :text ],
786
+ [ :outlier_yn , :text ],
787
+ [ :rm_living_desc , :text ],
788
+ [ :wf_feet , :text ],
789
+ [ :ftr_construction , :text ],
790
+ [ :office_notes , :text ],
791
+ [ :rm_lrdr , :text ],
792
+ [ :ftr_waterheater , :text ],
793
+ [ :construction_status , :text ],
794
+ [ :onsite_yn , :text ],
795
+ [ :rm_lrdr_desc , :text ],
796
+ [ :ftr_watersupply , :text ],
797
+ [ :contacts , :text ],
798
+ [ :onsite_days_hours , :text ],
799
+ [ :rm_master , :text ],
800
+ [ :waterfront , :text ],
801
+ [ :ftr_cooling , :text ],
802
+ [ :orig_lp , :text ],
803
+ [ :rm_master_desc , :text ],
804
+ [ :ftr_window_treat , :text ],
805
+ [ :county , :text ],
806
+ [ :other_fee_type , :text ],
807
+ [ :rm_other1 , :text ],
808
+ [ :ftr_windows , :text ],
809
+ [ :df_yn , :text ],
810
+ [ :photo_count , :text ],
811
+ [ :rm_other1_desc , :text ],
812
+ [ :year_built , :text ],
813
+ [ :date_modified , :text ],
814
+ [ :photo_date_modified , :text ],
815
+ [ :rm_other1_name , :text ],
816
+ [ :year_built_source , :text ],
817
+ [ :status_date , :text ],
818
+ [ :prop_id , :text ],
819
+ [ :rm_other2 , :text ],
820
+ [ :zip , :text ],
821
+ [ :date_created , :text ],
822
+ [ :parcel_id , :text ],
823
+ [ :rm_other2_desc , :text ],
824
+ [ :proj_close_date , :text ],
825
+ [ :pending_date , :text ],
826
+ [ :rm_other2_name , :text ],
827
+ [ :withdrawn_date , :text ],
828
+ [ :media_flag , :text ],
829
+ [ :rm_other3 , :text ],
830
+ [ :latitude , :float ],
831
+ [ :longitude , :float ]
832
+ ],
833
+ CabooseRets::SavedProperty => [
834
+ [ :user_id , :integer ],
835
+ [ :mls_acct , :integer ]
836
+ ],
837
+ CabooseRets::SavedSearch => [
838
+ [ :user_id , :integer ],
839
+ [ :params , :text ],
840
+ [ :date_created , :timestamp ],
841
+ [ :date_last , :timestamp ],
842
+ [ :interval , :integer ],
843
+ [ :property_type , :string ],
844
+ [ :uri , :text ],
845
+ [ :notify , :boolean ]
846
+ ],
847
+ CabooseRets::SearchOption => [
848
+ [ :name , :string ],
849
+ [ :field , :string ],
850
+ [ :value , :string ],
851
+ [ :flag_for_delete , :boolean , { :default => false }]
852
+ ],
853
+ Caboose::Site => [
854
+ [ :use_rets , :boolean, { :default => false }]
855
+ ]
856
+ }
857
+ end
858
+
859
+ def self.load_data
860
+
861
+ bt = Caboose::BlockType.where(:name => 'layout_rets').first
862
+ if bt.nil?
863
+ cat = Caboose::BlockTypeCategory.where(:name => 'Layouts').first
864
+ bt = Caboose::BlockType.create(:name => 'layout_rets', :description => 'RETS Layout', :block_type_category_id => cat.id, :allow_child_blocks => false, :field_type => 'block')
865
+ end
866
+
867
+ Caboose::Site.where(:use_rets => true).reorder(:id).all.each do |site|
868
+
869
+ home_page = Caboose::Page.index_page(site.id)
870
+
871
+ # Check that the rets layout is applied to the site
872
+ bt.add_to_site(site.id)
873
+
874
+ # Verify that the site has all the rets pages created and each page has the rets layout
875
+ rets_page = Caboose::Page.where(:site_id => site.id, :alias => 'rets').first
876
+ rets_page = Caboose::Page.create(:site_id => site.id, :alias => 'rets', :slug => 'rets', :uri => 'rets', :title => 'RETS', :parent_id => home_page.id) if rets_page.nil?
877
+
878
+ pages = []
879
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'residential' ).exists?
880
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'residential' , :alias => 'residential' , :uri => 'residential' , :title => 'Residential Properties' , :parent_id => rets_page.id)
881
+ end
882
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'commercial' ).exists?
883
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'commercial' , :alias => 'commercial' , :uri => 'commercial' , :title => 'Commercial Properties' , :parent_id => rets_page.id)
884
+ end
885
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'land' ).exists?
886
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'land' , :alias => 'land' , :uri => 'land' , :title => 'Land' , :parent_id => rets_page.id)
887
+ end
888
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'multi-family' ).exists?
889
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'multi-family' , :alias => 'multi-family' , :uri => 'multi-family' , :title => 'Multi-family Properties' , :parent_id => rets_page.id)
890
+ end
891
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'open-houses' ).exists?
892
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'open-houses' , :alias => 'open-houses' , :uri => 'open-houses' , :title => 'Open Houses' , :parent_id => rets_page.id)
893
+ end
894
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'agents' ).exists?
895
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'agents' , :alias => 'agents' , :uri => 'agents' , :title => 'Agents' , :parent_id => rets_page.id)
896
+ end
897
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'saved-searches' ).exists?
898
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'saved-searches' , :alias => 'saved-searches' , :uri => 'saved-searches' , :title => 'Saved Searches' , :parent_id => rets_page.id)
899
+ end
900
+ if !Caboose::Page.where(:site_id => site.id, :alias => 'saved-properties' ).exists?
901
+ then pages << Caboose::Page.create(:site_id => site.id, :slug => 'saved-properties' , :alias => 'saved-properties' , :uri => 'saved-properties' , :title => 'Saved Properties' , :parent_id => rets_page.id)
902
+ end
903
+
904
+ pages.each do |p|
905
+ Caboose::Block.where(:page_id => p.id).destroy_all
906
+ Caboose::Block.create(:page_id => p.id, :block_type_id => bt.id, :name => bt.name)
907
+
908
+ viewers = Caboose::PagePermission.where(:page_id => home_page.id, :action => 'view').pluck(:role_id)
909
+ editors = Caboose::PagePermission.where(:page_id => home_page.id, :action => 'edit').pluck(:role_id)
910
+ Caboose::Page.update_authorized_for_action(p.id, 'view', viewers)
911
+ Caboose::Page.update_authorized_for_action(p.id, 'edit', editors)
912
+ end
913
+
914
+ end
915
+
916
+ end
917
+
918
+ end