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

(-)a/Koha/CirculationRule.pm (+1 lines)
Lines 89-94 sub clone { Link Here
89
89
90
    my $cloned_rule = $self->unblessed;
90
    my $cloned_rule = $self->unblessed;
91
    $cloned_rule->{branchcode} = $to_branch;
91
    $cloned_rule->{branchcode} = $to_branch;
92
    $cloned_rule->{has_priority} = undef;
92
    delete $cloned_rule->{id};
93
    delete $cloned_rule->{id};
93
    return Koha::CirculationRule->new( $cloned_rule )->store;
94
    return Koha::CirculationRule->new( $cloned_rule )->store;
94
}
95
}
(-)a/Koha/CirculationRules.pm (-2 / +2 lines)
Lines 391-397 sub set_rule { Link Here
391
    my $branchcode   = $params->{branchcode};
391
    my $branchcode   = $params->{branchcode};
392
    my $categorycode = $params->{categorycode};
392
    my $categorycode = $params->{categorycode};
393
    my $itemtype     = $params->{itemtype};
393
    my $itemtype     = $params->{itemtype};
394
    my $has_priority = $params->{has_priority};
394
    my $has_priority = $params->{has_priority} ? 1 : undef;
395
    my $rule_name    = $params->{rule_name};
395
    my $rule_name    = $params->{rule_name};
396
    my $rule_value   = $params->{rule_value};
396
    my $rule_value   = $params->{rule_value};
397
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
397
    my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
Lines 409-421 sub set_rule { Link Here
409
            branchcode   => $branchcode,
409
            branchcode   => $branchcode,
410
            categorycode => $categorycode,
410
            categorycode => $categorycode,
411
            itemtype     => $itemtype,
411
            itemtype     => $itemtype,
412
            has_priority => $has_priority,
413
        }
412
        }
414
    )->next();
413
    )->next();
415
414
416
    if ($rule) {
415
    if ($rule) {
417
        if ( defined $rule_value ) {
416
        if ( defined $rule_value ) {
418
            $rule->rule_value($rule_value);
417
            $rule->rule_value($rule_value);
418
            $rule->has_priority($has_priority);
419
            $rule->update();
419
            $rule->update();
420
        }
420
        }
421
        else {
421
        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 (-5 / +6 lines)
Lines 1613-1623 Link Here
1613
                    itm_text = $(this).text();
1613
                    itm_text = $(this).text();
1614
                    itm_text = itm_text.replace(/^\s*|\s*$/g,'');
1614
                    itm_text = itm_text.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);
1620
                    } else if ( i == 9 ) {
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') );
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();
1623
                        var input_value = '';
1628
                        var input_value = '';
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_text);
1642
                        $(current_column).find("input[type='text']").val(itm_text);
1642
                        // unformat prices
1643
                        // unformat prices
(-)a/t/db_dependent/Circulation.t (-1 / +4 lines)
Lines 3306-3311 subtest 'AddReturn | is_overdue' => sub { Link Here
3306
                    branchcode   => $branchcode_false,
3306
                    branchcode   => $branchcode_false,
3307
                    categorycode => undef,
3307
                    categorycode => undef,
3308
                    itemtype     => undef,
3308
                    itemtype     => undef,
3309
                    has_priority => undef,
3309
                    rule_name    => 'lostreturn',
3310
                    rule_name    => 'lostreturn',
3310
                    rule_value   => 0
3311
                    rule_value   => 0
3311
                }
3312
                }
Lines 3320-3325 subtest 'AddReturn | is_overdue' => sub { Link Here
3320
                    branchcode   => $branchcode_refund,
3321
                    branchcode   => $branchcode_refund,
3321
                    categorycode => undef,
3322
                    categorycode => undef,
3322
                    itemtype     => undef,
3323
                    itemtype     => undef,
3324
                    has_priority => undef,
3323
                    rule_name    => 'lostreturn',
3325
                    rule_name    => 'lostreturn',
3324
                    rule_value   => 'refund'
3326
                    rule_value   => 'refund'
3325
                }
3327
                }
Lines 3334-3339 subtest 'AddReturn | is_overdue' => sub { Link Here
3334
                    branchcode   => $branchcode_restore,
3336
                    branchcode   => $branchcode_restore,
3335
                    categorycode => undef,
3337
                    categorycode => undef,
3336
                    itemtype     => undef,
3338
                    itemtype     => undef,
3339
                    has_priority => undef,
3337
                    rule_name    => 'lostreturn',
3340
                    rule_name    => 'lostreturn',
3338
                    rule_value   => 'restore'
3341
                    rule_value   => 'restore'
3339
                }
3342
                }
Lines 3348-3353 subtest 'AddReturn | is_overdue' => sub { Link Here
3348
                    branchcode   => $branchcode_charge,
3351
                    branchcode   => $branchcode_charge,
3349
                    categorycode => undef,
3352
                    categorycode => undef,
3350
                    itemtype     => undef,
3353
                    itemtype     => undef,
3354
                    has_priority => undef,
3351
                    rule_name    => 'lostreturn',
3355
                    rule_name    => 'lostreturn',
3352
                    rule_value   => 'charge'
3356
                    rule_value   => 'charge'
3353
                }
3357
                }
3354
- 

Return to bug 8137