X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/b96aeec0aa41e81c1fce82ba095486b05d601b31..8651e0271eb23ad16c4b19bb785284e99d9aac08:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 5a3b74223..ec27fbbd4 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -42,6 +42,7 @@ use SL::Form; use SL::User; use SL::USTVA; use SL::Iconv; +use SL::Locale::String qw(t8); use SL::TODO; use SL::DB::Printer; use SL::DB::Tax; @@ -614,207 +615,6 @@ sub delete_account { $main::lxdebug->leave_sub(); } -sub add_lead { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_lead" unless $form->{callback}; - - &lead_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_lead { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_lead(\%myconfig, \%$form); - - &lead_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_lead { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - AM->lead(\%::myconfig, $::form); - - $::form->{callback} = "am.pl?action=list_lead"; - $::form->{title} = $::locale->text('Lead'); - - $::form->header; - print $::form->parse_html_template('am/lead_list'); - - $::lxdebug->leave_sub; -} - -sub lead_header { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - # $locale->text('Add Lead') - # $locale->text('Edit Lead') - $::form->{title} = $::locale->text("$::form->{title} Lead"); - - $::form->header; - print $::form->parse_html_template('am/lead_header'); - - $::lxdebug->leave_sub; -} - -sub save_lead { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - AM->save_lead(\%myconfig, \%$form); - $form->redirect($locale->text('lead saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_lead { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_lead(\%myconfig, \%$form); - $form->redirect($locale->text('lead deleted!')); - - $main::lxdebug->leave_sub(); -} - -sub add_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_language" unless $form->{callback}; - - &language_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_language(\%myconfig, \%$form); - - &language_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_language { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - AM->language(\%::myconfig, $::form); - - $::form->{callback} = "am.pl?action=list_language"; - $::form->{title} = $::locale->text('Languages'); - - $::form->header; - - print $::form->parse_html_template('am/language_list'); - - $::lxdebug->leave_sub; -} - -sub language_header { - $::lxdebug->enter_sub; - $::auth->assert('config'); - - # $locale->text('Add Language') - # $locale->text('Edit Language') - $::form->{title} = $::locale->text("$::form->{title} Language"); - - $::form->header; - - print $::form->parse_html_template('am/language_header', { - numberformats => [ '1,000.00', '1000.00', '1.000,00', '1000,00', "1'000.00" ], - dateformats => [ qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd) ], - }); - - $::lxdebug->leave_sub; -} - -sub save_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Language missing!')); - $form->isblank("template_code", $locale->text('Template Code missing!')); - $form->isblank("article_code", $locale->text('Article Code missing!')); - AM->save_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language deleted!')); - - $main::lxdebug->leave_sub(); -} - sub _build_cfg_options { my $form = $main::form; my %myconfig = %main::myconfig; @@ -914,6 +714,8 @@ sub config { $form->{title} = $locale->text('Edit Preferences for #1', $::myconfig{login}); + setup_am_config_action_bar(); + $form->header(); $form->{full_signature} = $form->create_email_signature(); @@ -1451,111 +1253,6 @@ sub delete_tax { $main::lxdebug->leave_sub(); } -sub add_price_factor { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text('Add Price Factor'); - $form->{callback} ||= build_std_url('action=add_price_factor'); - - $form->header(); - print $form->parse_html_template('am/edit_price_factor'); - - $main::lxdebug->leave_sub(); -} - -sub edit_price_factor { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text('Edit Price Factor'); - $form->{callback} ||= build_std_url('action=add_price_factor'); - - AM->get_price_factor(\%myconfig, $form); - - $form->{factor} = $form->format_amount(\%myconfig, $form->{factor} * 1); - - $form->header(); - print $form->parse_html_template('am/edit_price_factor'); - - $main::lxdebug->leave_sub(); -} - -sub list_price_factors { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->get_all_price_factors(\%myconfig, \%$form); - - foreach my $current (@{ $form->{PRICE_FACTORS} }) { - $current->{factor} = $form->format_amount(\%myconfig, $current->{factor} * 1); - } - - $form->{callback} = build_std_url('action=list_price_factors'); - $form->{title} = $locale->text('Price Factors'); - $form->{url_base} = build_std_url('callback'); - - $form->header(); - print $form->parse_html_template('am/list_price_factors'); - - $main::lxdebug->leave_sub(); -} - -sub save_price_factor { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - $form->isblank("factor", $locale->text('Factor missing!')); - - $form->{factor} = $form->parse_amount(\%myconfig, $form->{factor}); - - AM->save_price_factor(\%myconfig, $form); - - $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor saved!')) if ($form->{callback}); - - $form->redirect($locale->text('Price factor saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_price_factor { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_price_factor(\%myconfig, \%$form); - - $form->{callback} .= '&MESSAGE=' . $form->escape($locale->text('Price factor deleted!')) if ($form->{callback}); - - $form->redirect($locale->text('Price factor deleted!')); - - $main::lxdebug->leave_sub(); -} - sub add_warehouse { $main::lxdebug->enter_sub(); @@ -1683,3 +1380,17 @@ sub save_bin { $main::lxdebug->leave_sub(); } + +sub setup_am_config_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => "save_preferences" } ], + accesskey => 'enter', + ], + ); + } +}