Bug 34014: Add support for advanced cataloging editor

To test:
1 - Enable the advanced cataloging editor
2 - Edit record 369 in the advanced cataloging editor
3 - On load, get a notice that there were issues and to check logs
4 - Save record
5 - Close and reopen in editor
6 - Confirm warning is gone

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-10-17 17:06:22 +00:00 committed by Tomas Cohen Arazi
parent 66d519ae41
commit 8dc2152e2f
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 16 additions and 3 deletions

View file

@ -106,7 +106,11 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin
GetRecord: function( id, remove_control_num, callback ) {
$.get(
'/cgi-bin/koha/svc/bib/'+ id
).done( function( metadata ) {
).done( function( metadata, status, xhr ) {
let encoding_issues = xhr.getResponseHeader('invalid-metadata');
if( encoding_issues ){
humanMsg.displayAlert( _("Record had encoding issues, please see logs") );
}
$.get(
'/cgi-bin/koha/svc/bib_framework/' + id
).done( function( frameworkcode ) {

13
svc/bib
View file

@ -67,9 +67,18 @@ sub fetch_bib {
my $query = shift;
my $biblionumber = shift;
my $biblio = Koha::Biblios->find( $biblionumber );
my $record = $biblio->metadata->record({ embed_items => scalar $query->param('items') });
my $record;
my $exception;
my $invalid_metadata;
eval { $record = $biblio->metadata->record({ embed_items => scalar $query->param('items') }) };
if( $@ ){
$exception = $@;
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
$record = $biblio->metadata->record_strip_nonxml({ embed_items => scalar $query->param('items') });
$invalid_metadata = 1;
}
if (defined $record) {
print $query->header(-type => 'text/xml',-charset => 'utf-8',);
print $query->header(-type => 'text/xml',-charset => 'utf-8', -invalid_metadata => $invalid_metadata );
print $record->as_xml_record();
} else {
print $query->header(-type => 'text/xml', -status => '404 Not Found');