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

(-)a/C4/Auth.pm (-10 / +39 lines)
Lines 28-33 require Exporter; Link Here
28
use C4::Context;
28
use C4::Context;
29
use C4::Templates;    # to get the template
29
use C4::Templates;    # to get the template
30
use C4::Branch; # GetBranches
30
use C4::Branch; # GetBranches
31
use C4::Printer qw(GetPrinterDetails);
31
use C4::VirtualShelves;
32
use C4::VirtualShelves;
32
use POSIX qw/strftime/;
33
use POSIX qw/strftime/;
33
use List::MoreUtils qw/ any /;
34
use List::MoreUtils qw/ any /;
Lines 46-52 BEGIN { Link Here
46
    $debug       = $ENV{DEBUG};
47
    $debug       = $ENV{DEBUG};
47
    @ISA         = qw(Exporter);
48
    @ISA         = qw(Exporter);
48
    @EXPORT      = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions);
49
    @EXPORT      = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions);
49
    @EXPORT_OK   = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &get_all_subpermissions &get_user_subpermissions);
50
    @EXPORT_OK   = qw(&check_api_auth &get_session &check_cookie_auth &checkpw
51
                      &get_all_subpermissions &get_user_subpermissions &get_user_printer);
50
    %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] );
52
    %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] );
51
    $ldap        = C4::Context->config('useldapserver') || 0;
53
    $ldap        = C4::Context->config('useldapserver') || 0;
52
    $cas         = C4::Context->preference('casAuthentication');
54
    $cas         = C4::Context->preference('casAuthentication');
Lines 311-316 sub get_template_and_user { Link Here
311
        $template->param(dateformat_iso => 1);
313
        $template->param(dateformat_iso => 1);
312
    }
314
    }
313
315
316
    my $userenv = C4::Context->userenv;
317
    my $userenv_branch = $userenv ? $userenv->{"branch"} : undef;
318
314
    # these template parameters are set the same regardless of $in->{'type'}
319
    # these template parameters are set the same regardless of $in->{'type'}
315
    $template->param(
320
    $template->param(
316
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
321
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
Lines 318-326 sub get_template_and_user { Link Here
318
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
323
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
319
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
324
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
320
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
325
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
321
            LoginBranchcode              => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
326
            LoginBranchcode              => ($userenv?$userenv_branch:"insecure"),
322
            LoginFirstname               => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
327
            LoginFirstname               => ($userenv?$userenv->{"firstname"}:"Bel"),
323
            LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
328
            LoginSurname                 => $userenv?$userenv->{"surname"}:"Inconnu",
324
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
329
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
325
            hide_marc                    => C4::Context->preference("hide_marc"),
330
            hide_marc                    => C4::Context->preference("hide_marc"),
326
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
331
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
Lines 345-351 sub get_template_and_user { Link Here
345
            IntranetNav                 => C4::Context->preference("IntranetNav"),
350
            IntranetNav                 => C4::Context->preference("IntranetNav"),
346
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
351
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
347
            LibraryName                 => C4::Context->preference("LibraryName"),
352
            LibraryName                 => C4::Context->preference("LibraryName"),
348
            LoginBranchname             => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
353
            LoginBranchname             => ($userenv?$userenv->{"branchname"}:"insecure"),
349
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
354
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
350
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
355
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
351
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
356
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
Lines 365-370 sub get_template_and_user { Link Here
365
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
370
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
366
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
371
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
367
        );
372
        );
373
        if ( C4::Context->preference('UsePrintQueues') ) {
374
            my $printer = get_user_printer();
375
            my $printer_rec = $printer ? GetPrinterDetails($printer) : {};
376
            $template->param(
377
                UsePrintQueues          => 1,
378
                PrinterName             => $printer_rec->{printername},
379
            );
380
        }
368
    }
381
    }
369
    else {
382
    else {
370
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
383
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
Lines 383-390 sub get_template_and_user { Link Here
383
        my $opac_name = '';
396
        my $opac_name = '';
384
        if (($opac_search_limit && $opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/)){
397
        if (($opac_search_limit && $opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/)){
385
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
398
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
386
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
399
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && $userenv_branch) {
387
            $opac_name = C4::Context->userenv->{'branch'};
400
            $opac_name = $userenv_branch
388
        }
401
        }
389
        $template->param(
402
        $template->param(
390
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
403
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
Lines 394-400 sub get_template_and_user { Link Here
394
            CalendarFirstDayOfWeek      => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
407
            CalendarFirstDayOfWeek      => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
395
            LibraryName               => "" . C4::Context->preference("LibraryName"),
408
            LibraryName               => "" . C4::Context->preference("LibraryName"),
396
            LibraryNameTitle          => "" . $LibraryNameTitle,
409
            LibraryNameTitle          => "" . $LibraryNameTitle,
397
            LoginBranchname           => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
410
            LoginBranchname           => $userenv?$userenv->{"branchname"}:"",
398
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
411
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
399
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
412
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
400
            OpacHighlightedWords       => C4::Context->preference("OpacHighlightedWords"),
413
            OpacHighlightedWords       => C4::Context->preference("OpacHighlightedWords"),
Lines 429-435 sub get_template_and_user { Link Here
429
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
442
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
430
            'Version'                 => C4::Context->preference('Version'),
443
            'Version'                 => C4::Context->preference('Version'),
431
            hidelostitems             => C4::Context->preference("hidelostitems"),
444
            hidelostitems             => C4::Context->preference("hidelostitems"),
432
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '',
445
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && $userenv) ? $userenv_branch : '',
433
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
446
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
434
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
447
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
435
            opaccredits               => "" . C4::Context->preference("opaccredits"),
448
            opaccredits               => "" . C4::Context->preference("opaccredits"),
Lines 1656-1663 sub getborrowernumber { Link Here
1656
    return 0;
1669
    return 0;
1657
}
1670
}
1658
1671
1672
=head2 get_user_printer
1673
1674
  $printer = get_user_printer();
1675
1676
  Returns printer queue that is to be used for the logged in user
1677
1678
=cut
1679
1680
sub get_user_printer {
1681
    my $userenv = C4::Context->userenv or return;
1682
    if (my $printer = $userenv->{branchprinter}) {
1683
        return $printer;
1684
    }
1685
    my $branchname = $userenv->{branch} or return;
1686
    my $branch = GetBranchDetail($branchname) or return;
1687
    return $branch->{branchprinter};
1688
}
1659
1689
1660
END { }    # module clean-up code here (global destructor)
1661
1;
1690
1;
1662
__END__
1691
__END__
1663
1692
(-)a/C4/Context.pm (-1 / +1 lines)
Lines 1057-1063 sub userenv { Link Here
1057
=head2 set_userenv
1057
=head2 set_userenv
1058
1058
1059
  C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, 
1059
  C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, 
1060
                  $usersurname, $userbranch, $userflags, $emailaddress);
1060
                  $usersurname, $userbranch, $userflags, $emailaddress, $branchprinter);
1061
1061
1062
Establish a hash of user environment variables.
1062
Establish a hash of user environment variables.
1063
1063
(-)a/C4/Koha.pm (-40 lines)
Lines 39-45 BEGIN { Link Here
39
	@EXPORT = qw(
39
	@EXPORT = qw(
40
		&slashifyDate
40
		&slashifyDate
41
		&subfield_is_koha_internal_p
41
		&subfield_is_koha_internal_p
42
		&GetPrinters &GetPrinter
43
		&GetItemTypes &getitemtypeinfo
42
		&GetItemTypes &getitemtypeinfo
44
		&GetCcodes
43
		&GetCcodes
45
		&GetSupportName &GetSupportList
44
		&GetSupportName &GetSupportList
Lines 600-644 sub getImageSets { Link Here
600
    return \@imagesets;
599
    return \@imagesets;
601
}
600
}
602
601
603
=head2 GetPrinters
604
605
  $printers = &GetPrinters();
606
  @queues = keys %$printers;
607
608
Returns information about existing printer queues.
609
610
C<$printers> is a reference-to-hash whose keys are the print queues
611
defined in the printers table of the Koha database. The values are
612
references-to-hash, whose keys are the fields in the printers table.
613
614
=cut
615
616
sub GetPrinters {
617
    my %printers;
618
    my $dbh = C4::Context->dbh;
619
    my $sth = $dbh->prepare("select * from printers");
620
    $sth->execute;
621
    while ( my $printer = $sth->fetchrow_hashref ) {
622
        $printers{ $printer->{'printqueue'} } = $printer;
623
    }
624
    return ( \%printers );
625
}
626
627
=head2 GetPrinter
628
629
  $printer = GetPrinter( $query, $printers );
630
631
=cut
632
633
sub GetPrinter {
634
    my ( $query, $printers ) = @_;    # get printer for this query from printers
635
    my $printer = $query->param('printer');
636
    my %cookie = $query->cookie('userenv');
637
    ($printer) || ( $printer = $cookie{'printer'} ) || ( $printer = '' );
638
    ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] );
639
    return $printer;
640
}
641
642
=head2 getnbpages
602
=head2 getnbpages
643
603
644
Returns the number of pages to display in a pagination bar, given the number
604
Returns the number of pages to display in a pagination bar, given the number
(-)a/C4/Printer.pm (+148 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
package C4::Printer;
4
5
# Copyright 2012 Catalyst IT
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it under the
10
# terms of the GNU General Public License as published by the Free Software
11
# Foundation; either version 2 of the License, or (at your option) any later
12
# version.
13
#
14
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License along
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22
use strict;
23
use warnings;
24
25
use C4::Context;
26
27
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
28
29
BEGIN {
30
    $VERSION = 3.07.00.049;
31
    require Exporter;
32
    @ISA    = qw(Exporter);
33
    @EXPORT = qw(
34
    );
35
    @EXPORT_OK = qw(
36
        &GetPrinters &SearchPrinters &GetPrinterDetails
37
        &AddPrinter &UpdatePrinter &DeletePrinter
38
    );
39
}
40
41
=head1 NAME
42
43
C4::Printer - functions that deal with printer selection
44
45
=head1 SYNOPSIS
46
47
  use C4::Printer;
48
49
=head1 DESCRIPTION
50
51
This module provides functions to select printer for slips etc.
52
53
TODO: Move SQL from admin/printers.pl to this module
54
55
=head1 FUNCTIONS
56
57
=head2 GetPrinters
58
59
  $printers = &GetPrinters();
60
  @queues = keys %$printers;
61
62
Returns information about existing printer queues.
63
64
C<$printers> is a reference-to-hash whose keys are the print queues
65
defined in the printers table of the Koha database. The values are
66
references-to-hash, whose keys are the fields in the printers table.
67
68
=cut
69
70
sub GetPrinters {
71
    my %printers;
72
    my $dbh = C4::Context->dbh;
73
    my $sth = $dbh->prepare("select * from printers");
74
    $sth->execute;
75
    while ( my $printer = $sth->fetchrow_hashref ) {
76
        $printers{ $printer->{'printqueue'} } = $printer;
77
    }
78
    return ( \%printers );
79
}
80
81
=head2 SearchPrinters
82
83
  $printers = SearchPrinters( $searchstring );
84
85
=cut
86
87
sub SearchPrinters {
88
    my ($searchstring)=@_;
89
    $searchstring .= '%';
90
    return C4::Context->dbh->selectall_arrayref("
91
        SELECT * FROM printers 
92
        WHERE printername like ? OR printqueue like ? ORDER BY printername
93
        ", {Slice => {}}, $searchstring, $searchstring);
94
}
95
96
=head2 GetPrinterDetails
97
98
  $printer_rec = GetPrinterDetails( $printqueue );
99
100
=cut
101
102
sub GetPrinterDetails {
103
    my ( $printer ) = @_;
104
    my $dbh = C4::Context->dbh;
105
    my $printername = $dbh->selectrow_hashref('SELECT * FROM printers WHERE printqueue = ?', undef, $printer);
106
    return $printername;
107
}
108
109
=head2 AddPrinter
110
111
  AddPrinter( $data );
112
113
=cut
114
115
sub AddPrinter {
116
    my ( $data ) = @_;
117
    my $dbh = C4::Context->dbh;
118
    $dbh->do("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)", undef,
119
        $data->{printername}, $data->{printqueue}, $data->{printtype});
120
}
121
122
=head2 UpdatePrinter
123
124
  UpdatePrinter( $printqueue, $data );
125
126
=cut
127
128
sub UpdatePrinter {
129
    my ( $printqueue, $data ) = @_;
130
    my $dbh = C4::Context->dbh;
131
    $dbh->do("UPDATE printers SET printqueue = ?, printername = ?, printtype = ? WHERE printqueue = ?", undef,
132
        $data->{printqueue}, $data->{printername}, $data->{printtype}, $printqueue);
133
}
134
135
=head2 DeletePrinter
136
137
  DeletePrinter( $printqueue );
138
139
=cut
140
141
sub DeletePrinter {
142
    my ( $printqueue ) = @_;
143
    my $dbh = C4::Context->dbh;
144
    $dbh->do("DELETE FROM printers WHERE printqueue = ?", undef,
145
        $printqueue);
146
}
147
148
1;
(-)a/admin/branches.pl (-11 / +19 lines)
Lines 45-50 use C4::Context; Link Here
45
use C4::Output;
45
use C4::Output;
46
use C4::Koha;
46
use C4::Koha;
47
use C4::Branch;
47
use C4::Branch;
48
use C4::Printer qw(GetPrinters);
48
49
49
# Fixed variables
50
# Fixed variables
50
my $script_name = "/cgi-bin/koha/admin/branches.pl";
51
my $script_name = "/cgi-bin/koha/admin/branches.pl";
Lines 226-237 sub default { Link Here
226
227
227
sub editbranchform {
228
sub editbranchform {
228
    my ($branchcode,$innertemplate) = @_;
229
    my ($branchcode,$innertemplate) = @_;
229
    # initiate the scrolling-list to select the printers
230
230
    my $printers = GetPrinters();
231
    my @printerloop;
232
    my $data;
231
    my $data;
233
    my $oldprinter = "";
232
    my $oldprinter = "";
234
235
    if ($branchcode) {
233
    if ($branchcode) {
236
        $data = GetBranchInfo($branchcode);
234
        $data = GetBranchInfo($branchcode);
237
        $data = $data->[0];
235
        $data = $data->[0];
Lines 241-255 sub editbranchform { Link Here
241
        _branch_to_template($data, $innertemplate);
239
        _branch_to_template($data, $innertemplate);
242
    }
240
    }
243
241
244
    foreach my $thisprinter ( keys %$printers ) {
242
    if ( C4::Context->preference('UsePrintQueues') ) {
245
        push @printerloop, {
243
        # initiate the scrolling-list to select the printers
246
            value         => $thisprinter,
244
        my $printers = GetPrinters();
247
            selected      => ( $oldprinter eq $printers->{$thisprinter} ),
245
        my @printerloop;
248
            branchprinter => $printers->{$thisprinter}->{'printqueue'},
246
        foreach my $thisprinter ( keys %$printers ) {
249
        };
247
            push @printerloop, {
248
                value         => $thisprinter,
249
                selected      => ( $oldprinter eq $thisprinter ),
250
                branchprinter => $printers->{$thisprinter}->{'printername'},
251
            };
252
        }
253
254
        $innertemplate->param( printerloop => \@printerloop );
250
    }
255
    }
251
256
252
    $innertemplate->param( printerloop => \@printerloop );
253
    # make the checkboxes.....
257
    # make the checkboxes.....
254
    #
258
    #
255
    # We export a "categoryloop" array to the template, each element of which
259
    # We export a "categoryloop" array to the template, each element of which
Lines 308-313 sub branchinfotable { Link Here
308
312
309
    my ($branchcode,$innertemplate) = @_;
313
    my ($branchcode,$innertemplate) = @_;
310
    my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
314
    my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
315
    my $printers = GetPrinters();
311
    my @loop_data = ();
316
    my @loop_data = ();
312
    foreach my $branch (@$branchinfo) {
317
    foreach my $branch (@$branchinfo) {
313
        #
318
        #
Lines 367-372 sub branchinfotable { Link Here
367
        $row{'branch_name'} = $branch->{'branchname'};
372
        $row{'branch_name'} = $branch->{'branchname'};
368
        $row{'branch_code'} = $branch->{'branchcode'};
373
        $row{'branch_code'} = $branch->{'branchcode'};
369
        $row{'value'}       = $branch->{'branchcode'};
374
        $row{'value'}       = $branch->{'branchcode'};
375
        if (my $printer = $branch->{'branchprinter'}) {
376
            $row{'branchprintername'} = $printers->{$printer}->{'printername'};
377
        }
370
378
371
        push @loop_data, \%row;
379
        push @loop_data, \%row;
372
    }
380
    }
(-)a/admin/printers.pl (-76 / +76 lines)
Lines 7-23 Link Here
7
# ALGO :
7
# ALGO :
8
# this script use an $op to know what to do.
8
# this script use an $op to know what to do.
9
# if $op is empty or none of the above values,
9
# if $op is empty or none of the above values,
10
#	- the default screen is build (with all records, or filtered datas).
10
#    - the default screen is build (with all records, or filtered datas).
11
#	- the   user can clic on add, modify or delete record.
11
#    - the   user can clic on add, modify or delete record.
12
# if $op=add_form
12
# if $op=add_form
13
#	- if primkey exists, this is a modification,so we read the $primkey record
13
#    - if primkey exists, this is a modification,so we read the $primkey record
14
#	- builds the add/modify form
14
#    - builds the add/modify form
15
# if $op=add_validate
15
# if $op=add_validate
16
#	- the user has just send datas, so we create/modify the record
16
#    - the user has just send datas, so we create/modify the record
17
# if $op=delete_form
17
# if $op=delete_form
18
#	- we show the record having primkey=$primkey and ask for deletion validation form
18
#    - we show the record having primkey=$primkey and ask for deletion validation form
19
# if $op=delete_confirm
19
# if $op=delete_confirm
20
#	- we delete the record having primkey=$primkey
20
#    - we delete the record having primkey=$primkey
21
21
22
22
23
# Copyright 2000-2002 Katipo Communications
23
# Copyright 2000-2002 Katipo Communications
Lines 43-61 use CGI; Link Here
43
use C4::Context;
43
use C4::Context;
44
use C4::Output;
44
use C4::Output;
45
use C4::Auth;
45
use C4::Auth;
46
46
use C4::Printer qw(GetPrinterDetails SearchPrinters AddPrinter UpdatePrinter DeletePrinter);
47
sub StringSearch  {
48
	my ($searchstring,$type)=@_;		# why bother with $type if we don't use it?!
49
	$searchstring=~ s/\'/\\\'/g;
50
	my @data=split(' ',$searchstring);
51
	my $sth = C4::Context->dbh->prepare("
52
		SELECT printername,printqueue,printtype from printers 
53
		WHERE (printername like ?) order by printername
54
	");
55
	$sth->execute("$data[0]%");
56
	my $data=$sth->fetchall_arrayref({});
57
	return (scalar(@$data),$data);
58
}
59
47
60
my $input = new CGI;
48
my $input = new CGI;
61
my $searchfield=$input->param('searchfield');
49
my $searchfield=$input->param('searchfield');
Lines 68-150 my $op = $input->param('op'); Link Here
68
$searchfield=~ s/\,//g;
56
$searchfield=~ s/\,//g;
69
57
70
my ($template, $loggedinuser, $cookie) = get_template_and_user({
58
my ($template, $loggedinuser, $cookie) = get_template_and_user({
71
	   template_name => "admin/printers.tmpl",
59
       template_name => "admin/printers.tmpl",
72
			   query => $input,
60
               query => $input,
73
			 	type => "intranet",
61
                type => "intranet",
74
	 authnotrequired => 0,
62
     authnotrequired => 0,
75
       flagsrequired => {parameters => 'parameters_remaining_permissions'},
63
       flagsrequired => {parameters => 'parameters_remaining_permissions'},
76
		       debug => 1,
64
               debug => 1,
77
});
65
});
78
66
79
$template->param(searchfield => $searchfield,
80
		 script_name => $script_name);
81
82
#start the page and read in includes
67
#start the page and read in includes
83
68
84
my $dbh = C4::Context->dbh;
69
my $dbh = C4::Context->dbh;
70
my $list_printers = 1;
85
################## ADD_FORM ##################################
71
################## ADD_FORM ##################################
86
# called by default. Used to create form to add or  modify a record
72
# called by default. Used to create form to add or  modify a record
87
if ($op eq 'add_form') {
73
if ($op eq 'add_form') {
88
	$template->param(add_form => 1);
74
    $list_printers = 0;
89
	#---- if primkey exists, it's a modify action, so read values to modify...
75
    $template->param(add_form => 1);
90
	my $data;
76
    #---- if primkey exists, it's a modify action, so read values to modify...
91
	if ($searchfield) {
77
    my $data;
92
		my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?");
78
    if ($searchfield) {
93
		$sth->execute($searchfield);
79
        $data=GetPrinterDetails($searchfield);
94
		$data=$sth->fetchrow_hashref;
80
    }
95
	}
81
96
82
    $template->param(
97
	$template->param(printqueue => $data->{'printqueue'},
83
        printqueue => $data->{'printqueue'},
98
			 printtype => $data->{'printtype'});
84
        printername => $data->{'printername'},
99
													# END $OP eq ADD_FORM
85
        printtype => $data->{'printtype'}
86
    );
87
# END $OP eq ADD_FORM
100
################## ADD_VALIDATE ##################################
88
################## ADD_VALIDATE ##################################
101
# called by add_form, used to insert/modify data in DB
89
# called by add_form, used to insert/modify data in DB
102
} elsif ($op eq 'add_validate') {
90
} elsif ($op eq 'add_validate') {
103
	$template->param(add_validate => 1);
91
    my $params = $input->Vars;
104
	if ($input->param('add')){
92
    if ($input->param('add')){
105
		my $sth=$dbh->prepare("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)");
93
        AddPrinter($params);
106
		$sth->execute($input->param('printername'),$input->param('printqueue'),$input->param('printtype'));
94
    } else {
107
	} else {
95
        UpdatePrinter($searchfield, $params);
108
		my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?");
96
    }
109
		$sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername'));
97
    $template->param(add_validate => 1);
110
	}
98
    $searchfield = '';
111
													# END $OP eq ADD_VALIDATE
99
# END $OP eq ADD_VALIDATE
112
################## DELETE_CONFIRM ##################################
100
################## DELETE_CONFIRM ##################################
113
# called by default form, used to confirm deletion of data in DB
101
# called by default form, used to confirm deletion of data in DB
114
} elsif ($op eq 'delete_confirm') {
102
} elsif ($op eq 'delete_confirm') {
115
	$template->param(delete_confirm => 1);
103
    $list_printers = 0;
116
	my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?");
104
    $template->param(delete_confirm => 1);
117
	$sth->execute($searchfield);
105
    my $data=GetPrinterDetails($searchfield);
118
	my $data=$sth->fetchrow_hashref;
106
    $template->param(
119
	$template->param(printqueue => $data->{'printqueue'},
107
        printqueue => $data->{'printqueue'},
120
			 printtype  => $data->{'printtype'});
108
        printtype  => $data->{'printtype'},
121
													# END $OP eq DELETE_CONFIRM
109
    );
110
# END $OP eq DELETE_CONFIRM
122
################## DELETE_CONFIRMED ##################################
111
################## DELETE_CONFIRMED ##################################
123
# called by delete_confirm, used to effectively confirm deletion of data in DB
112
# called by delete_confirm, used to effectively confirm deletion of data in DB
124
} elsif ($op eq 'delete_confirmed') {
113
} elsif ($op eq 'delete_confirmed') {
125
	$template->param(delete_confirmed => 1);
114
    # XXX Delete can fail
126
	my $sth=$dbh->prepare("delete from printers where printername=?");
115
    DeletePrinter($searchfield);
127
	$sth->execute($searchfield);
116
    $template->param(delete_confirmed => 1);
128
													# END $OP eq DELETE_CONFIRMED
117
    $template->param(list_printers => 1);
118
    $searchfield = '';
119
# END $OP eq DELETE_CONFIRMED
129
################## DEFAULT ###########################################
120
################## DEFAULT ###########################################
130
} else { # DEFAULT
121
} else { # DEFAULT
131
	$template->param(else => 1);
122
    $searchfield ||= $input->param('description') || "";
132
	my ($count,$results)=StringSearch($searchfield,'web');
133
	my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
134
	my @loop = (@$results)[$offset..$max];
135
	
136
	$template->param(loop => \@loop);
137
	
138
	if ($offset>0) {
139
		$template->param(offsetgtzero => 1,
140
				 prevpage => $offset-$pagesize);
141
	}
142
	if ($offset+$pagesize<$count) {
143
		$template->param(ltcount => 1,
144
				 nextpage => $offset+$pagesize);
145
	}
146
147
} #---- END $OP eq DEFAULT
123
} #---- END $OP eq DEFAULT
148
124
125
if ($list_printers) {
126
    $template->param(list_printers => 1);
127
    my $results=SearchPrinters($searchfield);
128
    my $count = $results ? scalar(@$results) : 0;
129
    my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
130
    my @loop = (@$results)[$offset..$max-1];
131
    
132
    $template->param(loop => \@loop);
133
    
134
    if ($offset>0) {
135
        $template->param(offsetgtzero => 1,
136
                 prevpage => $offset-$pagesize);
137
    }
138
    if ($offset+$pagesize<$count) {
139
        $template->param(ltcount => 1,
140
                 nextpage => $offset+$pagesize);
141
    }
142
}
143
144
$template->param(
145
    searchfield => $searchfield,
146
    script_name => $script_name
147
);
148
149
output_html_with_http_headers $input, $cookie, $template->output;
149
output_html_with_http_headers $input, $cookie, $template->output;
150
150
(-)a/circ/circulation.pl (-11 / +1 lines)
Lines 29-35 use C4::Print; Link Here
29
use C4::Auth qw/:DEFAULT get_session/;
29
use C4::Auth qw/:DEFAULT get_session/;
30
use C4::Dates qw/format_date/;
30
use C4::Dates qw/format_date/;
31
use C4::Branch; # GetBranches
31
use C4::Branch; # GetBranches
32
use C4::Koha;   # GetPrinter
32
use C4::Koha;
33
use C4::Circulation;
33
use C4::Circulation;
34
use C4::Overdues qw/CheckBorrowerDebarred/;
34
use C4::Overdues qw/CheckBorrowerDebarred/;
35
use C4::Members;
35
use C4::Members;
Lines 67-78 if ($branch){ Link Here
67
    $session->param('branchname', GetBranchName($branch));
67
    $session->param('branchname', GetBranchName($branch));
68
}
68
}
69
69
70
my $printer = $query->param('printer');
71
if ($printer){
72
    # update our session so the userenv is updated
73
    $session->param('branchprinter', $printer);
74
}
75
76
if (!C4::Context->userenv && !$branch){
70
if (!C4::Context->userenv && !$branch){
77
    if ($session->param('branch') eq 'NO_LIBRARY_SET'){
71
    if ($session->param('branch') eq 'NO_LIBRARY_SET'){
78
        # no branch set we can't issue
72
        # no branch set we can't issue
Lines 106-113 $findborrower =~ s|,| |g; Link Here
106
my $borrowernumber = $query->param('borrowernumber');
100
my $borrowernumber = $query->param('borrowernumber');
107
101
108
$branch  = C4::Context->userenv->{'branch'};  
102
$branch  = C4::Context->userenv->{'branch'};  
109
$printer = C4::Context->userenv->{'branchprinter'};
110
111
103
112
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
104
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
113
if (C4::Context->preference("AutoLocation") != 1) {
105
if (C4::Context->preference("AutoLocation") != 1) {
Lines 670-677 $template->param( Link Here
670
    borrowernumber    => $borrowernumber,
662
    borrowernumber    => $borrowernumber,
671
    branch            => $branch,
663
    branch            => $branch,
672
    branchname        => GetBranchName($borrower->{'branchcode'}),
664
    branchname        => GetBranchName($borrower->{'branchcode'}),
673
    printer           => $printer,
674
    printername       => $printer,
675
    firstname         => $borrower->{'firstname'},
665
    firstname         => $borrower->{'firstname'},
676
    surname           => $borrower->{'surname'},
666
    surname           => $borrower->{'surname'},
677
    showname          => $borrower->{'showname'},
667
    showname          => $borrower->{'showname'},
(-)a/circ/returns.pl (-8 lines)
Lines 36-42 use C4::Context; Link Here
36
use C4::Auth qw/:DEFAULT get_session/;
36
use C4::Auth qw/:DEFAULT get_session/;
37
use C4::Output;
37
use C4::Output;
38
use C4::Circulation;
38
use C4::Circulation;
39
use C4::Print;
40
use C4::Reserves;
39
use C4::Reserves;
41
use C4::Biblio;
40
use C4::Biblio;
42
use C4::Items;
41
use C4::Items;
Lines 73-87 my ( $template, $librarian, $cookie ) = get_template_and_user( Link Here
73
#####################
72
#####################
74
#Global vars
73
#Global vars
75
my $branches = GetBranches();
74
my $branches = GetBranches();
76
my $printers = GetPrinters();
77
75
78
my $printer = C4::Context->userenv ? C4::Context->userenv->{'branchprinter'} : "";
79
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
76
my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
80
77
81
my $userenv_branch = C4::Context->userenv->{'branch'} || '';
78
my $userenv_branch = C4::Context->userenv->{'branch'} || '';
82
#
83
# Some code to handle the error if there is no branch or printer setting.....
84
#
85
79
86
# Set up the item stack ....
80
# Set up the item stack ....
87
my %returneditems;
81
my %returneditems;
Lines 529-537 foreach ( sort { $a <=> $b } keys %returneditems ) { Link Here
529
$template->param(
523
$template->param(
530
    riloop         => \@riloop,
524
    riloop         => \@riloop,
531
    genbrname      => $branches->{$userenv_branch}->{'branchname'},
525
    genbrname      => $branches->{$userenv_branch}->{'branchname'},
532
    genprname      => $printers->{$printer}->{'printername'},
533
    branchname     => $branches->{$userenv_branch}->{'branchname'},
526
    branchname     => $branches->{$userenv_branch}->{'branchname'},
534
    printer        => $printer,
535
    errmsgloop     => \@errmsgloop,
527
    errmsgloop     => \@errmsgloop,
536
    exemptfine     => $exemptfine,
528
    exemptfine     => $exemptfine,
537
    dropboxmode    => $dropboxmode,
529
    dropboxmode    => $dropboxmode,
(-)a/circ/selectbranchprinter.pl (-21 / +28 lines)
Lines 23-32 use CGI; Link Here
23
23
24
use C4::Context;
24
use C4::Context;
25
use C4::Output;
25
use C4::Output;
26
use C4::Auth qw/:DEFAULT get_session/;
26
use C4::Auth qw/:DEFAULT get_session get_user_printer/;
27
use C4::Print;  # GetPrinters
28
use C4::Koha;
27
use C4::Koha;
29
use C4::Branch; # GetBranches GetBranchesLoop
28
use C4::Branch; # GetBranches GetBranchesLoop
29
use C4::Printer qw(GetPrinters);
30
30
31
# this will be the script that chooses branch and printer settings....
31
# this will be the script that chooses branch and printer settings....
32
32
Lines 56-64 my $userenv_printer = C4::Context->userenv->{'branchprinter'} || ''; Link Here
56
my @updated;
56
my @updated;
57
57
58
# $session lddines here are doing the updating
58
# $session lddines here are doing the updating
59
if ($branch and $branches->{$branch}) {
59
my $branch_rec = $branch ? $branches->{$branch} : undef;
60
if ($branch_rec) {
60
    if (! $userenv_branch or $userenv_branch ne $branch ) {
61
    if (! $userenv_branch or $userenv_branch ne $branch ) {
61
        my $branchname = GetBranchName($branch);
62
        my $branchname = $branch_rec->{branchname};
62
        $template->param(LoginBranchname => $branchname);   # update template for new branch
63
        $template->param(LoginBranchname => $branchname);   # update template for new branch
63
        $template->param(LoginBranchcode => $branch);       # update template for new branch
64
        $template->param(LoginBranchcode => $branch);       # update template for new branch
64
        $session->param('branchname', $branchname);         # update sesssion in DB
65
        $session->param('branchname', $branchname);         # update sesssion in DB
Lines 67-72 if ($branch and $branches->{$branch}) { Link Here
67
            updated_branch => 1,
68
            updated_branch => 1,
68
                old_branch => $userenv_branch,
69
                old_branch => $userenv_branch,
69
        };
70
        };
71
        $printer ||= $branch_rec->{branchprinter};
72
        undef $userenv_printer;
70
    } # else branch the same, no update
73
    } # else branch the same, no update
71
} else {
74
} else {
72
    $branch = $userenv_branch;  # fallback value
75
    $branch = $userenv_branch;  # fallback value
Lines 87-93 if ($printer) { Link Here
87
        };
90
        };
88
    } # else printer is the same, no update
91
    } # else printer is the same, no update
89
} else {
92
} else {
90
    $printer = $userenv_printer;  # fallback value
93
    $printer = get_user_printer();  # fallback value
91
}
94
}
92
95
93
$template->param(updated => \@updated) if (scalar @updated);
96
$template->param(updated => \@updated) if (scalar @updated);
Lines 96-116 unless ($branches->{$branch}) { Link Here
96
    $branch = (keys %$branches)[0];  # if branch didn't really exist, then replace it w/ one that does
99
    $branch = (keys %$branches)[0];  # if branch didn't really exist, then replace it w/ one that does
97
}
100
}
98
101
99
my @printkeys = sort keys %$printers;
100
if (scalar(@printkeys) == 1 or not $printers->{$printer}) {
101
    $printer = $printkeys[0];   # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does
102
}
103
104
my @printerloop;
105
foreach ( @printkeys ) {
106
    next unless ($_); # skip printer if blank.
107
    push @printerloop, {
108
        selected => ( $_ eq $printer ),
109
        name     => $printers->{$_}->{'printername'},
110
        value    => $_,
111
    };
112
}
113
114
my @recycle_loop;
102
my @recycle_loop;
115
foreach ($query->param()) {
103
foreach ($query->param()) {
116
    $_ or next;                   # disclude blanks
104
    $_ or next;                   # disclude blanks
Lines 133-141 if (scalar @updated and not scalar @recycle_loop) { Link Here
133
121
134
$template->param(
122
$template->param(
135
    referer     => $referer,
123
    referer     => $referer,
136
    printerloop => \@printerloop,
137
    branchloop  => GetBranchesLoop($branch),
124
    branchloop  => GetBranchesLoop($branch),
138
    recycle_loop=> \@recycle_loop,
125
    recycle_loop=> \@recycle_loop,
139
);
126
);
140
127
128
if ( C4::Context->preference('UsePrintQueues') ) {
129
    my @printkeys = keys %$printers;
130
    if (scalar(@printkeys) == 1 or not $printers->{$printer}) {
131
        $printer = $printkeys[0];   # if printer didn't really exist, or there is only 1 anyway, then replace it w/ one that does
132
    }
133
134
    my @printerloop;
135
    foreach ( @printkeys ) {
136
        push @printerloop, {
137
            selected => ( $_ eq $printer ),
138
            name     => $printers->{$_}->{'printername'},
139
            value    => $_,
140
        };
141
    }
142
143
    $template->param(
144
        printerloop => \@printerloop,
145
    );
146
}
147
141
output_html_with_http_headers $query, $cookie, $template->output;
148
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (-7 / +9 lines)
Lines 364-373 CREATE TABLE `branches` ( -- information about your libraries or branches are st Link Here
364
  `branchurl` mediumtext, -- the URL for your library or branch's website
364
  `branchurl` mediumtext, -- the URL for your library or branch's website
365
  `issuing` tinyint(4) default NULL, -- unused in Koha
365
  `issuing` tinyint(4) default NULL, -- unused in Koha
366
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
366
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
367
  `branchprinter` varchar(100) default NULL, -- unused in Koha
367
  `branchprinter` varchar(20) default NULL,
368
  `branchnotes` mediumtext, -- notes related to your library or branch
368
  `branchnotes` mediumtext, -- notes related to your library or branch
369
  opac_info text, -- HTML that displays in OPAC
369
  opac_info text, -- HTML that displays in OPAC
370
  PRIMARY KEY (`branchcode`)
370
  PRIMARY KEY (`branchcode`)
371
  FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE
371
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
372
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
372
373
373
--
374
--
Lines 1589-1600 CREATE TABLE `pending_offline_operations` ( Link Here
1589
-- Table structure for table `printers`
1590
-- Table structure for table `printers`
1590
--
1591
--
1591
1592
1592
DROP TABLE IF EXISTS `printers`;
1593
DROP TABLE IF EXISTS printers;
1593
CREATE TABLE `printers` (
1594
CREATE TABLE printers (
1594
  `printername` varchar(40) NOT NULL default '',
1595
  printername varchar(40) NOT NULL default '',
1595
  `printqueue` varchar(20) default NULL,
1596
  printqueue varchar(20) NOT NULL,
1596
  `printtype` varchar(20) default NULL,
1597
  printtype varchar(20) default NULL,
1597
  PRIMARY KEY  (`printername`)
1598
  PRIMARY KEY  (printqueue),
1599
  UNIQUE (printername)
1598
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1600
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1599
1601
1600
--
1602
--
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 371-376 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
371
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
371
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
372
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
372
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
373
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
373
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
374
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo');
374
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free');
375
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free');
375
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('PrefillItem','0','When a new item is added, should it be prefilled with last created item values?','','YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('PrefillItem','0','When a new item is added, should it be prefilled with last created item values?','','YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free');
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 6339-6344 if ( CheckVersion($DBversion) ) { Link Here
6339
   SetVersion ($DBversion);
6339
   SetVersion ($DBversion);
6340
}
6340
}
6341
6341
6342
$DBversion = "3.11.00.XXX";
6343
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6344
    $dbh->do("ALTER TABLE printers DROP PRIMARY KEY, MODIFY printqueue varchar(20) NOT NULL PRIMARY KEY, ADD UNIQUE (printername)");
6345
    $dbh->do("ALTER TABLE branches MODIFY branchprinter varchar(20) NULL, ADD FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE");
6346
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo')");
6347
6348
    print "Upgrade to $DBversion done (Add borrowers.default_printqueue and 'UsePrintQueues' syspref)\n";
6349
    SetVersion($DBversion);
6350
}
6351
6342
=head1 FUNCTIONS
6352
=head1 FUNCTIONS
6343
6353
6344
=head2 TableExists($table)
6354
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (+1 lines)
Lines 60-65 Link Here
60
<h5>Additional parameters</h5>
60
<h5>Additional parameters</h5>
61
61
62
<ul>
62
<ul>
63
    [% IF UsePrintQueues %]<li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li>[% END %]
63
    [% IF ( NoZebra ) %]<li><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></li>[% END %]
64
    [% IF ( NoZebra ) %]<li><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></li>[% END %]
64
	<!-- <li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li> -->
65
	<!-- <li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li> -->
65
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></li>
66
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (+3 lines)
Lines 57-62 Link Here
57
                [% LoginBranchname %]
57
                [% LoginBranchname %]
58
            [% END %]
58
            [% END %]
59
            </strong>
59
            </strong>
60
            [% IF UsePrintQueues && PrinterName %]
61
            - [% PrinterName %]
62
            [% END %]
60
            [% IF ( IndependantBranches ) %]
63
            [% IF ( IndependantBranches ) %]
61
                [% IF ( CAN_user_management || CAN_user_editcatalogue_edit_catalogue ) %]
64
                [% IF ( CAN_user_management || CAN_user_editcatalogue_edit_catalogue ) %]
62
                    ( <a class="toplinks" href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set library</a> )
65
                    ( <a class="toplinks" href="/cgi-bin/koha/circ/selectbranchprinter.pl">Set library</a> )
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (-2 / +2 lines)
Lines 103-110 Link Here
103
<dl>
103
<dl>
104
	[% IF ( NoZebra ) %]<dt><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></dt>
104
	[% IF ( NoZebra ) %]<dt><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></dt>
105
	<dd>Words ignored during search.</dd>[% END %]
105
	<dd>Words ignored during search.</dd>[% END %]
106
	<!-- <dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
106
   [% IF UsePrintQueues %]<dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
107
	<dd>Printers (UNIX paths).</dd> -->
107
 <dd>Printers (UNIX paths).</dd>[% END %]
108
    <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></dt>
108
    <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></dt>
109
	<dd>Define which servers to query for MARC data in the integrated Z39.50 client.</dd>
109
	<dd>Define which servers to query for MARC data in the integrated Z39.50 client.</dd>
110
    <dt><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></dt>
110
    <dt><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></dt>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-8 / +12 lines)
Lines 143-152 tinyMCE.init({ Link Here
143
        <li><label for="branchurl">URL</label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" /></li>
143
        <li><label for="branchurl">URL</label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" /></li>
144
        <li><label for="opac_info">OPAC info</label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
144
        <li><label for="opac_info">OPAC info</label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
145
        <li><label for="branchip">IP</label><input type="text" name="branchip" id="branchip" value="[% branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
145
        <li><label for="branchip">IP</label><input type="text" name="branchip" id="branchip" value="[% branchip |html %]" /> <span class="hint">Can be entered as a single IP, or a subnet such as 192.168.1.*</span></li>
146
		<!--
146
[% IF UsePrintQueues %]
147
        <li><label for="branchprinter">Library Printer</label>
147
        <li><label for="branchprinter">Library printer</label>
148
            <select id="branchprinter" name="branchprinter">
148
            <select id="branchprinter" name="branchprinter">
149
                <option value="">None</option>
149
                <option value="">(None)</option>
150
            [% FOREACH printerloo IN printerloop %]
150
            [% FOREACH printerloo IN printerloop %]
151
                [% IF ( printerloo.selected ) %]
151
                [% IF ( printerloo.selected ) %]
152
				<option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
152
				<option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
Lines 155-161 tinyMCE.init({ Link Here
155
				[% END %]
155
				[% END %]
156
                [% END %]
156
                [% END %]
157
            </select></li>
157
            </select></li>
158
			-->
158
[% END %]
159
        <li><label for="branchnotes">Notes</label><input type="text" name="branchnotes" id="branchnotes" value="[% branchnotes |html %]" /></li>
159
        <li><label for="branchnotes">Notes</label><input type="text" name="branchnotes" id="branchnotes" value="[% branchnotes |html %]" /></li>
160
        </ol>
160
        </ol>
161
        </fieldset>
161
        </fieldset>
Lines 198-204 tinyMCE.init({ Link Here
198
            <th>Address</th>
198
            <th>Address</th>
199
            <th>Properties</th>
199
            <th>Properties</th>
200
            <th>IP</th>
200
            <th>IP</th>
201
            <!-- <th>Printer</th> -->
201
[% IF UsePrintQueues %]
202
            <th>Printer</th>
203
[% END %]
202
            <th colspan="2">&nbsp;</th>
204
            <th colspan="2">&nbsp;</th>
203
        </tr></thead><tbody>
205
        </tr></thead><tbody>
204
        [% FOREACH branche IN branches %]
206
        [% FOREACH branche IN branches %]
Lines 250-258 tinyMCE.init({ Link Here
250
                <td>
252
                <td>
251
                    [% branche.branchip %]
253
                    [% branche.branchip %]
252
                </td>
254
                </td>
253
                <!-- <td>
255
[% IF UsePrintQueues %]
254
                    [% branche.branchprinter %]
256
                <td>
255
                </td> -->
257
                    [% branche.branchprintername %]
258
                </td>
259
[% END %]
256
                <td>
260
                <td>
257
                    <a href="[% branche.action %]?op=edit&amp;branchcode=[% branche.value |url %]">Edit</a>
261
                    <a href="[% branche.action %]?op=edit&amp;branchcode=[% branche.value |url %]">Edit</a>
258
                </td>
262
                </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+6 lines)
Lines 116-121 Circulation: Link Here
116
                  no: "Do not"
116
                  no: "Do not"
117
            - update a bibliographic record's total issues count whenever an item is issued (WARNING! This increases server load significantly; if performance is a concern, use the update_totalissues.pl cron job to update the total issues count).
117
            - update a bibliographic record's total issues count whenever an item is issued (WARNING! This increases server load significantly; if performance is a concern, use the update_totalissues.pl cron job to update the total issues count).
118
        -
118
        -
119
            - pref: UsePrintQueues
120
              choices:
121
                  yes: "Use"
122
                  no: "Don't use"
123
            - server print queues.
124
        -
119
            - Use the
125
            - Use the
120
            - pref: ExportWithCsvProfile
126
            - pref: ExportWithCsvProfile
121
            - CSV profile when exporting patron checkout history (enter CSV Profile name)
127
            - CSV profile when exporting patron checkout history (enter CSV Profile name)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt (-26 / +7 lines)
Lines 4-10 Link Here
4
[% IF ( add_validate ) %] Printers &rsaquo; Printer added[% END %]
4
[% IF ( add_validate ) %] Printers &rsaquo; Printer added[% END %]
5
[% IF ( delete_confirm ) %] Printers &rsaquo; Confirm deletion of printer '[% searchfield %]'[% END %]
5
[% IF ( delete_confirm ) %] Printers &rsaquo; Confirm deletion of printer '[% searchfield %]'[% END %]
6
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
6
[% IF ( delete_confirmed ) %] Printers &rsaquo; Printer deleted[% END %]
7
[% IF ( else ) %]Printers[% END %]</title>
7
[% IF ( list_printers ) %]Printers[% END %]</title>
8
[% INCLUDE 'doc-head-close.inc' %]
8
[% INCLUDE 'doc-head-close.inc' %]
9
[% IF ( add_form ) %]<script type="text/javascript">
9
[% IF ( add_form ) %]<script type="text/javascript">
10
//<![CDATA[
10
//<![CDATA[
Lines 71-77 Link Here
71
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
71
[% IF ( add_validate ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer added[% END %]
72
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Confirm deletion of printer '[% searchfield %]'[% END %]
72
[% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Confirm deletion of printer '[% searchfield %]'[% END %]
73
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer deleted[% END %]
73
[% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/printers.pl">Printers</a> &rsaquo; Printer deleted[% END %]
74
[% IF ( else ) %]Printers[% END %]</div>
74
[% IF ( list_printers ) %]Printers[% END %]</div>
75
75
76
<div id="doc3" class="yui-t2">
76
<div id="doc3" class="yui-t2">
77
   
77
   
Lines 89-110 Link Here
89
        <form action="[% script_name %]" name="Aform" method="post">
89
        <form action="[% script_name %]" name="Aform" method="post">
90
        <input type="hidden" name="op" value="add_validate" />
90
        <input type="hidden" name="op" value="add_validate" />
91
	[% IF ( searchfield ) %]
91
	[% IF ( searchfield ) %]
92
          <input type="hidden" name="searchfield" value="[% searchfield %]" />
92
		<input type="hidden" name="add" value="0" />
93
		<input type="hidden" name="add" value="0" />
93
	[% ELSE %]
94
	[% ELSE %]
94
		<input type="hidden" name="add" value="1" />
95
		<input type="hidden" name="add" value="1" />
95
	[% END %]
96
	[% END %]
96
	<fieldset class="rows">
97
	<fieldset class="rows">
97
<ol>	[% IF ( searchfield ) %]
98
<ol>
98
		<li>
99
            <span class="label">Printer name: </span>
100
				<input type="hidden" name="printername" id="" value="[% searchfield %]" />[% searchfield %]
101
		</li>
102
	[% ELSE %]
103
		<li>
99
		<li>
104
            <label for="printername">Printer name: </label>
100
            <label for="printername">Printer name: </label>
105
				<input type="text" name="printername" id="printername" size="50" maxlength="50" />
101
                             <input type="text" name="printername" id="printername" size="50" maxlength="50" value="[% printername %]" />
106
		</li>
102
		</li>
107
	[% END %]
108
        	<li>
103
        	<li>
109
			<label for="printqueue">Queue: </label>
104
			<label for="printqueue">Queue: </label>
110
			<input type="text" name="printqueue" id="printqueue" size="50" maxlength="50" value="[% printqueue %]" /> 
105
			<input type="text" name="printqueue" id="printqueue" size="50" maxlength="50" value="[% printqueue %]" /> 
Lines 119-131 Link Here
119
114
120
[% END %]
115
[% END %]
121
116
122
[% IF ( add_validate ) %]
123
<h3>Printer added</h3>
124
<form action="[% script_name %]" method="post">
125
       <fieldset class="action"> <input type="submit" value="OK" /></fieldset>
126
</form>
127
[% END %]
128
129
[% IF ( delete_confirm ) %]
117
[% IF ( delete_confirm ) %]
130
<h3>Confirm deletion of printer <em>[% searchfield %]</em></h3>
118
<h3>Confirm deletion of printer <em>[% searchfield %]</em></h3>
131
<ul>
119
<ul>
Lines 151-164 Link Here
151
			</form>
139
			</form>
152
[% END %]
140
[% END %]
153
141
154
[% IF ( delete_confirmed ) %]
142
[% IF ( list_printers ) %]
155
<h3>Printer deleted</h3>
156
<form action="[% script_name %]" method="post">
157
		<fieldset class="action"><input type="submit" value="OK" /></fieldset>
158
</form>
159
[% END %]
160
161
[% IF ( else ) %]
162
143
163
<div id="toolbar">
144
<div id="toolbar">
164
	<script type="text/javascript">
145
	<script type="text/javascript">
Lines 190-196 Link Here
190
			<td>[% loo.printername %]</td>
171
			<td>[% loo.printername %]</td>
191
			<td>[% loo.printqueue %]</td>
172
			<td>[% loo.printqueue %]</td>
192
			<td>[% loo.printtype %]</td>
173
			<td>[% loo.printtype %]</td>
193
			<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.printername %]">Edit</a> <a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.printername %]">Delete</a></td>
174
                     <td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.printqueue %]">Edit</a> <a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.printqueue %]">Delete</a></td>
194
		</tr>
175
		</tr>
195
		[% END %]
176
		[% END %]
196
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
177
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 lines)
Lines 538-544 No patron matched <span class="ex">[% message %]</span> Link Here
538
    <legend>Patron selection</legend>
538
    <legend>Patron selection</legend>
539
539
540
    <input type="hidden" name="branch" value="[% branch %]" />
540
    <input type="hidden" name="branch" value="[% branch %]" />
541
    <input type="hidden" name="printer" value="[% printer %]" />
542
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
541
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
543
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
542
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
544
543
Lines 596-602 No patron matched <span class="ex">[% message %]</span> Link Here
596
</div>[% END %]
595
</div>[% END %]
597
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
596
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
598
          <input type="hidden" name="branch" value="[% branch %]" />
597
          <input type="hidden" name="branch" value="[% branch %]" />
599
          <input type="hidden" name="printer" value="[% printer %]" />
600
          <input type="hidden" name="print" value="maybe" />
598
          <input type="hidden" name="print" value="maybe" />
601
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
599
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
602
                [% IF ( CHARGES ) %]
600
                [% IF ( CHARGES ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/selectbranchprinter.tt (-3 / +2 lines)
Lines 28-34 Updated:<ul> Link Here
28
    [% IF ( update.updated_branch ) %]
28
    [% IF ( update.updated_branch ) %]
29
        <li>Library: [% update.old_branch or "?" %] &rArr; [% update.LoginBranchcode or "?" %]</li>
29
        <li>Library: [% update.old_branch or "?" %] &rArr; [% update.LoginBranchcode or "?" %]</li>
30
    [% ELSIF ( update.updated_printer ) %]
30
    [% ELSIF ( update.updated_printer ) %]
31
      <!-- FIXME:  <li>Printer: [% update.old_printer or "?" %] &rArr; [% update.new_printer or "?" %]</li> -->
31
        <li>Printer: [% update.old_printer or "?" %] &rArr; [% update.new_printer or "?" %]</li>
32
    [% ELSE %]
32
    [% ELSE %]
33
        <li>ERROR - unknown</li>
33
        <li>ERROR - unknown</li>
34
    [% END %]
34
    [% END %]
Lines 63-69 Updated:<ul> Link Here
63
        [% END %]
63
        [% END %]
64
        </select></li>
64
        </select></li>
65
    [% END %]
65
    [% END %]
66
<!--
67
    [% IF ( printerloop ) %]
66
    [% IF ( printerloop ) %]
68
        <li><label for="printer">Choose a network printer:</label>
67
        <li><label for="printer">Choose a network printer:</label>
69
        <select name="printer" id="printer">
68
        <select name="printer" id="printer">
Lines 75-81 Updated:<ul> Link Here
75
                [% END %]
74
                [% END %]
76
            [% END %]
75
            [% END %]
77
        </select></li>
76
        </select></li>
78
    [% END %] -->
77
    [% END %]
79
    </ol>
78
    </ol>
80
</fieldset>
79
</fieldset>
81
<fieldset class="action"><input type="submit" value="Submit" /></fieldset>
80
<fieldset class="action"><input type="submit" value="Submit" /></fieldset>
(-)a/t/db_dependent/lib/KohaTest/Koha.pm (-2 lines)
Lines 28-35 sub methods : Test( 1 ) { Link Here
28
      _getImagesFromDirectory
28
      _getImagesFromDirectory
29
      _getSubdirectoryNames
29
      _getSubdirectoryNames
30
      getImageSets
30
      getImageSets
31
      GetPrinters
32
      GetPrinter
33
      getnbpages
31
      getnbpages
34
      getallthemes
32
      getallthemes
35
      getFacets
33
      getFacets
(-)a/t/db_dependent/lib/KohaTest/Printer.pm (-1 / +26 lines)
Line 0 Link Here
0
- 
1
package KohaTest::Printer;
2
use base qw( KohaTest );
3
4
use strict;
5
use warnings;
6
7
use Test::More;
8
9
use C4::Printer;
10
sub testing_class { 'C4::Printer' }
11
12
sub methods : Test( 1 ) {
13
    my $self    = shift;
14
    my @methods = qw(
15
      GetPrinters
16
      SearchPrinters
17
      GetPrinterDetails
18
      AddPrinter
19
      UpdatePrinter
20
      DeletePrinter
21
    );
22
23
    can_ok( $self->testing_class, @methods );
24
}
25
26
1;

Return to bug 8034