Bug 18088 - Software error additem.pl Can't call method subfield error. Can't add items.
Summary: Software error additem.pl Can't call method subfield error. Can't add items.
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: 16.11
Hardware: All All
: P5 - low enhancement
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-09 10:40 UTC by hard359
Modified: 2020-01-06 20:15 UTC (History)
2 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Crowdfunding committed: 0
Crowdfunding contact:
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hard359 2017-02-09 10:40:19 UTC
While adding items it sais:

Can't call method "subfield" on an undefined value at /usr/share/koha/intranet/cgi-bin/cataloguing/additem.pl line 91.

Line 88 to 103

sub _increment_barcode {
    my ($record, $frameworkcode) = @_;
    my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode);
    unless ($record->field($tagfield)->subfield($tagsubfield)) {
        my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items");
        $sth_barcode->execute;
        my ($newbarcode) = $sth_barcode->fetchrow;
        $newbarcode++;
        # OK, we have the new barcode, now create the entry in MARC record
        my $fieldItem = $record->field($tagfield);
        $record->delete_field($fieldItem);
        $fieldItem->add_subfields($tagsubfield => $newbarcode);
        $record->insert_fields_ordered($fieldItem);
    }
    return $record;
}
Comment 1 Katrin Fischer 2018-06-22 20:25:15 UTC
Is items.barcode mapped to a MARC field in your frameworks? You can check on the Koha 2 MARC configuration page.