@@ -, +, @@
---
.../tools/batch_record_modification.tt | 6 ++--
svc/records/preview | 32 ++++++++++++++++---
2 files changed, 30 insertions(+), 8 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt
@@ -198,7 +198,7 @@
[% biblio.biblionumber | html %] |
[% biblio.title | html %] |
- Show MARC
+ Show MARC
|
[% END %]
@@ -225,7 +225,7 @@
|
[% authority.authid | html %] |
[% PROCESS authresult summary=authority.summary authid=authority.authid %] |
- Show MARC
+ | Show MARC
[% END %]
@@ -355,7 +355,7 @@
var url = "/cgi-bin/koha/svc/records/preview?"
var mmtid = $(this).val();
$("a.previewMARC").each(function() {
- $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid);
+ $(this).attr("href", url + "record_type=" + $(this).attr("data-record_type") + "&record_id=" + $(this).attr("data-record_id") + "&mmtid=" + mmtid + "&overlay_context=batchmod");
});
});
--- a/svc/records/preview
+++ a/svc/records/preview
@@ -20,14 +20,17 @@
use Modern::Perl;
use CGI;
use C4::Auth qw( get_template_and_user );
-use C4::Biblio qw( GetMarcBiblio );
+use C4::Biblio qw( GetMarcBiblio ApplyMarcOverlayRules );
use C4::MarcModificationTemplates qw( ModifyRecordWithTemplate );
use C4::Output qw( output_html_with_http_headers );
+
use Koha::MetadataRecord::Authority;
+use Koha::Patrons;
my $query = CGI->new();
my $record_id = $query->param('record_id');
my $record_type = $query->param('record_type') || 'biblio';
+my $overlay_context = $query->param('overlay_context');
my $mmtid = $query->param('mmtid'); # Marc modification template id
my $record;
@@ -38,15 +41,34 @@ if ( $record_type eq 'biblio' ) {
$record = $authority->record;
}
-if ( $mmtid ) {
- ModifyRecordWithTemplate( $mmtid, $record );
-}
-
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
template_name => "catalogue/showmarc.tt",
query => $query,
type => "intranet",
});
+
+if ($mmtid) {
+ ModifyRecordWithTemplate( $mmtid, $record );
+
+ if ( $record_type eq 'biblio'
+ && C4::Context->preference('MARCOverlayRules')
+ && $overlay_context )
+ {
+ my $logged_in_user = Koha::Patrons->find($loggedinuser);
+ $record = ApplyMarcOverlayRules(
+ {
+ biblionumber => $record_id,
+ record => $record,
+ overlay_context => {
+ source => $overlay_context,
+ categorycode => $logged_in_user->categorycode,
+ userid => $logged_in_user->userid
+ },
+ }
+ );
+ }
+}
+
$template->param( MARC_FORMATTED => $record->as_formatted );
output_html_with_http_headers $query, $cookie, $template->output;
--
|