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

(-)a/C4/Biblio.pm (-3 / +3 lines)
Lines 542-547 sub LinkBibHeadingsToAuthorities { Link Here
542
            push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => $status || 'LOCAL_FOUND'}) if $verbose;
542
            push(@{$results{'details'}}, { tag => $field->tag(), authid => $authid, status => $status || 'LOCAL_FOUND'}) if $verbose;
543
        }
543
        }
544
        else {
544
        else {
545
            my $authority_type = Koha::Authority::Types->find( $heading->auth_type() );
545
            if ( defined $current_link
546
            if ( defined $current_link
546
                && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) )
547
                && (!$allowrelink || C4::Context->preference('LinkerKeepStale')) )
547
            {
548
            {
Lines 553-559 sub LinkBibHeadingsToAuthorities { Link Here
553
                    $results{'linked'}->{ $heading->display_form() }++;
554
                    $results{'linked'}->{ $heading->display_form() }++;
554
                }
555
                }
555
                else {
556
                else {
556
                    my $authority_type = Koha::Authority::Types->find( $heading->auth_type() );
557
                    my $marcrecordauth = MARC::Record->new();
557
                    my $marcrecordauth = MARC::Record->new();
558
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
558
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
559
                        $marcrecordauth->leader('     nz  a22     o  4500');
559
                        $marcrecordauth->leader('     nz  a22     o  4500');
Lines 618-629 sub LinkBibHeadingsToAuthorities { Link Here
618
                    $field->delete_subfield( code => '9' );
618
                    $field->delete_subfield( code => '9' );
619
                    $num_headings_changed++;
619
                    $num_headings_changed++;
620
                    $results{'unlinked'}->{ $heading->display_form() }++;
620
                    $results{'unlinked'}->{ $heading->display_form() }++;
621
                    push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose;
621
                    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;
622
                }
622
                }
623
            }
623
            }
624
            else {
624
            else {
625
                $results{'unlinked'}->{ $heading->display_form() }++;
625
                $results{'unlinked'}->{ $heading->display_form() }++;
626
                push(@{$results{'details'}}, { tag => $field->tag(), authid => undef, status => 'NONE_FOUND', auth_type => $heading->auth_type()}) if $verbose;
626
                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;
627
            }
627
            }
628
        }
628
        }
629
629
(-)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 166-176 function PopupZ3950() { Link Here
166
* this function append button for create new authority if not found
166
* this function append button for create new authority if not found
167
*/
167
*/
168
168
169
function addCreateAuthorityButton(tag_subfield_line, auth_type) {
169
function addCreateAuthorityButton(tag_subfield_line, heading, tag_index) {
170
    var title = _("Create authority");
170
    var title = _("Create authority");
171
    var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>');
171
    var elem = $('<a class="subfield_status" href="#"><img src="[% interface %]/[% theme %]/img/edit-tag.png" title="' + title + '" /></a>');
172
    elem.attr("onclick","window.open('../authorities/authorities.pl?authtypecode=" + auth_type  + "','','fullscreen','scrollbars')");
173
    tag_subfield_line.append(elem);
172
    tag_subfield_line.append(elem);
173
    var tag_subfield_line_a = $('.subfield_line[id^=subfield' + heading.tag + 'a]').eq(tag_index);
174
    var subfield_a = tag_subfield_line_a.children('.input_marceditor').eq(0);
175
    elem.click(function() {
176
        var popup = window.open("", "new_auth_popup",'fullscreen,toolbar=false,scrollbars=yes');
177
        if(popup !== null) {
178
            // Create a new form that will be POSTed in the new window
179
            var form = $('<form>').attr({
180
            method: 'post',
181
            action: "../authorities/authorities.pl",
182
            target: "new_auth_popup"
183
            });
184
            //add the authtypecode
185
            form.append($('<input>').attr({
186
                type: 'hidden',
187
                name: 'authtypecode',
188
                value: heading.auth_type
189
            }));
190
            form.append($('<input>').attr({
191
                type: 'hidden',
192
                name: 'tagreport',
193
                value: heading.tag_to_report
194
            }));
195
            form.append($('<input>').attr({
196
                type: 'hidden',
197
                name: 'tagbiblio',
198
                value: heading.tag
199
            }));
200
            $('.tag[id^=tag_' + heading.tag + '_]').eq(tag_index).find(':input').each(function(){
201
                form.append($('<input>').attr({
202
                    type: 'hidden',
203
                    name: this.name.split('_',4).join(''),
204
                    value: $(this).val()
205
                }));
206
            });
207
208
            $('body').append(form);
209
            form.submit();
210
            form.remove();
211
        }
212
        return false;
213
    });
214
174
}
215
}
175
216
176
/**
217
/**
Lines 247-253 function updateHeadingLinks(links) { Link Here
247
288
248
        // Add a link to create a new authority if none was found
289
        // Add a link to create a new authority if none was found
249
        if(heading.status == 'NONE_FOUND') {
290
        if(heading.status == 'NONE_FOUND') {
250
            addCreateAuthorityButton(tag_subfield_line, heading.auth_type);
291
            addCreateAuthorityButton(tag_subfield_line, heading , tag_index);
251
        }
292
        }
252
    });
293
    });
253
294
254
- 

Return to bug 11299