X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=ecf4f2b3724f2d72cb551dd6eefbd06a5cf3da1e;hb=ce498a747292baeaf103118b5073061196d981e4;hp=a1e227fa8a03f02772b4c4a8a2204a415cdbc58f;hpb=8fc97420c6fc30107eb9df4c17459cc552a159c9;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index a1e227fa8..ecf4f2b37 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -39,6 +39,7 @@ use SL::User; use SL::USTVA; use SL::Iconv; use SL::TODO; +use SL::Printer; use CGI::Ajax; use CGI; @@ -2014,234 +2015,6 @@ sub swap_buchungsgruppen { $main::lxdebug->leave_sub(); } - -sub add_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_printer" unless $form->{callback}; - - &printer_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_printer(\%myconfig, \%$form); - - &printer_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->printer(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_printer"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Printer'); - - my @column_index = qw(printer_description printer_command template_code); - my %column_header; - $column_header{printer_description} = - qq|| - . $locale->text('Printer Description') - . qq||; - $column_header{printer_command} = - qq|| - . $locale->text('Printer Command') - . qq||; - $column_header{template_code} = - qq|| - . $locale->text('Template Code') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{printer_description} = qq||; - $column_data{printer_command} = qq||; - $column_data{template_code} = - qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$ref->{printer_description}$ref->{printer_command}$ref->{template_code}
-

- -
-
- - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub printer_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Printer"); - - # $locale->text('Add Printer') - # $locale->text('Edit Printer') - - $form->{printer_description} =~ s/\"/"/g; - $form->{template_code} =~ s/\"/"/g; - $form->{printer_command} =~ s/\"/"/g; - - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Printer') . qq|
| . $locale->text('Printer Command') . qq|
| . $locale->text('Template Code') . qq|

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("printer_description", $locale->text('Description missing!')); - $form->isblank("printer_command", $locale->text('Printer Command missing!')); - AM->save_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer deleted!')); - - $main::lxdebug->leave_sub(); -} - sub add_payment { $main::lxdebug->enter_sub(); @@ -2722,10 +2495,8 @@ sub config { { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, }, ]; - AM->printer(\%myconfig, $form); - $form->{PRINTERS} = []; - foreach my $printer (@{$form->{"ALL"}}) { + foreach my $printer (SL::Printer->all_printers(%::myconfig)) { push @{ $form->{PRINTERS} }, { 'name' => $printer->{printer_description}, 'value' => $printer->{id}, @@ -3545,7 +3316,7 @@ sub delete_warehouse { $form->header(); print $form->parse_html_template('am/confirm_delete_warehouse'); - exit 0; + ::end_of_request(); } if (AM->delete_warehouse(\%myconfig, $form)) {