| 
      
            Lines 2129-2134
          routine in C<C4::Accounts>.
      
      
        Link Here
      
     | 
  
        
          | 2129 | 
          sub MarkIssueReturned { | 
          2129 | 
          sub MarkIssueReturned { | 
        
        
          | 2130 | 
              my ( $borrowernumber, $itemnumber, $dropbox_branch, $returndate, $privacy ) = @_;  | 
          2130 | 
              my ( $borrowernumber, $itemnumber, $dropbox_branch, $returndate, $privacy ) = @_;  | 
        
        
          | 2131 | 
           | 
          2131 | 
           | 
        
            
               | 
               | 
              2132 | 
               | 
            
            
              | 2133 | 
                  # Retrieve the issue  | 
            
            
              | 2134 | 
                  my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } ) or return; | 
            
            
              | 2135 | 
                  my $issue_id = $issue->issue_id;  | 
            
            
              | 2136 | 
               | 
            
        
          | 2132 | 
              my $anonymouspatron;  | 
          2137 | 
              my $anonymouspatron;  | 
        
        
          | 2133 | 
              if ( $privacy == 2 ) { | 
          2138 | 
              if ( $privacy == 2 ) { | 
        
        
          | 2134 | 
                  # The default of 0 will not work due to foreign key constraints  | 
          2139 | 
                  # The default of 0 will not work due to foreign key constraints  | 
        
  
    | 
      
            Lines 2143-2153
          sub MarkIssueReturned {
      
      
        Link Here
      
     | 
  
        
          | 2143 | 
              my $schema   = $database->schema;  | 
          2148 | 
              my $schema   = $database->schema;  | 
        
        
          | 2144 | 
              my $dbh   = C4::Context->dbh;  | 
          2149 | 
              my $dbh   = C4::Context->dbh;  | 
        
        
          | 2145 | 
           | 
          2150 | 
           | 
        
            
              | 2146 | 
                  my $issue_id = $dbh->selectrow_array(  | 
               | 
               | 
            
            
              | 2147 | 
                      q|SELECT issue_id FROM issues WHERE itemnumber = ?|,  | 
            
            
              | 2148 | 
                      undef, $itemnumber  | 
            
            
              | 2149 | 
                  );  | 
            
            
              | 2150 | 
               | 
            
        
          | 2151 | 
              my $query = 'UPDATE issues SET returndate=';  | 
          2151 | 
              my $query = 'UPDATE issues SET returndate=';  | 
        
        
          | 2152 | 
              my @bind;  | 
          2152 | 
              my @bind;  | 
        
        
          | 2153 | 
              if ($dropbox_branch) { | 
          2153 | 
              if ($dropbox_branch) { | 
        
  
    | 
      
            Lines 2170-2178
          sub MarkIssueReturned {
      
      
        Link Here
      
     | 
  
        
          | 2170 | 
                  # Update the returndate  | 
          2170 | 
                  # Update the returndate  | 
        
        
          | 2171 | 
                  $dbh->do( $query, undef, @bind );  | 
          2171 | 
                  $dbh->do( $query, undef, @bind );  | 
        
        
          | 2172 | 
           | 
          2172 | 
           | 
        
            
              | 2173 | 
                      # Retrieve the issue  | 
               | 
               | 
            
            
              | 2174 | 
                      my $issue = Koha::Checkouts->find( $issue_id ); # FIXME should be fetched earlier  | 
            
            
              | 2175 | 
               | 
            
        
          | 2176 | 
                  # Create the old_issues entry  | 
          2173 | 
                  # Create the old_issues entry  | 
        
        
          | 2177 | 
                  my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store;  | 
          2174 | 
                  my $old_checkout = Koha::Old::Checkout->new($issue->unblessed)->store;  | 
        
        
          | 2178 | 
           | 
          2175 | 
           | 
        
            
              | 2179 | 
              -   | 
               | 
               |