View | Details | Raw Unified | Return to bug 11299
Collapse All | Expand All

(-)a/C4/Biblio.pm (-3 / +3 lines)
Lines 538-543 sub LinkBibHeadingsToAuthorities { Link Here
538
            push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => $status || 'LOCAL_FOUND'}) if $verbose;
538
            push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => $status || 'LOCAL_FOUND'}) if $verbose;
539
        }
539
        }
540
        else {
540
        else {
541
            my $authority_type = Koha::Authority::Types->find( $heading->auth_type() );
541
            if ( defined $current_link
542
            if ( defined $current_link
542
                && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) )
543
                && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) )
543
            {
544
            {
Lines 549-555 sub LinkBibHeadingsToAuthorities { Link Here
549
                    $results{'linked'}->{ $heading->display_form() }++;
550
                    $results{'linked'}->{ $heading->display_form() }++;
550
                }
551
                }
551
                else {
552
                else {
552
                    my $authority_type = Koha::Authority::Types->find( $heading->auth_type() );
553
                    my $marcrecordauth = MARC::Record->new();
553
                    my $marcrecordauth = MARC::Record->new();
554
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
554
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
555
                        $marcrecordauth->leader('     nz  a22     o  4500');
555
                        $marcrecordauth->leader('     nz  a22     o  4500');
Lines 619-630 sub LinkBibHeadingsToAuthorities { Link Here
619
                    $field->delete_subfield( code => '9' );
619
                    $field->delete_subfield( code => '9' );
620
                    $num_headings_changed++;
620
                    $num_headings_changed++;
621
                    $results{'unlinked'}->{ $heading->display_form() }++;
621
                    $results{'unlinked'}->{ $heading->display_form() }++;
622
                    push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose;
622
                    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;
623
                }
623
                }
624
            }
624
            }
625
            else {
625
            else {
626
                $results{'unlinked'}->{ $heading->display_form() }++;
626
                $results{'unlinked'}->{ $heading->display_form() }++;
627
                push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose;
627
                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;
628
            }
628
            }
629
        }
629
        }
630
630
(-)a/authorities/authorities.pl (+3 lines)
Lines 289-294 sub create_input { Link Here
289
289
290
        }
290
        }
291
    }
291
    }
292
    if ($cgi->param('tagreport') && $subfield_data{tag} == $cgi->param('tagreport')) {
293
        $subfield_data{marc_value}{value} = $cgi->param('tag'. $cgi->param('tagbiblio') . 'subfield' . $subfield_data{subfield});
294
    }
292
    $subfield_data{'index_subfield'} = $index_subfield;
295
    $subfield_data{'index_subfield'} = $index_subfield;
293
    return \%subfield_data;
296
    return \%subfield_data;
294
}
297
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-4 / +44 lines)
Lines 172-182 function PopupZ3950() { Link Here
172
* this function append button for create new authority if not found
172
* this function append button for create new authority if not found
173
*/
173
*/
174
174
175
function addCreateAuthorityButton(tag_subfield_line, auth_type) {
175
function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) {
176
    var title = _("Create authority");
176
    var title = _("Create authority");
177
    var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>');
177
    var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>');
178
    elem.attr("onclick","window.open('../authorities/authorities.pl?authtypecode=" + auth_type  + "','','fullscreen','scrollbars')");
179
    tag_subfield_line.append(elem);
178
    tag_subfield_line.append(elem);
179
    var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index);
180
    var subfield_a = tag_subfield_line_a.children('.input_marceditor').eq(0);
181
    elem.click(function() {
182
        var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes');
183
        if(popup !== null) {
184
            // Create a new form that will be POSTed in the new window
185
            var form = $('<form>').attr({
186
            method: 'post',
187
            action: "../authorities/authorities.pl",
188
            target: "new_auth_popup"
189
            });
190
            //add the authtypecode
191
            form.append($('<input>').attr({
192
                type: 'hidden',
193
                name: 'authtypecode',
194
                value: heading.auth_type
195
            }));
196
            form.append($('<input>').attr({
197
                type: 'hidden',
198
                name: 'tagreport',
199
                value: heading.tag_to_report
200
            }));
201
            form.append($('<input>').attr({
202
                type: 'hidden',
203
                name: 'tagbiblio',
204
                value: heading.tag
205
            }));
206
            $('.tag[id^=tag_' + heading.tag + '_]').eq(tag_index).find(':input').each(function(){
207
                form.append($('<input>').attr({
208
                    type: 'hidden',
209
                    name: this.name.split('_',4).join(''),
210
                    value: $(this).val()
211
                }));
212
            });
213
214
            $('body').append(form);
215
            form.submit();
216
            form.remove();
217
        }
218
        return false;
219
    });
220
180
}
221
}
181
222
182
/**
223
/**
Lines 253-259 function updateHeadingLinks(links) { Link Here
253
294
254
        // Add a link to create a new authority if none was found
295
        // Add a link to create a new authority if none was found
255
        if(heading.status == 'NONE_FOUND') {
296
        if(heading.status == 'NONE_FOUND') {
256
            addCreateAuthorityButton(tag_subfield_line, heading.auth_type);
297
            addCreateAuthorityButton(tag_subfield_line, heading , tag_index);
257
        }
298
        }
258
    });
299
    });
259
300
260
- 

Return to bug 11299