Bug 8435: (follow-up) add unit tests for can_edit_subscription
[koha.git] / offline_circ / service.pl
index 38f46d8..771d459 100755 (executable)
@@ -29,6 +29,7 @@ my $cgi = CGI->new;
 
 # get the status of the user, this will check his credentials and rights
 my ($status, $cookie, $sessionId) = C4::Auth::check_api_auth($cgi, undef);
+($status, $sessionId) = C4::Auth::check_cookie_auth($cgi, undef) if ($status ne 'ok');
 
 my $result;
 
@@ -39,6 +40,7 @@ if ($status eq 'ok') { # if authentication is ok
     my $timestamp  = $cgi->param('timestamp')  || '';
     my $action     = $cgi->param('action')     || '';
     my $barcode    = $cgi->param('barcode')    || '';
+    my $amount     = $cgi->param('amount')     || 0;
     $barcode    =~ s/^\s+//;
     $barcode    =~ s/\s+$//;
     my $cardnumber = $cgi->param('cardnumber') || '';
@@ -53,6 +55,7 @@ if ($status eq 'ok') { # if authentication is ok
             $action,
             $barcode,
             $cardnumber,
+            $amount
         );
     } else {
         $result = ProcessOfflineOperation(
@@ -63,6 +66,7 @@ if ($status eq 'ok') { # if authentication is ok
                 'action'      => $action,
                 'barcode'     => $barcode,
                 'cardnumber'  => $cardnumber,
+                'amount'      => $amount
             }
         );
     }