Lines 684-690
$skip_all_rule->delete();
Link Here
|
684 |
|
684 |
|
685 |
# Test module filter specificity |
685 |
# Test module filter specificity |
686 |
subtest 'Module filter precedence tests' => sub { |
686 |
subtest 'Module filter precedence tests' => sub { |
687 |
plan tests => 7; |
687 |
plan tests => 9; |
688 |
|
688 |
|
689 |
$rule->set( |
689 |
$rule->set( |
690 |
{ |
690 |
{ |
Lines 868-873
subtest 'Module filter precedence tests' => sub {
Link Here
|
868 |
'Wildcard filter rules with tags with tag regexps matching the same tag as regexps for non wildcard filter rules has been overridden' |
868 |
'Wildcard filter rules with tags with tag regexps matching the same tag as regexps for non wildcard filter rules has been overridden' |
869 |
); |
869 |
); |
870 |
|
870 |
|
|
|
871 |
my $categorycode_matching_filter_rule_protect = Koha::MarcOverlayRules->find_or_create( |
872 |
{ |
873 |
tag => '*', |
874 |
module => 'categorycode', |
875 |
filter => 'C', |
876 |
add => 0, |
877 |
append => 0, |
878 |
remove => 0, |
879 |
delete => 0 |
880 |
} |
881 |
); |
882 |
|
883 |
# Current rules: |
884 |
# source: *, tag: *, add: 0, append: 0, remove: 0, delete: 0 |
885 |
# source: *, tag: 5\d{2}, add: 1, append: 1, remove: 1, delete: 1 |
886 |
# source: test, tag: 250, add: 1, append: 1, remove: 1, delete: 1 |
887 |
# source: test, tag: 5\d{2}, add: 0, append: 0, remove: 0, delete: 0 |
888 |
# categorycode: C, tag: *, add: 0, append: 0, remove: 0, delete: 0 |
889 |
$merged_record = Koha::MarcOverlayRules->merge_records( |
890 |
$orig_record, |
891 |
$incoming_record, |
892 |
{ 'source' => 'test', 'categorycode' => 'C' } |
893 |
); |
894 |
|
895 |
is( |
896 |
$merged_record->as_formatted, |
897 |
$orig_record->as_formatted, |
898 |
'If both categorycode and source module contexts matches, rules from categorycode module context are used' |
899 |
); |
900 |
|
901 |
my $userid_matching_filter_rule_protect = Koha::MarcOverlayRules->find_or_create( |
902 |
{ |
903 |
tag => '*', |
904 |
module => 'userid', |
905 |
filter => '123', |
906 |
add => 1, |
907 |
append => 1, |
908 |
remove => 1, |
909 |
delete => 1 |
910 |
} |
911 |
); |
912 |
|
913 |
# Current rules: |
914 |
# source: *, tag: *, add: 0, append: 0, remove: 0, delete: 0 |
915 |
# source: *, tag: 5\d{2}, add: 1, append: 1, remove: 1, delete: 1 |
916 |
# source: test, tag: 250, add: 1, append: 1, remove: 1, delete: 1 |
917 |
# source: test, tag: 5\d{2}, add: 0, append: 0, remove: 0, delete: 0 |
918 |
# categorycode: C, tag: *, add: 0, append: 0, remove: 0, delete: 0 |
919 |
# userid: 123, tag: *, add: 1, append: 1, remove: 1, delete: 1 |
920 |
$merged_record = Koha::MarcOverlayRules->merge_records( |
921 |
$orig_record, |
922 |
$incoming_record, |
923 |
{ 'source' => 'test', 'categorycode' => 'C', 'userid' => '123' } |
924 |
); |
925 |
|
926 |
is( |
927 |
$merged_record->as_formatted, |
928 |
$incoming_record->as_formatted, |
929 |
'If both userid, categorycode and source module contexts matches, rules from userid module context are used' |
930 |
); |
931 |
|
932 |
$categorycode_matching_filter_rule_protect->delete(); |
933 |
$userid_matching_filter_rule_protect->delete(); |
871 |
$wildcard_filter_rule_overwrite->delete(); |
934 |
$wildcard_filter_rule_overwrite->delete(); |
872 |
$matching_filter_rule_overwrite->delete(); |
935 |
$matching_filter_rule_overwrite->delete(); |
873 |
$matching_filter_rule_protect->delete(); |
936 |
$matching_filter_rule_protect->delete(); |
874 |
- |
|
|