Lines 861-868
sub GetNextSeq {
Link Here
|
861 |
|
861 |
|
862 |
my $calculated = ""; |
862 |
my $calculated = ""; |
863 |
my $numberingmethod = ""; |
863 |
my $numberingmethod = ""; |
|
|
864 |
my $dateformat = $subscription->{pubdatepatternformat}; |
864 |
if ($pattern eq "pubdate"){ |
865 |
if ($pattern eq "pubdate"){ |
865 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
866 |
if ( $dateformat eq 'dmy' ){ |
|
|
867 |
$calculated = dt_from_string( $planneddate )->strftime( '%d %B %Y' ); |
868 |
} elsif ( $dateformat eq 'mdy' ){ |
869 |
$calculated = dt_from_string( $planneddate )->strftime( '%B %d %Y' ); |
870 |
} elsif ( $dateformat eq 'ydm' ){ |
871 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %d %B' ); |
872 |
} else { |
873 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
874 |
} |
866 |
} else { |
875 |
} else { |
867 |
$numberingmethod = $pattern->{numberingmethod}; |
876 |
$numberingmethod = $pattern->{numberingmethod}; |
868 |
} |
877 |
} |
Lines 1156-1181
sub ModSerialStatus {
Link Here
|
1156 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1165 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1157 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1166 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1158 |
|
1167 |
|
1159 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1); |
1168 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency); |
1160 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1169 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1161 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1170 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1162 |
|
1171 |
|
|
|
1172 |
# next issue number |
1163 |
if (!defined $pattern){ |
1173 |
if (!defined $pattern){ |
1164 |
$pattern = "pubdate"; |
1174 |
$pattern = "pubdate"; |
1165 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1175 |
$newserialseq = "pubdate"; |
1166 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate ); |
|
|
1167 |
} else { |
1176 |
} else { |
1168 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1177 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1169 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1178 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1170 |
} |
1179 |
} |
1171 |
|
1180 |
|
1172 |
# next issue number |
|
|
1173 |
my ( |
1174 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1175 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
1176 |
) |
1177 |
= GetNextSeq( $subscription, $pattern, $frequency, $publisheddate ); |
1178 |
|
1179 |
# next date (calculated from actual date & frequency parameters) |
1181 |
# next date (calculated from actual date & frequency parameters) |
1180 |
my $nextpubdate = $nextpublisheddate; |
1182 |
my $nextpubdate = $nextpublisheddate; |
1181 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
1183 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
Lines 1322-1328
sub ModSubscription {
Link Here
|
1322 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1324 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1323 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1325 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1324 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1326 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1325 |
$itemtype, $previousitemtype, $mana_id |
1327 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
1326 |
) = @_; |
1328 |
) = @_; |
1327 |
|
1329 |
|
1328 |
my $dbh = C4::Context->dbh; |
1330 |
my $dbh = C4::Context->dbh; |
Lines 1335-1343
sub ModSubscription {
Link Here
|
1335 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1337 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1336 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1338 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1337 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1339 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1338 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=? |
1340 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, |
|
|
1341 |
pubdatepatternformat=? |
1339 |
WHERE subscriptionid = ?"; |
1342 |
WHERE subscriptionid = ?"; |
1340 |
|
|
|
1341 |
my $sth = $dbh->prepare($query); |
1343 |
my $sth = $dbh->prepare($query); |
1342 |
$sth->execute( |
1344 |
$sth->execute( |
1343 |
$auser, $branchcode, $aqbooksellerid, $cost, |
1345 |
$auser, $branchcode, $aqbooksellerid, $cost, |
Lines 1349-1355
sub ModSubscription {
Link Here
|
1349 |
$letter, ($manualhistory ? $manualhistory : 0), |
1351 |
$letter, ($manualhistory ? $manualhistory : 0), |
1350 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1352 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1351 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1353 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1352 |
$itemtype, $previousitemtype, $mana_id, |
1354 |
$itemtype, $previousitemtype, $mana_id, $dateformat, |
1353 |
$subscriptionid |
1355 |
$subscriptionid |
1354 |
); |
1356 |
); |
1355 |
my $rows = $sth->rows; |
1357 |
my $rows = $sth->rows; |
Lines 1366-1372
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
Link Here
|
1366 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1368 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1367 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1369 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1368 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1370 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1369 |
$skip_serialseq, $itemtype, $previousitemtype); |
1371 |
$skip_serialseq, $itemtype, $previousitemtype, $dateformat); |
1370 |
|
1372 |
|
1371 |
Create a new subscription with value given on input args. |
1373 |
Create a new subscription with value given on input args. |
1372 |
|
1374 |
|
Lines 1383-1389
sub NewSubscription {
Link Here
|
1383 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1385 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1384 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1386 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1385 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1387 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1386 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id |
1388 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, |
|
|
1389 |
$dateformat |
1387 |
) = @_; |
1390 |
) = @_; |
1388 |
my $dbh = C4::Context->dbh; |
1391 |
my $dbh = C4::Context->dbh; |
1389 |
|
1392 |
|
Lines 1426-1431
sub NewSubscription {
Link Here
|
1426 |
itemtype => $itemtype, |
1429 |
itemtype => $itemtype, |
1427 |
previousitemtype => $previousitemtype, |
1430 |
previousitemtype => $previousitemtype, |
1428 |
mana_id => $mana_id, |
1431 |
mana_id => $mana_id, |
|
|
1432 |
pubdatepatternformat => $dateformat, |
1429 |
} |
1433 |
} |
1430 |
)->store; |
1434 |
)->store; |
1431 |
$subscription->discard_changes; |
1435 |
$subscription->discard_changes; |
Lines 1458-1465
sub NewSubscription {
Link Here
|
1458 |
# calculate issue number |
1462 |
# calculate issue number |
1459 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1463 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1460 |
|
1464 |
|
|
|
1465 |
$dateformat //= ''; |
1461 |
if ($serialseq eq "pubdate"){ |
1466 |
if ($serialseq eq "pubdate"){ |
1462 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1467 |
if ( $dateformat eq 'dmy' ){ |
|
|
1468 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y'); |
1469 |
} elsif ( $dateformat eq 'mdy' ){ |
1470 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y'); |
1471 |
} elsif ( $dateformat eq 'ydm' ){ |
1472 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B'); |
1473 |
} else { |
1474 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1475 |
} |
1463 |
} |
1476 |
} |
1464 |
|
1477 |
|
1465 |
Koha::Serial->new( |
1478 |
Koha::Serial->new( |
Lines 1572-1577
sub NewIssue {
Link Here
|
1572 |
|
1585 |
|
1573 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1586 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1574 |
|
1587 |
|
|
|
1588 |
my $dateformat = $subscription->pubdatepatternformat; |
1589 |
if ($serialseq eq "pubdate"){ |
1590 |
if ( $dateformat eq 'dmy' ){ |
1591 |
$serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y'); |
1592 |
} elsif ( $dateformat eq 'mdy' ){ |
1593 |
$serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y'); |
1594 |
} elsif ( $dateformat eq 'ydm' ){ |
1595 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B'); |
1596 |
} else { |
1597 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d'); |
1598 |
} |
1599 |
} |
1600 |
|
1575 |
my $serial = Koha::Serial->new( |
1601 |
my $serial = Koha::Serial->new( |
1576 |
{ |
1602 |
{ |
1577 |
serialseq => $serialseq, |
1603 |
serialseq => $serialseq, |
Lines 2352-2358
sub GetNextDate {
Link Here
|
2352 |
|
2378 |
|
2353 |
return unless $subscription and $publisheddate; |
2379 |
return unless $subscription and $publisheddate; |
2354 |
|
2380 |
|
2355 |
|
|
|
2356 |
if ($freqdata->{'unit'}) { |
2381 |
if ($freqdata->{'unit'}) { |
2357 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2382 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2358 |
|
2383 |
|