View | Details | Raw Unified | Return to bug 14048
Collapse All | Expand All

(-)a/admin/smart-rules.pl (+34 lines)
Lines 30-35 use Koha::DateUtils; Link Here
30
use Koha::Database;
30
use Koha::Database;
31
use Koha::IssuingRule;
31
use Koha::IssuingRule;
32
use Koha::IssuingRules;
32
use Koha::IssuingRules;
33
use Koha::Logger;
34
use Koha::RefundLostItemFeeRule;
35
use Koha::RefundLostItemFeeRules;
33
use Koha::Libraries;
36
use Koha::Libraries;
34
37
35
my $input = CGI->new;
38
my $input = CGI->new;
Lines 423-428 elsif ($op eq "add-branch-item") { Link Here
423
        }
426
        }
424
    }
427
    }
425
}
428
}
429
elsif ( $op eq 'mod-refund-lost-item-fee-rule' ) {
430
431
    my $refund = $input->param('refund');
432
433
    if ( $refund eq '*' ) {
434
        if ( $branch ne '*' ) {
435
            # only do something for $refund eq '*' if branch-specific
436
            eval {
437
                # Delete it so it picks the default
438
                Koha::RefundLostItemFeeRules->find({
439
                    branchcode => $branch
440
                })->delete;
441
            };
442
        }
443
    } else {
444
        my $refundRule =
445
                Koha::RefundLostItemFeeRules->find({
446
                    branchcode => $branch
447
                }) // Koha::RefundLostItemFeeRule->new;
448
        $refundRule->set({
449
            branchcode => $branch,
450
                refund => $refund
451
        })->store;
452
    }
453
}
454
455
my $refundLostItemFeeRule = Koha::RefundLostItemFeeRules->find({ branchcode => $branch });
456
$template->param(
457
    refundLostItemFeeRule => $refundLostItemFeeRule,
458
    defaultRefundRule     => Koha::RefundLostItemFeeRules->_default_rule
459
);
426
460
427
my $branches = GetBranches();
461
my $branches = GetBranches();
428
my @branchloop;
462
my @branchloop;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +81 lines)
Lines 2-7 Link Here
2
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
2
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'calendar.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
[% USE Branches %]
5
<script type="text/javascript">
6
<script type="text/javascript">
6
//<![CDATA[
7
//<![CDATA[
7
8
Lines 557-562 for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde Link Here
557
        </form>
558
        </form>
558
    </div>
559
    </div>
559
    [% END %]
560
    [% END %]
561
562
    <div id="refund-lost-item-fee-on-return" class="container">
563
  [% IF current_branch == '*' %]
564
    <h3>Default lost item fee refund on return policy</h3>
565
  [% ELSE %]
566
    <h3>Lost item fee refund on return policy for [% Branches.GetName(current_branch) %]</h3>
567
  [% END %]
568
        <p>Specify the default policy for lost item fees on return.
569
        </p>
570
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
571
            <input type="hidden" name="op" value="mod-refund-lost-item-fee-rule" />
572
            <input type="hidden" name="branch" value="[% current_branch %]" />
573
            <table>
574
                <tr>
575
                    <th>Refund lost item fee</th>
576
                    <th>&nbsp;</th>
577
                </tr>
578
                <tr>
579
                    <td>
580
                        <select name="refund">
581
                          [#% Default branch %#]
582
                          [% IF ( current_branch == '*' ) %]
583
                            [% IF ( refundLostItemFeeRule.refund ) %]
584
                            <option value="1" selected="selected">
585
                            [% ELSE %]
586
                            <option value="1">
587
                            [% END %]
588
                                Yes
589
                            </option>
590
                            [% IF ( not refundLostItemFeeRule.refund ) %]
591
                            <option value="0" selected="selected">
592
                            [% ELSE %]
593
                            <option value="0">
594
                            [% END %]
595
                                No
596
                            </option>
597
                          [% ELSE %]
598
                          [#% Branch-specific %#]
599
                            [% IF ( not refundLostItemFeeRule ) %]
600
                                <option value="*" selected="selected">
601
                            [% ELSE %]
602
                                <option value="*">
603
                            [% END %]
604
                              [% IF defaultRefundRule %]
605
                                Use default (Yes)
606
                              [% ELSE %]
607
                                Use default (No)
608
                              [% END %]
609
                                </option>
610
                            [% IF ( not refundLostItemFeeRule ) %]
611
                                <option value="1">Yes</option>
612
                                <option value="0">No</option>
613
                            [% ELSE %]
614
                                [% IF ( refundLostItemFeeRule.refund ) %]
615
                                <option value="1" selected="selected">
616
                                [% ELSE %]
617
                                <option value="1">
618
                                [% END %]
619
                                    Yes
620
                                </option>
621
                                [% IF ( not refundLostItemFeeRule.refund ) %]
622
                                <option value="0" selected="selected">
623
                                [% ELSE %]
624
                                <option value="0">
625
                                [% END %]
626
                                    No
627
                                </option>
628
                            [% END %]
629
                          [% END %]
630
                        </select>
631
                    </td>
632
                    <td class="actions">
633
                        <button type="submit" class="btn btn-mini"><i class="fa fa-save"></i> Save</button>
634
                    </td>
635
                    </td>
636
                </tr>
637
            </table>
638
        </form>
639
    </div>
640
560
    <div id="holds-policy-by-item-type" class="container">
641
    <div id="holds-policy-by-item-type" class="container">
561
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
642
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
562
        <p>
643
        <p>
563
- 

Return to bug 14048