| Lines 74-79
          BEGIN {
      
      
        Link Here | 
        
          | 74 |       &ReNewSubscription  &GetLateOrMissingIssues | 74 |       &ReNewSubscription  &GetLateOrMissingIssues | 
        
          | 75 |       &GetSerialInformation                   &AddItem2Serial | 75 |       &GetSerialInformation                   &AddItem2Serial | 
        
          | 76 |       &PrepareSerialsData &GetNextExpected    &ModNextExpected | 76 |       &PrepareSerialsData &GetNextExpected    &ModNextExpected | 
            
              |  |  | 77 |       &GetPreviousSerialid | 
        
          | 77 |  | 78 |  | 
        
          | 78 |       &UpdateClaimdateIssues | 79 |       &UpdateClaimdateIssues | 
        
          | 79 |       &GetSuppliersWithLateIssues             &getsupplierbyserialid | 80 |       &GetSuppliersWithLateIssues             &getsupplierbyserialid | 
  
    | Lines 832-837
          sub GetLatestSerials {
      
      
        Link Here | 
        
          | 832 |     return \@serials; | 833 |     return \@serials; | 
        
          | 833 | } | 834 | } | 
        
          | 834 |  | 835 |  | 
            
              |  |  | 836 | =head2 GetPreviousSerialid | 
            
              | 837 |  | 
            
              | 838 | $serialid = GetPreviousSerialid($subscriptionid, $nth) | 
            
              | 839 | get the $nth's previous serial for the given subscriptionid | 
            
              | 840 | return : | 
            
              | 841 | the serialid | 
            
              | 842 |  | 
            
              | 843 | =cut | 
            
              | 844 |  | 
            
              | 845 | sub GetPreviousSerialid { | 
            
              | 846 |     my ( $subscriptionid, $nth ) = @_; | 
            
              | 847 |     $nth ||= 1; | 
            
              | 848 |     my $dbh = C4::Context->dbh; | 
            
              | 849 |     my $return = undef; | 
            
              | 850 |  | 
            
              | 851 |     # Status 2: Arrived | 
            
              | 852 |     my $strsth = "SELECT   serialid | 
            
              | 853 |                         FROM     serial | 
            
              | 854 |                         WHERE    subscriptionid = ? | 
            
              | 855 |                         AND      status = 2 | 
            
              | 856 |                         ORDER BY serialid DESC LIMIT $nth,1 | 
            
              | 857 |                 "; | 
            
              | 858 |     my $sth = $dbh->prepare($strsth); | 
            
              | 859 |     $sth->execute($subscriptionid); | 
            
              | 860 |     my @serials; | 
            
              | 861 |     my $line = $sth->fetchrow_hashref; | 
            
              | 862 |     $return = $line->{'serialid'} if ($line); | 
            
              | 863 |  | 
            
              | 864 |     return $return; | 
            
              | 865 | } | 
            
              | 866 |  | 
            
              | 867 |  | 
            
              | 868 |  | 
        
          | 835 | =head2 GetDistributedTo | 869 | =head2 GetDistributedTo | 
        
          | 836 |  | 870 |  | 
        
          | 837 | $distributedto=GetDistributedTo($subscriptionid) | 871 | $distributedto=GetDistributedTo($subscriptionid) | 
  
    | Lines 1331-1337
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1331 |     $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, | 1365 |     $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, | 
        
          | 1332 |     $biblionumber, $callnumber, $notes, $letter, $manualhistory, | 1366 |     $biblionumber, $callnumber, $notes, $letter, $manualhistory, | 
        
          | 1333 |     $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 1367 |     $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 
          
            
              | 1334 |     $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq | 1368 |     $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, | 
            
              |  |  | 1369 |     $itemtype, $previousitemtype | 
        
          | 1335 |     ) = @_; | 1370 |     ) = @_; | 
        
          | 1336 |  | 1371 |  | 
        
          | 1337 |     my $dbh   = C4::Context->dbh; | 1372 |     my $dbh   = C4::Context->dbh; | 
  
    | Lines 1344-1350
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1344 |             callnumber=?, notes=?, letter=?, manualhistory=?, | 1379 |             callnumber=?, notes=?, letter=?, manualhistory=?, | 
        
          | 1345 |             internalnotes=?, serialsadditems=?, staffdisplaycount=?, | 1380 |             internalnotes=?, serialsadditems=?, staffdisplaycount=?, | 
        
          | 1346 |             opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, | 1381 |             opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, | 
          
            
              | 1347 |             skip_serialseq=? | 1382 |             skip_serialseq=?, itemtype=?, previousitemtype=? | 
        
          | 1348 |         WHERE subscriptionid = ?"; | 1383 |         WHERE subscriptionid = ?"; | 
        
          | 1349 |  | 1384 |  | 
        
          | 1350 |     my $sth = $dbh->prepare($query); | 1385 |     my $sth = $dbh->prepare($query); | 
  
    | Lines 1358-1363
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1358 |         $letter,          ($manualhistory ? $manualhistory : 0), | 1393 |         $letter,          ($manualhistory ? $manualhistory : 0), | 
        
          | 1359 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 1394 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 
        
          | 1360 |         $graceperiod,     $location,       $enddate,        $skip_serialseq, | 1395 |         $graceperiod,     $location,       $enddate,        $skip_serialseq, | 
            
              |  |  | 1396 |         $itemtype,        $previousitemtype, | 
        
          | 1361 |         $subscriptionid | 1397 |         $subscriptionid | 
        
          | 1362 |     ); | 1398 |     ); | 
        
          | 1363 |     my $rows = $sth->rows; | 1399 |     my $rows = $sth->rows; | 
  
    | Lines 1373-1379
          $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
      
      
        Link Here | 
        
          | 1373 |     $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3, | 1409 |     $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3, | 
        
          | 1374 |     $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, | 1410 |     $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, | 
        
          | 1375 |     $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, | 1411 |     $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, | 
          
            
              | 1376 |     $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq); | 1412 |     $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, | 
            
              |  |  | 1413 |     $skip_serialseq, $itemtype, $previousitemtype); | 
        
          | 1377 |  | 1414 |  | 
        
          | 1378 | Create a new subscription with value given on input args. | 1415 | Create a new subscription with value given on input args. | 
        
          | 1379 |  | 1416 |  | 
  
    | Lines 1390-1396
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1390 |     $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, | 1427 |     $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, | 
        
          | 1391 |     $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, | 1428 |     $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, | 
        
          | 1392 |     $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, | 1429 |     $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, | 
          
            
              | 1393 |     $location, $enddate, $skip_serialseq | 1430 |     $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype | 
        
          | 1394 |     ) = @_; | 1431 |     ) = @_; | 
        
          | 1395 |     my $dbh = C4::Context->dbh; | 1432 |     my $dbh = C4::Context->dbh; | 
        
          | 1396 |  | 1433 |  | 
  
    | Lines 1403-1410
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1403 |             lastvalue3, innerloop3, status, notes, letter, firstacquidate, | 1440 |             lastvalue3, innerloop3, status, notes, letter, firstacquidate, | 
        
          | 1404 |             irregularity, numberpattern, locale, callnumber, | 1441 |             irregularity, numberpattern, locale, callnumber, | 
        
          | 1405 |             manualhistory, internalnotes, serialsadditems, staffdisplaycount, | 1442 |             manualhistory, internalnotes, serialsadditems, staffdisplaycount, | 
          
            
              | 1406 |             opacdisplaycount, graceperiod, location, enddate, skip_serialseq) | 1443 |             opacdisplaycount, graceperiod, location, enddate, skip_serialseq, | 
            
              | 1407 |         VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | 1444 |             itemtype, previousitemtype) | 
            
              |  |  | 1445 |         VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | 
        
          | 1408 |         |; | 1446 |         |; | 
        
          | 1409 |     my $sth = $dbh->prepare($query); | 1447 |     my $sth = $dbh->prepare($query); | 
        
          | 1410 |     $sth->execute( | 1448 |     $sth->execute( | 
  
    | Lines 1414-1420
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1414 |         $lastvalue3, $innerloop3, $status, $notes, $letter, | 1452 |         $lastvalue3, $innerloop3, $status, $notes, $letter, | 
        
          | 1415 |         $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, | 1453 |         $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, | 
        
          | 1416 |         $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, | 1454 |         $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, | 
          
            
              | 1417 |         $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq | 1455 |         $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, | 
            
              |  |  | 1456 |         $itemtype, $previousitemtype | 
        
          | 1418 |     ); | 1457 |     ); | 
        
          | 1419 |  | 1458 |  | 
        
          | 1420 |     my $subscriptionid = $dbh->{'mysql_insertid'}; | 1459 |     my $subscriptionid = $dbh->{'mysql_insertid'}; |