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 1613-1622 Link Here
1613
                    itm = $(this).text();
1613
                    itm = $(this).text();
1614
                    itm = itm.replace(/^\s*|\s*$/g,'');
1614
                    itm = itm.replace(/^\s*|\s*$/g,'');
1615
                    var current_column = $("#edit_row td:eq("+i+")");
1615
                    var current_column = $("#edit_row td:eq("+i+")");
1616
                    var may_have_priority = (0 == $('select#branch option[selected]').length);
1617
                    if ( i > 4) i+=may_have_priority;
1616
                    if ( i == 3 ) {
1618
                    if ( i == 3 ) {
1617
                        // specific processing for the Note column
1619
                        // specific processing for the Note column
1618
                        var note = $(this).find("a[name='viewnote']").data("content");
1620
                        var note = $(this).find("a[name='viewnote']").data("content");
1619
                        $(current_column).find("input[type='text']").val(note);
1621
                        $(current_column).find("input[type='text']").val(note);
1622
                    } else if ( i == 4 && may_have_priority ) {
1623
                        var has_priority = $(this).find("input[type='checkbox']");
1624
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1620
                    } else if ( i == 9 ) {
1625
                    } else if ( i == 9 ) {
1621
                        // specific processing for the Hard due date column
1626
                        // specific processing for the Hard due date column
1622
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1627
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
Lines 1633-1642 Link Here
1633
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1638
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1634
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1639
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1635
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1640
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1636
                    } else if ( i == 3 ) {
1637
                        var has_priority = $(this).find("input[type='checkbox']");
1638
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1639
                        //$('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1640
                    } else {
1641
                    } else {
1641
                        $(current_column).find("input[type='text']").val(itm);
1642
                        $(current_column).find("input[type='text']").val(itm);
1642
                        // select the corresponding option
1643
                        // select the corresponding option
(-)a/t/db_dependent/Circulation.t (-1 / +4 lines)
Lines 3223-3228 subtest 'AddReturn | is_overdue' => sub { Link Here
3223
                    branchcode   => $branchcode_false,
3223
                    branchcode   => $branchcode_false,
3224
                    categorycode => undef,
3224
                    categorycode => undef,
3225
                    itemtype     => undef,
3225
                    itemtype     => undef,
3226
                    has_priority => undef,
3226
                    rule_name    => 'lostreturn',
3227
                    rule_name    => 'lostreturn',
3227
                    rule_value   => 0
3228
                    rule_value   => 0
3228
                }
3229
                }
Lines 3237-3242 subtest 'AddReturn | is_overdue' => sub { Link Here
3237
                    branchcode   => $branchcode_refund,
3238
                    branchcode   => $branchcode_refund,
3238
                    categorycode => undef,
3239
                    categorycode => undef,
3239
                    itemtype     => undef,
3240
                    itemtype     => undef,
3241
                    has_priority => undef,
3240
                    rule_name    => 'lostreturn',
3242
                    rule_name    => 'lostreturn',
3241
                    rule_value   => 'refund'
3243
                    rule_value   => 'refund'
3242
                }
3244
                }
Lines 3251-3256 subtest 'AddReturn | is_overdue' => sub { Link Here
3251
                    branchcode   => $branchcode_restore,
3253
                    branchcode   => $branchcode_restore,
3252
                    categorycode => undef,
3254
                    categorycode => undef,
3253
                    itemtype     => undef,
3255
                    itemtype     => undef,
3256
                    has_priority => undef,
3254
                    rule_name    => 'lostreturn',
3257
                    rule_name    => 'lostreturn',
3255
                    rule_value   => 'restore'
3258
                    rule_value   => 'restore'
3256
                }
3259
                }
Lines 3265-3270 subtest 'AddReturn | is_overdue' => sub { Link Here
3265
                    branchcode   => $branchcode_charge,
3268
                    branchcode   => $branchcode_charge,
3266
                    categorycode => undef,
3269
                    categorycode => undef,
3267
                    itemtype     => undef,
3270
                    itemtype     => undef,
3271
                    has_priority => undef,
3268
                    rule_name    => 'lostreturn',
3272
                    rule_name    => 'lostreturn',
3269
                    rule_value   => 'charge'
3273
                    rule_value   => 'charge'
3270
                }
3274
                }
3271
- 

Return to bug 8137