[Koha-patches] [PATCH] Remove 'Cash Refund' from manual invoice, as it calls a deprecated function. Change the code for 'forgiven' from 'F' to 'FOR', since 'F' is used for 'Fine' elsewhere in the code. Mark other subroutines as deprecated that utilize the accountoffsets table, since that functionality was lost somewhere in the 2.2 series, and half-using it breaks things.

Ryan Higgins rch at liblime.com
Thu Jul 24 03:02:21 CEST 2008


---
 C4/Accounts.pm                                     |   78 ++++++++++++--------
 .../prog/en/modules/members/mancredit.tmpl         |    2 +-
 .../prog/en/modules/members/maninvoice.tmpl        |    1 -
 3 files changed, 47 insertions(+), 34 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index e4a745a..3a57154 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -73,7 +73,7 @@ will be credited to the next one.
 #'
 sub recordpayment {
 
-    #here we update both the accountoffsets and the account lines
+    #here we update the account lines
     my ( $borrowernumber, $data ) = @_;
     my $dbh        = C4::Context->dbh;
     my $newamtos   = 0;
@@ -109,13 +109,13 @@ sub recordpayment {
         );
         $usth->execute( $newamtos, $borrowernumber, $thisacct );
         $usth->finish;
-        $usth = $dbh->prepare(
-            "INSERT INTO accountoffsets
-     (borrowernumber, accountno, offsetaccount,  offsetamount)
-     VALUES (?,?,?,?)"
-        );
-        $usth->execute( $borrowernumber, $accdata->{'accountno'},
-            $nextaccntno, $newamtos );
+#        $usth = $dbh->prepare(
+#            "INSERT INTO accountoffsets
+#     (borrowernumber, accountno, offsetaccount,  offsetamount)
+#     VALUES (?,?,?,?)"
+#        );
+#        $usth->execute( $borrowernumber, $accdata->{'accountno'},
+#            $nextaccntno, $newamtos );
         $usth->finish;
     }
 
@@ -176,12 +176,12 @@ sub makepayment {
     );
 
     #  print $updquery;
-    $dbh->do( "
-        INSERT INTO     accountoffsets
-                        (borrowernumber, accountno, offsetaccount,
-                         offsetamount)
-        VALUES          ($borrowernumber, $accountno, $nextaccntno, $newamtos)
-        " );
+#    $dbh->do( "
+#        INSERT INTO     accountoffsets
+#                        (borrowernumber, accountno, offsetaccount,
+#                         offsetamount)
+#        VALUES          ($borrowernumber, $accountno, $nextaccntno, $newamtos)
+#        " );
 
     # create new line
     my $payment = 0 - $amount;
@@ -287,7 +287,17 @@ should be the empty string.
 =cut
 
 #'
-# FIXME - Okay, so what does this function do, really?
+# FIXME: In Koha 3.0 , the only account adjustment 'types' passed to this function
+# are :  
+# 		'C' = CREDIT
+# 		'FOR' = FORGIVEN  (Formerly 'F', but 'F' is taken to mean 'FINE' elsewhere)
+# 		'N' = New Card fee
+# 		'F' = Fine
+# 		'A' = Account Management fee
+# 		'M' = Sundry
+# 		'L' = Lost Item
+#
+
 sub manualinvoice {
     my ( $borrowernumber, $itemnum, $desc, $type, $amount, $user ) = @_;
     my $dbh      = C4::Context->dbh;
@@ -297,16 +307,16 @@ sub manualinvoice {
     my $accountno  = getnextacctno($borrowernumber);
     my $amountleft = $amount;
 
-    if (   $type eq 'CS'
-        || $type eq 'CB'
-        || $type eq 'CW'
-        || $type eq 'CF'
-        || $type eq 'CL' )
-    {
-        my $amount2 = $amount * -1;    # FIXME - $amount2 = -$amount
-        $amountleft =
-          fixcredit( $borrowernumber, $amount2, $itemnum, $type, $user );
-    }
+#    if (   $type eq 'CS'
+#        || $type eq 'CB'
+#        || $type eq 'CW'
+#        || $type eq 'CF'
+#        || $type eq 'CL' )
+#    {
+#        my $amount2 = $amount * -1;    # FIXME - $amount2 = -$amount
+#        $amountleft =
+#          fixcredit( $borrowernumber, $amount2, $itemnum, $type, $user );
+#    }
     if ( $type eq 'N' ) {
         $desc .= " New Card";
     }
@@ -324,10 +334,10 @@ sub manualinvoice {
 
         $desc = " Lost Item";
     }
-    if ( $type eq 'REF' ) {
-        $desc .= " Cash Refund";
-        $amountleft = refund( '', $borrowernumber, $amount );
-    }
+#    if ( $type eq 'REF' ) {
+#        $desc .= " Cash Refund";
+#        $amountleft = refund( '', $borrowernumber, $amount );
+#    }
     if (   ( $type eq 'L' )
         or ( $type eq 'F' )
         or ( $type eq 'A' )
@@ -355,15 +365,16 @@ sub manualinvoice {
     return 0;
 }
 
-=head2 fixcredit
+=head2 fixcredit #### DEPRECATED
 
  $amountleft = &fixcredit($borrowernumber, $data, $barcode, $type, $user);
 
  This function is only used internally, not exported.
- FIXME - Figure out what this function does, and write it down.
 
 =cut
 
+# This function is deprecated in 3.0
+
 sub fixcredit {
 
     #here we update both the accountoffsets and the account lines
@@ -466,7 +477,10 @@ sub fixcredit {
 
 =head2 refund
 
-# FIXME - Figure out what this function does, and write it down.
+#FIXME : DEPRECATED SUB
+ This subroutine tracks payments and/or credits against fines/charges
+   using the accountoffsets table, which is not used consistently in
+   Koha's fines management, and so is not used in 3.0 
 
 =cut 
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl
index a72e320..aa0e0bf 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tmpl
@@ -32,7 +32,7 @@
 <legend>Manual Credit</legend><ol>
 	<li><label for="type">Credit Type: </label><select name="type" id="type">
 <option value="C">Credit</option>
-<option value="F">Forgiven</option>
+<option value="FOR">Forgiven</option>
 </select></li>
 	<li><label for="itemnum">Itemnumber: </label><input type="text" name="itemnum" id="itemnum" /></li>
 	<li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl
index d59f85e..c84b212 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tmpl
@@ -40,7 +40,6 @@
 <option value="A">Account Management Fee</option>
 <option value="N">New Card</option>
 <option value="M">Sundry</option>
-<option value="REF">Cash Refund</option>
 </select></li>
 	<li><label for="itemnum">Itemnumber: </label><input type="text" name="itemnum" id="itemnum" /></li>
 	<li><label for="desc">Description: </label><input type="text" name="desc" id="desc" size="50" /></li>
-- 
1.5.5.GIT




More information about the Koha-patches mailing list