[Koha] Restore the default Marc Framework

Michael Kuhn mik at adminkuhn.ch
Thu Sep 5 05:24:54 NZST 2024


Hi Caroline

Many thanks for your e-mail! You wrote today:

 > As you can see, the DELETE commands only remove the marc_tag_structure
 > and marc_subfield_structure, but not biblio_framework.
 >
 > As for the error message, my best guess is that the ACQ framework is
 > created in the installer file you loaded
 > (marc21_framework_DEFAULT.yml), and when it tries to create it, it
 > sees that it's already there.
 > Fortunately, it didn't seem to stop the whole process (I know SQL
 > INSERT commands will stop when they run into an error, but YAML is
 > probably different, I'm not sure).
 >
 > I guess to make absolutely sure you get NO errors, you could also
 > delete the biblio_framework entries (DELETE FROM biblio_framework
 > WHERE frameworkcode IN ('', 'ACQ')). This way it will recreate
 > everything and not run into duplicates.

Unfortunately in both tables 
https://schema.koha-community.org/24_05/tables/marc_tag_structure.html 
and 
https://schema.koha-community.org/24_05/tables/marc_subfield_structure.html 
field "frameworkcode" is shown as a foreign key but it doesn't say it 
stems from table "biblio_framework". However I did just what you 
proposed and so executed these SQL commands:

  DELETE FROM biblio_framework WHERE frameworkcode IN ('', 'ACQ');
  DELETE FROM marc_subfield_structure WHERE frameworkcode IN ('', 'ACQ');
  DELETE FROM marc_tag_structure WHERE frameworkcode IN ('', 'ACQ');

Interestingly the standard framework never shows up in table 
"biblio_framework" even if it seems to have a name ("Default 
framework"), neither before deleting it nor after loading it via 
"marc21_framework_DEFAULT.yml".

After that I reloaded the frameworks using this command ("koha" is the 
instance name) and there was no more error message:

  $ sudo koha-shell -c "/usr/share/koha/bin/load_yaml.pl --load --file 
/usr/share/koha/intranet/cgi-bin/installer/data/mysql/de-DE/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml" 
koha

Thanks for the hint!

 > P.S. I'd still be curious to know what problems you ran into when
 > trying to import the frameworks, it was my (non-tested) suggested
 > workaround to get the default back for people who do not have database
 > access. But if it doesn't work, that means there is no way to do it
 > other than drastically deleting the frameworks...

Well, this seems to be ugly but since you asked... I tested this in my 
own demo installation (Koha 24.05.00) and also in a productive 
installation (Koha 24.05.01); both installation were set up using 
language de-DE:

1. In Koha menu "Administration > MARC bibliographic framework > 
Actions" when trying to delete one of the example frameworks it says the 
following (NOT showing the correct frameworkcode):

Confirm deletion of framework '' ()?
* Yes, delete this framework
* No, not delete

After clicking "Yes" it says:

An error occurred when deleting this framework. Check the logs for details.

The framework is not deleted and I cannot find anything in any log file 
under "/var/log/koha/koha", also there is no hint in Koha menu "Tools > 
Log viewer" when displaying ALL actions.

2. In Koha menu "Administration > MARC bibliographic framework > 
Actions" I was able to export the default framework as a CSV file but 
when trying to import it again (with no changes) it asks:

Are you sure you want to replace the fields and subfields for the 
default framework structure? The existing structure will be overwritten! 
For safety reasons, it is recommended to use the export option to make a 
backup first.
* Abort
* OK

After clicking OK it says:

Importing to framework: default. Importing from file: 
export_default_test.csv.

Then it takes some time to import and then shows a screen saying:

Default MARC bibliographic framework
* Create framework for () using: Default / OK

I click on OK and it it just says:

Default MARC bibliographic framework

When I check the current framework it appears the imported default 
framework has not loaded.


However, I think these problems can be solved using the mentioned DELETE 
commands provided by you, for all unwanted frameworks.

Best wishes: Michael
-- 
Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
T 0041 (0)61 261 55 61 · E mik at adminkuhn.ch · W www.adminkuhn.ch



More information about the Koha mailing list