Bugzilla – Attachment 67827 Details for
Bug 11299
Add a button to automatically link authority records in cataloguing (AJAX)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio
Bug11299---Prepopulate-the-fields-of-new-authority.patch (text/plain), 6.10 KB, created by
Katrin Fischer
on 2017-10-09 06:29:10 UTC
(
hide
)
Description:
Bug11299 - Prepopulate the fields of new authority by the values writed in biblio
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-10-09 06:29:10 UTC
Size:
6.10 KB
patch
obsolete
>From 32d5382ea1cc73c7aa3ae4c21c44f86097406865 Mon Sep 17 00:00:00 2001 >From: Bouzid Fergani <bouzid.fergani@inlibro.com> >Date: Wed, 7 Jun 2017 07:15:55 -0400 >Subject: [PATCH] Bug11299 - Prepopulate the fields of new authority by the > values writed in biblio > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Biblio.pm | 6 +-- > authorities/authorities.pl | 3 ++ > .../prog/en/modules/cataloguing/addbiblio.tt | 47 ++++++++++++++++++++-- > 3 files changed, 50 insertions(+), 6 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 3e8a012c05..cf66c19960 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -538,6 +538,7 @@ sub LinkBibHeadingsToAuthorities { > push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => $status || 'LOCAL_FOUND'}) if $verbose; > } > else { >+ my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); > if ( defined $current_link > && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) ) > { >@@ -549,7 +550,6 @@ sub LinkBibHeadingsToAuthorities { > $results{'linked'}->{ $heading->display_form() }++; > } > else { >- my $authority_type = Koha::Authority::Types->find( $heading->auth_type() ); > my $marcrecordauth = MARC::Record->new(); > if ( C4::Context->preference('marcflavour') eq 'MARC21' ) { > $marcrecordauth->leader(' nz a22 o 4500'); >@@ -619,12 +619,12 @@ sub LinkBibHeadingsToAuthorities { > $field->delete_subfield( code => '9' ); > $num_headings_changed++; > $results{'unlinked'}->{ $heading->display_form() }++; >- push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose; >+ push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; > } > } > else { > $results{'unlinked'}->{ $heading->display_form() }++; >- push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose; >+ push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type(), tag_to_report => $authority_type->auth_tag_to_report}) if $verbose; > } > } > >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index ff87131a46..49546cafad 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -289,6 +289,9 @@ sub create_input { > > } > } >+ if ($cgi->param('tagreport') && $subfield_data{tag} == $cgi->param('tagreport')) { >+ $subfield_data{marc_value}{value} = $cgi->param('tag'. $cgi->param('tagbiblio') . 'subfield' . $subfield_data{subfield}); >+ } > $subfield_data{'index_subfield'} = $index_subfield; > return \%subfield_data; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index aed9a4fc19..1b13e282f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -172,11 +172,52 @@ function PopupZ3950() { > * this function append button for create new authority if not found > */ > >-function addCreateAuthorityButton(tag_subfield_line, auth_type) { >+function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) { > var title = _("Create authority"); > var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>'); >- elem.attr("onclick","window.open('../authorities/authorities.pl?authtypecode=" + auth_type + "','','fullscreen','scrollbars')"); > tag_subfield_line.append(elem); >+ var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index); >+ var subfield_a = tag_subfield_line_a.children('.input_marceditor').eq(0); >+ elem.click(function() { >+ var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes'); >+ if(popup !== null) { >+ // Create a new form that will be POSTed in the new window >+ var form = $('<form>').attr({ >+ method: 'post', >+ action: "../authorities/authorities.pl", >+ target: "new_auth_popup" >+ }); >+ //add the authtypecode >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: 'authtypecode', >+ value: heading.auth_type >+ })); >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: 'tagreport', >+ value: heading.tag_to_report >+ })); >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: 'tagbiblio', >+ value: heading.tag >+ })); >+ $('.tag[id^=tag_' + heading.tag + '_]').eq(tag_index).find(':input').each(function(){ >+ form.append($('<input>').attr({ >+ type: 'hidden', >+ name: this.name.split('_',4).join(''), >+ value: $(this).val() >+ })); >+ }); >+ >+ $('body').append(form); >+ form.submit(); >+ form.remove(); >+ } >+ return false; >+ }); >+ > } > > /** >@@ -253,7 +294,7 @@ function updateHeadingLinks(links) { > > // Add a link to create a new authority if none was found > if(heading.status == 'NONE_FOUND') { >- addCreateAuthorityButton(tag_subfield_line, heading.auth_type); >+ addCreateAuthorityButton(tag_subfield_line, heading , tag_index); > } > }); > >-- >2.11.0
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11299
:
23146
|
26715
|
33074
|
37912
|
37913
|
37972
|
38737
|
39477
|
39478
|
39479
|
40831
|
41229
|
45218
|
56440
|
56508
|
56509
|
58307
|
60998
|
63311
|
63312
|
63313
|
64075
|
67162
|
67708
|
67709
|
67710
|
67712
|
67713
|
67714
|
67824
|
67825
|
67826
|
67827
|
67828
|
67829
|
79385
|
79386
|
79387
|
79388
|
79389
|
79390
|
79391
|
79392
|
79393
|
79394
|
79395
|
79396
|
79397
|
79398
|
79399
|
79447
|
79448
|
79449
|
79450
|
79451
|
79452
|
79545
|
94818
|
95126
|
95152
|
98571
|
98572
|
99249
|
108091
|
108309
|
108310
|
108396
|
108552
|
108834
|
108835
|
109062
|
109063
|
109069
|
109181
|
110553
|
110554
|
110555
|
110556
|
110557
|
110568
|
110569
|
110570
|
110571
|
110572
|
111706
|
111707
|
111708
|
111709
|
111710
|
112125
|
112126
|
112127
|
112128
|
112129
|
112130
|
112131
|
112132
|
112133
|
112134
|
112135
|
113562
|
113563
|
113564
|
113565
|
113566
|
113567
|
113568
|
114803
|
114924
|
114925
|
114926
|
114927
|
114928
|
114929
|
114930
|
114931
|
114932