invoicing 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/invoicing/ledger_item.rb +5 -3
- data/lib/invoicing/line_item.rb +4 -3
- data/lib/invoicing/taxable.rb +6 -1
- data/lib/invoicing/version.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f3972f667d3265b67721b85f92ec36d6a112c53
|
4
|
+
data.tar.gz: 8a48030d2cec91e38d9cd13be8f689e0b255f563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c24c29ba8dd15f8d65bf4d091a7e6edcc3e8bb7189173b6f647fa771f2926fe6f2ede2e106452a39fd647b106f11d3a7d0cc0060b3c81ecd73ff87761bbd907
|
7
|
+
data.tar.gz: cbafde8f986ec7a4b9fb8d4da1b8ea0e28743f09a65783dbcb73ed857ef295cfb9549e5b64797aa7d30cb9cb3f48af2a9744c185224d3173d7164e4560050b49
|
data/README.md
CHANGED
@@ -7,8 +7,13 @@
|
|
7
7
|
This is a framework for generating and displaying invoices (ideal for commercial
|
8
8
|
Rails apps). It allows for flexible business logic; provides tools for tax handling,
|
9
9
|
commission calculation etc. It aims to be both developer-friendly and
|
10
|
-
accountant-friendly.
|
11
|
-
|
10
|
+
accountant-friendly.
|
11
|
+
|
12
|
+
## Documentation
|
13
|
+
|
14
|
+
Detailed documentation about `invoicing` gem can be found on:
|
15
|
+
|
16
|
+
http://invoicing.codemancers.com/
|
12
17
|
|
13
18
|
## Features
|
14
19
|
|
@@ -376,17 +376,19 @@ module Invoicing
|
|
376
376
|
}
|
377
377
|
|
378
378
|
scope :sorted, lambda { |column|
|
379
|
+
table = ledger_item_class_info.method(quoted_table_name).to_s
|
379
380
|
column = ledger_item_class_info.method(column).to_s
|
380
381
|
if column_names.include?(column)
|
381
|
-
order("#{connection.quote_column_name(column)}, #{connection.quote_column_name(primary_key)}")
|
382
|
+
order("#{table}.#{connection.quote_column_name(column)}, #{table}.#{connection.quote_column_name(primary_key)}")
|
382
383
|
else
|
383
|
-
order(connection.quote_column_name(primary_key))
|
384
|
+
order("#{table}.#{connection.quote_column_name(primary_key)}")
|
384
385
|
end
|
385
386
|
}
|
386
387
|
|
387
388
|
scope :exclude_empty_invoices, lambda {
|
388
389
|
line_items_assoc_id = ledger_item_class_info.method(:line_items).to_sym
|
389
|
-
line_items_refl = reflections[line_items_assoc_id]
|
390
|
+
line_items_refl = reflections[line_items_assoc_id] ||
|
391
|
+
reflections[line_items_assoc_id.to_s]
|
390
392
|
line_items_table = line_items_refl.quoted_table_name
|
391
393
|
|
392
394
|
# e.g. `ledger_items`.`id`
|
data/lib/invoicing/line_item.rb
CHANGED
@@ -164,18 +164,19 @@ module Invoicing
|
|
164
164
|
# Dynamically created named scopes
|
165
165
|
scope :in_effect, lambda {
|
166
166
|
ledger_assoc = line_item_class_info.method(:ledger_item).to_sym
|
167
|
-
ledger_refl = reflections[ledger_assoc]
|
167
|
+
ledger_refl = reflections[ledger_assoc] || reflections[ledger_assoc.to_s]
|
168
168
|
ledger_table = ledger_refl.table_name # not quoted_table_name because it'll be quoted again
|
169
169
|
status_column = ledger_refl.klass.send(:ledger_item_class_info).method(:status)
|
170
170
|
joins(ledger_assoc).where("#{ledger_table}.#{status_column}" => ['closed', 'cleared'])
|
171
171
|
}
|
172
172
|
|
173
173
|
scope :sorted, lambda { |column|
|
174
|
+
table = line_item_class_info.method(quoted_table_name).to_s
|
174
175
|
column = line_item_class_info.method(column).to_s
|
175
176
|
if column_names.include?(column)
|
176
|
-
order("#{connection.quote_column_name(column)}, #{connection.quote_column_name(primary_key)}")
|
177
|
+
order("#{table}.#{connection.quote_column_name(column)}, #{table}.#{connection.quote_column_name(primary_key)}")
|
177
178
|
else
|
178
|
-
order(connection.quote_column_name(primary_key))
|
179
|
+
order("#{table}.#{connection.quote_column_name(primary_key)}")
|
179
180
|
end
|
180
181
|
}
|
181
182
|
end
|
data/lib/invoicing/taxable.rb
CHANGED
@@ -250,7 +250,12 @@ module Invoicing
|
|
250
250
|
@taxed_or_untaxed[attribute] = :untaxed
|
251
251
|
@taxed_attributes[attribute] = nil
|
252
252
|
elsif attribute =~ /^(#{attr_regex})_taxed$/
|
253
|
-
|
253
|
+
if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR >= 2
|
254
|
+
@attributes.write_cast_value(attribute, value)
|
255
|
+
else
|
256
|
+
@attributes[attribute] = value
|
257
|
+
end
|
258
|
+
|
254
259
|
@taxed_or_untaxed[$1] = :taxed
|
255
260
|
@taxed_attributes[$1] = value
|
256
261
|
end
|
data/lib/invoicing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invoicing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Kleppmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: flexmock
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: minitest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +107,7 @@ files:
|
|
121
107
|
- lib/rails/generators/invoicing/tax_rate/tax_rate_generator.rb
|
122
108
|
- lib/rails/generators/invoicing/tax_rate/templates/migration.rb
|
123
109
|
- lib/rails/generators/invoicing/tax_rate/templates/model.rb
|
124
|
-
homepage: http://
|
110
|
+
homepage: http://invoicing.codemancers.com/
|
125
111
|
licenses: []
|
126
112
|
metadata: {}
|
127
113
|
post_install_message:
|
@@ -140,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
126
|
version: '0'
|
141
127
|
requirements: []
|
142
128
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.4.5
|
144
130
|
signing_key:
|
145
131
|
specification_version: 4
|
146
132
|
summary: Ruby Invoicing Framework
|