Bug 2505 Enabled warnings in authorities/*
Fixed obvious warnings generators in scripts with mismatched comparisons or undefined variables removed temporary variable selected while ensuring the comparison it represented was between two defined variables Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
702c4e5d98
commit
bcde53b5ba
|
|
@ -537,7 +537,7 @@ sub GetTagsLabels {
|
|||
my $dbh=C4::Context->dbh;
|
||||
$authtypecode="" unless $authtypecode;
|
||||
my $sth;
|
||||
my $libfield = ($forlibrarian eq 1)? 'liblibrarian' : 'libopac';
|
||||
my $libfield = ($forlibrarian == 1)? 'liblibrarian' : 'libopac';
|
||||
|
||||
|
||||
# check that authority exists
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use CGI;
|
||||
use C4::Output;
|
||||
|
|
@ -44,16 +45,16 @@ my $resultsperpage;
|
|||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype ( keys %$authtypes ) {
|
||||
my $selected = 1 if $thisauthtype eq $authtypecode;
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
selected => $selected,
|
||||
selected => ($thisauthtype eq $authtypecode),
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
index => $index,
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
}
|
||||
|
||||
$op ||= q{};
|
||||
if ( $op eq "do_search" ) {
|
||||
my @marclist = $query->param('marclist');
|
||||
my @and_or = $query->param('and_or');
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
|
|
@ -32,7 +33,9 @@ use C4::Biblio;
|
|||
|
||||
my $query = new CGI;
|
||||
my $op = $query->param('op');
|
||||
$op ||= q{};
|
||||
my $authtypecode = $query->param('authtypecode');
|
||||
$authtypecode ||= q{};
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $authid = $query->param('authid');
|
||||
|
|
@ -43,10 +46,9 @@ my @authtypesloop;
|
|||
foreach my $thisauthtype ( sort { $authtypes->{$a}{'authtypetext'} cmp $authtypes->{$b}{'authtypetext'} }
|
||||
keys %$authtypes )
|
||||
{
|
||||
my $selected = 1 if $thisauthtype eq $authtypecode;
|
||||
my %row = (
|
||||
value => $thisauthtype,
|
||||
selected => $selected,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
|
|
@ -88,7 +90,13 @@ if ( $op eq "do_search" ) {
|
|||
for ( my $i = 0 ; $i <= $#marclist ; $i++ ) {
|
||||
if ($value[$i]){
|
||||
push @field_data, { term => "marclist", val => $marclist_ini[$i] };
|
||||
if (!defined $and_or[$i]) {
|
||||
$and_or[$i] = q{};
|
||||
}
|
||||
push @field_data, { term => "and_or", val => $and_or[$i] };
|
||||
if (!defined $excluding[$i]) {
|
||||
$excluding[$i] = q{};
|
||||
}
|
||||
push @field_data, { term => "excluding", val => $excluding[$i] };
|
||||
push @field_data, { term => "operator", val => $operator[$i] };
|
||||
push @field_data, { term => "value", val => $value[$i] };
|
||||
|
|
@ -113,6 +121,9 @@ if ( $op eq "do_search" ) {
|
|||
|
||||
my $from = ( $startfrom - 1 ) * $resultsperpage + 1;
|
||||
my $to;
|
||||
if (!defined $total) {
|
||||
$total = 0;
|
||||
}
|
||||
|
||||
if ( $total < $startfrom * $resultsperpage ) {
|
||||
$to = $total;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use CGI;
|
||||
use C4::Auth;
|
||||
use C4::Output;
|
||||
|
|
@ -131,6 +132,9 @@ sub create_input {
|
|||
# if there is no value provided but a default value in parameters, get it
|
||||
unless ($value) {
|
||||
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
|
||||
if (!defined $value) {
|
||||
$value = q{};
|
||||
}
|
||||
|
||||
# get today date & replace YYYY, MM, DD if provided in the default value
|
||||
my ( $year, $month, $day ) = Today();
|
||||
|
|
@ -351,7 +355,7 @@ sub build_tabs ($$$$$) {
|
|||
|
||||
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
|
||||
# if MARC::Record is empty => use tab as master loop.
|
||||
if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) {
|
||||
if ( $record != -1 && ( $record->field($tag) || $tag eq '000' ) ) {
|
||||
my @fields;
|
||||
if ( $tag ne '000' ) {
|
||||
@fields = $record->field($tag);
|
||||
|
|
@ -552,7 +556,7 @@ if ($authid) {
|
|||
($oldauthnumtagfield,$oldauthnumtagsubfield) = &GetAuthMARCFromKohaField("auth_header.authid",$authtypecode);
|
||||
($oldauthtypetagfield,$oldauthtypetagsubfield) = &GetAuthMARCFromKohaField("auth_header.authtypecode",$authtypecode);
|
||||
}
|
||||
|
||||
$op ||= q{};
|
||||
#------------------------------------------------------------------------------------------------------------------------------
|
||||
if ($op eq "add") {
|
||||
#------------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -577,7 +581,8 @@ if ($op eq "add") {
|
|||
}
|
||||
}
|
||||
|
||||
my ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
|
||||
my ($duplicateauthid,$duplicateauthvalue);
|
||||
($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
|
||||
my $confirm_not_duplicate = $input->param('confirm_not_duplicate');
|
||||
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate)
|
||||
if (!$duplicateauthid or $confirm_not_duplicate) {
|
||||
|
|
@ -626,9 +631,8 @@ $template->param(authid => $authid,
|
|||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my $selected = 1 if $thisauthtype eq $authtypecode;
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $selected,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ parameters tables.
|
|||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use C4::AuthoritiesMarc;
|
||||
use C4::Auth;
|
||||
|
|
@ -58,7 +59,10 @@ my $authtypecode = &GetAuthTypeCode($authid);
|
|||
my $tagslib = &GetTagsLabels( 1, $authtypecode );
|
||||
|
||||
my $auth_type = GetAuthType($authtypecode);
|
||||
my $record = GetAuthority($authid) if $authid;
|
||||
my $record;
|
||||
if ($authid) {
|
||||
$record = GetAuthority($authid);
|
||||
}
|
||||
|
||||
# open template
|
||||
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
||||
|
|
@ -72,7 +76,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
|
|||
);
|
||||
|
||||
# fill arrays
|
||||
my $tag;
|
||||
my @loop_data = ();
|
||||
if ($authid) {
|
||||
foreach my $field ( $record->field( $auth_type->{auth_tag_to_report} ) ) {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ parameters tables.
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use C4::AuthoritiesMarc;
|
||||
use C4::Auth;
|
||||
|
|
@ -73,7 +74,6 @@ my ($template, $loggedinuser, $cookie)
|
|||
|
||||
# fill arrays
|
||||
my @loop_data =();
|
||||
my $tag;
|
||||
# loop through each tab 0 through 9
|
||||
# for (my $tabloop = 0; $tabloop<=10;$tabloop++) {
|
||||
# loop through each tag
|
||||
|
|
@ -121,9 +121,8 @@ my @fields = $record->fields();
|
|||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (keys %$authtypes) {
|
||||
my $selected = 1 if $thisauthtype eq $authtypecode;
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $selected,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ parameters tables.
|
|||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use C4::AuthoritiesMarc;
|
||||
use C4::Auth;
|
||||
|
|
@ -324,12 +325,11 @@ sub build_tabs ($$$$$) {
|
|||
foreach my $tag (sort @tab_data) {
|
||||
$i++;
|
||||
next if ! $tag;
|
||||
my $indicator;
|
||||
my $index_tag = CreateKey;
|
||||
|
||||
# if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab.
|
||||
# if MARC::Record is empty => use tab as master loop.
|
||||
if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) {
|
||||
if ( $record != -1 && ( $record->field($tag) || $tag eq '000' ) ) {
|
||||
my @fields;
|
||||
if ( $tag ne '000' ) {
|
||||
@fields = $record->field($tag);
|
||||
|
|
@ -439,7 +439,6 @@ if (C4::Context->preference("AuthDisplayHierarchy")){
|
|||
my $cnt=0;
|
||||
my @loophierarchy;
|
||||
foreach my $element (@tree){
|
||||
my $cell;
|
||||
my $elementdata = GetAuthority($element);
|
||||
$record= $elementdata if ($authid==$element);
|
||||
push @loophierarchy, BuildUnimarcHierarchy($elementdata,"child".$cnt, $authid);
|
||||
|
|
@ -477,9 +476,8 @@ my $tag;
|
|||
my $authtypes = getauthtypes;
|
||||
my @authtypesloop;
|
||||
foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
|
||||
my $selected = 1 if $thisauthtype eq $authtypecode;
|
||||
my %row =(value => $thisauthtype,
|
||||
selected => $selected,
|
||||
selected => $thisauthtype eq $authtypecode,
|
||||
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
|
||||
);
|
||||
push @authtypesloop, \%row;
|
||||
|
|
|
|||
Loading…
Reference in New Issue