View | Details | Raw Unified | Return to bug 17845
Collapse All | Expand All

(-)a/C4/Auth.pm (-21 / +16 lines)
Lines 853-859 sub checkauth { Link Here
853
                $session->param('cardnumber'),   $session->param('firstname'),
853
                $session->param('cardnumber'),   $session->param('firstname'),
854
                $session->param('surname'),      $session->param('branch'),
854
                $session->param('surname'),      $session->param('branch'),
855
                $session->param('branchname'),   $session->param('flags'),
855
                $session->param('branchname'),   $session->param('flags'),
856
                $session->param('emailaddress'), $session->param('branchprinter'),
856
                $session->param('emailaddress'),
857
                $session->param('shibboleth')
857
                $session->param('shibboleth')
858
            );
858
            );
859
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
859
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
Lines 1076-1089 sub checkauth { Link Here
1076
                    C4::Context->_unset_userenv($sessionID);
1076
                    C4::Context->_unset_userenv($sessionID);
1077
                }
1077
                }
1078
                my ( $borrowernumber, $firstname, $surname, $userflags,
1078
                my ( $borrowernumber, $firstname, $surname, $userflags,
1079
                    $branchcode, $branchname, $branchprinter, $emailaddress );
1079
                    $branchcode, $branchname, $emailaddress );
1080
1080
1081
                if ( $return == 1 ) {
1081
                if ( $return == 1 ) {
1082
                    my $select = "
1082
                    my $select = "
1083
                    SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode,
1083
                    SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode,
1084
                    branches.branchname    as branchname,
1084
                    branches.branchname    as branchname, email
1085
                    branches.branchprinter as branchprinter,
1086
                    email
1087
                    FROM borrowers
1085
                    FROM borrowers
1088
                    LEFT JOIN branches on borrowers.branchcode=branches.branchcode
1086
                    LEFT JOIN branches on borrowers.branchcode=branches.branchcode
1089
                    ";
1087
                    ";
Lines 1104-1110 sub checkauth { Link Here
1104
                    }
1102
                    }
1105
                    if ( $sth->rows ) {
1103
                    if ( $sth->rows ) {
1106
                        ( $borrowernumber, $firstname, $surname, $userflags,
1104
                        ( $borrowernumber, $firstname, $surname, $userflags,
1107
                            $branchcode, $branchname, $branchprinter, $emailaddress ) = $sth->fetchrow;
1105
                            $branchcode, $branchname, $emailaddress ) = $sth->fetchrow;
1108
                        $debug and print STDERR "AUTH_3 results: " .
1106
                        $debug and print STDERR "AUTH_3 results: " .
1109
                          "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n";
1107
                          "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n";
1110
                    } else {
1108
                    } else {
Lines 1146-1153 sub checkauth { Link Here
1146
                        if ( $domain && $ip =~ /^$domain/ ) {
1144
                        if ( $domain && $ip =~ /^$domain/ ) {
1147
                            $branchcode = $branches->{$br}->{'branchcode'};
1145
                            $branchcode = $branches->{$br}->{'branchcode'};
1148
1146
1149
                            # new op dev : add the branchprinter and branchname in the cookie
1147
                            # new op dev : add the branchname to the cookie
1150
                            $branchprinter = $branches->{$br}->{'branchprinter'};
1151
                            $branchname    = $branches->{$br}->{'branchname'};
1148
                            $branchname    = $branches->{$br}->{'branchname'};
1152
                        }
1149
                        }
1153
                    }
1150
                    }
Lines 1171-1178 sub checkauth { Link Here
1171
                    $session->param('cardnumber'),   $session->param('firstname'),
1168
                    $session->param('cardnumber'),   $session->param('firstname'),
1172
                    $session->param('surname'),      $session->param('branch'),
1169
                    $session->param('surname'),      $session->param('branch'),
1173
                    $session->param('branchname'),   $session->param('flags'),
1170
                    $session->param('branchname'),   $session->param('flags'),
1174
                    $session->param('emailaddress'), $session->param('branchprinter'),
1171
                    $session->param('emailaddress'), $session->param('shibboleth')
1175
                    $session->param('shibboleth')
1176
                );
1172
                );
1177
1173
1178
            }
1174
            }
Lines 1439-1445 sub check_api_auth { Link Here
1439
                $session->param('cardnumber'),   $session->param('firstname'),
1435
                $session->param('cardnumber'),   $session->param('firstname'),
1440
                $session->param('surname'),      $session->param('branch'),
1436
                $session->param('surname'),      $session->param('branch'),
1441
                $session->param('branchname'),   $session->param('flags'),
1437
                $session->param('branchname'),   $session->param('flags'),
1442
                $session->param('emailaddress'), $session->param('branchprinter')
1438
                $session->param('emailaddress')
1443
            );
1439
            );
1444
1440
1445
            my $ip       = $session->param('ip');
1441
            my $ip       = $session->param('ip');
Lines 1527-1561 sub check_api_auth { Link Here
1527
                my (
1523
                my (
1528
                    $borrowernumber, $firstname,  $surname,
1524
                    $borrowernumber, $firstname,  $surname,
1529
                    $userflags,      $branchcode, $branchname,
1525
                    $userflags,      $branchcode, $branchname,
1530
                    $branchprinter,  $emailaddress
1526
                    $emailaddress
1531
                );
1527
                );
1532
                my $sth =
1528
                my $sth =
1533
                  $dbh->prepare(
1529
                  $dbh->prepare(
1534
"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=?"
1530
"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?"
1535
                  );
1531
                  );
1536
                $sth->execute($userid);
1532
                $sth->execute($userid);
1537
                (
1533
                (
1538
                    $borrowernumber, $firstname,  $surname,
1534
                    $borrowernumber, $firstname,  $surname,
1539
                    $userflags,      $branchcode, $branchname,
1535
                    $userflags,      $branchcode, $branchname,
1540
                    $branchprinter,  $emailaddress
1536
                    $emailaddress
1541
                ) = $sth->fetchrow if ( $sth->rows );
1537
                ) = $sth->fetchrow if ( $sth->rows );
1542
1538
1543
                unless ( $sth->rows ) {
1539
                unless ( $sth->rows ) {
1544
                    my $sth = $dbh->prepare(
1540
                    my $sth = $dbh->prepare(
1545
"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=?"
1541
"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?"
1546
                    );
1542
                    );
1547
                    $sth->execute($cardnumber);
1543
                    $sth->execute($cardnumber);
1548
                    (
1544
                    (
1549
                        $borrowernumber, $firstname,  $surname,
1545
                        $borrowernumber, $firstname,  $surname,
1550
                        $userflags,      $branchcode, $branchname,
1546
                        $userflags,      $branchcode, $branchname,
1551
                        $branchprinter,  $emailaddress
1547
                        $emailaddress
1552
                    ) = $sth->fetchrow if ( $sth->rows );
1548
                    ) = $sth->fetchrow if ( $sth->rows );
1553
1549
1554
                    unless ( $sth->rows ) {
1550
                    unless ( $sth->rows ) {
1555
                        $sth->execute($userid);
1551
                        $sth->execute($userid);
1556
                        (
1552
                        (
1557
                            $borrowernumber, $firstname,  $surname,       $userflags,
1553
                            $borrowernumber, $firstname,  $surname,       $userflags,
1558
                            $branchcode,     $branchname, $branchprinter, $emailaddress
1554
                            $branchcode,     $branchname, $emailaddress
1559
                        ) = $sth->fetchrow if ( $sth->rows );
1555
                        ) = $sth->fetchrow if ( $sth->rows );
1560
                    }
1556
                    }
1561
                }
1557
                }
Lines 1576-1583 sub check_api_auth { Link Here
1576
                    if ( $domain && $ip =~ /^$domain/ ) {
1572
                    if ( $domain && $ip =~ /^$domain/ ) {
1577
                        $branchcode = $branches->{$br}->{'branchcode'};
1573
                        $branchcode = $branches->{$br}->{'branchcode'};
1578
1574
1579
                        # new op dev : add the branchprinter and branchname in the cookie
1575
                        # new op dev : add the branchname to the cookie
1580
                        $branchprinter = $branches->{$br}->{'branchprinter'};
1581
                        $branchname    = $branches->{$br}->{'branchname'};
1576
                        $branchname    = $branches->{$br}->{'branchname'};
1582
                    }
1577
                    }
1583
                }
1578
                }
Lines 1599-1605 sub check_api_auth { Link Here
1599
                $session->param('cardnumber'),   $session->param('firstname'),
1594
                $session->param('cardnumber'),   $session->param('firstname'),
1600
                $session->param('surname'),      $session->param('branch'),
1595
                $session->param('surname'),      $session->param('branch'),
1601
                $session->param('branchname'),   $session->param('flags'),
1596
                $session->param('branchname'),   $session->param('flags'),
1602
                $session->param('emailaddress'), $session->param('branchprinter')
1597
                $session->param('emailaddress')
1603
            );
1598
            );
1604
            return ( "ok", $cookie, $sessionID );
1599
            return ( "ok", $cookie, $sessionID );
1605
        } else {
1600
        } else {
Lines 1682-1688 sub check_cookie_auth { Link Here
1682
            $session->param('cardnumber'),   $session->param('firstname'),
1677
            $session->param('cardnumber'),   $session->param('firstname'),
1683
            $session->param('surname'),      $session->param('branch'),
1678
            $session->param('surname'),      $session->param('branch'),
1684
            $session->param('branchname'),   $session->param('flags'),
1679
            $session->param('branchname'),   $session->param('flags'),
1685
            $session->param('emailaddress'), $session->param('branchprinter')
1680
            $session->param('emailaddress')
1686
        );
1681
        );
1687
1682
1688
        my $ip       = $session->param('ip');
1683
        my $ip       = $session->param('ip');
(-)a/C4/Context.pm (-3 / +2 lines)
Lines 835-841 sub userenv { Link Here
835
  C4::Context->set_userenv($usernum, $userid, $usercnum,
835
  C4::Context->set_userenv($usernum, $userid, $usercnum,
836
                           $userfirstname, $usersurname,
836
                           $userfirstname, $usersurname,
837
                           $userbranch, $branchname, $userflags,
837
                           $userbranch, $branchname, $userflags,
838
                           $emailaddress, $branchprinter, $shibboleth);
838
                           $emailaddress, $shibboleth);
839
839
840
Establish a hash of user environment variables.
840
Establish a hash of user environment variables.
841
841
Lines 846-852 set_userenv is called in Auth.pm Link Here
846
#'
846
#'
847
sub set_userenv {
847
sub set_userenv {
848
    shift @_;
848
    shift @_;
849
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $shibboleth)=
849
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth)=
850
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
850
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
851
    @_;
851
    @_;
852
    my $var=$context->{"activeuser"} || '';
852
    my $var=$context->{"activeuser"} || '';
Lines 861-867 sub set_userenv { Link Here
861
        "branchname" => $branchname,
861
        "branchname" => $branchname,
862
        "flags"      => $userflags,
862
        "flags"      => $userflags,
863
        "emailaddress"     => $emailaddress,
863
        "emailaddress"     => $emailaddress,
864
        "branchprinter"    => $branchprinter,
865
        "shibboleth" => $shibboleth,
864
        "shibboleth" => $shibboleth,
866
    };
865
    };
867
    $context->{userenv}->{$var} = $cell;
866
    $context->{userenv}->{$var} = $cell;
(-)a/C4/InstallAuth.pm (-2 / +1 lines)
Lines 260-267 sub checkauth { Link Here
260
                $session->param('branch'),
260
                $session->param('branch'),
261
                $session->param('branchname'),
261
                $session->param('branchname'),
262
                $session->param('flags'),
262
                $session->param('flags'),
263
                $session->param('emailaddress'),
263
                $session->param('emailaddress')
264
                $session->param('branchprinter')
265
            );
264
            );
266
            $cookie = $query->cookie(
265
            $cookie = $query->cookie(
267
                -name     => 'CGISESSID',
266
                -name     => 'CGISESSID',
(-)a/C4/Koha.pm (-40 lines)
Lines 40-46 BEGIN { Link Here
40
	require Exporter;
40
	require Exporter;
41
	@ISA    = qw(Exporter);
41
	@ISA    = qw(Exporter);
42
	@EXPORT = qw(
42
	@EXPORT = qw(
43
        &GetPrinters &GetPrinter
44
        &GetItemTypesCategorized
43
        &GetItemTypesCategorized
45
        &getallthemes
44
        &getallthemes
46
        &getFacets
45
        &getFacets
Lines 277-321 sub getImageSets { Link Here
277
    return \@imagesets;
276
    return \@imagesets;
278
}
277
}
279
278
280
=head2 GetPrinters
281
282
  $printers = &GetPrinters();
283
  @queues = keys %$printers;
284
285
Returns information about existing printer queues.
286
287
C<$printers> is a reference-to-hash whose keys are the print queues
288
defined in the printers table of the Koha database. The values are
289
references-to-hash, whose keys are the fields in the printers table.
290
291
=cut
292
293
sub GetPrinters {
294
    my %printers;
295
    my $dbh = C4::Context->dbh;
296
    my $sth = $dbh->prepare("select * from printers");
297
    $sth->execute;
298
    while ( my $printer = $sth->fetchrow_hashref ) {
299
        $printers{ $printer->{'printqueue'} } = $printer;
300
    }
301
    return ( \%printers );
302
}
303
304
=head2 GetPrinter
305
306
  $printer = GetPrinter( $query, $printers );
307
308
=cut
309
310
sub GetPrinter {
311
    my ( $query, $printers ) = @_;    # get printer for this query from printers
312
    my $printer = $query->param('printer');
313
    my %cookie = $query->cookie('userenv');
314
    ($printer) || ( $printer = $cookie{'printer'} ) || ( $printer = '' );
315
    ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] );
316
    return $printer;
317
}
318
319
=head2 getnbpages
279
=head2 getnbpages
320
280
321
Returns the number of pages to display in a pagination bar, given the number
281
Returns the number of pages to display in a pagination bar, given the number
(-)a/C4/Print.pm (-104 lines)
Lines 1-104 Link Here
1
package C4::Print;
2
3
# Copyright 2000-2002 Katipo Communications
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use strict;
21
#use warnings; FIXME - Bug 2505
22
use C4::Context;
23
24
use vars qw(@ISA @EXPORT);
25
26
BEGIN {
27
	require Exporter;
28
	@ISA    = qw(Exporter);
29
    @EXPORT = qw(&NetworkPrint);
30
}
31
32
=head1 NAME
33
34
C4::Print - Koha module dealing with printing
35
36
=head1 SYNOPSIS
37
38
  use C4::Print;
39
40
=head1 DESCRIPTION
41
42
The functions in this module handle sending text to a printer.
43
44
=head1 FUNCTIONS
45
46
=head2 NetworkPrint
47
48
  &NetworkPrint($text)
49
50
Queue some text for printing on the selected branch printer
51
52
=cut
53
54
sub NetworkPrint {
55
    my ($text) = @_;
56
57
# FIXME - It'd be nifty if this could generate pretty PostScript.
58
59
    my $queue = '';
60
61
    # FIXME - If 'queue' is undefined or empty, then presumably it should
62
    # mean "use the default queue", whatever the default is. Presumably
63
    # the default depends on the physical location of the machine.
64
    # FIXME - Perhaps "print to file" should be a supported option. Just
65
    # set the queue to "file" (or " file", if real queues aren't allowed
66
    # to have spaces in them). Or perhaps if $queue eq "" and
67
    # $env->{file} ne "", then that should mean "print to $env->{file}".
68
69
    my $fh;
70
    if ( $queue eq "" || $queue eq 'nulllp' ) {
71
        return;
72
	#open( $fh, ">/tmp/kohaiss" );
73
    }
74
    else {
75
76
        # FIXME - This assumes that 'lpr' exists, and works as expected.
77
        # This is a reasonable assumption, but only because every other
78
        # printing package has a wrapper script called 'lpr'. It'd still
79
        # be better to be able to customize this.
80
        open( $fh, "-|", "lpr -P $queue > /dev/null" )
81
          or die "Couldn't write to queue:$queue!\n";
82
    }
83
84
    #  print $queue;
85
    #open (FILE,">/tmp/$file");
86
    print $fh $text;
87
    print $fh "\r\n" x 7 ;
88
    close $fh;
89
90
    #system("lpr /tmp/$file");
91
}
92
93
1;
94
__END__
95
96
=head1 AUTHOR
97
98
Koha Development Team <http://koha-community.org/>
99
100
=head1 SEE ALSO
101
102
C4::Circulation::Circ2(3)
103
104
=cut
(-)a/admin/printers.pl (-137 lines)
Lines 1-137 Link Here
1
#!/usr/bin/perl
2
3
#script to administer the aqbudget table
4
#written 20/02/2002 by paul.poulain@free.fr
5
# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
6
7
# ALGO :
8
# this script use an $op to know what to do.
9
# if $op is empty or none of the above values,
10
#	- the default screen is build (with all records, or filtered datas).
11
#	- the   user can clic on add, modify or delete record.
12
# if $op=add_form
13
#	- if primkey exists, this is a modification,so we read the $primkey record
14
#	- builds the add/modify form
15
# if $op=add_validate
16
#	- the user has just send datas, so we create/modify the record
17
# if $op=delete_form
18
#	- we show the record having primkey=$primkey and ask for deletion validation form
19
# if $op=delete_confirm
20
#	- we delete the record having primkey=$primkey
21
22
23
# Copyright 2000-2002 Katipo Communications
24
#
25
# This file is part of Koha.
26
#
27
# Koha is free software; you can redistribute it and/or modify it
28
# under the terms of the GNU General Public License as published by
29
# the Free Software Foundation; either version 3 of the License, or
30
# (at your option) any later version.
31
#
32
# Koha is distributed in the hope that it will be useful, but
33
# WITHOUT ANY WARRANTY; without even the implied warranty of
34
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35
# GNU General Public License for more details.
36
#
37
# You should have received a copy of the GNU General Public License
38
# along with Koha; if not, see <http://www.gnu.org/licenses>.
39
40
use Modern::Perl;
41
use CGI qw ( -utf8 );
42
use C4::Context;
43
use C4::Output;
44
use C4::Auth;
45
46
sub StringSearch  {
47
	my ($searchstring,$type)=@_;		# why bother with $type if we don't use it?!
48
	$searchstring=~ s/\'/\\\'/g;
49
	my @data=split(' ',$searchstring);
50
	my $sth = C4::Context->dbh->prepare("
51
		SELECT printername,printqueue,printtype from printers 
52
		WHERE (printername like ?) order by printername
53
	");
54
	$sth->execute("$data[0]%");
55
	my $data=$sth->fetchall_arrayref({});
56
	return (scalar(@$data),$data);
57
}
58
59
my $input = new CGI;
60
my $searchfield=$input->param('searchfield');
61
#my $branchcode=$input->param('branchcode');
62
my $script_name="/cgi-bin/koha/admin/printers.pl";
63
64
my $op = $input->param('op');
65
$searchfield=~ s/\,//g;
66
67
my ($template, $loggedinuser, $cookie) = get_template_and_user(
68
    {
69
        template_name   => "admin/printers.tt",
70
        query           => $input,
71
        type            => "intranet",
72
        authnotrequired => 0,
73
        flagsrequired   => {parameters => 'parameters_remaining_permissions'},
74
        debug           => 1,
75
    }
76
);
77
78
$template->param(searchfield => $searchfield,
79
		 script_name => $script_name);
80
81
#start the page and read in includes
82
83
my $dbh = C4::Context->dbh;
84
################## ADD_FORM ##################################
85
# called by default. Used to create form to add or  modify a record
86
if ($op eq 'add_form') {
87
	$template->param(add_form => 1);
88
	#---- if primkey exists, it's a modify action, so read values to modify...
89
	my $data;
90
	if ($searchfield) {
91
		my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?");
92
		$sth->execute($searchfield);
93
		$data=$sth->fetchrow_hashref;
94
	}
95
96
	$template->param(printqueue => $data->{'printqueue'},
97
			 printtype => $data->{'printtype'});
98
													# END $OP eq ADD_FORM
99
################## ADD_VALIDATE ##################################
100
# called by add_form, used to insert/modify data in DB
101
} elsif ($op eq 'add_validate') {
102
	$template->param(add_validate => 1);
103
	if ($input->param('add')){
104
		my $sth=$dbh->prepare("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)");
105
		$sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype'));
106
	} else {
107
		my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?");
108
		$sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername'));
109
	}
110
													# END $OP eq ADD_VALIDATE
111
################## DELETE_CONFIRM ##################################
112
# called by default form, used to confirm deletion of data in DB
113
} elsif ($op eq 'delete_confirm') {
114
	$template->param(delete_confirm => 1);
115
	my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?");
116
	$sth->execute($searchfield);
117
	my $data=$sth->fetchrow_hashref;
118
	$template->param(printqueue => $data->{'printqueue'},
119
			 printtype  => $data->{'printtype'});
120
													# END $OP eq DELETE_CONFIRM
121
################## DELETE_CONFIRMED ##################################
122
# called by delete_confirm, used to effectively confirm deletion of data in DB
123
} elsif ($op eq 'delete_confirmed') {
124
	$template->param(delete_confirmed => 1);
125
	my $sth=$dbh->prepare("delete from printers where printername=?");
126
	$sth->execute($searchfield);
127
													# END $OP eq DELETE_CONFIRMED
128
################## DEFAULT ###########################################
129
} else { # DEFAULT
130
	$template->param(else => 1);
131
	my ($count,$results)=StringSearch($searchfield,'web');
132
    $template->param(loop => $results);
133
134
} #---- END $OP eq DEFAULT
135
136
output_html_with_http_headers $input, $cookie, $template->output;
137
(-)a/circ/circulation.pl (-17 / +1 lines)
Lines 30-38 use DateTime; Link Here
30
use DateTime::Duration;
30
use DateTime::Duration;
31
use Scalar::Util qw( looks_like_number );
31
use Scalar::Util qw( looks_like_number );
32
use C4::Output;
32
use C4::Output;
33
use C4::Print;
34
use C4::Auth qw/:DEFAULT get_session haspermission/;
33
use C4::Auth qw/:DEFAULT get_session haspermission/;
35
use C4::Koha;   # GetPrinter
34
use C4::Koha;
36
use C4::Circulation;
35
use C4::Circulation;
37
use C4::Utils::DataTables::Members;
36
use C4::Utils::DataTables::Members;
38
use C4::Members;
37
use C4::Members;
Lines 184-190 if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { Link Here
184
}
183
}
185
my $issueconfirmed = $query->param('issueconfirmed');
184
my $issueconfirmed = $query->param('issueconfirmed');
186
my $cancelreserve  = $query->param('cancelreserve');
185
my $cancelreserve  = $query->param('cancelreserve');
187
my $print          = $query->param('print') || q{};
188
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
186
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
189
my $charges        = $query->param('charges') || q{};
187
my $charges        = $query->param('charges') || q{};
190
188
Lines 218-228 if( $onsite_checkout && !$duedatespec_allow ) { Link Here
218
    }
216
    }
219
}
217
}
220
218
221
# check and see if we should print
222
if ( @$barcodes == 0 && $print eq 'maybe' ) {
223
    $print = 'yes';
224
}
225
226
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
219
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
227
if ( @$barcodes == 0 && $charges eq 'yes' ) {
220
if ( @$barcodes == 0 && $charges eq 'yes' ) {
228
    $template->param(
221
    $template->param(
Lines 231-245 if ( @$barcodes == 0 && $charges eq 'yes' ) { Link Here
231
    );
224
    );
232
}
225
}
233
226
234
if ( $print eq 'yes' && $borrowernumber ne '' ) {
235
    if ( C4::Context->boolean_preference('printcirculationslips') ) {
236
        my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
237
        NetworkPrint($letter->{content});
238
    }
239
    $query->param( 'borrowernumber', '' );
240
    $borrowernumber = '';
241
}
242
243
#
227
#
244
# STEP 2 : FIND BORROWER
228
# STEP 2 : FIND BORROWER
245
# if there is a list of find borrowers....
229
# if there is a list of find borrowers....
(-)a/circ/returns.pl (-7 lines)
Lines 37-43 use C4::Context; Link Here
37
use C4::Auth qw/:DEFAULT get_session/;
37
use C4::Auth qw/:DEFAULT get_session/;
38
use C4::Output;
38
use C4::Output;
39
use C4::Circulation;
39
use C4::Circulation;
40
use C4::Print;
41
use C4::Reserves;
40
use C4::Reserves;
42
use C4::Biblio;
41
use C4::Biblio;
43
use C4::Items;
42
use C4::Items;
Lines 86-101 if ( $query->param('print_slip') ) { Link Here
86
85
87
#####################
86
#####################
88
#Global vars
87
#Global vars
89
my $printers = GetPrinters();
90
my $userenv = C4::Context->userenv;
88
my $userenv = C4::Context->userenv;
91
my $userenv_branch = $userenv->{'branch'} // '';
89
my $userenv_branch = $userenv->{'branch'} // '';
92
my $printer = $userenv->{'branchprinter'} // '';
93
my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire');
90
my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire');
94
91
95
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
92
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
96
 #
97
# Some code to handle the error if there is no branch or printer setting.....
98
#
99
93
100
# Set up the item stack ....
94
# Set up the item stack ....
101
my %returneditems;
95
my %returneditems;
Lines 612-618 foreach ( sort { $a <=> $b } keys %returneditems ) { Link Here
612
606
613
$template->param(
607
$template->param(
614
    riloop         => \@riloop,
608
    riloop         => \@riloop,
615
    printer        => $printer,
616
    errmsgloop     => \@errmsgloop,
609
    errmsgloop     => \@errmsgloop,
617
    exemptfine     => $exemptfine,
610
    exemptfine     => $exemptfine,
618
    dropboxmode    => $dropboxmode,
611
    dropboxmode    => $dropboxmode,
(-)a/circ/selectbranchprinter.pl (-45 lines)
Lines 23-35 use CGI qw ( -utf8 ); Link Here
23
use C4::Context;
23
use C4::Context;
24
use C4::Output;
24
use C4::Output;
25
use C4::Auth qw/:DEFAULT get_session/;
25
use C4::Auth qw/:DEFAULT get_session/;
26
use C4::Print;  # GetPrinters
27
use C4::Koha;
26
use C4::Koha;
28
use Koha::BiblioFrameworks;
27
use Koha::BiblioFrameworks;
29
use Koha::Libraries;
28
use Koha::Libraries;
30
29
31
# this will be the script that chooses branch and printer settings....
32
33
my $query = CGI->new();
30
my $query = CGI->new();
34
31
35
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({
32
my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({
Lines 44-57 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user({ Link Here
44
my $sessionID = $query->cookie("CGISESSID");
41
my $sessionID = $query->cookie("CGISESSID");
45
my $session = get_session($sessionID);
42
my $session = get_session($sessionID);
46
43
47
# try to get the branch and printer settings from http, fallback to userenv
48
my $printers = GetPrinters();
49
my $branch   = $query->param('branch' );
44
my $branch   = $query->param('branch' );
50
my $printer  = $query->param('printer');
51
# fallbacks for $branch and $printer after possible session updates
52
53
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
45
my $userenv_branch  = C4::Context->userenv->{'branch'}        || '';
54
my $userenv_printer = C4::Context->userenv->{'branchprinter'} || '';
55
my @updated;
46
my @updated;
56
47
57
# $session lddines here are doing the updating
48
# $session lddines here are doing the updating
Lines 72-118 if ( $branch and my $library = Koha::Libraries->find($branch) ) { Link Here
72
    $branch = $userenv_branch;  # fallback value
63
    $branch = $userenv_branch;  # fallback value
73
}
64
}
74
65
75
# FIXME: branchprinter is not retained by session.  This feature was not adequately
76
# ported from Koha 2.2.3 where it had been a separate cookie.
77
# So this needs to be fixed for Koha 3 or removed outright.
78
#   --atz (w/ info from chris cormack)
79
80
if ($printer) {
81
    if (! $userenv_printer or $userenv_printer ne $printer ) {
82
        $session->param('branchprinter', $printer);         # update sesssion in DB
83
        $session->flush();
84
        $template->param('new_printer', $printer);          # update template
85
        push @updated, {
86
            updated_printer => 1,
87
                old_printer => $userenv_printer,
88
        };
89
    } # else printer is the same, no update
90
} else {
91
    $printer = $userenv_printer;  # fallback value
92
}
93
94
$template->param(updated => \@updated) if (scalar @updated);
66
$template->param(updated => \@updated) if (scalar @updated);
95
67
96
my @printkeys = sort keys %$printers;
97
if (scalar(@printkeys) == 1 or not $printers->{$printer}) {
98
    $printer = $printkeys[0];   # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does
99
}
100
101
my @printerloop;
102
foreach ( @printkeys ) {
103
    next unless ($_); # skip printer if blank.
104
    push @printerloop, {
105
        selected => ( $_ eq $printer ),
106
        name     => $printers->{$_}->{'printername'},
107
        value    => $_,
108
    };
109
}
110
111
my @recycle_loop;
68
my @recycle_loop;
112
foreach ($query->param()) {
69
foreach ($query->param()) {
113
    $_ or next;                   # disclude blanks
70
    $_ or next;                   # disclude blanks
114
    $_ eq "branch"     and next;  # disclude branch
71
    $_ eq "branch"     and next;  # disclude branch
115
    $_ eq "printer"    and next;  # disclude printer
116
    $_ eq "oldreferer" and next;  # disclude oldreferer
72
    $_ eq "oldreferer" and next;  # disclude oldreferer
117
    push @recycle_loop, {
73
    push @recycle_loop, {
118
        param => $_,
74
        param => $_,
Lines 130-136 if (scalar @updated and not scalar @recycle_loop) { Link Here
130
86
131
$template->param(
87
$template->param(
132
    referer     => $referer,
88
    referer     => $referer,
133
    printerloop => \@printerloop,
134
    branch      => $branch,
89
    branch      => $branch,
135
    recycle_loop=> \@recycle_loop,
90
    recycle_loop=> \@recycle_loop,
136
);
91
);
(-)a/installer/data/mysql/atomicupdate/bug_17845_remove_printers (+4 lines)
Line 0 Link Here
1
DROP TABLE IF EXISTS printers;
2
ALTER TABLE branches DROP COLUMN branchprinter;
3
DELETE FROM systempreferences WHERE variable = "printcirculationslips";
4
-- Bug 17845: Drop unused table printers and branchprinter column
(-)a/installer/data/mysql/kohastructure.sql (-14 lines)
Lines 262-268 CREATE TABLE `branches` ( -- information about your libraries or branches are st Link Here
262
  `branchurl` LONGTEXT, -- the URL for your library or branch's website
262
  `branchurl` LONGTEXT, -- the URL for your library or branch's website
263
  `issuing` tinyint(4) default NULL, -- unused in Koha
263
  `issuing` tinyint(4) default NULL, -- unused in Koha
264
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
264
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
265
  `branchprinter` varchar(100) default NULL, -- unused in Koha
266
  `branchnotes` LONGTEXT, -- notes related to your library or branch
265
  `branchnotes` LONGTEXT, -- notes related to your library or branch
267
  opac_info MEDIUMTEXT, -- HTML that displays in OPAC
266
  opac_info MEDIUMTEXT, -- HTML that displays in OPAC
268
  `geolocation` VARCHAR(255) default NULL, -- geolocation of your library
267
  `geolocation` VARCHAR(255) default NULL, -- geolocation of your library
Lines 1348-1366 CREATE TABLE pending_offline_operations ( Link Here
1348
  PRIMARY KEY (operationid)
1347
  PRIMARY KEY (operationid)
1349
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1348
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1350
1349
1351
1352
--
1353
-- Table structure for table `printers`
1354
--
1355
1356
DROP TABLE IF EXISTS `printers`;
1357
CREATE TABLE `printers` (
1358
  `printername` varchar(40) NOT NULL default '',
1359
  `printqueue` varchar(20) default NULL,
1360
  `printtype` varchar(20) default NULL,
1361
  PRIMARY KEY (`printername`)
1362
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1363
1364
--
1350
--
1365
-- Table structure for table `printers_profile`
1351
-- Table structure for table `printers_profile`
1366
--
1352
--
(-)a/installer/data/mysql/ru-RU/optional/example_branches.sql (-9 / +9 lines)
Lines 1-19 Link Here
1
TRUNCATE branches;
1
TRUNCATE branches;
2
2
3
INSERT INTO `branches` (`branchcode`, `branchname`, `branchaddress1`, `branchaddress2`, `branchaddress3`, `branchphone`, `branchfax`, `branchemail`, `issuing`, `branchip`, `branchprinter`) VALUES
3
INSERT INTO `branches` (`branchcode`, `branchname`, `branchaddress1`, `branchaddress2`, `branchaddress3`, `branchphone`, `branchfax`, `branchemail`, `issuing`, `branchip`) VALUES
4
('AB',   'Абонемент', 
4
('AB',   'Абонемент', 
5
             'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
5
             'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
6
('ABH',  'Абонемент художественной литературы', 
6
('ABH',  'Абонемент художественной литературы', 
7
             'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
7
             'Украина', 'г. Тернополь', 'кабинет 53 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
8
('CHZ',  'Читательский зал', 
8
('CHZ',  'Читательский зал', 
9
             'Украина', 'г. Тернополь', 'кабинет 58 (3-ий этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
9
             'Украина', 'г. Тернополь', 'кабинет 58 (3-ий этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
10
('CHZP', 'Читательский зал периодики, каталог', 
10
('CHZP', 'Читательский зал периодики, каталог', 
11
             'Украина', 'г. Тернополь', 'кабинет 2 (1-ый этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
11
             'Украина', 'г. Тернополь', 'кабинет 2 (1-ый этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
12
('ECHZ', 'Электронный читательский зал',
12
('ECHZ', 'Электронный читательский зал',
13
             'Украина', 'г. Тернополь', 'кабинет 54 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
13
             'Украина', 'г. Тернополь', 'кабинет 54 (2-ой этаж)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
14
('LNSL', 'Львовская национальная научная библиотека им. В.Стефаника НАНУ', 
14
('LNSL', 'Львовская национальная научная библиотека им. В.Стефаника НАНУ', 
15
             'Украина', 'г. Львов', 'ул. Стефаника 2', '8 (032) 272-45-36', '', 'library@library.lviv.ua', NULL, '', NULL),
15
             'Украина', 'г. Львов', 'ул. Стефаника 2', '8 (032) 272-45-36', '', 'library@library.lviv.ua', NULL, ''),
16
('STL',  'Научно-техническая библиотека Тернопольского государственного техниеского университета им. Ив Пулюя', 
16
('STL',  'Научно-техническая библиотека Тернопольского государственного техниеского университета им. Ив Пулюя', 
17
             'Украина', 'м. Тернопіль', 'ул. Руська 56, кабинет 5 (второй корпус)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, '', NULL),
17
             'Украина', 'м. Тернопіль', 'ул. Руська 56, кабинет 5 (второй корпус)', '8 (0352) 52-53-45', '', 'lib@tu.edu.te.ua', NULL, ''),
18
('NPLU', 'Национальная парламентская библиотека Украины', 
18
('NPLU', 'Национальная парламентская библиотека Украины', 
19
             'Украина', 'г. Киев', 'ул. Грушевского, 1', '38 (044) 278-85-12', '38 (044) 278-85-12', 'office@nplu.org', NULL, '192.168.1.*', NULL);
19
             'Украина', 'г. Киев', 'ул. Грушевского, 1', '38 (044) 278-85-12', '38 (044) 278-85-12', 'office@nplu.org', NULL, '192.168.1.*');
(-)a/installer/data/mysql/sysprefs.sql (-1 lines)
Lines 441-447 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
441
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
441
('PayPalUser',  '', NULL ,  'Your PayPal API username ( email address )',  'Free'),
442
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
442
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
443
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
443
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
444
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
445
('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'),
444
('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'),
446
('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'),
445
('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'),
447
('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'),
446
('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'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 lines)
Lines 1-5 Link Here
1
Circulation:
1
Circulation:
2
# FIXME: printcirculationslips is also omitted. It _technically_ could work, but C4::Print is HLT specific and needs a little bit of refactoring.
3
    Interface:
2
    Interface:
4
        -
3
        -
5
            - pref: CircSidebar
4
            - pref: CircSidebar
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt (-174 lines)
Lines 1-174 Link Here
1
[% USE raw %]
2
[% USE Asset %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; Administration &rsaquo;
5
[% IF ( add_form ) %][% IF ( searchfield ) %] Printers &rsaquo; Modify printer '[% searchfield | html %]'[% ELSE %] Printers &rsaquo; New printer[% END %][% END %]
6
[% IF ( add_validate ) %] Printers &rsaquo; Printer added[% END %]
7
[% IF ( delete_confirm ) %] Printers &rsaquo; Confirm deletion of printer '[% searchfield | html %]'[% END %]
8
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
9
[% IF ( else ) %]Printers[% END %]</title>
10
[% INCLUDE 'doc-head-close.inc' %]
11
[% IF ( loop ) %]
12
[% Asset.css("css/datatables.css") | $raw %]
13
[% INCLUDE 'datatables.inc' %]
14
<script>
15
//<![CDATA[
16
    $(document).ready(function() {
17
        $("#printerst").dataTable($.extend(true, {}, dataTablesDefaults, {
18
            "aoColumnDefs": [
19
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
20
            ],
21
            "aaSorting": [[ 0, "asc" ]],
22
            "sPaginationType": "four_button"
23
        }));
24
    });
25
//]]>
26
</script>
27
[% END %]
28
</head>
29
<body id="admin_printers" class="admin">
30
[% INCLUDE 'header.inc' %]
31
[% INCLUDE 'cat-search.inc' %]
32
33
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Modify printer '[% searchfield | html %]'[% ELSE %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; New printer[% END %][% END %]
34
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
35
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Confirm deletion of printer '[% searchfield | html %]'[% END %]
36
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer deleted[% END %]
37
[% IF ( else ) %]Printers[% END %]</div>
38
39
<div class="main container-fluid">
40
    <div class="row">
41
        <div class="col-sm-10 col-sm-push-2">
42
            <main>
43
44
[% IF ( add_form ) %]
45
46
[% IF ( searchfield ) %]
47
		<h1>Modify printer</h1>
48
	[% ELSE %]
49
		<h1>New printer</h1>
50
	[% END %]
51
        <form action="[% script_name | html %]" name="Aform" method="post" class="validated">
52
        <input type="hidden" name="op" value="add_validate" />
53
	[% IF ( searchfield ) %]
54
		<input type="hidden" name="add" value="0" />
55
	[% ELSE %]
56
		<input type="hidden" name="add" value="1" />
57
	[% END %]
58
	<fieldset class="rows">
59
<ol>	[% IF ( searchfield ) %]
60
		<li>
61
            <span class="label">Printer name: </span>
62
				<input type="hidden" name="printername" id="" value="[% searchfield | html %]" />[% searchfield | html %]
63
		</li>
64
	[% ELSE %]
65
		<li>
66
            <label for="printername" class="required">Printer name: </label>
67
                <input type="text" name="printername" id="printername" size="40" maxlength="40" class="required" required="required" />
68
                <span class="required">Required</span>
69
		</li>
70
	[% END %]
71
        	<li>
72
            <label for="printqueue" class="required">Queue: </label>
73
            <input type="text" name="printqueue" id="printqueue" size="20" maxlength="20" value="[% printqueue | html %]"  class="required" required="required" />
74
            <span class="required">Required</span>
75
		</li>
76
        	<li>
77
			<label for="printtype">Type: </label>
78
            <input type="text" name="printtype" id="printtype" size="20" maxlength="20" value="[% printtype | html %]" />
79
		</li></ol>
80
        </fieldset>
81
        <fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/printers.pl">Cancel</a></fieldset>
82
        </form>
83
84
[% END %]
85
86
[% IF ( add_validate ) %]
87
<h3>Printer added</h3>
88
<form action="[% script_name | html %]" method="post">
89
       <fieldset class="action"> <input type="submit" value="OK" /></fieldset>
90
</form>
91
[% END %]
92
93
[% IF ( delete_confirm ) %]
94
    <div class="dialog alert">
95
        <h3>Confirm deletion of printer <em>[% searchfield | html %]</em></h3>
96
97
        <table>
98
            <tr>
99
                <th scope="row">Printer: </th><td>[% searchfield | html %]</td>
100
            </tr>
101
            <tr>
102
                <th scope="row">Queue: </th><td>[% printqueue | html %]</td>
103
            </tr>
104
            <tr>
105
                <th scope="row">Type: </th><td>[% printtype | html %]</td>
106
            </tr>
107
        </table>
108
109
        <form action="[% script_name | html %]" method="post">
110
            <input type="hidden" name="op" value="delete_confirmed" />
111
            <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
112
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
113
        </form>
114
        <form action="/cgi-bin/koha/admin/printers.pl" method="get">
115
            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
116
        </form>
117
    </div>
118
[% END %]
119
120
[% IF ( delete_confirmed ) %]
121
    <div class="dialog message">
122
        <h3>Printer deleted</h3>
123
        <form action="[% script_name | html %]" method="post">
124
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
125
        </form>
126
    </div>
127
128
[% END %]
129
130
[% IF ( else ) %]
131
132
<div id="toolbar" class="btn-toolbar">
133
    <a class="btn btn-default btn-sm" id="newprinter" href="/cgi-bin/koha/admin/printers.pl?op=add_form"><i class="fa fa-plus"></i> New printer</a>
134
</div>
135
136
<h2>Printers</h2>
137
	[% IF ( searchfield ) %]
138
		You searched for [% searchfield | html %]</span>
139
	[% END %]
140
141
[% IF ( loop ) %]
142
    <table id="printerst">
143
        <thead>
144
            <tr>
145
                <th>Name</th>
146
                <th>Queue</th>
147
                <th>Type</th>
148
                <th>&nbsp;</th>
149
            </tr>
150
        </thead>
151
        <tbody>
152
		[% FOREACH loo IN loop %]
153
        <tr>
154
			<td>[% loo.printername | html %]</td>
155
			<td>[% loo.printqueue | html %]</td>
156
			<td>[% loo.printtype | html %]</td>
157
            <td class="actions"><a class="btn btn-default btn-xs" href="[% loo.script_name | html %]?op=add_form&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-pencil"></i> Edit</a> <a class="btn btn-default btn-xs" href="[% loo.script_name | html %]?op=delete_confirm&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-trash"></i> Delete</a></td>
158
		</tr>
159
		[% END %]
160
        </tbody>
161
    </table>[% ELSE %]<div class="dialog message">No printers defined.</div>[% END %]
162
[% END %]
163
164
            </main>
165
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
166
167
        <div class="col-sm-2 col-sm-pull-10">
168
            <aside>
169
                [% INCLUDE 'admin-menu.inc' %]
170
            </aside>
171
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
172
     </div> <!-- /.row -->
173
174
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-15 lines)
Lines 29-36 Updated:<ul> Link Here
29
    [% FOREACH update IN updated %]
29
    [% FOREACH update IN updated %]
30
    [% IF ( update.updated_branch ) %]
30
    [% IF ( update.updated_branch ) %]
31
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.LoginBranchcode or "?" | html %]</li>
31
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.LoginBranchcode or "?" | html %]</li>
32
    [% ELSIF ( update.updated_printer ) %]
33
      <!-- FIXME:  <li>Printer: [% update.old_printer or "?" | html %] &rArr; [% update.new_printer or "?" | html %]</li> -->
34
    [% ELSE %]
32
    [% ELSE %]
35
        <li>ERROR - unknown</li>
33
        <li>ERROR - unknown</li>
36
    [% END %]
34
    [% END %]
Lines 59-77 Updated:<ul> Link Here
59
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
57
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
60
        </select></li>
58
        </select></li>
61
    [% END %]
59
    [% END %]
62
<!--
63
    [% IF ( printerloop ) %]
64
        <li><label for="printer">Choose a network printer:</label>
65
        <select name="printer" id="printer">
66
            [% FOREACH printerloo IN printerloop %]
67
                [% IF ( printerloo.selected ) %]
68
                    <option value="[% printerloo.value | html %]" selected="selected">[% printerloo.name | html %]</option>
69
                [% ELSE %]
70
                    <option value="[% printerloo.value | html %]">[% printerloo.name | html %]</option>
71
                [% END %]
72
            [% END %]
73
        </select></li>
74
    [% END %] -->
75
    </ol>
60
    </ol>
76
</fieldset>
61
</fieldset>
77
<fieldset class="action">
62
<fieldset class="action">
(-)a/t/Print.t (-16 lines)
Lines 1-15 Link Here
1
#!/usr/bin/perl
2
#
3
# This Koha test module is a stub!  
4
# Add more tests here!!!
5
6
use strict;
7
use warnings;
8
9
use Test::More tests => 2;
10
11
BEGIN {
12
        use_ok('C4::Print');
13
}
14
ok( !NetworkPrint(""));
15
16
- 

Return to bug 17845