Bug 5478 - Automate MARC framework import/export
authorSalvador Zaragoza Rubio <salvazm@masmedios.com>
Fri, 4 Mar 2011 09:05:34 +0000 (10:05 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Fri, 1 Apr 2011 08:17:33 +0000 (21:17 +1300)
commit689bc191540e6d55dcf98046c2225691ce4233c0
tree4c7a51332b295310230a61b33bc9b305d7931a35
parent61e87362c41403052ab867164033da1305141bfa
Bug 5478 - Automate MARC framework import/export

    Module to Import/Export a Framework structure to CSV/Excel-xml/ODS/SQL in Intranet Administration - MARC Frameworks section.
    There are two new links: "Export" to export to a format; and "Import" to import from a file.
    The data exported/imported is the one stored in the MySQL tables marc_tag_structure, marc_subfield_structure.

    Exported works as follows:
    1) CSV: As this format only allows one worksheet, the data from the tables is splitted with a row with #-# cells or with the
    names of the fields of the next MySQL table. Each row has as much cells as fields has the MySQL table. The first row contains the
    field names, the remaining holds the data.
    2) Excel: Excel xml 2003 format. Each MySQL table has its own worksheet in the spreadsheet. Rows and cells data as CSV.
    3) ODS: OpenDocument Spreadsheet compressed format, creates a temporary directory to generate the files needed to create the zip file.
    Each MySQL table has its own worksheet in the spreadsheet. Rows and cells data as CSV.
    4) SQL: Text file, the first row for each table is a delete and the remaining are inserts.

    Importing reads the rows from the spreadsheet/text-file as follows:
    1) CSV: Each row inserts or updates the associated MySQL table for this framework. At the end of the importing for a MySQL table, deletes the rows in the database that don't possess a correspondence with the spreadsheet.
    2) Excel: Imports each worksheet to the associated MySQL table. Works as the CSV for each worksheet.
    3) ODS: Creates a temporary directory to decompress and read the content.xml. This file has the data needed to import.
    Works as the CSV for each worksheet.
    4) Executes the SQL file.
    If the file imported has a different frameworkcode that the framework importing, the framecode is changed along the process.

    The Csv format will be the default.
    It uses perl module Archive::Zip or zip/unzip system command to process ODS files.
    To parse the sql files when importing it uses SQL::Statement or homemade parsing.

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/ImportExportFramework.pm [new file with mode: 0755]
admin/import_export_framework.pl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css [changed mode: 0644->0755]
koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl [changed mode: 0644->0755]