Lines 122-138
sub GetSuppliersWithLateIssues {
Link Here
|
122 |
my $dbh = C4::Context->dbh; |
122 |
my $dbh = C4::Context->dbh; |
123 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
123 |
my $statuses = join(',', ( LATE, MISSING_STATUSES, CLAIMED ) ); |
124 |
my $query = qq| |
124 |
my $query = qq| |
125 |
SELECT DISTINCT id, name |
125 |
SELECT DISTINCT aqbooksellers.id, aqbooksellers.name |
126 |
FROM subscription |
126 |
FROM aqbooksellers |
127 |
LEFT JOIN serial ON serial.subscriptionid=subscription.subscriptionid |
127 |
LEFT JOIN serial ON serial.aqbooksellerid = aqbooksellers.id |
128 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
128 |
LEFT JOIN subscription ON serial.subscriptionid = subscription.subscriptionid |
129 |
WHERE id > 0 |
129 |
WHERE ( |
130 |
AND ( |
130 |
(serial.planneddate < NOW() AND serial.status = 1) |
131 |
(planneddate < now() AND serial.status=1) |
131 |
OR serial.status IN ( $statuses ) |
132 |
OR serial.STATUS IN ( $statuses ) |
132 |
) |
133 |
) |
133 |
AND subscription.closed = 0 |
134 |
AND subscription.closed = 0 |
134 |
ORDER BY name |
135 |
ORDER BY name|; |
135 |
|; |
136 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
136 |
return $dbh->selectall_arrayref($query, { Slice => {} }); |
137 |
} |
137 |
} |
138 |
|
138 |
|
Lines 1473-1478
sub NewSubscription {
Link Here
|
1473 |
serialseq_y => $subscription->{'lastvalue2'}, |
1473 |
serialseq_y => $subscription->{'lastvalue2'}, |
1474 |
serialseq_z => $subscription->{'lastvalue3'}, |
1474 |
serialseq_z => $subscription->{'lastvalue3'}, |
1475 |
subscriptionid => $subscriptionid, |
1475 |
subscriptionid => $subscriptionid, |
|
|
1476 |
aqbooksellerid => $subscription->{aqbooksellerid}, |
1476 |
biblionumber => $biblionumber, |
1477 |
biblionumber => $biblionumber, |
1477 |
status => EXPECTED, |
1478 |
status => EXPECTED, |
1478 |
planneddate => $firstacquidate, |
1479 |
planneddate => $firstacquidate, |
Lines 1580-1585
sub NewIssue {
Link Here
|
1580 |
serialseq_y => $subscription->lastvalue2(), |
1581 |
serialseq_y => $subscription->lastvalue2(), |
1581 |
serialseq_z => $subscription->lastvalue3(), |
1582 |
serialseq_z => $subscription->lastvalue3(), |
1582 |
subscriptionid => $subscriptionid, |
1583 |
subscriptionid => $subscriptionid, |
|
|
1584 |
aqbooksellerid => $subscription->aqbooksellerid(), |
1583 |
biblionumber => $biblionumber, |
1585 |
biblionumber => $biblionumber, |
1584 |
status => $status, |
1586 |
status => $status, |
1585 |
planneddate => $planneddate, |
1587 |
planneddate => $planneddate, |
Lines 1826-1832
sub GetLateOrMissingIssues {
Link Here
|
1826 |
my $sth; |
1828 |
my $sth; |
1827 |
my $byserial = ''; |
1829 |
my $byserial = ''; |
1828 |
if ($serialid) { |
1830 |
if ($serialid) { |
1829 |
$byserial = "and serialid = " . $serialid; |
1831 |
$byserial = "and s.serialid = " . $serialid; |
1830 |
} |
1832 |
} |
1831 |
if ($order) { |
1833 |
if ($order) { |
1832 |
$order .= ", title"; |
1834 |
$order .= ", title"; |
Lines 1835-1873
sub GetLateOrMissingIssues {
Link Here
|
1835 |
} |
1837 |
} |
1836 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
1838 |
my $missing_statuses_string = join ',', (MISSING_STATUSES); |
1837 |
if ($supplierid) { |
1839 |
if ($supplierid) { |
1838 |
$sth = $dbh->prepare( |
1840 |
$sth = $dbh->prepare(qq{ |
1839 |
"SELECT |
1841 |
SELECT |
1840 |
serialid, aqbooksellerid, name, |
1842 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
1841 |
biblio.title, biblioitems.issn, planneddate, serialseq, |
1843 |
biblio.title, biblioitems.issn, s.planneddate, s.serialseq, |
1842 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1844 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
1843 |
subscription.branchcode |
1845 |
subscription.branchcode |
1844 |
FROM serial |
1846 |
FROM serial s |
1845 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1847 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
1846 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1848 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
1847 |
LEFT JOIN biblioitems ON subscription.biblionumber=biblioitems.biblionumber |
1849 |
LEFT JOIN biblioitems ON subscription.biblionumber = biblioitems.biblionumber |
1848 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1850 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
1849 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1851 |
WHERE |
1850 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1852 |
( |
1851 |
AND subscription.aqbooksellerid=$supplierid |
1853 |
s.status IN ($missing_statuses_string) |
1852 |
$byserial |
1854 |
OR ( |
1853 |
ORDER BY $order" |
1855 |
(s.planneddate < NOW() AND s.status = ?) |
1854 |
); |
1856 |
OR s.status = ? |
|
|
1857 |
OR s.status = ? |
1858 |
) |
1859 |
) |
1860 |
AND s.aqbooksellerid = $supplierid |
1861 |
$byserial |
1862 |
ORDER BY $order |
1863 |
}); |
1855 |
} else { |
1864 |
} else { |
1856 |
$sth = $dbh->prepare( |
1865 |
$sth = $dbh->prepare(qq{ |
1857 |
"SELECT |
1866 |
SELECT |
1858 |
serialid, aqbooksellerid, name, |
1867 |
s.serialid, s.aqbooksellerid, aqbooksellers.name, |
1859 |
biblio.title, planneddate, serialseq, |
1868 |
biblio.title, s.planneddate, s.serialseq, |
1860 |
serial.status, serial.subscriptionid, claimdate, claims_count, |
1869 |
s.status, s.subscriptionid, s.claimdate, s.claims_count, |
1861 |
subscription.branchcode |
1870 |
subscription.branchcode |
1862 |
FROM serial |
1871 |
FROM serial s |
1863 |
LEFT JOIN subscription ON serial.subscriptionid=subscription.subscriptionid |
1872 |
LEFT JOIN subscription ON s.subscriptionid = subscription.subscriptionid |
1864 |
LEFT JOIN biblio ON subscription.biblionumber=biblio.biblionumber |
1873 |
LEFT JOIN biblio ON subscription.biblionumber = biblio.biblionumber |
1865 |
LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id |
1874 |
LEFT JOIN aqbooksellers ON s.aqbooksellerid = aqbooksellers.id |
1866 |
WHERE subscription.subscriptionid = serial.subscriptionid |
1875 |
WHERE |
1867 |
AND (serial.STATUS IN ($missing_statuses_string) OR ((planneddate < now() AND serial.STATUS = ?) OR serial.STATUS = ? OR serial.STATUS = ?)) |
1876 |
( |
|
|
1877 |
s.status IN ($missing_statuses_string) |
1878 |
OR ( |
1879 |
(s.planneddate < now() AND s.status = ?) |
1880 |
OR s.status = ? |
1881 |
OR s.status = ? |
1882 |
) |
1883 |
) |
1868 |
$byserial |
1884 |
$byserial |
1869 |
ORDER BY $order" |
1885 |
ORDER BY $order |
1870 |
); |
1886 |
}); |
1871 |
} |
1887 |
} |
1872 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
1888 |
$sth->execute( EXPECTED, LATE, CLAIMED ); |
1873 |
my @issuelist; |
1889 |
my @issuelist; |