Lines 380-386
sub GetSubscription {
Link Here
|
380 |
$debug and warn "query : $query\nsubsid :$subscriptionid"; |
380 |
$debug and warn "query : $query\nsubsid :$subscriptionid"; |
381 |
my $sth = $dbh->prepare($query); |
381 |
my $sth = $dbh->prepare($query); |
382 |
$sth->execute($subscriptionid); |
382 |
$sth->execute($subscriptionid); |
383 |
return $sth->fetchrow_hashref; |
383 |
my $data= $sth->fetchrow_hashref; |
|
|
384 |
return $data; |
384 |
} |
385 |
} |
385 |
|
386 |
|
386 |
=head2 GetFullSubscription |
387 |
=head2 GetFullSubscription |
Lines 987-993
sub GetSeq {
Link Here
|
987 |
|
988 |
|
988 |
=head2 GetExpirationDate |
989 |
=head2 GetExpirationDate |
989 |
|
990 |
|
990 |
$sensddate = GetExpirationDate($subscriptionid) |
991 |
$enddate = GetExpirationDate($subscriptionid,$startdate) |
991 |
|
992 |
|
992 |
this function return the next expiration date for a subscription given on input args. |
993 |
this function return the next expiration date for a subscription given on input args. |
993 |
|
994 |
|
Lines 1349-1363
sub NewSubscription {
Link Here
|
1349 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate |
1350 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate |
1350 |
); |
1351 |
); |
1351 |
|
1352 |
|
1352 |
#then create the 1st waited number |
|
|
1353 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
1353 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
|
|
1354 |
unless ($enddate){ |
1355 |
$enddate=GetExpirationDate($subscriptionid,$startdate); |
1356 |
$query = qq| |
1357 |
UPDATE subscription |
1358 |
SET enddate=? |
1359 |
WHERE subscriptionid=? |
1360 |
|; |
1361 |
$sth = $dbh->prepare($query); |
1362 |
$sth->execute( $enddate, $subscriptionid ); |
1363 |
} |
1364 |
#then create the 1st waited number |
1354 |
$query = qq( |
1365 |
$query = qq( |
1355 |
INSERT INTO subscriptionhistory |
1366 |
INSERT INTO subscriptionhistory |
1356 |
(biblionumber, subscriptionid, histstartdate, opacnote, librariannote) |
1367 |
(biblionumber, subscriptionid, histstartdate, opacnote, librariannote) |
1357 |
VALUES (?,?,?,?,?) |
1368 |
VALUES (?,?,?,?,?) |
1358 |
); |
1369 |
); |
1359 |
$sth = $dbh->prepare($query); |
1370 |
$sth = $dbh->prepare($query); |
1360 |
$sth->execute( $biblionumber, $subscriptionid, $startdate, $notes, $internalnotes ); |
1371 |
$sth->execute( $biblionumber, $subscriptionid, $startdate, $notes, $internalnotes ); |
1361 |
|
1372 |
|
1362 |
# reread subscription to get a hash (for calculation of the 1st issue number) |
1373 |
# reread subscription to get a hash (for calculation of the 1st issue number) |
1363 |
$query = qq( |
1374 |
$query = qq( |
Lines 1719-1725
sub HasSubscriptionExpired {
Link Here
|
1719 |
my $dbh = C4::Context->dbh; |
1730 |
my $dbh = C4::Context->dbh; |
1720 |
my $subscription = GetSubscription($subscriptionid); |
1731 |
my $subscription = GetSubscription($subscriptionid); |
1721 |
if ( ( $subscription->{periodicity} % 16 ) > 0 ) { |
1732 |
if ( ( $subscription->{periodicity} % 16 ) > 0 ) { |
1722 |
my $expirationdate = $subscription->{enddate}; |
1733 |
my $expirationdate = $subscription->{enddate}||GetExpirationDate($subscriptionid); |
1723 |
my $query = qq| |
1734 |
my $query = qq| |
1724 |
SELECT max(planneddate) |
1735 |
SELECT max(planneddate) |
1725 |
FROM serial |
1736 |
FROM serial |
1726 |
- |
|
|