https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15870

Tomás Cohen Arazi <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Failed QA

--- Comment #6 from Tomás Cohen Arazi <[email protected]> ---
This bug was lacking functionality tests. As it is in my best interest to have
this moving, I've gone through the process of writing unit tests for this piece
of code.

Things that weren't tested:
- opac vs. intranet (interface option)
- test all the possible values.
- control fields and datafields traverse different code branches, and needed to
be tested.

The tests I wrote cover most of what is needed. Please read the TODO in the
commit message.

The tests fail.

Mark: you need to get rid of the clone. The RecordProcessor pipeline is
designed so it works on the original object. Doing so will make several tests
pass:

    foreach my $current_record (@records) {
-        my $result        = $current_record->clone();
+        my $result        = $current_record;


There are still problems. Hopefully problems in the tests. I couldn't spend
more time on this.

Also, there is a weird construct you should get rid off, so you simplify the
code and make it more readable:

+    else {
+        # visibility is a "level" (-7 to +7), default to 0
+        my $visibility = $marcsubfieldstructure->{$tag}->{q{@}}->{hidden};
+        $visibility //= 0;
+        my $hidden;
+        if ( $display->{$interface}->{$visibility} ) {
+            $hidden = 0;
+        }
+        else {
+            $hidden = 1;
+            $result->delete_fields($field);
+        }
+    }

could be just:

+    else {
+        # visibility is a "level" (-7 to +7), default to 0
+        my $visibility = $marcsubfieldstructure->{$tag}->{q{@}}->{hidden};
+        $visibility //= 0;
+        if ( ! $display->{$interface}->{$visibility} ) {
+            $result->delete_fields($field);
+        }
+    }

Looking forward to your comments and/or followups. Count on me to have this
done ASAP.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to