Bug 27968: Fix framework import if isurl has an incorrect value
If isurl is set to undef in the DB, it will be exported as an empty string, which is an invalid value for isurl (int) Incorrect integer value: '' for column 'isurl' Test plan: Export framework structure in CSV and ODS, then reimport it and check that all the subfields are important correctly Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
f096a8dffc
commit
01f0e04172
|
|
@ -977,6 +977,9 @@ sub _import_table_csv
|
|||
} elsif ($fields->[$j] eq 'frameworkcode' && $value ne $frameworkcode) {
|
||||
$dataFields{$fields->[$j]} = $frameworkcode;
|
||||
push @values, $frameworkcode;
|
||||
} elsif ($fields->[$j] eq 'isurl' && defined $value && $value eq q{}) {
|
||||
$dataFields{$fields->[$j]} = undef;
|
||||
push @values, undef;
|
||||
} else {
|
||||
$dataFields{$fields->[$j]} = $value;
|
||||
push @values, $value;
|
||||
|
|
@ -1094,7 +1097,12 @@ sub _getDataFields
|
|||
if ($ok) {
|
||||
$data //= '';
|
||||
$data = '' if ($data eq '#');
|
||||
$data = $frameworkcode if ($fields->[$i] eq 'frameworkcode');
|
||||
if ( $fields->[$i] eq 'frameworkcode' ) {
|
||||
$data = $frameworkcode;
|
||||
}
|
||||
elsif ( $fields->[$i] eq 'isurl' ) {
|
||||
$data = undef if defined $data && $data eq q{};
|
||||
}
|
||||
$dataFields->{$fields->[$i]} = $data;
|
||||
push @dataFieldsA, $data;
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
"#-#","#-#","#-#","#-#","#-#","#-#","#-#"
|
||||
|
||||
"tagfield","tagsubfield","liblibrarian","libopac","repeatable","mandatory","kohafield","tab","authorised_value","authtypecode","value_builder","isurl","hidden","frameworkcode","seealso","link","defaultvalue","maxlength"
|
||||
"000","@","fixed length control field","fixed length control field","0","1","","0","","","marc21_leader.pl","0","0","","","","","24"
|
||||
"000","@","fixed length control field","fixed length control field","0","1","","0","","","marc21_leader.pl","","0","","","","","24"
|
||||
"001","@","control field","control field","0","0","","0","","","","0","0","","","","","9999"
|
||||
"003","@","control field","control field","0","1","","0","","","marc21_orgcode.pl","0","0","","","","","9999"
|
||||
"005","@","control field","control field","0","1","","0","","","marc21_field_005.pl","0","0","","","","","9999"
|
||||
|
|
|
|||
|
Can't render this file because it has a wrong number of fields in line 9.
|
Loading…
Reference in New Issue