|
Lines 842-849
sub GetNextSeq {
Link Here
|
| 842 |
|
842 |
|
| 843 |
my $calculated = ""; |
843 |
my $calculated = ""; |
| 844 |
my $numberingmethod = ""; |
844 |
my $numberingmethod = ""; |
|
|
845 |
my $dateformat = $subscription->{pubdatepatternformat}; |
| 845 |
if ($pattern eq "pubdate"){ |
846 |
if ($pattern eq "pubdate"){ |
| 846 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
847 |
if ( $dateformat eq 'dmy' ){ |
|
|
848 |
$calculated = dt_from_string( $planneddate )->strftime( '%d %B %Y' ); |
| 849 |
} elsif ( $dateformat eq 'mdy' ){ |
| 850 |
$calculated = dt_from_string( $planneddate )->strftime( '%B %d %Y' ); |
| 851 |
} elsif ( $dateformat eq 'ydm' ){ |
| 852 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %d %B' ); |
| 853 |
} else { |
| 854 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
| 855 |
} |
| 847 |
} else { |
856 |
} else { |
| 848 |
$numberingmethod = $pattern->{numberingmethod}; |
857 |
$numberingmethod = $pattern->{numberingmethod}; |
| 849 |
} |
858 |
} |
|
Lines 1135-1160
sub ModSerialStatus {
Link Here
|
| 1135 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1144 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
| 1136 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1145 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
| 1137 |
|
1146 |
|
| 1138 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1); |
1147 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency); |
| 1139 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1148 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1140 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1149 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
| 1141 |
|
1150 |
|
|
|
1151 |
# next issue number |
| 1142 |
if (!defined $pattern){ |
1152 |
if (!defined $pattern){ |
| 1143 |
$pattern = "pubdate"; |
1153 |
$pattern = "pubdate"; |
| 1144 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1154 |
$newserialseq = "pubdate"; |
| 1145 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate ); |
|
|
| 1146 |
} else { |
1155 |
} else { |
| 1147 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1156 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1148 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1157 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
| 1149 |
} |
1158 |
} |
| 1150 |
|
1159 |
|
| 1151 |
# next issue number |
|
|
| 1152 |
my ( |
| 1153 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
| 1154 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
| 1155 |
) |
| 1156 |
= GetNextSeq( $subscription, $pattern, $frequency, $publisheddate ); |
| 1157 |
|
| 1158 |
# next date (calculated from actual date & frequency parameters) |
1160 |
# next date (calculated from actual date & frequency parameters) |
| 1159 |
my $nextpubdate = $nextpublisheddate; |
1161 |
my $nextpubdate = $nextpublisheddate; |
| 1160 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
1162 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
|
Lines 1315-1321
sub ModSubscription {
Link Here
|
| 1315 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1317 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
| 1316 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1318 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
| 1317 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1319 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
| 1318 |
$itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template |
1320 |
$itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template, $dateformat |
| 1319 |
) = @_; |
1321 |
) = @_; |
| 1320 |
|
1322 |
|
| 1321 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
1323 |
my $subscription = Koha::Subscriptions->find($subscriptionid); |
|
Lines 1360-1365
sub ModSubscription {
Link Here
|
| 1360 |
mana_id => $mana_id, |
1362 |
mana_id => $mana_id, |
| 1361 |
ccode => $ccode, |
1363 |
ccode => $ccode, |
| 1362 |
published_on_template => $published_on_template, |
1364 |
published_on_template => $published_on_template, |
|
|
1365 |
pubdatepatternformat => $dateformat, |
| 1363 |
} |
1366 |
} |
| 1364 |
)->store; |
1367 |
)->store; |
| 1365 |
# FIXME Must be $subscription->serials |
1368 |
# FIXME Must be $subscription->serials |
|
Lines 1380-1386
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
Link Here
|
| 1380 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1383 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
| 1381 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1384 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
| 1382 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1385 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
| 1383 |
$skip_serialseq, $itemtype, $previousitemtype); |
1386 |
$skip_serialseq, $itemtype, $previousitemtype, $dateformat); |
| 1384 |
|
1387 |
|
| 1385 |
Create a new subscription with value given on input args. |
1388 |
Create a new subscription with value given on input args. |
| 1386 |
|
1389 |
|
|
Lines 1398-1404
sub NewSubscription {
Link Here
|
| 1398 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1401 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
| 1399 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1402 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
| 1400 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, |
1403 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, |
| 1401 |
$published_on_template, |
1404 |
$published_on_template, $dateformat, |
| 1402 |
) = @_; |
1405 |
) = @_; |
| 1403 |
my $dbh = C4::Context->dbh; |
1406 |
my $dbh = C4::Context->dbh; |
| 1404 |
|
1407 |
|
|
Lines 1443-1448
sub NewSubscription {
Link Here
|
| 1443 |
mana_id => $mana_id, |
1446 |
mana_id => $mana_id, |
| 1444 |
ccode => $ccode, |
1447 |
ccode => $ccode, |
| 1445 |
published_on_template => $published_on_template, |
1448 |
published_on_template => $published_on_template, |
|
|
1449 |
pubdatepatternformat => $dateformat, |
| 1446 |
} |
1450 |
} |
| 1447 |
)->store; |
1451 |
)->store; |
| 1448 |
$subscription->discard_changes; |
1452 |
$subscription->discard_changes; |
|
Lines 1475-1482
sub NewSubscription {
Link Here
|
| 1475 |
# calculate issue number |
1479 |
# calculate issue number |
| 1476 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1480 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
| 1477 |
|
1481 |
|
|
|
1482 |
$dateformat //= ''; |
| 1478 |
if ($serialseq eq "pubdate"){ |
1483 |
if ($serialseq eq "pubdate"){ |
| 1479 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1484 |
if ( $dateformat eq 'dmy' ){ |
|
|
1485 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y'); |
| 1486 |
} elsif ( $dateformat eq 'mdy' ){ |
| 1487 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y'); |
| 1488 |
} elsif ( $dateformat eq 'ydm' ){ |
| 1489 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B'); |
| 1490 |
} else { |
| 1491 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
| 1492 |
} |
| 1480 |
} |
1493 |
} |
| 1481 |
|
1494 |
|
| 1482 |
Koha::Serial->new( |
1495 |
Koha::Serial->new( |
|
Lines 1622-1627
sub NewIssue {
Link Here
|
| 1622 |
|
1635 |
|
| 1623 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1636 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
| 1624 |
|
1637 |
|
|
|
1638 |
my $dateformat = $subscription->pubdatepatternformat; |
| 1639 |
if ($serialseq eq "pubdate"){ |
| 1640 |
if ( $dateformat eq 'dmy' ){ |
| 1641 |
$serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y'); |
| 1642 |
} elsif ( $dateformat eq 'mdy' ){ |
| 1643 |
$serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y'); |
| 1644 |
} elsif ( $dateformat eq 'ydm' ){ |
| 1645 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B'); |
| 1646 |
} else { |
| 1647 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d'); |
| 1648 |
} |
| 1649 |
} |
| 1650 |
|
| 1625 |
if ( my $template = $subscription->published_on_template ) { |
1651 |
if ( my $template = $subscription->published_on_template ) { |
| 1626 |
$publisheddatetext = process_tt( |
1652 |
$publisheddatetext = process_tt( |
| 1627 |
$template, |
1653 |
$template, |
|
Lines 2427-2433
sub GetNextDate {
Link Here
|
| 2427 |
|
2453 |
|
| 2428 |
return unless $subscription and $publisheddate; |
2454 |
return unless $subscription and $publisheddate; |
| 2429 |
|
2455 |
|
| 2430 |
|
|
|
| 2431 |
if ($freqdata->{'unit'}) { |
2456 |
if ($freqdata->{'unit'}) { |
| 2432 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2457 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
| 2433 |
|
2458 |
|