[Koha-patches] [PATCH] [SIGNED-OFF] Bug 4374 Improve biblio data entry form regarding hidden/mandatory fields
Stéphane Delaune
stephane.delaune at biblibre.com
Wed Apr 6 10:14:29 CEST 2011
From: Frédéric Demians <f.demians at tamil.fr>
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 at biblibre.com>
---
cataloguing/addbiblio.pl | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 038878f..4bb2012 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -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} =
--
1.7.0.4
More information about the Koha-patches
mailing list