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

(-)a/Koha/CirculationRule.pm (+1 lines)
Lines 92-97 sub clone { Link Here
92
92
93
    my $cloned_rule = $self->unblessed;
93
    my $cloned_rule = $self->unblessed;
94
    $cloned_rule->{branchcode} = $to_branch;
94
    $cloned_rule->{branchcode} = $to_branch;
95
    $cloned_rule->{has_priority} = undef;
95
    delete $cloned_rule->{id};
96
    delete $cloned_rule->{id};
96
    return Koha::CirculationRule->new( $cloned_rule )->store;
97
    return Koha::CirculationRule->new( $cloned_rule )->store;
97
}
98
}
(-)a/Koha/CirculationRules.pm (-2 / +2 lines)
Lines 384-390 sub set_rule { Link Here
384
    my $branchcode   = $params->{branchcode};
384
    my $branchcode   = $params->{branchcode};
385
    my $categorycode = $params->{categorycode};
385
    my $categorycode = $params->{categorycode};
386
    my $itemtype     = $params->{itemtype};
386
    my $itemtype     = $params->{itemtype};
387
    my $has_priority = $params->{has_priority};
387
    my $has_priority = $params->{has_priority} ? 1 : undef;
388
    my $rule_name    = $params->{rule_name};
388
    my $rule_name    = $params->{rule_name};
389
    my $rule_value   = $params->{rule_value};
389
    my $rule_value   = $params->{rule_value};
390
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
390
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
Lines 399-411 sub set_rule { Link Here
399
            branchcode   => $branchcode,
399
            branchcode   => $branchcode,
400
            categorycode => $categorycode,
400
            categorycode => $categorycode,
401
            itemtype     => $itemtype,
401
            itemtype     => $itemtype,
402
            has_priority => $has_priority,
403
        }
402
        }
404
    )->next();
403
    )->next();
405
404
406
    if ($rule) {
405
    if ($rule) {
407
        if ( defined $rule_value ) {
406
        if ( defined $rule_value ) {
408
            $rule->rule_value($rule_value);
407
            $rule->rule_value($rule_value);
408
            $rule->has_priority($has_priority);
409
            $rule->update();
409
            $rule->update();
410
        }
410
        }
411
        else {
411
        else {
(-)a/Koha/Schema/Result/CirculationRule.pm (-2 / +5 lines)
Lines 52-58 __PACKAGE__->table("circulation_rules"); Link Here
52
52
53
=head2 has_priority
53
=head2 has_priority
54
54
55
  data_type: 'integer'
55
  data_type: 'tinyint'
56
  default_value: 0
56
  is_nullable: 1
57
  is_nullable: 1
57
58
58
=head2 rule_name
59
=head2 rule_name
Lines 79-85 __PACKAGE__->add_columns( Link Here
79
  "itemtype",
80
  "itemtype",
80
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
81
  { data_type => "varchar", is_foreign_key => 1, is_nullable => 1, size => 10 },
81
  "has_priority",
82
  "has_priority",
82
  { data_type => "integer", is_nullable => 1, is_boolean => 1 },
83
  { data_type => "tinyint", default_value => 0, is_nullable => 1 },
83
  "rule_name",
84
  "rule_name",
84
  { data_type => "varchar", is_nullable => 0, size => 32 },
85
  { data_type => "varchar", is_nullable => 0, size => 32 },
85
  "rule_value",
86
  "rule_value",
Lines 187-192 __PACKAGE__->belongs_to( Link Here
187
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-07-22 13:19:28
188
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-07-22 13:19:28
188
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mg3weVQdfPTJ+jX6X5K+Q
189
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1mg3weVQdfPTJ+jX6X5K+Q
189
190
191
__PACKAGE__->add_columns( '+has_priority' => { is_boolean => 1 });
192
190
sub koha_objects_class {
193
sub koha_objects_class {
191
    'Koha::CirculationRules';
194
    'Koha::CirculationRules';
192
}
195
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-4 / +5 lines)
Lines 1606-1615 Link Here
1606
                    itm = $(this).text();
1606
                    itm = $(this).text();
1607
                    itm = itm.replace(/^\s*|\s*$/g,'');
1607
                    itm = itm.replace(/^\s*|\s*$/g,'');
1608
                    var current_column = $("#edit_row td:eq("+i+")");
1608
                    var current_column = $("#edit_row td:eq("+i+")");
1609
                    var may_have_priority = (0 == $('select#branch option[selected]').length);
1610
                    if ( i > 4) i+=may_have_priority;
1609
                    if ( i == 3 ) {
1611
                    if ( i == 3 ) {
1610
                        // specific processing for the Note column
1612
                        // specific processing for the Note column
1611
                        var note = $(this).find("a[name='viewnote']").data("content");
1613
                        var note = $(this).find("a[name='viewnote']").data("content");
1612
                        $(current_column).find("input[type='text']").val(note);
1614
                        $(current_column).find("input[type='text']").val(note);
1615
                    } else if ( i == 4 && may_have_priority ) {
1616
                        var has_priority = $(this).find("input[type='checkbox']");
1617
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1613
                    } else if ( i == 9 ) {
1618
                    } else if ( i == 9 ) {
1614
                        // specific processing for the Hard due date column
1619
                        // specific processing for the Hard due date column
1615
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1620
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
Lines 1626-1635 Link Here
1626
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1631
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1627
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1632
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1628
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1633
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1629
                    } else if ( i == 3 ) {
1630
                        var has_priority = $(this).find("input[type='checkbox']");
1631
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1632
                        //$('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1633
                    } else {
1634
                    } else {
1634
                        $(current_column).find("input[type='text']").val(itm);
1635
                        $(current_column).find("input[type='text']").val(itm);
1635
                        // select the corresponding option
1636
                        // select the corresponding option
(-)a/t/db_dependent/Circulation.t (-1 / +4 lines)
Lines 3281-3286 subtest 'AddReturn | is_overdue' => sub { Link Here
3281
                    branchcode   => $branchcode_false,
3281
                    branchcode   => $branchcode_false,
3282
                    categorycode => undef,
3282
                    categorycode => undef,
3283
                    itemtype     => undef,
3283
                    itemtype     => undef,
3284
                    has_priority => undef,
3284
                    rule_name    => 'lostreturn',
3285
                    rule_name    => 'lostreturn',
3285
                    rule_value   => 0
3286
                    rule_value   => 0
3286
                }
3287
                }
Lines 3295-3300 subtest 'AddReturn | is_overdue' => sub { Link Here
3295
                    branchcode   => $branchcode_refund,
3296
                    branchcode   => $branchcode_refund,
3296
                    categorycode => undef,
3297
                    categorycode => undef,
3297
                    itemtype     => undef,
3298
                    itemtype     => undef,
3299
                    has_priority => undef,
3298
                    rule_name    => 'lostreturn',
3300
                    rule_name    => 'lostreturn',
3299
                    rule_value   => 'refund'
3301
                    rule_value   => 'refund'
3300
                }
3302
                }
Lines 3309-3314 subtest 'AddReturn | is_overdue' => sub { Link Here
3309
                    branchcode   => $branchcode_restore,
3311
                    branchcode   => $branchcode_restore,
3310
                    categorycode => undef,
3312
                    categorycode => undef,
3311
                    itemtype     => undef,
3313
                    itemtype     => undef,
3314
                    has_priority => undef,
3312
                    rule_name    => 'lostreturn',
3315
                    rule_name    => 'lostreturn',
3313
                    rule_value   => 'restore'
3316
                    rule_value   => 'restore'
3314
                }
3317
                }
Lines 3323-3328 subtest 'AddReturn | is_overdue' => sub { Link Here
3323
                    branchcode   => $branchcode_charge,
3326
                    branchcode   => $branchcode_charge,
3324
                    categorycode => undef,
3327
                    categorycode => undef,
3325
                    itemtype     => undef,
3328
                    itemtype     => undef,
3329
                    has_priority => undef,
3326
                    rule_name    => 'lostreturn',
3330
                    rule_name    => 'lostreturn',
3327
                    rule_value   => 'charge'
3331
                    rule_value   => 'charge'
3328
                }
3332
                }
3329
- 

Return to bug 8137