From c904f865b0f9d1da094f2ca5198796829277d8e4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 12 Jun 2013 11:55:51 +0200 Subject: [PATCH] =?utf8?q?SL/Printer.pm=20wird=20nicht=20mehr=20ben=C3=B6t?= =?utf8?q?igt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Printer.pm | 91 ----------------------------------------------- bin/mozilla/am.pl | 4 +-- 2 files changed, 2 insertions(+), 93 deletions(-) delete mode 100644 SL/Printer.pm diff --git a/SL/Printer.pm b/SL/Printer.pm deleted file mode 100644 index 5ed072d81..000000000 --- a/SL/Printer.pm +++ /dev/null @@ -1,91 +0,0 @@ -package SL::Printer; - -use strict; - -use SL::DBUtils; - -sub all_printers { - $::lxdebug->enter_sub; - - my ($self, %params) = @_; - - my $dbh = $::auth->get_user_dbh($params{login}); - - my $query = qq|SELECT * FROM printers ORDER BY printer_description|; - my @printers = selectall_hashref_query($::form, $dbh, $query); - - $dbh->disconnect; - - $::lxdebug->leave_sub; - - return wantarray ? @printers : \@printers; -} - -sub get_printer { - $::lxdebug->enter_sub; - - my ($self, %params) = @_; - - my $dbh = $::auth->get_user_dbh($params{login}); - - my $query = qq|SELECT * FROM printers WHERE id = ?|; - my ($printer) = selectfirst_hashref_query($::form, $dbh, $query, $params{id}); - - $dbh->disconnect; - - $::lxdebug->leave_sub; - - return $printer; -} - -sub save_printer { - $main::lxdebug->enter_sub(); - - my ($self, %params) = @_; - - # connect to database - my $dbh = $::auth->get_user_dbh($params{login}); - my $printer = $params{printer}; - - unless ($printer->{id}) { - ($printer->{id}) = selectfirst_array_query($::form, $dbh, "SELECT nextval('id'::text)"); - do_query($::form, $dbh, "INSERT INTO printers (id, printer_description) VALUES (?, '')", $printer->{id}); - } - - my $query = <{printer_description}, - $printer->{template_code}, - $printer->{printer_command}, - $printer->{id}, - ); - - $dbh->commit; - $dbh->disconnect; - - $::lxdebug->leave_sub; -} - -sub delete_printer { - $::lxdebug->enter_sub; - - my ($self, %params) = @_; - - my $dbh = $::auth->get_user_dbh($params{login}); - - my $query = qq|DELETE FROM printers WHERE id = ?|; - do_query($::form, $dbh, $query, $params{id}); - - $dbh->commit; - $dbh->disconnect; - - $::lxdebug->leave_sub; -} - -1; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index ebe7ed187..e5be21ecc 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -42,7 +42,7 @@ use SL::User; use SL::USTVA; use SL::Iconv; use SL::TODO; -use SL::Printer; +use SL::DB::Printer; use CGI; require "bin/mozilla/common.pl"; @@ -1059,7 +1059,7 @@ sub config { { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, }, ]; - $form->{PRINTERS} = [ SL::Printer->all_printers(%::myconfig) ]; + $form->{PRINTERS} = SL::DB::Manager::Printer->get_all_sorted; my %countrycodes = User->country_codes; -- 2.20.1