# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
-use strict;
-use warnings;
+use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Output;
-use C4::Auth;
-use C4::Koha;
-use C4::Debug;
-use C4::Branch; # GetBranches
-use C4::HoldsQueue qw(TransportCostMatrix UpdateTransportCostMatrix);
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
+use C4::HoldsQueue qw( TransportCostMatrix UpdateTransportCostMatrix );
-use Data::Dumper;
+use Koha::Libraries;
-my $input = new CGI;
+
+my $input = CGI->new;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "admin/transport-cost-matrix.tt",
query => $input,
type => "intranet",
- authnotrequired => 0,
- flagsrequired => {parameters => 1},
- debug => 1,
+ flagsrequired => { parameters => 'manage_transfers' },
});
my $use_transport_cost_matrix = C4::Context->preference("UseTransportCostMatrix");
$have_matrix = keys %$cost_matrix if $cost_matrix;
}
-my $branches = GetBranches();
-my @branchloop = map { code => $_,
- name => $branches->{$_}->{'branchname'} },
- sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} }
- keys %$branches;
-my (@branchfromloop, @cost, @errors);
+my @branchloop = map { code => $_->branchcode, name => $_->branchname }, Koha::Libraries->search({}, { order_by => 'branchname' })->as_list;
+my (@branchfromloop, @errors);
foreach my $branchfrom ( @branchloop ) {
my $fromcode = $branchfrom->{code};