Bug 18376 - authority framework creation fails under Plack
With plack, when creating a new authority framework from another, you get the error :
Can't call method "prepare" on an undefined value at (...)/src/admin/auth_tag_structure.pl line 267.
Looks like plack does not like when the var $dbh from the script is called inside a sub.
This patch adds a local var $dbh inside sub duplicate_auth_framework(), like in sub StringSearch().
Also correctes a redefine of my $sth.
Test plan:
- Go to Administration > Authority types
- Create a new type
- On this new type click on Actions > MARC Structure
- Select another type and click OK
=> You must get a table filled with the tag structure
Check with and without plack
You may not be able to reproduce the error with plack.
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 6a82ff4b89)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
parent
418d898560
commit
1f5cfee41a
|
|
@ -167,10 +167,10 @@ if ($op eq 'add_form') {
|
|||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||
} elsif ($op eq 'delete_confirmed') {
|
||||
unless (C4::Context->config('demo') eq 1) {
|
||||
my $sth = $dbh->prepare("delete from auth_tag_structure where tagfield=? and authtypecode=?");
|
||||
$sth->execute($searchfield,$authtypecode);
|
||||
my $sth = $dbh->prepare("delete from auth_subfield_structure where tagfield=? and authtypecode=?");
|
||||
$sth->execute($searchfield,$authtypecode);
|
||||
my $sth_tag = $dbh->prepare("delete from auth_tag_structure where tagfield=? and authtypecode=?");
|
||||
$sth_tag->execute($searchfield,$authtypecode);
|
||||
my $sth_sub = $dbh->prepare("delete from auth_subfield_structure where tagfield=? and authtypecode=?");
|
||||
$sth_sub->execute($searchfield,$authtypecode);
|
||||
}
|
||||
my $tagfield = $input->param('tagfield');
|
||||
print $input->redirect("/cgi-bin/koha/admin/auth_tag_structure.pl?searchfield=$tagfield&authtypecode=$authtypecode");
|
||||
|
|
@ -255,6 +255,7 @@ sub StringSearch {
|
|||
sub duplicate_auth_framework {
|
||||
my ($newauthtype,$oldauthtype) = @_;
|
||||
# warn "TO $newauthtype FROM $oldauthtype";
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from auth_tag_structure where authtypecode=?");
|
||||
$sth->execute($oldauthtype);
|
||||
my $sth_insert = $dbh->prepare("insert into auth_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, authtypecode) values (?,?,?,?,?,?,?)");
|
||||
|
|
|
|||
Loading…
Reference in New Issue