|
Lines 135-151
sub GetSuppliersWithLateIssues {
Link Here
|
| 135 |
my $dbh = C4::Context->dbh; |
135 |
my $dbh = C4::Context->dbh; |
| 136 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
136 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
| 137 |
my $query = qq| |
137 |
my $query = qq| |
| 138 |
SELECT DISTINCT id, name |
138 |
SELECT DISTINCT aqbooksellers.id, aqbooksellers.name |
| 139 |
FROM subscription |
139 |
FROM aqbooksellers |
| 140 |
LEFT JOIN serial ON serial.subscriptionid=subscription.subscriptionid |
140 |
LEFT JOIN serial ON serial.aqbooksellerid = aqbooksellers.id |
| 141 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
141 |
LEFT JOIN subscription ON serial.subscriptionid = subscription.subscriptionid |
| 142 |
WHERE id > 0 |
142 |
WHERE ( |
| 143 |
AND ( |
143 |
(serial.planneddate < NOW() AND serial.status = 1) |
| 144 |
(planneddate < now() AND serial.status=1) |
144 |
OR serial.status IN ( $statuses ) |
| 145 |
OR serial.STATUS IN ( $statuses ) |
145 |
) |
| 146 |
) |
146 |
AND subscription.closed = 0 |
| 147 |
AND subscription.closed = 0 |
147 |
ORDER BY name |
| 148 |
ORDER BY name|; |
148 |
|; |
| 149 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
149 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
| 150 |
} |
150 |
} |
| 151 |
|
151 |
|
|
Lines 1325-1330
sub ModSubscription {
Link Here
|
| 1325 |
$itemtype, $previousitemtype, $mana_id, $ccode |
1325 |
$itemtype, $previousitemtype, $mana_id, $ccode |
| 1326 |
) = @_; |
1326 |
) = @_; |
| 1327 |
|
1327 |
|
|
|
1328 |
$aqbooksellerid ||= undef; |
| 1329 |
|
| 1328 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
1330 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
| 1329 |
$subscription->set( |
1331 |
$subscription->set( |
| 1330 |
{ |
1332 |
{ |
|
Lines 1407-1412
sub NewSubscription {
Link Here
|
| 1407 |
) = @_; |
1409 |
) = @_; |
| 1408 |
my $dbh = C4::Context->dbh; |
1410 |
my $dbh = C4::Context->dbh; |
| 1409 |
|
1411 |
|
|
|
1412 |
$aqbooksellerid ||= undef; |
| 1413 |
|
| 1410 |
my $subscription = Koha::Subscription->new( |
1414 |
my $subscription = Koha::Subscription->new( |
| 1411 |
{ |
1415 |
{ |
| 1412 |
librarian => $auser, |
1416 |
librarian => $auser, |
|
Lines 1486-1491
sub NewSubscription {
Link Here
|
| 1486 |
serialseq_y => $subscription->{'lastvalue2'}, |
1490 |
serialseq_y => $subscription->{'lastvalue2'}, |
| 1487 |
serialseq_z => $subscription->{'lastvalue3'}, |
1491 |
serialseq_z => $subscription->{'lastvalue3'}, |
| 1488 |
subscriptionid => $subscriptionid, |
1492 |
subscriptionid => $subscriptionid, |
|
|
1493 |
aqbooksellerid => $subscription->{aqbooksellerid}, |
| 1489 |
biblionumber => $biblionumber, |
1494 |
biblionumber => $biblionumber, |
| 1490 |
status => EXPECTED, |
1495 |
status => EXPECTED, |
| 1491 |
planneddate => $firstacquidate, |
1496 |
planneddate => $firstacquidate, |
|
Lines 1629-1634
sub NewIssue {
Link Here
|
| 1629 |
serialseq_y => $subscription->lastvalue2(), |
1634 |
serialseq_y => $subscription->lastvalue2(), |
| 1630 |
serialseq_z => $subscription->lastvalue3(), |
1635 |
serialseq_z => $subscription->lastvalue3(), |
| 1631 |
subscriptionid => $subscriptionid, |
1636 |
subscriptionid => $subscriptionid, |
|
|
1637 |
aqbooksellerid => $subscription->aqbooksellerid(), |
| 1632 |
biblionumber => $biblionumber, |
1638 |
biblionumber => $biblionumber, |
| 1633 |
status => $status, |
1639 |
status => $status, |
| 1634 |
planneddate => $planneddate, |
1640 |
planneddate => $planneddate, |
|
Lines 1854-1860
sub GetLateOrMissingIssues {
Link Here
|
| 1854 |
my $sth; |
1860 |
my $sth; |
| 1855 |
my $byserial = ''; |
1861 |
my $byserial = ''; |
| 1856 |
if ($serialid) { |
1862 |
if ($serialid) { |
| 1857 |
$byserial = "and serialid = " . $serialid; |
1863 |
$byserial = "and s.serialid = " . $serialid; |
| 1858 |
} |
1864 |
} |
| 1859 |
if ($order) { |
1865 |
if ($order) { |
| 1860 |
$order .= ", title"; |
1866 |
$order .= ", title"; |
|
Lines 1863-1901
sub GetLateOrMissingIssues {
Link Here
|
| 1863 |
} |
1869 |
} |
| 1864 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
1870 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
| 1865 |
if ($supplierid) { |
1871 |
if ($supplierid) { |
| 1866 |
$sth = $dbh->prepare( |
1872 |
$sth = $dbh->prepare(qq{ |
| 1867 |
"SELECT |
1873 |
SELECT |
| 1868 |
serialid, aqbooksellerid, name, |
1874 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
| 1869 |
biblio.title, biblioitems.issn, planneddate, serialseq, |
1875 |
biblio.title, biblioitems.issn, s.planneddate, s.serialseq, |
| 1870 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1876 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
| 1871 |
subscription.branchcode, serial.publisheddate |
1877 |
subscription.branchcode, s.publisheddate |
| 1872 |
FROM serial |
1878 |
FROM serial s |
| 1873 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1879 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
| 1874 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1880 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
| 1875 |
LEFT JOIN biblioitems ON subscription.biblionumber=biblioitems.biblionumber |
1881 |
LEFT JOIN biblioitems ON subscription.biblionumber = biblioitems.biblionumber |
| 1876 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1882 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
| 1877 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1883 |
WHERE |
| 1878 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1884 |
( |
| 1879 |
AND subscription.aqbooksellerid=$supplierid |
1885 |
s.status IN ($missing_statuses_string) |
| 1880 |
$byserial |
1886 |
OR ( |
| 1881 |
ORDER BY $order" |
1887 |
(s.planneddate < NOW() AND s.status = ?) |
| 1882 |
); |
1888 |
OR s.status = ? |
|
|
1889 |
OR s.status = ? |
| 1890 |
) |
| 1891 |
) |
| 1892 |
AND s.aqbooksellerid = $supplierid |
| 1893 |
$byserial |
| 1894 |
ORDER BY $order |
| 1895 |
}); |
| 1883 |
} else { |
1896 |
} else { |
| 1884 |
$sth = $dbh->prepare( |
1897 |
$sth = $dbh->prepare(qq{ |
| 1885 |
"SELECT |
1898 |
SELECT |
| 1886 |
serialid, aqbooksellerid, name, |
1899 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
| 1887 |
biblio.title, planneddate, serialseq, |
1900 |
biblio.title, s.planneddate, s.serialseq, |
| 1888 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1901 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
| 1889 |
subscription.branchcode, serial.publisheddate |
1902 |
subscription.branchcode, s.publisheddate |
| 1890 |
FROM serial |
1903 |
FROM serial s |
| 1891 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1904 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
| 1892 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1905 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
| 1893 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1906 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
| 1894 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1907 |
WHERE |
| 1895 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1908 |
( |
|
|
1909 |
s.status IN ($missing_statuses_string) |
| 1910 |
OR ( |
| 1911 |
(s.planneddate < now() AND s.status = ?) |
| 1912 |
OR s.status = ? |
| 1913 |
OR s.status = ? |
| 1914 |
) |
| 1915 |
) |
| 1896 |
$byserial |
1916 |
$byserial |
| 1897 |
ORDER BY $order" |
1917 |
ORDER BY $order |
| 1898 |
); |
1918 |
}); |
| 1899 |
} |
1919 |
} |
| 1900 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
1920 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
| 1901 |
my @issuelist; |
1921 |
my @issuelist; |