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

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

Return to bug 11299