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