Bug 28510: Remove marking of closed branches as 'disable_transfer'

We no longer need to act as if closed branches were marked as
disable_transfer. This allows us to clean up a nice bit of code.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 28510: Remove unused variable

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Kyle Hall 2021-06-03 06:57:52 -04:00 committed by Kyle Hall
parent 4b825ce3a5
commit 15373c26f0
2 changed files with 2 additions and 10 deletions

View file

@ -63,13 +63,11 @@ Returns Transport Cost Matrix as a hashref <to branch code> => <from branch code
sub TransportCostMatrix { sub TransportCostMatrix {
my ( $params ) = @_; my ( $params ) = @_;
my $ignore_holds_queue_skip_closed = $params->{ignore_holds_queue_skip_closed};
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my $transport_costs = $dbh->selectall_arrayref("SELECT * FROM transport_cost",{ Slice => {} }); my $transport_costs = $dbh->selectall_arrayref("SELECT * FROM transport_cost",{ Slice => {} });
my $today = dt_from_string(); my $today = dt_from_string();
my $calendars;
my %transport_cost_matrix; my %transport_cost_matrix;
foreach (@$transport_costs) { foreach (@$transport_costs) {
my $from = $_->{frombranch}; my $from = $_->{frombranch};
@ -80,14 +78,8 @@ sub TransportCostMatrix {
cost => $cost, cost => $cost,
disable_transfer => $disabled disable_transfer => $disabled
}; };
if ( !$ignore_holds_queue_skip_closed && C4::Context->preference("HoldsQueueSkipClosed") ) {
$calendars->{$from} ||= Koha::Calendar->new( branchcode => $from );
$transport_cost_matrix{$to}{$from}{disable_transfer} ||=
$calendars->{$from}->is_holiday( $today );
}
} }
return \%transport_cost_matrix; return \%transport_cost_matrix;
} }

View file

@ -45,7 +45,7 @@ my $update = ( $input->param('op') // '' ) eq 'set-cost-matrix';
my ($cost_matrix, $have_matrix); my ($cost_matrix, $have_matrix);
unless ($update) { unless ($update) {
$cost_matrix = TransportCostMatrix({ ignore_holds_queue_skip_closed => 1 }); $cost_matrix = TransportCostMatrix();
$have_matrix = keys %$cost_matrix if $cost_matrix; $have_matrix = keys %$cost_matrix if $cost_matrix;
} }