Bug 18501: (QA follow-up) Remove FIXME + Track issue_id
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 14 Aug 2020 10:53:59 +0000 (11:53 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 20 Aug 2020 10:31:59 +0000 (12:31 +0200)
We correct some compilation errors here by updating the transfered
_FixAccountForLostAndFound method to use $self references.  We add
issue_id tracking so that future reports can clearly see how a refund
relates to the original charge and finally we remove a FIXME as I agree
that the 'discard_changes' call is not required.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Item.pm

index f2ca45d..ff6a4d5 100644 (file)
@@ -864,11 +864,12 @@ sub _set_found_trigger {
         $credit = $account->add_credit(
             {
                 amount      => $credit_total,
-                description => 'Item found ' . $item_id,
+                description => 'Item found ' . $self->itemnumber,
                 type        => 'LOST_FOUND',
                 interface   => C4::Context->interface,
                 library_id  => $branchcode,
-                item_id     => $itemnumber
+                item_id     => $self->itemnumber,
+                issue_id    => $accountline->issue_id
             }
         );
 
@@ -877,8 +878,7 @@ sub _set_found_trigger {
     }
 
     # Update the account status
-    $accountline->discard_changes->status('FOUND')
-      ; # FIXME JD Why discard_changes? $accountline has not been modified since last fetch
+    $accountline->status('FOUND');
     $accountline->store;
 
     if ( defined $account and C4::Context->preference('AccountAutoReconcile') ) {