|
Lines 926-932
sub GetNextSeq {
Link Here
|
| 926 |
$newlastvalue1 = $val->{lastvalue1}; |
926 |
$newlastvalue1 = $val->{lastvalue1}; |
| 927 |
$newlastvalue2 = $val->{lastvalue2}; |
927 |
$newlastvalue2 = $val->{lastvalue2}; |
| 928 |
$newlastvalue3 = $val->{lastvalue3}; |
928 |
$newlastvalue3 = $val->{lastvalue3}; |
| 929 |
$newlastvalue1 = $val->{lastvalue1}; |
|
|
| 930 |
|
929 |
|
| 931 |
# check if we have to increase the new value. |
930 |
# check if we have to increase the new value. |
| 932 |
$newinnerloop1 = $val->{innerloop1} + 1; |
931 |
$newinnerloop1 = $val->{innerloop1} + 1; |
|
Lines 935-942
sub GetNextSeq {
Link Here
|
| 935 |
$newlastvalue1 = $val->{setto1} if ( $newlastvalue1 > $val->{whenmorethan1} ); # reset counter if needed. |
934 |
$newlastvalue1 = $val->{setto1} if ( $newlastvalue1 > $val->{whenmorethan1} ); # reset counter if needed. |
| 936 |
$calculated =~ s/\{X\}/$newlastvalue1/g; |
935 |
$calculated =~ s/\{X\}/$newlastvalue1/g; |
| 937 |
|
936 |
|
| 938 |
$newlastvalue2 = $val->{lastvalue2}; |
|
|
| 939 |
|
| 940 |
# check if we have to increase the new value. |
937 |
# check if we have to increase the new value. |
| 941 |
$newinnerloop2 = $val->{innerloop2} + 1; |
938 |
$newinnerloop2 = $val->{innerloop2} + 1; |
| 942 |
$newinnerloop2 = 0 if ( $newinnerloop2 >= $val->{every2} ); |
939 |
$newinnerloop2 = 0 if ( $newinnerloop2 >= $val->{every2} ); |
|
Lines 977-1005
the sequence in integer format
Link Here
|
| 977 |
=cut |
974 |
=cut |
| 978 |
|
975 |
|
| 979 |
sub GetSeq { |
976 |
sub GetSeq { |
| 980 |
my ($val) = @_; |
|
|
| 981 |
my $pattern = $val->{numberpattern}; |
| 982 |
my @seasons = ( 'nothing', 'Winter', 'Spring', 'Summer', 'Autumn' ); |
977 |
my @seasons = ( 'nothing', 'Winter', 'Spring', 'Summer', 'Autumn' ); |
| 983 |
my @southern_seasons = ( '', 'Summer', 'Autumn', 'Winter', 'Spring' ); |
978 |
my @southern_seasons = ( '', 'Summer', 'Autumn', 'Winter', 'Spring' ); |
|
|
979 |
|
| 980 |
my ($val) = @_; |
| 981 |
my $pattern = $val->{numberpattern}; |
| 984 |
my $calculated = $val->{numberingmethod}; |
982 |
my $calculated = $val->{numberingmethod}; |
| 985 |
my $x = $val->{'lastvalue1'}; |
983 |
my $x = $val->{'lastvalue1'}; |
| 986 |
$calculated =~ s/\{X\}/$x/g; |
984 |
my $y = $val->{'lastvalue2'}; |
| 987 |
my $newlastvalue2 = $val->{'lastvalue2'}; |
985 |
my $z = $val->{'lastvalue3'}; |
| 988 |
|
986 |
|
| 989 |
if ( $pattern == 6 ) { |
987 |
if ( $pattern == 6 ) { ## Seasons |
| 990 |
if ( $val->{hemisphere} == 2 ) { |
988 |
if ( $val->{hemisphere} == 2 ) { |
| 991 |
my $newlastvalue2seq = $southern_seasons[$newlastvalue2]; |
989 |
$y = $southern_seasons[$y]; |
| 992 |
$calculated =~ s/\{Y\}/$newlastvalue2seq/g; |
|
|
| 993 |
} else { |
990 |
} else { |
| 994 |
my $newlastvalue2seq = $seasons[$newlastvalue2]; |
991 |
$y = $seasons[$y]; |
| 995 |
$calculated =~ s/\{Y\}/$newlastvalue2seq/g; |
|
|
| 996 |
} |
992 |
} |
| 997 |
} else { |
|
|
| 998 |
$calculated =~ s/\{Y\}/$newlastvalue2/g; |
| 999 |
} |
993 |
} |
| 1000 |
my $z = $val->{'lastvalue3'}; |
994 |
|
|
|
995 |
$calculated =~ s/\{X\}/$x/g; |
| 996 |
$calculated =~ s/\{Y\}/$y/g; |
| 1001 |
$calculated =~ s/\{Z\}/$z/g; |
997 |
$calculated =~ s/\{Z\}/$z/g; |
| 1002 |
return $calculated; |
998 |
|
|
|
999 |
my $x_label = $val->{'serialseq_x_label'}; |
| 1000 |
my $y_label = $val->{'serialseq_y_label'}; |
| 1001 |
my $z_label = $val->{'serialseq_z_label'}; |
| 1002 |
$calculated =~ s/\{XL\}/$x_label/g; |
| 1003 |
$calculated =~ s/\{YL\}/$y_label/g; |
| 1004 |
$calculated =~ s/\{ZL\}/$z_label/g; |
| 1005 |
|
| 1006 |
return ( $calculated, $x, $y, $z ); |
| 1003 |
} |
1007 |
} |
| 1004 |
|
1008 |
|
| 1005 |
=head2 GetExpirationDate |
1009 |
=head2 GetExpirationDate |
|
Lines 1168-1174
sub ModSerialStatus {
Link Here
|
| 1168 |
|
1172 |
|
| 1169 |
# next date (calculated from actual date & frequency parameters) |
1173 |
# next date (calculated from actual date & frequency parameters) |
| 1170 |
my $nextpublisheddate = GetNextDate( $publisheddate, $val ); |
1174 |
my $nextpublisheddate = GetNextDate( $publisheddate, $val ); |
| 1171 |
NewIssue( $newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate, $nextpublisheddate ); |
1175 |
NewIssue( $newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate, $nextpublisheddate, undef, $newlastvalue1, $newlastvalue2, $newlastvalue3 ); |
| 1172 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
1176 |
$query = "UPDATE subscription SET lastvalue1=?, lastvalue2=?, lastvalue3=?, innerloop1=?, innerloop2=?, innerloop3=? |
| 1173 |
WHERE subscriptionid = ?"; |
1177 |
WHERE subscriptionid = ?"; |
| 1174 |
$sth = $dbh->prepare($query); |
1178 |
$sth = $dbh->prepare($query); |
|
Lines 1379-1392
sub NewSubscription {
Link Here
|
| 1379 |
my $val = $sth->fetchrow_hashref; |
1383 |
my $val = $sth->fetchrow_hashref; |
| 1380 |
|
1384 |
|
| 1381 |
# calculate issue number |
1385 |
# calculate issue number |
| 1382 |
my $serialseq = GetSeq($val); |
1386 |
my ( $serialseq, $x, $y, $z ) = GetSeq($val); |
| 1383 |
$query = qq| |
1387 |
$query = qq| |
| 1384 |
INSERT INTO serial |
1388 |
INSERT INTO serial |
| 1385 |
(serialseq,subscriptionid,biblionumber,status, planneddate, publisheddate) |
1389 |
(serialseq,serialseq_x,serialseq_y,serialseq_z,subscriptionid,biblionumber,status, planneddate, publisheddate) |
| 1386 |
VALUES (?,?,?,?,?,?) |
1390 |
VALUES (?,?,?,?,?,?,?,?,?) |
| 1387 |
|; |
1391 |
|; |
| 1388 |
$sth = $dbh->prepare($query); |
1392 |
$sth = $dbh->prepare($query); |
| 1389 |
$sth->execute( "$serialseq", $subscriptionid, $biblionumber, 1, $firstacquidate, $firstacquidate ); |
1393 |
$sth->execute( $serialseq, $x, $y, $z, $subscriptionid, $biblionumber, 1, $firstacquidate, $firstacquidate ); |
| 1390 |
|
1394 |
|
| 1391 |
logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); |
1395 |
logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); |
| 1392 |
|
1396 |
|
|
Lines 1478-1494
returns the serial id
Link Here
|
| 1478 |
=cut |
1482 |
=cut |
| 1479 |
|
1483 |
|
| 1480 |
sub NewIssue { |
1484 |
sub NewIssue { |
| 1481 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes ) = @_; |
1485 |
my ( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes, $x, $y, $z ) = @_; |
|
|
1486 |
warn "NewIssue( $serialseq, $subscriptionid, $biblionumber, $status, $planneddate, $publisheddate, $notes, $x, $y, $z )"; |
| 1482 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
1487 |
### FIXME biblionumber CAN be provided by subscriptionid. So Do we STILL NEED IT ? |
| 1483 |
|
1488 |
|
| 1484 |
my $dbh = C4::Context->dbh; |
1489 |
my $dbh = C4::Context->dbh; |
| 1485 |
my $query = qq| |
1490 |
my $query = qq| |
| 1486 |
INSERT INTO serial |
1491 |
INSERT INTO serial |
| 1487 |
(serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes) |
1492 |
(serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate,notes,serialseq_x,serialseq_y,serialseq_z) |
| 1488 |
VALUES (?,?,?,?,?,?,?) |
1493 |
VALUES (?,?,?,?,?,?,?,?,?,?) |
| 1489 |
|; |
1494 |
|; |
| 1490 |
my $sth = $dbh->prepare($query); |
1495 |
my $sth = $dbh->prepare($query); |
| 1491 |
$sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes ); |
1496 |
$sth->execute( $serialseq, $subscriptionid, $biblionumber, $status, $publisheddate, $planneddate, $notes, $x, $y, $z ); |
| 1492 |
my $serialid = $dbh->{'mysql_insertid'}; |
1497 |
my $serialid = $dbh->{'mysql_insertid'}; |
| 1493 |
$query = qq| |
1498 |
$query = qq| |
| 1494 |
SELECT missinglist,recievedlist |
1499 |
SELECT missinglist,recievedlist |