Lines 1266-1271
sub GetItemsInfo {
Link Here
|
1266 |
biblioitems.lccn, |
1266 |
biblioitems.lccn, |
1267 |
biblioitems.url, |
1267 |
biblioitems.url, |
1268 |
items.notforloan as itemnotforloan, |
1268 |
items.notforloan as itemnotforloan, |
|
|
1269 |
issues.borrowernumber, |
1270 |
issues.date_due as datedue, |
1271 |
borrowers.cardnumber, |
1272 |
borrowers.surname, |
1273 |
borrowers.firstname, |
1274 |
borrowers.branchcode as bcode, |
1275 |
serial.serialseq, |
1276 |
serial.publisheddate, |
1269 |
itemtypes.description, |
1277 |
itemtypes.description, |
1270 |
itemtypes.notforloan as notforloan_per_itemtype, |
1278 |
itemtypes.notforloan as notforloan_per_itemtype, |
1271 |
holding.branchurl, |
1279 |
holding.branchurl, |
Lines 1277-1282
sub GetItemsInfo {
Link Here
|
1277 |
LEFT JOIN branches AS home ON items.homebranch=home.branchcode |
1285 |
LEFT JOIN branches AS home ON items.homebranch=home.branchcode |
1278 |
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber |
1286 |
LEFT JOIN biblio ON biblio.biblionumber = items.biblionumber |
1279 |
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber |
1287 |
LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber |
|
|
1288 |
LEFT JOIN issues USING (itemnumber) |
1289 |
LEFT JOIN borrowers USING (borrowernumber) |
1290 |
LEFT JOIN serialitems USING (itemnumber) |
1291 |
LEFT JOIN serial USING (serialid) |
1280 |
LEFT JOIN itemtypes ON itemtypes.itemtype = " |
1292 |
LEFT JOIN itemtypes ON itemtypes.itemtype = " |
1281 |
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); |
1293 |
. (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); |
1282 |
$query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; |
1294 |
$query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; |
Lines 1286-1329
sub GetItemsInfo {
Link Here
|
1286 |
my @results; |
1298 |
my @results; |
1287 |
my $serial; |
1299 |
my $serial; |
1288 |
|
1300 |
|
1289 |
my $isth = $dbh->prepare( |
1301 |
my $userenv = C4::Context->userenv; |
1290 |
"SELECT issues.*,borrowers.cardnumber,borrowers.surname,borrowers.firstname,borrowers.branchcode as bcode |
1302 |
my $want_not_same_branch = C4::Context->preference("IndependentBranches") && !C4::Context->IsSuperLibrarian(); |
1291 |
FROM issues LEFT JOIN borrowers ON issues.borrowernumber=borrowers.borrowernumber |
1303 |
while ( my $data = $sth->fetchrow_hashref ) { |
1292 |
WHERE itemnumber = ?" |
1304 |
if ( $data->{borrowernumber} && $want_not_same_branch) { |
1293 |
); |
1305 |
$data->{'NOTSAMEBRANCH'} = $data->{'bcode'} ne $userenv->{branch}; |
1294 |
my $ssth = $dbh->prepare("SELECT serialseq,publisheddate from serialitems left join serial on serialitems.serialid=serial.serialid where serialitems.itemnumber=? "); |
|
|
1295 |
while ( my $data = $sth->fetchrow_hashref ) { |
1296 |
my $datedue = ''; |
1297 |
$isth->execute( $data->{'itemnumber'} ); |
1298 |
if ( my $idata = $isth->fetchrow_hashref ) { |
1299 |
$data->{borrowernumber} = $idata->{borrowernumber}; |
1300 |
$data->{cardnumber} = $idata->{cardnumber}; |
1301 |
$data->{surname} = $idata->{surname}; |
1302 |
$data->{firstname} = $idata->{firstname}; |
1303 |
$data->{lastreneweddate} = $idata->{lastreneweddate}; |
1304 |
$datedue = $idata->{'date_due'}; |
1305 |
if (C4::Context->preference("IndependentBranches")){ |
1306 |
my $userenv = C4::Context->userenv; |
1307 |
unless ( C4::Context->IsSuperLibrarian() ) { |
1308 |
$data->{'NOTSAMEBRANCH'} = 1 if ($idata->{'bcode'} ne $userenv->{branch}); |
1309 |
} |
1306 |
} |
1310 |
} |
1307 |
|
1311 |
} |
1308 |
$serial ||= $data->{'serial'}; |
1312 |
if ( $data->{'serial'}) { |
|
|
1313 |
$ssth->execute($data->{'itemnumber'}) ; |
1314 |
($data->{'serialseq'} , $data->{'publisheddate'}) = $ssth->fetchrow_array(); |
1315 |
$serial = 1; |
1316 |
} |
1317 |
#get branch information..... |
1318 |
my $bsth = $dbh->prepare( |
1319 |
"SELECT * FROM branches WHERE branchcode = ? |
1320 |
" |
1321 |
); |
1322 |
$bsth->execute( $data->{'holdingbranch'} ); |
1323 |
if ( my $bdata = $bsth->fetchrow_hashref ) { |
1324 |
$data->{'branchname'} = $bdata->{'branchname'}; |
1325 |
} |
1326 |
$data->{'datedue'} = $datedue; |
1327 |
|
1309 |
|
1328 |
# get notforloan complete status if applicable |
1310 |
# get notforloan complete status if applicable |
1329 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { |
1311 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.notforloan', $data->{frameworkcode} ) ) { |
Lines 1341-1346
sub GetItemsInfo {
Link Here
|
1341 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { |
1323 |
if ( my $code = C4::Koha::GetAuthValCode( 'items.stack', $data->{frameworkcode} ) ) { |
1342 |
$data->{stack} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{stack} ); |
1324 |
$data->{stack} = C4::Koha::GetKohaAuthorisedValueLib( $code, $data->{stack} ); |
1343 |
} |
1325 |
} |
|
|
1326 |
|
1344 |
# Find the last 3 people who borrowed this item. |
1327 |
# Find the last 3 people who borrowed this item. |
1345 |
my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers |
1328 |
my $sth2 = $dbh->prepare("SELECT * FROM old_issues,borrowers |
1346 |
WHERE itemnumber = ? |
1329 |
WHERE itemnumber = ? |
Lines 1359-1369
sub GetItemsInfo {
Link Here
|
1359 |
$results[$i] = $data; |
1342 |
$results[$i] = $data; |
1360 |
$i++; |
1343 |
$i++; |
1361 |
} |
1344 |
} |
1362 |
if($serial) { |
1345 |
|
1363 |
return( sort { ($b->{'publisheddate'} || $b->{'enumchron'}) cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results ); |
1346 |
return $serial |
1364 |
} else { |
1347 |
? sort { ($b->{'publisheddate'} || $b->{'enumchron'}) cmp ($a->{'publisheddate'} || $a->{'enumchron'}) } @results |
1365 |
return (@results); |
1348 |
: @results; |
1366 |
} |
|
|
1367 |
} |
1349 |
} |
1368 |
|
1350 |
|
1369 |
=head2 GetItemsLocationInfo |
1351 |
=head2 GetItemsLocationInfo |
1370 |
- |
|
|