Lines 1373-1409
sub NewSubscription {
Link Here
|
1373 |
) = @_; |
1373 |
) = @_; |
1374 |
my $dbh = C4::Context->dbh; |
1374 |
my $dbh = C4::Context->dbh; |
1375 |
|
1375 |
|
1376 |
$_ ||= undef # Set to undef for integer values, not empty string |
1376 |
my $subscription = Koha::Subscription->new( |
1377 |
for ( |
1377 |
{ |
1378 |
$aqbooksellerid, $lastvalue1, $innerloop1, $lastvalue2, |
1378 |
librarian => $auser, |
1379 |
$innerloop2, $lastvalue3, $innerloop3, |
1379 |
branchcode => $branchcode, |
1380 |
); |
1380 |
aqbooksellerid => $aqbooksellerid, |
1381 |
#save subscription (insert into database) |
1381 |
cost => $cost, |
1382 |
my $query = qq| |
1382 |
aqbudgetid => $aqbudgetid, |
1383 |
INSERT INTO subscription |
1383 |
biblionumber => $biblionumber, |
1384 |
(librarian, branchcode, aqbooksellerid, cost, aqbudgetid, |
1384 |
startdate => $startdate, |
1385 |
biblionumber, startdate, periodicity, numberlength, weeklength, |
1385 |
periodicity => $periodicity, |
1386 |
monthlength, lastvalue1, innerloop1, lastvalue2, innerloop2, |
1386 |
numberlength => $numberlength, |
1387 |
lastvalue3, innerloop3, status, notes, letter, firstacquidate, |
1387 |
weeklength => $weeklength, |
1388 |
irregularity, numberpattern, locale, callnumber, |
1388 |
monthlength => $monthlength, |
1389 |
manualhistory, internalnotes, serialsadditems, staffdisplaycount, |
1389 |
lastvalue1 => $lastvalue1, |
1390 |
opacdisplaycount, graceperiod, location, enddate, skip_serialseq, |
1390 |
innerloop1 => $innerloop1, |
1391 |
itemtype, previousitemtype, mana_id) |
1391 |
lastvalue2 => $lastvalue2, |
1392 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?) |
1392 |
innerloop2 => $innerloop2, |
1393 |
|; |
1393 |
lastvalue3 => $lastvalue3, |
1394 |
my $sth = $dbh->prepare($query); |
1394 |
innerloop3 => $innerloop3, |
1395 |
$sth->execute( |
1395 |
status => $status, |
1396 |
$auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber, |
1396 |
notes => $notes, |
1397 |
$startdate, $periodicity, $numberlength, $weeklength, |
1397 |
letter => $letter, |
1398 |
$monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, |
1398 |
firstacquidate => $firstacquidate, |
1399 |
$lastvalue3, $innerloop3, $status, $notes, $letter, |
1399 |
irregularity => $irregularity, |
1400 |
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, |
1400 |
numberpattern => $numberpattern, |
1401 |
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, |
1401 |
locale => $locale, |
1402 |
$opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, |
1402 |
callnumber => $callnumber, |
1403 |
$itemtype, $previousitemtype, $mana_id |
1403 |
manualhistory => $manualhistory, |
1404 |
); |
1404 |
internalnotes => $internalnotes, |
1405 |
|
1405 |
serialsadditems => $serialsadditems, |
1406 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
1406 |
staffdisplaycount => $staffdisplaycount, |
|
|
1407 |
opacdisplaycount => $opacdisplaycount, |
1408 |
graceperiod => $graceperiod, |
1409 |
location => $location, |
1410 |
enddate => $enddate, |
1411 |
skip_serialseq => $skip_serialseq, |
1412 |
itemtype => $itemtype, |
1413 |
previousitemtype => $previousitemtype, |
1414 |
mana_id => $mana_id, |
1415 |
} |
1416 |
)->store; |
1417 |
$subscription->discard_changes; |
1418 |
my $subscriptionid = $subscription->subscriptionid; |
1419 |
my ( $query, $sth ); |
1407 |
unless ($enddate) { |
1420 |
unless ($enddate) { |
1408 |
$enddate = GetExpirationDate( $subscriptionid, $startdate ); |
1421 |
$enddate = GetExpirationDate( $subscriptionid, $startdate ); |
1409 |
$query = qq| |
1422 |
$query = qq| |
Lines 1425-1431
sub NewSubscription {
Link Here
|
1425 |
$sth->execute( $biblionumber, $subscriptionid, $startdate); |
1438 |
$sth->execute( $biblionumber, $subscriptionid, $startdate); |
1426 |
|
1439 |
|
1427 |
# reread subscription to get a hash (for calculation of the 1st issue number) |
1440 |
# reread subscription to get a hash (for calculation of the 1st issue number) |
1428 |
my $subscription = GetSubscription($subscriptionid); |
1441 |
$subscription = GetSubscription($subscriptionid); # We should not do that |
1429 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1442 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1430 |
|
1443 |
|
1431 |
# calculate issue number |
1444 |
# calculate issue number |