Lines 71-77
bibs to and from virtual shelves.
Link Here
|
71 |
|
71 |
|
72 |
=head2 GetShelves |
72 |
=head2 GetShelves |
73 |
|
73 |
|
74 |
($shelflist, $totshelves) = &GetShelves($category, $row_count, $offset, $owner); |
74 |
$shelflist = &GetShelves($category, $row_count, $offset, $owner); |
75 |
($shelfnumber, $shelfhash) = each %{$shelflist}; |
75 |
($shelfnumber, $shelfhash) = each %{$shelflist}; |
76 |
|
76 |
|
77 |
Returns the number of shelves specified by C<$row_count> and C<$offset> as well as the total |
77 |
Returns the number of shelves specified by C<$row_count> and C<$offset> as well as the total |
Lines 90-107
and the values (C<$shelfhash>, above) are themselves references-to-hash, with th
Link Here
|
90 |
|
90 |
|
91 |
A string. The name of the shelf. |
91 |
A string. The name of the shelf. |
92 |
|
92 |
|
93 |
=item C<$shelfhash-E<gt>{count}> |
|
|
94 |
|
95 |
The number of virtuals on that virtualshelves. |
96 |
|
97 |
=back |
93 |
=back |
98 |
|
94 |
|
99 |
=cut |
95 |
=cut |
100 |
|
96 |
|
101 |
sub GetShelves { |
97 |
sub GetShelves { |
102 |
my ($category, $row_count, $offset, $owner) = @_; |
98 |
my ($category, $row_count, $offset, $owner) = @_; |
103 |
my @params; |
99 |
$offset ||= 0; |
104 |
my $total = _shelf_count($owner, $category); |
100 |
my @params = ( $offset, $row_count ); |
105 |
my $dbh = C4::Context->dbh; |
101 |
my $dbh = C4::Context->dbh; |
106 |
my $query = qq{ |
102 |
my $query = qq{ |
107 |
SELECT vs.shelfnumber, vs.shelfname,vs.owner, |
103 |
SELECT vs.shelfnumber, vs.shelfname,vs.owner, |
Lines 115-125
sub GetShelves {
Link Here
|
115 |
LEFT JOIN virtualshelfshares sh ON sh.shelfnumber=vs.shelfnumber |
111 |
LEFT JOIN virtualshelfshares sh ON sh.shelfnumber=vs.shelfnumber |
116 |
AND sh.borrowernumber=? |
112 |
AND sh.borrowernumber=? |
117 |
WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?) }; |
113 |
WHERE category=1 AND (vs.owner=? OR sh.borrowernumber=?) }; |
118 |
@params= ($owner, $owner, $owner, $offset||0, $row_count); |
114 |
push @params, ($owner) x 3; |
119 |
} |
115 |
} |
120 |
else { |
116 |
else { |
121 |
$query.= 'WHERE category=2 '; |
117 |
$query.= 'WHERE category=2 '; |
122 |
@params= ($offset||0, $row_count); |
|
|
123 |
} |
118 |
} |
124 |
$query.= qq{ |
119 |
$query.= qq{ |
125 |
GROUP BY vs.shelfnumber |
120 |
GROUP BY vs.shelfnumber |
Lines 139-145
sub GetShelves {
Link Here
|
139 |
$shelflist{$shelfnumber}->{'surname'} = $surname; |
134 |
$shelflist{$shelfnumber}->{'surname'} = $surname; |
140 |
$shelflist{$shelfnumber}->{'firstname'} = $firstname; |
135 |
$shelflist{$shelfnumber}->{'firstname'} = $firstname; |
141 |
} |
136 |
} |
142 |
return ( \%shelflist, $total ); |
137 |
return \%shelflist; |
143 |
} |
138 |
} |
144 |
|
139 |
|
145 |
=head2 GetAllShelves |
140 |
=head2 GetAllShelves |
Lines 751-759
WHERE borrowernumber=? AND shelfnumber=?
Link Here
|
751 |
return 1; |
746 |
return 1; |
752 |
} |
747 |
} |
753 |
|
748 |
|
754 |
# internal subs |
|
|
755 |
|
749 |
|
756 |
sub _shelf_count { |
750 |
sub GetShelfCount { |
757 |
my ($owner, $category) = @_; |
751 |
my ($owner, $category) = @_; |
758 |
my @params; |
752 |
my @params; |
759 |
# Find out how many shelves total meet the submitted criteria... |
753 |
# Find out how many shelves total meet the submitted criteria... |
Lines 777-782
sub _shelf_count {
Link Here
|
777 |
return $total; |
771 |
return $total; |
778 |
} |
772 |
} |
779 |
|
773 |
|
|
|
774 |
# internal subs |
780 |
sub _CheckShelfName { |
775 |
sub _CheckShelfName { |
781 |
my ($name, $cat, $owner, $number)= @_; |
776 |
my ($name, $cat, $owner, $number)= @_; |
782 |
|
777 |
|