my( $user_obj, $evt ) = $U->checksesperm($login, 'CREATE_MARC');
return $evt if $evt;
+ $$oargs{import_location} = $e->requestor->ws_ou;
+
$logger->activity("user ".$user_obj->id." creating new MARC record");
my $meth = $self->method_lookup("open-ils.cat.biblio.record.xml.import");
$oargs = {};
}
+ $$oargs{import_location} = $e->requestor->ws_ou;
+
my $res = OpenILS::Application::Cat::BibCommon->biblio_record_replace_marc(
$e, $recid, $newxml, $source, $fix_tcn, $oargs);
} else {
$oargs = {};
}
+ $$oargs{import_location} = $e->requestor->ws_ou;
my $record = OpenILS::Application::Cat::BibCommon->biblio_record_xml_import(
$e, $xml, $source, $auto_tcn, $oargs);
$marcdoc = __make_marc_doc($newxml);
}
+ my $import_loc = $$override{import_location};
+ my $ancestors = $U->get_org_ancestors($import_loc) if ($import_loc);
+ my $trash_tags = $e->search_vandelay_import_bib_trash_fields({owner => $ancestors}) if ($ancestors);
+
+ if ($trash_tags && @$trash_tags) {
+ for my $tag (@$trash_tags) {
+ for my $node ($marcdoc->findnodes('//*[@tag="'.$tag->field.'"]')) {
+ $node->parentNode->removeChild($node);
+ }
+ }
+ }
+
$rec->source(bib_source_from_name($source)) if $source;
$rec->editor($e->requestor->id);
return $evt if $evt;
}
+ my $import_loc = $$override{import_location};
+ my $ancestors = $U->get_org_ancestors($import_loc) if ($import_loc);
+ my $trash_tags = $e->search_vandelay_import_bib_trash_fields({owner => $ancestors}) if ($ancestors);
+
+ if ($trash_tags && @$trash_tags) {
+ for my $tag (@$trash_tags) {
+ for my $node ($marcdoc->findnodes('//*[@tag="'.$tag.'"]')) {
+ $node->parentNode->removeChild($node);
+ }
+ }
+ }
+
# Silence warnings when _find_tcn_info() fails
$tcn ||= '';
$tcn_source ||= '';
use Time::HiRes qw(time);
use OpenSRF::Utils::Logger qw/$logger/;
use MIME::Base64;
+use XML::LibXML;
use OpenILS::Const qw/:const/;
use OpenILS::Application::AppUtils;
use OpenILS::Application::Cat::BibCommon;
$rec_class = 'vqar';
}
+ my $import_loc = $requestor->ws_ou;
+ my $ancestors = $U->get_org_ancestors($import_loc) if ($import_loc);
+ my $trash_tags = $editor->search_vandelay_import_bib_trash_fields({owner => $ancestors}) if ($ancestors);
+
my $new_rec_perm_cache;
my @success_rec_ids;
for my $rec_id (@$rec_ids) {
next;
}
+ if ($trash_tags && @$trash_tags) {
+ my $marcxml = XML::LibXML->new->parse_string($rec->marc);
+ if ($marcxml) {
+ for my $tag (@$trash_tags) {
+ for my $node ($marcxml->findnodes('//*[@tag="'.$tag->field.'"]')) {
+ $node->parentNode->removeChild($node);
+ }
+ }
+
+ $rec->marc( $U->entityize( $marcdoc->documentElement->toString ) );
+ $e->$update_func($rec);
+ }
+ }
+
$$report_args{rec} = $rec;
$queues{$rec->queue} = 1;