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 1510-1516 sub GetMarcSubjects { Link Here
1510
            my $value     = $subject_subfield->[1];
1510
            my $value     = $subject_subfield->[1];
1511
            my $linkvalue = $value;
1511
            my $linkvalue = $value;
1512
            $linkvalue =~ s/(\(|\))//g;
1512
            $linkvalue =~ s/(\(|\))//g;
1513
            my $operator = " and " unless $counter == 0;
1513
            my $operator;
1514
            if ( $counter != 0 ) {
1515
                $operator = ' and ';
1516
            }
1514
            if ( $code eq 9 ) {
1517
            if ( $code eq 9 ) {
1515
                $found9 = 1;
1518
                $found9 = 1;
1516
                @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
1519
                @link_loop = ( { 'limit' => 'an', link => "$linkvalue" } );
Lines 1518-1524 sub GetMarcSubjects { Link Here
1518
            if ( not $found9 ) {
1521
            if ( not $found9 ) {
1519
                push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
1522
                push @link_loop, { 'limit' => $subject_limit, link => $linkvalue, operator => $operator };
1520
            }
1523
            }
1521
            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
1524
            my $separator;
1525
            if ( $counter != 0 ) {
1526
                $separator = C4::Context->preference('authoritysep');
1527
            }
1522
1528
1523
            # ignore $9
1529
            # ignore $9
1524
            my @this_link_loop = @link_loop;
1530
            my @this_link_loop = @link_loop;
Lines 1576-1582 sub GetMarcAuthors { Link Here
1576
            my $value        = $authors_subfield->[1];
1582
            my $value        = $authors_subfield->[1];
1577
            my $linkvalue    = $value;
1583
            my $linkvalue    = $value;
1578
            $linkvalue =~ s/(\(|\))//g;
1584
            $linkvalue =~ s/(\(|\))//g;
1579
            my $operator = " and " unless $count_auth == 0;
1585
            my $operator;
1586
            if ( $count_auth != 0 ) {
1587
                $operator = ' and ';
1588
            }
1580
1589
1581
            # if we have an authority link, use that as the link, otherwise use standard searching
1590
            # if we have an authority link, use that as the link, otherwise use standard searching
1582
            if ($subfield9) {
1591
            if ($subfield9) {
Lines 1592-1599 sub GetMarcAuthors { Link Here
1592
            $value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
1601
            $value = GetAuthorisedValueDesc( $field->tag(), $authors_subfield->[0], $authors_subfield->[1], '', $tagslib )
1593
              if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
1602
              if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /4/ ) );
1594
            my @this_link_loop = @link_loop;
1603
            my @this_link_loop = @link_loop;
1595
            my $separator = C4::Context->preference("authoritysep") unless $count_auth == 0;
1604
            my $separator;
1596
            push @subfields_loop, { code => $subfieldcode, value => $value, link_loop => \@this_link_loop, separator => $separator } unless ( $authors_subfield->[0] eq '9' );
1605
            if ( $count_auth != 0 ) {
1606
                $separator = C4::Context->preference('authoritysep');
1607
            }
1608
            push @subfields_loop,
1609
              { code      => $subfieldcode,
1610
                value     => $value,
1611
                link_loop => \@this_link_loop,
1612
                separator => $separator
1613
              }
1614
              unless ( $authors_subfield->[0] eq '9' );
1597
            $count_auth++;
1615
            $count_auth++;
1598
        }
1616
        }
1599
        push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
1617
        push @marcauthors, { MARCAUTHOR_SUBFIELDS_LOOP => \@subfields_loop };
Lines 1704-1716 sub GetMarcSeries { Link Here
1704
            my $value     = $series_subfield->[1];
1722
            my $value     = $series_subfield->[1];
1705
            my $linkvalue = $value;
1723
            my $linkvalue = $value;
1706
            $linkvalue =~ s/(\(|\))//g;
1724
            $linkvalue =~ s/(\(|\))//g;
1707
            my $operator = " and " unless $counter == 0;
1725
            if ( $counter != 0 ) {
1708
            push @link_loop, { link => $linkvalue, operator => $operator };
1726
                push @link_loop, { link => $linkvalue, operator => ' and ', };
1709
            my $separator = C4::Context->preference("authoritysep") unless $counter == 0;
1727
            } else {
1728
                push @link_loop, { link => $linkvalue, operator => undef, };
1729
            }
1730
            my $separator;
1731
            if ( $counter != 0 ) {
1732
                $separator = C4::Context->preference('authoritysep');
1733
            }
1710
            if ($volume_number) {
1734
            if ($volume_number) {
1711
                push @subfields_loop, { volumenum => $value };
1735
                push @subfields_loop, { volumenum => $value };
1712
            } else {
1736
            } else {
1713
                push @subfields_loop, { code => $code, value => $value, link_loop => \@link_loop, separator => $separator, volumenum => $volume_number } unless ( $series_subfield->[0] eq '9' );
1737
                if ( $series_subfield->[0] ne '9' ) {
1738
                    push @subfields_loop, {
1739
                        code      => $code,
1740
                        value     => $value,
1741
                        link_loop => \@link_loop,
1742
                        separator => $separator,
1743
                        volumenum => $volume_number,
1744
                    };
1745
                }
1714
            }
1746
            }
1715
            $counter++;
1747
            $counter++;
1716
        }
1748
        }
Lines 2326-2333 sub PrepareItemrecordDisplay { Link Here
2326
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2358
    my $tagslib = &GetMarcStructure( 1, $frameworkcode );
2327
2359
2328
    # return nothing if we don't have found an existing framework.
2360
    # return nothing if we don't have found an existing framework.
2329
    return "" unless $tagslib;
2361
    return q{} unless $tagslib;
2330
    my $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum ) if ($itemnum);
2362
    my $itemrecord;
2363
    if ($itemnum) {
2364
        $itemrecord = C4::Items::GetMarcItem( $bibnum, $itemnum );
2365
    }
2331
    my @loop_data;
2366
    my @loop_data;
2332
    my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
2367
    my $authorised_values_sth = $dbh->prepare( "SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib" );
2333
    foreach my $tag ( sort keys %{$tagslib} ) {
2368
    foreach my $tag ( sort keys %{$tagslib} ) {
Lines 2366-2380 sub PrepareItemrecordDisplay { Link Here
2366
                    && C4::Context->preference('itemcallnumber') ) {
2401
                    && C4::Context->preference('itemcallnumber') ) {
2367
                    my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
2402
                    my $CNtag      = substr( C4::Context->preference('itemcallnumber'), 0, 3 );
2368
                    my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
2403
                    my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 );
2369
                    my $temp = $itemrecord->field($CNtag) if ($itemrecord);
2404
                    if ($itemrecord) {
2370
                    if ($temp) {
2405
                        my $temp = $itemrecord->field($CNtag);
2371
                        $defaultvalue = $temp->subfield($CNsubfield);
2406
                        if ($temp) {
2407
                            $defaultvalue = $temp->subfield($CNsubfield);
2408
                        }
2372
                    }
2409
                    }
2373
                }
2410
                }
2374
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2411
                if (   $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber'
2375
                    && $defaultvalues
2412
                    && $defaultvalues
2376
                    && $defaultvalues->{'callnumber'} ) {
2413
                    && $defaultvalues->{'callnumber'} ) {
2377
                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
2414
                    my $temp;
2415
                    if ($itemrecord) {
2416
                        $temp = $itemrecord->field($subfield);
2417
                    }
2378
                    unless ($temp) {
2418
                    unless ($temp) {
2379
                        $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
2419
                        $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues;
2380
                    }
2420
                    }
Lines 2382-2388 sub PrepareItemrecordDisplay { Link Here
2382
                if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2422
                if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
2383
                    && $defaultvalues
2423
                    && $defaultvalues
2384
                    && $defaultvalues->{'branchcode'} ) {
2424
                    && $defaultvalues->{'branchcode'} ) {
2385
                    my $temp = $itemrecord->field($subfield) if ($itemrecord);
2425
                    my $temp;
2426
                    if ($itemrecord) {
2427
                        $temp = $itemrecord->field($subfield);
2428
                    }
2386
                    unless ($temp) {
2429
                    unless ($temp) {
2387
                        $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
2430
                        $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues;
2388
                    }
2431
                    }
Lines 2507-2514 sub PrepareItemrecordDisplay { Link Here
2507
            }
2550
            }
2508
        }
2551
        }
2509
    }
2552
    }
2510
    my $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield )
2553
    my $itemnumber;
2511
      if ( $itemrecord && $itemrecord->field($itemtagfield) );
2554
    if ( $itemrecord && $itemrecord->field($itemtagfield) ) {
2555
        $itemnumber = $itemrecord->subfield( $itemtagfield, $itemtagsubfield );
2556
    }
2512
    return {
2557
    return {
2513
        'itemtagfield'    => $itemtagfield,
2558
        'itemtagfield'    => $itemtagfield,
2514
        'itemtagsubfield' => $itemtagsubfield,
2559
        '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