+++ /dev/null
-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 = <<SQL;
- UPDATE printers SET
- printer_description = ?,
- template_code = ?,
- printer_command = ?
- WHERE id = ?
-SQL
- do_query($::form, $dbh, $query,
- $printer->{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;
use SL::USTVA;
use SL::Iconv;
use SL::TODO;
-use SL::Printer;
+use SL::DB::Printer;
use CGI;
require "bin/mozilla/common.pl";
{ '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;