Lines 33-38
use C4::Debug;
Link Here
|
33 |
use C4::Items; |
33 |
use C4::Items; |
34 |
use YAML; |
34 |
use YAML; |
35 |
use URI::Escape; |
35 |
use URI::Escape; |
|
|
36 |
use POSIX; |
36 |
|
37 |
|
37 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); |
38 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); |
38 |
|
39 |
|
Lines 1423-1429
sub searchResults {
Link Here
|
1423 |
#find branchname |
1424 |
#find branchname |
1424 |
#get branch information..... |
1425 |
#get branch information..... |
1425 |
my %branches; |
1426 |
my %branches; |
1426 |
my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches"); # FIXME : use C4::Branch::GetBranches |
1427 |
my $bsth =$dbh->prepare("SELECT branchcode,branchname FROM branches "); |
1427 |
$bsth->execute(); |
1428 |
$bsth->execute(); |
1428 |
while ( my $bdata = $bsth->fetchrow_hashref ) { |
1429 |
while ( my $bdata = $bsth->fetchrow_hashref ) { |
1429 |
$branches{ $bdata->{'branchcode'} } = $bdata->{'branchname'}; |
1430 |
$branches{ $bdata->{'branchcode'} } = $bdata->{'branchname'}; |
Lines 1671-1677
sub searchResults {
Link Here
|
1671 |
($reservestatus, $reserveitem) = C4::Reserves::CheckReserves($item->{itemnumber}); |
1672 |
($reservestatus, $reserveitem) = C4::Reserves::CheckReserves($item->{itemnumber}); |
1672 |
} |
1673 |
} |
1673 |
|
1674 |
|
1674 |
# item is withdrawn, lost, damaged, not for loan, reserved or in transit |
1675 |
# item is withdrawn, lost or damaged |
1675 |
if ( $item->{wthdrawn} |
1676 |
if ( $item->{wthdrawn} |
1676 |
|| $item->{itemlost} |
1677 |
|| $item->{itemlost} |
1677 |
|| $item->{damaged} |
1678 |
|| $item->{damaged} |
Lines 1686-1700
sub searchResults {
Link Here
|
1686 |
$item_in_transit_count++ if $transfertwhen ne ''; |
1687 |
$item_in_transit_count++ if $transfertwhen ne ''; |
1687 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
1688 |
$item_onhold_count++ if $reservestatus eq 'Waiting'; |
1688 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
1689 |
$item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; |
1689 |
|
|
|
1690 |
# can place hold on item ? |
1691 |
if ((!$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems')) |
1692 |
&& !$item->{itemlost} |
1693 |
&& !$item->{withdrawn} |
1694 |
) { |
1695 |
$can_place_holds = 1; |
1696 |
} |
1697 |
|
1698 |
$other_count++; |
1690 |
$other_count++; |
1699 |
|
1691 |
|
1700 |
my $key = $prefix . $item->{status}; |
1692 |
my $key = $prefix . $item->{status}; |
Lines 2599-2607
$template->param ( MYLOOP => C4::Search::z3950_search_args($searchscalar) )
Link Here
|
2599 |
|
2591 |
|
2600 |
=cut |
2592 |
=cut |
2601 |
|
2593 |
|
|
|
2594 |
|
2595 |
|
2596 |
|
2602 |
sub z3950_search_args { |
2597 |
sub z3950_search_args { |
2603 |
my $bibrec = shift; |
2598 |
my $bibrec = shift; |
2604 |
$bibrec = { title => $bibrec } if !ref $bibrec; |
2599 |
|
|
|
2600 |
|
2601 |
if (validate_isbn($bibrec) == 1) |
2602 |
{ |
2603 |
$bibrec = { isbn => $bibrec } if !ref $bibrec; |
2604 |
} |
2605 |
else { |
2606 |
$bibrec = { title => $bibrec } if !ref $bibrec; |
2607 |
} |
2605 |
my $array = []; |
2608 |
my $array = []; |
2606 |
for my $field (qw/ lccn isbn issn title author dewey subject /) |
2609 |
for my $field (qw/ lccn isbn issn title author dewey subject /) |
2607 |
{ |
2610 |
{ |
Lines 2641-2646
OR adds a new authority record
Link Here
|
2641 |
=cut |
2644 |
=cut |
2642 |
|
2645 |
|
2643 |
|
2646 |
|
|
|
2647 |
=head |
2648 |
BOOL validate_isbn($isbn_number) |
2649 |
|
2650 |
This function validates an isbn number by: |
2651 |
|
2652 |
1. Checking it is 10 or 13 characters long |
2653 |
2. If it is 10 characters long, checks the lasd character is an 'X' and all other characters are digits |
2654 |
3. If it is 13 characters long, checks it begins with '97' and all other characters are digits |
2655 |
|
2656 |
=cut |
2657 |
sub validate_isbn { |
2658 |
my $isbn = shift; |
2659 |
|
2660 |
# Handle ISBNs with spaces or hyphens in them |
2661 |
$isbn =~ s/\s+//g; |
2662 |
$isbn =~ s/\-//g; |
2663 |
|
2664 |
# Is it the correct length ? |
2665 |
if (length($isbn) != 10 && length($isbn) != 13) |
2666 |
{ return 0; } |
2667 |
else { |
2668 |
|
2669 |
# Is the last char 'x' for ISBN10 ? |
2670 |
my @chars = split('', $isbn); |
2671 |
if (length($isbn) == 10 && uc($chars[9]) eq 'X') |
2672 |
{ |
2673 |
# Are all but the last characters digits ? |
2674 |
if (isdigit(substr($isbn,0,length($isbn)-1)) ) |
2675 |
{ return 1;} |
2676 |
} |
2677 |
|
2678 |
# Is it 13 chars long and begin with '97' ? |
2679 |
if ( ($chars[0] eq '9' && $chars[1] eq '7') && length($isbn) == 13) |
2680 |
{ |
2681 |
# is it made up of digits? |
2682 |
if (isdigit($isbn)) |
2683 |
{ return 1;} |
2684 |
|
2685 |
|
2686 |
} |
2687 |
|
2688 |
} |
2689 |
# If this function has not yet successfully returned the return failure |
2690 |
return 0; |
2691 |
} |
2692 |
|
2644 |
sub BiblioAddAuthorities{ |
2693 |
sub BiblioAddAuthorities{ |
2645 |
my ( $record, $frameworkcode ) = @_; |
2694 |
my ( $record, $frameworkcode ) = @_; |
2646 |
my $dbh=C4::Context->dbh; |
2695 |
my $dbh=C4::Context->dbh; |
2647 |
- |
|
|