View | Details | Raw Unified | Return to bug 5453
Collapse All | Expand All

(-)a/C4/Auth.pm (-6 / +9 lines)
Lines 137-148 sub get_template_and_user { Link Here
137
    my $in       = shift;
137
    my $in       = shift;
138
    my $template =
138
    my $template =
139
      gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
139
      gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'} );
140
    my ( $user, $cookie, $sessionID, $flags ) = checkauth(
140
    my ( $user, $cookie, $sessionID, $flags );
141
        $in->{'query'},
141
    if ( $in->{'template_name'} !~m/maintenance/ ) {
142
        $in->{'authnotrequired'},
142
        ( $user, $cookie, $sessionID, $flags ) = checkauth(
143
        $in->{'flagsrequired'},
143
            $in->{'query'},
144
        $in->{'type'}
144
            $in->{'authnotrequired'},
145
    ) unless ($in->{'template_name'}=~/maintenance/);
145
            $in->{'flagsrequired'},
146
            $in->{'type'}
147
        );
148
    }
146
149
147
    my $borrowernumber;
150
    my $borrowernumber;
148
    my $insecure = C4::Context->preference('insecure');
151
    my $insecure = C4::Context->preference('insecure');
(-)a/C4/Auth_with_ldap.pm (-2 / +3 lines)
Lines 165-172 sub checkpw_ldap { Link Here
165
	if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
165
	if (C4::Context->preference('ExtendedPatronAttributes') && $borrowernumber && ($config{update} ||$config{replicate})) {
166
   		my @types = C4::Members::AttributeTypes::GetAttributeTypes();
166
   		my @types = C4::Members::AttributeTypes::GetAttributeTypes();
167
		my @attributes = grep{my $key=$_; any{$_ eq $key}@types;} keys %borrower;
167
		my @attributes = grep{my $key=$_; any{$_ eq $key}@types;} keys %borrower;
168
		my $extended_patron_attributes = map{{code=>$_,value=>$borrower{$_}}}@attributes;
168
        my $extended_patron_attributes;
169
		my $extended_patron_attributes = [] unless $extended_patron_attributes;
169
        @{$extended_patron_attributes} =
170
          map { { code => $_, value => $borrower{$_} } } @attributes;
170
		my @errors;
171
		my @errors;
171
		#Check before add
172
		#Check before add
172
		for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) {
173
		for (my $i; $i< scalar(@$extended_patron_attributes)-1;$i++) {
(-)a/C4/Biblio.pm (-18 / +63 lines)
Lines 1513-1519 sub GetMarcSubjects { Link Here
1513
            my $value     = $subject_subfield->[1];
1513
            my $value     = $subject_subfield->[1];
1514
            my $linkvalue = $value;
1514
            my $linkvalue = $value;
1515
            $linkvalue =~ s/(\(|\))//g;
1515
            $linkvalue =~ s/(\(|\))//g;
1516
            my $operator = " and " unless $counter == 0;
1516
            my $operator;
1517
            if ( $counter != 0 ) {
1518
                $operator = ' and ';
1519
            }
1517
            if ( $code eq 9 ) {
1520
            if ( $code eq 9 ) {
1518
                $found9 = 1;
1521
                $found9 = 1;
1519
                @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
1522
                @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
Lines 1521-1527 sub GetMarcSubjects { Link Here
1521
            if ( not $found9 ) {
1524
            if ( not $found9 ) {
1522
                push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
1525
                push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
1523
            }
1526
            }
1524
            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
1527
            my $separator;
1528
            if ( $counter != 0 ) {
1529
                $separator = C4::Context->preference('authoritysep');
1530
            }
1525
1531
1526
            # ignore $9
1532
            # ignore $9
1527
            my @this_link_loop = @link_loop;
1533
            my @this_link_loop = @link_loop;
Lines 1579-1585 sub GetMarcAuthors { Link Here
1579
            my $value        = $authors_subfield->[1];
1585
            my $value        = $authors_subfield->[1];
1580
            my $linkvalue    = $value;
1586
            my $linkvalue    = $value;
1581
            $linkvalue =~ s/(\(|\))//g;
1587
            $linkvalue =~ s/(\(|\))//g;
1582
            my $operator = " and " unless $count_auth == 0;
1588
            my $operator;
1589
            if ( $count_auth != 0 ) {
1590
                $operator = ' and ';
1591
            }
1583
1592
1584
            # if we have an authority link, use that as the link, otherwise use standard searching
1593
            # if we have an authority link, use that as the link, otherwise use standard searching
1585
            if ($subfield9) {
1594
            if ($subfield9) {
Lines 1595-1602 sub GetMarcAuthors { Link Here
1595
            $value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
1604
            $value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
1596
              if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
1605
              if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
1597
            my @this_link_loop = @link_loop;
1606
            my @this_link_loop = @link_loop;
1598
            my $separator = C4::Context->preference("authoritysep") unless $count_auth == 0;
1607
            my $separator;
1599
            push @subfields_loop, { code => $subfieldcode, value => $value, link_loop => \@this_link_loop, separator => $separator } unless ( $authors_subfield->[0] eq '9' );
1608
            if ( $count_auth != 0 ) {
1609
                $separator = C4::Context->preference('authoritysep');
1610
            }
1611
            push @subfields_loop,
1612
              { code      => $subfieldcode,
1613
                value     => $value,
1614
                link_loop => \@this_link_loop,
1615
                separator => $separator
1616
              }
1617
              unless ( $authors_subfield->[0] eq '9' );
1600
            $count_auth++;
1618
            $count_auth++;
1601
        }
1619
        }
1602
        push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
1620
        push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
Lines 1707-1719 sub GetMarcSeries { Link Here
1707
            my $value     = $series_subfield->[1];
1725
            my $value     = $series_subfield->[1];
1708
            my $linkvalue = $value;
1726
            my $linkvalue = $value;
1709
            $linkvalue =~ s/(\(|\))//g;
1727
            $linkvalue =~ s/(\(|\))//g;
1710
            my $operator = " and " unless $counter == 0;
1728
            if ( $counter != 0 ) {
1711
            push @link_loop, { link => $linkvalue, operator => $operator };
1729
                push @link_loop, { link => $linkvalue, operator => ' and ', };
1712
            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
1730
            } else {
1731
                push @link_loop, { link => $linkvalue, operator => undef, };
1732
            }
1733
            my $separator;
1734
            if ( $counter != 0 ) {
1735
                $separator = C4::Context->preference('authoritysep');
1736
            }
1713
            if ($volume_number) {
1737
            if ($volume_number) {
1714
                push @subfields_loop, { volumenum => $value };
1738
                push @subfields_loop, { volumenum => $value };
1715
            } else {
1739
            } else {
1716
                push @subfields_loop, { code => $code, value => $value, link_loop => \@link_loop, separator => $separator, volumenum => $volume_number } unless ( $series_subfield->[0] eq '9' );
1740
                if ( $series_subfield->[0] ne '9' ) {
1741
                    push @subfields_loop, {
1742
                        code      => $code,
1743
                        value     => $value,
1744
                        link_loop => \@link_loop,
1745
                        separator => $separator,
1746
                        volumenum => $volume_number,
1747
                    };
1748
                }
1717
            }
1749
            }
1718
            $counter++;
1750
            $counter++;
1719
        }
1751
        }
Lines 2329-2336 sub PrepareItemrecordDisplay { Link Here
2329
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2361
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2330
2362
2331
    # return nothing if we don't have found an existing framework.
2363
    # return nothing if we don't have found an existing framework.
2332
    return "" unless $tagslib;
2364
    return q{} unless $tagslib;
2333
    my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum ) if ($itemnum);
2365
    my $itemrecord;
2366
    if ($itemnum) {
2367
        $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum );
2368
    }
2334
    my @loop_data;
2369
    my @loop_data;
2335
    my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
2370
    my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
2336
    foreach my $tag ( sort keys %{$tagslib} ) {
2371
    foreach my $tag ( sort keys %{$tagslib} ) {
Lines 2369-2383 sub PrepareItemrecordDisplay { Link Here
2369
                    && C4::Context->preference('itemcallnumber') ) {
2404
                    && C4::Context->preference('itemcallnumber') ) {
2370
                    my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
2405
                    my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
2371
                    my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
2406
                    my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
2372
                    my $temp = $itemrecord->field($CNtag) if ($itemrecord);
2407
                    if ($itemrecord) {
2373
                    if ($temp) {
2408
                        my $temp = $itemrecord->field($CNtag);
2374
                        $defaultvalue = $temp->subfield($CNsubfield);
2409
                        if ($temp) {
2410
                            $defaultvalue = $temp->subfield($CNsubfield);
2411
                        }
2375
                    }
2412
                    }
2376
                }
2413
                }
2377
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2414
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2378
                    && $defaultvalues
2415
                    && $defaultvalues
2379
                    && $defaultvalues->{'callnumber'} ) {
2416
                    && $defaultvalues->{'callnumber'} ) {
2380
                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
2417
                    my $temp;
2418
                    if ($itemrecord) {
2419
                        $temp = $itemrecord->field($subfield);
2420
                    }
2381
                    unless ($temp) {
2421
                    unless ($temp) {
2382
                        $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
2422
                        $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
2383
                    }
2423
                    }
Lines 2385-2391 sub PrepareItemrecordDisplay { Link Here
2385
                if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2425
                if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2386
                    && $defaultvalues
2426
                    && $defaultvalues
2387
                    && $defaultvalues->{'branchcode'} ) {
2427
                    && $defaultvalues->{'branchcode'} ) {
2388
                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
2428
                    my $temp;
2429
                    if ($itemrecord) {
2430
                        $temp = $itemrecord->field($subfield);
2431
                    }
2389
                    unless ($temp) {
2432
                    unless ($temp) {
2390
                        $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
2433
                        $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
2391
                    }
2434
                    }
Lines 2510-2517 sub PrepareItemrecordDisplay { Link Here
2510
            }
2553
            }
2511
        }
2554
        }
2512
    }
2555
    }
2513
    my $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield )
2556
    my $itemnumber;
2514
      if ( $itemrecord && $itemrecord->field($itemtagfield) );
2557
    if ( $itemrecord && $itemrecord->field($itemtagfield) ) {
2558
        $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield );
2559
    }
2515
    return {
2560
    return {
2516
        'itemtagfield'    => $itemtagfield,
2561
        'itemtagfield'    => $itemtagfield,
2517
        'itemtagsubfield' => $itemtagsubfield,
2562
        'itemtagsubfield' => $itemtagsubfield,
(-)a/C4/Budgets.pm (-1 / +4 lines)
Lines 590-596 sub GetBudgetHierarchy { Link Here
590
# add budget-percent and allocation, and flags for html-template
590
# add budget-percent and allocation, and flags for html-template
591
	foreach my $r (@sort) {
591
	foreach my $r (@sort) {
592
		my $subs_href = $r->{'child'};
592
		my $subs_href = $r->{'child'};
593
        my @subs_arr = @$subs_href if defined $subs_href;
593
        my @subs_arr = ();
594
        if ( defined $subs_href ) {
595
            @subs_arr = @{$subs_href};
596
        }
594
597
595
        my $moo = $r->{'budget_code_indent'};
598
        my $moo = $r->{'budget_code_indent'};
596
        $moo =~ s/\ /\&nbsp\;/g;
599
        $moo =~ s/\ /\&nbsp\;/g;
(-)a/C4/Letters.pm (-10 / +14 lines)
Lines 323-334 sub SendAlerts { Link Here
323
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
323
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
324
        $letter->{content} =~
324
        $letter->{content} =~
325
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
325
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
326
        foreach my $data (@$dataorders) {
326
        foreach my $data ( @{$dataorders} ) {
327
            my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
327
            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
328
            foreach my $field ( keys %$data ) {
328
                my $line = $1;
329
                $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
329
                foreach my $field ( keys %{$data} ) {
330
                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
331
                }
332
                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
330
            }
333
            }
331
            $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
332
        }
334
        }
333
        $letter->{content} =~ s/<<[^>]*>>//g;
335
        $letter->{content} =~ s/<<[^>]*>>//g;
334
        my $innerletter = $letter;
336
        my $innerletter = $letter;
Lines 391-402 sub SendAlerts { Link Here
391
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
393
        $letter->{content} =~ s/<<LibrarianSurname>>/$userenv->{surname}/g;
392
        $letter->{content} =~
394
        $letter->{content} =~
393
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
395
          s/<<LibrarianEmailaddress>>/$userenv->{emailaddress}/g;
394
        foreach my $data (@$dataorders) {
396
        foreach my $data ( @{$dataorders} ) {
395
            my $line = $1 if ( $letter->{content} =~ m/(<<.*>>)/ );
397
            if ( $letter->{content} =~ m/(<<.*>>)/ ) {
396
            foreach my $field ( keys %$data ) {
398
                my $line = $1;
397
                $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
399
                foreach my $field ( keys %{$data} ) {
400
                    $line =~ s/(<<[^\.]+.$field>>)/$data->{$field}/;
401
                }
402
                $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
398
            }
403
            }
399
            $letter->{content} =~ s/(<<.*>>)/$line\n$1/;
400
        }
404
        }
401
        $letter->{content} =~ s/<<[^>]*>>//g;
405
        $letter->{content} =~ s/<<[^>]*>>//g;
402
        my $innerletter = $letter;
406
        my $innerletter = $letter;
(-)a/C4/Members.pm (-3 / +5 lines)
Lines 1167-1175 sub GetMemberAccountRecords { Link Here
1167
    $sth->execute( @bind );
1167
    $sth->execute( @bind );
1168
    my $total = 0;
1168
    my $total = 0;
1169
    while ( my $data = $sth->fetchrow_hashref ) {
1169
    while ( my $data = $sth->fetchrow_hashref ) {
1170
		my $biblio = GetBiblioFromItemNumber($data->{itemnumber}) if $data->{itemnumber};
1170
        if ( $data->{itemnumber} ) {
1171
		$data->{biblionumber} = $biblio->{biblionumber};
1171
            my $biblio = GetBiblioFromItemNumber( $data->{itemnumber} );
1172
	        $data->{title} = $biblio->{title};
1172
            $data->{biblionumber} = $biblio->{biblionumber};
1173
            $data->{title}        = $biblio->{title};
1174
        }
1173
        $acctlines[$numlines] = $data;
1175
        $acctlines[$numlines] = $data;
1174
        $numlines++;
1176
        $numlines++;
1175
        $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
1177
        $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors
(-)a/C4/Record.pm (-6 / +12 lines)
Lines 266-277 sub marc2modsxml { Link Here
266
sub marc2endnote {
266
sub marc2endnote {
267
    my ($marc) = @_;
267
    my ($marc) = @_;
268
	my $marc_rec_obj =  MARC::Record->new_from_usmarc($marc);
268
	my $marc_rec_obj =  MARC::Record->new_from_usmarc($marc);
269
	my $f260 = $marc_rec_obj->field('260');
269
    my ( $abstract, $f260a, $f710a );
270
	my $f260a = $f260->subfield('a') if $f260;
270
    my $f260 = $marc_rec_obj->field('260');
271
    if ($f260) {
272
        $f260a = $f260->subfield('a') if $f260;
273
    }
271
    my $f710 = $marc_rec_obj->field('710');
274
    my $f710 = $marc_rec_obj->field('710');
272
    my $f710a = $f710->subfield('a') if $f710;
275
    if ($f710) {
273
	my $f500 = $marc_rec_obj->field('500');
276
        $f710a = $f710->subfield('a');
274
	my $abstract = $f500->subfield('a') if $f500;
277
    }
278
    my $f500 = $marc_rec_obj->field('500');
279
    if ($f500) {
280
        $abstract = $f500->subfield('a');
281
    }
275
	my $fields = {
282
	my $fields = {
276
		DB => C4::Context->preference("LibraryName"),
283
		DB => C4::Context->preference("LibraryName"),
277
		Title => $marc_rec_obj->title(),	
284
		Title => $marc_rec_obj->title(),	
278
- 

Return to bug 5453