Changes made on bug 15381 assumed that the authid was always set.
But if the user wants to clear the field of the authority, the script is
called with authid=0 (FIXME...)
To fix this issue, it's better to move the new calls to
Koha::Authorities->find($authid)->authtypecode
and
Koha::Authority::Types->find($authtypecode);
at the correct place
Test plan:
1. Edit a record which has a field linked to an
authority record (100a for instance).
2. Click the link which triggers the tag editor.
A pop-up window should be displayed.
3. In the pop-up window, click the "Clear field"
button.
=> Without this patch A second pop-up window opens and displays an error:
Can't call method "authtypecode" on an undefined value at /authorities/blinddetail-biblio-search.pl line 61.
=> With this patch applied the field is correctly cleared.
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
my $index = $query->param('index');
my $tagid = $query->param('tagid');
my $relationship = $query->param('relationship');
my $index = $query->param('index');
my $tagid = $query->param('tagid');
my $relationship = $query->param('relationship');
-my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
-my $tagslib = &GetTagsLabels( 1, $authtypecode );
-
-my $auth_type = Koha::Authority::Types->find($authtypecode);
-my $record;
-if ($authid) {
- $record = GetAuthority($authid);
-}
# open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
# open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my @subfield_loop;
my ($indicator1, $indicator2);
if ($authid) {
my @subfield_loop;
my ($indicator1, $indicator2);
if ($authid) {
+ my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
+ my $auth_type = Koha::Authority::Types->find($authtypecode);
+ my $record = GetAuthority($authid);
my @fields = $record->field( $auth_type->auth_tag_to_report );
my $repet = ($query->param('repet') || 1) - 1;
my $field = $fields[$repet];
my @fields = $record->field( $auth_type->auth_tag_to_report );
my $repet = ($query->param('repet') || 1) - 1;
my $field = $fields[$repet];