africompta 1.9.11 → 1.9.13.pre.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +41 -31
- data/africompta.gemspec +3 -3
- data/lib/africompta/entities/account.rb +21 -9
- data/lib/africompta/views/compta/edit_movements.rb +3 -2
- data/test/ac_account.rb +12 -4
- data/test/ac_africompta.rb +4 -0
- data/test/ac_movement.rb +7 -0
- data/test/test.rb +16 -10
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf1e7e270ef30a5fd52246f899bfd0c9bfbab96c
|
4
|
+
data.tar.gz: 0d18e6a07b37e389df418e8fcb2c14b644a05b19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57effd88a25338b06af9db2ce8b199d4344cf778d7577ffaf05fab5dcce975bd9f4a787386b7870cc70f9aaacf0ca58187af5296550aa0282ef25181d964165d
|
7
|
+
data.tar.gz: e11724471549d4a8b199a4076f1a430dfdba4850e5ac4d6232312ea9809861b07eadb2cca413603621ed8ccc25629d86310d0708467ff20f6df8d66b621dd1df
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
africompta (1.9.10)
|
5
|
-
prawn (= 1.0.0)
|
6
|
-
qooxview (= 1.9.10)
|
7
|
-
|
8
1
|
PATH
|
9
2
|
remote: ../HelperClasses
|
10
3
|
specs:
|
@@ -13,58 +6,68 @@ PATH
|
|
13
6
|
PATH
|
14
7
|
remote: ../QooxView
|
15
8
|
specs:
|
16
|
-
qooxview (1.9.
|
17
|
-
activemodel (=
|
18
|
-
activerecord (=
|
19
|
-
activesupport (=
|
20
|
-
arel (=
|
9
|
+
qooxview (1.9.11)
|
10
|
+
activemodel (= 5.1.0)
|
11
|
+
activerecord (= 5.1.0)
|
12
|
+
activesupport (= 5.1.0)
|
13
|
+
arel (= 8.0)
|
21
14
|
chunky_png (= 1.3.4)
|
22
15
|
docsplit (= 0.7.6)
|
23
16
|
gettext (= 3.0.0)
|
24
17
|
helper_classes (= 0.3.5)
|
25
|
-
i18n (= 0.
|
18
|
+
i18n (= 0.7.0)
|
26
19
|
iconv (= 1.0.3)
|
27
20
|
iniparse (= 1.4.0)
|
28
21
|
json (= 2.1.0)
|
29
22
|
locale (= 2.0.8)
|
30
23
|
multi_json (= 1.0.3)
|
31
|
-
net-ldap (= 0.
|
24
|
+
net-ldap (= 0.16)
|
32
25
|
rqrcode (= 0.4.2)
|
33
26
|
rqrcode-with-patches (= 0.5.4)
|
34
27
|
rubyzip (= 1.1.7)
|
35
28
|
serialport (= 1.3.1)
|
36
29
|
sqlite3 (= 1.3.10)
|
30
|
+
test-unit (= 3.2.3)
|
37
31
|
text (= 1.2.3)
|
38
32
|
|
33
|
+
PATH
|
34
|
+
remote: .
|
35
|
+
specs:
|
36
|
+
africompta (1.9.11)
|
37
|
+
prawn (= 1.0.0)
|
38
|
+
qooxview (= 1.9.11)
|
39
|
+
|
39
40
|
GEM
|
40
41
|
remote: https://rubygems.org/
|
41
42
|
specs:
|
42
|
-
activemodel (
|
43
|
-
activesupport (=
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
arel (
|
54
|
-
builder (3.0.4)
|
43
|
+
activemodel (5.1.0)
|
44
|
+
activesupport (= 5.1.0)
|
45
|
+
activerecord (5.1.0)
|
46
|
+
activemodel (= 5.1.0)
|
47
|
+
activesupport (= 5.1.0)
|
48
|
+
arel (~> 8.0)
|
49
|
+
activesupport (5.1.0)
|
50
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
51
|
+
i18n (~> 0.7)
|
52
|
+
minitest (~> 5.1)
|
53
|
+
tzinfo (~> 1.1)
|
54
|
+
arel (8.0.0)
|
55
55
|
chunky_png (1.3.4)
|
56
|
+
concurrent-ruby (1.0.5)
|
56
57
|
docsplit (0.7.6)
|
57
58
|
gettext (3.0.0)
|
58
59
|
locale (>= 2.0.5)
|
59
60
|
text
|
60
|
-
i18n (0.
|
61
|
+
i18n (0.7.0)
|
61
62
|
iconv (1.0.3)
|
62
63
|
iniparse (1.4.0)
|
63
64
|
json (2.1.0)
|
64
65
|
locale (2.0.8)
|
66
|
+
minitest (5.10.2)
|
65
67
|
multi_json (1.0.3)
|
66
|
-
net-ldap (0.
|
67
|
-
pdf-core (0.2.
|
68
|
+
net-ldap (0.16.0)
|
69
|
+
pdf-core (0.2.2)
|
70
|
+
power_assert (1.0.2)
|
68
71
|
prawn (1.0.0)
|
69
72
|
pdf-core (~> 0.2.2)
|
70
73
|
ttfunk (~> 1.1.1)
|
@@ -74,9 +77,13 @@ GEM
|
|
74
77
|
rubyzip (1.1.7)
|
75
78
|
serialport (1.3.1)
|
76
79
|
sqlite3 (1.3.10)
|
80
|
+
test-unit (3.2.3)
|
81
|
+
power_assert
|
77
82
|
text (1.2.3)
|
83
|
+
thread_safe (0.3.6)
|
78
84
|
ttfunk (1.1.1)
|
79
|
-
tzinfo (
|
85
|
+
tzinfo (1.2.3)
|
86
|
+
thread_safe (~> 0.1)
|
80
87
|
|
81
88
|
PLATFORMS
|
82
89
|
ruby
|
@@ -85,3 +92,6 @@ DEPENDENCIES
|
|
85
92
|
africompta!
|
86
93
|
helper_classes!
|
87
94
|
qooxview!
|
95
|
+
|
96
|
+
BUNDLED WITH
|
97
|
+
1.15.0
|
data/africompta.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'africompta'
|
3
|
-
s.version = '1.9.
|
4
|
-
s.date = '
|
3
|
+
s.version = '1.9.13-10'
|
4
|
+
s.date = '2017-10-30'
|
5
5
|
s.summary = 'Africompta-module for QooxView'
|
6
6
|
s.description = 'With this module you can have a simple accounting-system.
|
7
7
|
It is based on http://github.com/ineiti/QooxView and adds Entities to handle
|
8
8
|
accounts and movements. For the standalone counterpart (which uses the same database),
|
9
9
|
see http://github.com/ineiti/AfriCompta_client .'
|
10
10
|
s.authors = ['Linus Gasser']
|
11
|
-
s.email = 'ineiti
|
11
|
+
s.email = 'ineiti.blue'
|
12
12
|
|
13
13
|
s.files = `if [ -d '.git' ]; then git ls-files -z; fi`.split("\x0")
|
14
14
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -177,7 +177,7 @@ class Accounts < Entities
|
|
177
177
|
years = Hash.new(0)
|
178
178
|
acc.movements.each { |mov|
|
179
179
|
if not mov.desc =~ /^-- Sum of/
|
180
|
-
y, m,
|
180
|
+
y, m, _ = mov.date.to_s.split('-').collect { |d| d.to_i }
|
181
181
|
dputs(5) { "Date of #{mov.desc} is #{mov.date}" }
|
182
182
|
m < month_start and y -= 1
|
183
183
|
years[y] += 1
|
@@ -207,7 +207,7 @@ class Accounts < Entities
|
|
207
207
|
def move_movements(acc, years, month_start)
|
208
208
|
acc.movements.each { |mov|
|
209
209
|
dputs(5) { 'Start of each' }
|
210
|
-
y, m,
|
210
|
+
y, m, _ = mov.date.to_s.split('-').collect { |d| d.to_i }
|
211
211
|
dputs(5) { "Date of #{mov.desc} is #{mov.date}" }
|
212
212
|
m < month_start and y -= 1
|
213
213
|
if years.has_key? y
|
@@ -455,7 +455,7 @@ class Accounts < Entities
|
|
455
455
|
def load
|
456
456
|
super
|
457
457
|
if Accounts.search_by_name('Root').count == 0
|
458
|
-
dputs(
|
458
|
+
dputs(1) { "Didn't find 'Root' in database - creating base" }
|
459
459
|
Accounts.init
|
460
460
|
end
|
461
461
|
end
|
@@ -473,6 +473,18 @@ class Accounts < Entities
|
|
473
473
|
a.rev_index = a.id
|
474
474
|
end
|
475
475
|
|
476
|
+
def migration_3(m)
|
477
|
+
# dp "Migrating #{m.inspect}"
|
478
|
+
if m.id == 1 && m.account_id != nil
|
479
|
+
dp 'Root-account has parent...'
|
480
|
+
m.account_id = 0
|
481
|
+
m.name = 'Root'
|
482
|
+
m.desc = 'Root'
|
483
|
+
m.global_id = Digest::MD5.hexdigest((rand 2**128).to_s).to_s + '-1'
|
484
|
+
m.total = 0.0
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
476
488
|
def listp_path
|
477
489
|
dputs(3) { 'Being called' }
|
478
490
|
Accounts.search_all.select { |a| !a.deleted }.collect { |a| [a.id, a.path] }.
|
@@ -513,7 +525,7 @@ class Accounts < Entities
|
|
513
525
|
#dputs(3) { "Looking at #{row}" }
|
514
526
|
@check_progress += progress_step
|
515
527
|
|
516
|
-
|
528
|
+
_, acc_id_, name_, desc_, gid_, tot_, mult_, _, _, del_, keep_, = row
|
517
529
|
parent = if acc_id_
|
518
530
|
acc_id_ == 0 ? '' :
|
519
531
|
db.execute("select * from compta_accounts where id=#{acc_id_}").first[4]
|
@@ -756,7 +768,7 @@ class Account < Entity
|
|
756
768
|
set_child_multiplier_total(multiplier, total)
|
757
769
|
end
|
758
770
|
|
759
|
-
# Sort first regarding inverse date (newest first), then description,
|
771
|
+
# Sort first regarding inverse date (newest first), then description,
|
760
772
|
# and finally the value
|
761
773
|
def movements(from = nil, to = nil)
|
762
774
|
dputs(5) { 'Account::movements' }
|
@@ -775,7 +787,7 @@ class Account < Entity
|
|
775
787
|
end
|
776
788
|
if ret == 0
|
777
789
|
ret = a.rev_index <=> b.rev_index
|
778
|
-
=begin
|
790
|
+
=begin
|
779
791
|
if a.desc and b.desc
|
780
792
|
ret = a.desc <=> b.desc
|
781
793
|
end
|
@@ -834,7 +846,7 @@ class Account < Entity
|
|
834
846
|
}
|
835
847
|
self
|
836
848
|
end
|
837
|
-
|
849
|
+
|
838
850
|
def accounts
|
839
851
|
# Some hand-optimized stuff. This would be written shorter like this:
|
840
852
|
# Accounts.matches_by_account_id( self.id )
|
@@ -853,7 +865,7 @@ class Account < Entity
|
|
853
865
|
Accounts.match_by_id(self.account_id)
|
854
866
|
end
|
855
867
|
|
856
|
-
def account=
|
868
|
+
def account=(a)
|
857
869
|
self.account_id = a.class == Account ? a.id : a
|
858
870
|
end
|
859
871
|
|
@@ -861,7 +873,7 @@ class Account < Entity
|
|
861
873
|
account
|
862
874
|
end
|
863
875
|
|
864
|
-
def parent=
|
876
|
+
def parent=(a)
|
865
877
|
self.account = a
|
866
878
|
end
|
867
879
|
|
@@ -107,7 +107,8 @@ class ComptaEditMovements < View
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def update_accounts()
|
110
|
-
|
110
|
+
if AccountRoot.actual
|
111
|
+
reply(:empty_nonlists, [:account_archive, :account_src, :account_dst]) +
|
111
112
|
reply(:update_silent, :account_archive =>
|
112
113
|
[[AccountRoot.actual.id, 'Actual']].concat(
|
113
114
|
if archive = AccountRoot.archive
|
@@ -119,6 +120,7 @@ class ComptaEditMovements < View
|
|
119
120
|
update_list(AccountRoot.actual, AccountRoot.actual) +
|
120
121
|
reply(:update, :account_src => AccountRoot.actual.listp_path,
|
121
122
|
:account_dst => AccountRoot.actual.listp_path)
|
123
|
+
end
|
122
124
|
end
|
123
125
|
|
124
126
|
def rpc_update_view(session)
|
@@ -164,4 +166,3 @@ class ComptaEditMovements < View
|
|
164
166
|
return str.delete('^0123456789.,-').gsub(/,/, '.').to_f
|
165
167
|
end
|
166
168
|
end
|
167
|
-
|
data/test/ac_account.rb
CHANGED
@@ -29,6 +29,8 @@ class TC_Account < Test::Unit::TestCase
|
|
29
29
|
|
30
30
|
def test_path
|
31
31
|
assert_equal 'Root::Cash', @cash.path
|
32
|
+
assert_equal 0, @root.account_id
|
33
|
+
assert_equal nil, @root.account
|
32
34
|
end
|
33
35
|
|
34
36
|
def test_del_account
|
@@ -61,12 +63,12 @@ class TC_Account < Test::Unit::TestCase
|
|
61
63
|
Accounts.create_path('Test')
|
62
64
|
Accounts.dump true
|
63
65
|
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
|
64
|
-
assert_equal [4, 0,
|
66
|
+
assert_equal [4, 0, 18, 1],
|
65
67
|
[count_mov, bad_mov, count_acc, bad_acc]
|
66
68
|
|
67
69
|
Accounts.dump
|
68
70
|
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
|
69
|
-
assert_equal [4, 0,
|
71
|
+
assert_equal [4, 0, 18, 0],
|
70
72
|
[count_mov, bad_mov, count_acc, bad_acc]
|
71
73
|
end
|
72
74
|
|
@@ -146,7 +148,7 @@ class TC_Account < Test::Unit::TestCase
|
|
146
148
|
Movements.create("Mov for #{src}_#{sub} - #{mov}", date, 100 * src,
|
147
149
|
accs[src][sub], @cash)
|
148
150
|
}
|
149
|
-
assert_equal -300 * src, accs[src][sub].total
|
151
|
+
assert_equal( -300 * src, accs[src][sub].total)
|
150
152
|
}
|
151
153
|
}
|
152
154
|
|
@@ -157,7 +159,7 @@ class TC_Account < Test::Unit::TestCase
|
|
157
159
|
dp line
|
158
160
|
end
|
159
161
|
|
160
|
-
def
|
162
|
+
def tes_report_man
|
161
163
|
SQLite.dbs_close_all
|
162
164
|
FileUtils.cp('db.man', 'data2/compta.db')
|
163
165
|
SQLite.dbs_open_load
|
@@ -173,4 +175,10 @@ class TC_Account < Test::Unit::TestCase
|
|
173
175
|
line = report.print_account_monthly(reportAccount, Date.new(2014, 6), 1, 1)
|
174
176
|
dp line
|
175
177
|
end
|
178
|
+
|
179
|
+
def test_add_account
|
180
|
+
subacc = Accounts.create_path("Root::Test")
|
181
|
+
Entities.reload
|
182
|
+
assert_equal 6, Accounts.search_all_.count
|
183
|
+
end
|
176
184
|
end
|
data/test/ac_africompta.rb
CHANGED
@@ -10,6 +10,10 @@ class TC_AfriCompta < Test::Unit::TestCase
|
|
10
10
|
dputs(2) { 'Resetting SQLite' }
|
11
11
|
SQLite.dbs_close_all
|
12
12
|
dputs(2) { 'Putting testGestion' }
|
13
|
+
begin
|
14
|
+
Dir.mkdir('data')
|
15
|
+
rescue Errno::EEXIST
|
16
|
+
end
|
13
17
|
FileUtils.cp('db.testGestion', 'data/compta.db')
|
14
18
|
SQLite.dbs_open_load_migrate
|
15
19
|
|
data/test/ac_movement.rb
CHANGED
@@ -25,6 +25,13 @@ class TC_Movement < Test::Unit::TestCase
|
|
25
25
|
def teardown
|
26
26
|
end
|
27
27
|
|
28
|
+
def test_rm_add
|
29
|
+
m = Movements.create('test', Date.today, 1000, @cash, @lending)
|
30
|
+
m.delete
|
31
|
+
Movements.create('test', Date.today, 1000, @cash, @lending)
|
32
|
+
assert_equal 2040, @cash.total.to_i
|
33
|
+
end
|
34
|
+
|
28
35
|
def test_move
|
29
36
|
value_cash = @cash.total.to_f
|
30
37
|
value_lending = @lending.total.to_f
|
data/test/test.rb
CHANGED
@@ -12,21 +12,27 @@ DEBUG_LVL=1
|
|
12
12
|
require 'QooxView'
|
13
13
|
require 'africompta'
|
14
14
|
|
15
|
-
Permission.add(
|
16
|
-
Permission.add(
|
17
|
-
Permission.add(
|
18
|
-
Permission.add(
|
19
|
-
Permission.add(
|
20
|
-
Permission.add(
|
15
|
+
Permission.add('default', 'View,Welcome')
|
16
|
+
Permission.add('admin', '.*', '.*')
|
17
|
+
Permission.add('internet', 'Internet,PersonShow', 'default')
|
18
|
+
Permission.add('student', '', 'internet')
|
19
|
+
Permission.add('professor', '', 'student')
|
20
|
+
Permission.add('secretary', 'PersonModify', 'professor')
|
21
21
|
|
22
|
-
qooxView = QooxView.init(
|
22
|
+
qooxView = QooxView.init('../Entities', '../Views')
|
23
23
|
|
24
|
-
tests =
|
24
|
+
tests = Dir.glob('ac_*.rb')
|
25
|
+
# tests = %w( africompta account movement sqlite )
|
25
26
|
#tests = %w( africompta )
|
26
27
|
tests = %w( account )
|
27
28
|
#tests = %w( merge )
|
28
|
-
tests
|
29
|
-
|
29
|
+
dp tests
|
30
|
+
tests.each { |t|
|
31
|
+
begin
|
32
|
+
require_relative "ac_#{t}"
|
33
|
+
rescue LoadError => e
|
34
|
+
require_relative t
|
35
|
+
end
|
30
36
|
}
|
31
37
|
|
32
38
|
# Fails test_archive_sum_up
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: africompta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.13.pre.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linus Gasser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qooxview
|
@@ -43,7 +43,7 @@ description: |-
|
|
43
43
|
It is based on http://github.com/ineiti/QooxView and adds Entities to handle
|
44
44
|
accounts and movements. For the standalone counterpart (which uses the same database),
|
45
45
|
see http://github.com/ineiti/AfriCompta_client .
|
46
|
-
email: ineiti
|
46
|
+
email: ineiti.blue
|
47
47
|
executables:
|
48
48
|
- afri_compta.rb
|
49
49
|
- africompta.sh
|
@@ -109,12 +109,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- - "
|
112
|
+
- - ">"
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
114
|
+
version: 1.3.1
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.6.
|
117
|
+
rubygems_version: 2.6.13
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Africompta-module for QooxView
|