Bug 27837: Always pass permanent location from items editor if it was defined
By always passing permenent location from the items editor, we can know if permanent location was defined in the framework. This means we can know if we should update permanent location independently of location even if permenent location has an empty value. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
db382ebaff
commit
f5bd16410a
17
C4/Biblio.pm
17
C4/Biblio.pm
|
|
@ -2076,6 +2076,8 @@ sub TransformHtmlToXml {
|
|||
my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
|
||||
# NOTE: The parameter $ind_tag is NOT USED -- BZ 11247
|
||||
|
||||
my ( $perm_loc_tag, $perm_loc_subfield ) = C4::Biblio::GetMarcFromKohaField( "items.permanent_location" );
|
||||
|
||||
my $xml = MARC::File::XML::header('UTF-8');
|
||||
$xml .= "<record>\n";
|
||||
$auth_type = C4::Context->preference('marcflavour') unless $auth_type;
|
||||
|
|
@ -2091,7 +2093,6 @@ sub TransformHtmlToXml {
|
|||
my $j = -1;
|
||||
my $close_last_tag;
|
||||
for ( my $i = 0 ; $i < @$tags ; $i++ ) {
|
||||
|
||||
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) {
|
||||
|
||||
# if we have a 100 field and it's values are not correct, skip them.
|
||||
|
|
@ -2109,6 +2110,13 @@ sub TransformHtmlToXml {
|
|||
@$values[$i] =~ s/"/"/g;
|
||||
@$values[$i] =~ s/'/'/g;
|
||||
|
||||
my $skip = @$values[$i] eq q{};
|
||||
$skip = 0
|
||||
if $perm_loc_tag
|
||||
&& $perm_loc_subfield
|
||||
&& @$tags[$i] eq $perm_loc_tag
|
||||
&& @$subfields[$i] eq $perm_loc_subfield;
|
||||
|
||||
if ( ( @$tags[$i] ne $prevtag ) ) {
|
||||
$close_last_tag = 0;
|
||||
$j++ unless ( @$tags[$i] eq "" );
|
||||
|
|
@ -2118,7 +2126,7 @@ sub TransformHtmlToXml {
|
|||
if ( !$first ) {
|
||||
$xml .= "</datafield>\n";
|
||||
if ( ( @$tags[$i] && @$tags[$i] > 10 )
|
||||
&& ( @$values[$i] ne "" ) ) {
|
||||
&& ( !$skip ) ) {
|
||||
$xml .= "<datafield tag=\"@$tags[$i]\" ind1=\"$ind1\" ind2=\"$ind2\">\n";
|
||||
$xml .= "<subfield code=\"@$subfields[$i]\">@$values[$i]</subfield>\n";
|
||||
$first = 0;
|
||||
|
|
@ -2127,7 +2135,7 @@ sub TransformHtmlToXml {
|
|||
$first = 1;
|
||||
}
|
||||
} else {
|
||||
if ( @$values[$i] ne "" ) {
|
||||
if ( !$skip ) {
|
||||
|
||||
# leader
|
||||
if ( @$tags[$i] eq "000" ) {
|
||||
|
|
@ -2147,8 +2155,7 @@ sub TransformHtmlToXml {
|
|||
}
|
||||
}
|
||||
} else { # @$tags[$i] eq $prevtag
|
||||
if ( @$values[$i] eq "" ) {
|
||||
} else {
|
||||
if ( !$skip ) {
|
||||
if ($first) {
|
||||
my $str = ( $indicator->[$j] // q{} ) . ' '; # extra space prevents substr outside of string warn
|
||||
my $ind1 = _default_ind_to_space( substr( $str, 0, 1 ) );
|
||||
|
|
|
|||
Loading…
Reference in New Issue