From ef8b724225218b85121d334a2d91de1c4eb2bcf7 Mon Sep 17 00:00:00 2001 From: marwen blel Date: Wed, 9 Nov 2011 10:33:13 +0100 Subject: [PATCH 01/19] #reports# fixing first report --- app/controllers/reports_controller.rb | 15 +- app/models/journal.rb | 4 +- app/views/layouts/application.html.erb | 213 +++++++++++----------- app/views/reports/index.html.erb | 6 +- app/views/reports/ledger_balance.html.erb | 5 +- app/views/reports/ledger_journal.html.erb | 2 +- app/views/shared/_period_picker.html.erb | 22 +-- 7 files changed, 141 insertions(+), 126 deletions(-) diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb index 7eccdef..5c95065 100644 --- a/app/controllers/reports_controller.rb +++ b/app/controllers/reports_controller.rb @@ -167,26 +167,30 @@ def ledger_balance end def ledger_journal - + accounts = nil periods = nil - journal_operations = nil params[:offset] ||= 0 @journal_operations = [] @count = 0; where = nil + #if specified accounts range is taken between from_account_number and to_account_number if !params[:from_account_number].blank? && !params[:to_account_number].blank? where = ["number BETWEEN ? AND ?", params[:from_account_number], params[:to_account_number]] elsif !params[:from_account_number].blank? + #from_account specified but not to_account where = ["number >= ?", params[:from_account_number]] elsif !params[:to_account_number].blank? + #to_account specified but not from_account where = ["number <= ?", params[:to_account_number]] end - + if where.nil? + #if no accounts specified where = ["is_result_account = ?"] - else + else + #if one of the accounts at least is specified where[0] += " AND is_result_account = ?" end where << false @@ -236,6 +240,9 @@ def ledger_journal where[0] += " AND unit_id = ?" where << params[:unit_id] end + unless params[:car_id].blank? + where[0] += " AND car_id = ?" + end @journal_operations = JournalOperation.joins(:journal).joins(:account).where(where).order( "account_id, journals.period_id, journal_operations.created_at").includes( diff --git a/app/models/journal.rb b/app/models/journal.rb index 21d9a17..7c97bf3 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -72,7 +72,7 @@ def self.report_ledger_balance(periods_to_balance, periods_to_balance_previous, inner join journal_operations on journals.id = journal_operations.journal_id inner join accounts on journal_operations.account_id = accounts.id where journals.company_id = #{company.id} - and periods.id in (#{_periods_to_balance}) + and periods.id in (#{_periods_to_balance}) and accounts.is_result_account = false" unless unit.blank? sql += " and journal_operations.unit_id = #{unit.id}" @@ -98,7 +98,7 @@ def self.report_ledger_balance(periods_to_balance, periods_to_balance_previous, inner join journal_operations on journals.id = journal_operations.journal_id inner join accounts on journal_operations.account_id = accounts.id where journals.company_id = #{company.id} - and periods.id in (#{_periods_to_balance_last}) + and periods.id in (#{_periods_to_balance_last}) and accounts.is_result_account = false" unless unit.blank? sql += " and journal_operations.unit_id = #{unit.id}" diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8873355..2cfb666 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,123 +1,124 @@ + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - - DODO - <%= stylesheet_link_tag 'datepicker' %> - <%= stylesheet_link_tag 'journals' %> - <%= stylesheet_link_tag 'dodo' %> - <%= stylesheet_link_tag 'application' %> - <%= stylesheet_link_tag 'jquery-ui' %> - <%= javascript_include_tag :defaults %> - <%= javascript_include_tag "dodo" %> - <%= javascript_include_tag "date" %> - <%= javascript_include_tag "journals" %> - <%= javascript_include_tag "payment_runs" %> - <%= javascript_include_tag "jquery-ui" %> - <%= javascript_include_tag "submitaction" %> - <%= javascript_include_tag "validateField" %> - - - -
- <% if flash[:error] %> -
- <%= flash[:error] %> -
- <% end %> - <% if flash[:alert] %> -
- <%= flash[:alert] %> -
- <% end %> - <% if flash[:notice] %> -
- <%= flash[:notice] %> -
- <% end %> -
+
+ <% if flash[:error] %> +
+ <%= flash[:error] %> +
+ <% end %> + <% if flash[:alert] %> +
+ <%= flash[:alert] %> +
+ <% end %> + <% if flash[:notice] %> +
+ <%= flash[:notice] %> +
+ <% end %> +
-
-
- <%= yield %> -
+
+
+ <%= yield %> +
+
+ <%= debug params %>
-
- - + + diff --git a/app/views/reports/index.html.erb b/app/views/reports/index.html.erb index a0ce0c8..235a949 100644 --- a/app/views/reports/index.html.erb +++ b/app/views/reports/index.html.erb @@ -168,9 +168,13 @@ options_from_collection_for_select(@projects, "id", "to_s"), :include_blank => true %> - + + <%= t(:car, :scope=>:reports) %> + <%= select_tag :car_id, + options_from_collection_for_select(@cars, "id", "to_s"), + :include_blank => true %> diff --git a/app/views/reports/ledger_balance.html.erb b/app/views/reports/ledger_balance.html.erb index 6c059cb..6c2bb97 100644 --- a/app/views/reports/ledger_balance.html.erb +++ b/app/views/reports/ledger_balance.html.erb @@ -6,6 +6,9 @@ <% unless @project.blank?%>

<%= t(:project, :scope=>:reports) %>: <%= @project %>

<% end %> +<% unless @car.blank?%> +

<%= t(:car, :scope=>:reports) %>: <%= @car %>

+<% end %> <% unless @journal_type.blank?%>

<%= t(:journal_type, :scope=>:reports) %>: <%= @journal_type %>

<% end %> @@ -69,7 +72,7 @@ - + diff --git a/app/views/reports/ledger_journal.html.erb b/app/views/reports/ledger_journal.html.erb index 30150ed..96d23b7 100644 --- a/app/views/reports/ledger_journal.html.erb +++ b/app/views/reports/ledger_journal.html.erb @@ -47,4 +47,4 @@
<%= t(:unit, :scope=>:reports) %><%= t(:result, :scope=>:reports) %>
-
+
\ No newline at end of file diff --git a/app/views/shared/_period_picker.html.erb b/app/views/shared/_period_picker.html.erb index d23e380..ac76c65 100644 --- a/app/views/shared/_period_picker.html.erb +++ b/app/views/shared/_period_picker.html.erb @@ -1,16 +1,16 @@
-<%= form_tag "", :method => :get do %> -
-<%= label :first_period, t('period_picker.first_period') %> -<%= select_tag 'first_period', options_for_select(current_user.current_company.periods.map {|e| e.to_s}, first_period) %> -
-
+ <%= form_tag "", :method => :get do %> +
-<%= label :first_period, t('period_picker.last_period') %> -<%= select_tag 'last_period', options_for_select(current_user.current_company.periods.map {|e| e.to_s}, last_period) %> -
-<%= submit_tag t('global.filter') %> -<% end %> + <%= label :first_period, t('period_picker.last_period') %> + <%= select_tag 'last_period', options_for_select(current_user.current_company.periods.order("year, nr").reverse.map {|e| e.to_s}, last_period) %> +
+
+ <%= label :first_period, t('period_picker.first_period') %> + <%= select_tag 'first_period', options_for_select(current_user.current_company.periods.order("year, nr").map {|e| e.to_s}, first_period) %> +
+ <%= submit_tag t('global.filter') %> + <% end %>
From 4e0e2132a41543ac469998d9a5108935cd4002fa Mon Sep 17 00:00:00 2001 From: Axel Liljencrantz Date: Wed, 9 Nov 2011 14:42:12 +0100 Subject: [PATCH 02/19] More period work. Trying to make locked periods append-only in the browser --- app/controllers/journals_controller.rb | 2 + app/models/period.rb | 4 ++ app/models/user.rb | 3 +- app/views/journals/_form.html.erb | 81 +++++++++++++++++--------- public/javascripts/journals.js | 3 + 5 files changed, 63 insertions(+), 30 deletions(-) diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index f0fbc7b..b469652 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -37,6 +37,7 @@ def show # GET /journals/new.xml def new @journal = Journal.new :journal_type_id => params[:journal_type_id] + @append = false if !@journal.journal_type raise "No journal type specified" end @@ -50,6 +51,7 @@ def new # GET /journals/1/edit def edit + @append = @journal.period.append_only? end # POST /journals diff --git a/app/models/period.rb b/app/models/period.rb index 356f5c2..c4cdbbd 100644 --- a/app/models/period.rb +++ b/app/models/period.rb @@ -82,6 +82,10 @@ def elevate_status end self.status += 1 end + + def append_only? + return self.status == STATUSE_NAMES['Locked'] + end def to_s sprintf("%d %.2d", self.year, self.nr) diff --git a/app/models/user.rb b/app/models/user.rb index 1da26c9..322bfc4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -33,7 +33,8 @@ def role_symbols end def open_periods(company = self.current_company) - Period.where(:company_id => company.id, :status => Period::STATUSE_NAMES['Open']) + + Period.where(:company_id => company.id, :status => [1,2,3]) end # declarative_auth wants a login attribute for the introspection ui diff --git a/app/views/journals/_form.html.erb b/app/views/journals/_form.html.erb index d2f1dbb..41b7b75 100644 --- a/app/views/journals/_form.html.erb +++ b/app/views/journals/_form.html.erb @@ -8,7 +8,8 @@ projectList: <%= raw(@projects_all.all.to_json) %>, accountList: <%= raw(@accounts_all.to_json) %>, journalOperationList: <%= raw(@journal.journal_operations.all.to_json) %>, - readOnly: <%= @readonly?"true":"false" %> + readOnly: <%= @readonly ? "true":"false" %>, + append: <%= @append ? "true":"false" %> }; @@ -16,6 +17,49 @@ <%= form_for(@journal) do |f| %> <%= f.error_messages %> + +<% if @readonly || @append then %> + +

+ <%= f.label :journal_type, t(:type, :scope => :journals) %>
+ <%= @journal.journal_type %> +

+

+ <%= f.label :number, t(:number, :scope => :journals) %>
+ <%= @journal.number %> + +

+

+ <%= f.label :period_id, "Period" %>
+ <%= @journal.period %> +

+

+ <%= f.label :journal_date, t(:journal_date, :scope => :journals) %>
+ <%= f.hidden_field :journal_date, :class => :datepicker %> + <%= @journal.journal_date %> +

+ +

+ <%= f.label :due_date, t(:due_date, :scope => :journals) %>
+ <%= @journal.due_date %> +

+ +

+ <%= f.label :kid, t(:kid, :scope => :journals) %>
+ <%= @journal.kid %> + +

+

+ <%= f.label :bill_number, t(:bill_number, :scope => :bills) %>
+ <%= @journal.bill_number %> +

+

+ <%= f.label :description, t(:description, :scope => :global) %>
+ <%= @journal.description %> +

+ +<% else %> +

<%= f.label :journal_type, t(:type, :scope => :journals) %>
<%= @journal.journal_type %> @@ -32,40 +76,21 @@

<%= f.label :period_id, "Period" %>
- <%= if @readonly then - @journal.period - else - f.select :period_id, @me.open_periods.reverse.collect {|p| [ p, p.id ] } - end %> + <%= f.select :period_id, @me.open_periods.reverse.collect {|p| [ p, p.id ] } %>

<%= f.label :journal_date, t(:journal_date, :scope => :journals) %>
- <%= if @readonly then - @journal.journal_date - f.hidden_field :journal_date - else - f.text_field :journal_date, :class => :datepicker - end %> + <%= f.text_field :journal_date, :class => :datepicker %>

<%= f.label :due_date, t(:due_date, :scope => :journals) %>
- <%= if @readonly then - @journal.due_date - f.hidden_field :due_date - else - f.text_field :due_date, :class => :datepicker - end %> + <%= f.text_field :due_date, :class => :datepicker %>

<%= f.label :kid, t(:kid, :scope => :journals) %>
- <%= if @readonly then - @journal.kid - else - f.text_field :kid - end - %> + <%= f.text_field :kid %>

@@ -80,13 +105,11 @@

<%= f.label :description, t(:description, :scope => :global) %>
- <%= if @readonly then - @journal.description - else - f.text_field :description - end %> + <%= f.text_field :description %>

+<% end %> +

<% if !@readonly %> diff --git a/public/javascripts/journals.js b/public/javascripts/journals.js index 35462f1..200f15f 100644 --- a/public/javascripts/journals.js +++ b/public/javascripts/journals.js @@ -556,6 +556,8 @@ var journals = { Add all predefined journal_operation lines from the DODO.journalOperationList array. */ addPredefined: function(){ + var oldReadOnly = DODO.readOnly; + DODO.readOnly = DODO.append || oldReadOnly; lines = DODO.journalOperationList; for (var i=0; i Date: Wed, 9 Nov 2011 15:39:12 +0100 Subject: [PATCH 03/19] Make append-only journal thingies work --- app/controllers/journals_controller.rb | 60 ++++++++++++++++---------- public/javascripts/journals.js | 8 ++-- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index b469652..e4d76f4 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -95,34 +95,48 @@ def update respond_to do |format| Journal.transaction do begin + append = @journal.period.append_only? - @journal.journal_operations.each do - |op| - if op.closed_operation then - op.closed_operation.journal_operations.each do - |op2| - op2.closed_operation = nil - op2.save + if append + params[:journal_operations].each do + |key, value| + if !value[:old] + op = JournalOperation.new(value) + op.company = @me.current_company + @journal.journal_operations.push op + end + + end + @journal.save! + else + @journal.journal_operations.each do + |op| + if op.closed_operation then + op.closed_operation.journal_operations.each do + |op2| + op2.closed_operation = nil + op2.save + end end end - end - - @journal.update_attributes(params[:journal]) or raise ActiveRecord::Rollback - @journal.journal_operations.clear - params[:journal_operations].each do - |key, value| - op = JournalOperation.new(value) - op.company = @me.current_company - @journal.journal_operations.push op - end - @journal.save! + + @journal.update_attributes(params[:journal]) or raise ActiveRecord::Rollback + @journal.journal_operations.clear + params[:journal_operations].each do + |key, value| + op = JournalOperation.new(value) + op.company = @me.current_company + @journal.journal_operations.push op + end + @journal.save! - cnt = @journal.journal_type.counter(@me.current_company) - if cnt.adjust_outside_of_sequence - cnt.counter = @journal.number+1 - cnt.save + cnt = @journal.journal_type.counter(@me.current_company) + if cnt.adjust_outside_of_sequence + cnt.counter = @journal.number+1 + cnt.save + end end - + flash[:notice] = 'Journal was successfully updated.' format.html { redirect_to(@journal) } format.xml { head :ok } diff --git a/public/javascripts/journals.js b/public/javascripts/journals.js index 200f15f..fc9daa3 100644 --- a/public/javascripts/journals.js +++ b/public/javascripts/journals.js @@ -468,7 +468,7 @@ var journals = { var opTable = $('#operations')[0]; var row = opTable.insertRow(opTable.rows.length); - + var ac = function (content, className) { var c = this.insertCell(this.cells.length); if (className) { @@ -479,8 +479,7 @@ var journals = { }; row.addCell = ac; - - + var row2 = opTable.insertRow(opTable.rows.length); row2.addCell = ac; @@ -559,9 +558,12 @@ var journals = { var oldReadOnly = DODO.readOnly; DODO.readOnly = DODO.append || oldReadOnly; lines = DODO.journalOperationList; + var form = $("form.edit_journal"); for (var i=0; i").attr("name", "journal_operations[" + i + "][old]")); + } journals.updateVat(false); journals.update(); From ad74bd44504552484cdf01b1bd06f95a66f5d8b8 Mon Sep 17 00:00:00 2001 From: Wadii TAHRI Date: Wed, 9 Nov 2011 17:29:55 +0100 Subject: [PATCH 04/19] Editing counties --- app/controllers/admin/counties_controller.rb | 20 ++++++-- app/models/county.rb | 1 + app/models/county_tax_zone.rb | 1 + app/models/tax_zone.rb | 2 + app/models/tax_zone_tax.rb | 1 - app/views/admin/counties/_form.html.erb | 23 +++------ app/views/admin/counties/edit.html.erb | 51 ++++++++++++++++++- app/views/admin/counties/show.html.erb | 12 +++-- .../20111104144940_ledgers_add_county.rb | 9 ++++ .../20111104145622_paychecks_add_county.rb | 9 ++++ 10 files changed, 103 insertions(+), 26 deletions(-) create mode 100644 db/migrate/20111104144940_ledgers_add_county.rb create mode 100644 db/migrate/20111104145622_paychecks_add_county.rb diff --git a/app/controllers/admin/counties_controller.rb b/app/controllers/admin/counties_controller.rb index 710621e..6b2e25b 100644 --- a/app/controllers/admin/counties_controller.rb +++ b/app/controllers/admin/counties_controller.rb @@ -25,6 +25,7 @@ def show # GET /counties/new.xml def new @county = County.new + @tax_zones = TaxZone.find(:all) respond_to do |format| format.html # new.html.erb @@ -35,12 +36,21 @@ def new # GET /counties/1/edit def edit @county = County.find(params[:id]) + @county_tax_zone = CountyTaxZone.where(:county_id => @county.id)[0] + puts "***********************", @county_tax_zone.class, @county_tax_zone.id, "****************************************" + # TO-DO : check whether @county_tax_zone is not nil : CountyTaxZone must contain a row that has a county_id available + @tax_zone = @county_tax_zone.tax_zone + @tax_zones = TaxZone.find(:all) + + @from = @county_tax_zone.from + @number = @tax_zone.number end # POST /counties # POST /counties.xml def create @county = County.new(params[:county]) + @tax_zones = TaxZone.find(:all) respond_to do |format| if @county.save @@ -56,10 +66,11 @@ def create # PUT /counties/1 # PUT /counties/1.xml def update - @county = County.find(params[:id]) - + @county = County.find(params[:id]) + county_tax_zone = CountyTaxZone.where(:county_id => @county.id)[0] + respond_to do |format| - if @county.update_attributes(params[:county]) + if county_tax_zone.update_attributes(params[:county]["county_tax_zone"]) and county_tax_zone.update_attributes(params[:county]["tax_zone"]) format.html { redirect_to([:admin, @county], :notice => 'County was successfully updated.') } format.xml { head :ok } else @@ -74,8 +85,7 @@ def update def destroy @county = County.find(params[:id]) @county.is_visible = false - state = @county.save - puts "woops", @county, @county.is_visible, state + state = @county.save respond_to do |format| format.html { redirect_to(admin_counties_url) } format.xml { head :ok } diff --git a/app/models/county.rb b/app/models/county.rb index 2eea3ab..87e55a4 100644 --- a/app/models/county.rb +++ b/app/models/county.rb @@ -1,3 +1,4 @@ class County < ActiveRecord::Base has_many :county_tax_zones + accepts_nested_attributes_for :county_tax_zones, :allow_destroy => false end diff --git a/app/models/county_tax_zone.rb b/app/models/county_tax_zone.rb index 5838ebc..dca3bf4 100644 --- a/app/models/county_tax_zone.rb +++ b/app/models/county_tax_zone.rb @@ -1,3 +1,4 @@ class CountyTaxZone < ActiveRecord::Base belongs_to :county + belongs_to :tax_zone end diff --git a/app/models/tax_zone.rb b/app/models/tax_zone.rb index 383ca79..479bb60 100644 --- a/app/models/tax_zone.rb +++ b/app/models/tax_zone.rb @@ -1,3 +1,5 @@ class TaxZone < ActiveRecord::Base has_many :tax_zone_taxes + has_many :county_tax_zones + accepts_nested_attributes_for :county_tax_zones, :allow_destroy => false end diff --git a/app/models/tax_zone_tax.rb b/app/models/tax_zone_tax.rb index 2410df5..b926df0 100644 --- a/app/models/tax_zone_tax.rb +++ b/app/models/tax_zone_tax.rb @@ -1,4 +1,3 @@ class TaxZoneTax < ActiveRecord::Base belongs_to :tax_zone - end diff --git a/app/views/admin/counties/_form.html.erb b/app/views/admin/counties/_form.html.erb index 8e928ad..6ff92c4 100644 --- a/app/views/admin/counties/_form.html.erb +++ b/app/views/admin/counties/_form.html.erb @@ -1,21 +1,14 @@ <%= form_for([:admin,@county]) do |f| %> - <% if @county.errors.any? %> -

-

<%= pluralize(@county.errors.count, "error") %> prohibited this county from being saved:

+ + <%= f.error_messages %> -
    - <% @county.errors.full_messages.each do |msg| %> -
  • <%= msg %>
  • - <% end %> -
-
- <% end %> - -
- <%= f.label :name %>
+

+ <%= f.label :name %> <%= f.text_field :name %> -

+

+

- <%= f.submit %> + <%= f.submit %>
+ <% end %> diff --git a/app/views/admin/counties/edit.html.erb b/app/views/admin/counties/edit.html.erb index 239f821..e2ad486 100644 --- a/app/views/admin/counties/edit.html.erb +++ b/app/views/admin/counties/edit.html.erb @@ -1,10 +1,57 @@

Editing county

-<% if @county.is_visible == true %> - <%= render 'form' %> +<% if @county.is_visible == true %> + + <% if @county_tax_zone.nil? %> +
+

This county should not be edited !

+
+ <% end %> + + <%= form_for([:admin,@county]) do |f| %> + + <% if @county.errors.any? %> +
+

<%= pluralize(@county.errors.count, "error") %> prohibited this county from being saved:

+
    + <% @county.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+

+ <%= @county.name %> +

+ <%= f.fields_for :county_tax_zone do |county_tax_zone| %> +

+ <%= county_tax_zone.label :from %> + <%= county_tax_zone.text_field :from, :value => @from, :class=> :datepicker %> +

+ <% end %> + <%= f.fields_for :tax_zone do |tax_zone| %> +

+ <%= tax_zone.label :number %> + <%= tax_zone.select :tax_zone_id, @tax_zones.collect {|p| [p.number, p.id]} %> +

+ <% end %> +
+ +
+ +
+ <%= f.submit %> +
+ +<% end %> + <% else %> <%= t(:deleting_county_error, :scope => :counties) -%> <% end %> +
+ <%= link_to 'Show', [:admin, @county] %> | <%= link_to 'Back', admin_counties_path %> diff --git a/app/views/admin/counties/show.html.erb b/app/views/admin/counties/show.html.erb index 2820eaa..be6a07c 100644 --- a/app/views/admin/counties/show.html.erb +++ b/app/views/admin/counties/show.html.erb @@ -1,10 +1,16 @@

<%= notice %>

- Name: + Name : <%= @county.name %> -

- <%= @county.is_visible %> +

+ + <%= link_to 'Edit', edit_admin_county_path(@county) %> | <%= link_to 'Back', admin_counties_path %> diff --git a/db/migrate/20111104144940_ledgers_add_county.rb b/db/migrate/20111104144940_ledgers_add_county.rb new file mode 100644 index 0000000..39e2cae --- /dev/null +++ b/db/migrate/20111104144940_ledgers_add_county.rb @@ -0,0 +1,9 @@ +class LedgersAddCounty < ActiveRecord::Migration + def self.up + add_column :ledgers, :county_id, :integer + end + + def self.down + remove_column :ledgers, :county_id + end +end diff --git a/db/migrate/20111104145622_paychecks_add_county.rb b/db/migrate/20111104145622_paychecks_add_county.rb new file mode 100644 index 0000000..24f533a --- /dev/null +++ b/db/migrate/20111104145622_paychecks_add_county.rb @@ -0,0 +1,9 @@ +class PaychecksAddCounty < ActiveRecord::Migration + def self.up + add_column :paychecks, :county_id, :integer + end + + def self.down + remove_column :paychecks, :county_id + end +end From 20239c901267894324163cc95751e853249198f4 Mon Sep 17 00:00:00 2001 From: Wadii TAHRI Date: Thu, 10 Nov 2011 10:02:05 +0100 Subject: [PATCH 05/19] depolyment check after pull and push of editing counties --- app/controllers/admin/counties_controller.rb | 5 +++++ app/views/admin/counties/show.html.erb | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/admin/counties_controller.rb b/app/controllers/admin/counties_controller.rb index e0801ea..c305a2c 100644 --- a/app/controllers/admin/counties_controller.rb +++ b/app/controllers/admin/counties_controller.rb @@ -18,6 +18,11 @@ def index # GET /counties/1.xml def show @county = County.find(params[:id]) + @county_tax_zone = CountyTaxZone.where(:county_id => @county.id)[0] + puts "***********************", @county_tax_zone.class, @county_tax_zone.id, "****************************************" + # TO-DO : check whether @county_tax_zone is not nil : CountyTaxZone must contain a row that has a county_id available + @tax_zone = @county_tax_zone.tax_zone + @tax_zones = TaxZone.find(:all) respond_to do |format| format.html # show.html.erb diff --git a/app/views/admin/counties/show.html.erb b/app/views/admin/counties/show.html.erb index be6a07c..de18ded 100644 --- a/app/views/admin/counties/show.html.erb +++ b/app/views/admin/counties/show.html.erb @@ -5,12 +5,11 @@ <%= @county.name %>

- + Number : <%= @tax_zone.number %>
+ Effective date : <%= @county_tax_zone.from %>
+

<%= link_to 'Edit', edit_admin_county_path(@county) %> | <%= link_to 'Back', admin_counties_path %> From 36581a7d44f7f1db2298b4898ac16514fc5d02ac Mon Sep 17 00:00:00 2001 From: marwen blel Date: Thu, 10 Nov 2011 10:46:22 +0100 Subject: [PATCH 06/19] debug message deleted from layout file --- app/views/layouts/application.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2cfb666..d1dcb23 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -114,7 +114,6 @@
- <%= debug params %>