Revision bdd97244
Von Kivitendo Admin vor fast 9 Jahren hinzugefügt
SL/AM.pm | ||
---|---|---|
181 | 181 |
$form->{orphaned} = $chart_obj->has_transaction ? 0 : 1; |
182 | 182 |
|
183 | 183 |
# check if new account is active |
184 |
$form->{new_chart_valid} = 0; |
|
185 |
if ($form->{new_chart_id}) { |
|
186 |
$query = qq|SELECT current_date-valid_from FROM chart |
|
187 |
WHERE id = ?|; |
|
188 |
$main::lxdebug->message(LXDebug->QUERY(), "\$query=\n $query"); |
|
189 |
my ($count) = selectrow_query($form, $dbh, $query, $form->{id}); |
|
190 |
if ($count >=0) { |
|
191 |
$form->{new_chart_valid} = 1; |
|
192 |
} |
|
193 |
$sth->finish; |
|
194 |
} |
|
184 |
# The old sql query was broken since at least 2006 and always returned 0 |
|
185 |
$form->{new_chart_valid} = $chart_obj->new_chart_valid; |
|
195 | 186 |
|
196 | 187 |
$dbh->disconnect; |
197 | 188 |
|
SL/DB/Chart.pm | ||
---|---|---|
87 | 87 |
$self->db->dbh->selectrow_array('select exists(select 1 from acc_trans where chart_id = ?)', {}, $self->id); |
88 | 88 |
} |
89 | 89 |
|
90 |
sub new_chart_valid { |
|
91 |
my ($self) = @_; |
|
92 |
|
|
93 |
if ( $self->valid_from && DateTime->today >= $self->valid_from ) { |
|
94 |
return 1; |
|
95 |
} else { |
|
96 |
return 0; |
|
97 |
}; |
|
98 |
} |
|
99 |
|
|
90 | 100 |
sub displayable_name { |
91 | 101 |
my ($self) = @_; |
92 | 102 |
|
... | ... | |
170 | 180 |
Returns the date of the last transaction of the chart in the database, which |
171 | 181 |
may lie in the future. |
172 | 182 |
|
183 |
=item C<new_chart_valid> |
|
184 |
|
|
185 |
Checks whether a follow-up chart is configured, and returns 1 or 0 depending on |
|
186 |
whether the valid_from date is before or after the current date. |
|
187 |
Is this even used anywhere? |
|
188 |
|
|
173 | 189 |
=back |
174 | 190 |
|
175 | 191 |
=head1 BUGS |
Auch abrufbar als: Unified diff
Neue Chart Methode new_chart_valid
die prüft, ob es für das Konto ein Folgekonto gibt, und ob das aktuelle
Tagesdatum >= dem Folgedatum ist, d.h. ob eigentlich das Folgekonto
benutzt werden soll. Diese Abfrage war bisher allerdings kaputt und wird
wahrscheinlich auch nirgends sinnvoll genutzt.