Lines 134-150
sub GetSuppliersWithLateIssues {
Link Here
|
134 |
my $dbh = C4::Context->dbh; |
134 |
my $dbh = C4::Context->dbh; |
135 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
135 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
136 |
my $query = qq| |
136 |
my $query = qq| |
137 |
SELECT DISTINCT id, name |
137 |
SELECT DISTINCT aqbooksellers.id, aqbooksellers.name |
138 |
FROM subscription |
138 |
FROM aqbooksellers |
139 |
LEFT JOIN serial ON serial.subscriptionid=subscription.subscriptionid |
139 |
LEFT JOIN serial ON serial.aqbooksellerid = aqbooksellers.id |
140 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
140 |
LEFT JOIN subscription ON serial.subscriptionid = subscription.subscriptionid |
141 |
WHERE id > 0 |
141 |
WHERE ( |
142 |
AND ( |
142 |
(serial.planneddate < NOW() AND serial.status = 1) |
143 |
(planneddate < now() AND serial.status=1) |
143 |
OR serial.status IN ( $statuses ) |
144 |
OR serial.STATUS IN ( $statuses ) |
144 |
) |
145 |
) |
145 |
AND subscription.closed = 0 |
146 |
AND subscription.closed = 0 |
146 |
ORDER BY name |
147 |
ORDER BY name|; |
147 |
|; |
148 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
148 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
149 |
} |
149 |
} |
150 |
|
150 |
|
Lines 1321-1326
sub ModSubscription {
Link Here
|
1321 |
$itemtype, $previousitemtype, $mana_id |
1321 |
$itemtype, $previousitemtype, $mana_id |
1322 |
) = @_; |
1322 |
) = @_; |
1323 |
|
1323 |
|
|
|
1324 |
$aqbooksellerid ||= undef; |
1325 |
|
1324 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
1326 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
1325 |
$subscription->set( |
1327 |
$subscription->set( |
1326 |
{ |
1328 |
{ |
Lines 1402-1407
sub NewSubscription {
Link Here
|
1402 |
) = @_; |
1404 |
) = @_; |
1403 |
my $dbh = C4::Context->dbh; |
1405 |
my $dbh = C4::Context->dbh; |
1404 |
|
1406 |
|
|
|
1407 |
$aqbooksellerid ||= undef; |
1408 |
|
1405 |
my $subscription = Koha::Subscription->new( |
1409 |
my $subscription = Koha::Subscription->new( |
1406 |
{ |
1410 |
{ |
1407 |
librarian => $auser, |
1411 |
librarian => $auser, |
Lines 1480-1485
sub NewSubscription {
Link Here
|
1480 |
serialseq_y => $subscription->{'lastvalue2'}, |
1484 |
serialseq_y => $subscription->{'lastvalue2'}, |
1481 |
serialseq_z => $subscription->{'lastvalue3'}, |
1485 |
serialseq_z => $subscription->{'lastvalue3'}, |
1482 |
subscriptionid => $subscriptionid, |
1486 |
subscriptionid => $subscriptionid, |
|
|
1487 |
aqbooksellerid => $subscription->{aqbooksellerid}, |
1483 |
biblionumber => $biblionumber, |
1488 |
biblionumber => $biblionumber, |
1484 |
status => EXPECTED, |
1489 |
status => EXPECTED, |
1485 |
planneddate => $firstacquidate, |
1490 |
planneddate => $firstacquidate, |
Lines 1623-1628
sub NewIssue {
Link Here
|
1623 |
serialseq_y => $subscription->lastvalue2(), |
1628 |
serialseq_y => $subscription->lastvalue2(), |
1624 |
serialseq_z => $subscription->lastvalue3(), |
1629 |
serialseq_z => $subscription->lastvalue3(), |
1625 |
subscriptionid => $subscriptionid, |
1630 |
subscriptionid => $subscriptionid, |
|
|
1631 |
aqbooksellerid => $subscription->aqbooksellerid(), |
1626 |
biblionumber => $biblionumber, |
1632 |
biblionumber => $biblionumber, |
1627 |
status => $status, |
1633 |
status => $status, |
1628 |
planneddate => $planneddate, |
1634 |
planneddate => $planneddate, |
Lines 1848-1854
sub GetLateOrMissingIssues {
Link Here
|
1848 |
my $sth; |
1854 |
my $sth; |
1849 |
my $byserial = ''; |
1855 |
my $byserial = ''; |
1850 |
if ($serialid) { |
1856 |
if ($serialid) { |
1851 |
$byserial = "and serialid = " . $serialid; |
1857 |
$byserial = "and s.serialid = " . $serialid; |
1852 |
} |
1858 |
} |
1853 |
if ($order) { |
1859 |
if ($order) { |
1854 |
$order .= ", title"; |
1860 |
$order .= ", title"; |
Lines 1857-1895
sub GetLateOrMissingIssues {
Link Here
|
1857 |
} |
1863 |
} |
1858 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
1864 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
1859 |
if ($supplierid) { |
1865 |
if ($supplierid) { |
1860 |
$sth = $dbh->prepare( |
1866 |
$sth = $dbh->prepare(qq{ |
1861 |
"SELECT |
1867 |
SELECT |
1862 |
serialid, aqbooksellerid, name, |
1868 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
1863 |
biblio.title, biblioitems.issn, planneddate, serialseq, |
1869 |
biblio.title, biblioitems.issn, s.planneddate, s.serialseq, |
1864 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1870 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
1865 |
subscription.branchcode |
1871 |
subscription.branchcode |
1866 |
FROM serial |
1872 |
FROM serial s |
1867 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1873 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
1868 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1874 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
1869 |
LEFT JOIN biblioitems ON subscription.biblionumber=biblioitems.biblionumber |
1875 |
LEFT JOIN biblioitems ON subscription.biblionumber = biblioitems.biblionumber |
1870 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1876 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
1871 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1877 |
WHERE |
1872 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1878 |
( |
1873 |
AND subscription.aqbooksellerid=$supplierid |
1879 |
s.status IN ($missing_statuses_string) |
1874 |
$byserial |
1880 |
OR ( |
1875 |
ORDER BY $order" |
1881 |
(s.planneddate < NOW() AND s.status = ?) |
1876 |
); |
1882 |
OR s.status = ? |
|
|
1883 |
OR s.status = ? |
1884 |
) |
1885 |
) |
1886 |
AND s.aqbooksellerid = $supplierid |
1887 |
$byserial |
1888 |
ORDER BY $order |
1889 |
}); |
1877 |
} else { |
1890 |
} else { |
1878 |
$sth = $dbh->prepare( |
1891 |
$sth = $dbh->prepare(qq{ |
1879 |
"SELECT |
1892 |
SELECT |
1880 |
serialid, aqbooksellerid, name, |
1893 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
1881 |
biblio.title, planneddate, serialseq, |
1894 |
biblio.title, s.planneddate, s.serialseq, |
1882 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1895 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
1883 |
subscription.branchcode |
1896 |
subscription.branchcode |
1884 |
FROM serial |
1897 |
FROM serial s |
1885 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1898 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
1886 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1899 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
1887 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1900 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
1888 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1901 |
WHERE |
1889 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1902 |
( |
|
|
1903 |
s.status IN ($missing_statuses_string) |
1904 |
OR ( |
1905 |
(s.planneddate < now() AND s.status = ?) |
1906 |
OR s.status = ? |
1907 |
OR s.status = ? |
1908 |
) |
1909 |
) |
1890 |
$byserial |
1910 |
$byserial |
1891 |
ORDER BY $order" |
1911 |
ORDER BY $order |
1892 |
); |
1912 |
}); |
1893 |
} |
1913 |
} |
1894 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
1914 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
1895 |
my @issuelist; |
1915 |
my @issuelist; |