From 2637cfaa688fc7eda50190d6146b31e80aa09e08 Mon Sep 17 00:00:00 2001 From: Bouzid Fergani Date: Tue, 9 May 2017 15:39:10 -0400 Subject: [PATCH] Bug11299 - Fix problems when authority is not found and i want add it --- C4/Biblio.pm | 4 +- .../prog/en/modules/cataloguing/addbiblio.tt | 53 +++------------------- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 588a648..d3a55b9 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -618,12 +618,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'}) if $verbose; + push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose; } } else { $results{'unlinked'}->{ $heading->display_form() }++; - push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND'}) if $verbose; + push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose; } } 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 7eb59b7..3d477f7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -162,54 +162,15 @@ function PopupZ3950() { } } -function addCreateAuthorityButton(tag_subfield_line, tag, index) { +/** +* this function append button for create new authority if not found +*/ + +function addCreateAuthorityButton(tag_subfield_line, auth_type) { var title = _("Create authority"); var elem = $(''); + elem.attr("onclick","window.open('../authorities/authorities.pl?authtypecode=" + auth_type + "','','fullscreen','scrollbars')"); tag_subfield_line.append(elem); - - elem.click(function() { - var biblioindex = $(this).parents('.subfield_line').find('input').eq(1).attr('id'); - var popup = window.open("", "new_auth_popup",'width=700,height=550,toolbar=false,scrollbars=yes'); - - if(popup !== null) { - // Create a new form that will be POSTed in the new window - var form = $('
').attr({ - method: 'post', - action: "../authorities/authorities.pl", - target: "new_auth_popup" - }); - - // Add the biblioindex - form.append($('').attr({ - type: 'hidden', - name: 'biblioindex', - value: biblioindex - })); - //add the authtypecode - form.append($('').attr({ - type: 'hidden', - name: 'authtypecode', - value: $("#authtypecode").val() - })); - - - // Get all form datas for the current heading field - $('.tag[id^=tag_' + tag + '_]').eq(index).find(':input').each(function(){ - form.append($('').attr({ - type: 'hidden', - name: this.name, - value: $(this).val() - })); - }); - - // We need to add the temporary form to the body so we can submit it - $('body').append(form); - form.submit(); - form.remove(); - } - - return false; - }); } /** @@ -286,7 +247,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.tag, tag_index); + addCreateAuthorityButton(tag_subfield_line, heading.auth_type); } }); -- 1.9.1