3 # Copyright Koha Development Team
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
27 use Koha
::Library
::OverDriveInfos
;
30 my @branchcodes = $input->multi_param('branchcode');
31 my @authnames = $input->multi_param('authname');
32 my $op = $input->param('op');
34 our ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
35 { template_name
=> 'admin/overdrive.tt',
38 flagsrequired
=> { parameters
=> 'parameters_remaining_permissions' },
42 if ( $op && $op eq 'update' ) {
44 @od_info{ @branchcodes } = @authnames;
45 while( my($branchcode,$authname) = each %od_info){
46 my $cur_info = Koha
::Library
::OverDriveInfos
->find($branchcode);
48 $cur_info->authname($authname)->store;
50 Koha
::Library
::OverDriveInfo
->new({
51 branchcode
=> $branchcode,
52 authname
=> $authname,
58 my @branches = Koha
::Libraries
->search();
60 foreach my $branch ( @branches ){
61 my $od_info = Koha
::Library
::OverDriveInfos
->find($branch->branchcode);
63 push @branch_od_info, { branchcode
=> $od_info->branchcode, authname
=> $od_info->authname };
65 push @branch_od_info, { branchcode
=> $branch->branchcode, authname
=> "" };
70 branches
=> \
@branch_od_info,
73 output_html_with_http_headers
$input, $cookie, $template->output;