Bug 5453 : Move declarations out of conditionals
Patched for C4 Modules Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
b5b71339f3
commit
306dc79217
15
C4/Auth.pm
15
C4/Auth.pm
|
|
@ -137,12 +137,15 @@ sub get_template_and_user {
|
|||
my $in = shift;
|
||||
my $template =
|
||||
gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
|
||||
my ( $user, $cookie, $sessionID, $flags ) = checkauth(
|
||||
$in->{'query'},
|
||||
$in->{'authnotrequired'},
|
||||
$in->{'flagsrequired'},
|
||||
$in->{'type'}
|
||||
) unless ($in->{'template_name'}=~/maintenance/);
|
||||
my ( $user, $cookie, $sessionID, $flags );
|
||||
if ( $in->{'template_name'} !~m/maintenance/ ) {
|
||||
( $user, $cookie, $sessionID, $flags ) = checkauth(
|
||||
$in->{'query'},
|
||||
$in->{'authnotrequired'},
|
||||
$in->{'flagsrequired'},
|
||||
$in->{'type'}
|
||||
);
|
||||
}
|
||||
|
||||
my $borrowernumber;
|
||||
my $insecure = C4::Context->preference('insecure');
|
||||
|
|
|
|||
|
|
@ -171,8 +171,9 @@ sub checkpw_ldap {
|
|||
if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
|
||||
my @types = C4::Members::AttributeTypes::GetAttributeTypes();
|
||||
my @attributes = grep{my $key=$_; any{$_ eq $key}@types;} keys %borrower;
|
||||
my $extended_patron_attributes = map{{code=>$_,value=>$borrower{$_}}}@attributes;
|
||||
my $extended_patron_attributes = [] unless $extended_patron_attributes;
|
||||
my $extended_patron_attributes;
|
||||
@{$extended_patron_attributes} =
|
||||
map { { code => $_, value => $borrower{$_} } } @attributes;
|
||||
my @errors;
|
||||
#Check before add
|
||||
for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) {
|
||||
|
|
|
|||
81
C4/Biblio.pm
81
C4/Biblio.pm
|
|
@ -1513,7 +1513,10 @@ sub GetMarcSubjects {
|
|||
my $value = $subject_subfield->[1];
|
||||
my $linkvalue = $value;
|
||||
$linkvalue =~ s/(\(|\))//g;
|
||||
my $operator = " and " unless $counter == 0;
|
||||
my $operator;
|
||||
if ( $counter != 0 ) {
|
||||
$operator = ' and ';
|
||||
}
|
||||
if ( $code eq 9 ) {
|
||||
$found9 = 1;
|
||||
@link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
|
||||
|
|
@ -1521,7 +1524,10 @@ sub GetMarcSubjects {
|
|||
if ( not $found9 ) {
|
||||
push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
|
||||
}
|
||||
my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
|
||||
my $separator;
|
||||
if ( $counter != 0 ) {
|
||||
$separator = C4::Context->preference('authoritysep');
|
||||
}
|
||||
|
||||
# ignore $9
|
||||
my @this_link_loop = @link_loop;
|
||||
|
|
@ -1579,7 +1585,10 @@ sub GetMarcAuthors {
|
|||
my $value = $authors_subfield->[1];
|
||||
my $linkvalue = $value;
|
||||
$linkvalue =~ s/(\(|\))//g;
|
||||
my $operator = " and " unless $count_auth == 0;
|
||||
my $operator;
|
||||
if ( $count_auth != 0 ) {
|
||||
$operator = ' and ';
|
||||
}
|
||||
|
||||
# if we have an authority link, use that as the link, otherwise use standard searching
|
||||
if ($subfield9) {
|
||||
|
|
@ -1595,8 +1604,17 @@ sub GetMarcAuthors {
|
|||
$value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
|
||||
if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
|
||||
my @this_link_loop = @link_loop;
|
||||
my $separator = C4::Context->preference("authoritysep") unless $count_auth == 0;
|
||||
push @subfields_loop, { code => $subfieldcode, value => $value, link_loop => \@this_link_loop, separator => $separator } unless ( $authors_subfield->[0] eq '9' );
|
||||
my $separator;
|
||||
if ( $count_auth != 0 ) {
|
||||
$separator = C4::Context->preference('authoritysep');
|
||||
}
|
||||
push @subfields_loop,
|
||||
{ code => $subfieldcode,
|
||||
value => $value,
|
||||
link_loop => \@this_link_loop,
|
||||
separator => $separator
|
||||
}
|
||||
unless ( $authors_subfield->[0] eq '9' );
|
||||
$count_auth++;
|
||||
}
|
||||
push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
|
||||
|
|
@ -1707,13 +1725,27 @@ sub GetMarcSeries {
|
|||
my $value = $series_subfield->[1];
|
||||
my $linkvalue = $value;
|
||||
$linkvalue =~ s/(\(|\))//g;
|
||||
my $operator = " and " unless $counter == 0;
|
||||
push @link_loop, { link => $linkvalue, operator => $operator };
|
||||
my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
|
||||
if ( $counter != 0 ) {
|
||||
push @link_loop, { link => $linkvalue, operator => ' and ', };
|
||||
} else {
|
||||
push @link_loop, { link => $linkvalue, operator => undef, };
|
||||
}
|
||||
my $separator;
|
||||
if ( $counter != 0 ) {
|
||||
$separator = C4::Context->preference('authoritysep');
|
||||
}
|
||||
if ($volume_number) {
|
||||
push @subfields_loop, { volumenum => $value };
|
||||
} else {
|
||||
push @subfields_loop, { code => $code, value => $value, link_loop => \@link_loop, separator => $separator, volumenum => $volume_number } unless ( $series_subfield->[0] eq '9' );
|
||||
if ( $series_subfield->[0] ne '9' ) {
|
||||
push @subfields_loop, {
|
||||
code => $code,
|
||||
value => $value,
|
||||
link_loop => \@link_loop,
|
||||
separator => $separator,
|
||||
volumenum => $volume_number,
|
||||
};
|
||||
}
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
|
@ -2329,8 +2361,11 @@ sub PrepareItemrecordDisplay {
|
|||
my $tagslib = &GetMarcStructure( 1, $frameworkcode );
|
||||
|
||||
# return nothing if we don't have found an existing framework.
|
||||
return "" unless $tagslib;
|
||||
my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum ) if ($itemnum);
|
||||
return q{} unless $tagslib;
|
||||
my $itemrecord;
|
||||
if ($itemnum) {
|
||||
$itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum );
|
||||
}
|
||||
my @loop_data;
|
||||
my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
|
||||
foreach my $tag ( sort keys %{$tagslib} ) {
|
||||
|
|
@ -2369,15 +2404,20 @@ sub PrepareItemrecordDisplay {
|
|||
&& C4::Context->preference('itemcallnumber') ) {
|
||||
my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
|
||||
my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
|
||||
my $temp = $itemrecord->field($CNtag) if ($itemrecord);
|
||||
if ($temp) {
|
||||
$defaultvalue = $temp->subfield($CNsubfield);
|
||||
if ($itemrecord) {
|
||||
my $temp = $itemrecord->field($CNtag);
|
||||
if ($temp) {
|
||||
$defaultvalue = $temp->subfield($CNsubfield);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
|
||||
&& $defaultvalues
|
||||
&& $defaultvalues->{'callnumber'} ) {
|
||||
my $temp = $itemrecord->field($subfield) if ($itemrecord);
|
||||
my $temp;
|
||||
if ($itemrecord) {
|
||||
$temp = $itemrecord->field($subfield);
|
||||
}
|
||||
unless ($temp) {
|
||||
$defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
|
||||
}
|
||||
|
|
@ -2385,7 +2425,10 @@ sub PrepareItemrecordDisplay {
|
|||
if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
|
||||
&& $defaultvalues
|
||||
&& $defaultvalues->{'branchcode'} ) {
|
||||
my $temp = $itemrecord->field($subfield) if ($itemrecord);
|
||||
my $temp;
|
||||
if ($itemrecord) {
|
||||
$temp = $itemrecord->field($subfield);
|
||||
}
|
||||
unless ($temp) {
|
||||
$defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
|
||||
}
|
||||
|
|
@ -2510,8 +2553,10 @@ sub PrepareItemrecordDisplay {
|
|||
}
|
||||
}
|
||||
}
|
||||
my $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield )
|
||||
if ( $itemrecord && $itemrecord->field($itemtagfield) );
|
||||
my $itemnumber;
|
||||
if ( $itemrecord && $itemrecord->field($itemtagfield) ) {
|
||||
$itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield );
|
||||
}
|
||||
return {
|
||||
'itemtagfield' => $itemtagfield,
|
||||
'itemtagsubfield' => $itemtagsubfield,
|
||||
|
|
|
|||
|
|
@ -590,7 +590,10 @@ sub GetBudgetHierarchy {
|
|||
# add budget-percent and allocation, and flags for html-template
|
||||
foreach my $r (@sort) {
|
||||
my $subs_href = $r->{'child'};
|
||||
my @subs_arr = @$subs_href if defined $subs_href;
|
||||
my @subs_arr = ();
|
||||
if ( defined $subs_href ) {
|
||||
@subs_arr = @{$subs_href};
|
||||
}
|
||||
|
||||
my $moo = $r->{'budget_code_indent'};
|
||||
$moo =~ s/\ /\ \;/g;
|
||||
|
|
|
|||
|
|
@ -323,12 +323,14 @@ sub SendAlerts {
|
|||
$letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
|
||||
$letter->{content} =~
|
||||
s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
|
||||
foreach my $data (@$dataorders) {
|
||||
my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
|
||||
foreach my $field ( keys %$data ) {
|
||||
$line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
|
||||
foreach my $data ( @{$dataorders} ) {
|
||||
if ( $letter->{content} =~ m/(<<.*>>)/ ) {
|
||||
my $line = $1;
|
||||
foreach my $field ( keys %{$data} ) {
|
||||
$line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
|
||||
}
|
||||
$letter->{content} =~ s/(<<.*>>)/$line\n$1/;
|
||||
}
|
||||
$letter->{content} =~ s/(<<.*>>)/$line\n$1/;
|
||||
}
|
||||
$letter->{content} =~ s/<<[^>]*>>//g;
|
||||
my $innerletter = $letter;
|
||||
|
|
@ -391,12 +393,14 @@ sub SendAlerts {
|
|||
$letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
|
||||
$letter->{content} =~
|
||||
s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
|
||||
foreach my $data (@$dataorders) {
|
||||
my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
|
||||
foreach my $field ( keys %$data ) {
|
||||
$line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
|
||||
foreach my $data ( @{$dataorders} ) {
|
||||
if ( $letter->{content} =~ m/(<<.*>>)/ ) {
|
||||
my $line = $1;
|
||||
foreach my $field ( keys %{$data} ) {
|
||||
$line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
|
||||
}
|
||||
$letter->{content} =~ s/(<<.*>>)/$line\n$1/;
|
||||
}
|
||||
$letter->{content} =~ s/(<<.*>>)/$line\n$1/;
|
||||
}
|
||||
$letter->{content} =~ s/<<[^>]*>>//g;
|
||||
my $innerletter = $letter;
|
||||
|
|
|
|||
|
|
@ -1177,9 +1177,11 @@ sub GetMemberAccountRecords {
|
|||
$sth->execute( @bind );
|
||||
my $total = 0;
|
||||
while ( my $data = $sth->fetchrow_hashref ) {
|
||||
my $biblio = GetBiblioFromItemNumber($data->{itemnumber}) if $data->{itemnumber};
|
||||
$data->{biblionumber} = $biblio->{biblionumber};
|
||||
$data->{title} = $biblio->{title};
|
||||
if ( $data->{itemnumber} ) {
|
||||
my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
|
||||
$data->{biblionumber} = $biblio->{biblionumber};
|
||||
$data->{title} = $biblio->{title};
|
||||
}
|
||||
$acctlines[$numlines] = $data;
|
||||
$numlines++;
|
||||
$total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
|
||||
|
|
|
|||
17
C4/Record.pm
17
C4/Record.pm
|
|
@ -266,12 +266,19 @@ sub marc2modsxml {
|
|||
sub marc2endnote {
|
||||
my ($marc) = @_;
|
||||
my $marc_rec_obj = MARC::Record->new_from_usmarc($marc);
|
||||
my $f260 = $marc_rec_obj->field('260');
|
||||
my $f260a = $f260->subfield('a') if $f260;
|
||||
my ( $abstract, $f260a, $f710a );
|
||||
my $f260 = $marc_rec_obj->field('260');
|
||||
if ($f260) {
|
||||
$f260a = $f260->subfield('a') if $f260;
|
||||
}
|
||||
my $f710 = $marc_rec_obj->field('710');
|
||||
my $f710a = $f710->subfield('a') if $f710;
|
||||
my $f500 = $marc_rec_obj->field('500');
|
||||
my $abstract = $f500->subfield('a') if $f500;
|
||||
if ($f710) {
|
||||
$f710a = $f710->subfield('a');
|
||||
}
|
||||
my $f500 = $marc_rec_obj->field('500');
|
||||
if ($f500) {
|
||||
$abstract = $f500->subfield('a');
|
||||
}
|
||||
my $fields = {
|
||||
DB => C4::Context->preference("LibraryName"),
|
||||
Title => $marc_rec_obj->title(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue