warn on attempts to add duplicate item barcodes during batch import
[koha.git] / C4 / Accounts.pm
old mode 100755 (executable)
new mode 100644 (file)
index 945c8ed..7fe1df0
@@ -17,7 +17,6 @@ package C4::Accounts;
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id$
 
 use strict;
 require Exporter;
@@ -29,9 +28,7 @@ use C4::Members;
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g;
-    shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v );
-};
+$VERSION = 3.00;
 
 =head1 NAME
 
@@ -270,7 +267,7 @@ EOT
 sub returnlost {
     my ( $borrowernumber, $itemnum ) = @_;
     my $dbh      = C4::Context->dbh;
-    my $borrower = GetMember( $borrowernumber, 'borrowernumber' );
+    my $borrower = C4::Members::GetMember( $borrowernumber, 'borrowernumber' );
     my $sth      = $dbh->prepare(
         "UPDATE issues SET returndate=now() WHERE
   borrowernumber=? AND itemnumber=? AND returndate IS NULL"
@@ -357,22 +354,17 @@ sub manualinvoice {
         my $sth = $dbh->prepare(
             "INSERT INTO  accountlines
                         (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id)
-        VALUES (?, ?, now(), ?,?, ?,?,?,?)"
-        );
-
-#     $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $data->{'itemnumber'});
-        $sth->execute( $borrowernumber, $accountno, $amount, $desc, $type,
-            $amountleft, $itemnum, $notifyid );
-    }
-    else {
-        my $sth = $dbh->prepare(
-            "INSERT INTO  accountlines
+        VALUES (?, ?, now(), ?,?, ?,?,?,?)");
+     $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid) || return $sth->errstr;
+  } else {
+    my $sth=$dbh->prepare("INSERT INTO  accountlines
             (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding,notify_id)
             VALUES (?, ?, now(), ?, ?, ?, ?,?)"
         );
         $sth->execute( $borrowernumber, $accountno, $amount, $desc, $type,
             $amountleft, $notifyid );
     }
+    return 0;
 }
 
 =head2 fixcredit