 +        return ($response, 1);
 +    }
 +
++    if ($cause =~ /slettet tidligere/) {
++        $sync->update( { 'sync' => 0 } );
++        return ($response, 1);
++    }
++
 +    # Something is wrong but we don't know how to handle it, so no point
 +    # in trying again.
 +    return ($response, 1);
  }
 
  =head2 NLGetChanged
-@@ -426,7 +524,7 @@ sub NLUpdateHashedPIN {
+@@ -426,7 +542,7 @@ sub NLUpdateHashedPIN {
      my $borrowersync = Koha::Database->new->schema->resultset('BorrowerSync')->find({
          'synctype'       => 'norwegianpatrondb',
          'borrowernumber' => $borrowernumber,


* Turn of sync if patron is allready deleted in NL


diff --git a/Koha/NorwegianPatronDB.pm b/Koha/NorwegianPatronDB.pm
index 237ddd7..378cfed 100644
--- a/Koha/NorwegianPatronDB.pm
+++ b/Koha/NorwegianPatronDB.pm
@@ -74,6 +74,7 @@ our %EXPORT_TAGS = ( all => [qw(

+        } elsif ( $sync->syncstatus eq 'delete' ) {
+            $response = $client->slett( $cardnumber );
         }
-    }
-    if ( $sync->syncstatus eq 'delete' ) {
-        $response = $client->slett( $cardnumber );
+
+        ($response, $ok) = _responseOK($sync, $response, $patron, $client);
+        last if $ok;
     }

-    # Update the sync data according to the results
-    if ( $response->{'status'} && $response->{'status'} == 1 ) {
