Merge branch 'trivial_bugs' of git://git.koha-community.org/wip/koha-fbc into kcmaster
[koha_gimpoz] / C4 / Accounts.pm
index e137587..d73fc2e 100644 (file)
@@ -13,12 +13,13 @@ package C4::Accounts;
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
 use strict;
+#use warnings; FIXME - Bug 2505
 use C4::Context;
 use C4::Stats;
 use C4::Members;
@@ -266,7 +267,7 @@ EOT
 sub returnlost{
     my ( $borrowernumber, $itemnum ) = @_;
     C4::Circulation::MarkIssueReturned( $borrowernumber, $itemnum );
-    my $borrower = C4::Members::GetMember( $borrowernumber, 'borrowernumber' );
+    my $borrower = C4::Members::GetMember( 'borrowernumber'=>$borrowernumber );
     my @datearr = localtime(time);
     my $date = ( 1900 + $datearr[5] ) . "-" . ( $datearr[4] + 1 ) . "-" . $datearr[3];
     my $bor = "$borrower->{'firstname'} $borrower->{'surname'} $borrower->{'cardnumber'}";
@@ -275,7 +276,6 @@ sub returnlost{
 
 
 sub chargelostitem{
-# http://wiki.koha.org/doku.php?id=en:development:kohastatuses
 # lost ==1 Lost, lost==2 longoverdue, lost==3 lost and paid for
 # FIXME: itemlost should be set to 3 after payment is made, should be a warning to the interface that
 # a charge has been added
@@ -283,7 +283,11 @@ sub chargelostitem{
    
     my $dbh = C4::Context->dbh();
     my ($itemnumber) = @_;
-    my $sth=$dbh->prepare("SELECT * FROM issues, items WHERE issues.itemnumber=items.itemnumber and  issues.itemnumber=?");
+    my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title 
+                           FROM issues 
+                           JOIN items USING (itemnumber) 
+                           JOIN biblio USING (biblionumber)
+                           WHERE issues.itemnumber=?");
     $sth->execute($itemnumber);
     my $issues=$sth->fetchrow_hashref();
 
@@ -315,7 +319,7 @@ sub chargelostitem{
         warn " $issues->{'borrowernumber'}  /  $itemnumber ";
         C4::Circulation::MarkIssueReturned($issues->{borrowernumber},$itemnumber);
        #  Shouldn't MarkIssueReturned do this?
-        ModItem({ onloan => undef }, undef, $itemnumber);
+        C4::Items::ModItem({ onloan => undef }, undef, $itemnumber);
     }
     $sth->finish;
 }