africompta 1.9.10 → 1.9.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -1
- data/Gemfile.lock +14 -8
- data/africompta.gemspec +3 -2
- data/bin/afri_compta.rb +119 -0
- data/bin/africompta.sh +23 -0
- data/config.yaml.default +19 -0
- data/lib/africompta.rb +7 -1
- data/lib/africompta/acaccess.rb +54 -68
- data/lib/africompta/acqooxview.rb +10 -10
- data/lib/africompta/entities/account.rb +120 -116
- data/lib/africompta/entities/config_base.rb +9 -0
- data/lib/africompta/entities/remote.rb +240 -6
- data/lib/africompta/entities/report.rb +136 -0
- data/lib/africompta/entities/users.rb +18 -6
- data/lib/africompta/views/compta/admin.rb +135 -0
- data/lib/africompta/views/compta/check.rb +245 -0
- data/lib/africompta/views/compta/edit_accounts.rb +138 -0
- data/lib/africompta/views/compta/edit_movements.rb +167 -0
- data/lib/africompta/views/compta/remotes.rb +23 -0
- data/lib/africompta/views/compta/tabs.rb +9 -0
- data/lib/africompta/views/compta/users.rb +23 -0
- data/lib/africompta/views/report/compta_executive.rb +221 -0
- data/lib/africompta/views/report/compta_flat.rb +79 -0
- data/lib/africompta/views/report/tabs.rb +7 -2
- data/po/afri_compta-ar.po +2356 -0
- data/po/afri_compta-en.po +2253 -0
- data/po/afri_compta-fr.po +4345 -0
- data/test/ac_account.rb +176 -0
- data/{Test → test}/ac_africompta.rb +0 -0
- data/{Test → test}/ac_big.rb +0 -0
- data/test/ac_merge.rb +177 -0
- data/{Test → test}/ac_movement.rb +14 -1
- data/{Test → test}/ac_sqlite.rb +0 -0
- data/{Test → test}/config_test.yaml +1 -6
- data/test/other.conf +1 -0
- data/test/other.rb +18 -0
- data/test/test.conf +1 -0
- data/{Test → test}/test.rb +7 -14
- metadata +63 -18
- data/Test/ac_account.rb +0 -128
- data/lib/africompta/africompta.rb +0 -83
- data/lib/africompta/views/edit/movement.rb +0 -8
- data/lib/africompta/views/edit/tabs.rb +0 -8
- data/lib/africompta/views/report/annual.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08243c15dad8df272891c62ea2faf14f74da98ac'
|
4
|
+
data.tar.gz: cae8035c25a7289f8cd3901d81dd6470b17ccc7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98b9ecec86b7f200b922c36556bfb9ac2cc8f416e71b43260cdaeca5d31522a38b4e810ef2e6a0ed0b3494ddf7fa1aaaedf3c33bf1c3dcc6d55876a97ff9df14
|
7
|
+
data.tar.gz: ec678fd7608c2391ea85791fb6da89fab6c0acbff3bf538b1755390199bff3b6370604adadc36373e20bbbc415a2a17d4c5860e22e9d1c39169a782f1f2ec5ee
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
africompta (1.9.10
|
5
|
-
|
4
|
+
africompta (1.9.10)
|
5
|
+
prawn (= 1.0.0)
|
6
|
+
qooxview (= 1.9.10)
|
6
7
|
|
7
8
|
PATH
|
8
9
|
remote: ../HelperClasses
|
9
10
|
specs:
|
10
|
-
helper_classes (0.3.
|
11
|
+
helper_classes (0.3.5)
|
11
12
|
|
12
13
|
PATH
|
13
14
|
remote: ../QooxView
|
14
15
|
specs:
|
15
|
-
qooxview (1.9.10
|
16
|
+
qooxview (1.9.10)
|
16
17
|
activemodel (= 3.1.1)
|
17
18
|
activerecord (= 3.1.1)
|
18
19
|
activesupport (= 3.1.1)
|
@@ -20,11 +21,11 @@ PATH
|
|
20
21
|
chunky_png (= 1.3.4)
|
21
22
|
docsplit (= 0.7.6)
|
22
23
|
gettext (= 3.0.0)
|
23
|
-
helper_classes (= 0.3.
|
24
|
+
helper_classes (= 0.3.5)
|
24
25
|
i18n (= 0.6.0)
|
25
26
|
iconv (= 1.0.3)
|
26
27
|
iniparse (= 1.4.0)
|
27
|
-
json (= 1.
|
28
|
+
json (= 2.1.0)
|
28
29
|
locale (= 2.0.8)
|
29
30
|
multi_json (= 1.0.3)
|
30
31
|
net-ldap (= 0.5.1)
|
@@ -59,10 +60,14 @@ GEM
|
|
59
60
|
i18n (0.6.0)
|
60
61
|
iconv (1.0.3)
|
61
62
|
iniparse (1.4.0)
|
62
|
-
json (1.
|
63
|
+
json (2.1.0)
|
63
64
|
locale (2.0.8)
|
64
65
|
multi_json (1.0.3)
|
65
66
|
net-ldap (0.5.1)
|
67
|
+
pdf-core (0.2.5)
|
68
|
+
prawn (1.0.0)
|
69
|
+
pdf-core (~> 0.2.2)
|
70
|
+
ttfunk (~> 1.1.1)
|
66
71
|
rqrcode (0.4.2)
|
67
72
|
rqrcode-with-patches (0.5.4)
|
68
73
|
chunky_png
|
@@ -70,7 +75,8 @@ GEM
|
|
70
75
|
serialport (1.3.1)
|
71
76
|
sqlite3 (1.3.10)
|
72
77
|
text (1.2.3)
|
73
|
-
|
78
|
+
ttfunk (1.1.1)
|
79
|
+
tzinfo (0.3.53)
|
74
80
|
|
75
81
|
PLATFORMS
|
76
82
|
ruby
|
data/africompta.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'africompta'
|
3
|
-
s.version = '1.9.
|
3
|
+
s.version = '1.9.11'
|
4
4
|
s.date = '2015-06-20'
|
5
5
|
s.summary = 'Africompta-module for QooxView'
|
6
6
|
s.description = 'With this module you can have a simple accounting-system.
|
@@ -19,5 +19,6 @@ see http://github.com/ineiti/AfriCompta_client .'
|
|
19
19
|
'https://github.com/ineiti/AfriCompta'
|
20
20
|
s.license = 'GPLv3'
|
21
21
|
|
22
|
-
s.add_dependency 'qooxview', '1.9.
|
22
|
+
s.add_dependency 'qooxview', '1.9.11'
|
23
|
+
s.add_dependency 'prawn', '1.0.0'
|
23
24
|
end
|
data/bin/afri_compta.rb
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
if ARGV == %w(-p)
|
5
|
+
DEBUG_LVL = 0
|
6
|
+
else
|
7
|
+
DEBUG_LVL = 2
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'bundler/setup'
|
11
|
+
require 'helper_classes'
|
12
|
+
include HelperClasses
|
13
|
+
include System
|
14
|
+
|
15
|
+
Encoding.default_external = Encoding::UTF_8
|
16
|
+
|
17
|
+
require 'fileutils'
|
18
|
+
|
19
|
+
begin
|
20
|
+
require 'africompta'
|
21
|
+
if not FileTest.exists? $config_file
|
22
|
+
puts "Config-file doesn't exist, copying a standard one"
|
23
|
+
FileUtils.cp "#{File.join(AFRICOMPTA_DIR, '..', '..', 'config.yaml')}.default",
|
24
|
+
$config_file
|
25
|
+
load_config_yaml
|
26
|
+
end
|
27
|
+
rescue Exception => e
|
28
|
+
puts "#{e.inspect}"
|
29
|
+
puts "#{e.to_s}"
|
30
|
+
puts e.backtrace
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
QooxView::init('entities', 'views')
|
36
|
+
rescue Exception => e
|
37
|
+
case e.to_s
|
38
|
+
when /UpdatePot|MakeMo|PrintHelp|value_entity_uncomplete/
|
39
|
+
else
|
40
|
+
puts e.inspect
|
41
|
+
puts e.backtrace
|
42
|
+
dputs(0) { "Error: Couldn't load things!" }
|
43
|
+
dputs(0) { "#{e.inspect}" }
|
44
|
+
dputs(0) { "#{e.to_s}" }
|
45
|
+
puts e.backtrace
|
46
|
+
end
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
webrick_port = get_config(3302, :Webrick, :port)
|
51
|
+
dputs(2) { "Starting at port #{webrick_port}" }
|
52
|
+
|
53
|
+
$profiling = get_config(nil, :profiling)
|
54
|
+
if $profiling
|
55
|
+
dputs(1) { 'Starting Profiling' }
|
56
|
+
require 'rubygems'
|
57
|
+
require 'perftools'
|
58
|
+
PerfTools::CpuProfiler.start("/tmp/#{$profiling}") do
|
59
|
+
QooxView::startWeb webrick_port, get_config(30, :profiling, :duration)
|
60
|
+
dputs(1) { 'Finished profiling' }
|
61
|
+
end
|
62
|
+
|
63
|
+
if $profiling
|
64
|
+
puts "Now run the following:
|
65
|
+
pprof.rb --pdf /tmp/#{$profiling} > /tmp/#{$profiling}.pdf
|
66
|
+
open /tmp/#{$profiling}.pdf
|
67
|
+
CPUPROFILE_FREQUENCY=500
|
68
|
+
"
|
69
|
+
end
|
70
|
+
else
|
71
|
+
dputs(1) { 'Starting autosave' }
|
72
|
+
$autosave = Thread.new {
|
73
|
+
loop {
|
74
|
+
sleep 60
|
75
|
+
rescue_all "Error: couldn't save all" do
|
76
|
+
Entities.save_all
|
77
|
+
end
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
# Shows time every minute in the logs
|
82
|
+
if get_config(false, :showTime)
|
83
|
+
dputs(1) { 'Showing time' }
|
84
|
+
$show_time = Thread.new {
|
85
|
+
loop {
|
86
|
+
sleep 60
|
87
|
+
dputs(1) { 'It is now: ' + Time.now.strftime('%Y-%m-%d %H:%M') }
|
88
|
+
}
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Catch SIGINT signal so we can save everything before quitting
|
93
|
+
trap('SIGINT') {
|
94
|
+
throw :ctrl_c
|
95
|
+
}
|
96
|
+
|
97
|
+
ConfigBase.set_functions(%w(accounting accounting_standalone))
|
98
|
+
# Finally start QooxView
|
99
|
+
catch :ctrl_c do
|
100
|
+
rescue_all 'Error: QooxView aborted' do
|
101
|
+
log_msg :main, "Started Gestion on port #{webrick_port}"
|
102
|
+
images_path = File.join(File.expand_path(File.dirname(__FILE__)), 'Images')
|
103
|
+
RPCQooxdooHandler.add_file_path(:Images, images_path)
|
104
|
+
include HelperClasses::HashAccessor
|
105
|
+
$config = {}
|
106
|
+
Welcome.nologin
|
107
|
+
QooxView::startWeb webrick_port
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Clean up all threads
|
112
|
+
if get_config(true, :autosave)
|
113
|
+
$autosave.kill
|
114
|
+
end
|
115
|
+
$show_time and $show_time.kill
|
116
|
+
|
117
|
+
# And finally save all before quitting
|
118
|
+
Entities.save_all
|
119
|
+
end
|
data/bin/africompta.sh
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
cd "$( dirname ${BASH_SOURCE[0]} )/.."
|
3
|
+
DIR_AC="$(pwd)"
|
4
|
+
DIR_RES="$DIR_AC/.."
|
5
|
+
|
6
|
+
echo "DATA_DIR=$HOME/Library/AfriCompta" > ../afri_compta.conf
|
7
|
+
export PATH="$DIR_RES/ruby/bin:$PATH"
|
8
|
+
export GEM_PATH="$DIR_RES/ruby/lib/ruby"
|
9
|
+
echo path: $PATH
|
10
|
+
echo gem_path: $GEM_PATH
|
11
|
+
ruby --version
|
12
|
+
which ruby
|
13
|
+
pkill -f "afri_compta.rb"
|
14
|
+
bin/afri_compta.rb &
|
15
|
+
AFRICOMPTA=$!
|
16
|
+
sleep 5
|
17
|
+
echo $AFRICOMPTA
|
18
|
+
open -Wn -a Safari.app http://localhost:3302
|
19
|
+
kill $!
|
20
|
+
#open -a Safari.app http://localhost:3302/$!
|
21
|
+
#pkill -f "afri_compta.rb"
|
22
|
+
echo Done with AfriCompta
|
23
|
+
#read a
|
data/config.yaml.default
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Uncomment to automatically login admin
|
2
|
+
#autologin: admin
|
3
|
+
# Together with autologin, allows for more than one at the same time,
|
4
|
+
# for example for chat
|
5
|
+
#multilogin: true
|
6
|
+
|
7
|
+
StorageType:
|
8
|
+
CSV:
|
9
|
+
backup_count: 5
|
10
|
+
|
11
|
+
#profiling: profile.txt
|
12
|
+
# duration: 30
|
13
|
+
|
14
|
+
Webrick:
|
15
|
+
# port: 3302
|
16
|
+
|
17
|
+
Views:
|
18
|
+
# CourseTabs:
|
19
|
+
# order: 0
|
data/lib/africompta.rb
CHANGED
@@ -1,2 +1,8 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
require '
|
2
|
+
require 'qooxview'
|
3
|
+
require 'africompta/acaccess'
|
4
|
+
require 'africompta/acqooxview'
|
5
|
+
|
6
|
+
AFRICOMPTA_DIR = File.join(File.dirname(__FILE__), 'africompta')
|
7
|
+
QooxView.load_dirs(%w(entities views).collect { |d|
|
8
|
+
File.join(AFRICOMPTA_DIR, d) })
|
data/lib/africompta/acaccess.rb
CHANGED
@@ -64,30 +64,6 @@ class ACaccess < RPCQooxdooPath
|
|
64
64
|
ret
|
65
65
|
end
|
66
66
|
|
67
|
-
def self.accounts_fetch_old(user)
|
68
|
-
ret = ''
|
69
|
-
|
70
|
-
Accounts.matches_by_account_id(0).to_a.concat(
|
71
|
-
Accounts.matches_by_account_id(nil)).sort { |a, b|
|
72
|
-
a.global_id <=> b.global_id }.each { |a|
|
73
|
-
dputs(2) { "Found one root-account #{a.rev_index} - #{a.path_id}" }
|
74
|
-
if a.global_id
|
75
|
-
dputs(3) { "It's global" }
|
76
|
-
a.get_tree { |acc|
|
77
|
-
dputs(4) { "In get_tree #{acc.path_id}: #{acc.deleted == true} - #{acc.rev_index}" }
|
78
|
-
if acc.rev_index > user.account_index
|
79
|
-
dputs(4) { "Found account #{acc.name} with index #{acc.rev_index}" }
|
80
|
-
ret += "#{acc.to_s}\n"
|
81
|
-
end
|
82
|
-
}
|
83
|
-
else
|
84
|
-
dputs(3) { "It's not global" }
|
85
|
-
end
|
86
|
-
dputs(3) { 'Will search for next' }
|
87
|
-
}
|
88
|
-
ret
|
89
|
-
end
|
90
|
-
|
91
67
|
def self.accounts_fetch(user)
|
92
68
|
Accounts.data.select { |_k, v| v._rev_index > user.account_index }.
|
93
69
|
collect { |k, _v| Accounts.get_data_instance(k) }.
|
@@ -100,9 +76,9 @@ class ACaccess < RPCQooxdooPath
|
|
100
76
|
# Two cases:
|
101
77
|
# path/arg/user,pass - arg is used
|
102
78
|
# path/user,pass - arg is nil
|
103
|
-
path, arg, id = p.split(
|
79
|
+
path, arg, id = p.split('/')
|
104
80
|
arg, id = id, arg if not id
|
105
|
-
user, pass = id.split(
|
81
|
+
user, pass = id.split(',')
|
106
82
|
|
107
83
|
log_msg 'ACaccess.get', "get-merge-path #{path} - #{arg} with " +
|
108
84
|
"user #{user} and pass #{pass}"
|
@@ -120,52 +96,55 @@ class ACaccess < RPCQooxdooPath
|
|
120
96
|
ret = ''
|
121
97
|
dputs(2) { "user index is: #{u.account_index}" }
|
122
98
|
# Returns only one account
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
99
|
+
case $1
|
100
|
+
when '_one'
|
101
|
+
return Accounts.match_by_global_id(arg).to_s
|
102
|
+
when '_all'
|
103
|
+
dputs(2) { 'Putting all accounts' }
|
104
|
+
ret = Accounts.search_all.collect { |acc|
|
105
|
+
dputs(4) { "Found account #{acc.name} with index #{acc.rev_index}" }
|
106
|
+
acc.to_s(true)
|
107
|
+
}.join("\n")
|
108
|
+
when '_count'
|
109
|
+
ret += Accounts.search_all.size.to_s
|
110
|
+
when '_part'
|
111
|
+
acc_start, acc_end = arg.split(',')
|
112
|
+
dputs(2) { "Putting accounts #{acc_start}..#{acc_end}" }
|
113
|
+
Accounts.search_all.select { |acc|
|
114
|
+
acc.rev_index >= acc_start.to_i and acc.rev_index <= acc_end.to_i
|
115
|
+
}.each { |acc|
|
116
|
+
dputs(4) { "Found account #{acc.name} with index #{acc.rev_index}" }
|
117
|
+
ret += "#{acc.to_s(true)}\n"
|
118
|
+
}
|
119
|
+
else
|
120
|
+
dputs(2) { 'Starting to search accounts' }
|
121
|
+
t = Time.now
|
122
|
+
ret += ACaccess.accounts_fetch(u)
|
123
|
+
dputs(2) { "Found #{ret.count("\n")} after #{Time.now - t} seconds" }
|
148
124
|
end
|
149
125
|
dputs(3) { 'Finished search' }
|
150
126
|
return ret
|
151
|
-
|
152
127
|
# Gets all movements (for the accounts of that user)
|
153
128
|
when /movements_get(.*)/
|
154
129
|
dputs(2) { "movements_get#{$1} with #{arg.inspect}" }
|
155
130
|
start, stop = u.movement_index + 1, u_local.movement_index - 1
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
131
|
+
ret = case $1
|
132
|
+
when '_one'
|
133
|
+
# Returns only one account
|
134
|
+
Movements.match_by_global_id(arg).to_s
|
135
|
+
when '_all_actual'
|
136
|
+
start, stop = arg.split(/,/)
|
137
|
+
print_movements_actual(start, stop)
|
138
|
+
when '_all'
|
139
|
+
Movements.search_all.collect { |m|
|
140
|
+
m.to_s
|
141
|
+
}.join("\n")
|
142
|
+
when '_range'
|
143
|
+
start, stop = arg.split(/,/)
|
144
|
+
print_movements(start, stop)
|
145
|
+
else
|
146
|
+
print_movements(start, stop)
|
147
|
+
end
|
169
148
|
dputs(2) { "Sending a total of #{ret.length}" }
|
170
149
|
dputs(3) { "Sending:\n #{ret.inspect}" }
|
171
150
|
return ret
|
@@ -174,7 +153,7 @@ class ACaccess < RPCQooxdooPath
|
|
174
153
|
return $VERSION.to_s
|
175
154
|
|
176
155
|
when 'index'
|
177
|
-
return [u_local.account_index, u_local.movement_index].join(
|
156
|
+
return [u_local.account_index, u_local.movement_index].join(',')
|
178
157
|
|
179
158
|
when 'local_id'
|
180
159
|
return u_local.full
|
@@ -196,11 +175,17 @@ class ACaccess < RPCQooxdooPath
|
|
196
175
|
mov.delete
|
197
176
|
end
|
198
177
|
dputs(3) { 'Finished deleting' }
|
178
|
+
|
179
|
+
when 'get_db'
|
180
|
+
Entities.save_all
|
181
|
+
return IO.read(Accounts.storage[:SQLiteAC].db_file)
|
199
182
|
end
|
183
|
+
|
200
184
|
return ''
|
201
185
|
end
|
202
186
|
|
203
187
|
def self.post(path, input)
|
188
|
+
#dputs_func
|
204
189
|
dputs(5) { "self.post with #{path} and #{input.inspect}" }
|
205
190
|
log_msg 'ACaccess.post', "post-merge-path #{path} with " +
|
206
191
|
"user #{input['user']} and pass #{input['pass']}"
|
@@ -231,7 +216,7 @@ class ACaccess < RPCQooxdooPath
|
|
231
216
|
else
|
232
217
|
dputs(0) { "Error: couldn't create movement from #{m.inspect}" }
|
233
218
|
end
|
234
|
-
u.update_movement_index
|
219
|
+
u.update_movement_index unless input._debug
|
235
220
|
}
|
236
221
|
end
|
237
222
|
when 'movement_delete'
|
@@ -244,7 +229,7 @@ class ACaccess < RPCQooxdooPath
|
|
244
229
|
when 'account_put'
|
245
230
|
dputs(3) { "Going to put account #{input['account'].inspect}" }
|
246
231
|
acc = Accounts.from_s(input['account'])
|
247
|
-
u.update_account_index
|
232
|
+
u.update_account_index unless input._debug
|
248
233
|
dputs(2) { "Saved account #{acc.global_id}" }
|
249
234
|
when 'account_delete'
|
250
235
|
dputs(3) { 'Going to delete account' }
|
@@ -253,5 +238,6 @@ class ACaccess < RPCQooxdooPath
|
|
253
238
|
end
|
254
239
|
return 'ok'
|
255
240
|
end
|
241
|
+
|
256
242
|
end
|
257
243
|
|