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 310-315 sub get_template_and_user { Link Here
310
        $template->param(dateformat_iso => 1);
312
        $template->param(dateformat_iso => 1);
311
    }
313
    }
312
314
315
    my $userenv = C4::Context->userenv;
316
    my $userenv_branch = $userenv ? $userenv->{"branch"} : undef;
317
313
    # these template parameters are set the same regardless of $in->{'type'}
318
    # these template parameters are set the same regardless of $in->{'type'}
314
    $template->param(
319
    $template->param(
315
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
320
            "BiblioDefaultView".C4::Context->preference("BiblioDefaultView")         => 1,
Lines 317-325 sub get_template_and_user { Link Here
317
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
322
            GoogleJackets                => C4::Context->preference("GoogleJackets"),
318
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
323
            OpenLibraryCovers            => C4::Context->preference("OpenLibraryCovers"),
319
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
324
            KohaAdminEmailAddress        => "" . C4::Context->preference("KohaAdminEmailAddress"),
320
            LoginBranchcode              => (C4::Context->userenv?C4::Context->userenv->{"branch"}:"insecure"),
325
            LoginBranchcode              => ($userenv?$userenv_branch:"insecure"),
321
            LoginFirstname               => (C4::Context->userenv?C4::Context->userenv->{"firstname"}:"Bel"),
326
            LoginFirstname               => ($userenv?$userenv->{"firstname"}:"Bel"),
322
            LoginSurname                 => C4::Context->userenv?C4::Context->userenv->{"surname"}:"Inconnu",
327
            LoginSurname                 => $userenv?$userenv->{"surname"}:"Inconnu",
323
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
328
            TagsEnabled                  => C4::Context->preference("TagsEnabled"),
324
            hide_marc                    => C4::Context->preference("hide_marc"),
329
            hide_marc                    => C4::Context->preference("hide_marc"),
325
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
330
            item_level_itypes            => C4::Context->preference('item-level_itypes'),
Lines 348-354 sub get_template_and_user { Link Here
348
            IntranetNav                 => C4::Context->preference("IntranetNav"),
353
            IntranetNav                 => C4::Context->preference("IntranetNav"),
349
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
354
            IntranetmainUserblock       => C4::Context->preference("IntranetmainUserblock"),
350
            LibraryName                 => C4::Context->preference("LibraryName"),
355
            LibraryName                 => C4::Context->preference("LibraryName"),
351
            LoginBranchname             => (C4::Context->userenv?C4::Context->userenv->{"branchname"}:"insecure"),
356
            LoginBranchname             => ($userenv?$userenv->{"branchname"}:"insecure"),
352
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
357
            advancedMARCEditor          => C4::Context->preference("advancedMARCEditor"),
353
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
358
            canreservefromotherbranches => C4::Context->preference('canreservefromotherbranches'),
354
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
359
            intranetcolorstylesheet     => C4::Context->preference("intranetcolorstylesheet"),
Lines 368-373 sub get_template_and_user { Link Here
368
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
373
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
369
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
374
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
370
        );
375
        );
376
        if ( C4::Context->preference('UsePrintQueues') ) {
377
            my $printer = get_user_printer();
378
            my $printer_rec = $printer ? GetPrinterDetails($printer) : {};
379
            $template->param(
380
                UsePrintQueues          => 1,
381
                PrinterName             => $printer_rec->{printername},
382
            );
383
        }
371
    }
384
    }
372
    else {
385
    else {
373
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
386
        warn "template type should be OPAC, here it is=[" . $in->{'type'} . "]" unless ( $in->{'type'} eq 'opac' );
Lines 386-393 sub get_template_and_user { Link Here
386
        my $opac_name = '';
399
        my $opac_name = '';
387
        if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){
400
        if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){
388
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
401
            $opac_name = $1;   # opac_search_limit is a branch, so we use it.
389
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
402
        } elsif (C4::Context->preference("SearchMyLibraryFirst") && $userenv_branch) {
390
            $opac_name = C4::Context->userenv->{'branch'};
403
            $opac_name = $userenv_branch
391
        }
404
        }
392
	my $checkstyle = C4::Context->preference("opaccolorstylesheet");
405
	my $checkstyle = C4::Context->preference("opaccolorstylesheet");
393
	if ($checkstyle =~ /http/)
406
	if ($checkstyle =~ /http/)
Lines 407-413 sub get_template_and_user { Link Here
407
            CalendarFirstDayOfWeek      => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
420
            CalendarFirstDayOfWeek      => (C4::Context->preference("CalendarFirstDayOfWeek") eq "Sunday")?0:1,
408
            LibraryName               => "" . C4::Context->preference("LibraryName"),
421
            LibraryName               => "" . C4::Context->preference("LibraryName"),
409
            LibraryNameTitle          => "" . $LibraryNameTitle,
422
            LibraryNameTitle          => "" . $LibraryNameTitle,
410
            LoginBranchname           => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"",
423
            LoginBranchname           => $userenv?$userenv->{"branchname"}:"",
411
            OPACAmazonEnabled         => C4::Context->preference("OPACAmazonEnabled"),
424
            OPACAmazonEnabled         => C4::Context->preference("OPACAmazonEnabled"),
412
            OPACAmazonSimilarItems    => C4::Context->preference("OPACAmazonSimilarItems"),
425
            OPACAmazonSimilarItems    => C4::Context->preference("OPACAmazonSimilarItems"),
413
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
426
            OPACAmazonCoverImages     => C4::Context->preference("OPACAmazonCoverImages"),
Lines 441-447 sub get_template_and_user { Link Here
441
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
454
            RequestOnOpac             => C4::Context->preference("RequestOnOpac"),
442
            'Version'                 => C4::Context->preference('Version'),
455
            'Version'                 => C4::Context->preference('Version'),
443
            hidelostitems             => C4::Context->preference("hidelostitems"),
456
            hidelostitems             => C4::Context->preference("hidelostitems"),
444
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv) ? C4::Context->userenv->{'branch'} : '',
457
            mylibraryfirst            => (C4::Context->preference("SearchMyLibraryFirst") && $userenv) ? $userenv_branch : '',
445
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
458
            opaclayoutstylesheet      => "" . C4::Context->preference("opaclayoutstylesheet"),
446
            opacstylesheet            => "" . C4::Context->preference("opacstylesheet"),
459
            opacstylesheet            => "" . C4::Context->preference("opacstylesheet"),
447
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
460
            opacbookbag               => "" . C4::Context->preference("opacbookbag"),
Lines 1671-1678 sub getborrowernumber { Link Here
1671
    return 0;
1684
    return 0;
1672
}
1685
}
1673
1686
1687
=head2 get_user_printer
1688
1689
  $printer = get_user_printer();
1690
1691
  Returns printer queue that is to be used for the logged in user
1692
1693
=cut
1694
1695
sub get_user_printer {
1696
    my $userenv = C4::Context->userenv or return;
1697
    if (my $printer = $userenv->{branchprinter}) {
1698
        return $printer;
1699
    }
1700
    my $branchname = $userenv->{branch} or return;
1701
    my $branch = GetBranchDetail($branchname) or return;
1702
    return $branch->{branchprinter};
1703
}
1674
1704
1675
END { }    # module clean-up code here (global destructor)
1676
1;
1705
1;
1677
__END__
1706
__END__
1678
1707
(-)a/C4/Context.pm (-1 / +1 lines)
Lines 998-1004 sub userenv { Link Here
998
=head2 set_userenv
998
=head2 set_userenv
999
999
1000
  C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, 
1000
  C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, 
1001
                  $usersurname, $userbranch, $userflags, $emailaddress);
1001
                  $usersurname, $userbranch, $userflags, $emailaddress, $branchprinter);
1002
1002
1003
Establish a hash of user environment variables.
1003
Establish a hash of user environment variables.
1004
1004
(-)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 (+152 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=~ s/\'/\\\'/g;
90
    my @data=split(' ',$searchstring);
91
    my $sth = C4::Context->dbh->prepare("
92
        SELECT * FROM printers 
93
        WHERE (printername like ?) ORDER BY printername
94
        ");
95
    $sth->execute("$data[0]%");
96
    return $sth->fetchall_arrayref({});
97
}
98
99
100
=head2 GetPrinterDetails
101
102
  $printer_rec = GetPrinterDetails( $printqueue );
103
104
=cut
105
106
sub GetPrinterDetails {
107
    my ( $printer ) = @_;
108
    my $dbh = C4::Context->dbh;
109
    my $printername = $dbh->selectrow_hashref('SELECT * FROM printers WHERE printqueue = ?', undef, $printer);
110
    return $printername;
111
}
112
113
=head2 AddPrinter
114
115
  AddPrinter( $data );
116
117
=cut
118
119
sub AddPrinter {
120
    my ( $data ) = @_;
121
    my $dbh = C4::Context->dbh;
122
    $dbh->do("INSERT INTO printers (printername,printqueue,printtype) VALUES (?,?,?)", undef,
123
        $data->{printername}, $data->{printqueue}, $data->{printtype});
124
}
125
126
=head2 UpdatePrinter
127
128
  UpdatePrinter( $printqueue, $data );
129
130
=cut
131
132
sub UpdatePrinter {
133
    my ( $printqueue, $data ) = @_;
134
    my $dbh = C4::Context->dbh;
135
    $dbh->do("UPDATE printers SET printername = ?, printtype = ? WHERE printqueue = ?", undef,
136
        $data->{printername}, $data->{printtype}, $printqueue);
137
}
138
139
=head2 DeletePrinter
140
141
  DeletePrinter( $printqueue );
142
143
=cut
144
145
sub DeletePrinter {
146
    my ( $printqueue ) = @_;
147
    my $dbh = C4::Context->dbh;
148
    $dbh->do("DELETE FROM printers WHERE printqueue = ?", undef,
149
        $printqueue);
150
}
151
152
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 $printers->{$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 (-26 / +13 lines)
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 89-121 if ($op eq 'add_form') { Link Here
89
	#---- if primkey exists, it's a modify action, so read values to modify...
77
	#---- if primkey exists, it's a modify action, so read values to modify...
90
	my $data;
78
	my $data;
91
	if ($searchfield) {
79
	if ($searchfield) {
92
		my $sth=$dbh->prepare("SELECT printername,printqueue,printtype from printers where printername=?");
80
		$data=GetPrinterDetails($searchfield);
93
		$sth->execute($searchfield);
94
		$data=$sth->fetchrow_hashref;
95
	}
81
	}
96
82
97
	$template->param(printqueue => $data->{'printqueue'},
83
	$template->param(printqueue => $data->{'printqueue'},
84
                    printername => $data->{'printername'},
98
			 printtype => $data->{'printtype'});
85
			 printtype => $data->{'printtype'});
99
													# END $OP eq ADD_FORM
86
													# END $OP eq ADD_FORM
100
################## ADD_VALIDATE ##################################
87
################## ADD_VALIDATE ##################################
101
# called by add_form, used to insert/modify data in DB
88
# called by add_form, used to insert/modify data in DB
102
} elsif ($op eq 'add_validate') {
89
} elsif ($op eq 'add_validate') {
103
	$template->param(add_validate => 1);
90
	$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'));
107
	} else {
94
	} else {
108
		my $sth=$dbh->prepare("UPDATE printers SET printqueue=?,printtype=? WHERE printername=?");
95
            UpdatePrinter($params->{printqueue}, $params);
109
		$sth->execute($input->param('printqueue'),$input->param('printtype'),$input->param('printername'));
110
	}
96
	}
111
													# END $OP eq ADD_VALIDATE
97
													# END $OP eq ADD_VALIDATE
112
################## DELETE_CONFIRM ##################################
98
################## DELETE_CONFIRM ##################################
113
# called by default form, used to confirm deletion of data in DB
99
# called by default form, used to confirm deletion of data in DB
114
} elsif ($op eq 'delete_confirm') {
100
} elsif ($op eq 'delete_confirm') {
115
	$template->param(delete_confirm => 1);
101
	$template->param(delete_confirm => 1);
116
	my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printername=?");
102
   my $sth=$dbh->prepare("select printername,printqueue,printtype from printers where printqueue=?");
117
	$sth->execute($searchfield);
103
	$sth->execute($searchfield);
118
	my $data=$sth->fetchrow_hashref;
104
	my $data=GetPrinterDetails($searchfield);
119
	$template->param(printqueue => $data->{'printqueue'},
105
	$template->param(printqueue => $data->{'printqueue'},
120
			 printtype  => $data->{'printtype'});
106
			 printtype  => $data->{'printtype'});
121
													# END $OP eq DELETE_CONFIRM
107
													# END $OP eq DELETE_CONFIRM
Lines 123-137 if ($op eq 'add_form') { Link Here
123
# called by delete_confirm, used to effectively confirm deletion of data in DB
109
# called by delete_confirm, used to effectively confirm deletion of data in DB
124
} elsif ($op eq 'delete_confirmed') {
110
} elsif ($op eq 'delete_confirmed') {
125
	$template->param(delete_confirmed => 1);
111
	$template->param(delete_confirmed => 1);
126
	my $sth=$dbh->prepare("delete from printers where printername=?");
112
        DeletePrinter($searchfield);
127
	$sth->execute($searchfield);
128
													# END $OP eq DELETE_CONFIRMED
113
													# END $OP eq DELETE_CONFIRMED
129
################## DEFAULT ###########################################
114
################## DEFAULT ###########################################
130
} else { # DEFAULT
115
} else { # DEFAULT
131
	$template->param(else => 1);
116
	$template->param(else => 1);
132
	my ($count,$results)=StringSearch($searchfield,'web');
117
        $searchfield ||= $input->param('description') || "";
118
	my $results=SearchPrinters($searchfield);
119
	my $count = $results ? scalar(@$results) : 0;
133
	my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
120
	my $max = ($offset+$pagesize < $count) ? $offset+$pagesize : $count;
134
	my @loop = (@$results)[$offset..$max];
121
    my @loop = (@$results)[$offset..$max-1];
135
	
122
	
136
	$template->param(loop => \@loop);
123
	$template->param(loop => \@loop);
137
	
124
	
(-)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 102-109 $findborrower =~ s|,| |g; Link Here
102
my $borrowernumber = $query->param('borrowernumber');
96
my $borrowernumber = $query->param('borrowernumber');
103
97
104
$branch  = C4::Context->userenv->{'branch'};  
98
$branch  = C4::Context->userenv->{'branch'};  
105
$printer = C4::Context->userenv->{'branchprinter'};
106
107
99
108
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
100
# If AutoLocation is not activated, we show the Circulation Parameters to chage settings of librarian
109
if (C4::Context->preference("AutoLocation") != 1) {
101
if (C4::Context->preference("AutoLocation") != 1) {
Lines 667-674 $template->param( Link Here
667
    borrowernumber    => $borrowernumber,
659
    borrowernumber    => $borrowernumber,
668
    branch            => $branch,
660
    branch            => $branch,
669
    branchname        => GetBranchName($borrower->{'branchcode'}),
661
    branchname        => GetBranchName($borrower->{'branchcode'}),
670
    printer           => $printer,
671
    printername       => $printer,
672
    firstname         => $borrower->{'firstname'},
662
    firstname         => $borrower->{'firstname'},
673
    surname           => $borrower->{'surname'},
663
    surname           => $borrower->{'surname'},
674
    showname          => $borrower->{'showname'},
664
    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 604-612 foreach ( sort { $a <=> $b } keys %returneditems ) { Link Here
604
$template->param(
598
$template->param(
605
    riloop         => \@riloop,
599
    riloop         => \@riloop,
606
    genbrname      => $branches->{$userenv_branch}->{'branchname'},
600
    genbrname      => $branches->{$userenv_branch}->{'branchname'},
607
    genprname      => $printers->{$printer}->{'printername'},
608
    branchname     => $branches->{$userenv_branch}->{'branchname'},
601
    branchname     => $branches->{$userenv_branch}->{'branchname'},
609
    printer        => $printer,
610
    errmsgloop     => \@errmsgloop,
602
    errmsgloop     => \@errmsgloop,
611
    exemptfine     => $exemptfine,
603
    exemptfine     => $exemptfine,
612
    dropboxmode    => $dropboxmode,
604
    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 363-372 CREATE TABLE `branches` ( -- information about your libraries or branches are st Link Here
363
  `branchurl` mediumtext, -- the URL for your library or branch's website
363
  `branchurl` mediumtext, -- the URL for your library or branch's website
364
  `issuing` tinyint(4) default NULL, -- unused in Koha
364
  `issuing` tinyint(4) default NULL, -- unused in Koha
365
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
365
  `branchip` varchar(15) default NULL, -- the IP address for your library or branch
366
  `branchprinter` varchar(100) default NULL, -- unused in Koha
366
  `branchprinter` varchar(20) default NULL,
367
  `branchnotes` mediumtext, -- notes related to your library or branch
367
  `branchnotes` mediumtext, -- notes related to your library or branch
368
  opac_info text, -- HTML that displays in OPAC
368
  opac_info text, -- HTML that displays in OPAC
369
  PRIMARY KEY (`branchcode`)
369
  PRIMARY KEY (`branchcode`)
370
  FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE
370
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
371
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
371
372
372
--
373
--
Lines 1567-1578 CREATE TABLE `pending_offline_operations` ( Link Here
1567
-- Table structure for table `printers`
1568
-- Table structure for table `printers`
1568
--
1569
--
1569
1570
1570
DROP TABLE IF EXISTS `printers`;
1571
DROP TABLE IF EXISTS printers;
1571
CREATE TABLE `printers` (
1572
CREATE TABLE printers (
1572
  `printername` varchar(40) NOT NULL default '',
1573
  printername varchar(40) NOT NULL default '',
1573
  `printqueue` varchar(20) default NULL,
1574
  printqueue varchar(20) NOT NULL,
1574
  `printtype` varchar(20) default NULL,
1575
  printtype varchar(20) default NULL,
1575
  PRIMARY KEY  (`printername`)
1576
  PRIMARY KEY  (printqueue),
1577
  UNIQUE (printername)
1576
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1578
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1577
1579
1578
--
1580
--
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 375-377 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
375
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');
375
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');
376
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');
376
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');
377
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');
377
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');
378
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+12 lines)
Lines 5536-5541 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5536
    SetVersion($DBversion);
5536
    SetVersion($DBversion);
5537
}
5537
}
5538
5538
5539
5540
5541
$DBversion = "3.09.00.XXX";
5542
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5543
    $dbh->do("ALTER TABLE printers DROP PRIMARY KEY, MODIFY printqueue varchar(20) NOT NULL PRIMARY KEY, ADD UNIQUE (printername)");
5544
    $dbh->do("ALTER TABLE branches MODIFY branchprinter varchar(20) NULL, ADD FOREIGN KEY (branchprinter) REFERENCES printers (printqueue) ON UPDATE CASCADE");
5545
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UsePrintQueues','0',NULL,NULL,'YesNo')");
5546
5547
    print "Upgrade to $DBversion done (Add borrowers.default_printqueue and 'UsePrintQueues' syspref)\n";
5548
    SetVersion($DBversion);
5549
}
5550
5539
=head1 FUNCTIONS
5551
=head1 FUNCTIONS
5540
5552
5541
=head2 TableExists($table)
5553
=head2 TableExists($table)
(-)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 %]
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 99-106 Link Here
99
<dl>
99
<dl>
100
	[% IF ( NoZebra ) %]<dt><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></dt>
100
	[% IF ( NoZebra ) %]<dt><a href="/cgi-bin/koha/admin/stopwords.pl">Stop words</a></dt>
101
	<dd>Words ignored during search.</dd>[% END %]
101
	<dd>Words ignored during search.</dd>[% END %]
102
	<!-- <dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
102
   [% IF UsePrintQueues %]<dt><a href="/cgi-bin/koha/admin/printers.pl">Network Printers</a></dt>
103
	<dd>Printers (UNIX paths).</dd> -->
103
 <dd>Printers (UNIX paths).</dd>[% END %]
104
    <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></dt>
104
    <dt><a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 client targets</a></dt>
105
	<dd>Define which servers to query for MARC data in the integrated Z39.50 client.</dd>
105
	<dd>Define which servers to query for MARC data in the integrated Z39.50 client.</dd>
106
</dl>
106
</dl>
(-)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 109-114 Circulation: Link Here
109
                  yes: Do
109
                  yes: Do
110
                  no: "Do not"
110
                  no: "Do not"
111
            - 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).
111
            - 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).
112
        -
113
            - pref: UsePrintQueues
114
              choices:
115
                  yes: "Use"
116
                  no: "Don't use"
117
            - server print queues.
112
    Checkout Policy:
118
    Checkout Policy:
113
        -
119
        -
114
            - pref: AllowNotForLoanOverride
120
            - pref: AllowNotForLoanOverride
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/printers.tt (-9 / +4 lines)
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 190-196 Link Here
190
			<td>[% loo.printername %]</td>
185
			<td>[% loo.printername %]</td>
191
			<td>[% loo.printqueue %]</td>
186
			<td>[% loo.printqueue %]</td>
192
			<td>[% loo.printtype %]</td>
187
			<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>
188
                     <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>
189
		</tr>
195
		[% END %]
190
		[% END %]
196
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
191
	</table>[% ELSE %]<div class="notice">No printers defined.</div>[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 lines)
Lines 441-447 No patron matched <span class="ex">[% message %]</span> Link Here
441
    <legend>Patron selection</legend>
441
    <legend>Patron selection</legend>
442
442
443
    <input type="hidden" name="branch" value="[% branch %]" />
443
    <input type="hidden" name="branch" value="[% branch %]" />
444
    <input type="hidden" name="printer" value="[% printer %]" />
445
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
444
    <input type="hidden" name="duedatespec" value="[% duedatespec %]" />
446
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
445
    <input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
447
446
Lines 499-505 No patron matched <span class="ex">[% message %]</span> Link Here
499
</div>[% END %]
498
</div>[% END %]
500
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
499
          <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
501
          <input type="hidden" name="branch" value="[% branch %]" />
500
          <input type="hidden" name="branch" value="[% branch %]" />
502
          <input type="hidden" name="printer" value="[% printer %]" />
503
          <input type="hidden" name="print" value="maybe" />
501
          <input type="hidden" name="print" value="maybe" />
504
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
502
          <input type="hidden" name="debt_confirmed" value="[% debt_confirmed %]" />
505
                [% IF ( CHARGES ) %]
503
                [% 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::Koha;
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