|
Lines 872-879
sub GetNextSeq {
Link Here
|
| 872 |
|
872 |
|
| 873 |
my $calculated = ""; |
873 |
my $calculated = ""; |
| 874 |
my $numberingmethod = ""; |
874 |
my $numberingmethod = ""; |
|
|
875 |
my $dateformat = $subscription->{pubdatepatternformat}; |
| 875 |
if ($pattern eq "pubdate"){ |
876 |
if ($pattern eq "pubdate"){ |
| 876 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
877 |
if ( $dateformat eq 'dmy' ){ |
|
|
878 |
$calculated = dt_from_string( $planneddate )->strftime( '%d %B %Y' ); |
| 879 |
} elsif ( $dateformat eq 'mdy' ){ |
| 880 |
$calculated = dt_from_string( $planneddate )->strftime( '%B %d %Y' ); |
| 881 |
} elsif ( $dateformat eq 'ydm' ){ |
| 882 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %d %B' ); |
| 883 |
} else { |
| 884 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
| 885 |
} |
| 877 |
} else { |
886 |
} else { |
| 878 |
$numberingmethod = $pattern->{numberingmethod}; |
887 |
$numberingmethod = $pattern->{numberingmethod}; |
| 879 |
} |
888 |
} |
|
Lines 1168-1193
sub ModSerialStatus {
Link Here
|
| 1168 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1177 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
| 1169 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1178 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
| 1170 |
|
1179 |
|
| 1171 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1); |
1180 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency); |
| 1172 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1181 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1173 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1182 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
| 1174 |
|
1183 |
|
|
|
1184 |
# next issue number |
| 1175 |
if (!defined $pattern){ |
1185 |
if (!defined $pattern){ |
| 1176 |
$pattern = "pubdate"; |
1186 |
$pattern = "pubdate"; |
| 1177 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1187 |
$newserialseq = "pubdate"; |
| 1178 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate ); |
|
|
| 1179 |
} else { |
1188 |
} else { |
| 1180 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1189 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1181 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1190 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
| 1182 |
} |
1191 |
} |
| 1183 |
|
1192 |
|
| 1184 |
# next issue number |
|
|
| 1185 |
my ( |
| 1186 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1187 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
| 1188 |
) |
| 1189 |
= GetNextSeq( $subscription, $pattern, $frequency, $publisheddate ); |
| 1190 |
|
| 1191 |
# next date (calculated from actual date & frequency parameters) |
1193 |
# next date (calculated from actual date & frequency parameters) |
| 1192 |
my $nextpubdate = $nextpublisheddate; |
1194 |
my $nextpubdate = $nextpublisheddate; |
| 1193 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
1195 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
|
Lines 1336-1342
sub ModSubscription {
Link Here
|
| 1336 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1338 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
| 1337 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1339 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
| 1338 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1340 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
| 1339 |
$itemtype, $previousitemtype |
1341 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
| 1340 |
) = @_; |
1342 |
) = @_; |
| 1341 |
|
1343 |
|
| 1342 |
my $dbh = C4::Context->dbh; |
1344 |
my $dbh = C4::Context->dbh; |
|
Lines 1349-1357
sub ModSubscription {
Link Here
|
| 1349 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1351 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
| 1350 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1352 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
| 1351 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1353 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
| 1352 |
skip_serialseq=?, itemtype=?, previousitemtype=? |
1354 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, |
|
|
1355 |
pubdatepatternformat=? |
| 1353 |
WHERE subscriptionid = ?"; |
1356 |
WHERE subscriptionid = ?"; |
| 1354 |
|
|
|
| 1355 |
my $sth = $dbh->prepare($query); |
1357 |
my $sth = $dbh->prepare($query); |
| 1356 |
$sth->execute( |
1358 |
$sth->execute( |
| 1357 |
$auser, $branchcode, $aqbooksellerid, $cost, |
1359 |
$auser, $branchcode, $aqbooksellerid, $cost, |
|
Lines 1363-1369
sub ModSubscription {
Link Here
|
| 1363 |
$letter, ($manualhistory ? $manualhistory : 0), |
1365 |
$letter, ($manualhistory ? $manualhistory : 0), |
| 1364 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1366 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
| 1365 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1367 |
$graceperiod, $location, $enddate, $skip_serialseq, |
| 1366 |
$itemtype, $previousitemtype, |
1368 |
$itemtype, $previousitemtype, $mana_id, $dateformat, |
| 1367 |
$subscriptionid |
1369 |
$subscriptionid |
| 1368 |
); |
1370 |
); |
| 1369 |
my $rows = $sth->rows; |
1371 |
my $rows = $sth->rows; |
|
Lines 1380-1386
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
Link Here
|
| 1380 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1382 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
| 1381 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1383 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
| 1382 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1384 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
| 1383 |
$skip_serialseq, $itemtype, $previousitemtype); |
1385 |
$skip_serialseq, $itemtype, $previousitemtype, $dateformat); |
| 1384 |
|
1386 |
|
| 1385 |
Create a new subscription with value given on input args. |
1387 |
Create a new subscription with value given on input args. |
| 1386 |
|
1388 |
|
|
Lines 1397-1403
sub NewSubscription {
Link Here
|
| 1397 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1399 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
| 1398 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1400 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
| 1399 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1401 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
| 1400 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id |
1402 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, |
|
|
1403 |
$dateformat |
| 1401 |
) = @_; |
1404 |
) = @_; |
| 1402 |
my $dbh = C4::Context->dbh; |
1405 |
my $dbh = C4::Context->dbh; |
| 1403 |
|
1406 |
|
|
Lines 1411-1418
sub NewSubscription {
Link Here
|
| 1411 |
irregularity, numberpattern, locale, callnumber, |
1414 |
irregularity, numberpattern, locale, callnumber, |
| 1412 |
manualhistory, internalnotes, serialsadditems, staffdisplaycount, |
1415 |
manualhistory, internalnotes, serialsadditems, staffdisplaycount, |
| 1413 |
opacdisplaycount, graceperiod, location, enddate, skip_serialseq, |
1416 |
opacdisplaycount, graceperiod, location, enddate, skip_serialseq, |
| 1414 |
itemtype, previousitemtype, mana_id) |
1417 |
itemtype, previousitemtype, mana_id, pubdatepatternformat) |
| 1415 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?) |
1418 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
| 1416 |
|; |
1419 |
|; |
| 1417 |
my $sth = $dbh->prepare($query); |
1420 |
my $sth = $dbh->prepare($query); |
| 1418 |
$sth->execute( |
1421 |
$sth->execute( |
|
Lines 1423-1429
sub NewSubscription {
Link Here
|
| 1423 |
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, |
1426 |
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, |
| 1424 |
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, |
1427 |
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, |
| 1425 |
$opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, |
1428 |
$opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, |
| 1426 |
$itemtype, $previousitemtype, $mana_id |
1429 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
| 1427 |
); |
1430 |
); |
| 1428 |
|
1431 |
|
| 1429 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
1432 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
|
Lines 1454-1461
sub NewSubscription {
Link Here
|
| 1454 |
# calculate issue number |
1457 |
# calculate issue number |
| 1455 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1458 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
| 1456 |
|
1459 |
|
|
|
1460 |
$dateformat //= ''; |
| 1457 |
if ($serialseq eq "pubdate"){ |
1461 |
if ($serialseq eq "pubdate"){ |
| 1458 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1462 |
if ( $dateformat eq 'dmy' ){ |
|
|
1463 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y'); |
| 1464 |
} elsif ( $dateformat eq 'mdy' ){ |
| 1465 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y'); |
| 1466 |
} elsif ( $dateformat eq 'ydm' ){ |
| 1467 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B'); |
| 1468 |
} else { |
| 1469 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
| 1470 |
} |
| 1459 |
} |
1471 |
} |
| 1460 |
|
1472 |
|
| 1461 |
Koha::Serial->new( |
1473 |
Koha::Serial->new( |
|
Lines 1549-1555
sub ReNewSubscription {
Link Here
|
| 1549 |
|
1561 |
|
| 1550 |
=head2 NewIssue |
1562 |
=head2 NewIssue |
| 1551 |
|
1563 |
|
| 1552 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1564 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
| 1553 |
|
1565 |
|
| 1554 |
Create a new issue stored on the database. |
1566 |
Create a new issue stored on the database. |
| 1555 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
1567 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
|
Lines 1568-1573
sub NewIssue {
Link Here
|
| 1568 |
|
1580 |
|
| 1569 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1581 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
| 1570 |
|
1582 |
|
|
|
1583 |
my $dateformat = $subscription->pubdatepatternformat; |
| 1584 |
if ($serialseq eq "pubdate"){ |
| 1585 |
if ( $dateformat eq 'dmy' ){ |
| 1586 |
$serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y'); |
| 1587 |
} elsif ( $dateformat eq 'mdy' ){ |
| 1588 |
$serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y'); |
| 1589 |
} elsif ( $dateformat eq 'ydm' ){ |
| 1590 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B'); |
| 1591 |
} else { |
| 1592 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d'); |
| 1593 |
} |
| 1594 |
} |
| 1595 |
|
| 1571 |
my $serial = Koha::Serial->new( |
1596 |
my $serial = Koha::Serial->new( |
| 1572 |
{ |
1597 |
{ |
| 1573 |
serialseq => $serialseq, |
1598 |
serialseq => $serialseq, |
|
Lines 2349-2355
sub GetNextDate {
Link Here
|
| 2349 |
|
2374 |
|
| 2350 |
return unless $subscription and $publisheddate; |
2375 |
return unless $subscription and $publisheddate; |
| 2351 |
|
2376 |
|
| 2352 |
|
|
|
| 2353 |
if ($freqdata->{'unit'}) { |
2377 |
if ($freqdata->{'unit'}) { |
| 2354 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2378 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
| 2355 |
|
2379 |
|