| Lines 45-50
          BEGIN {
      
      
        Link Here | 
        
          | 45 |       &ReNewSubscription  &GetLateIssues      &GetLateOrMissingIssues | 45 |       &ReNewSubscription  &GetLateIssues      &GetLateOrMissingIssues | 
        
          | 46 |       &GetSerialInformation                   &AddItem2Serial | 46 |       &GetSerialInformation                   &AddItem2Serial | 
        
          | 47 |       &PrepareSerialsData &GetNextExpected    &ModNextExpected | 47 |       &PrepareSerialsData &GetNextExpected    &ModNextExpected | 
            
              |  |  | 48 |       &GetPreviousSerialid | 
        
          | 48 |  | 49 |  | 
        
          | 49 |       &UpdateClaimdateIssues | 50 |       &UpdateClaimdateIssues | 
        
          | 50 |       &GetSuppliersWithLateIssues             &getsupplierbyserialid | 51 |       &GetSuppliersWithLateIssues             &getsupplierbyserialid | 
  
    | Lines 858-863
          sub GetLatestSerials {
      
      
        Link Here | 
        
          | 858 |     return \@serials; | 859 |     return \@serials; | 
        
          | 859 | } | 860 | } | 
        
          | 860 |  | 861 |  | 
            
              |  |  | 862 | =head2 GetPreviousSerialid | 
            
              | 863 |  | 
            
              | 864 | $serialid = GetPreviousSerialid($subscriptionid, $nth) | 
            
              | 865 | get the $nth's previous serial for the given subscriptionid | 
            
              | 866 | return : | 
            
              | 867 | the serialid | 
            
              | 868 |  | 
            
              | 869 | =cut | 
            
              | 870 |  | 
            
              | 871 | sub GetPreviousSerialid { | 
            
              | 872 |     my ( $subscriptionid, $nth ) = @_; | 
            
              | 873 |     $nth ||= 1; | 
            
              | 874 |     my $dbh = C4::Context->dbh; | 
            
              | 875 |     my $return = undef; | 
            
              | 876 |  | 
            
              | 877 |     # Status 2: Arrived | 
            
              | 878 |     my $strsth = "SELECT   serialid | 
            
              | 879 |                         FROM     serial | 
            
              | 880 |                         WHERE    subscriptionid = ? | 
            
              | 881 |                         AND      status = 2 | 
            
              | 882 |                         ORDER BY serialid DESC LIMIT $nth,1  | 
            
              | 883 |                 "; | 
            
              | 884 |     my $sth = $dbh->prepare($strsth); | 
            
              | 885 |     $sth->execute($subscriptionid); | 
            
              | 886 |     my @serials; | 
            
              | 887 |     my $line = $sth->fetchrow_hashref; | 
            
              | 888 |     $return = $line->{'serialid'} if ($line); | 
            
              | 889 |  | 
            
              | 890 |     return $return; | 
            
              | 891 | } | 
            
              | 892 |  | 
            
              | 893 |  | 
            
              | 894 |  | 
        
          | 861 | =head2 GetDistributedTo | 895 | =head2 GetDistributedTo | 
        
          | 862 |  | 896 |  | 
        
          | 863 | $distributedto=GetDistributedTo($subscriptionid) | 897 | $distributedto=GetDistributedTo($subscriptionid) | 
  
    | Lines 1259-1265
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1259 |         $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2, | 1293 |         $whenmorethan1,   $setto1,          $lastvalue1,        $innerloop1,       $add2,          $every2,      $whenmorethan2, $setto2, | 
        
          | 1260 |         $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3, | 1294 |         $lastvalue2,      $innerloop2,      $add3,              $every3,           $whenmorethan3, $setto3,      $lastvalue3,    $innerloop3, | 
        
          | 1261 |         $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory, | 1295 |         $numberingmethod, $status,          $biblionumber,      $callnumber,       $notes,         $letter,      $hemisphere,    $manualhistory, | 
          
            
              | 1262 |         $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $subscriptionid | 1296 |         $internalnotes,   $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,    $enddate,       $itemtype, | 
            
              |  |  | 1297 | 	$ccode,           $origin,          $domain,            $previousitemtype, $subscriptionid | 
        
          | 1263 |     ) = @_; | 1298 |     ) = @_; | 
        
          | 1264 |  | 1299 |  | 
        
          | 1265 |     #     warn $irregularity; | 1300 |     #     warn $irregularity; | 
  
    | Lines 1273-1279
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1273 |                         numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?,  | 1308 |                         numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?,  | 
        
          | 1274 | 						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?, | 1309 | 						letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?, | 
        
          | 1275 | 						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ? | 1310 | 						staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ? | 
          
            
              | 1276 | 						,enddate=? | 1311 | 						,enddate=?, itemtype=?, ccode=?, origin=?, domain=?, previousitemtype = ? | 
        
          | 1277 |                     WHERE subscriptionid = ?"; | 1312 |                     WHERE subscriptionid = ?"; | 
        
          | 1278 |  | 1313 |  | 
        
          | 1279 |     #warn "query :".$query; | 1314 |     #warn "query :".$query; | 
  
    | Lines 1290-1299
          sub ModSubscription {
      
      
        Link Here | 
        
          | 1290 |         $numberingmethod, $status,         $biblionumber,   $callnumber, | 1325 |         $numberingmethod, $status,         $biblionumber,   $callnumber, | 
        
          | 1291 |         $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ), | 1326 |         $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ), | 
        
          | 1292 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 1327 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, | 
          
            
              | 1293 |         $graceperiod,   $location,        $enddate,           $subscriptionid | 1328 |         $graceperiod,   $location,        $enddate,         $itemtype, | 
            
              |  |  | 1329 | 	$ccode,         $origin,          $domain,          $previousitemtype, | 
            
              | 1330 | 	$subscriptionid | 
        
          | 1294 |     ); | 1331 |     ); | 
        
          | 1295 |     my $rows = $sth->rows; | 1332 |     my $rows = $sth->rows; | 
            
              | 1296 |  |  |  | 
        
          | 1297 |     logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); | 1333 |     logaction( "SERIAL", "MODIFY", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); | 
        
          | 1298 |     return $rows; | 1334 |     return $rows; | 
        
          | 1299 | } | 1335 | } | 
  
    | Lines 1321-1327
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1321 |         $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2, | 1357 |         $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2, | 
        
          | 1322 |         $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status, | 1358 |         $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, $status, | 
        
          | 1323 |         $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory, | 1359 |         $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory, | 
          
            
              | 1324 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate | 1360 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate,         $itemtype, | 
            
              |  |  | 1361 |         $ccode,         $origin,          $domain,            $previousitemtype | 
        
          | 1325 |     ) = @_; | 1362 |     ) = @_; | 
        
          | 1326 |     my $dbh = C4::Context->dbh; | 1363 |     my $dbh = C4::Context->dbh; | 
        
          | 1327 |  | 1364 |  | 
  
    | Lines 1335-1342
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1335 |             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3, | 1372 |             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3, | 
        
          | 1336 |             numberingmethod, status, notes, letter,firstacquidate,irregularity, | 1373 |             numberingmethod, status, notes, letter,firstacquidate,irregularity, | 
        
          | 1337 |             numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems, | 1374 |             numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems, | 
          
            
              | 1338 |             staffdisplaycount,opacdisplaycount,graceperiod,location,enddate) | 1375 |             staffdisplaycount,opacdisplaycount,graceperiod,location,enddate, itemtype, ccode, origin, domain, previousitemtype) | 
            
              | 1339 |         VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | 1376 |         VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) | 
        
          | 1340 |         |; | 1377 |         |; | 
        
          | 1341 |     my $sth = $dbh->prepare($query); | 1378 |     my $sth = $dbh->prepare($query); | 
        
          | 1342 |     $sth->execute( | 1379 |     $sth->execute( | 
  
    | Lines 1345-1351
          sub NewSubscription {
      
      
        Link Here | 
        
          | 1345 |         $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2, | 1382 |         $lastvalue1,    $innerloop1,      $add2,              $every2,           $whenmorethan2, $setto2,       $lastvalue2,      $innerloop2, | 
        
          | 1346 |         $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status", | 1383 |         $add3,          $every3,          $whenmorethan3,     $setto3,           $lastvalue3,    $innerloop3,   $numberingmethod, "$status", | 
        
          | 1347 |         $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory, | 1384 |         $notes,         $letter,          $firstacquidate,    $irregularity,     $numberpattern, $callnumber,   $hemisphere,      $manualhistory, | 
          
            
              | 1348 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate | 1385 |         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $location,     $enddate, 	  $itemtype, | 
            
              |  |  | 1386 | 	$ccode,         $origin,          $domain, $previousitemtype | 
        
          | 1349 |     ); | 1387 |     ); | 
        
          | 1350 |  | 1388 |  | 
        
          | 1351 |     my $subscriptionid = $dbh->{'mysql_insertid'}; | 1389 |     my $subscriptionid = $dbh->{'mysql_insertid'}; |