Lines 1-9
Link Here
|
1 |
package C4::RotatingCollections; |
1 |
package C4::RotatingCollections; |
2 |
|
2 |
|
3 |
# $Id: RotatingCollections.pm,v 0.1 2007/04/20 kylemhall |
3 |
# $Id: RotatingCollections.pm,v 0.1 2007/04/20 kylemhall |
4 |
|
4 |
|
5 |
# This package is inteded to keep track of what library |
5 |
# This package is inteded to keep track of what library |
6 |
# Items of a certain collection should be at. |
6 |
# Items of a certain collection should be at. |
7 |
|
7 |
|
8 |
# Copyright 2007 Kyle Hall |
8 |
# Copyright 2007 Kyle Hall |
9 |
# |
9 |
# |
Lines 81-108
BEGIN {
Link Here
|
81 |
=cut |
81 |
=cut |
82 |
|
82 |
|
83 |
sub CreateCollection { |
83 |
sub CreateCollection { |
84 |
my ( $title, $description ) = @_; |
84 |
my ( $title, $description ) = @_; |
85 |
|
85 |
|
86 |
## Check for all neccessary parameters |
86 |
## Check for all neccessary parameters |
87 |
if ( ! $title ) { |
87 |
if ( !$title ) { |
88 |
return ( 0, 1, "No Title Given" ); |
88 |
return ( 0, 1, "No Title Given" ); |
89 |
} |
89 |
} |
90 |
if ( ! $description ) { |
90 |
if ( !$description ) { |
91 |
return ( 0, 2, "No Description Given" ); |
91 |
return ( 0, 2, "No Description Given" ); |
92 |
} |
92 |
} |
93 |
|
93 |
|
94 |
my $success = 1; |
94 |
my $success = 1; |
95 |
|
95 |
|
96 |
my $dbh = C4::Context->dbh; |
96 |
my $dbh = C4::Context->dbh; |
97 |
|
97 |
|
98 |
my $sth; |
98 |
my $sth; |
99 |
$sth = $dbh->prepare("INSERT INTO collections ( colId, colTitle, colDesc ) |
99 |
$sth = $dbh->prepare(" |
100 |
VALUES ( NULL, ?, ? )"); |
100 |
INSERT INTO collections ( colId, colTitle, colDesc ) VALUES ( NULL, ?, ? ) |
101 |
$sth->execute( $title, $description ) or return ( 0, 3, $sth->errstr() ); |
101 |
"); |
102 |
$sth->finish; |
102 |
$sth->execute( $title, $description ) or return ( 0, 3, $sth->errstr() ); |
|
|
103 |
$sth->finish; |
104 |
|
105 |
return 1; |
103 |
|
106 |
|
104 |
return 1; |
|
|
105 |
|
106 |
} |
107 |
} |
107 |
|
108 |
|
108 |
=head2 UpdateCollection |
109 |
=head2 UpdateCollection |
Lines 124-154
Updates a collection
Link Here
|
124 |
=cut |
125 |
=cut |
125 |
|
126 |
|
126 |
sub UpdateCollection { |
127 |
sub UpdateCollection { |
127 |
my ( $colId, $title, $description ) = @_; |
128 |
my ( $colId, $title, $description ) = @_; |
128 |
|
129 |
|
129 |
## Check for all neccessary parameters |
130 |
## Check for all neccessary parameters |
130 |
if ( ! $colId ) { |
131 |
if ( !$colId ) { |
131 |
return ( 0, 1, "No Id Given" ); |
132 |
return ( 0, 1, "No Id Given" ); |
132 |
} |
133 |
} |
133 |
if ( ! $title ) { |
134 |
if ( !$title ) { |
134 |
return ( 0, 2, "No Title Given" ); |
135 |
return ( 0, 2, "No Title Given" ); |
135 |
} |
136 |
} |
136 |
if ( ! $description ) { |
137 |
if ( !$description ) { |
137 |
return ( 0, 3, "No Description Given" ); |
138 |
return ( 0, 3, "No Description Given" ); |
138 |
} |
139 |
} |
139 |
|
140 |
|
140 |
my $dbh = C4::Context->dbh; |
141 |
my $dbh = C4::Context->dbh; |
141 |
|
142 |
|
142 |
my $sth; |
143 |
my $sth; |
143 |
$sth = $dbh->prepare("UPDATE collections |
144 |
$sth = $dbh->prepare(" |
144 |
SET |
145 |
UPDATE collections SET colTitle = ?, colDesc = ? WHERE colId = ? |
145 |
colTitle = ?, colDesc = ? |
146 |
"); |
146 |
WHERE colId = ?"); |
147 |
$sth->execute( $title, $description, $colId ) |
147 |
$sth->execute( $title, $description, $colId ) or return ( 0, 4, $sth->errstr() ); |
148 |
or return ( 0, 4, $sth->errstr() ); |
148 |
$sth->finish; |
149 |
$sth->finish; |
149 |
|
150 |
|
150 |
return 1; |
151 |
return 1; |
151 |
|
152 |
|
152 |
} |
153 |
} |
153 |
|
154 |
|
154 |
=head2 DeleteCollection |
155 |
=head2 DeleteCollection |
Lines 167-188
sub UpdateCollection {
Link Here
|
167 |
=cut |
168 |
=cut |
168 |
|
169 |
|
169 |
sub DeleteCollection { |
170 |
sub DeleteCollection { |
170 |
my ( $colId ) = @_; |
171 |
my ($colId) = @_; |
171 |
|
172 |
|
172 |
## Paramter check |
173 |
## Paramter check |
173 |
if ( ! $colId ) { |
174 |
if ( !$colId ) { |
174 |
return ( 0, 1, "No Collection Id Given" );; |
175 |
return ( 0, 1, "No Collection Id Given" ); |
175 |
} |
176 |
} |
176 |
|
|
|
177 |
my $dbh = C4::Context->dbh; |
178 |
|
177 |
|
179 |
my $sth; |
178 |
my $dbh = C4::Context->dbh; |
180 |
|
179 |
|
181 |
$sth = $dbh->prepare("DELETE FROM collections WHERE colId = ?"); |
180 |
my $sth; |
182 |
$sth->execute( $colId ) or return ( 0, 4, $sth->errstr() ); |
|
|
183 |
$sth->finish; |
184 |
|
181 |
|
185 |
return 1; |
182 |
$sth = $dbh->prepare("DELETE FROM collections WHERE colId = ?"); |
|
|
183 |
$sth->execute($colId) or return ( 0, 4, $sth->errstr() ); |
184 |
$sth->finish; |
185 |
|
186 |
return 1; |
186 |
} |
187 |
} |
187 |
|
188 |
|
188 |
=head2 GetCollections |
189 |
=head2 GetCollections |
Lines 201-219
sub DeleteCollection {
Link Here
|
201 |
|
202 |
|
202 |
sub GetCollections { |
203 |
sub GetCollections { |
203 |
|
204 |
|
204 |
my $dbh = C4::Context->dbh; |
205 |
my $dbh = C4::Context->dbh; |
205 |
|
206 |
|
206 |
my $sth = $dbh->prepare("SELECT * FROM collections"); |
207 |
my $sth = $dbh->prepare("SELECT * FROM collections"); |
207 |
$sth->execute() or return ( 1, $sth->errstr() ); |
208 |
$sth->execute() or return ( 1, $sth->errstr() ); |
208 |
|
209 |
|
209 |
my @results; |
210 |
my @results; |
210 |
while ( my $row = $sth->fetchrow_hashref ) { |
211 |
while ( my $row = $sth->fetchrow_hashref ) { |
211 |
push( @results , $row ); |
212 |
push( @results, $row ); |
212 |
} |
213 |
} |
213 |
|
214 |
|
214 |
$sth->finish; |
215 |
$sth->finish; |
215 |
|
216 |
|
216 |
return \@results; |
217 |
return \@results; |
217 |
} |
218 |
} |
218 |
|
219 |
|
219 |
=head2 GetItemsInCollection |
220 |
=head2 GetItemsInCollection |
Lines 234-267
sub GetCollections {
Link Here
|
234 |
=cut |
235 |
=cut |
235 |
|
236 |
|
236 |
sub GetItemsInCollection { |
237 |
sub GetItemsInCollection { |
237 |
my ( $colId ) = @_; |
238 |
my ($colId) = @_; |
238 |
|
239 |
|
239 |
## Paramter check |
240 |
## Paramter check |
240 |
if ( ! $colId ) { |
241 |
if ( !$colId ) { |
241 |
return ( 0, 0, 1, "No Collection Id Given" );; |
242 |
return ( 0, 0, 1, "No Collection Id Given" ); |
242 |
} |
243 |
} |
243 |
|
244 |
|
244 |
my $dbh = C4::Context->dbh; |
245 |
my $dbh = C4::Context->dbh; |
245 |
|
246 |
|
246 |
my $sth = $dbh->prepare("SELECT |
247 |
my $sth = $dbh->prepare(" |
247 |
biblio.title, |
248 |
SELECT |
248 |
items.itemcallnumber, |
249 |
biblio.title, |
249 |
items.barcode |
250 |
items.itemcallnumber, |
250 |
FROM collections, collections_tracking, items, biblio |
251 |
items.barcode |
251 |
WHERE collections.colId = collections_tracking.colId |
252 |
FROM |
252 |
AND collections_tracking.itemnumber = items.itemnumber |
253 |
collections, |
253 |
AND items.biblionumber = biblio.biblionumber |
254 |
collections_tracking, |
254 |
AND collections.colId = ? ORDER BY biblio.title"); |
255 |
items, biblio |
255 |
$sth->execute( $colId ) or return ( 0, 0, 2, $sth->errstr() ); |
256 |
WHERE collections.colId = collections_tracking.colId |
256 |
|
257 |
AND collections_tracking.itemnumber = items.itemnumber |
257 |
my @results; |
258 |
AND items.biblionumber = biblio.biblionumber |
258 |
while ( my $row = $sth->fetchrow_hashref ) { |
259 |
AND collections.colId = ? ORDER BY biblio.title |
259 |
push( @results , $row ); |
260 |
"); |
260 |
} |
261 |
$sth->execute($colId) or return ( 0, 0, 2, $sth->errstr() ); |
261 |
|
262 |
|
262 |
$sth->finish; |
263 |
my @results; |
263 |
|
264 |
while ( my $row = $sth->fetchrow_hashref ) { |
264 |
return \@results; |
265 |
push( @results, $row ); |
|
|
266 |
} |
267 |
|
268 |
$sth->finish; |
269 |
|
270 |
return \@results; |
265 |
} |
271 |
} |
266 |
|
272 |
|
267 |
=head2 GetCollection |
273 |
=head2 GetCollection |
Lines 278-302
Returns information about a collection
Link Here
|
278 |
=cut |
284 |
=cut |
279 |
|
285 |
|
280 |
sub GetCollection { |
286 |
sub GetCollection { |
281 |
my ( $colId ) = @_; |
287 |
my ($colId) = @_; |
282 |
|
288 |
|
283 |
my $dbh = C4::Context->dbh; |
289 |
my $dbh = C4::Context->dbh; |
284 |
|
290 |
|
285 |
my ( $sth, @results ); |
291 |
my ( $sth, @results ); |
286 |
$sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?"); |
292 |
$sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?"); |
287 |
$sth->execute( $colId ) or return 0; |
293 |
$sth->execute($colId) or return 0; |
288 |
|
294 |
|
289 |
my $row = $sth->fetchrow_hashref; |
295 |
my $row = $sth->fetchrow_hashref; |
290 |
|
296 |
|
291 |
$sth->finish; |
297 |
$sth->finish; |
292 |
|
298 |
|
293 |
return ( |
299 |
return ( |
294 |
$$row{'colId'}, |
300 |
$$row{'colId'}, $$row{'colTitle'}, |
295 |
$$row{'colTitle'}, |
301 |
$$row{'colDesc'}, $$row{'colBranchcode'} |
296 |
$$row{'colDesc'}, |
302 |
); |
297 |
$$row{'colBranchcode'} |
303 |
|
298 |
); |
|
|
299 |
|
300 |
} |
304 |
} |
301 |
|
305 |
|
302 |
=head2 AddItemToCollection |
306 |
=head2 AddItemToCollection |
Lines 316-347
Adds an item to a rotating collection.
Link Here
|
316 |
=cut |
320 |
=cut |
317 |
|
321 |
|
318 |
sub AddItemToCollection { |
322 |
sub AddItemToCollection { |
319 |
my ( $colId, $itemnumber ) = @_; |
323 |
my ( $colId, $itemnumber ) = @_; |
320 |
|
324 |
|
321 |
## Check for all neccessary parameters |
325 |
## Check for all neccessary parameters |
322 |
if ( ! $colId ) { |
326 |
if ( !$colId ) { |
323 |
return ( 0, 1, "No Collection Given" ); |
327 |
return ( 0, 1, "No Collection Given" ); |
324 |
} |
328 |
} |
325 |
if ( ! $itemnumber ) { |
329 |
if ( !$itemnumber ) { |
326 |
return ( 0, 2, "No Itemnumber Given" ); |
330 |
return ( 0, 2, "No Itemnumber Given" ); |
327 |
} |
331 |
} |
328 |
|
332 |
|
329 |
if ( isItemInThisCollection( $itemnumber, $colId ) ) { |
333 |
if ( isItemInThisCollection( $itemnumber, $colId ) ) { |
330 |
return ( 0, 2, "Item is already in the collection!" ); |
334 |
return ( 0, 2, "Item is already in the collection!" ); |
331 |
} elsif ( isItemInAnyCollection( $itemnumber ) ) { |
335 |
} |
332 |
return ( 0, 3, "Item is already in a different collection!" ); |
336 |
elsif ( isItemInAnyCollection($itemnumber) ) { |
333 |
} |
337 |
return ( 0, 3, "Item is already in a different collection!" ); |
334 |
|
338 |
} |
335 |
my $dbh = C4::Context->dbh; |
339 |
|
336 |
|
340 |
my $dbh = C4::Context->dbh; |
337 |
my $sth; |
341 |
|
338 |
$sth = $dbh->prepare("INSERT INTO collections_tracking ( ctId, colId, itemnumber ) |
342 |
my $sth; |
339 |
VALUES ( NULL, ?, ? )"); |
343 |
$sth = $dbh->prepare(" |
340 |
$sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() ); |
344 |
INSERT INTO collections_tracking ( |
341 |
$sth->finish; |
345 |
ctId, |
342 |
|
346 |
colId, i |
343 |
return 1; |
347 |
temnumber |
344 |
|
348 |
) VALUES ( NULL, ?, ? ) |
|
|
349 |
"); |
350 |
$sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() ); |
351 |
$sth->finish; |
352 |
|
353 |
return 1; |
354 |
|
345 |
} |
355 |
} |
346 |
|
356 |
|
347 |
=head2 RemoveItemFromCollection |
357 |
=head2 RemoveItemFromCollection |
Lines 362-387
Removes an item to a collection
Link Here
|
362 |
=cut |
372 |
=cut |
363 |
|
373 |
|
364 |
sub RemoveItemFromCollection { |
374 |
sub RemoveItemFromCollection { |
365 |
my ( $colId, $itemnumber ) = @_; |
375 |
my ( $colId, $itemnumber ) = @_; |
366 |
|
376 |
|
367 |
## Check for all neccessary parameters |
377 |
## Check for all neccessary parameters |
368 |
if ( ! $itemnumber ) { |
378 |
if ( !$itemnumber ) { |
369 |
return ( 0, 2, "No Itemnumber Given" ); |
379 |
return ( 0, 2, "No Itemnumber Given" ); |
370 |
} |
380 |
} |
371 |
|
381 |
|
372 |
if ( ! isItemInThisCollection( $itemnumber, $colId ) ) { |
382 |
if ( !isItemInThisCollection( $itemnumber, $colId ) ) { |
373 |
return ( 0, 2, "Item is not in the collection!" ); |
383 |
return ( 0, 2, "Item is not in the collection!" ); |
374 |
} |
384 |
} |
375 |
|
385 |
|
376 |
my $dbh = C4::Context->dbh; |
386 |
my $dbh = C4::Context->dbh; |
377 |
|
387 |
|
378 |
my $sth; |
388 |
my $sth; |
379 |
$sth = $dbh->prepare("DELETE FROM collections_tracking |
389 |
$sth = $dbh->prepare("DELETE FROM collections_tracking WHERE itemnumber = ?"); |
380 |
WHERE itemnumber = ?"); |
390 |
$sth->execute($itemnumber) or return ( 0, 3, $sth->errstr() ); |
381 |
$sth->execute( $itemnumber ) or return ( 0, 3, $sth->errstr() ); |
391 |
$sth->finish; |
382 |
$sth->finish; |
392 |
|
383 |
|
393 |
return 1; |
384 |
return 1; |
|
|
385 |
} |
394 |
} |
386 |
|
395 |
|
387 |
=head2 TransferCollection |
396 |
=head2 TransferCollection |
Lines 402-440
Transfers a collection to another branch
Link Here
|
402 |
=cut |
411 |
=cut |
403 |
|
412 |
|
404 |
sub TransferCollection { |
413 |
sub TransferCollection { |
405 |
my ( $colId, $colBranchcode ) = @_; |
414 |
my ( $colId, $colBranchcode ) = @_; |
406 |
|
415 |
|
407 |
## Check for all neccessary parameters |
416 |
## Check for all neccessary parameters |
408 |
if ( ! $colId ) { |
417 |
if ( !$colId ) { |
409 |
return ( 0, 1, "No Id Given" ); |
418 |
return ( 0, 1, "No Id Given" ); |
410 |
} |
419 |
} |
411 |
if ( ! $colBranchcode ) { |
420 |
if ( !$colBranchcode ) { |
412 |
return ( 0, 2, "No Branchcode Given" ); |
421 |
return ( 0, 2, "No Branchcode Given" ); |
413 |
} |
422 |
} |
414 |
|
423 |
|
415 |
my $dbh = C4::Context->dbh; |
424 |
my $dbh = C4::Context->dbh; |
416 |
|
425 |
|
417 |
my $sth; |
426 |
my $sth; |
418 |
$sth = $dbh->prepare("UPDATE collections |
427 |
$sth = $dbh->prepare("UPDATE collections SET colBranchcode = ? WHERE colId = ?"); |
419 |
SET |
428 |
$sth->execute( $colBranchcode, $colId ) or return ( 0, 4, $sth->errstr() ); |
420 |
colBranchcode = ? |
429 |
$sth->finish; |
421 |
WHERE colId = ?"); |
430 |
|
422 |
$sth->execute( $colBranchcode, $colId ) or return ( 0, 4, $sth->errstr() ); |
431 |
$sth = $dbh->prepare(" |
423 |
$sth->finish; |
432 |
SELECT barcode |
424 |
|
433 |
FROM |
425 |
$sth = $dbh->prepare("SELECT barcode FROM items, collections_tracking |
434 |
items, |
426 |
WHERE items.itemnumber = collections_tracking.itemnumber |
435 |
collections_tracking |
427 |
AND collections_tracking.colId = ?"); |
436 |
WHERE items.itemnumber = collections_tracking.itemnumber |
428 |
$sth->execute( $colId ) or return ( 0, 4, $sth->errstr ); |
437 |
AND collections_tracking.colId = ? |
429 |
my @results; |
438 |
"); |
430 |
while ( my $item = $sth->fetchrow_hashref ) { |
439 |
$sth->execute($colId) or return ( 0, 4, $sth->errstr ); |
431 |
my ( $dotransfer, $messages, $iteminformation ) = transferbook( $colBranchcode, $item->{'barcode'}, my $ignore_reserves = 1); |
440 |
my @results; |
432 |
} |
441 |
while ( my $item = $sth->fetchrow_hashref ) { |
433 |
|
442 |
my ( $dotransfer, $messages, $iteminformation ) = |
434 |
|
443 |
transferbook( $colBranchcode, $item->{'barcode'}, |
435 |
|
444 |
my $ignore_reserves = 1 ); |
436 |
return 1; |
445 |
} |
437 |
|
446 |
|
|
|
447 |
return 1; |
448 |
|
438 |
} |
449 |
} |
439 |
|
450 |
|
440 |
=head2 GetCollectionItemBranches |
451 |
=head2 GetCollectionItemBranches |
Lines 444-472
sub TransferCollection {
Link Here
|
444 |
=cut |
455 |
=cut |
445 |
|
456 |
|
446 |
sub GetCollectionItemBranches { |
457 |
sub GetCollectionItemBranches { |
447 |
my ( $itemnumber ) = @_; |
458 |
my ($itemnumber) = @_; |
448 |
|
459 |
|
449 |
if ( ! $itemnumber ) { |
460 |
if ( !$itemnumber ) { |
450 |
return; |
461 |
return; |
451 |
} |
462 |
} |
452 |
|
463 |
|
453 |
my $dbh = C4::Context->dbh; |
464 |
my $dbh = C4::Context->dbh; |
454 |
|
465 |
|
455 |
my ( $sth, @results ); |
466 |
my ( $sth, @results ); |
456 |
$sth = $dbh->prepare("SELECT holdingbranch, colBranchcode FROM items, collections, collections_tracking |
467 |
$sth = $dbh->prepare(" |
457 |
WHERE items.itemnumber = collections_tracking.itemnumber |
468 |
SELECT |
458 |
AND collections.colId = collections_tracking.colId |
469 |
holdingbranch, |
459 |
AND items.itemnumber = ?"); |
470 |
colBranchcode |
460 |
$sth->execute( $itemnumber ); |
471 |
FROM |
461 |
|
472 |
items, |
462 |
my $row = $sth->fetchrow_hashref; |
473 |
collections, |
463 |
|
474 |
collections_tracking |
464 |
$sth->finish; |
475 |
WHERE items.itemnumber = collections_tracking.itemnumber |
465 |
|
476 |
AND collections.colId = collections_tracking.colId |
466 |
return ( |
477 |
AND items.itemnumber = ? |
467 |
$$row{'holdingbranch'}, |
478 |
"); |
468 |
$$row{'colBranchcode'}, |
479 |
$sth->execute($itemnumber); |
469 |
); |
480 |
|
|
|
481 |
my $row = $sth->fetchrow_hashref; |
482 |
|
483 |
$sth->finish; |
484 |
|
485 |
return ( $$row{'holdingbranch'}, $$row{'colBranchcode'}, ); |
470 |
} |
486 |
} |
471 |
|
487 |
|
472 |
=head2 isItemInThisCollection |
488 |
=head2 isItemInThisCollection |
Lines 476-491
sub GetCollectionItemBranches {
Link Here
|
476 |
=cut |
492 |
=cut |
477 |
|
493 |
|
478 |
sub isItemInThisCollection { |
494 |
sub isItemInThisCollection { |
479 |
my ( $itemnumber, $colId ) = @_; |
495 |
my ( $itemnumber, $colId ) = @_; |
480 |
|
496 |
|
481 |
my $dbh = C4::Context->dbh; |
497 |
my $dbh = C4::Context->dbh; |
482 |
|
498 |
|
483 |
my $sth = $dbh->prepare("SELECT COUNT(*) as inCollection FROM collections_tracking WHERE itemnumber = ? AND colId = ?"); |
499 |
my $sth = $dbh->prepare(" |
484 |
$sth->execute( $itemnumber, $colId ) or return( 0 ); |
500 |
SELECT COUNT(*) as inCollection FROM collections_tracking WHERE itemnumber = ? AND colId = ? |
485 |
|
501 |
"); |
486 |
my $row = $sth->fetchrow_hashref; |
502 |
$sth->execute( $itemnumber, $colId ) or return (0); |
487 |
|
503 |
|
488 |
return $$row{'inCollection'}; |
504 |
my $row = $sth->fetchrow_hashref; |
|
|
505 |
|
506 |
return $$row{'inCollection'}; |
489 |
} |
507 |
} |
490 |
|
508 |
|
491 |
=head2 isItemInAnyCollection |
509 |
=head2 isItemInAnyCollection |
Lines 495-517
$inCollection = isItemInAnyCollection( $itemnumber );
Link Here
|
495 |
=cut |
513 |
=cut |
496 |
|
514 |
|
497 |
sub isItemInAnyCollection { |
515 |
sub isItemInAnyCollection { |
498 |
my ( $itemnumber ) = @_; |
516 |
my ($itemnumber) = @_; |
499 |
|
517 |
|
500 |
my $dbh = C4::Context->dbh; |
518 |
my $dbh = C4::Context->dbh; |
501 |
|
519 |
|
502 |
my $sth = $dbh->prepare("SELECT itemnumber FROM collections_tracking WHERE itemnumber = ?"); |
520 |
my $sth = $dbh->prepare(" |
503 |
$sth->execute( $itemnumber ) or return( 0 ); |
521 |
SELECT itemnumber FROM collections_tracking WHERE itemnumber = ? |
504 |
|
522 |
"); |
505 |
my $row = $sth->fetchrow_hashref; |
523 |
$sth->execute($itemnumber) or return (0); |
506 |
|
524 |
|
507 |
$itemnumber = $row->{itemnumber}; |
525 |
my $row = $sth->fetchrow_hashref; |
508 |
$sth->finish; |
526 |
|
509 |
|
527 |
$itemnumber = $row->{itemnumber}; |
510 |
if ( $itemnumber ) { |
528 |
$sth->finish; |
511 |
return 1; |
529 |
|
512 |
} else { |
530 |
if ($itemnumber) { |
513 |
return 0; |
531 |
return 1; |
514 |
} |
532 |
} |
|
|
533 |
else { |
534 |
return 0; |
535 |
} |
515 |
} |
536 |
} |
516 |
|
537 |
|
517 |
1; |
538 |
1; |