Bug 17915

Summary: warning in Stage MARC records for import when matching rule with offset
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: ToolsAssignee: Fridolin Somers <fridolin.somers>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 17915 - warning in Stage MARC records for import when matching rule with offset

Description Fridolin Somers 2017-01-16 15:42:27 UTC
When using Stage MARC records for import with a matching rule where an offset is defined, the input string may be empty or shorter than the offset.
This generated a warning :
stage-marc-import.pl: substr outside of string at /home/koha/src/C4/Matcher.pm line 822.
Comment 1 Fridolin Somers 2017-01-17 08:18:50 UTC
Created attachment 59069 [details] [review]
Bug 17915 - warning in Stage MARC records for import when matching rule with offset

When using Stage MARC records for import with a matching rule where an offset is defined, the input string may be empty or shorter than the offset.
This generated a warning :
stage-marc-import.pl: substr outside of string at /home/koha/src/C4/Matcher.pm line 822.

Test plan :
- define a matching rule on ISBN with length 0 and offset 999 (too big for any value)
- import some MARC records with this matching rule
- check the perl warns
=> Without patch you see warns : "substr outside of string at /home/koha/src/C4/Matcher.pm"
=> With patch no such warn
- edit the matching rule to set offset 0
- import some MARC records, with matching ISBN, with this matching rule
=> Import must match existing records with same ISBN
Comment 2 Owen Leonard 2017-05-09 16:58:50 UTC Comment hidden (obsolete)
Comment 3 Owen Leonard 2017-10-11 13:38:20 UTC
I was able to reproduce this problem in master, and the patch does make the error go away. However, I'm seeing a different error now:

stage-marc-import.pl: DBIx::Class::Storage::DBI::select_single(): Query returned more than one row.  SQL that returns multiple rows is DEPRECATED for ->find and ->single at /home/vagrant/kohaclone/Koha/Objects.pm line 92

Is this error within the scope of this bug?
Comment 4 Fridolin Somers 2020-03-27 13:06:16 UTC
(In reply to Owen Leonard from comment #3)
> I was able to reproduce this problem in master, and the patch does make the
> error go away. However, I'm seeing a different error now:
> 
> stage-marc-import.pl: DBIx::Class::Storage::DBI::select_single(): Query
> returned more than one row.  SQL that returns multiple rows is DEPRECATED
> for ->find and ->single at /home/vagrant/kohaclone/Koha/Objects.pm line 92
> 
> Is this error within the scope of this bug?

Oh could you test again please ?