 +            if ( $response->{'status'} && $response->{'status'} == 1 || ($cause && $cause =~ /Oppdaterte felt/)) {
 +                $sync->update( { 'syncstatus' => 'synced', 'lastsync' => $response->{'server_tid'} } );
 +            }
++        } elsif ($cause =~ /Person med gitt fnr finnes allerede i registeret/) {
++            # TODO patron exists with Høgskolekort. Don't know what to do with it.
 +        }
-+
      }
      return $response;
 
-@@ -564,6 +610,23 @@ sub _format_soap_error {
+@@ -426,7 +479,7 @@ sub NLUpdateHashedPIN {
+     my $borrowersync = Koha::Database->new->schema->resultset('BorrowerSync')->find({
+         'synctype'       => 'norwegianpatrondb',
+         'borrowernumber' => $borrowernumber,
+-        });
++    });
+     return $borrowersync->update({ 'hashed_pin', _encrypt_pin( $pin ) });
+
+ }
+@@ -564,6 +617,23 @@ sub _format_soap_error {
 
  }
 

         'dateofbirth'  => scalar $cgi->param('fdato'),
         'cardnumber'   => scalar $cgi->param('lnr'),
         'userid'       => scalar $cgi->param('lnr'),
@@ -118,13 +118,12 @@ if ( $op && $op eq 'search' ) {
         'address2'     => scalar $cgi->param('p_adresse2'),
         'zipcode'      => scalar $cgi->param('p_postnr'),
         'city'         => scalar $cgi->param('p_sted'),

+            # without checking if they allready exist in NL.
+            # We set syncstatus to 'edited', so that it might be correctly synced next time.
+            # The lastsync value is arbritary, and will be corrected on next iteration
+            my $now = `date +"%Y-%m-%dT%T"`;
+            chomp($now);
+            $sync->update( { 'syncstatus' => 'edited', 'lastsync' => $now } );
+        } elsif ($cause =~ /lnr finnes ikke i registeret/) {
+            # Make sure syncstatus is 'new'
+            $sync->update( { 'syncstatus' => 'new' } );
+        } elsif ($cause =~ /Mangler verdi for sist_endret/) {
+            my $now = `date +"%Y-%m-%dT%T"`;
+            chomp($now);
+            $sync->update( { 'lastsync' => $now } );
+        } elsif ($cause =~ /SIST_ENDRET/) {
+            # NL has different timestamp; returnin an error like this:
+            #  endre: Uoverensstemmelse med gjeldende data i basen:
