Bug 41454: Remove unused dbh calls

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Amended-by: Jonathan Druart
Tidy C4/Search.pm

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Petro Vashchuk 2025-12-16 14:09:02 +02:00 committed by Lucas Gass
parent 041fa90a0d
commit b3cddc9994
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
16 changed files with 1 additions and 20 deletions

View File

@ -2977,7 +2977,6 @@ sub ModBiblioMarc {
# Clone record as it gets modified # Clone record as it gets modified
$record = $record->clone(); $record = $record->clone();
my $dbh = C4::Context->dbh;
my @fields = $record->fields(); my @fields = $record->fields();
my $encoding = C4::Context->preference("marcflavour"); my $encoding = C4::Context->preference("marcflavour");

View File

@ -432,7 +432,6 @@ sub TooMany {
my $onsite_checkout = $params->{onsite_checkout} || 0; my $onsite_checkout = $params->{onsite_checkout} || 0;
my $switch_onsite_checkout = $params->{switch_onsite_checkout} || 0; my $switch_onsite_checkout = $params->{switch_onsite_checkout} || 0;
my $cat_borrower = $patron->categorycode; my $cat_borrower = $patron->categorycode;
my $dbh = C4::Context->dbh;
# Get which branchcode we need # Get which branchcode we need
my $branch = _GetCircControlBranch( $item, $patron ); my $branch = _GetCircControlBranch( $item, $patron );

View File

@ -236,7 +236,6 @@ sub checkauth {
my $type = shift; my $type = shift;
$type = 'intranet' unless $type; $type = 'intranet' unless $type;
my $dbh = C4::Context->dbh();
my $template_name; my $template_name;
$template_name = "installer/auth.tt"; $template_name = "installer/auth.tt";

View File

@ -88,8 +88,7 @@ This function attempts to find duplicate records using a hard-coded, fairly simp
sub FindDuplicate { sub FindDuplicate {
my ($record) = @_; my ($record) = @_;
my $dbh = C4::Context->dbh; my $result = TransformMarcToKoha( { record => $record } );
my $result = TransformMarcToKoha( { record => $record } );
my $sth; my $sth;
my $query; my $query;
@ -1661,7 +1660,6 @@ Format results in a form suitable for passing to the template
# building the HTML output for the template # building the HTML output for the template
sub searchResults { sub searchResults {
my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults, $xslt_variables ) = @_; my ( $search_context, $searchdesc, $hits, $results_per_page, $offset, $scan, $marcresults, $xslt_variables ) = @_;
my $dbh = C4::Context->dbh;
my @newresults; my @newresults;
require C4::Items; require C4::Items;

View File

@ -51,7 +51,6 @@ This module provides facilities for retrieving ThingISBN and XISBN content in Ko
sub _get_biblio_from_xisbn { sub _get_biblio_from_xisbn {
my $xisbn = shift; my $xisbn = shift;
my $dbh = C4::Context->dbh;
my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 ); my ( $errors, $results, $total_hits ) = $searcher->simple_search_compat( "nb=$xisbn", 0, 1 );

View File

@ -60,7 +60,6 @@ use Koha::DateUtils qw( dt_from_string );
my $input = CGI->new; my $input = CGI->new;
my $do_search = $input->param('do_search') || 0; my $do_search = $input->param('do_search') || 0;
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ {
template_name => "acqui/histsearch.tt", template_name => "acqui/histsearch.tt",

View File

@ -115,7 +115,6 @@ my $link_order = $input->param('link_order');
$op = 'else' unless $op; $op = 'else' unless $op;
my $dbh = C4::Context->dbh;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{ {
template_name => "acqui/newordersuggestion.tt", template_name => "acqui/newordersuggestion.tt",

View File

@ -37,7 +37,6 @@ use Koha::XSLT::Base;
use Koha::Z3950Servers; use Koha::Z3950Servers;
my $query = CGI->new; my $query = CGI->new;
my $dbh = C4::Context->dbh;
my $op = $query->param('op') || ''; my $op = $query->param('op') || '';
my $authtypecode = $query->param('authtypecode') || ''; my $authtypecode = $query->param('authtypecode') || '';
my $authid = $query->param('authid') || ''; my $authid = $query->param('authid') || '';

View File

@ -55,7 +55,6 @@ my $builder = sub {
my $launcher = sub { my $launcher = sub {
my ($params) = @_; my ($params) = @_;
my $query = $params->{cgi}; my $query = $params->{cgi};
my $dbh = C4::Context->dbh;
my $op = $query->param('op') // ''; my $op = $query->param('op') // '';
# -- op could be equal to # -- op could be equal to

View File

@ -54,8 +54,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result'); my $result = $input->param('result');
my $dbh = C4::Context->dbh;
my $defaultlanguage = C4::Context->preference("UNIMARCField100Language"); my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
$defaultlanguage = "fre" if ( !$defaultlanguage || length($defaultlanguage) != 3 ); $defaultlanguage = "fre" if ( !$defaultlanguage || length($defaultlanguage) != 3 );

View File

@ -52,8 +52,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result'); my $result = $input->param('result');
my $dbh = C4::Context->dbh;
my $defaultlanguage = C4::Context->preference("UNIMARCField100Language"); my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
$defaultlanguage = "fre" if ( !$defaultlanguage || length($defaultlanguage) != 3 ); $defaultlanguage = "fre" if ( !$defaultlanguage || length($defaultlanguage) != 3 );

View File

@ -50,7 +50,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result'); my $result = $input->param('result');
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ {
template_name => "cataloguing/value_builder/unimarc_field_105.tt", template_name => "cataloguing/value_builder/unimarc_field_105.tt",

View File

@ -48,7 +48,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result') || q{}; my $result = $input->param('result') || q{};
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ {
template_name => "cataloguing/value_builder/unimarc_field_106.tt", template_name => "cataloguing/value_builder/unimarc_field_106.tt",

View File

@ -50,7 +50,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result'); my $result = $input->param('result');
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ {
template_name => "cataloguing/value_builder/unimarc_field_110.tt", template_name => "cataloguing/value_builder/unimarc_field_110.tt",

View File

@ -55,7 +55,6 @@ sub plugin {
my $index = $input->param('index'); my $index = $input->param('index');
my $result = $input->param('result'); my $result = $input->param('result');
my $dbh = C4::Context->dbh;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ {
template_name => "cataloguing/value_builder/unimarc_field_115a.tt", template_name => "cataloguing/value_builder/unimarc_field_115a.tt",

View File

@ -97,7 +97,6 @@ unless ($loggedinuser) {
} else { } else {
# And if the user is logged in, we deal with the database # And if the user is logged in, we deal with the database
my $dbh = C4::Context->dbh;
# Deleting search history # Deleting search history
if ( $op eq 'cud-delete' ) { if ( $op eq 'cud-delete' ) {