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 388-399 elsif ($op eq "set-branch-defaults") { Link Here
388
                branchcode   => undef,
388
                branchcode   => undef,
389
                has_priority => $has_priority,
389
                has_priority => $has_priority,
390
                rules        => {
390
                rules        => {
391
                    patron_maxissueqty             => $patron_maxissueqty,
391
                    patron_maxissueqty       => $patron_maxissueqty,
392
                    patron_maxonsiteissueqty       => $patron_maxonsiteissueqty,
392
                    patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
393
                    patron_has_priority      => $has_priority,
394
                }
393
                }
395
            }
394
            }
396
        );
395
        );
396
397
    } else {
397
    } else {
398
        Koha::CirculationRules->set_rules(
398
        Koha::CirculationRules->set_rules(
399
            {
399
            {
(-)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 (-132 / +3 lines)
Lines 115-121 Link Here
115
                            <th class="fixed_sort">Item type</th>
115
                            <th class="fixed_sort">Item type</th>
116
                            <th class="noExport">Actions</th>
116
                            <th class="noExport">Actions</th>
117
                            <th>Note</th>
117
                            <th>Note</th>
118
                            [% UNLESS humanbranch %]<th>Has priority</th>[% END %]
118
                            [% UNLESS humanbranch %]<th> Has priority</th>[% END %]
119
                <th>Current checkouts allowed</th>
119
                <th>Current checkouts allowed</th>
120
                <th>Current on-site checkouts allowed</th>
120
                <th>Current on-site checkouts allowed</th>
121
                <th>Loan period</th>
121
                <th>Loan period</th>
Lines 784-790 Link Here
784
    </div>
784
    </div>
785
    [% IF ( show_branch_cat_rule_form ) %]
785
    [% IF ( show_branch_cat_rule_form ) %]
786
    <div id="holds-policy-by-patron-category" class="container">
786
    <div id="holds-policy-by-patron-category" class="container">
787
    <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
787
        <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
788
        <p>For this library, you can specify the maximum number of loans that
788
        <p>For this library, you can specify the maximum number of loans that
789
            a patron of a given category can make, regardless of the item type.
789
            a patron of a given category can make, regardless of the item type.
790
        </p>
790
        </p>
Lines 871-876 Link Here
871
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
871
                                <td><input name="patron_maxissueqty" size="3" type="text" /></td>
872
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
872
                                <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
873
                                <td><input name="max_holds" size="3" type="text" /></td>
873
                                <td><input name="max_holds" size="3" type="text" /></td>
874
                                <td>&nbsp;</td>
874
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
875
                                <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</button></td>
875
                            </tr>
876
                            </tr>
876
                        </table>
877
                        </table>
Lines 1299-1433 Link Here
1299
                                [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1300
                                [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %]
1300
                                [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1301
                                [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %]
1301
                                [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1302
                                [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %]
1302
                                        <tr>
1303
                                            <td>
1304
                                                <select>
1305
                                                    [% IF returnbranch == 'homebranch' %]
1306
                                                    <option value="homebranch" selected="selected">
1307
                                                    [% ELSE %]
1308
                                                    <option value="homebranch">
1309
                                                    [% END %]
1310
                                                        Item returns home
1311
                                                    </option>
1312
                                                    [% IF returnbranch == 'holdingbranch' %]
1313
                                                    <option value="holdingbranch" selected="selected">
1314
                                                    [% ELSE %]
1315
                                                    <option value="holdingbranch">
1316
                                                    [% END %]
1317
                                                        Item returns to issuing library
1318
                                                    </option>
1319
                                                    [% IF returnbranch == 'noreturn' %]
1320
                                                    <option value="noreturn" selected="selected">
1321
                                                    [% ELSE %]
1322
                                                    <option value="noreturn">
1323
                                                    [% END %]
1324
                                                        Item floats
1325
                                                    </option>
1326
                                                </select>
1327
                                            </td>
1328
                                            <td class="actions">
1329
                                                <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-save"></i> Save</button>
1330
                                                <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>
1331
                                            </td>
1332
                                        </tr>
1333
                                    </table>
1334
                                </form>
1335
                            </div>
1336
                            [% IF ( show_branch_cat_rule_form ) %]
1337
                            <div id="holds-policy-by-patron-category" class="container">
1338
                            <h3>[% IF humanbranch %]Checkout, hold policy by patron category for [% Branches.GetName( humanbranch ) | html %][% ELSE %]Default checkout, hold policy by patron category[% END %]</h3>
1339
                                <p>For this library, you can specify the maximum number of loans that
1340
                                    a patron of a given category can make, regardless of the item type.
1341
                                </p>
1342
                                <p>If the total amount loanable for a given patron category is left blank,
1343
                                   no limit applies, except possibly for a limit you define for a specific item type.
1344
                                </p>
1345
                                <p>
1346
                                    <b>Has priority: </b>If checked, the rule will override those for all branches. Else
1347
                                    it behaves like a default one: used if no rule existe for the coresponding branch.
1348
                                </p>
1349
                                <form method="post" action="/cgi-bin/koha/admin/smart-rules.pl">
1350
                                    <input type="hidden" name="op" value="add-branch-cat" />
1351
                                    <input type="hidden" name="branch" value="[% current_branch | html %]"/>
1352
                                    <table>
1353
                                        <tr>
1354
                                            <th>Patron category</th>
1355
                                            <th>Total current checkouts allowed</th>
1356
                                            <th>Total current on-site checkouts allowed</th>
1357
                                            <th>Total holds allowed</th>
1358
                                            [% UNLESS humanbranch %]<th>Has priority</th>[% END %]
1359
                                            <th>&nbsp;</th>
1360
                                        </tr>
1361
                                        [% FOREACH c IN categorycodes %]
1362
                                            [% NEXT UNLESS c %]
1363
                                            [% SET patron_maxissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxissueqty' ) %]
1364
                                            [% SET patron_maxonsiteissueqty = CirculationRules.Search( branchcode, c, undef, 'patron_maxonsiteissueqty' ) %]
1365
                                            [% SET max_holds = CirculationRules.Search( branchcode, c, undef, 'max_holds' ) %]
1366
1367
                                            [% IF  ( patron_maxissueqty.defined && patron_maxissueqty != '' ) || ( patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' ) || ( max_holds.defined && max_holds != '' ) %]
1368
                                            <tr>
1369
                                                <td>
1370
                                                    [% IF c == undef %]
1371
                                                        <em>Default</em>
1372
                                                    [% ELSE %]
1373
                                                        [% Categories.GetName(c) | html %]
1374
                                                    [% END %]
1375
                                                </td>
1376
                                                <td>
1377
                                                    [% IF patron_maxissueqty.defined && patron_maxissueqty != '' %]
1378
                                                        [% patron_maxissueqty | html %]
1379
                                                    [% ELSE %]
1380
                                                        <span>Unlimited</span>
1381
                                                    [% END %]
1382
                                                </td>
1383
                                                <td>
1384
                                                    [% IF patron_maxonsiteissueqty.defined && patron_maxonsiteissueqty != '' %]
1385
                                                        [% patron_maxonsiteissueqty | html %]
1386
                                                    [% ELSE %]
1387
                                                        <span>Unlimited</span>
1388
                                                    [% END %]
1389
                                                </td>
1390
                                                <td>
1391
                                                    [% IF max_holds.defined && max_holds != '' %]
1392
                                                        [% max_holds | html %]
1393
                                                    [% ELSE %]
1394
                                                        <span>Unlimited</span>
1395
                                                    [% END %]
1396
                                                </td>
1397
                                                [% UNLESS humanbranch %]
1398
                                                    <td>
1399
                                                        <input type="checkbox" [% IF branch_cat_rule_loo.has_priority %]checked[% END %] disabled/>
1400
                                                    </td>
1401
                                                [% END %]
1402
1403
                                                <td class="actions">
1404
                                                    <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>
1405
                                                </td>
1406
                                            </tr>
1407
                                            [% END %]
1408
                                        [% END %]
1409
                                        <tr>
1410
                                            <td>
1411
                                                <select name="categorycode">
1412
                                                [% FOREACH patron_category IN patron_categories%]
1413
                                                    <option value="[% patron_category.categorycode | html %]">[% patron_category.description | html %]</option>
1414
                                                [% END %]
1415
                                                </select>
1416
                                            </td>
1417
                                            <td><input name="patron_maxissueqty" size="3" type="text" /></td>
1418
                                            <td><input name="patron_maxonsiteissueqty" size="3" type="text" /></td>
1419
                                            <td><input name="max_holds" size="3" type="text" /></td>
1420
                                            [% UNLESS humanbranch %]
1421
                                                <td>
1422
                                                    <input type="checkbox" name="has_priority"/>
1423
                                                </td>
1424
                                            [% END %]
1425
                                            <td class="actions"><button type="submit" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</td>
1426
                                        </tr>
1427
                                    </table>
1428
                                </form>
1429
                            </div>
1430
                            [% END %]
1431
1303
1432
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1304
                                [% IF holdallowed || hold_fulfillment_policy || returnbranch %]
1433
                                    <tr>
1305
                                    <tr>
1434
- 

Return to bug 8137