X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Facctranscorrections.pl;h=c0e325e4f41073b0d0d45b3d9ec0b0c6469b45eb;hb=484b8c43b1c76221908cf43ee4b25f2e3ab8ed4e;hp=78d21b08b270ab9303c9cbf39e314c21f65a1621;hpb=eb0c10b0a09da8ff4590c3043a9fa6dd10775ee4;p=kivitendo-erp.git diff --git a/bin/mozilla/acctranscorrections.pl b/bin/mozilla/acctranscorrections.pl index 78d21b08b..c0e325e4f 100644 --- a/bin/mozilla/acctranscorrections.pl +++ b/bin/mozilla/acctranscorrections.pl @@ -1,24 +1,34 @@ use SL::AccTransCorrections; use SL::Form; +use SL::Locale::String qw(t8); use SL::User; use Data::Dumper; use YAML; require "bin/mozilla/common.pl"; +use strict; + sub analyze_filter { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; + + setup_analyze_filter_action_bar(); - $form->{jsscript} = 1; $form->{title} = $locale->text('General ledger corrections'); $form->header(); print $form->parse_html_template('acctranscorrections/analyze_filter'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub analyze { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{title} = $locale->text('General ledger corrections'); @@ -36,21 +46,26 @@ sub analyze { if (!scalar @problems) { $form->show_generic_information($locale->text('No problems were recognized.')); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return; } + setup_analyze_action_bar(); + $form->header(); print $form->parse_html_template('acctranscorrections/analyze_overview', { 'PROBLEMS' => \@problems, 'callback' => $callback, }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub assistant { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{title} = $locale->text('Assistant for general ledger corrections'); @@ -68,7 +83,7 @@ sub assistant { $form->show_generic_information($locale->text('The assistant could not find anything wrong with #1. Maybe the problem has been solved in the meantime.', "$module $form->{trans_reference}")); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); return; } @@ -83,22 +98,28 @@ sub assistant { $form->show_generic_error($locale->text('Unknown problem type.')); } - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub assistant_for_ap_ar_wrong_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{title} = $locale->text('Assistant for general ledger corrections'); $form->header(); print $form->parse_html_template('acctranscorrections/assistant_for_ap_ar_wrong_taxkeys'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub fix_ap_ar_wrong_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; my $analyzer = AccTransCorrections->new(); $analyzer->fix_ap_ar_wrong_taxkeys(); @@ -107,22 +128,28 @@ sub fix_ap_ar_wrong_taxkeys { $form->header(); print $form->parse_html_template('acctranscorrections/fix_ap_ar_wrong_taxkeys'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub assistant_for_invoice_inventory_with_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{title} = $locale->text('Assistant for general ledger corrections'); $form->header(); print $form->parse_html_template('acctranscorrections/assistant_for_invoice_inventory_with_taxkeys'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub fix_invoice_inventory_with_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; my $analyzer = AccTransCorrections->new(); $analyzer->fix_invoice_inventory_with_taxkeys(); @@ -131,11 +158,14 @@ sub fix_invoice_inventory_with_taxkeys { $form->header(); print $form->parse_html_template('acctranscorrections/fix_invoice_inventory_with_taxkeys'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub assistant_for_wrong_taxes { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; my $problem = shift; @@ -144,11 +174,14 @@ sub assistant_for_wrong_taxes { $form->header(); print $form->parse_html_template('acctranscorrections/assistant_for_wrong_taxes', { 'problem' => $problem, }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub assistant_for_wrong_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; my $problem = shift; @@ -157,11 +190,14 @@ sub assistant_for_wrong_taxkeys { $form->header(); print $form->parse_html_template('acctranscorrections/assistant_for_wrong_taxkeys', { 'problem' => $problem, }); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub fix_wrong_taxkeys { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; my $fixes = ref $form->{fixes} eq 'ARRAY' ? $form->{fixes} : []; @@ -172,11 +208,14 @@ sub fix_wrong_taxkeys { $form->header(); print $form->parse_html_template('acctranscorrections/fix_wrong_taxkeys'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub delete_transaction { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my $locale = $main::locale; $form->{title} = $locale->text('Delete transaction'); $form->header(); @@ -190,18 +229,23 @@ sub delete_transaction { print $form->parse_html_template('acctranscorrections/delete_transaction'); } - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub redirect { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; $form->redirect('Missing callbcak'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub dispatcher { + my $form = $main::form; + my $locale = $main::locale; + foreach my $action (qw(fix_wrong_taxkeys delete_transaction)) { if ($form->{"action_${action}"}) { call_sub($action); @@ -212,4 +256,31 @@ sub dispatcher { $form->error($locale->text('No action defined.')); } +sub setup_analyze_filter_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Analyze'), + submit => [ '#form' ], + accesskey => 'enter', + ], + ); + } +} + +sub setup_analyze_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Back'), + call => [ 'kivi.history_back' ], + ], + ); + } +} + 1;