From 9b86077aaea9b12ba750a04f7054fd4c1ab180aa Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Sun, 16 Sep 2018 23:25:37 +0200 Subject: [PATCH] Bug 17845: Remove unused code related to printers There is some quite old and unused code in Koha related to printer configuration and network printing. These code hasn't been functional in a long time and should be removed. This patch: - Removes printcirculationslips system preference - Removes table printers - Removes branchprinter column from branches Check that: - Go to administration - Open any age there, but change the last bit to: printers.pl - Apply patch, run the database update - Verify the hidden page no longer exists - Verify that logging in and out still works correctly - Verify that checkout and returns work correctly - Switch to another branch using the "Set library" option Signed-off-by: Owen Leonard Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- C4/Auth.pm | 37 ++-- C4/Context.pm | 5 +- C4/InstallAuth.pm | 3 +- C4/Koha.pm | 40 ---- C4/Print.pm | 103 ----------- admin/printers.pl | 137 -------------- circ/circulation.pl | 19 +- circ/returns.pl | 10 +- circ/selectbranchprinter.pl | 45 ----- .../atomicupdate/bug_17845_remove_printers | 4 + installer/data/mysql/kohastructure.sql | 14 -- .../mysql/ru-RU/optional/example_branches.sql | 18 +- installer/data/mysql/sysprefs.sql | 1 - .../admin/preferences/circulation.pref | 1 - .../prog/en/modules/admin/printers.tt | 173 ------------------ .../en/modules/circ/selectbranchprinter.tt | 15 -- t/Print.t | 15 -- 17 files changed, 36 insertions(+), 604 deletions(-) delete mode 100644 C4/Print.pm delete mode 100755 admin/printers.pl create mode 100644 installer/data/mysql/atomicupdate/bug_17845_remove_printers delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt delete mode 100755 t/Print.t diff --git a/C4/Auth.pm b/C4/Auth.pm index bf35b006c7..d3fc43f6b6 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -848,7 +848,7 @@ sub checkauth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter'), + $session->param('emailaddress'), $session->param('shibboleth') ); C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') ); @@ -1069,14 +1069,12 @@ sub checkauth { C4::Context->_unset_userenv($sessionID); } my ( $borrowernumber, $firstname, $surname, $userflags, - $branchcode, $branchname, $branchprinter, $emailaddress ); + $branchcode, $branchname, $emailaddress ); if ( $return == 1 ) { my $select = " SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode, - branches.branchname as branchname, - branches.branchprinter as branchprinter, - email + branches.branchname as branchname, email FROM borrowers LEFT JOIN branches on borrowers.branchcode=branches.branchcode "; @@ -1097,7 +1095,7 @@ sub checkauth { } if ( $sth->rows ) { ( $borrowernumber, $firstname, $surname, $userflags, - $branchcode, $branchname, $branchprinter, $emailaddress ) = $sth->fetchrow; + $branchcode, $branchname, $emailaddress ) = $sth->fetchrow; $debug and print STDERR "AUTH_3 results: " . "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; } else { @@ -1139,8 +1137,7 @@ sub checkauth { if ( $domain && $ip =~ /^$domain/ ) { $branchcode = $branches->{$br}->{'branchcode'}; - # new op dev : add the branchprinter and branchname in the cookie - $branchprinter = $branches->{$br}->{'branchprinter'}; + # new op dev : add the branchname to the cookie $branchname = $branches->{$br}->{'branchname'}; } } @@ -1165,8 +1162,7 @@ sub checkauth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter'), - $session->param('shibboleth') + $session->param('emailaddress'), $session->param('shibboleth') ); } @@ -1444,7 +1440,7 @@ sub check_api_auth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') + $session->param('emailaddress') ); my $ip = $session->param('ip'); @@ -1532,35 +1528,35 @@ sub check_api_auth { my ( $borrowernumber, $firstname, $surname, $userflags, $branchcode, $branchname, - $branchprinter, $emailaddress + $emailaddress ); my $sth = $dbh->prepare( -"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname,branches.branchprinter as branchprinter, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?" +"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?" ); $sth->execute($userid); ( $borrowernumber, $firstname, $surname, $userflags, $branchcode, $branchname, - $branchprinter, $emailaddress + $emailaddress ) = $sth->fetchrow if ( $sth->rows ); unless ( $sth->rows ) { my $sth = $dbh->prepare( -"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, branches.branchprinter as branchprinter, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?" +"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?" ); $sth->execute($cardnumber); ( $borrowernumber, $firstname, $surname, $userflags, $branchcode, $branchname, - $branchprinter, $emailaddress + $emailaddress ) = $sth->fetchrow if ( $sth->rows ); unless ( $sth->rows ) { $sth->execute($userid); ( $borrowernumber, $firstname, $surname, $userflags, - $branchcode, $branchname, $branchprinter, $emailaddress + $branchcode, $branchname, $emailaddress ) = $sth->fetchrow if ( $sth->rows ); } } @@ -1581,8 +1577,7 @@ sub check_api_auth { if ( $domain && $ip =~ /^$domain/ ) { $branchcode = $branches->{$br}->{'branchcode'}; - # new op dev : add the branchprinter and branchname in the cookie - $branchprinter = $branches->{$br}->{'branchprinter'}; + # new op dev : add the branchname to the cookie $branchname = $branches->{$br}->{'branchname'}; } } @@ -1605,7 +1600,7 @@ sub check_api_auth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') + $session->param('emailaddress') ); return ( "ok", $cookie, $sessionID ); } else { @@ -1693,7 +1688,7 @@ sub check_cookie_auth { $session->param('cardnumber'), $session->param('firstname'), $session->param('surname'), $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') + $session->param('emailaddress') ); my $ip = $session->param('ip'); diff --git a/C4/Context.pm b/C4/Context.pm index 7b10f8f1d0..df4b5dbbc6 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -809,7 +809,7 @@ sub userenv { C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, - $emailaddress, $branchprinter, $shibboleth); + $emailaddress, $shibboleth); Establish a hash of user environment variables. @@ -820,7 +820,7 @@ set_userenv is called in Auth.pm #' sub set_userenv { shift @_; - my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $shibboleth)= + my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth)= map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here @_; my $var=$context->{"activeuser"} || ''; @@ -835,7 +835,6 @@ sub set_userenv { "branchname" => $branchname, "flags" => $userflags, "emailaddress" => $emailaddress, - "branchprinter" => $branchprinter, "shibboleth" => $shibboleth, }; $context->{userenv}->{$var} = $cell; diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm index 86d1241dff..b73794ae99 100644 --- a/C4/InstallAuth.pm +++ b/C4/InstallAuth.pm @@ -259,8 +259,7 @@ sub checkauth { $session->param('branch'), $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), - $session->param('branchprinter') + $session->param('emailaddress') ); $cookie = $query->cookie( -name => 'CGISESSID', diff --git a/C4/Koha.pm b/C4/Koha.pm index 39bfb4fdee..2e51935dae 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -39,7 +39,6 @@ BEGIN { require Exporter; @ISA = qw(Exporter); @EXPORT = qw( - &GetPrinters &GetPrinter &GetItemTypesCategorized &getallthemes &getFacets @@ -276,45 +275,6 @@ sub getImageSets { return \@imagesets; } -=head2 GetPrinters - - $printers = &GetPrinters(); - @queues = keys %$printers; - -Returns information about existing printer queues. - -C<$printers> is a reference-to-hash whose keys are the print queues -defined in the printers table of the Koha database. The values are -references-to-hash, whose keys are the fields in the printers table. - -=cut - -sub GetPrinters { - my %printers; - my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("select * from printers"); - $sth->execute; - while ( my $printer = $sth->fetchrow_hashref ) { - $printers{ $printer->{'printqueue'} } = $printer; - } - return ( \%printers ); -} - -=head2 GetPrinter - - $printer = GetPrinter( $query, $printers ); - -=cut - -sub GetPrinter { - my ( $query, $printers ) = @_; # get printer for this query from printers - my $printer = $query->param('printer'); - my %cookie = $query->cookie('userenv'); - ($printer) || ( $printer = $cookie{'printer'} ) || ( $printer = '' ); - ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] ); - return $printer; -} - =head2 getnbpages Returns the number of pages to display in a pagination bar, given the number diff --git a/C4/Print.pm b/C4/Print.pm deleted file mode 100644 index a5bd3d3381..0000000000 --- a/C4/Print.pm +++ /dev/null @@ -1,103 +0,0 @@ -package C4::Print; - -# Copyright 2000-2002 Katipo Communications -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; -use C4::Context; - -use vars qw(@ISA @EXPORT); - -BEGIN { - require Exporter; - @ISA = qw(Exporter); - @EXPORT = qw(&NetworkPrint); -} - -=head1 NAME - -C4::Print - Koha module dealing with printing - -=head1 SYNOPSIS - - use C4::Print; - -=head1 DESCRIPTION - -The functions in this module handle sending text to a printer. - -=head1 FUNCTIONS - -=head2 NetworkPrint - - &NetworkPrint($text) - -Queue some text for printing on the selected branch printer - -=cut - -sub NetworkPrint { - my ($text) = @_; - -# FIXME - It'd be nifty if this could generate pretty PostScript. - - my $queue = ''; - - # FIXME - If 'queue' is undefined or empty, then presumably it should - # mean "use the default queue", whatever the default is. Presumably - # the default depends on the physical location of the machine. - # FIXME - Perhaps "print to file" should be a supported option. Just - # set the queue to "file" (or " file", if real queues aren't allowed - # to have spaces in them). Or perhaps if $queue eq "" and - # $env->{file} ne "", then that should mean "print to $env->{file}". - - my $fh; - if ( $queue eq "" || $queue eq 'nulllp' ) { - return; - #open( $fh, ">/tmp/kohaiss" ); - } - else { - - # FIXME - This assumes that 'lpr' exists, and works as expected. - # This is a reasonable assumption, but only because every other - # printing package has a wrapper script called 'lpr'. It'd still - # be better to be able to customize this. - open( $fh, "-|", "lpr -P $queue > /dev/null" ) - or die "Couldn't write to queue:$queue!\n"; - } - - # print $queue; - #open (FILE,">/tmp/$file"); - print $fh $text; - print $fh "\r\n" x 7 ; - close $fh; - - #system("lpr /tmp/$file"); -} - -1; -__END__ - -=head1 AUTHOR - -Koha Development Team - -=head1 SEE ALSO - -C4::Circulation::Circ2(3) - -=cut diff --git a/admin/printers.pl b/admin/printers.pl deleted file mode 100755 index 57a9133552..0000000000 --- a/admin/printers.pl +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/perl - -#script to administer the aqbudget table -#written 20/02/2002 by paul.poulain@free.fr -# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html) - -# ALGO : -# this script use an $op to know what to do. -# if $op is empty or none of the above values, -# - the default screen is build (with all records, or filtered datas). -# - the user can clic on add, modify or delete record. -# if $op=add_form -# - if primkey exists, this is a modification,so we read the $primkey record -# - builds the add/modify form -# if $op=add_validate -# - the user has just send datas, so we create/modify the record -# if $op=delete_form -# - we show the record having primkey=$primkey and ask for deletion validation form -# if $op=delete_confirm -# - we delete the record having primkey=$primkey - - -# Copyright 2000-2002 Katipo Communications -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# Koha is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Koha; if not, see . - -use Modern::Perl; -use CGI qw ( -utf8 ); -use C4::Context; -use C4::Output; -use C4::Auth; - -sub StringSearch { - my ($searchstring,$type)=@_; # why bother with $type if we don't use it?! - $searchstring=~ s/\'/\\\'/g; - my @data=split(' ',$searchstring); - my $sth = C4::Context->dbh->prepare(" - SELECT printername,printqueue,printtype from printers - WHERE (printername like ?) order by printername - "); - $sth->execute("$data[0]%"); - my $data=$sth->fetchall_arrayref({}); - return (scalar(@$data),$data); -} - -my $input = new CGI; -my $searchfield=$input->param('searchfield'); -#my $branchcode=$input->param('branchcode'); -my $script_name="/cgi-bin/koha/admin/printers.pl"; - -my $op = $input->param('op'); -$searchfield=~ s/\,//g; - -my ($template, $loggedinuser, $cookie) = get_template_and_user( - { - template_name => "admin/printers.tt", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {parameters => '*'}, - debug => 1, - } -); - -$template->param(searchfield => $searchfield, - script_name => $script_name); - -#start the page and read in includes - -my $dbh = C4::Context->dbh; -################## ADD_FORM ################################## -# called by default. Used to create form to add or modify a record -if ($op eq 'add_form') { - $template->param(add_form => 1); - #---- if primkey exists, it's a modify action, so read values to modify... - my $data; - if ($searchfield) { - my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?"); - $sth->execute($searchfield); - $data=$sth->fetchrow_hashref; - } - - $template->param(printqueue => $data->{'printqueue'}, - printtype => $data->{'printtype'}); - # END $OP eq ADD_FORM -################## ADD_VALIDATE ################################## -# called by add_form, used to insert/modify data in DB -} elsif ($op eq 'add_validate') { - $template->param(add_validate => 1); - if ($input->param('add')){ - my $sth=$dbh->prepare("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)"); - $sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype')); - } else { - my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?"); - $sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername')); - } - # END $OP eq ADD_VALIDATE -################## DELETE_CONFIRM ################################## -# called by default form, used to confirm deletion of data in DB -} elsif ($op eq 'delete_confirm') { - $template->param(delete_confirm => 1); - my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?"); - $sth->execute($searchfield); - my $data=$sth->fetchrow_hashref; - $template->param(printqueue => $data->{'printqueue'}, - printtype => $data->{'printtype'}); - # END $OP eq DELETE_CONFIRM -################## DELETE_CONFIRMED ################################## -# called by delete_confirm, used to effectively confirm deletion of data in DB -} elsif ($op eq 'delete_confirmed') { - $template->param(delete_confirmed => 1); - my $sth=$dbh->prepare("delete from printers where printername=?"); - $sth->execute($searchfield); - # END $OP eq DELETE_CONFIRMED -################## DEFAULT ########################################### -} else { # DEFAULT - $template->param(else => 1); - my ($count,$results)=StringSearch($searchfield,'web'); - $template->param(loop => $results); - -} #---- END $OP eq DEFAULT - -output_html_with_http_headers $input, $cookie, $template->output; - diff --git a/circ/circulation.pl b/circ/circulation.pl index 1572a080e5..19feb305f5 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -30,9 +30,8 @@ use DateTime; use DateTime::Duration; use Scalar::Util qw( looks_like_number ); use C4::Output; -use C4::Print; use C4::Auth qw/:DEFAULT get_session haspermission/; -use C4::Koha; # GetPrinter +use C4::Koha; use C4::Circulation; use C4::Utils::DataTables::Members; use C4::Members; @@ -179,7 +178,6 @@ if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { } my $issueconfirmed = $query->param('issueconfirmed'); my $cancelreserve = $query->param('cancelreserve'); -my $print = $query->param('print') || q{}; my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice my $charges = $query->param('charges') || q{}; @@ -215,11 +213,6 @@ if( $onsite_checkout && !$duedatespec_allow ) { } } -# check and see if we should print -if ( @$barcodes == 0 && $print eq 'maybe' ) { - $print = 'yes'; -} - my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess'); if ( @$barcodes == 0 && $charges eq 'yes' ) { $template->param( @@ -228,16 +221,6 @@ if ( @$barcodes == 0 && $charges eq 'yes' ) { ); } -if ( $print eq 'yes' && $borrowernumber ne '' ) { - if ( C4::Context->boolean_preference('printcirculationslips') ) { - my $letter = IssueSlip($branch, $borrowernumber, "QUICK"); - NetworkPrint($letter->{content}); - } - $query->param( 'borrowernumber', '' ); - $borrowernumber = ''; - undef $patron; -} - # # STEP 2 : FIND BORROWER # if there is a list of find borrowers.... diff --git a/circ/returns.pl b/circ/returns.pl index 3bf7feef1f..65093b9d56 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -35,6 +35,9 @@ use CGI qw ( -utf8 ); use DateTime; use C4::Auth qw/:DEFAULT get_session/; +use C4::Output; +use C4::Circulation; +use C4::Reserves; use C4::Biblio; use C4::Circulation; use C4::Context; @@ -43,7 +46,6 @@ use C4::Koha; # FIXME : is it still useful ? use C4::Members::Messaging; use C4::Members; use C4::Output; -use C4::Print; use C4::Reserves; use C4::RotatingCollections; use Koha::AuthorisedValues; @@ -83,16 +85,11 @@ if ( $query->param('print_slip') ) { ##################### #Global vars -my $printers = GetPrinters(); my $userenv = C4::Context->userenv; my $userenv_branch = $userenv->{'branch'} // ''; -my $printer = $userenv->{'branchprinter'} // ''; my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire'); my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off'); - # -# Some code to handle the error if there is no branch or printer setting..... -# # Set up the item stack .... my %returneditems; @@ -619,7 +616,6 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $template->param( riloop => \@riloop, - printer => $printer, errmsgloop => \@errmsgloop, exemptfine => $exemptfine, dropboxmode => $dropboxmode, diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index 0febd0ffb7..c762876cb0 100755 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -23,13 +23,10 @@ use CGI qw ( -utf8 ); use C4::Context; use C4::Output; use C4::Auth qw/:DEFAULT get_session/; -use C4::Print; # GetPrinters use C4::Koha; use Koha::BiblioFrameworks; use Koha::Libraries; -# this will be the script that chooses branch and printer settings.... - my $query = CGI->new(); my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({ @@ -44,14 +41,8 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({ my $sessionID = $query->cookie("CGISESSID"); my $session = get_session($sessionID); -# try to get the branch and printer settings from http, fallback to userenv -my $printers = GetPrinters(); my $branch = $query->param('branch' ); -my $printer = $query->param('printer'); -# fallbacks for $branch and $printer after possible session updates - my $userenv_branch = C4::Context->userenv->{'branch'} || ''; -my $userenv_printer = C4::Context->userenv->{'branchprinter'} || ''; my @updated; # $session lddines here are doing the updating @@ -72,47 +63,12 @@ if ( $branch and my $library = Koha::Libraries->find($branch) ) { $branch = $userenv_branch; # fallback value } -# FIXME: branchprinter is not retained by session. This feature was not adequately -# ported from Koha 2.2.3 where it had been a separate cookie. -# So this needs to be fixed for Koha 3 or removed outright. -# --atz (w/ info from chris cormack) - -if ($printer) { - if (! $userenv_printer or $userenv_printer ne $printer ) { - $session->param('branchprinter', $printer); # update sesssion in DB - $session->flush(); - $template->param('new_printer', $printer); # update template - push @updated, { - updated_printer => 1, - old_printer => $userenv_printer, - }; - } # else printer is the same, no update -} else { - $printer = $userenv_printer; # fallback value -} - $template->param(updated => \@updated) if (scalar @updated); -my @printkeys = sort keys %$printers; -if (scalar(@printkeys) == 1 or not $printers->{$printer}) { - $printer = $printkeys[0]; # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does -} - -my @printerloop; -foreach ( @printkeys ) { - next unless ($_); # skip printer if blank. - push @printerloop, { - selected => ( $_ eq $printer ), - name => $printers->{$_}->{'printername'}, - value => $_, - }; -} - my @recycle_loop; foreach ($query->param()) { $_ or next; # disclude blanks $_ eq "branch" and next; # disclude branch - $_ eq "printer" and next; # disclude printer $_ eq "oldreferer" and next; # disclude oldreferer push @recycle_loop, { param => $_, @@ -130,7 +86,6 @@ if (scalar @updated and not scalar @recycle_loop) { $template->param( referer => $referer, - printerloop => \@printerloop, branch => $branch, recycle_loop=> \@recycle_loop, ); diff --git a/installer/data/mysql/atomicupdate/bug_17845_remove_printers b/installer/data/mysql/atomicupdate/bug_17845_remove_printers new file mode 100644 index 0000000000..914860be44 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17845_remove_printers @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS printers; +ALTER TABLE branches DROP COLUMN branchprinter; +DELETE FROM systempreferences WHERE variable = "printcirculationslips"; +-- Bug 17845: Drop unused table printers and branchprinter column diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 5cb56ae2fd..0f092725b5 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -266,7 +266,6 @@ CREATE TABLE `branches` ( -- information about your libraries or branches are st `branchurl` LONGTEXT, -- the URL for your library or branch's website `issuing` tinyint(4) default NULL, -- unused in Koha `branchip` varchar(15) default NULL, -- the IP address for your library or branch - `branchprinter` varchar(100) default NULL, -- unused in Koha `branchnotes` LONGTEXT, -- notes related to your library or branch opac_info MEDIUMTEXT, -- HTML that displays in OPAC `geolocation` VARCHAR(255) default NULL, -- geolocation of your library @@ -1239,19 +1238,6 @@ CREATE TABLE pending_offline_operations ( PRIMARY KEY (operationid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- --- Table structure for table `printers` --- - -DROP TABLE IF EXISTS `printers`; -CREATE TABLE `printers` ( - `printername` varchar(40) NOT NULL default '', - `printqueue` varchar(20) default NULL, - `printtype` varchar(20) default NULL, - PRIMARY KEY (`printername`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - -- -- Table structure for table `printers_profile` -- diff --git a/installer/data/mysql/ru-RU/optional/example_branches.sql b/installer/data/mysql/ru-RU/optional/example_branches.sql index 51d1efe90f..df1f79ee2e 100644 --- a/installer/data/mysql/ru-RU/optional/example_branches.sql +++ b/installer/data/mysql/ru-RU/optional/example_branches.sql @@ -1,19 +1,19 @@ TRUNCATE branches; -INSERT INTO `branches` (`branchcode`, `branchname`, `branchaddress1`, `branchaddress2`, `branchaddress3`, `branchphone`, `branchfax`, `branchemail`, `issuing`, `branchip`, `branchprinter`) VALUES +INSERT INTO `branches` (`branchcode`, `branchname`, `branchaddress1`, `branchaddress2`, `branchaddress3`, `branchphone`, `branchfax`, `branchemail`, `issuing`, `branchip`) VALUES ('AB', 'Абонемент', - 'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('ABH', 'Абонемент художественной литературы', - 'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('CHZ', 'Читательский зал', - 'Украина', 'г. Тернополь', 'кабинет 58 (3-ий этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'г. Тернополь', 'кабинет 58 (3-ий этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('CHZP', 'Читательский зал периодики, каталог', - 'Украина', 'г. Тернополь', 'кабинет 2 (1-ый этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'г. Тернополь', 'кабинет 2 (1-ый этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('ECHZ', 'Электронный читательский зал', - 'Украина', 'г. Тернополь', 'кабинет 54 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'г. Тернополь', 'кабинет 54 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('LNSL', 'Львовская национальная научная библиотека им. В.Стефаника НАНУ', - 'Украина', 'г. Львов', 'ул. Стефаника 2', '8 (032) 272-45-36', '', 'library@library.lviv.ua', NULL, '', NULL), + 'Украина', 'г. Львов', 'ул. Стефаника 2', '8 (032) 272-45-36', '', 'library@library.lviv.ua', NULL, ''), ('STL', 'Научно-техническая библиотека Тернопольского государственного техниеского университета им. Ив Пулюя', - 'Украина', 'м. Тернопіль', 'ул. Руська 56, кабинет 5 (второй корпус)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL), + 'Украина', 'м. Тернопіль', 'ул. Руська 56, кабинет 5 (второй корпус)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''), ('NPLU', 'Национальная парламентская библиотека Украины', - 'Украина', 'г. Киев', 'ул. Грушевского, 1', '38 (044) 278-85-12', '38 (044) 278-85-12', 'office@nplu.org', NULL, '192.168.1.*', NULL); + 'Украина', 'г. Киев', 'ул. Грушевского, 1', '38 (044) 278-85-12', '38 (044) 278-85-12', 'office@nplu.org', NULL, '192.168.1.*'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 3e513fd0db..62283f1087 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -502,7 +502,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'), ('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'), ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), -('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), ('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'), ('ProcessingFeeNote', '', NULL, 'Set the text to be recorded in the column note, table accountlines when the processing fee (defined in item type) is applied', 'textarea'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index bb03bd5ebf..bb71416d15 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -1,5 +1,4 @@ Circulation: -# FIXME: printcirculationslips is also omitted. It _technically_ could work, but C4::Print is HLT specific and needs a little bit of refactoring. Interface: - - pref: CircSidebar diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt deleted file mode 100644 index 1a83fe3630..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt +++ /dev/null @@ -1,173 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% INCLUDE 'doc-head-open.inc' %] -Koha › Administration › -[% IF ( add_form ) %][% IF ( searchfield ) %] Printers › Modify printer '[% searchfield | html %]'[% ELSE %] Printers › New printer[% END %][% END %] -[% IF ( add_validate ) %] Printers › Printer added[% END %] -[% IF ( delete_confirm ) %] Printers › Confirm deletion of printer '[% searchfield | html %]'[% END %] -[% IF ( delete_confirmed ) %] Printers › Printer deleted[% END %] -[% IF ( else ) %]Printers[% END %] -[% INCLUDE 'doc-head-close.inc' %] -[% IF ( loop ) %] -[% INCLUDE 'datatables.inc' %] - -[% END %] - - -[% INCLUDE 'header.inc' %] -[% INCLUDE 'cat-search.inc' %] - - - -
-
-
-
- -[% IF ( add_form ) %] - -[% IF ( searchfield ) %] -

Modify printer

- [% ELSE %] -

New printer

- [% END %] -
- - [% IF ( searchfield ) %] - - [% ELSE %] - - [% END %] -
-
    [% IF ( searchfield ) %] -
  1. - Printer name: - [% searchfield | html %] -
  2. - [% ELSE %] -
  3. - - - Required -
  4. - [% END %] -
  5. - - - Required -
  6. -
  7. - - -
-
-
Cancel
-
- -[% END %] - -[% IF ( add_validate ) %] -

Printer added

-
-
-
-[% END %] - -[% IF ( delete_confirm ) %] -
-

Confirm deletion of printer [% searchfield | html %]

- - - - - - - - - - - -
Printer: [% searchfield | html %]
Queue: [% printqueue | html %]
Type: [% printtype | html %]
- -
- - - -
-
- -
-
-[% END %] - -[% IF ( delete_confirmed ) %] -
-

Printer deleted

-
- -
-
- -[% END %] - -[% IF ( else ) %] - - - -

Printers

- [% IF ( searchfield ) %] - You searched for [% searchfield | html %] - [% END %] - -[% IF ( loop ) %] - - - - - - - - - - - [% FOREACH loo IN loop %] - - - - - - - [% END %] - -
NameQueueType 
[% loo.printername | html %][% loo.printqueue | html %][% loo.printtype | html %] Edit Delete
[% ELSE %]
No printers defined.
[% END %] -[% END %] - -
-
- -
- -
-
- -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt index f2a65c92ab..19d462c273 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt @@ -37,8 +37,6 @@ Updated:
    [% FOREACH update IN updated %] [% IF ( update.updated_branch ) %]
  • Library: [% update.old_branch or "?" | html %] ⇒ [% update.LoginBranchcode or "?" | html %]
  • - [% ELSIF ( update.updated_printer ) %] - [% ELSE %]
  • ERROR - unknown
  • [% END %] @@ -67,19 +65,6 @@ Updated:
      [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %] [% END %] -
      diff --git a/t/Print.t b/t/Print.t deleted file mode 100755 index faf729d6b7..0000000000 --- a/t/Print.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# -# This Koha test module is a stub! -# Add more tests here!!! - -use strict; -use warnings; - -use Test::More tests => 2; - -BEGIN { - use_ok('C4::Print'); -} -ok( !NetworkPrint("")); - -- 2.39.5