From 8246d99b8449799943895088e30197f76dba6fef Mon Sep 17 00:00:00 2001
From: Cori Lynn Arnold <carnold@dgiinc.com>
Date: Tue, 11 Feb 2020 20:03:12 +0000
Subject: [PATCH] Bug 24429: Advanced editor - Add ability to generate an
 export file as cataloger saves

Adds the ability for catalogers to *automatically* save a list of bibs
to export as they are cataloging.

To test, apply patch:
0/Verify that the advanced editor is enabled by going to
"Administration" and searching for "EnableAdvancedCatalogingEditor"
1/Set it to "Enable" if it isn't already.
2/Go to "Cataloging", click on "Advanced editor"
3/Click on "Export" button (verify a modal window comes up)
4/Click on the link for "New Export File", name the export file
5/Close the modal window
6/Search for a record by entering "specious" in the keyword box and
hitting enter
7/Click "import" on a record
8/Make some changes and hit "Save", note the bib number
9/Repeat steps 6-8 for several records, getting records from the catalog
and importing through the "import" button in the UI
10/Click on "Export..." button
11/Click on the link for the name you created in step 4
12/Verify the bib numbers from step 8 are in the Export Files Editor
13/Click "Generate Export File"
14/Verify that all the records for every bib listed is in the file
generated
15/Repeat steps with different file names / records
---
 koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
index 59a816d86b..35de13cdc2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
@@ -758,7 +758,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
         var output = []; //Output array
 
         for (var i = 0; i < pieces.length; i++) {
-               if (output.indexOf(pieces[i]) < 0) {
+               if (output.indexOf(pieces[i]) < 0 && pieces[i].length > 0) {
                          output.push(pieces[i]);
                }
         }
-- 
2.11.0