Bug 4374 Improve biblio data entry form regarding hidden/mandatory fields

Biblio framework has 3 entry points controlling if input box are
displayed by default in data entry form:

  - 'mandatory' flag at field level
  - 'mandatory' flag at subfield level
  - 'hidden' flag at subfield level

It doesn't work as it should (?):

  - All subfields are expanded (shown) if their field is mandatory
  - A subfield containing anything is always expanded whatever it contains
  - A mandatory subfield is always expanded
  - An hidden subfield isn't expanded.

Default framework having 0 in all marc_subfield_structure.hidden, by default
all subfields will be expanded.

TO BE INTEGRATED IN RELEASE NOTES:

  Koha sysadmin should have to edit its frameworks to add hidden=1 in
  appropriate subfields.

Signed-off-by: Stéphane Delaune <stephane.delaune@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit cecdc19369)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Frédéric Demians 2011-04-06 10:14:29 +02:00 committed by Chris Nighswonger
parent f19e7bb5c9
commit bd1c75cb03
1 changed files with 7 additions and 7 deletions

View File

@ -341,14 +341,14 @@ sub create_input {
if(exists $mandatory_z3950->{$tag.$subfield}){
$subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
}
# decide if the subfield must be expanded (visible) by default or not
# if it is mandatory, then expand. If it is hidden explicitly by the hidden flag, hidden anyway
# Subfield is hidden depending of hidden and mandatory flag, and is always
# shown if it contains anything or if its field is mandatory.
my $tdef = $tagslib->{$tag};
$subfield_data{visibility} = "display:none;"
if ( ($tagslib->{$tag}->{$subfield}->{hidden} % 2 == 1) and $value ne ''
or ($value eq '' and !$tagslib->{$tag}->{$subfield}->{mandatory})
);
# always expand all subfields of a mandatory field
$subfield_data{visibility} = "" if $tagslib->{$tag}->{mandatory};
if $tdef->{$subfield}->{hidden} % 2 == 1 &&
$value eq '' &&
!$tdef->{$subfield}->{mandatory} &&
!$tdef->{mandatory};
# it's an authorised field
if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
$subfield_data{marc_value} =