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

(-)a/admin/smart-rules.pl (+25 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 'add-refund-lost-item-fee-rule' ) {
430
    my $ref_branchcode = $input->param('ref_branchcode');
431
    my $ref_refund     = $input->param('ref_refund');
432
    # We retrieve the object to update it, or create a new one
433
    my $refundLostItemFeeRule = Koha::RefundLostItemFeeRules->find({
434
                                    branchcode => $ref_branchcode
435
                                }) // Koha::RefundLostItemFeeRule->new;
436
    $refundLostItemFeeRule->set({
437
        branchcode => $ref_branchcode,
438
            refund => $ref_refund
439
    })->store();
440
}
441
elsif ( $op eq 'del-refund-lost-item-fee-rule' ) {
442
    my $ref_branchcode = $input->param('ref_branchcode');
443
    eval {
444
        Koha::RefundLostItemFeeRules->find({
445
            branchcode => $ref_branchcode
446
        })->delete;
447
    };
448
}
449
450
$template->param( refundLostItemFeeRules => scalar Koha::RefundLostItemFeeRules->search ) ;
426
451
427
my $branches = GetBranches();
452
my $branches = GetBranches();
428
my @branchloop;
453
my @branchloop;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +58 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
    <h3>Lost item fee refund on return policy</h3>
564
        <p>Specify the default policy for lost item fees on return.
565
        </p>
566
        <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
567
            <input type="hidden" name="op" value="add-refund-lost-item-fee-rule" />
568
            <table>
569
                <tr>
570
                    <th>Library</th>
571
                    <th>Refund lost item fee</th>
572
                    <th>&nbsp;</th>
573
                </tr>
574
            [% FOREACH refundLostItemFeeRule IN refundLostItemFeeRules %]
575
                <tr>
576
                    <td>
577
                [% IF refundLostItemFeeRule.branchcode == '*' %]
578
                        All
579
                [% ELSE %]
580
                        [% Branches.GetName(refundLostItemFeeRule.branchcode) %]
581
                [% END %]
582
                    </td>
583
                    <td>
584
                [% IF refundLostItemFeeRule.refund %]
585
                        Yes
586
                [% ELSE %]
587
                        No
588
                [% END %]
589
                    </td>
590
                    <td class="actions">
591
                    [% IF refundLostItemFeeRule.branchcode != '*' %]
592
                        <a class="btn btn-mini delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=del-refund-lost-item-fee-rule&amp;ref_branchcode=[% refundLostItemFeeRule.branchcode %]"><i class="fa fa-trash"></i> Delete</a>
593
                    [% END %]
594
                    </td>
595
                </tr>
596
            [% END %]
597
                <tr>
598
                    <td>
599
                        <select name="ref_branchcode">
600
                            <option value='*'>All</option>
601
                        [% FOREACH branch IN Branches.all %]
602
                            <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
603
                        [% END %]
604
                        </select>
605
                    </td>
606
                    <td>
607
                        <select name="ref_refund">
608
                            <option value="0">No</option>
609
                            <option value="1">Yes</option>
610
                        </select>
611
                    </td>
612
                    <td class="actions"><button type="submit" class="btn btn-mini"><i class="fa fa-plus"></i> Add</td>
613
                </tr>
614
            </table>
615
        </form>
616
    </div>
617
560
    <div id="holds-policy-by-item-type" class="container">
618
    <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>
619
    <h3>[% IF humanbranch %]Holds policy by item type for [% humanbranch %][% ELSE %]Default holds policy by item type[% END %]</h3>
562
        <p>
620
        <p>
563
- 

Return to bug 14048