Doku: Update nach Auth-Erweiterung auf multiple Module
[kivitendo-erp.git] / SL / Controller / YearEndTransactions.pm
index 4a9f06c..5228038 100644 (file)
@@ -15,6 +15,8 @@ use SL::DB::GLTransaction;
 use SL::DB::AccTransaction;
 use SL::DB::Helper::AccountingPeriod qw(get_balance_starting_date);
 
+use SL::Presenter::Tag qw(checkbox_tag);
+
 use Rose::Object::MakeMethods::Generic (
   'scalar --get_set_init' => [ qw(charts charts9000 cbob_chart cb_date cb_startdate ob_date cb_reference ob_reference cb_description ob_description) ],
 );
@@ -56,17 +58,19 @@ sub action_list {
   );
 
   $self->setup_list_action_bar;
-  $report->generate_with_headers(action_bar => 1);
+  $report->generate_with_headers();
   $main::lxdebug->leave_sub();
 }
 
 sub action_generate {
   my ($self) = @_;
 
-  my $cnt = $self->make_booking();
-
-  flash('info', $::locale->text('#1 CB transactions and #1 OB transactions generated.',$cnt)) if $cnt > 0;
-
+  if ($self->cb_date > $self->ob_date) {
+    flash ('error', $::locale->text('CB date #1 is higher than OB date #2. Please select again.', $self->cb_date, $self->ob_date));
+  } else {
+    my $cnt = $self->make_booking();
+    flash('info', $::locale->text('#1 CB transactions and #1 OB transactions generated.',$cnt)) if $cnt > 0;
+  }
   $self->action_list;
 }
 
@@ -110,7 +114,7 @@ sub prepare_report {
   my $idx = 1;
 
   my %column_defs = (
-    'ids'         => { raw_header_data => $self->presenter->checkbox_tag("", id => "check_all",
+    'ids'         => { raw_header_data => checkbox_tag("", id => "check_all",
                                                                           checkall => "[data-checkall=1]"), 'align' => 'center' },
     'chart'       => { text => $::locale->text('Account'), },
     'description' => { text => $::locale->text('Description'), },
@@ -152,7 +156,7 @@ sub prepare_report {
       my $chart_id = $chart->id;
       my $row = { map { $_ => { 'data' => '' } } @columns };
       $row->{ids}  = {
-        'raw_data' => $self->presenter->checkbox_tag("multi_id_${idx}", value => $chart_id, "data-checkall" => 1),
+        'raw_data' => checkbox_tag("multi_id_${idx}", value => $chart_id, "data-checkall" => 1),
         'valign'   => 'center',
         'align'    => 'center',
       };