Koha/C4
Marcel de Rooy 48aba1533c Bug 6852: Staged import reports wrong success for items
If we import items that have a wrong branch code, the items will not
be imported but manage-marc-import reports them as imported. (A wrong
branch code probably occurs most, but other causes are possible too.)

The underlying cause is that AddItem does not look at the error
returned from _koha_new_item in Items.pm.

This patch deals with that omission in the most economical way. It adjusts
AddItem so that it returns undef if no item was added.
In ImportBatch.pm I check if an item was added and adjust the totals
accordingly instead of just always counting them.

Note: Several scripts like additem.pl use AddItemFromMarc to call
AddItem. They do not report an error, but fail silently. With this patch,
these scripts get undef and will still fail silently. (No change.)
Adding error checks around calls of AddItemFromMarc is outside the scope of
this report. Here we are taking care of correct imported item numbers.

Test plan:
[1] Verify that additem.pl still works by adding a new item.
[2] Run t/db_dependent/Items.t
[3] Add a new branchcode, say XXX.
[4] Pick a biblio record with a few items (n) and set one item to branch XXX.
[5] Export this biblio with items to a MARC file.
[6] Change the XXX item to the original branch and remove branch XXX.
[7] Import the MARC file. Verify that one item was not imported and that
    the number of imported items reflects that (equals n-1).

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-09-12 08:55:41 +00:00
..
AuthoritiesMarc
Barcodes Bug 16635: [QA Follow-up] Eliminate some global package vars 2016-06-10 17:58:48 +00:00
Bookseller
ClassSortRoutine
Creators
External Bug 17189: Replace occurrences of 'use Koha::Cache' 2016-09-08 10:24:47 +00:00
Form
Heading
ILSDI Bug 15758: Koha::Libraries - Remove GetBranches 2016-09-08 14:36:03 +00:00
Installer Bug 16685 [QA Followup] - Use Path::Tiny::slurp instead of File::Slurp 2016-09-09 12:53:07 +00:00
Labels Bug 15758: Koha::Libraries - Remove GetBranchName 2016-09-08 14:36:01 +00:00
Linker
Members Bug 16443: Make C4::Members::Statistics plack safe 2016-06-10 16:35:09 +00:00
OAI
Output
Patroncards
Reports Bug 15407: Koha::Patron::Categories - remove sql queries in some pl and pm 2016-09-08 13:29:03 +00:00
Search
Serials
SIP Bug 15758: Koha::Libraries - Remove GetBranchName 2016-09-08 14:36:01 +00:00
Utils Bug 15758: Koha::Libraries - Ultimate duel for C4::Branch 2016-09-08 14:36:04 +00:00
Accounts.pm Bug 15397 - Pay selected does not works as expected 2016-08-01 10:49:31 +00:00
Acquisition.pm Bug 16365: Adding additional unsafe call-candidates from Acquisition 2016-09-09 10:43:26 +00:00
Auth.pm Bug 15758: [QA Follow-up] Some corrections related to GetBranchName 2016-09-08 14:36:05 +00:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 13:16:36 +00:00
Auth_with_cas.pm Bug 16622: some tests triggered by prove t fail for unset KOHA_CONF 2016-08-05 06:09:58 +00:00
Auth_with_ldap.pm Bug 16853: Move changepassword to Koha::Patron->update_password 2016-07-15 18:09:17 +00:00
Auth_with_shibboleth.pm Bug 16818: External auth redirect broken under Plack 2016-08-04 19:42:44 +00:00
AuthoritiesMarc.pm Bug 16431: Use Koha::Cache to cache marc subfield structure 2016-07-08 12:44:58 +00:00
BackgroundJob.pm
Barcodes.pm
Biblio.pm Bug 16365: Selectively introduce GetMarcStructure() "unsafe" variant for better performance 2016-09-09 10:43:22 +00:00
Bookseller.pm
Boolean.pm
Breeding.pm
Budgets.pm
Calendar.pm Bug 17189: Replace occurrences of 'use Koha::Cache' 2016-09-08 10:24:47 +00:00
Charset.pm
Circulation.pm Bug 16272: (follow-up) Specific case when switching an on-site checkout to a regular checkout 2016-09-09 11:43:56 +00:00
ClassSortRoutine.pm
ClassSource.pm
Context.pm Bug 15758: [QA Follow-up] Remove onlymine from Plugin/Branches.pm 2016-09-08 14:36:05 +00:00
Contract.pm
CourseReserves.pm
Creators.pm
Debug.pm
Heading.pm
HoldsQueue.pm Bug 15758: Koha::Libraries - Ultimate duel for C4::Branch 2016-09-08 14:36:04 +00:00
HTML5Media.pm Bug 17231 - (QA Followup) 2016-09-08 12:06:47 +00:00
Images.pm
ImportBatch.pm Bug 6852: Staged import reports wrong success for items 2016-09-12 08:55:41 +00:00
ImportExportFramework.pm
InstallAuth.pm
Installer.pm Bug 14048: Add RefundLostItemFeeRule table and classes 2016-07-07 10:37:01 -06:00
ItemCirculationAlertPreference.pm Bug 15407: Koha::Patron::Categories - replace C4::Category->all 2016-09-08 13:29:03 +00:00
Items.pm Bug 6852: Staged import reports wrong success for items 2016-09-12 08:55:41 +00:00
Koha.pm Bug 17099: C4::Koha - Remove GetSupportName and GetSupportList 2016-09-09 13:30:45 +00:00
Labels.pm
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-06-24 14:05:56 +00:00
Letters.pm Bug 15758: Koha::Libraries - Ultimate duel for C4::Branch 2016-09-08 14:36:04 +00:00
Linker.pm
Log.pm Bug 14642: Add logging for Holds 2016-08-17 18:43:13 +00:00
MarcModificationTemplates.pm
Matcher.pm
Members.pm Bug 16908: Koha::Patrons - Remove GetSortDetails 2016-09-09 13:12:28 +00:00
Message.pm
NewsChannels.pm
Output.pm
Overdues.pm Bug 15758: Koha::Libraries - Remove GetBranches 2016-09-08 14:36:03 +00:00
Patroncards.pm
Print.pm
Record.pm Bug 15451: Koha::CsvProfiles - Remove the residue 2016-07-22 17:18:36 +00:00
Reports.pm
Reserves.pm Bug 14695 [QA Followup] 2016-09-08 12:44:50 +00:00
Ris.pm Bug 16668: Fix t/Ris.t tests 2016-06-10 16:59:20 +00:00
RotatingCollections.pm
Scheduler.pm
Scrubber.pm
Search.pm Bug 17193: Remove C4::Search::SearchAcquisitions 2016-09-09 14:07:57 +00:00
Serials.pm Bug 12178: Update serial status to "claimed" when exporting to CSV 2016-07-15 14:07:40 +00:00
Service.pm
ShelfBrowser.pm Bug 15758: Koha::Libraries - Remove GetBranches 2016-09-08 14:36:03 +00:00
SMS.pm
SocialData.pm
Stats.pm
Suggestions.pm
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-10 18:05:10 +00:00
Templates.pm
TmplToken.pm
TmplTokenType.pm
TTParser.pm
UsageStats.pm Bug 14048: (QA followup) Update syspref name for HEA 2016-07-07 10:37:01 -06:00
XISBN.pm
XSLT.pm Bug 16365: Selectively introduce GetMarcStructure() "unsafe" variant for better performance 2016-09-09 10:43:22 +00:00