redmine_crm 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/CHANGELOG +9 -0
- data/lib/redmine_crm/currency/formatting.rb +5 -10
- data/lib/redmine_crm/money_helper.rb +7 -10
- data/lib/redmine_crm/rcrm_acts_as_taggable.rb +6 -5
- data/lib/redmine_crm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8476cc7f68dab5781c42ea785cdf2ceee5cd110f
|
4
|
+
data.tar.gz: 803b10a20986f745450fb3137b69c69d6fa53158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3fbac887b278b4f45ca4dc48adc508ed5876e9a5ff8bb531a6b837a8a8d9b4b0ff8d6a05df5165701030c2ec3e9c50a5f622660f25a474be2eba13b6e0e1b8
|
7
|
+
data.tar.gz: c14842d725949500bd2d91121f6817864908b138c899883f0b28bd83318f7c700ac18cf47bc9c8af3e4705c43084eaa845bbac697016a1e2c48906f3a3fb07db
|
data/doc/CHANGELOG
CHANGED
@@ -4,6 +4,15 @@ Redmine crm gem - general functions for plugins (tags, vote, viewing, currency)
|
|
4
4
|
Copyright (C) 2011-2015 RedmineCRM
|
5
5
|
http://www.redminecrm.com/
|
6
6
|
|
7
|
+
== 2015-09-26 v0.0.16
|
8
|
+
|
9
|
+
* Totally remove dependency from Contact plugin
|
10
|
+
|
11
|
+
== 2015-09-24 v0.0.15
|
12
|
+
|
13
|
+
* Fixed bug for available tag when model not have a relation with a project
|
14
|
+
* Added transfer of parameters for formatting a price
|
15
|
+
|
7
16
|
== 2015-09-23 v0.0.14
|
8
17
|
|
9
18
|
* Fixed bug in viewed? function
|
@@ -30,16 +30,15 @@ module RedmineCrm
|
|
30
30
|
def format(value, currency, *rules)
|
31
31
|
# support for old format parameters
|
32
32
|
rules = normalize_formatting_rules(rules)
|
33
|
-
# byebug
|
34
|
-
rules = Currency.default_formatting_rules.merge(rules)
|
35
33
|
if currency
|
36
34
|
rules = self.localize_formatting_rules(rules, currency)
|
37
35
|
rules = self.translate_formatting_rules(rules, currency.code) if rules[:translate]
|
38
|
-
rules[:decimal_mark] = currency.decimal_mark
|
36
|
+
rules[:decimal_mark] = currency.decimal_mark if rules[:decimal_mark].nil?
|
39
37
|
rules[:decimal_places] = currency.decimal_places
|
40
38
|
rules[:subunit_to_unit] = currency.subunit_to_unit
|
41
|
-
rules[:thousands_separator] = currency.thousands_separator
|
39
|
+
rules[:thousands_separator] = currency.thousands_separator if rules[:thousands_separator].nil?
|
42
40
|
end
|
41
|
+
rules = Currency.default_formatting_rules.merge(rules){|key, v1, v2| v2.nil? ? v1 : v2}
|
43
42
|
|
44
43
|
# if fractional == 0
|
45
44
|
if rules[:display_free].respond_to?(:to_str)
|
@@ -50,9 +49,6 @@ module RedmineCrm
|
|
50
49
|
# end
|
51
50
|
|
52
51
|
symbol_value = currency.try(:symbol) || ""
|
53
|
-
# decimal_mark = rules["decimal_mark"]
|
54
|
-
# decimal_places
|
55
|
-
|
56
52
|
|
57
53
|
formatted = value.abs.to_s
|
58
54
|
|
@@ -79,7 +75,6 @@ module RedmineCrm
|
|
79
75
|
thousands_separator_value = rules[:thousands_separator] || ''
|
80
76
|
end
|
81
77
|
decimal_mark = rules[:decimal_mark]
|
82
|
-
|
83
78
|
# Apply thousands_separator
|
84
79
|
formatted.gsub!(regexp_format(formatted, rules, decimal_mark, symbol_value),
|
85
80
|
"\\1#{thousands_separator_value}")
|
@@ -206,8 +201,8 @@ module RedmineCrm
|
|
206
201
|
rules = rules.pop
|
207
202
|
rules = { rules => true } if rules.is_a?(Symbol)
|
208
203
|
end
|
209
|
-
rules[:decimal_mark] = rules[:separator] ||
|
210
|
-
rules[:thousands_separator] = rules[:delimiter] ||
|
204
|
+
rules[:decimal_mark] = rules[:separator] || rules[:decimal_mark]
|
205
|
+
rules[:thousands_separator] = rules[:delimiter] || rules[:thousands_separator]
|
211
206
|
rules
|
212
207
|
end
|
213
208
|
|
@@ -5,8 +5,9 @@ require 'action_view'
|
|
5
5
|
module RedmineCrm
|
6
6
|
module MoneyHelper
|
7
7
|
|
8
|
-
def object_price(obj, price_field = :price)
|
9
|
-
|
8
|
+
def object_price(obj, price_field = :price, options = {})
|
9
|
+
options.merge!({:symbol => true})
|
10
|
+
price_to_currency(obj.try(price_field), obj.currency, options).to_s if obj.respond_to?(:currency)
|
10
11
|
end
|
11
12
|
|
12
13
|
def prices_collection_by_currency(prices_collection, options={})
|
@@ -29,14 +30,10 @@ module RedmineCrm
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
|
-
def collection_for_currencies_select(default_currency
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def major_currencies_collection(default_currency)
|
37
|
-
currencies = []
|
33
|
+
def collection_for_currencies_select(default_currency='USD')
|
34
|
+
currencies = []
|
38
35
|
currencies << default_currency.to_s unless default_currency.blank?
|
39
|
-
currencies |=
|
36
|
+
currencies |= %w(USD EUR GBP RUB CHF)
|
40
37
|
currencies.map do |c|
|
41
38
|
currency = RedmineCrm::Currency.find(c)
|
42
39
|
["#{currency.iso_code} (#{currency.symbol})", currency.iso_code] if currency
|
@@ -57,7 +54,7 @@ module RedmineCrm
|
|
57
54
|
currency = "USD" unless currency.is_a?(String)
|
58
55
|
currency = RedmineCrm::Currency.find(currency)
|
59
56
|
|
60
|
-
return RedmineCrm::Currency.format(price.to_f, currency)# if currency
|
57
|
+
return RedmineCrm::Currency.format(price.to_f, currency, options)# if currency
|
61
58
|
price.to_s
|
62
59
|
end
|
63
60
|
|
@@ -93,16 +93,17 @@ module RedmineCrm
|
|
93
93
|
#Example: Question.available_tags(@project_id )
|
94
94
|
def available_tags(project=nil, limit=30)
|
95
95
|
scope = Tag.where({})
|
96
|
-
scope = scope.where("#{Project.table_name}.id = ?", project) if project
|
97
96
|
class_name = quote_value(base_class.name, nil)
|
98
97
|
join = []
|
99
98
|
join << "JOIN #{Tagging.table_name} ON #{Tagging.table_name}.tag_id = #{Tag.table_name}.id "
|
100
99
|
join << "JOIN #{table_name} ON #{table_name}.id = #{Tagging.table_name}.taggable_id
|
101
100
|
AND #{Tagging.table_name}.taggable_type = #{class_name} "
|
102
|
-
if
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
if self.attribute_names.include? "project_id"
|
102
|
+
if project
|
103
|
+
join << "JOIN #{Project.table_name} ON #{Project.table_name}.id = #{table_name}.project_id"
|
104
|
+
else
|
105
|
+
scope = scope.where("#{table_name}.project_id IS NULL")
|
106
|
+
end
|
106
107
|
end
|
107
108
|
|
108
109
|
group_fields = ""
|
data/lib/redmine_crm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RedmineCRM
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: plugins for Redmine
|
14
14
|
email:
|