Bug 23355: Rename staff_id for manager_id
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 3 Mar 2020 13:50:44 +0000 (10:50 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 3 Mar 2020 15:03:02 +0000 (15:03 +0000)
This patch makes the parameter naming more consistent and also fixes the
tests (there was a missmatch on the parameter naming, and tests count
was incorrect).

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Cash/Register.pm
pos/register.pl
t/db_dependent/Koha/Account/Line.t
t/db_dependent/Koha/Cash/Register.t

index a070c98..ac14db6 100644 (file)
@@ -209,6 +209,13 @@ sub drop_default {
 
 =head3 add_cashup
 
+    my $action = $cash_register->add_cashup(
+        {
+            manager_id => $logged_in_user->id,
+            amount     => $cash_register->outstanding_accountlines->total
+        }
+    );
+
 Add a new cashup action to the till, returns the added action.
 
 =cut
@@ -219,7 +226,7 @@ sub add_cashup {
     my $rs = $self->_result->add_to_cash_register_actions(
         {
             code       => 'CASHUP',
-            manager_id => $params->{staff_id},
+            manager_id => $params->{manager_id},
             amount     => $params->{amount}
         }
     )->discard_changes;
index 5002d9e..6e2e73b 100755 (executable)
@@ -73,8 +73,8 @@ else {
     if ( $op eq 'cashup' ) {
         $cash_register->add_cashup(
             {
-                staff_id => $logged_in_user->id,
-                amount   => $cash_register->outstanding_accountlines->total
+                manager_id => $logged_in_user->id,
+                amount     => $cash_register->outstanding_accountlines->total
             }
         );
     }
index d62a38d..1c28f56 100644 (file)
@@ -19,7 +19,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 8;
+use Test::More tests => 11;
 use Test::Exception;
 
 use C4::Circulation qw/AddIssue AddReturn/;
index 567e125..dbac2b2 100644 (file)
@@ -160,7 +160,7 @@ subtest 'cashup' => sub {
 
         ok(
             $cashup1 = $register->add_cashup(
-                { user_id => $patron->id, amount => '12.00' }
+                { manager_id => $patron->id, amount => '12.00' }
             ),
             'call successfull'
         );
@@ -184,7 +184,7 @@ subtest 'cashup' => sub {
         plan tests => 3;
 
         my $cashup2 =
-          $register->add_cashup( { user_id => $patron->id, amount => '6.00' } );
+          $register->add_cashup( { manager_id => $patron->id, amount => '6.00' } );
 
         my $last_cashup = $register->last_cashup;
         is(
@@ -220,7 +220,7 @@ subtest 'cashup' => sub {
         is( $accountlines->count, 2, 'No cashup, all accountlines returned' );
 
         my $cashup3 =
-          $register->add_cashup( { user_id => $patron->id, amount => '2.50' } );
+          $register->add_cashup( { manager_id => $patron->id, amount => '2.50' } );
 
         $accountlines = $register->outstanding_accountlines;
         is( $accountlines->count, 0, 'Cashup added, no accountlines returned' );