line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################## |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (C) 2022 Res Binaria Di Paolo Capaldo () |
4
|
|
|
|
|
|
|
# All Rights Reserved |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
7
|
|
|
|
|
|
|
# it under the terms of the GNU Affero General Public License as published |
8
|
|
|
|
|
|
|
# by the Free Software Foundation, either version 3 of the License, or |
9
|
|
|
|
|
|
|
# (at your option) any later version. |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
12
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
|
|
|
|
# GNU Affero General Public License for more details. |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# You should have received a copy of the GNU Affero General Public License |
17
|
|
|
|
|
|
|
# along with this program. If not, see . |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
############################################################################## |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package CBI::Wrapper; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
669
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
24
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
374
|
use CBI::Wrapper::RIBA; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
29
|
1
|
|
|
1
|
|
6
|
use CBI::Wrapper::Flow; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
402
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
32
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
33
|
0
|
|
|
|
|
|
my $args = shift; |
34
|
|
|
|
|
|
|
my $self = { |
35
|
|
|
|
|
|
|
_header => $args->{header}, |
36
|
|
|
|
|
|
|
_disposals => $args->{disposals}, |
37
|
0
|
|
|
|
|
|
_flow_CBI => {}, |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
bless $self, $class; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Getters and Setters. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub set_header { |
48
|
0
|
|
|
0
|
1
|
|
my ($self, $header) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
$self->{_header} = $header; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub get_header { |
54
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $self->{_header}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub set_disposals { |
60
|
0
|
|
|
0
|
1
|
|
my ($self, $disposals) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->{_disposals} = $disposals; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_disposals { |
66
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self->{_disposals}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub set_flow_CBI { |
72
|
0
|
|
|
0
|
1
|
|
my ($self, $flow_CBI) = @_; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
$self->{_flow_CBI} = $flow_CBI; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub get_flow_CBI { |
78
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $self->{_flow_CBI}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub append_disposal { |
84
|
0
|
|
|
0
|
1
|
|
my ($self, $disposal) = @_; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $disposals = $self->get_disposals(); |
87
|
0
|
|
|
|
|
|
push(@$disposals, $disposal); |
88
|
0
|
|
|
|
|
|
$self->set_disposals($disposals); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Create a flow with header, disposals and footer. |
92
|
|
|
|
|
|
|
sub create_flow { |
93
|
0
|
|
|
0
|
1
|
|
my ($self, $args) = @_; |
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
my $header = defined $args->{header} ? $args->{header} : $self->get_header(); |
96
|
0
|
0
|
|
|
|
|
my $disposals = defined $args->{disposals} ? $args->{disposals} : $self->get_disposals(); |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
return 0 unless (defined $header and defined $disposals); |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
my $flow_type = defined $args->{flow_type} ? $args->{flow_type} : ''; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $flow_CBI; |
103
|
|
|
|
|
|
|
|
104
|
0
|
0
|
|
|
|
|
if ($flow_type eq 'RICEVUTE_BANCARIE') { |
105
|
0
|
|
|
|
|
|
$flow_CBI = &CBI::Wrapper::RIBA::create_RIBA( |
106
|
|
|
|
|
|
|
{ |
107
|
|
|
|
|
|
|
header => $header, |
108
|
|
|
|
|
|
|
disposals => $disposals, |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
$self->set_flow_CBI($flow_CBI); |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return 1; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# Write CBI flow on file. |
119
|
|
|
|
|
|
|
sub print { |
120
|
0
|
|
|
0
|
1
|
|
my ($self, $filename) = @_; |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
|
|
|
return 0 unless defined $filename; |
123
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my $flow_CBI = $self->get_flow_CBI(); |
125
|
0
|
|
|
|
|
|
$flow_CBI->write_file($filename); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Load CBI flow from file. |
129
|
|
|
|
|
|
|
sub load { |
130
|
0
|
|
|
0
|
1
|
|
my ($self, $filename) = @_; |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
my $flow_CBI = new CBI::Wrapper::Flow(); |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$flow_CBI->read_file($filename); |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$self->set_flow_CBI($flow_CBI); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
1; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
__END__ |