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

(-)a/C4/Auth.pm (-12 / +41 lines)
Lines 29-34 require Exporter; Link Here
29
use C4::Context;
29
use C4::Context;
30
use C4::Templates;    # to get the template
30
use C4::Templates;    # to get the template
31
use C4::Branch; # GetBranches
31
use C4::Branch; # GetBranches
32
use C4::Printer qw(GetPrinterDetails);
32
use C4::VirtualShelves;
33
use C4::VirtualShelves;
33
use POSIX qw/strftime/;
34
use POSIX qw/strftime/;
34
use List::MoreUtils qw/ any /;
35
use List::MoreUtils qw/ any /;
Lines 47-53 BEGIN { Link Here
47
    $debug       = $ENV{DEBUG};
48
    $debug       = $ENV{DEBUG};
48
    @ISA         = qw(Exporter);
49
    @ISA         = qw(Exporter);
49
    @EXPORT      = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions);
50
    @EXPORT      = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions);
50
    @EXPORT_OK   = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &get_all_subpermissions &get_user_subpermissions);
51
    @EXPORT_OK   = qw(&check_api_auth &get_session &check_cookie_auth &checkpw
52
                      &get_all_subpermissions &get_user_subpermissions &get_user_printer);
51
    %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] );
53
    %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] );
52
    $ldap        = C4::Context->config('useldapserver') || 0;
54
    $ldap        = C4::Context->config('useldapserver') || 0;
53
    $cas         = C4::Context->preference('casAuthentication');
55
    $cas         = C4::Context->preference('casAuthentication');
Lines 314-319 sub get_template_and_user { Link Here
314
        $template->param(dateformat_iso => 1);
316
        $template->param(dateformat_iso => 1);
315
    }
317
    }
316
318
319
    my $userenv = C4::Context->userenv;
320
    my $userenv_branch = $userenv ? $userenv->{"branch"} : undef;
321
317
    # these template parameters are set the same regardless of $in->{'type'}
322
    # these template parameters are set the same regardless of $in->{'type'}
318
    $template->param(
323
    $template->param(
319
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
324
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
Lines 321-331 sub get_template_and_user { Link Here
321
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
326
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
322
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
327
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
323
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
328
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
324
            LoginBranchcode              => (C4::Context->userenv?C4::Context->userenv->{"branch"}:undef),
329
            LoginBranchcode              => ($userenv?$userenv->{"branch"}:undef),
325
            LoginFirstname               => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
330
            LoginFirstname               => ($userenv?$userenv->{"firstname"}:"Bel"),
326
            LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
331
            LoginSurname                 => $userenv?$userenv->{"surname"}:"Inconnu",
327
            emailaddress                 => C4::Context->userenv?C4::Context->userenv->{"emailaddress"}:undef,
332
            emailaddress                 => $userenv?$userenv->{"emailaddress"}:undef,
328
            loggedinpersona              => C4::Context->userenv?C4::Context->userenv->{"persona"}:undef,
333
            loggedinpersona              => $userenv?$userenv->{"persona"}:undef,
329
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
334
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
330
            hide_marc                    => C4::Context->preference("hide_marc"),
335
            hide_marc                    => C4::Context->preference("hide_marc"),
331
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
336
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
Lines 350-356 sub get_template_and_user { Link Here
350
            IntranetNav                 => C4::Context->preference("IntranetNav"),
355
            IntranetNav                 => C4::Context->preference("IntranetNav"),
351
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
356
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
352
            LibraryName                 => C4::Context->preference("LibraryName"),
357
            LibraryName                 => C4::Context->preference("LibraryName"),
353
            LoginBranchname             => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:undef),
358
            LoginBranchname             => ($userenv?$userenv->{"branchname"}:undef),
354
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
359
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
355
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
360
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
356
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
361
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
Lines 370-375 sub get_template_and_user { Link Here
370
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
375
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
371
            UseKohaPlugins              => C4::Context->preference('UseKohaPlugins'),
376
            UseKohaPlugins              => C4::Context->preference('UseKohaPlugins'),
372
        );
377
        );
378
        if ( C4::Context->preference('UsePrintQueues') ) {
379
            my $printer = get_user_printer();
380
            my $printer_rec = $printer ? GetPrinterDetails($printer) : {};
381
            $template->param(
382
                UsePrintQueues          => 1,
383
                PrinterName             => $printer_rec->{printername},
384
            );
385
        }
373
    }
386
    }
374
    else {
387
    else {
375
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
388
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
Lines 390-397 sub get_template_and_user { Link Here
390
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
403
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
391
        } elsif ( $in->{'query'}->param('multibranchlimit') ) {
404
        } elsif ( $in->{'query'}->param('multibranchlimit') ) {
392
            $opac_name = $in->{'query'}->param('multibranchlimit');
405
            $opac_name = $in->{'query'}->param('multibranchlimit');
393
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
406
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && $userenv_branch) {
394
            $opac_name = C4::Context->userenv->{'branch'};
407
            $opac_name = $userenv_branch;
395
        }
408
        }
396
        $template->param(
409
        $template->param(
397
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
410
            opaccolorstylesheet       => C4::Context->preference("opaccolorstylesheet"),
Lines 402-408 sub get_template_and_user { Link Here
402
            CalendarFirstDayOfWeek    => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
415
            CalendarFirstDayOfWeek    => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
403
            LibraryName               => "" . C4::Context->preference("LibraryName"),
416
            LibraryName               => "" . C4::Context->preference("LibraryName"),
404
            LibraryNameTitle          => "" . $LibraryNameTitle,
417
            LibraryNameTitle          => "" . $LibraryNameTitle,
405
            LoginBranchname           => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
418
            LoginBranchname           => $userenv?$userenv->{"branchname"}:"",
406
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
419
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
407
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
420
            OPACFRBRizeEditions       => C4::Context->preference("OPACFRBRizeEditions"),
408
            OpacHighlightedWords      => C4::Context->preference("OpacHighlightedWords"),
421
            OpacHighlightedWords      => C4::Context->preference("OpacHighlightedWords"),
Lines 437-443 sub get_template_and_user { Link Here
437
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
450
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
438
            'Version'                 => C4::Context->preference('Version'),
451
            'Version'                 => C4::Context->preference('Version'),
439
            hidelostitems             => C4::Context->preference("hidelostitems"),
452
            hidelostitems             => C4::Context->preference("hidelostitems"),
440
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '',
453
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && $userenv) ? $userenv_branch : '',
441
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
454
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
442
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
455
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
443
            opaccredits               => "" . C4::Context->preference("opaccredits"),
456
            opaccredits               => "" . C4::Context->preference("opaccredits"),
Lines 1717-1724 sub getborrowernumber { Link Here
1717
    return 0;
1730
    return 0;
1718
}
1731
}
1719
1732
1733
=head2 get_user_printer
1734
1735
  $printer = get_user_printer();
1736
1737
  Returns printer queue that is to be used for the logged in user
1738
1739
=cut
1740
1741
sub get_user_printer {
1742
    my $userenv = C4::Context->userenv or return;
1743
    if (my $printer = $userenv->{branchprinter}) {
1744
        return $printer;
1745
    }
1746
    my $branchname = $userenv->{branch} or return;
1747
    my $branch = GetBranchDetail($branchname) or return;
1748
    return $branch->{branchprinter};
1749
}
1720
1750
1721
END { }    # module clean-up code here (global destructor)
1722
1;
1751
1;
1723
__END__
1752
__END__
1724
1753
(-)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 603-647 sub getImageSets { Link Here
603
    return \@imagesets;
602
    return \@imagesets;
604
}
603
}
605
604
606
=head2 GetPrinters
607
608
  $printers = &GetPrinters();
609
  @queues = keys %$printers;
610
611
Returns information about existing printer queues.
612
613
C<$printers> is a reference-to-hash whose keys are the print queues
614
defined in the printers table of the Koha database. The values are
615
references-to-hash, whose keys are the fields in the printers table.
616
617
=cut
618
619
sub GetPrinters {
620
    my %printers;
621
    my $dbh = C4::Context->dbh;
622
    my $sth = $dbh->prepare("select * from printers");
623
    $sth->execute;
624
    while ( my $printer = $sth->fetchrow_hashref ) {
625
        $printers{ $printer->{'printqueue'} } = $printer;
626
    }
627
    return ( \%printers );
628
}
629
630
=head2 GetPrinter
631
632
  $printer = GetPrinter( $query, $printers );
633
634
=cut
635
636
sub GetPrinter {
637
    my ( $query, $printers ) = @_;    # get printer for this query from printers
638
    my $printer = $query->param('printer');
639
    my %cookie = $query->cookie('userenv');
640
    ($printer) || ( $printer = $cookie{'printer'} ) || ( $printer = '' );
641
    ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] );
642
    return $printer;
643
}
644
645
=head2 getnbpages
605
=head2 getnbpages
646
606
647
Returns the number of pages to display in a pagination bar, given the number
607
Returns the number of pages to display in a pagination bar, given the number
(-)a/C4/Printer.pm (+158 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
my $PRINTER_SELECT_FROM = <<EOQ;
71
SELECT printername, printqueue, printtype, branches
72
FROM printers
73
LEFT OUTER JOIN (SELECT branchprinter, COUNT(*) AS branches FROM branches GROUP BY branchprinter) b
74
  ON (branchprinter = printqueue)
75
EOQ
76
77
sub GetPrinters {
78
    my %printers;
79
    my $dbh = C4::Context->dbh;
80
    my $sth = $dbh->prepare($PRINTER_SELECT_FROM);
81
    $sth->execute;
82
    while ( my $printer = $sth->fetchrow_hashref ) {
83
        $printers{ $printer->{'printqueue'} } = $printer;
84
    }
85
    return ( \%printers );
86
}
87
88
=head2 SearchPrinters
89
90
  $printers = SearchPrinters( $searchstring );
91
92
=cut
93
94
sub SearchPrinters {
95
    my ($searchstring)=@_;
96
    $searchstring .= '%';
97
    return C4::Context->dbh->selectall_arrayref(
98
        "$PRINTER_SELECT_FROM
99
         WHERE printername like ? OR printqueue like ? ORDER BY printername",
100
        {Slice => {}},
101
        $searchstring, $searchstring);
102
}
103
104
=head2 GetPrinterDetails
105
106
  $printer_rec = GetPrinterDetails( $printqueue );
107
108
=cut
109
110
sub GetPrinterDetails {
111
    my ( $printer ) = @_;
112
    my $dbh = C4::Context->dbh;
113
    return $dbh->selectrow_hashref(
114
        "$PRINTER_SELECT_FROM
115
         WHERE printqueue = ?",
116
        undef, $printer);
117
}
118
119
=head2 AddPrinter
120
121
  AddPrinter( $data );
122
123
=cut
124
125
sub AddPrinter {
126
    my ( $data ) = @_;
127
    my $dbh = C4::Context->dbh;
128
    $dbh->do("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)", undef,
129
        $data->{printername}, $data->{printqueue}, $data->{printtype});
130
}
131
132
=head2 UpdatePrinter
133
134
  UpdatePrinter( $printqueue, $data );
135
136
=cut
137
138
sub UpdatePrinter {
139
    my ( $printqueue, $data ) = @_;
140
    my $dbh = C4::Context->dbh;
141
    $dbh->do("UPDATE printers SET printqueue = ?, printername = ?, printtype = ? WHERE printqueue = ?", undef,
142
        $data->{printqueue}, $data->{printername}, $data->{printtype}, $printqueue);
143
}
144
145
=head2 DeletePrinter
146
147
  DeletePrinter( $printqueue );
148
149
=cut
150
151
sub DeletePrinter {
152
    my ( $printqueue ) = @_;
153
    my $dbh = C4::Context->dbh;
154
    $dbh->do("DELETE FROM printers WHERE printqueue = ?", undef,
155
        $printqueue);
156
}
157
158
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 228-239 sub default { Link Here
228
229
229
sub editbranchform {
230
sub editbranchform {
230
    my ($branchcode,$innertemplate) = @_;
231
    my ($branchcode,$innertemplate) = @_;
231
    # initiate the scrolling-list to select the printers
232
232
    my $printers = GetPrinters();
233
    my @printerloop;
234
    my $data;
233
    my $data;
235
    my $oldprinter = "";
234
    my $oldprinter = "";
236
237
    if ($branchcode) {
235
    if ($branchcode) {
238
        $data = GetBranchInfo($branchcode);
236
        $data = GetBranchInfo($branchcode);
239
        $data = $data->[0];
237
        $data = $data->[0];
Lines 243-257 sub editbranchform { Link Here
243
        _branch_to_template($data, $innertemplate);
241
        _branch_to_template($data, $innertemplate);
244
    }
242
    }
245
243
246
    foreach my $thisprinter ( keys %$printers ) {
244
    if ( C4::Context->preference('UsePrintQueues') ) {
247
        push @printerloop, {
245
        # initiate the scrolling-list to select the printers
248
            value         => $thisprinter,
246
        my $printers = GetPrinters();
249
            selected      => ( $oldprinter eq $printers->{$thisprinter} ),
247
        my @printerloop;
250
            branchprinter => $printers->{$thisprinter}->{'printqueue'},
248
        foreach my $thisprinter ( keys %$printers ) {
251
        };
249
            push @printerloop, {
250
                value         => $thisprinter,
251
                selected      => ( $oldprinter eq $thisprinter ),
252
                branchprinter => $printers->{$thisprinter}->{'printername'},
253
            };
254
        }
255
256
        $innertemplate->param( printerloop => \@printerloop );
252
    }
257
    }
253
258
254
    $innertemplate->param( printerloop => \@printerloop );
255
    # make the checkboxes.....
259
    # make the checkboxes.....
256
    #
260
    #
257
    # We export a "categoryloop" array to the template, each element of which
261
    # We export a "categoryloop" array to the template, each element of which
Lines 311-316 sub branchinfotable { Link Here
311
315
312
    my ($branchcode,$innertemplate) = @_;
316
    my ($branchcode,$innertemplate) = @_;
313
    my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
317
    my $branchinfo = $branchcode ? GetBranchInfo($branchcode) : GetBranchInfo();
318
    my $printers = GetPrinters();
314
    my @loop_data = ();
319
    my @loop_data = ();
315
    foreach my $branch (@$branchinfo) {
320
    foreach my $branch (@$branchinfo) {
316
        #
321
        #
Lines 370-375 sub branchinfotable { Link Here
370
        $row{'branch_name'} = $branch->{'branchname'};
375
        $row{'branch_name'} = $branch->{'branchname'};
371
        $row{'branch_code'} = $branch->{'branchcode'};
376
        $row{'branch_code'} = $branch->{'branchcode'};
372
        $row{'value'}       = $branch->{'branchcode'};
377
        $row{'value'}       = $branch->{'branchcode'};
378
        if (my $printer = $branch->{'branchprinter'}) {
379
            $row{'branchprintername'} = $printers->{$printer}->{'printername'};
380
        }
373
381
374
        push @loop_data, \%row;
382
        push @loop_data, \%row;
375
    }
383
    }
(-)a/admin/printers.pl (-76 / +82 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
    my $data=GetPrinterDetails($searchfield);
117
	$sth->execute($searchfield);
105
    my $branches = $data->{branches};
118
	my $data=$sth->fetchrow_hashref;
106
    if ($branches && $branches > 0) {
119
	$template->param(printqueue => $data->{'printqueue'},
107
        $template->param(cannot_delete_branches => $branches);
120
			 printtype  => $data->{'printtype'});
108
        $template->param(add_form => 1);
121
													# END $OP eq DELETE_CONFIRM
109
    } else {
110
        $template->param(delete_confirm => 1);
111
    }
112
    $template->param(
113
        printqueue => $data->{'printqueue'},
114
        printtype  => $data->{'printtype'},
115
    );
116
# END $OP eq DELETE_CONFIRM
122
################## DELETE_CONFIRMED ##################################
117
################## DELETE_CONFIRMED ##################################
123
# called by delete_confirm, used to effectively confirm deletion of data in DB
118
# called by delete_confirm, used to effectively confirm deletion of data in DB
124
} elsif ($op eq 'delete_confirmed') {
119
} elsif ($op eq 'delete_confirmed') {
125
	$template->param(delete_confirmed => 1);
120
    # XXX Delete can fail
126
	my $sth=$dbh->prepare("delete from printers where printername=?");
121
    DeletePrinter($searchfield);
127
	$sth->execute($searchfield);
122
    $template->param(delete_confirmed => 1);
128
													# END $OP eq DELETE_CONFIRMED
123
    $template->param(list_printers => 1);
124
    $searchfield = '';
125
# END $OP eq DELETE_CONFIRMED
129
################## DEFAULT ###########################################
126
################## DEFAULT ###########################################
130
} else { # DEFAULT
127
} else { # DEFAULT
131
	$template->param(else => 1);
128
    $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
129
} #---- END $OP eq DEFAULT
148
130
131
if ($list_printers) {
132
    $template->param(list_printers => 1);
133
    my $results=SearchPrinters($searchfield);
134
    my $count = $results ? scalar(@$results) : 0;
135
    my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
136
    my @loop = (@$results)[$offset..$max-1];
137
    
138
    $template->param(loop => \@loop);
139
    
140
    if ($offset>0) {
141
        $template->param(offsetgtzero => 1,
142
                 prevpage => $offset-$pagesize);
143
    }
144
    if ($offset+$pagesize<$count) {
145
        $template->param(ltcount => 1,
146
                 nextpage => $offset+$pagesize);
147
    }
148
}
149
150
$template->param(
151
    searchfield => $searchfield,
152
    script_name => $script_name
153
);
154
149
output_html_with_http_headers $input, $cookie, $template->output;
155
output_html_with_http_headers $input, $cookie, $template->output;
150
156
(-)a/circ/circulation.pl (-11 / +1 lines)
Lines 30-36 use C4::Print; Link Here
30
use C4::Auth qw/:DEFAULT get_session/;
30
use C4::Auth qw/:DEFAULT get_session/;
31
use C4::Dates qw/format_date/;
31
use C4::Dates qw/format_date/;
32
use C4::Branch; # GetBranches
32
use C4::Branch; # GetBranches
33
use C4::Koha;   # GetPrinter
33
use C4::Koha;
34
use C4::Circulation;
34
use C4::Circulation;
35
use C4::Overdues qw/CheckBorrowerDebarred/;
35
use C4::Overdues qw/CheckBorrowerDebarred/;
36
use C4::Members;
36
use C4::Members;
Lines 68-79 if ($branch){ Link Here
68
    $session->param('branchname', GetBranchName($branch));
68
    $session->param('branchname', GetBranchName($branch));
69
}
69
}
70
70
71
my $printer = $query->param('printer');
72
if ($printer){
73
    # update our session so the userenv is updated
74
    $session->param('branchprinter', $printer);
75
}
76
77
if (!C4::Context->userenv && !$branch){
71
if (!C4::Context->userenv && !$branch){
78
    if ($session->param('branch') eq 'NO_LIBRARY_SET'){
72
    if ($session->param('branch') eq 'NO_LIBRARY_SET'){
79
        # no branch set we can't issue
73
        # no branch set we can't issue
Lines 108-115 $findborrower =~ s|,| |g; Link Here
108
my $borrowernumber = $query->param('borrowernumber');
102
my $borrowernumber = $query->param('borrowernumber');
109
103
110
$branch  = C4::Context->userenv->{'branch'};  
104
$branch  = C4::Context->userenv->{'branch'};  
111
$printer = C4::Context->userenv->{'branchprinter'};
112
113
105
114
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
106
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
115
if (C4::Context->preference("AutoLocation") != 1) {
107
if (C4::Context->preference("AutoLocation") != 1) {
Lines 679-686 $template->param( Link Here
679
    borrowernumber    => $borrowernumber,
671
    borrowernumber    => $borrowernumber,
680
    branch            => $branch,
672
    branch            => $branch,
681
    branchname        => GetBranchName($borrower->{'branchcode'}),
673
    branchname        => GetBranchName($borrower->{'branchcode'}),
682
    printer           => $printer,
683
    printername       => $printer,
684
    firstname         => $borrower->{'firstname'},
674
    firstname         => $borrower->{'firstname'},
685
    surname           => $borrower->{'surname'},
675
    surname           => $borrower->{'surname'},
686
    showname          => $borrower->{'showname'},
676
    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 366-375 CREATE TABLE `branches` ( -- information about your libraries or branches are st Link Here
366
  `branchurl` mediumtext, -- the URL for your library or branch's website
366
  `branchurl` mediumtext, -- the URL for your library or branch's website
367
  `issuing` tinyint(4) default NULL, -- unused in Koha
367
  `issuing` tinyint(4) default NULL, -- unused in Koha
368
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
368
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
369
  `branchprinter` varchar(100) default NULL, -- unused in Koha
369
  `branchprinter` varchar(20) default NULL,
370
  `branchnotes` mediumtext, -- notes related to your library or branch
370
  `branchnotes` mediumtext, -- notes related to your library or branch
371
  opac_info text, -- HTML that displays in OPAC
371
  opac_info text, -- HTML that displays in OPAC
372
  PRIMARY KEY (`branchcode`)
372
  PRIMARY KEY (`branchcode`)
373
  FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE
373
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
374
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
374
375
375
--
376
--
Lines 1579-1590 CREATE TABLE pending_offline_operations ( Link Here
1579
-- Table structure for table `printers`
1580
-- Table structure for table `printers`
1580
--
1581
--
1581
1582
1582
DROP TABLE IF EXISTS `printers`;
1583
DROP TABLE IF EXISTS printers;
1583
CREATE TABLE `printers` (
1584
CREATE TABLE printers (
1584
  `printername` varchar(40) NOT NULL default '',
1585
  printername varchar(40) NOT NULL default '',
1585
  `printqueue` varchar(20) default NULL,
1586
  printqueue varchar(20) NOT NULL,
1586
  `printtype` varchar(20) default NULL,
1587
  printtype varchar(20) default NULL,
1587
  PRIMARY KEY  (`printername`)
1588
  PRIMARY KEY  (printqueue),
1589
  UNIQUE (printername)
1588
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1590
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1589
1591
1590
--
1592
--
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 370-375 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
370
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');
370
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,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
371
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('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');
372
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 ('UsePrintQueues','0',NULL,NULL,'YesNo');
373
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free');
374
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSuppressionByIPRange','','Restrict the suppression to IP adresses outside of the IP range','','free');
374
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');
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');
375
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free');
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');
(-)a/installer/data/mysql/updatedatabase.pl (+11 lines)
Lines 6772-6777 if ( CheckVersion($DBversion) ) { Link Here
6772
}
6772
}
6773
6773
6774
6774
6775
6776
$DBversion = "3.11.00.XXX";
6777
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6778
    $dbh->do("ALTER TABLE printers DROP PRIMARY KEY, MODIFY printqueue varchar(20) NOT NULL PRIMARY KEY, ADD UNIQUE (printername)");
6779
    $dbh->do("ALTER TABLE branches MODIFY branchprinter varchar(20) NULL, ADD FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE");
6780
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo')");
6781
6782
    print "Upgrade to $DBversion done (Add borrowers.default_printqueue and 'UsePrintQueues' syspref)\n";
6783
    SetVersion($DBversion);
6784
}
6785
6775
=head1 FUNCTIONS
6786
=head1 FUNCTIONS
6776
6787
6777
=head2 TableExists($table)
6788
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc (-1 / +1 lines)
Lines 60-66 Link Here
60
<h5>Additional parameters</h5>
60
<h5>Additional parameters</h5>
61
61
62
<ul>
62
<ul>
63
	<!-- <li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li> -->
63
    [% IF UsePrintQueues %]<li><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></li>[% END %]
64
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></li>
64
    <li><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></li>
65
    <li><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></li>
65
    <li><a href="/cgi-bin/koha/admin/didyoumean.pl">Did you mean?</a></li>
66
</ul>
66
</ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (+3 lines)
Lines 58-63 Link Here
58
                  [% END %]
58
                  [% END %]
59
                </strong>
59
                </strong>
60
              [% END %]
60
              [% END %]
61
              [% IF UsePrintQueues && PrinterName %]
62
              - [% PrinterName %]
63
              [% END %]
61
              <b class="caret"></b>
64
              <b class="caret"></b>
62
          </a>
65
          </a>
63
          <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
66
          <ul class="dropdown-menu" role="menu" aria-labelledby="drop3">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (-2 / +4 lines)
Lines 101-108 Link Here
101
101
102
<h3>Additional parameters</h3>
102
<h3>Additional parameters</h3>
103
<dl>
103
<dl>
104
	<!-- <dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
104
    [% IF UsePrintQueues %]
105
	<dd>Printers (UNIX paths).</dd> -->
105
	<dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
106
	<dd>Printers (UNIX paths).</dd>
107
    [% END %]
106
    <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>
107
	<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>
108
    <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 (-7 / +11 lines)
Lines 132-141 tinyMCE.init({ Link Here
132
        <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" class="url" /></li>
132
        <li><label for="branchurl">URL: </label><input type="text" name="branchurl" id="branchurl" value="[% branchurl |html %]" class="url" /></li>
133
        <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
133
        <li><label for="opac_info">OPAC info: </label><textarea name="opac_info" id="opac_info">[% opac_info |html %]</textarea></li>
134
        <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>
134
        <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>
135
		<!--
135
[% IF UsePrintQueues %]
136
        <li><label for="branchprinter">Library Printer: </label>
136
        <li><label for="branchprinter">Library Printer: </label>
137
            <select id="branchprinter" name="branchprinter">
137
            <select id="branchprinter" name="branchprinter">
138
                <option value="">None</option>
138
                <option value="">(None)</option>
139
            [% FOREACH printerloo IN printerloop %]
139
            [% FOREACH printerloo IN printerloop %]
140
                [% IF ( printerloo.selected ) %]
140
                [% IF ( printerloo.selected ) %]
141
				<option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
141
				<option value="[% printerloo.value %]" selected="selected">[% printerloo.branchprinter %]</option>
Lines 144-150 tinyMCE.init({ Link Here
144
				[% END %]
144
				[% END %]
145
                [% END %]
145
                [% END %]
146
            </select></li>
146
            </select></li>
147
			-->
147
[% END %]
148
        <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" value="[% branchnotes |html %]" /></li>
148
        <li><label for="branchnotes">Notes: </label><input type="text" name="branchnotes" id="branchnotes" value="[% branchnotes |html %]" /></li>
149
        </ol>
149
        </ol>
150
        </fieldset>
150
        </fieldset>
Lines 184-190 tinyMCE.init({ Link Here
184
            <th>Address</th>
184
            <th>Address</th>
185
            <th>Properties</th>
185
            <th>Properties</th>
186
            <th>IP</th>
186
            <th>IP</th>
187
            <!-- <th>Printer</th> -->
187
[% IF UsePrintQueues %]
188
            <th>Printer</th>
189
[% END %]
188
            <th>&nbsp;</th>
190
            <th>&nbsp;</th>
189
            <th>&nbsp;</th>
191
            <th>&nbsp;</th>
190
        </tr></thead><tbody>
192
        </tr></thead><tbody>
Lines 237-245 tinyMCE.init({ Link Here
237
                <td>
239
                <td>
238
                    [% branche.branchip %]
240
                    [% branche.branchip %]
239
                </td>
241
                </td>
240
                <!-- <td>
242
[% IF UsePrintQueues %]
241
                    [% branche.branchprinter %]
243
                <td>
242
                </td> -->
244
                    [% branche.branchprintername %]
245
                </td>
246
[% END %]
243
                <td>
247
                <td>
244
                    <a href="[% branche.action %]?op=edit&amp;branchcode=[% branche.value |url %]">Edit</a>
248
                    <a href="[% branche.action %]?op=edit&amp;branchcode=[% branche.value |url %]">Edit</a>
245
                </td>
249
                </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 / +14 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" class="btn-toolbar">
144
<div id="toolbar" class="btn-toolbar">
164
    <a class="btn btn-small" id="newprinter" href="/cgi-bin/koha/admin/printers.pl?op=add_form"><i class="icon-plus"></i> New printer</a>
145
    <a class="btn btn-small" id="newprinter" href="/cgi-bin/koha/admin/printers.pl?op=add_form"><i class="icon-plus"></i> New printer</a>
Lines 181-187 Link Here
181
			<td>[% loo.printername %]</td>
162
			<td>[% loo.printername %]</td>
182
			<td>[% loo.printqueue %]</td>
163
			<td>[% loo.printqueue %]</td>
183
			<td>[% loo.printtype %]</td>
164
			<td>[% loo.printtype %]</td>
184
			<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>
165
                     <td>
166
                         <a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.printqueue %]">Edit</a>
167
                     [% IF loo.branches %]
168
                         Default printer for [% loo.branches %] branch(es)
169
                     [% ELSE %]
170
                         <a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.printqueue %]">Delete</a>
171
                     [% END %]
172
                     </td>
185
		</tr>
173
		</tr>
186
		[% END %]
174
		[% END %]
187
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
175
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 lines)
Lines 560-566 No patron matched <span class="ex">[% message %]</span> Link Here
560
    <legend>Patron selection</legend>
560
    <legend>Patron selection</legend>
561
561
562
    <input type="hidden" name="branch" value="[% branch %]" />
562
    <input type="hidden" name="branch" value="[% branch %]" />
563
    <input type="hidden" name="printer" value="[% printer %]" />
564
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
563
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
565
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
564
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
566
565
Lines 618-624 No patron matched <span class="ex">[% message %]</span> Link Here
618
</div>[% END %]
617
</div>[% END %]
619
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
618
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
620
          <input type="hidden" name="branch" value="[% branch %]" />
619
          <input type="hidden" name="branch" value="[% branch %]" />
621
          <input type="hidden" name="printer" value="[% printer %]" />
622
          <input type="hidden" name="print" value="maybe" />
620
          <input type="hidden" name="print" value="maybe" />
623
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
621
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
624
                [% IF ( CHARGES ) %]
622
                [% 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