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

(-)a/admin/smart-rules.pl (-4 / +4 lines)
Lines 71-77 if ($op eq 'delete') { Link Here
71
    my $itemtype     = $input->param('itemtype');
71
    my $itemtype     = $input->param('itemtype');
72
    my $categorycode = $input->param('categorycode');
72
    my $categorycode = $input->param('categorycode');
73
    my $has_priority = $input->param('has_priority') ? 1 : undef;
73
    my $has_priority = $input->param('has_priority') ? 1 : undef;
74
    $debug and warn "deleting $1 $2 $branch";
74
    warn "deleting $1 $2 $branch";
75
75
76
    Koha::CirculationRules->set_rules(
76
    Koha::CirculationRules->set_rules(
77
        {
77
        {
Lines 387-398 elsif ($op eq "set-branch-defaults") { Link Here
387
                branchcode   => undef,
387
                branchcode   => undef,
388
                has_priority => $has_priority,
388
                has_priority => $has_priority,
389
                rules        => {
389
                rules        => {
390
                    patron_maxissueqty             => $patron_maxissueqty,
390
                    patron_maxissueqty       => $patron_maxissueqty,
391
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
391
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
392
                    patron_has_priority      => $has_priority,
393
                }
392
                }
394
            }
393
            }
395
        );
394
        );
395
396
    } else {
396
    } else {
397
        Koha::CirculationRules->set_rules(
397
        Koha::CirculationRules->set_rules(
398
            {
398
            {
(-)a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.pl (+17 lines)
Line 0 Link Here
1
2
use Modern::Perl;
3
4
return {
5
    bug_number => "BUG_NUMBER",
6
    description => "A single line description",
7
    up => sub {
8
        my ($args) = @_;
9
        my ($dbh, $out) = @$args{qw(dbh out)};
10
        # Do you stuffs here
11
        $dbh->do(q{
12
            ALTER TABLE circulation_rules ADD has_priority INT(1) DEFAULT NULL AFTER itemtype;
13
        });
14
        # Print useful stuff here
15
        say $out "Added column 'has_priority' to table circulation_rules";
16
    },
17
};
(-)a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql (-2 lines)
Lines 1-2 Link Here
1
ALTER TABLE circulation_rules ADD has_priority INT(1) DEFAULT NULL AFTER itemtype;
2
ALTER TABLE circulation_rules ADD KEY (branchcode , categorycode, itemtype, has_priority);
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-139 / +9 lines)
Lines 110-116 Link Here
110
                            <th class="fixed_sort">Item type</th>
110
                            <th class="fixed_sort">Item type</th>
111
                            <th class="noExport">Actions</th>
111
                            <th class="noExport">Actions</th>
112
                            <th>Note</th>
112
                            <th>Note</th>
113
                            [% UNLESS humanbranch %]<th>Has priority</th>[% END %]
113
                            [% UNLESS humanbranch %]<th> Has priority</th>[% END %]
114
                <th>Current checkouts allowed</th>
114
                <th>Current checkouts allowed</th>
115
                <th>Current on-site checkouts allowed</th>
115
                <th>Current on-site checkouts allowed</th>
116
                <th>Loan period</th>
116
                <th>Loan period</th>
Lines 779-785 Link Here
779
    </div>
779
    </div>
780
    [% IF ( show_branch_cat_rule_form ) %]
780
    [% IF ( show_branch_cat_rule_form ) %]
781
    <div id="holds-policy-by-patron-category" class="container">
781
    <div id="holds-policy-by-patron-category" class="container">
782
    <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
782
        <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
783
        <p>For this library, you can specify the maximum number of loans that
783
        <p>For this library, you can specify the maximum number of loans that
784
            a patron of a given category can make, regardless of the item type.
784
            a patron of a given category can make, regardless of the item type.
785
        </p>
785
        </p>
Lines 848-860 Link Here
848
                                [% END %]
848
                                [% END %]
849
                            </td>
849
                            </td>
850
                        [% END %]
850
                        [% END %]
851
851
                            <td class="actions">
852
                                    <td class="actions">
852
                                <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
853
                                        <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
853
                            </td>
854
                                    </td>
854
                        </tr>
855
                                </tr>
855
                        [% END %]
856
                                [% END %]
856
                        [% END %]
857
                            [% END %]
858
                            <tr>
857
                            <tr>
859
                                <td>
858
                                <td>
860
                                    <select name="categorycode">
859
                                    <select name="categorycode">
Lines 866-871 Link Here
866
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
865
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
867
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
866
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
868
                                <td><input name="max_holds" size="3" type="text" /></td>
867
                                <td><input name="max_holds" size="3" type="text" /></td>
868
                                <td>&nbsp;</td>
869
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
869
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
870
                            </tr>
870
                            </tr>
871
                        </table>
871
                        </table>
Lines 1294-1428 Link Here
1294
                                [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1294
                                [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1295
                                [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1295
                                [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1296
                                [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1296
                                [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1297
                                        <tr>
1298
                                            <td>
1299
                                                <select>
1300
                                                    [% IF returnbranch == 'homebranch' %]
1301
                                                    <option value="homebranch" selected="selected">
1302
                                                    [% ELSE %]
1303
                                                    <option value="homebranch">
1304
                                                    [% END %]
1305
                                                        Item returns home
1306
                                                    </option>
1307
                                                    [% IF returnbranch == 'holdingbranch' %]
1308
                                                    <option value="holdingbranch" selected="selected">
1309
                                                    [% ELSE %]
1310
                                                    <option value="holdingbranch">
1311
                                                    [% END %]
1312
                                                        Item returns to issuing library
1313
                                                    </option>
1314
                                                    [% IF returnbranch == 'noreturn' %]
1315
                                                    <option value="noreturn" selected="selected">
1316
                                                    [% ELSE %]
1317
                                                    <option value="noreturn">
1318
                                                    [% END %]
1319
                                                        Item floats
1320
                                                    </option>
1321
                                                </select>
1322
                                            </td>
1323
                                            <td class="actions">
1324
                                                <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
1325
                                                <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=*&amp;branch=[% current_branch | html %]" id="unset"><i class="fa fa-undo"></i> Unset</a>
1326
                                            </td>
1327
                                        </tr>
1328
                                    </table>
1329
                                </form>
1330
                            </div>
1331
                            [% IF ( show_branch_cat_rule_form ) %]
1332
                            <div id="holds-policy-by-patron-category" class="container">
1333
                            <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
1334
                                <p>For this library, you can specify the maximum number of loans that
1335
                                    a patron of a given category can make, regardless of the item type.
1336
                                </p>
1337
                                <p>If the total amount loanable for a given patron category is left blank,
1338
                                   no limit applies, except possibly for a limit you define for a specific item type.
1339
                                </p>
1340
                                <p>
1341
                                    <b>Has priority: </b>If checked, the rule will override those for all branches. Else
1342
                                    it behaves like a default one: used if no rule existe for the coresponding branch.
1343
                                </p>
1344
                                <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1345
                                    <input type="hidden" name="op" value="add-branch-cat" />
1346
                                    <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1347
                                    <table>
1348
                                        <tr>
1349
                                            <th>Patron category</th>
1350
                                            <th>Total current checkouts allowed</th>
1351
                                            <th>Total current on-site checkouts allowed</th>
1352
                                            <th>Total holds allowed</th>
1353
                                            [% UNLESS humanbranch %]<th>Has priority</th>[% END %]
1354
                                            <th>&nbsp;</th>
1355
                                        </tr>
1356
                                        [% FOREACH c IN categorycodes %]
1357
                                            [% NEXT UNLESS c %]
1358
                                            [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
1359
                                            [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
1360
                                            [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
1361
1362
                                            [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
1363
                                            <tr>
1364
                                                <td>
1365
                                                    [% IF c == undef %]
1366
                                                        <em>Default</em>
1367
                                                    [% ELSE %]
1368
                                                        [% Categories.GetName(c) | html %]
1369
                                                    [% END %]
1370
                                                </td>
1371
                                                <td>
1372
                                                    [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
1373
                                                        [% patron_maxissueqty | html %]
1374
                                                    [% ELSE %]
1375
                                                        <span>Unlimited</span>
1376
                                                    [% END %]
1377
                                                </td>
1378
                                                <td>
1379
                                                    [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
1380
                                                        [% patron_maxonsiteissueqty | html %]
1381
                                                    [% ELSE %]
1382
                                                        <span>Unlimited</span>
1383
                                                    [% END %]
1384
                                                </td>
1385
                                                <td>
1386
                                                    [% IF max_holds.defined && max_holds != '' %]
1387
                                                        [% max_holds | html %]
1388
                                                    [% ELSE %]
1389
                                                        <span>Unlimited</span>
1390
                                                    [% END %]
1391
                                                </td>
1392
                                                [% UNLESS humanbranch %]
1393
                                                    <td>
1394
                                                        <input type="checkbox" [% IF branch_cat_rule_loo.has_priority %]checked[% END %] disabled/>
1395
                                                    </td>
1396
                                                [% END %]
1397
1398
                                                <td class="actions">
1399
                                                    <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/admin/smart-rules.pl?op=delete-branch-cat&amp;categorycode=[% c | html %]&amp;branch=[% current_branch | html %]"><i class="fa fa-trash"></i> Delete</a>
1400
                                                </td>
1401
                                            </tr>
1402
                                            [% END %]
1403
                                        [% END %]
1404
                                        <tr>
1405
                                            <td>
1406
                                                <select name="categorycode">
1407
                                                [% FOREACH patron_category IN patron_categories%]
1408
                                                    <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1409
                                                [% END %]
1410
                                                </select>
1411
                                            </td>
1412
                                            <td><input name="patron_maxissueqty" size="3" type="text" /></td>
1413
                                            <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
1414
                                            <td><input name="max_holds" size="3" type="text" /></td>
1415
                                            [% UNLESS humanbranch %]
1416
                                                <td>
1417
                                                    <input type="checkbox" name="has_priority"/>
1418
                                                </td>
1419
                                            [% END %]
1420
                                            <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
1421
                                        </tr>
1422
                                    </table>
1423
                                </form>
1424
                            </div>
1425
                            [% END %]
1426
1297
1427
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1298
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1428
                                    <tr>
1299
                                    <tr>
1429
- 

Return to bug 8137