The find method in RefundLostItemFeeRules had been overloaded to only
support a hash being passed, however find can be called with a bare
array of primary key values (i.e. id in this case). TestBuilder relies
on this functionality and started to fail; This patch simply restores
the original behaviour for when a single value (or array of values) is
passed.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
=cut
-=head3 type
+=head3 _type
=cut
sub find {
my ( $self, @pars ) = @_;
- $pars[0]->{rule_name} = 'refund';
+ if ( ref($pars[0]) eq 'HASH' ) {
+ $pars[0]->{rule_name} = 'refund';
+ }
return $self->SUPER::find(@pars);
}
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHMqvrtX0ohJe70PHUYZ0Q
+sub koha_objects_class {
+ 'Koha::CirculationRules';
+}
+
+sub koha_object_class {
+ 'Koha::CirculationRule';
+}
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
subtest 'Koha::RefundLostItemFeeRules::find() tests' => sub {
- plan tests => 4;
+ plan tests => 5;
# Start transaction
$schema->storage->txn_begin;
}
}
);
+
+ ok(defined Koha::RefundLostItemFeeRules->find($default_non_refund->{id}), 'Find should continue to work when passed an id');
+
my $specific_non_refund = $builder->build(
{
source => 'CirculationRule',
AuthHeader => {
marcxml => '',
},
+ RefundLostItemFeeRules => {
+ rule_name => 'refund',
+ },
};
}