serial.publisheddatetext,
serial.status,
serial.notes as notes,
- year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
+ year(IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate)) as year,
aqbooksellers.name as aqbooksellername,
biblio.title as bibliotitle,
subscription.branchcode AS branchcode,
LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber
WHERE serial.subscriptionid = ?
ORDER BY year DESC,
- IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate) DESC,
+ IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate) DESC,
serial.subscriptionid
|;
$debug and warn "GetFullSubscription query: $query";
serial.publisheddatetext,
serial.status,
serial.notes as notes,
- year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
+ year(IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate)) as year,
biblio.title as bibliotitle,
subscription.branchcode AS branchcode,
subscription.subscriptionid AS subscriptionid
LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber
WHERE subscription.biblionumber = ?
ORDER BY year DESC,
- IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate) DESC,
+ IF(serial.publisheddate IS NULL,serial.planneddate,serial.publisheddate) DESC,
serial.subscriptionid
|;
my $sth = $dbh->prepare($query);
publisheddatetext, planneddate,notes, routingnotes
FROM serial
WHERE subscriptionid = ? AND status NOT IN ( $statuses )
- ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
+ ORDER BY IF(publisheddate IS NULL,planneddate,publisheddate) DESC";
my $sth = $dbh->prepare($query);
$sth->execute($subscriptionid);
FROM serial
WHERE subscriptionid = ?
AND status IN ( $statuses )
- ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC
+ ORDER BY IF(publisheddate IS NULL,planneddate,publisheddate) DESC
";
$sth = $dbh->prepare($query);
$sth->execute($subscriptionid);
$itemtype, $previousitemtype, $mana_id
) = @_;
- my $dbh = C4::Context->dbh;
- my $query = "UPDATE subscription
- SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
- startdate=?, periodicity=?, firstacquidate=?, irregularity=?,
- numberpattern=?, locale=?, numberlength=?, weeklength=?, monthlength=?,
- lastvalue1=?, innerloop1=?, lastvalue2=?, innerloop2=?,
- lastvalue3=?, innerloop3=?, status=?, biblionumber=?,
- callnumber=?, notes=?, letter=?, manualhistory=?,
- internalnotes=?, serialsadditems=?, staffdisplaycount=?,
- opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
- skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?
- WHERE subscriptionid = ?";
-
- my $sth = $dbh->prepare($query);
- $sth->execute(
- $auser, $branchcode, $aqbooksellerid, $cost,
- $aqbudgetid, $startdate, $periodicity, $firstacquidate,
- $irregularity, $numberpattern, $locale, $numberlength,
- $weeklength, $monthlength, $lastvalue1, $innerloop1,
- $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
- $status, $biblionumber, $callnumber, $notes,
- $letter, ($manualhistory ? $manualhistory : 0),
- $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
- $graceperiod, $location, $enddate, $skip_serialseq,
- $itemtype, $previousitemtype, $mana_id,
- $subscriptionid
- );
- my $rows = $sth->rows;
+ my $subscription = Koha::Subscriptions->find($subscriptionid);
+ $subscription->set(
+ {
+ librarian => $auser,
+ branchcode => $branchcode,
+ aqbooksellerid => $aqbooksellerid,
+ cost => $cost,
+ aqbudgetid => $aqbudgetid,
+ biblionumber => $biblionumber,
+ startdate => $startdate,
+ periodicity => $periodicity,
+ numberlength => $numberlength,
+ weeklength => $weeklength,
+ monthlength => $monthlength,
+ lastvalue1 => $lastvalue1,
+ innerloop1 => $innerloop1,
+ lastvalue2 => $lastvalue2,
+ innerloop2 => $innerloop2,
+ lastvalue3 => $lastvalue3,
+ innerloop3 => $innerloop3,
+ status => $status,
+ notes => $notes,
+ letter => $letter,
+ firstacquidate => $firstacquidate,
+ irregularity => $irregularity,
+ numberpattern => $numberpattern,
+ locale => $locale,
+ callnumber => $callnumber,
+ manualhistory => $manualhistory,
+ internalnotes => $internalnotes,
+ serialsadditems => $serialsadditems,
+ staffdisplaycount => $staffdisplaycount,
+ opacdisplaycount => $opacdisplaycount,
+ graceperiod => $graceperiod,
+ location => $location,
+ enddate => $enddate,
+ skip_serialseq => $skip_serialseq,
+ itemtype => $itemtype,
+ previousitemtype => $previousitemtype,
+ mana_id => $mana_id,
+ }
+ )->store;
logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
- return $rows;
+
+ $subscription->discard_changes;
+ return $subscription;
}
=head2 NewSubscription
=head2 ReNewSubscription
-ReNewSubscription($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note)
+ReNewSubscription($params);
+
+$params is a hashref with the following keys: subscriptionid, user, startdate, numberlength, weeklength, monthlength, note, branchcode
this function renew a subscription with values given on input args.
=cut
sub ReNewSubscription {
- my ( $subscriptionid, $user, $startdate, $numberlength, $weeklength, $monthlength, $note ) = @_;
+ my ( $params ) = @_;
+ my $subscriptionid = $params->{subscriptionid};
+ my $user = $params->{user};
+ my $startdate = $params->{startdate};
+ my $numberlength = $params->{numberlength};
+ my $weeklength = $params->{weeklength};
+ my $monthlength = $params->{monthlength};
+ my $note = $params->{note};
+ my $branchcode = $params->{branchcode};
+
my $dbh = C4::Context->dbh;
my $subscription = GetSubscription($subscriptionid);
my $query = qq|
'title' => $subscription->{bibliotitle},
'author' => $biblio->{author},
'publishercode' => $biblio->{publishercode},
- 'note' => $biblio->{note},
- 'biblionumber' => $subscription->{biblionumber}
+ 'note' => $note,
+ 'biblionumber' => $subscription->{biblionumber},
+ 'branchcode' => $branchcode,
}
);
}
### Would use substr and index But be careful to previous presence of ()
$recievedlist .= "; $serialseq" unless ( index( $recievedlist, $serialseq ) > 0 );
}
- if ( grep { /^$status$/ } (MISSING_STATUSES) ) {
+ if ( grep { $_ eq $status } (MISSING_STATUSES) ) {
$missinglist .= "; $serialseq" unless ( index( $missinglist, $serialseq ) > 0 );
}
}
}
- } elsif ($subscription->{numberlength}>0) {
+ } elsif ( $subscription->{numberlength} && $subscription->{numberlength}>0) {
return (countissuesfrom($subscriptionid,$subscription->{'startdate'}) >=$subscription->{numberlength}-1);
}