Lines 1293-1298
sub GetItemsInfo {
Link Here
|
1293 |
biblioitems.lccn, |
1293 |
biblioitems.lccn, |
1294 |
biblioitems.url, |
1294 |
biblioitems.url, |
1295 |
items.notforloan as itemnotforloan, |
1295 |
items.notforloan as itemnotforloan, |
|
|
1296 |
issues.borrowernumber, |
1297 |
issues.date_due as datedue, |
1298 |
borrowers.cardnumber, |
1299 |
borrowers.surname, |
1300 |
borrowers.firstname, |
1301 |
borrowers.branchcode as bcode, |
1302 |
serial.serialseq, |
1303 |
serial.publisheddate, |
1296 |
itemtypes.description, |
1304 |
itemtypes.description, |
1297 |
itemtypes.notforloan as notforloan_per_itemtype, |
1305 |
itemtypes.notforloan as notforloan_per_itemtype, |
1298 |
holding.branchurl, |
1306 |
holding.branchurl, |
Lines 1304-1309
sub GetItemsInfo {
Link Here
|
1304 |
LEFT JOIN branches AS home ON items.homebranch=home.branchcode |
1312 |
LEFT JOIN branches AS home ON items.homebranch=home.branchcode |
1305 |
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber |
1313 |
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber |
1306 |
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber |
1314 |
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber |
|
|
1315 |
LEFT JOIN issues USING (itemnumber) |
1316 |
LEFT JOIN borrowers USING (borrowernumber) |
1317 |
LEFT JOIN serialitems USING (itemnumber) |
1318 |
LEFT JOIN serial USING (serialid) |
1307 |
LEFT JOIN itemtypes ON itemtypes.itemtype = " |
1319 |
LEFT JOIN itemtypes ON itemtypes.itemtype = " |
1308 |
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); |
1320 |
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); |
1309 |
$query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; |
1321 |
$query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; |
Lines 1313-1356
sub GetItemsInfo {
Link Here
|
1313 |
my @results; |
1325 |
my @results; |
1314 |
my $serial; |
1326 |
my $serial; |
1315 |
|
1327 |
|
1316 |
my $isth = $dbh->prepare( |
1328 |
my $userenv = C4::Context->userenv; |
1317 |
"SELECT issues.*,borrowers.cardnumber,borrowers.surname,borrowers.firstname,borrowers.branchcode as bcode |
1329 |
my $want_not_same_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian(); |
1318 |
FROM issues LEFT JOIN borrowers ON issues.borrowernumber=borrowers.borrowernumber |
1330 |
while ( my $data = $sth->fetchrow_hashref ) { |
1319 |
WHERE itemnumber = ?" |
1331 |
if ( $data->{borrowernumber} && $want_not_same_branch) { |
1320 |
); |
1332 |
$data->{'NOTSAMEBRANCH'} = $data->{'bcode'} ne $userenv->{branch}; |
1321 |
my $ssth = $dbh->prepare("SELECT serialseq,publisheddate from serialitems left join serial on serialitems.serialid=serial.serialid where serialitems.itemnumber=? "); |
|
|
1322 |
while ( my $data = $sth->fetchrow_hashref ) { |
1323 |
my $datedue = ''; |
1324 |
$isth->execute( $data->{'itemnumber'} ); |
1325 |
if ( my $idata = $isth->fetchrow_hashref ) { |
1326 |
$data->{borrowernumber} = $idata->{borrowernumber}; |
1327 |
$data->{cardnumber} = $idata->{cardnumber}; |
1328 |
$data->{surname} = $idata->{surname}; |
1329 |
$data->{firstname} = $idata->{firstname}; |
1330 |
$data->{lastreneweddate} = $idata->{lastreneweddate}; |
1331 |
$datedue = $idata->{'date_due'}; |
1332 |
if (C4::Context->preference("IndependentBranches")){ |
1333 |
my $userenv = C4::Context->userenv; |
1334 |
unless ( C4::Context->IsSuperLibrarian() ) { |
1335 |
$data->{'NOTSAMEBRANCH'} = 1 if ($idata->{'bcode'} ne $userenv->{branch}); |
1336 |
} |
1333 |
} |
1337 |
} |
1334 |
|
1338 |
} |
1335 |
$serial ||= $data->{'serial'}; |
1339 |
if ( $data->{'serial'}) { |
|
|
1340 |
$ssth->execute($data->{'itemnumber'}) ; |
1341 |
($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array(); |
1342 |
$serial = 1; |
1343 |
} |
1344 |
#get branch information..... |
1345 |
my $bsth = $dbh->prepare( |
1346 |
"SELECT * FROM branches WHERE branchcode = ? |
1347 |
" |
1348 |
); |
1349 |
$bsth->execute( $data->{'holdingbranch'} ); |
1350 |
if ( my $bdata = $bsth->fetchrow_hashref ) { |
1351 |
$data->{'branchname'} = $bdata->{'branchname'}; |
1352 |
} |
1353 |
$data->{'datedue'} = $datedue; |
1354 |
|
1336 |
|
1355 |
# get notforloan complete status if applicable |
1337 |
# get notforloan complete status if applicable |
1356 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { |
1338 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { |
Lines 1368-1373
sub GetItemsInfo {
Link Here
|
1368 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { |
1350 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { |
1369 |
$data->{stack} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{stack} ); |
1351 |
$data->{stack} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{stack} ); |
1370 |
} |
1352 |
} |
|
|
1353 |
|
1371 |
# Find the last 3 people who borrowed this item. |
1354 |
# Find the last 3 people who borrowed this item. |
1372 |
my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers |
1355 |
my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers |
1373 |
WHERE itemnumber = ? |
1356 |
WHERE itemnumber = ? |
Lines 1386-1396
sub GetItemsInfo {
Link Here
|
1386 |
$results[$i] = $data; |
1369 |
$results[$i] = $data; |
1387 |
$i++; |
1370 |
$i++; |
1388 |
} |
1371 |
} |
1389 |
if($serial) { |
1372 |
|
1390 |
return( sort { ($b->{'publisheddate'} || $b->{'enumchron'}) cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results ); |
1373 |
return $serial |
1391 |
} else { |
1374 |
? sort { ($b->{'publisheddate'} || $b->{'enumchron'}) cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results |
1392 |
return (@results); |
1375 |
: @results; |
1393 |
} |
|
|
1394 |
} |
1376 |
} |
1395 |
|
1377 |
|
1396 |
=head2 GetItemsLocationInfo |
1378 |
=head2 GetItemsLocationInfo |
1397 |
- |
|
|