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 1323-1329
sub ModSubscription {
Link Here
|
1323 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1325 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1324 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1326 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1325 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1327 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1326 |
$itemtype, $previousitemtype, $mana_id |
1328 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
1327 |
) = @_; |
1329 |
) = @_; |
1328 |
|
1330 |
|
1329 |
my $dbh = C4::Context->dbh; |
1331 |
my $dbh = C4::Context->dbh; |
Lines 1336-1344
sub ModSubscription {
Link Here
|
1336 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1338 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1337 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1339 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1338 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1340 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1339 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=? |
1341 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, |
|
|
1342 |
pubdatepatternformat=? |
1340 |
WHERE subscriptionid = ?"; |
1343 |
WHERE subscriptionid = ?"; |
1341 |
|
|
|
1342 |
my $sth = $dbh->prepare($query); |
1344 |
my $sth = $dbh->prepare($query); |
1343 |
$sth->execute( |
1345 |
$sth->execute( |
1344 |
$auser, $branchcode, $aqbooksellerid, $cost, |
1346 |
$auser, $branchcode, $aqbooksellerid, $cost, |
Lines 1350-1356
sub ModSubscription {
Link Here
|
1350 |
$letter, ($manualhistory ? $manualhistory : 0), |
1352 |
$letter, ($manualhistory ? $manualhistory : 0), |
1351 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1353 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1352 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1354 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1353 |
$itemtype, $previousitemtype, $mana_id, |
1355 |
$itemtype, $previousitemtype, $mana_id, $dateformat, |
1354 |
$subscriptionid |
1356 |
$subscriptionid |
1355 |
); |
1357 |
); |
1356 |
my $rows = $sth->rows; |
1358 |
my $rows = $sth->rows; |
Lines 1367-1373
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
Link Here
|
1367 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1369 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1368 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1370 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1369 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1371 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1370 |
$skip_serialseq, $itemtype, $previousitemtype); |
1372 |
$skip_serialseq, $itemtype, $previousitemtype, $dateformat); |
1371 |
|
1373 |
|
1372 |
Create a new subscription with value given on input args. |
1374 |
Create a new subscription with value given on input args. |
1373 |
|
1375 |
|
Lines 1384-1390
sub NewSubscription {
Link Here
|
1384 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1386 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1385 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1387 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1386 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1388 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1387 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id |
1389 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, |
|
|
1390 |
$dateformat |
1388 |
) = @_; |
1391 |
) = @_; |
1389 |
my $dbh = C4::Context->dbh; |
1392 |
my $dbh = C4::Context->dbh; |
1390 |
|
1393 |
|
Lines 1427-1432
sub NewSubscription {
Link Here
|
1427 |
itemtype => $itemtype, |
1430 |
itemtype => $itemtype, |
1428 |
previousitemtype => $previousitemtype, |
1431 |
previousitemtype => $previousitemtype, |
1429 |
mana_id => $mana_id, |
1432 |
mana_id => $mana_id, |
|
|
1433 |
pubdatepatternformat => $dateformat, |
1430 |
} |
1434 |
} |
1431 |
)->store; |
1435 |
)->store; |
1432 |
$subscription->discard_changes; |
1436 |
$subscription->discard_changes; |
Lines 1459-1466
sub NewSubscription {
Link Here
|
1459 |
# calculate issue number |
1463 |
# calculate issue number |
1460 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1464 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1461 |
|
1465 |
|
|
|
1466 |
$dateformat //= ''; |
1462 |
if ($serialseq eq "pubdate"){ |
1467 |
if ($serialseq eq "pubdate"){ |
1463 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1468 |
if ( $dateformat eq 'dmy' ){ |
|
|
1469 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y'); |
1470 |
} elsif ( $dateformat eq 'mdy' ){ |
1471 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y'); |
1472 |
} elsif ( $dateformat eq 'ydm' ){ |
1473 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B'); |
1474 |
} else { |
1475 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1476 |
} |
1464 |
} |
1477 |
} |
1465 |
|
1478 |
|
1466 |
Koha::Serial->new( |
1479 |
Koha::Serial->new( |
Lines 1573-1578
sub NewIssue {
Link Here
|
1573 |
|
1586 |
|
1574 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1587 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1575 |
|
1588 |
|
|
|
1589 |
my $dateformat = $subscription->pubdatepatternformat; |
1590 |
if ($serialseq eq "pubdate"){ |
1591 |
if ( $dateformat eq 'dmy' ){ |
1592 |
$serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y'); |
1593 |
} elsif ( $dateformat eq 'mdy' ){ |
1594 |
$serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y'); |
1595 |
} elsif ( $dateformat eq 'ydm' ){ |
1596 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B'); |
1597 |
} else { |
1598 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d'); |
1599 |
} |
1600 |
} |
1601 |
|
1576 |
my $serial = Koha::Serial->new( |
1602 |
my $serial = Koha::Serial->new( |
1577 |
{ |
1603 |
{ |
1578 |
serialseq => $serialseq, |
1604 |
serialseq => $serialseq, |
Lines 2353-2359
sub GetNextDate {
Link Here
|
2353 |
|
2379 |
|
2354 |
return unless $subscription and $publisheddate; |
2380 |
return unless $subscription and $publisheddate; |
2355 |
|
2381 |
|
2356 |
|
|
|
2357 |
if ($freqdata->{'unit'}) { |
2382 |
if ($freqdata->{'unit'}) { |
2358 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2383 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2359 |
|
2384 |
|