Lines 865-872
sub GetNextSeq {
Link Here
|
865 |
|
865 |
|
866 |
my $calculated = ""; |
866 |
my $calculated = ""; |
867 |
my $numberingmethod = ""; |
867 |
my $numberingmethod = ""; |
|
|
868 |
my $dateformat = $subscription->{pubdatepatternformat}; |
868 |
if ($pattern eq "pubdate"){ |
869 |
if ($pattern eq "pubdate"){ |
869 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
870 |
if ( $dateformat eq 'dmy' ){ |
|
|
871 |
$calculated = dt_from_string( $planneddate )->strftime( '%d %B %Y' ); |
872 |
} elsif ( $dateformat eq 'mdy' ){ |
873 |
$calculated = dt_from_string( $planneddate )->strftime( '%B %d %Y' ); |
874 |
} elsif ( $dateformat eq 'ydm' ){ |
875 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %d %B' ); |
876 |
} else { |
877 |
$calculated = dt_from_string( $planneddate )->strftime( '%Y %B %d' ); |
878 |
} |
870 |
} else { |
879 |
} else { |
871 |
$numberingmethod = $pattern->{numberingmethod}; |
880 |
$numberingmethod = $pattern->{numberingmethod}; |
872 |
} |
881 |
} |
Lines 1161-1186
sub ModSerialStatus {
Link Here
|
1161 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1170 |
my $pattern = C4::Serials::Numberpattern::GetSubscriptionNumberpattern($subscription->{numberpattern}); |
1162 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1171 |
my $frequency = C4::Serials::Frequency::GetSubscriptionFrequency($subscription->{periodicity}); |
1163 |
|
1172 |
|
1164 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, 1); |
1173 |
my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency); |
1165 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1174 |
my ( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1166 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1175 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ); |
1167 |
|
1176 |
|
|
|
1177 |
# next issue number |
1168 |
if (!defined $pattern){ |
1178 |
if (!defined $pattern){ |
1169 |
$pattern = "pubdate"; |
1179 |
$pattern = "pubdate"; |
1170 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1180 |
$newserialseq = "pubdate"; |
1171 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $nextpublisheddate ); |
|
|
1172 |
} else { |
1181 |
} else { |
1173 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1182 |
( $newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1174 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1183 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 ) = GetNextSeq( $subscription, $pattern, $publisheddate ); |
1175 |
} |
1184 |
} |
1176 |
|
1185 |
|
1177 |
# next issue number |
|
|
1178 |
my ( |
1179 |
$newserialseq, $newlastvalue1, $newlastvalue2, $newlastvalue3, |
1180 |
$newinnerloop1, $newinnerloop2, $newinnerloop3 |
1181 |
) |
1182 |
= GetNextSeq( $subscription, $pattern, $frequency, $publisheddate ); |
1183 |
|
1184 |
# next date (calculated from actual date & frequency parameters) |
1186 |
# next date (calculated from actual date & frequency parameters) |
1185 |
my $nextpubdate = $nextpublisheddate; |
1187 |
my $nextpubdate = $nextpublisheddate; |
1186 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
1188 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
Lines 1329-1335
sub ModSubscription {
Link Here
|
1329 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1331 |
$biblionumber, $callnumber, $notes, $letter, $manualhistory, |
1330 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1332 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1331 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1333 |
$graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, |
1332 |
$itemtype, $previousitemtype, $mana_id |
1334 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
1333 |
) = @_; |
1335 |
) = @_; |
1334 |
|
1336 |
|
1335 |
my $dbh = C4::Context->dbh; |
1337 |
my $dbh = C4::Context->dbh; |
Lines 1342-1350
sub ModSubscription {
Link Here
|
1342 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1344 |
callnumber=?, notes=?, letter=?, manualhistory=?, |
1343 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1345 |
internalnotes=?, serialsadditems=?, staffdisplaycount=?, |
1344 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1346 |
opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, |
1345 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=? |
1347 |
skip_serialseq=?, itemtype=?, previousitemtype=?, mana_id=?, |
|
|
1348 |
pubdatepatternformat=? |
1346 |
WHERE subscriptionid = ?"; |
1349 |
WHERE subscriptionid = ?"; |
1347 |
|
|
|
1348 |
my $sth = $dbh->prepare($query); |
1350 |
my $sth = $dbh->prepare($query); |
1349 |
$sth->execute( |
1351 |
$sth->execute( |
1350 |
$auser, $branchcode, $aqbooksellerid, $cost, |
1352 |
$auser, $branchcode, $aqbooksellerid, $cost, |
Lines 1356-1362
sub ModSubscription {
Link Here
|
1356 |
$letter, ($manualhistory ? $manualhistory : 0), |
1358 |
$letter, ($manualhistory ? $manualhistory : 0), |
1357 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1359 |
$internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, |
1358 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1360 |
$graceperiod, $location, $enddate, $skip_serialseq, |
1359 |
$itemtype, $previousitemtype, $mana_id, |
1361 |
$itemtype, $previousitemtype, $mana_id, $dateformat, |
1360 |
$subscriptionid |
1362 |
$subscriptionid |
1361 |
); |
1363 |
); |
1362 |
my $rows = $sth->rows; |
1364 |
my $rows = $sth->rows; |
Lines 1373-1379
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
Link Here
|
1373 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1375 |
$status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, |
1374 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1376 |
$locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, |
1375 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1377 |
$staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, |
1376 |
$skip_serialseq, $itemtype, $previousitemtype); |
1378 |
$skip_serialseq, $itemtype, $previousitemtype, $dateformat); |
1377 |
|
1379 |
|
1378 |
Create a new subscription with value given on input args. |
1380 |
Create a new subscription with value given on input args. |
1379 |
|
1381 |
|
Lines 1390-1396
sub NewSubscription {
Link Here
|
1390 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1392 |
$innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, |
1391 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1393 |
$numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, |
1392 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1394 |
$serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, |
1393 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id |
1395 |
$location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, |
|
|
1396 |
$dateformat |
1394 |
) = @_; |
1397 |
) = @_; |
1395 |
my $dbh = C4::Context->dbh; |
1398 |
my $dbh = C4::Context->dbh; |
1396 |
|
1399 |
|
Lines 1404-1411
sub NewSubscription {
Link Here
|
1404 |
irregularity, numberpattern, locale, callnumber, |
1407 |
irregularity, numberpattern, locale, callnumber, |
1405 |
manualhistory, internalnotes, serialsadditems, staffdisplaycount, |
1408 |
manualhistory, internalnotes, serialsadditems, staffdisplaycount, |
1406 |
opacdisplaycount, graceperiod, location, enddate, skip_serialseq, |
1409 |
opacdisplaycount, graceperiod, location, enddate, skip_serialseq, |
1407 |
itemtype, previousitemtype, mana_id) |
1410 |
itemtype, previousitemtype, mana_id, pubdatepatternformat) |
1408 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, ?) |
1411 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |
1409 |
|; |
1412 |
|; |
1410 |
my $sth = $dbh->prepare($query); |
1413 |
my $sth = $dbh->prepare($query); |
1411 |
$sth->execute( |
1414 |
$sth->execute( |
Lines 1416-1422
sub NewSubscription {
Link Here
|
1416 |
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, |
1419 |
$firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, |
1417 |
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, |
1420 |
$manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, |
1418 |
$opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, |
1421 |
$opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, |
1419 |
$itemtype, $previousitemtype, $mana_id |
1422 |
$itemtype, $previousitemtype, $mana_id, $dateformat |
1420 |
); |
1423 |
); |
1421 |
|
1424 |
|
1422 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
1425 |
my $subscriptionid = $dbh->{'mysql_insertid'}; |
Lines 1447-1454
sub NewSubscription {
Link Here
|
1447 |
# calculate issue number |
1450 |
# calculate issue number |
1448 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1451 |
my $serialseq = GetSeq($subscription, $pattern) || q{}; |
1449 |
|
1452 |
|
|
|
1453 |
$dateformat //= ''; |
1450 |
if ($serialseq eq "pubdate"){ |
1454 |
if ($serialseq eq "pubdate"){ |
1451 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1455 |
if ( $dateformat eq 'dmy' ){ |
|
|
1456 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%d %B %Y'); |
1457 |
} elsif ( $dateformat eq 'mdy' ){ |
1458 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%B %d %Y'); |
1459 |
} elsif ( $dateformat eq 'ydm' ){ |
1460 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %d %B'); |
1461 |
} else { |
1462 |
$serialseq = dt_from_string( $firstacquidate )->strftime('%Y %B %d'); |
1463 |
} |
1452 |
} |
1464 |
} |
1453 |
|
1465 |
|
1454 |
Koha::Serial->new( |
1466 |
Koha::Serial->new( |
Lines 1542-1548
sub ReNewSubscription {
Link Here
|
1542 |
|
1554 |
|
1543 |
=head2 NewIssue |
1555 |
=head2 NewIssue |
1544 |
|
1556 |
|
1545 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1557 |
NewIssue($serialseq,$subscriptionid,$biblionumber,$status, $planneddate, $publisheddate, $notes) |
1546 |
|
1558 |
|
1547 |
Create a new issue stored on the database. |
1559 |
Create a new issue stored on the database. |
1548 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
1560 |
Note : we have to update the recievedlist and missinglist on subscriptionhistory for this subscription. |
Lines 1561-1566
sub NewIssue {
Link Here
|
1561 |
|
1573 |
|
1562 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1574 |
my $subscription = Koha::Subscriptions->find( $subscriptionid ); |
1563 |
|
1575 |
|
|
|
1576 |
my $dateformat = $subscription->pubdatepatternformat; |
1577 |
if ($serialseq eq "pubdate"){ |
1578 |
if ( $dateformat eq 'dmy' ){ |
1579 |
$serialseq = dt_from_string( $publisheddate )->strftime('%d %B %Y'); |
1580 |
} elsif ( $dateformat eq 'mdy' ){ |
1581 |
$serialseq = dt_from_string( $publisheddate )->strftime('%B %d %Y'); |
1582 |
} elsif ( $dateformat eq 'ydm' ){ |
1583 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %d %B'); |
1584 |
} else { |
1585 |
$serialseq = dt_from_string( $publisheddate )->strftime('%Y %B %d'); |
1586 |
} |
1587 |
} |
1588 |
|
1564 |
my $serial = Koha::Serial->new( |
1589 |
my $serial = Koha::Serial->new( |
1565 |
{ |
1590 |
{ |
1566 |
serialseq => $serialseq, |
1591 |
serialseq => $serialseq, |
Lines 2340-2346
sub GetNextDate {
Link Here
|
2340 |
|
2365 |
|
2341 |
return unless $subscription and $publisheddate; |
2366 |
return unless $subscription and $publisheddate; |
2342 |
|
2367 |
|
2343 |
|
|
|
2344 |
if ($freqdata->{'unit'}) { |
2368 |
if ($freqdata->{'unit'}) { |
2345 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2369 |
my ( $year, $month, $day ) = split /-/, $publisheddate; |
2346 |
|
2370 |
|