Bug 11200

Summary: Adding subfield without field in addbiblio.pl
Product: Koha Reporter: Nuño López Ansótegui <nunyo.lopez>
Component: CatalogingAssignee: Nuño López Ansótegui <nunyo.lopez>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, m.de.rooy, mtompset, nunyo.lopez, veron
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 11200 - Adding subfield without field in addbiblio.pl

Description Nuño López Ansótegui 2013-11-05 10:02:58 UTC
In addbiblio.pl, subfield is adding but don't check if field exist.

if ($title) {

#                         $field->add_subfields("$subfield"=>"[ ".ucfirst($title).ucfirst($firstname)." ".$number." ]");
                        $field->add_subfields(
                                "$subfield" => ucfirst($title) . " "
                              . ucfirst($firstname) . " "
                              . $number );
                    }
                    else {

#                       $field->add_subfields("$subfield"=>"[ ".ucfirst($firstname).", ".ucfirst($lastname)." ]");
                        $field->add_subfields(
                            "$subfield" => ucfirst($firstname) . ", "
                              . ucfirst($lastname) );
                    }
Comment 1 Nuño López Ansótegui 2013-11-05 10:32:57 UTC
Created attachment 22716 [details] [review]
Bug 11200 - Adding subfield without field in addbiblio.pl
Comment 2 Owen Leonard 2013-11-14 13:49:18 UTC
Please provide a more thorough description of the problem this fixes and a test plan.
Comment 3 Marc Véron 2015-12-24 13:55:25 UTC
Is this bug still valid?
Comment 4 Mark Tompsett 2016-03-30 18:53:34 UTC
(In reply to Marc Véron from comment #3)
> Is this bug still valid?

From my quick skim of the code, I think maybe so.

If you have z3950NormalizeAuthor, z3950AuthorAuthFields, and UNIMARC...
and you lack a biblio.author field, as defined in marc_subfields_structure tagfield and subtagfield, in the record, then $field never gets defined. If it isn't defined, I would expect $field->add_subfields() to explode.
Comment 5 Jonathan Druart 2019-12-16 09:50:22 UTC
Lowering severity as we do not have a test plan to recreate the problem.