|
Lines 69-75
BEGIN {
Link Here
|
| 69 |
CheckItemPreSave |
69 |
CheckItemPreSave |
| 70 |
|
70 |
|
| 71 |
GetItemsForInventory |
71 |
GetItemsForInventory |
| 72 |
GetItemsByBiblioitemnumber |
|
|
| 73 |
GetItemsInfo |
72 |
GetItemsInfo |
| 74 |
GetItemsLocationInfo |
73 |
GetItemsLocationInfo |
| 75 |
GetHostItemsInfo |
74 |
GetHostItemsInfo |
|
Lines 775-785
The following functions provide various ways of
Link Here
|
| 775 |
getting an item record, a set of item records, or |
774 |
getting an item record, a set of item records, or |
| 776 |
lists of authorized values for certain item fields. |
775 |
lists of authorized values for certain item fields. |
| 777 |
|
776 |
|
| 778 |
Some of the functions in this group are candidates |
|
|
| 779 |
for refactoring -- for example, some of the code |
| 780 |
in C<GetItemsByBiblioitemnumber> and C<GetItemsInfo> |
| 781 |
has copy-and-paste work. |
| 782 |
|
| 783 |
=cut |
777 |
=cut |
| 784 |
|
778 |
|
| 785 |
=head2 GetItemsForInventory |
779 |
=head2 GetItemsForInventory |
|
Lines 932-989
sub GetItemsForInventory {
Link Here
|
| 932 |
return (\@results, $iTotalRecords); |
926 |
return (\@results, $iTotalRecords); |
| 933 |
} |
927 |
} |
| 934 |
|
928 |
|
| 935 |
=head2 GetItemsByBiblioitemnumber |
|
|
| 936 |
|
| 937 |
GetItemsByBiblioitemnumber($biblioitemnumber); |
| 938 |
|
| 939 |
Returns an arrayref of hashrefs suitable for use in a TMPL_LOOP |
| 940 |
Called by C<C4::XISBN> |
| 941 |
|
| 942 |
=cut |
| 943 |
|
| 944 |
sub GetItemsByBiblioitemnumber { |
| 945 |
my ( $bibitem ) = @_; |
| 946 |
my $dbh = C4::Context->dbh; |
| 947 |
my $sth = $dbh->prepare("SELECT * FROM items WHERE items.biblioitemnumber = ?") || die $dbh->errstr; |
| 948 |
# Get all items attached to a biblioitem |
| 949 |
my $i = 0; |
| 950 |
my @results; |
| 951 |
$sth->execute($bibitem) || die $sth->errstr; |
| 952 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 953 |
# Foreach item, get circulation information |
| 954 |
my $sth2 = $dbh->prepare( "SELECT * FROM issues,borrowers |
| 955 |
WHERE itemnumber = ? |
| 956 |
AND issues.borrowernumber = borrowers.borrowernumber" |
| 957 |
); |
| 958 |
$sth2->execute( $data->{'itemnumber'} ); |
| 959 |
if ( my $data2 = $sth2->fetchrow_hashref ) { |
| 960 |
# if item is out, set the due date and who it is out too |
| 961 |
$data->{'date_due'} = $data2->{'date_due'}; |
| 962 |
$data->{'cardnumber'} = $data2->{'cardnumber'}; |
| 963 |
$data->{'borrowernumber'} = $data2->{'borrowernumber'}; |
| 964 |
} |
| 965 |
else { |
| 966 |
# set date_due to blank, so in the template we check itemlost, and withdrawn |
| 967 |
$data->{'date_due'} = ''; |
| 968 |
} # else |
| 969 |
# Find the last 3 people who borrowed this item. |
| 970 |
my $query2 = "SELECT * FROM old_issues, borrowers WHERE itemnumber = ? |
| 971 |
AND old_issues.borrowernumber = borrowers.borrowernumber |
| 972 |
ORDER BY returndate desc,timestamp desc LIMIT 3"; |
| 973 |
$sth2 = $dbh->prepare($query2) || die $dbh->errstr; |
| 974 |
$sth2->execute( $data->{'itemnumber'} ) || die $sth2->errstr; |
| 975 |
my $i2 = 0; |
| 976 |
while ( my $data2 = $sth2->fetchrow_hashref ) { |
| 977 |
$data->{"timestamp$i2"} = $data2->{'timestamp'}; |
| 978 |
$data->{"card$i2"} = $data2->{'cardnumber'}; |
| 979 |
$data->{"borrower$i2"} = $data2->{'borrowernumber'}; |
| 980 |
$i2++; |
| 981 |
} |
| 982 |
push(@results,$data); |
| 983 |
} |
| 984 |
return (\@results); |
| 985 |
} |
| 986 |
|
| 987 |
=head2 GetItemsInfo |
929 |
=head2 GetItemsInfo |
| 988 |
|
930 |
|
| 989 |
@results = GetItemsInfo($biblionumber); |
931 |
@results = GetItemsInfo($biblionumber); |
| 990 |
- |
|
|