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 298-304 sub set_rule { Link Here
298
    my $branchcode   = $params->{branchcode};
298
    my $branchcode   = $params->{branchcode};
299
    my $categorycode = $params->{categorycode};
299
    my $categorycode = $params->{categorycode};
300
    my $itemtype     = $params->{itemtype};
300
    my $itemtype     = $params->{itemtype};
301
    my $has_priority = $params->{has_priority};
301
    my $has_priority = $params->{has_priority} ? 1 : undef;
302
    my $rule_name    = $params->{rule_name};
302
    my $rule_name    = $params->{rule_name};
303
    my $rule_value   = $params->{rule_value};
303
    my $rule_value   = $params->{rule_value};
304
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
304
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
Lines 313-325 sub set_rule { Link Here
313
            branchcode   => $branchcode,
313
            branchcode   => $branchcode,
314
            categorycode => $categorycode,
314
            categorycode => $categorycode,
315
            itemtype     => $itemtype,
315
            itemtype     => $itemtype,
316
            has_priority => $has_priority,
317
        }
316
        }
318
    )->next();
317
    )->next();
319
318
320
    if ($rule) {
319
    if ($rule) {
321
        if ( defined $rule_value ) {
320
        if ( defined $rule_value ) {
322
            $rule->rule_value($rule_value);
321
            $rule->rule_value($rule_value);
322
            $rule->has_priority($has_priority);
323
            $rule->update();
323
            $rule->update();
324
        }
324
        }
325
        else {
325
        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 1120-1129 Link Here
1120
                    itm = $(this).text();
1120
                    itm = $(this).text();
1121
                    itm = itm.replace(/^\s*|\s*$/g,'');
1121
                    itm = itm.replace(/^\s*|\s*$/g,'');
1122
                    var current_column = $("#edit_row td:eq("+i+")");
1122
                    var current_column = $("#edit_row td:eq("+i+")");
1123
                    var may_have_priority = (0 == $('select#branch option[selected]').length);
1124
                    if ( i > 4) i+=may_have_priority;
1123
                    if ( i == 3 ) {
1125
                    if ( i == 3 ) {
1124
                        // specific processing for the Note column
1126
                        // specific processing for the Note column
1125
                        var note = $(this).find("a[name='viewnote']").data("content");
1127
                        var note = $(this).find("a[name='viewnote']").data("content");
1126
                        $(current_column).find("input[type='text']").val(note);
1128
                        $(current_column).find("input[type='text']").val(note);
1129
                    } else if ( i == 4 && may_have_priority ) {
1130
                        var has_priority = $(this).find("input[type='checkbox']");
1131
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1127
                    } else if ( i == 9 ) {
1132
                    } else if ( i == 9 ) {
1128
                        // specific processing for the Hard due date column
1133
                        // specific processing for the Hard due date column
1129
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
1134
                        var select_value = $(this).find("input[type='hidden'][name='hardduedatecomparebackup']").val();
Lines 1140-1149 Link Here
1140
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1145
                        var cap_fine_to_replacement_price = $(this).find("input[type='checkbox']");
1141
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1146
                        $('#cap_fine_to_replacement_price').prop('checked', cap_fine_to_replacement_price.is(':checked') );
1142
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1147
                        $('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1143
                    } else if ( i == 3 ) {
1144
                        var has_priority = $(this).find("input[type='checkbox']");
1145
                        $('#has_priority').prop('checked', has_priority.is(':checked') );
1146
                        //$('#overduefinescap').prop('disabled', cap_fine_to_replacement_price.is(':checked') );
1147
                    } else {
1148
                    } else {
1148
                        $(current_column).find("input[type='text']").val(itm);
1149
                        $(current_column).find("input[type='text']").val(itm);
1149
                        // select the corresponding option
1150
                        // select the corresponding option
(-)a/t/db_dependent/Circulation.t (-1 / +4 lines)
Lines 2791-2796 subtest 'AddReturn | is_overdue' => sub { Link Here
2791
                    branchcode   => $branchcode_false,
2791
                    branchcode   => $branchcode_false,
2792
                    categorycode => undef,
2792
                    categorycode => undef,
2793
                    itemtype     => undef,
2793
                    itemtype     => undef,
2794
                    has_priority => undef,
2794
                    rule_name    => 'lostreturn',
2795
                    rule_name    => 'lostreturn',
2795
                    rule_value   => 0
2796
                    rule_value   => 0
2796
                }
2797
                }
Lines 2805-2810 subtest 'AddReturn | is_overdue' => sub { Link Here
2805
                    branchcode   => $branchcode_refund,
2806
                    branchcode   => $branchcode_refund,
2806
                    categorycode => undef,
2807
                    categorycode => undef,
2807
                    itemtype     => undef,
2808
                    itemtype     => undef,
2809
                    has_priority => undef,
2808
                    rule_name    => 'lostreturn',
2810
                    rule_name    => 'lostreturn',
2809
                    rule_value   => 'refund'
2811
                    rule_value   => 'refund'
2810
                }
2812
                }
Lines 2819-2824 subtest 'AddReturn | is_overdue' => sub { Link Here
2819
                    branchcode   => $branchcode_restore,
2821
                    branchcode   => $branchcode_restore,
2820
                    categorycode => undef,
2822
                    categorycode => undef,
2821
                    itemtype     => undef,
2823
                    itemtype     => undef,
2824
                    has_priority => undef,
2822
                    rule_name    => 'lostreturn',
2825
                    rule_name    => 'lostreturn',
2823
                    rule_value   => 'restore'
2826
                    rule_value   => 'restore'
2824
                }
2827
                }
Lines 2833-2838 subtest 'AddReturn | is_overdue' => sub { Link Here
2833
                    branchcode   => $branchcode_charge,
2836
                    branchcode   => $branchcode_charge,
2834
                    categorycode => undef,
2837
                    categorycode => undef,
2835
                    itemtype     => undef,
2838
                    itemtype     => undef,
2839
                    has_priority => undef,
2836
                    rule_name    => 'lostreturn',
2840
                    rule_name    => 'lostreturn',
2837
                    rule_value   => 'charge'
2841
                    rule_value   => 'charge'
2838
                }
2842
                }
2839
- 

Return to bug 8137