diff --git a/app/models/organization.rb b/app/models/organization.rb
index 22e9b81..2282071 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -78,6 +78,8 @@ class Organization < Profile
country
tag_list
template_id
+ district
+ address_reference
]
def self.fields
@@ -96,8 +98,8 @@ class Organization < Profile
[]
end
- N_('Display name'); N_('Description'); N_('Contact person'); N_('Contact email'); N_('Acronym'); N_('Foundation year'); N_('Legal form'); N_('Economic activity'); N_('Management information'); N_('Tag list')
- settings_items :display_name, :description, :contact_person, :contact_email, :acronym, :foundation_year, :legal_form, :economic_activity, :management_information
+ N_('Display name'); N_('Description'); N_('Contact person'); N_('Contact email'); N_('Acronym'); N_('Foundation year'); N_('Legal form'); N_('Economic activity'); N_('Management information'); N_('Tag list'); N_('District'); N_('Address reference')
+ settings_items :display_name, :description, :contact_person, :contact_email, :acronym, :foundation_year, :legal_form, :economic_activity, :management_information, :district, :address_reference
validates_format_of :foundation_year, :with => Noosfero::Constants::INTEGER_FORMAT
validates_format_of :contact_email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |org| !org.contact_email.blank? })
diff --git a/app/models/person.rb b/app/models/person.rb
index 378ad3a..8881932 100644
--- a/app/models/person.rb
+++ b/app/models/person.rb
@@ -148,6 +148,8 @@ class Person < Profile
contact_information
description
image
+ district
+ address_reference
]
validates_multiparameter_assignments
@@ -201,8 +203,8 @@ class Person < Profile
N_('Education'); N_('Custom education'); N_('Custom area of study');
settings_items :formation, :custom_formation, :custom_area_of_study
- N_('Contact information'); N_('City'); N_('State'); N_('Country'); N_('Sex'); N_('Zip code')
- settings_items :photo, :contact_information, :sex, :city, :state, :country, :zip_code
+ N_('Contact information'); N_('City'); N_('State'); N_('Country'); N_('Sex'); N_('Zip code'); N_('District'); N_('Address reference')
+ settings_items :photo, :contact_information, :sex, :city, :state, :country, :zip_code, :district, :address_reference
extend SetProfileRegionFromCityState::ClassMethods
set_profile_region_from_city_state
diff --git a/app/models/profile.rb b/app/models/profile.rb
index 02b1778..5ba8fb6 100644
--- a/app/models/profile.rb
+++ b/app/models/profile.rb
@@ -231,7 +231,7 @@ class Profile < ActiveRecord::Base
if myregion
myregion.hierarchy.reverse.first(2).map(&:name).join(separator)
else
- %w[address city state country_name zip_code ].map {|item| (self.respond_to?(item) && !self.send(item).blank?) ? self.send(item) : nil }.compact.join(separator)
+ %w[address district city state country_name zip_code ].map {|item| (self.respond_to?(item) && !self.send(item).blank?) ? self.send(item) : nil }.compact.join(separator)
end
end
@@ -696,7 +696,7 @@ private :generate_url, :url_options
def custom_footer_expanded
footer = custom_footer
if footer
- %w[contact_person contact_email contact_phone location address economic_activity city state country zip_code].each do |att|
+ %w[contact_person contact_email contact_phone location address district address_reference economic_activity city state country zip_code].each do |att|
if self.respond_to?(att) && footer.match(/\{[^{]*#{att}\}/)
if !self.send(att).nil? && !self.send(att).blank?
footer = footer.gsub(/\{([^{]*)#{att}\}/, '\1' + self.send(att))
diff --git a/app/views/profile_editor/_person_form.rhtml b/app/views/profile_editor/_person_form.rhtml
index c84d99a..1cb54ea 100644
--- a/app/views/profile_editor/_person_form.rhtml
+++ b/app/views/profile_editor/_person_form.rhtml
@@ -21,6 +21,8 @@
<%= optional_field(@person, 'city', f.text_field(:city, :rel => _('City'))) %>
<%= optional_field(@person, 'zip_code', labelled_form_field(_('ZIP code'), text_field(:profile_data, :zip_code, :rel => _('ZIP code')))) %>
<%= optional_field(@person, 'address', labelled_form_field(_('Address (street and number)'), text_field(:profile_data, :address, :rel => _('Address')))) %>
+<%= optional_field(profile, 'address_reference', labelled_form_field(_('Address reference'), text_field(object_name, :address_reference, :rel => _('Address reference')))) %>
+<%= optional_field(@person, 'district', labelled_form_field(_('District'), text_field(:profile_data, :district, :rel => _('District')))) %>
<% optional_field(@person, 'schooling') do %>
diff --git a/app/views/shared/_organization_custom_fields.rhtml b/app/views/shared/_organization_custom_fields.rhtml
index 893a666..508db10 100644
--- a/app/views/shared/_organization_custom_fields.rhtml
+++ b/app/views/shared/_organization_custom_fields.rhtml
@@ -10,6 +10,8 @@
<%= optional_field(profile, 'economic_activity', f.text_field(:economic_activity)) %>
<%= optional_field(profile, 'management_information', f.text_area(:management_information, :rows => 5)) %>
<%= optional_field(profile, 'address', labelled_form_field(_('Address (street and number)'), text_field(object_name, :address))) %>
+<%= optional_field(profile, 'address_reference', labelled_form_field(_('Address reference'), text_field(object_name, :address_reference))) %>
+<%= optional_field(profile, 'district', labelled_form_field(_('District'), text_field(object_name, :district))) %>
<%= optional_field(profile, 'zip_code', labelled_form_field(_('ZIP code'), text_field(object_name, :zip_code))) %>
<%= optional_field(profile, 'city', f.text_field(:city)) %>
<%= optional_field(profile, 'state', f.text_field(:state)) %>
diff --git a/plugins/shopping_cart/public/buy.js b/plugins/shopping_cart/public/buy.js
index 3fca959..c3fbcd6 100644
--- a/plugins/shopping_cart/public/buy.js
+++ b/plugins/shopping_cart/public/buy.js
@@ -28,3 +28,7 @@ jQuery('#delivery_option').change(function(){
},
});
});
+
+jQuery('#customer_payment').change(function(){
+ jQuery(this).closest('.formfieldline').next().slideToggle('fast');
+});
diff --git a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
index 9f96d63..1fa5377 100644
--- a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
+++ b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
@@ -17,19 +17,29 @@
<%= _('Full name') %>: <%= @customer[:name] %>
<%= _('Email') %>: <%= @customer[:email] %>
<%= _('Phone number') %>: <%= @customer[:contact_phone] %>
- <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? %>
+ <%= _('Payment') %>: <%= @customer[:payment] == 'money' ? _('Money') : _('Check') %>
+ <% if @customer[:payment] == 'money' %>
+ <%= _('Change') %>: <%= @customer[:change] %>
+ <% end %>
+ <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
<%= _('Address') %>:
<% end %>
<% if !@customer[:address].blank? %>
<%= @customer[:address] %>
<% end %>
+ <% if !@customer[:district].blank? %>
+ <%= @customer[:district] %>
+ <% end %>
<% if !@customer[:city].blank? %>
<%= @customer[:city] %>
<% end %>
<% if !@customer[:zip_code].blank? %>
<%= @customer[:zip_code] %>
<% end %>
- <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? %>
+ <% if !@customer[:address_reference].blank? %>
+ <%= @customer[:address_reference] %>
+ <% end %>
+ <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
<% end %>
diff --git a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
index 61d5e2a..c774e72 100644
--- a/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
+++ b/plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
@@ -15,19 +15,29 @@
<%= _('Full name') %>: <%= @customer[:name] %>
<%= _('Email') %>: <%= @customer[:email] %>
<%= _('Phone number') %>: <%= @customer[:contact_phone] %>
- <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? %>
+ <%= _('Payment') %>: <%= @customer[:payment] == 'money' ? _('Money') : _('Check') %>
+ <% if @customer[:payment] == 'money' %>
+ <%= _('Change') %>: <%= @customer[:change] %>
+ <% end %>
+ <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
<%= _('Address') %>:
<% end %>
<% if !@customer[:address].blank? %>
<%= @customer[:address] %>
<% end %>
+ <% if !@customer[:district].blank? %>
+ <%= @customer[:district] %>
+ <% end %>
<% if !@customer[:city].blank? %>
<%= @customer[:city] %>
<% end %>
<% if !@customer[:zip_code].blank? %>
<%= @customer[:zip_code] %>
<% end %>
- <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? %>
+ <% if !@customer[:address_reference].blank? %>
+ <%= @customer[:address_reference] %>
+ <% end %>
+ <% if !@customer[:address].blank? || !@customer[:city].blank? || !@customer[:zip_code].blank? || !@customer[:district].blank? || !@customer[:address_reference].blank? %>
<% end %>
diff --git a/plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb b/plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
index 1f3eaaa..89d02db 100644
--- a/plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
+++ b/plugins/shopping_cart/views/shopping_cart_plugin_profile/buy.html.erb
@@ -7,10 +7,14 @@
<%= labelled_form_field('* ' + _("Email"), f.text_field(:email, :class => 'required email') ) %>
<%= labelled_form_field('* ' + _("Contact phone"), f.text_field(:contact_phone, :class => 'required') ) %>
<%= labelled_form_field(_('Delivery option'), select_tag(:delivery_option, options_for_select(select_delivery_options(@settings.delivery_options, environment)), 'data-profile-identifier' => profile.identifier)) unless !@settings.delivery || (@settings.free_delivery_price && get_total(session[:cart][:items]) >= @settings.free_delivery_price) %>
+ <%= labelled_form_field(_('Payment'), select_tag('customer[payment]', options_for_select([[_("Money"), :money],[_('Check'), :check]]))) %>
+ <%= labelled_form_field(_('Change'), text_field_tag('customer[change]')) %>
<% if @settings.delivery %>
diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb
index af7442a..8fd6f90 100644
--- a/test/unit/person_test.rb
+++ b/test/unit/person_test.rb
@@ -64,7 +64,7 @@ class PersonTest < ActiveSupport::TestCase
should "have person info fields" do
p = Person.new(:environment => Environment.default)
- [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code, :image ].each do |i|
+ [ :name, :photo, :contact_information, :birth_date, :sex, :address, :city, :state, :country, :zip_code, :image, :district, :address_reference ].each do |i|
assert_respond_to p, i
end
end
--
libgit2 0.21.2