When running the tests a user is not logged in so C4::Context->userenv
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 12 Apr 2011 23:52:28 +0000 (11:52 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 12 Apr 2011 23:52:28 +0000 (11:52 +1200)
does not exist, stopping the tests erroring

C4/Accounts.pm

index 9540b44..0610c13 100644 (file)
@@ -352,7 +352,8 @@ should be the empty string.
 
 sub manualinvoice {
     my ( $borrowernumber, $itemnum, $desc, $type, $amount, $note ) = @_;
-    my $manager_id = C4::Context->userenv->{'number'};
+    my $manager_id = 0;
+    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv->{'number'};
     my $dbh      = C4::Context->dbh;
     my $notifyid = 0;
     my $insert;