Bugzilla – Attachment 190560 Details for
Bug 16994
Import and export MARC modification templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Describes the function
EXPORT_IMPORT_FEATURE.md (text/markdown), 3.08 KB, created by
Arthur Suzuki
on 2025-12-16 21:39:25 UTC
(
hide
)
Description:
Describes the function
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2025-12-16 21:39:25 UTC
Size:
3.08 KB
patch
obsolete
># MARC Modification Templates Export/Import Feature > >## Overview >This implementation adds export and import functionality to MARC modification templates in Koha, allowing librarians to: >- Export templates to JSON format >- Import templates from JSON files >- Share templates between libraries >- Backup and restore templates > >## Files Modified > >### 1. C4/MarcModificationTemplates.pm >Added two new functions: >- `ExportModificationTemplates($template_ids)` - Exports templates to JSON >- `ImportModificationTemplates($json, $options)` - Imports templates from JSON > >### 2. tools/marc_modification_templates.pl >Added two new operations: >- `export` - Handles export requests >- `cud-import` - Handles import requests > >### 3. koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt >Added: >- Export dropdown button (Export all or individual templates) >- Import button with modal dialog >- JavaScript to show modal after import with results > >## Usage > >### Exporting Templates >1. Navigate to Tools > MARC modification templates >2. Click the "Export" dropdown button >3. Choose "Export all templates" or select a specific template >4. The JSON file will download automatically > >### Importing Templates >1. Navigate to Tools > MARC modification templates >2. Click the "Import" button >3. Upload a JSON file exported from this system >4. Choose import options: > - Skip existing templates (do not overwrite) >5. Click "Import" >6. View results in the modal dialog > >## Export Format (JSON) >```json >{ > "version": 1, > "templates": [ > { > "template_id": 1, > "name": "Vendor A Template", > "actions": [ > { > "mmta_id": 1, > "ordering": 1, > "action": "update_field", > "field_number": 1, > "from_field": "020", > "from_subfield": "a", > "field_value": "__BRANCHCODE__-", > "description": "Add branch code prefix to ISBN" > } > ] > } > ] >} >``` > >## Import Options >- **skip_existing**: (default to yes) Skip templates that already exist, overwise existing templates with same name are overwrite > >## Testing >A test script `test_export_import.pl` is provided to verify the functionality: >```bash >perl test_export_import.pl >``` > >## Benefits >1. **Backup and Migration**: Protect templates during system upgrades >2. **Sharing**: Share templates between libraries >3. **Version Control**: Track changes to templates over time >4. **Documentation**: Export serves as documentation of template configurations > >## Technical Details > >### Export Function >- Exports all templates or selected templates >- Returns JSON with version information and all template data >- Preserves all action details including conditionals and regex patterns > >### Import Function >- Validates JSON format and version >- Handles conflicts gracefully with skip/update options >- Provides detailed success/skipped/overwritten/error reporting >- Maintains template action ordering > >### UI Integration >- Seamless integration with existing template management interface >- Modal dialog shows import results >- Export links trigger immediate file download >- Responsive design compatible with Koha's UI framework
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 16994
: 190560 |
190561
|
190563
|
190647
|
190648