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

(-)a/C4/Auth.pm (-21 / +16 lines)
Lines 848-854 sub checkauth { Link Here
848
                $session->param('cardnumber'),   $session->param('firstname'),
848
                $session->param('cardnumber'),   $session->param('firstname'),
849
                $session->param('surname'),      $session->param('branch'),
849
                $session->param('surname'),      $session->param('branch'),
850
                $session->param('branchname'),   $session->param('flags'),
850
                $session->param('branchname'),   $session->param('flags'),
851
                $session->param('emailaddress'), $session->param('branchprinter'),
851
                $session->param('emailaddress'),
852
                $session->param('shibboleth')
852
                $session->param('shibboleth')
853
            );
853
            );
854
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
854
            C4::Context::set_shelves_userenv( 'bar', $session->param('barshelves') );
Lines 1069-1082 sub checkauth { Link Here
1069
                    C4::Context->_unset_userenv($sessionID);
1069
                    C4::Context->_unset_userenv($sessionID);
1070
                }
1070
                }
1071
                my ( $borrowernumber, $firstname, $surname, $userflags,
1071
                my ( $borrowernumber, $firstname, $surname, $userflags,
1072
                    $branchcode, $branchname, $branchprinter, $emailaddress );
1072
                    $branchcode, $branchname, $emailaddress );
1073
1073
1074
                if ( $return == 1 ) {
1074
                if ( $return == 1 ) {
1075
                    my $select = "
1075
                    my $select = "
1076
                    SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode,
1076
                    SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode,
1077
                    branches.branchname    as branchname,
1077
                    branches.branchname    as branchname, email
1078
                    branches.branchprinter as branchprinter,
1079
                    email
1080
                    FROM borrowers
1078
                    FROM borrowers
1081
                    LEFT JOIN branches on borrowers.branchcode=branches.branchcode
1079
                    LEFT JOIN branches on borrowers.branchcode=branches.branchcode
1082
                    ";
1080
                    ";
Lines 1097-1103 sub checkauth { Link Here
1097
                    }
1095
                    }
1098
                    if ( $sth->rows ) {
1096
                    if ( $sth->rows ) {
1099
                        ( $borrowernumber, $firstname, $surname, $userflags,
1097
                        ( $borrowernumber, $firstname, $surname, $userflags,
1100
                            $branchcode, $branchname, $branchprinter, $emailaddress ) = $sth->fetchrow;
1098
                            $branchcode, $branchname, $emailaddress ) = $sth->fetchrow;
1101
                        $debug and print STDERR "AUTH_3 results: " .
1099
                        $debug and print STDERR "AUTH_3 results: " .
1102
                          "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n";
1100
                          "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n";
1103
                    } else {
1101
                    } else {
Lines 1139-1146 sub checkauth { Link Here
1139
                        if ( $domain && $ip =~ /^$domain/ ) {
1137
                        if ( $domain && $ip =~ /^$domain/ ) {
1140
                            $branchcode = $branches->{$br}->{'branchcode'};
1138
                            $branchcode = $branches->{$br}->{'branchcode'};
1141
1139
1142
                            # new op dev : add the branchprinter and branchname in the cookie
1140
                            # new op dev : add the branchname to the cookie
1143
                            $branchprinter = $branches->{$br}->{'branchprinter'};
1144
                            $branchname    = $branches->{$br}->{'branchname'};
1141
                            $branchname    = $branches->{$br}->{'branchname'};
1145
                        }
1142
                        }
1146
                    }
1143
                    }
Lines 1165-1172 sub checkauth { Link Here
1165
                    $session->param('cardnumber'),   $session->param('firstname'),
1162
                    $session->param('cardnumber'),   $session->param('firstname'),
1166
                    $session->param('surname'),      $session->param('branch'),
1163
                    $session->param('surname'),      $session->param('branch'),
1167
                    $session->param('branchname'),   $session->param('flags'),
1164
                    $session->param('branchname'),   $session->param('flags'),
1168
                    $session->param('emailaddress'), $session->param('branchprinter'),
1165
                    $session->param('emailaddress'), $session->param('shibboleth')
1169
                    $session->param('shibboleth')
1170
                );
1166
                );
1171
1167
1172
            }
1168
            }
Lines 1444-1450 sub check_api_auth { Link Here
1444
                $session->param('cardnumber'),   $session->param('firstname'),
1440
                $session->param('cardnumber'),   $session->param('firstname'),
1445
                $session->param('surname'),      $session->param('branch'),
1441
                $session->param('surname'),      $session->param('branch'),
1446
                $session->param('branchname'),   $session->param('flags'),
1442
                $session->param('branchname'),   $session->param('flags'),
1447
                $session->param('emailaddress'), $session->param('branchprinter')
1443
                $session->param('emailaddress')
1448
            );
1444
            );
1449
1445
1450
            my $ip       = $session->param('ip');
1446
            my $ip       = $session->param('ip');
Lines 1532-1566 sub check_api_auth { Link Here
1532
                my (
1528
                my (
1533
                    $borrowernumber, $firstname,  $surname,
1529
                    $borrowernumber, $firstname,  $surname,
1534
                    $userflags,      $branchcode, $branchname,
1530
                    $userflags,      $branchcode, $branchname,
1535
                    $branchprinter,  $emailaddress
1531
                    $emailaddress
1536
                );
1532
                );
1537
                my $sth =
1533
                my $sth =
1538
                  $dbh->prepare(
1534
                  $dbh->prepare(
1539
"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=?"
1535
"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where userid=?"
1540
                  );
1536
                  );
1541
                $sth->execute($userid);
1537
                $sth->execute($userid);
1542
                (
1538
                (
1543
                    $borrowernumber, $firstname,  $surname,
1539
                    $borrowernumber, $firstname,  $surname,
1544
                    $userflags,      $branchcode, $branchname,
1540
                    $userflags,      $branchcode, $branchname,
1545
                    $branchprinter,  $emailaddress
1541
                    $emailaddress
1546
                ) = $sth->fetchrow if ( $sth->rows );
1542
                ) = $sth->fetchrow if ( $sth->rows );
1547
1543
1548
                unless ( $sth->rows ) {
1544
                unless ( $sth->rows ) {
1549
                    my $sth = $dbh->prepare(
1545
                    my $sth = $dbh->prepare(
1550
"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=?"
1546
"select borrowernumber, firstname, surname, flags, borrowers.branchcode, branches.branchname as branchname, email from borrowers left join branches on borrowers.branchcode=branches.branchcode where cardnumber=?"
1551
                    );
1547
                    );
1552
                    $sth->execute($cardnumber);
1548
                    $sth->execute($cardnumber);
1553
                    (
1549
                    (
1554
                        $borrowernumber, $firstname,  $surname,
1550
                        $borrowernumber, $firstname,  $surname,
1555
                        $userflags,      $branchcode, $branchname,
1551
                        $userflags,      $branchcode, $branchname,
1556
                        $branchprinter,  $emailaddress
1552
                        $emailaddress
1557
                    ) = $sth->fetchrow if ( $sth->rows );
1553
                    ) = $sth->fetchrow if ( $sth->rows );
1558
1554
1559
                    unless ( $sth->rows ) {
1555
                    unless ( $sth->rows ) {
1560
                        $sth->execute($userid);
1556
                        $sth->execute($userid);
1561
                        (
1557
                        (
1562
                            $borrowernumber, $firstname,  $surname,       $userflags,
1558
                            $borrowernumber, $firstname,  $surname,       $userflags,
1563
                            $branchcode,     $branchname, $branchprinter, $emailaddress
1559
                            $branchcode,     $branchname, $emailaddress
1564
                        ) = $sth->fetchrow if ( $sth->rows );
1560
                        ) = $sth->fetchrow if ( $sth->rows );
1565
                    }
1561
                    }
1566
                }
1562
                }
Lines 1581-1588 sub check_api_auth { Link Here
1581
                    if ( $domain && $ip =~ /^$domain/ ) {
1577
                    if ( $domain && $ip =~ /^$domain/ ) {
1582
                        $branchcode = $branches->{$br}->{'branchcode'};
1578
                        $branchcode = $branches->{$br}->{'branchcode'};
1583
1579
1584
                        # new op dev : add the branchprinter and branchname in the cookie
1580
                        # new op dev : add the branchname to the cookie
1585
                        $branchprinter = $branches->{$br}->{'branchprinter'};
1586
                        $branchname    = $branches->{$br}->{'branchname'};
1581
                        $branchname    = $branches->{$br}->{'branchname'};
1587
                    }
1582
                    }
1588
                }
1583
                }
Lines 1605-1611 sub check_api_auth { Link Here
1605
                $session->param('cardnumber'),   $session->param('firstname'),
1600
                $session->param('cardnumber'),   $session->param('firstname'),
1606
                $session->param('surname'),      $session->param('branch'),
1601
                $session->param('surname'),      $session->param('branch'),
1607
                $session->param('branchname'),   $session->param('flags'),
1602
                $session->param('branchname'),   $session->param('flags'),
1608
                $session->param('emailaddress'), $session->param('branchprinter')
1603
                $session->param('emailaddress')
1609
            );
1604
            );
1610
            return ( "ok", $cookie, $sessionID );
1605
            return ( "ok", $cookie, $sessionID );
1611
        } else {
1606
        } else {
Lines 1693-1699 sub check_cookie_auth { Link Here
1693
            $session->param('cardnumber'),   $session->param('firstname'),
1688
            $session->param('cardnumber'),   $session->param('firstname'),
1694
            $session->param('surname'),      $session->param('branch'),
1689
            $session->param('surname'),      $session->param('branch'),
1695
            $session->param('branchname'),   $session->param('flags'),
1690
            $session->param('branchname'),   $session->param('flags'),
1696
            $session->param('emailaddress'), $session->param('branchprinter')
1691
            $session->param('emailaddress')
1697
        );
1692
        );
1698
1693
1699
        my $ip       = $session->param('ip');
1694
        my $ip       = $session->param('ip');
(-)a/C4/Context.pm (-3 / +2 lines)
Lines 809-815 sub userenv { Link Here
809
  C4::Context->set_userenv($usernum, $userid, $usercnum,
809
  C4::Context->set_userenv($usernum, $userid, $usercnum,
810
                           $userfirstname, $usersurname,
810
                           $userfirstname, $usersurname,
811
                           $userbranch, $branchname, $userflags,
811
                           $userbranch, $branchname, $userflags,
812
                           $emailaddress, $branchprinter, $shibboleth);
812
                           $emailaddress, $shibboleth);
813
813
814
Establish a hash of user environment variables.
814
Establish a hash of user environment variables.
815
815
Lines 820-826 set_userenv is called in Auth.pm Link Here
820
#'
820
#'
821
sub set_userenv {
821
sub set_userenv {
822
    shift @_;
822
    shift @_;
823
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $shibboleth)=
823
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $shibboleth)=
824
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
824
    map { Encode::is_utf8( $_ ) ? $_ : Encode::decode('UTF-8', $_) } # CGI::Session doesn't handle utf-8, so we decode it here
825
    @_;
825
    @_;
826
    my $var=$context->{"activeuser"} || '';
826
    my $var=$context->{"activeuser"} || '';
Lines 835-841 sub set_userenv { Link Here
835
        "branchname" => $branchname,
835
        "branchname" => $branchname,
836
        "flags"      => $userflags,
836
        "flags"      => $userflags,
837
        "emailaddress"     => $emailaddress,
837
        "emailaddress"     => $emailaddress,
838
        "branchprinter"    => $branchprinter,
839
        "shibboleth" => $shibboleth,
838
        "shibboleth" => $shibboleth,
840
    };
839
    };
841
    $context->{userenv}->{$var} = $cell;
840
    $context->{userenv}->{$var} = $cell;
(-)a/C4/InstallAuth.pm (-2 / +1 lines)
Lines 259-266 sub checkauth { Link Here
259
                $session->param('branch'),
259
                $session->param('branch'),
260
                $session->param('branchname'),
260
                $session->param('branchname'),
261
                $session->param('flags'),
261
                $session->param('flags'),
262
                $session->param('emailaddress'),
262
                $session->param('emailaddress')
263
                $session->param('branchprinter')
264
            );
263
            );
265
            $cookie = $query->cookie(
264
            $cookie = $query->cookie(
266
                -name     => 'CGISESSID',
265
                -name     => 'CGISESSID',
(-)a/C4/Koha.pm (-40 lines)
Lines 39-45 BEGIN { Link Here
39
	require Exporter;
39
	require Exporter;
40
	@ISA    = qw(Exporter);
40
	@ISA    = qw(Exporter);
41
	@EXPORT = qw(
41
	@EXPORT = qw(
42
        &GetPrinters &GetPrinter
43
        &GetItemTypesCategorized
42
        &GetItemTypesCategorized
44
        &getallthemes
43
        &getallthemes
45
        &getFacets
44
        &getFacets
Lines 276-320 sub getImageSets { Link Here
276
    return \@imagesets;
275
    return \@imagesets;
277
}
276
}
278
277
279
=head2 GetPrinters
280
281
  $printers = &GetPrinters();
282
  @queues = keys %$printers;
283
284
Returns information about existing printer queues.
285
286
C<$printers> is a reference-to-hash whose keys are the print queues
287
defined in the printers table of the Koha database. The values are
288
references-to-hash, whose keys are the fields in the printers table.
289
290
=cut
291
292
sub GetPrinters {
293
    my %printers;
294
    my $dbh = C4::Context->dbh;
295
    my $sth = $dbh->prepare("select * from printers");
296
    $sth->execute;
297
    while ( my $printer = $sth->fetchrow_hashref ) {
298
        $printers{ $printer->{'printqueue'} } = $printer;
299
    }
300
    return ( \%printers );
301
}
302
303
=head2 GetPrinter
304
305
  $printer = GetPrinter( $query, $printers );
306
307
=cut
308
309
sub GetPrinter {
310
    my ( $query, $printers ) = @_;    # get printer for this query from printers
311
    my $printer = $query->param('printer');
312
    my %cookie = $query->cookie('userenv');
313
    ($printer) || ( $printer = $cookie{'printer'} ) || ( $printer = '' );
314
    ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] );
315
    return $printer;
316
}
317
318
=head2 getnbpages
278
=head2 getnbpages
319
279
320
Returns the number of pages to display in a pagination bar, given the number
280
Returns the number of pages to display in a pagination bar, given the number
(-)a/C4/Print.pm (-103 lines)
Lines 1-103 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 Modern::Perl;
21
use C4::Context;
22
23
use vars qw(@ISA @EXPORT);
24
25
BEGIN {
26
	require Exporter;
27
	@ISA    = qw(Exporter);
28
    @EXPORT = qw(&NetworkPrint);
29
}
30
31
=head1 NAME
32
33
C4::Print - Koha module dealing with printing
34
35
=head1 SYNOPSIS
36
37
  use C4::Print;
38
39
=head1 DESCRIPTION
40
41
The functions in this module handle sending text to a printer.
42
43
=head1 FUNCTIONS
44
45
=head2 NetworkPrint
46
47
  &NetworkPrint($text)
48
49
Queue some text for printing on the selected branch printer
50
51
=cut
52
53
sub NetworkPrint {
54
    my ($text) = @_;
55
56
# FIXME - It'd be nifty if this could generate pretty PostScript.
57
58
    my $queue = '';
59
60
    # FIXME - If 'queue' is undefined or empty, then presumably it should
61
    # mean "use the default queue", whatever the default is. Presumably
62
    # the default depends on the physical location of the machine.
63
    # FIXME - Perhaps "print to file" should be a supported option. Just
64
    # set the queue to "file" (or " file", if real queues aren't allowed
65
    # to have spaces in them). Or perhaps if $queue eq "" and
66
    # $env->{file} ne "", then that should mean "print to $env->{file}".
67
68
    my $fh;
69
    if ( $queue eq "" || $queue eq 'nulllp' ) {
70
        return;
71
	#open( $fh, ">/tmp/kohaiss" );
72
    }
73
    else {
74
75
        # FIXME - This assumes that 'lpr' exists, and works as expected.
76
        # This is a reasonable assumption, but only because every other
77
        # printing package has a wrapper script called 'lpr'. It'd still
78
        # be better to be able to customize this.
79
        open( $fh, "-|", "lpr -P $queue > /dev/null" )
80
          or die "Couldn't write to queue:$queue!\n";
81
    }
82
83
    #  print $queue;
84
    #open (FILE,">/tmp/$file");
85
    print $fh $text;
86
    print $fh "\r\n" x 7 ;
87
    close $fh;
88
89
    #system("lpr /tmp/$file");
90
}
91
92
1;
93
__END__
94
95
=head1 AUTHOR
96
97
Koha Development Team <http://koha-community.org/>
98
99
=head1 SEE ALSO
100
101
C4::Circulation::Circ2(3)
102
103
=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 => '*'},
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 (-18 / +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 179-185 if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) { Link Here
179
}
178
}
180
my $issueconfirmed = $query->param('issueconfirmed');
179
my $issueconfirmed = $query->param('issueconfirmed');
181
my $cancelreserve  = $query->param('cancelreserve');
180
my $cancelreserve  = $query->param('cancelreserve');
182
my $print          = $query->param('print') || q{};
183
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
181
my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
184
my $charges        = $query->param('charges') || q{};
182
my $charges        = $query->param('charges') || q{};
185
183
Lines 215-225 if( $onsite_checkout && !$duedatespec_allow ) { Link Here
215
    }
213
    }
216
}
214
}
217
215
218
# check and see if we should print
219
if ( @$barcodes == 0 && $print eq 'maybe' ) {
220
    $print = 'yes';
221
}
222
223
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
216
my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
224
if ( @$barcodes == 0 && $charges eq 'yes' ) {
217
if ( @$barcodes == 0 && $charges eq 'yes' ) {
225
    $template->param(
218
    $template->param(
Lines 228-243 if ( @$barcodes == 0 && $charges eq 'yes' ) { Link Here
228
    );
221
    );
229
}
222
}
230
223
231
if ( $print eq 'yes' && $borrowernumber ne '' ) {
232
    if ( C4::Context->boolean_preference('printcirculationslips') ) {
233
        my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
234
        NetworkPrint($letter->{content});
235
    }
236
    $query->param( 'borrowernumber', '' );
237
    $borrowernumber = '';
238
    undef $patron;
239
}
240
241
#
224
#
242
# STEP 2 : FIND BORROWER
225
# STEP 2 : FIND BORROWER
243
# if there is a list of find borrowers....
226
# if there is a list of find borrowers....
(-)a/circ/returns.pl (-7 / +3 lines)
Lines 35-40 use CGI qw ( -utf8 ); Link Here
35
use DateTime;
35
use DateTime;
36
36
37
use C4::Auth qw/:DEFAULT get_session/;
37
use C4::Auth qw/:DEFAULT get_session/;
38
use C4::Output;
39
use C4::Circulation;
40
use C4::Reserves;
38
use C4::Biblio;
41
use C4::Biblio;
39
use C4::Circulation;
42
use C4::Circulation;
40
use C4::Context;
43
use C4::Context;
Lines 43-49 use C4::Koha; # FIXME : is it still useful ? Link Here
43
use C4::Members::Messaging;
46
use C4::Members::Messaging;
44
use C4::Members;
47
use C4::Members;
45
use C4::Output;
48
use C4::Output;
46
use C4::Print;
47
use C4::Reserves;
49
use C4::Reserves;
48
use C4::RotatingCollections;
50
use C4::RotatingCollections;
49
use Koha::AuthorisedValues;
51
use Koha::AuthorisedValues;
Lines 83-98 if ( $query->param('print_slip') ) { Link Here
83
85
84
#####################
86
#####################
85
#Global vars
87
#Global vars
86
my $printers = GetPrinters();
87
my $userenv = C4::Context->userenv;
88
my $userenv = C4::Context->userenv;
88
my $userenv_branch = $userenv->{'branch'} // '';
89
my $userenv_branch = $userenv->{'branch'} // '';
89
my $printer = $userenv->{'branchprinter'} // '';
90
my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire');
90
my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire');
91
91
92
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');
93
 #
94
# Some code to handle the error if there is no branch or printer setting.....
95
#
96
93
97
# Set up the item stack ....
94
# Set up the item stack ....
98
my %returneditems;
95
my %returneditems;
Lines 619-625 foreach ( sort { $a <=> $b } keys %returneditems ) { Link Here
619
616
620
$template->param(
617
$template->param(
621
    riloop         => \@riloop,
618
    riloop         => \@riloop,
622
    printer        => $printer,
623
    errmsgloop     => \@errmsgloop,
619
    errmsgloop     => \@errmsgloop,
624
    exemptfine     => $exemptfine,
620
    exemptfine     => $exemptfine,
625
    dropboxmode    => $dropboxmode,
621
    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 266-272 CREATE TABLE `branches` ( -- information about your libraries or branches are st Link Here
266
  `branchurl` LONGTEXT, -- the URL for your library or branch's website
266
  `branchurl` LONGTEXT, -- the URL for your library or branch's website
267
  `issuing` tinyint(4) default NULL, -- unused in Koha
267
  `issuing` tinyint(4) default NULL, -- unused in Koha
268
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
268
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
269
  `branchprinter` varchar(100) default NULL, -- unused in Koha
270
  `branchnotes` LONGTEXT, -- notes related to your library or branch
269
  `branchnotes` LONGTEXT, -- notes related to your library or branch
271
  opac_info MEDIUMTEXT, -- HTML that displays in OPAC
270
  opac_info MEDIUMTEXT, -- HTML that displays in OPAC
272
  `geolocation` VARCHAR(255) default NULL, -- geolocation of your library
271
  `geolocation` VARCHAR(255) default NULL, -- geolocation of your library
Lines 1239-1257 CREATE TABLE pending_offline_operations ( Link Here
1239
  PRIMARY KEY (operationid)
1238
  PRIMARY KEY (operationid)
1240
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1239
) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1241
1240
1242
1243
--
1244
-- Table structure for table `printers`
1245
--
1246
1247
DROP TABLE IF EXISTS `printers`;
1248
CREATE TABLE `printers` (
1249
  `printername` varchar(40) NOT NULL default '',
1250
  `printqueue` varchar(20) default NULL,
1251
  `printtype` varchar(20) default NULL,
1252
  PRIMARY KEY (`printername`)
1253
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1254
1255
--
1241
--
1256
-- Table structure for table `printers_profile`
1242
-- Table structure for table `printers_profile`
1257
--
1243
--
(-)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 501-507 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
501
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
501
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
502
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
502
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
503
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
503
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
504
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
505
('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'),
504
('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'),
506
('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'),
505
('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free'),
507
('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'),
506
('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 (-173 lines)
Lines 1-173 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
[% INCLUDE 'datatables.inc' %]
13
<script>
14
//<![CDATA[
15
    $(document).ready(function() {
16
        $("#printerst").dataTable($.extend(true, {}, dataTablesDefaults, {
17
            "aoColumnDefs": [
18
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
19
            ],
20
            "aaSorting": [[ 0, "asc" ]],
21
            "sPaginationType": "full"
22
        }));
23
    });
24
//]]>
25
</script>
26
[% END %]
27
</head>
28
<body id="admin_printers" class="admin">
29
[% INCLUDE 'header.inc' %]
30
[% INCLUDE 'cat-search.inc' %]
31
32
<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 %]
33
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
34
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Confirm deletion of printer '[% searchfield | html %]'[% END %]
35
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer deleted[% END %]
36
[% IF ( else ) %]Printers[% END %]</div>
37
38
<div class="main container-fluid">
39
    <div class="row">
40
        <div class="col-sm-10 col-sm-push-2">
41
            <main>
42
43
[% IF ( add_form ) %]
44
45
[% IF ( searchfield ) %]
46
		<h1>Modify printer</h1>
47
	[% ELSE %]
48
		<h1>New printer</h1>
49
	[% END %]
50
        <form action="[% script_name | html %]" name="Aform" method="post" class="validated">
51
        <input type="hidden" name="op" value="add_validate" />
52
	[% IF ( searchfield ) %]
53
		<input type="hidden" name="add" value="0" />
54
	[% ELSE %]
55
		<input type="hidden" name="add" value="1" />
56
	[% END %]
57
	<fieldset class="rows">
58
<ol>	[% IF ( searchfield ) %]
59
		<li>
60
            <span class="label">Printer name: </span>
61
				<input type="hidden" name="printername" id="" value="[% searchfield | html %]" />[% searchfield | html %]
62
		</li>
63
	[% ELSE %]
64
		<li>
65
            <label for="printername" class="required">Printer name: </label>
66
                <input type="text" name="printername" id="printername" size="40" maxlength="40" class="required" required="required" />
67
                <span class="required">Required</span>
68
		</li>
69
	[% END %]
70
        	<li>
71
            <label for="printqueue" class="required">Queue: </label>
72
            <input type="text" name="printqueue" id="printqueue" size="20" maxlength="20" value="[% printqueue | html %]"  class="required" required="required" />
73
            <span class="required">Required</span>
74
		</li>
75
        	<li>
76
			<label for="printtype">Type: </label>
77
            <input type="text" name="printtype" id="printtype" size="20" maxlength="20" value="[% printtype | html %]" />
78
		</li></ol>
79
        </fieldset>
80
        <fieldset class="action"><input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/printers.pl">Cancel</a></fieldset>
81
        </form>
82
83
[% END %]
84
85
[% IF ( add_validate ) %]
86
<h3>Printer added</h3>
87
<form action="[% script_name | html %]" method="post">
88
       <fieldset class="action"> <input type="submit" value="OK" /></fieldset>
89
</form>
90
[% END %]
91
92
[% IF ( delete_confirm ) %]
93
    <div class="dialog alert">
94
        <h3>Confirm deletion of printer <em>[% searchfield | html %]</em></h3>
95
96
        <table>
97
            <tr>
98
                <th scope="row">Printer: </th><td>[% searchfield | html %]</td>
99
            </tr>
100
            <tr>
101
                <th scope="row">Queue: </th><td>[% printqueue | html %]</td>
102
            </tr>
103
            <tr>
104
                <th scope="row">Type: </th><td>[% printtype | html %]</td>
105
            </tr>
106
        </table>
107
108
        <form action="[% script_name | html %]" method="post">
109
            <input type="hidden" name="op" value="delete_confirmed" />
110
            <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
111
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
112
        </form>
113
        <form action="/cgi-bin/koha/admin/printers.pl" method="get">
114
            <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
115
        </form>
116
    </div>
117
[% END %]
118
119
[% IF ( delete_confirmed ) %]
120
    <div class="dialog message">
121
        <h3>Printer deleted</h3>
122
        <form action="[% script_name | html %]" method="post">
123
            <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
124
        </form>
125
    </div>
126
127
[% END %]
128
129
[% IF ( else ) %]
130
131
<div id="toolbar" class="btn-toolbar">
132
    <a class="btn btn-default" id="newprinter" href="/cgi-bin/koha/admin/printers.pl?op=add_form"><i class="fa fa-plus"></i> New printer</a>
133
</div>
134
135
<h2>Printers</h2>
136
	[% IF ( searchfield ) %]
137
		You searched for [% searchfield | html %]</span>
138
	[% END %]
139
140
[% IF ( loop ) %]
141
    <table id="printerst">
142
        <thead>
143
            <tr>
144
                <th>Name</th>
145
                <th>Queue</th>
146
                <th>Type</th>
147
                <th>&nbsp;</th>
148
            </tr>
149
        </thead>
150
        <tbody>
151
		[% FOREACH loo IN loop %]
152
        <tr>
153
			<td>[% loo.printername | html %]</td>
154
			<td>[% loo.printqueue | html %]</td>
155
			<td>[% loo.printtype | html %]</td>
156
            <td class="actions"><a class="btn btn-default btn-xs" href="[% loo.script_name | url %]?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 | url %]?op=delete_confirm&amp;searchfield=[% loo.printername |uri %]"><i class="fa fa-trash"></i> Delete</a></td>
157
		</tr>
158
		[% END %]
159
        </tbody>
160
    </table>[% ELSE %]<div class="dialog message">No printers defined.</div>[% END %]
161
[% END %]
162
163
            </main>
164
        </div> <!-- /.col-sm-10.col-sm-push-2 -->
165
166
        <div class="col-sm-2 col-sm-pull-10">
167
            <aside>
168
                [% INCLUDE 'admin-menu.inc' %]
169
            </aside>
170
        </div> <!-- /.col-sm-2.col-sm-pull-10 -->
171
     </div> <!-- /.row -->
172
173
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-15 lines)
Lines 37-44 Updated:<ul> Link Here
37
    [% FOREACH update IN updated %]
37
    [% FOREACH update IN updated %]
38
    [% IF ( update.updated_branch ) %]
38
    [% IF ( update.updated_branch ) %]
39
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.LoginBranchcode or "?" | html %]</li>
39
        <li>Library: [% update.old_branch or "?" | html %] &rArr; [% update.LoginBranchcode or "?" | html %]</li>
40
    [% ELSIF ( update.updated_printer ) %]
41
      <!-- FIXME:  <li>Printer: [% update.old_printer or "?" | html %] &rArr; [% update.new_printer or "?" | html %]</li> -->
42
    [% ELSE %]
40
    [% ELSE %]
43
        <li>ERROR - unknown</li>
41
        <li>ERROR - unknown</li>
44
    [% END %]
42
    [% END %]
Lines 67-85 Updated:<ul> Link Here
67
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
65
            [% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
68
        </select></li>
66
        </select></li>
69
    [% END %]
67
    [% END %]
70
<!--
71
    [% IF ( printerloop ) %]
72
        <li><label for="printer">Choose a network printer:</label>
73
        <select name="printer" id="printer">
74
            [% FOREACH printerloo IN printerloop %]
75
                [% IF ( printerloo.selected ) %]
76
                    <option value="[% printerloo.value | html %]" selected="selected">[% printerloo.name | html %]</option>
77
                [% ELSE %]
78
                    <option value="[% printerloo.value | html %]">[% printerloo.name | html %]</option>
79
                [% END %]
80
            [% END %]
81
        </select></li>
82
    [% END %] -->
83
    </ol>
68
    </ol>
84
</fieldset>
69
</fieldset>
85
<fieldset class="action">
70
<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