Koha-clms/C4
Marcel de Rooy 82795f8b91 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>
(cherry picked from commit 48aba1533c)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
(cherry picked from commit 9aee97978e)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
2016-09-16 11:09:21 +02:00
..
AuthoritiesMarc Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Barcodes Bug 16635: [QA Follow-up] Eliminate some global package vars 2016-06-16 12:03:37 +02:00
Bookseller Bug 10402 follow-up: choose contacts for claims 2014-08-26 11:45:59 -03:00
ClassSortRoutine Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Creators Bug 14468: Remove warnings when creating Labels 2015-10-27 10:12:32 -03:00
External Bug 16636: [QA Follow-up] Make BakerTaylor plack safe 2016-06-16 12:05:38 +02:00
Form Bug 16259: Replace CGI->param with CGI->multi_param in list context - part 2 2016-05-17 07:44:16 +02:00
Heading Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
ILSDI Bug 16864: Silence warnings in t/db_dependent/ILSDI_Services.t 2016-08-17 15:42:49 +02:00
Installer Bug 17223: Add Cache::Memcached to PerlDependencies 2016-09-16 08:39:25 +02:00
Labels Bug 14781: Creation of barcode types 2of5 not functional 2015-11-05 10:31:46 -03:00
Linker Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Members Bug 16443: Make C4::Members::Statistics plack safe 2016-06-16 10:31:37 +02:00
OAI Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Output Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Patroncards Bug 14107: Patron cards: Make barcode width and height scaling editable 2015-07-24 14:07:18 -03:00
Reports Bug 14982: Remove C4::Dates from guided report wizard and dictionary 2015-10-26 11:20:11 -03:00
SIP Bug 15006: [QA Follow-up] Only handle login requests in raw_transport 2016-08-17 12:03:43 +02:00
Search Bug 10933: (follow-up) fix the previous patch to work with master 2015-10-27 11:03:03 -03:00
Serials Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
Utils Bug 17106 - DataTables patron search defaulting to 'starts_with' - doc 2016-08-24 12:52:16 +02:00
Accounts.pm Bug 15397 - Pay selected does not works as expected 2016-08-17 14:10:38 +02:00
Acquisition.pm Bug 16971: Missing dependency for HTML::Entities 2016-08-17 15:37:36 +02:00
Auth.pm Bug 16818: External auth redirect broken under Plack 2016-08-17 15:35:24 +02:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-17 16:00:36 +02:00
Auth_with_cas.pm Bug 16622: some tests triggered by prove t fail for unset KOHA_CONF 2016-08-17 15:52:04 +02:00
Auth_with_ldap.pm Bug 15889: LDAP authentication: Only update mapped attributes 2016-04-01 14:18:33 +02:00
Auth_with_shibboleth.pm Bug 16818: External auth redirect broken under Plack 2016-08-17 15:35:24 +02:00
AuthoritiesMarc.pm Bug 15130: useless unitialization warnings when updating authorities 2015-11-06 12:08:51 -03:00
BackgroundJob.pm Bug 13606 Clear job data in session when the job is completed 2015-04-23 13:18:48 -03:00
Barcodes.pm Bug 13813: Remove deprecated module C4::Dates from system 2015-09-18 12:40:55 -03:00
Biblio.pm Bug 16809: Follow-up for scalarizing biblionumber 2016-09-16 09:59:57 +02:00
Bookseller.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Boolean.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Branch.pm Bug 15628: Remove get_branchinfos_of vestiges 2016-02-04 22:29:05 +01:00
Breeding.pm Bug 13987: Fix server name in z39.50 authority search results 2015-04-22 14:39:00 -03:00
Budgets.pm Bug 15009: QA follow-up 2016-05-16 14:01:43 +02:00
Calendar.pm Bug 15333: Use Koha::Cache to cache exception_holidays instead of a package variable 2016-06-09 09:32:46 +02:00
Category.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Charset.pm Bug 14078: (followup) converting from ISO5426 is not complete 2015-11-16 12:48:44 -03:00
Circulation.pm Bug 14390 [QA Followup] - Fix warning 2016-09-16 08:06:40 +02:00
ClassSortRoutine.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
ClassSource.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Context.pm Bug 16813: Allow empty string for OPACBaseURL 2016-08-17 12:45:46 +02:00
Contract.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
CourseReserves.pm Bug 15530 - Editing a course item via a disabled course disables it even if it is on other enabled courses 2016-01-27 15:33:36 +01:00
Creators.pm Bug 14059: Delete all export of get_column_names 2015-05-22 17:02:21 -03:00
Csv.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Debug.pm Bug 14870: (followup) Remove mention of C4::Dates from C4/Debug.pm 2015-11-19 13:05:06 -03:00
HTML5Media.pm Bug 12885: Fix if url contains +*... and HTML5 Media is enabled 2015-09-02 14:38:29 -03:00
Heading.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
HoldsQueue.pm Bug 15062: Holds queue with Transport Cost Matrix will transfer item even if transfers disabled 2015-11-23 11:32:53 -03:00
Images.pm Bug 14778: Install fixtures for t/Images.t 2015-10-23 12:01:18 -03:00
ImportBatch.pm Bug 6852: Staged import reports wrong success for items 2016-09-16 11:09:21 +02:00
ImportExportFramework.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
InstallAuth.pm Bug 15005: Replace CGI->url with the corresponding url 2015-10-19 09:36:43 -03:00
Installer.pm Bug 13669: Catch the errors to have them to the logs 2016-05-25 10:06:07 +02:00
ItemCirculationAlertPreference.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
ItemType.pm Bug 16356: Fix Error 500 when returning an item which itemtype is not in itemtypes table 2016-04-28 12:51:07 +02:00
Items.pm Bug 6852: Staged import reports wrong success for items 2016-09-16 11:09:21 +02:00
Koha.pm Bug 16716: Replaced wrong GROUP BY with DISTINCT 2016-08-17 13:40:41 +02:00
Labels.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-08-16 15:33:10 +02:00
Letters.pm Bug 16805: Log in with database admin user breaks OPAC 2016-08-16 17:44:50 +02:00
Linker.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Log.pm Bug 15939: Action logs - Do not default dates to today 2016-03-07 11:35:14 +01:00
MarcModificationTemplates.pm Bug 14098: Implement the copy_and_replace action for MTT 2015-09-07 11:17:13 -03:00
Matcher.pm Bug 15745: C4::Matcher gets CCL parsing error if term contains ? (question mark) 2016-04-06 16:38:52 +02:00
Members.pm Bug 16716: Replaced wrong GROUP BY with DISTINCT 2016-08-17 13:40:41 +02:00
Message.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
NewsChannels.pm Bug 16550: Can't set opac news expiration date to NULL, it reverts to today 2016-05-25 11:27:22 +02:00
Output.pm Bug 15111: Change X-Frame-Options with SAMEORIGIN 2016-04-22 10:51:11 +02:00
Overdues.pm Bug 14390: [Follow-up] Only update FU record in UpdateFine 2016-09-16 08:06:40 +02:00
Patroncards.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Print.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Ratings.pm Bug 14383: Fix POD error in C4/Ratings.pm 2015-06-22 17:34:47 -03:00
Record.pm Bug 12357: Following whitespace failures on koha qa test tools. 2015-09-07 13:59:07 -03:00
Reports.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Reserves.pm Bug 14968 - found shouldn't be set to null when cancelling holds 2016-08-16 16:09:54 +02:00
Review.pm Bug 13969: Replace calls to $sth->fetchrow* with a call to $dbh->selectrow* and Cleaning files 2015-05-14 11:11:41 -03:00
Ris.pm Bug 16668: Fix t/Ris.t tests 2016-06-16 10:58:50 +02:00
RotatingCollections.pm Bug 15066: Make transfer rotating collection works under Plack 2015-11-05 09:50:09 -03:00
SMS.pm Bug 14421: Corrected example in SMS.pm to working version with hashref. 2015-06-22 11:08:29 -03:00
Scheduler.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Scrubber.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Search.pm Bug 17107 - Add ident and Identifier-standard to known indexes 2016-08-24 12:45:13 +02:00
Serials.pm Bug 12178: Update serial status to "claimed" when exporting to CSV 2016-08-17 11:33:26 +02:00
Service.pm Bug 11559: Supporting changes for Rancor 2015-10-27 12:16:05 -03:00
ShelfBrowser.pm Bug 16315 - OPAC Shelfbrowser doesn't display the full title 2016-05-16 10:08:03 +02:00
SocialData.pm Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
Stats.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Suggestions.pm Bug 16325: Do not return all suggestions if search for STATUS='' 2016-05-16 13:24:14 +02:00
TTParser.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-16 12:07:29 +02:00
Templates.pm Bug 16088: Introduce Koha::Cache::Memory::Lite to cache the language 2016-06-16 13:46:28 +02:00
TmplToken.pm Bug 6679: (follow-up) fix 9 perlcritic violations in C4/TmplTokenType.pm 2016-01-27 15:26:02 +01:00
TmplTokenType.pm Bug 6679: (follow-up) fix 9 perlcritic violations in C4/TmplTokenType.pm 2016-01-27 15:26:02 +01:00
UsageStats.pm Bug 14097: Testing C4::UsageStats 2016-03-07 14:22:01 +01:00
XISBN.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
XSLT.pm Bug 7441 - search results showing wrong branch? 2016-08-23 16:13:23 +02:00