-
-my $branches = GetBranches();
-my @branchloop;
-for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
- push @branchloop, {
- value => $thisbranch,
- selected => $thisbranch eq $branch,
- branchname => $branches->{$thisbranch}->{'branchname'},
- };
+elsif ( $op eq 'mod-refund-lost-item-fee-rule' ) {
+
+ my $refund = $input->param('refund');
+
+ if ( $refund eq '*' ) {
+ if ( $branch ne '*' ) {
+ # only do something for $refund eq '*' if branch-specific
+ eval {
+ # Delete it so it picks the default
+ Koha::RefundLostItemFeeRules->find({
+ branchcode => $branch
+ })->delete;
+ };
+ }
+ } else {
+ my $refundRule =
+ Koha::RefundLostItemFeeRules->find({
+ branchcode => $branch
+ }) // Koha::RefundLostItemFeeRule->new;
+ $refundRule->set({
+ branchcode => $branch,
+ refund => $refund
+ })->store;
+ }