ImportKBARTFile - Create new eHoldings titles from a KBART file
This is a subclass of Koha::BackgroundJob.
Define the job type of this job.
Process the import.
Enqueue the new job
Formats a title to fit the names of the database fields in Koha
Kbart field "title_id" = "external_id" in Koha Kbart field "coverage_notes" = "notes" in Koha
Reads a file to provide report headers and lines to be processed
Takes a line and creates a hash of the values mapped to the column headings Only accepts fields that are in the list of permitted KBART fields, other fields are ignored (This is identified to the user on the background job status page)
Checks whether this title already exists to avoid duplicates
Creates a resource for a newly stored title.
Gets and formats a date for storing on the resource. Dates can come from files in YYYY, YYYY-MM or YYYY-MM-DD format
Returns a list of permitted headers in a KBART phase II file
Calculates average line size to work out how many lines to chunk a large file into Uses only 75% of the max_allowed_packet as an upper limit
Calculates the final size of the background job object that will need storing to check if we exceed the max_allowed_packet
EBSCO have an incorrect spelling for "preceding_publication_title_id" in all of their KBART files (preceding is spelled with a double 'e'). This means all of their KBART files fail to import using the current methodology. There is no simple way of finding out who the vendor is before importing so all KBART files from any vendor are going to have to be checked for this spelling and corrected.