|
Lines 958-964
sub GetItemLocation {
Link Here
|
| 958 |
|
958 |
|
| 959 |
=head2 GetLostItems |
959 |
=head2 GetLostItems |
| 960 |
|
960 |
|
| 961 |
$items = GetLostItems( $where, $orderby ); |
961 |
$items = GetLostItems( $where ); |
| 962 |
|
962 |
|
| 963 |
This function gets a list of lost items. |
963 |
This function gets a list of lost items. |
| 964 |
|
964 |
|
|
Lines 972-980
and the value to match as value. For example:
Link Here
|
| 972 |
{ barcode => 'abc123', |
972 |
{ barcode => 'abc123', |
| 973 |
homebranch => 'CPL', } |
973 |
homebranch => 'CPL', } |
| 974 |
|
974 |
|
| 975 |
C<$orderby> is a field of the items table by which the resultset |
|
|
| 976 |
should be orderd. |
| 977 |
|
| 978 |
=item return: |
975 |
=item return: |
| 979 |
|
976 |
|
| 980 |
C<$items> is a reference to an array full of hashrefs with columns |
977 |
C<$items> is a reference to an array full of hashrefs with columns |
|
Lines 983-989
from the "items" table as keys.
Link Here
|
| 983 |
=item usage in the perl script: |
980 |
=item usage in the perl script: |
| 984 |
|
981 |
|
| 985 |
my $where = { barcode => '0001548' }; |
982 |
my $where = { barcode => '0001548' }; |
| 986 |
my $items = GetLostItems( $where, "homebranch" ); |
983 |
my $items = GetLostItems( $where ); |
| 987 |
$template->param( itemsloop => $items ); |
984 |
$template->param( itemsloop => $items ); |
| 988 |
|
985 |
|
| 989 |
=back |
986 |
=back |
|
Lines 993-999
from the "items" table as keys.
Link Here
|
| 993 |
sub GetLostItems { |
990 |
sub GetLostItems { |
| 994 |
# Getting input args. |
991 |
# Getting input args. |
| 995 |
my $where = shift; |
992 |
my $where = shift; |
| 996 |
my $orderby = shift; |
|
|
| 997 |
my $dbh = C4::Context->dbh; |
993 |
my $dbh = C4::Context->dbh; |
| 998 |
|
994 |
|
| 999 |
my $query = " |
995 |
my $query = " |
|
Lines 1013-1023
sub GetLostItems {
Link Here
|
| 1013 |
$query .= " AND $key LIKE ?"; |
1009 |
$query .= " AND $key LIKE ?"; |
| 1014 |
push @query_parameters, "%$where->{$key}%"; |
1010 |
push @query_parameters, "%$where->{$key}%"; |
| 1015 |
} |
1011 |
} |
| 1016 |
my @ordervalues = qw/title author homebranch itype barcode price replacementprice lib datelastseen location/; |
|
|
| 1017 |
|
| 1018 |
if ( defined $orderby && grep($orderby, @ordervalues)) { |
| 1019 |
$query .= ' ORDER BY '.$orderby; |
| 1020 |
} |
| 1021 |
|
1012 |
|
| 1022 |
my $sth = $dbh->prepare($query); |
1013 |
my $sth = $dbh->prepare($query); |
| 1023 |
$sth->execute( @query_parameters ); |
1014 |
$sth->execute( @query_parameters ); |