- my ( $colId, $itemnumber ) = @_;
-
- ## Check for all neccessary parameters
- if ( ! $colId ) {
- return ( 0, 1, "No Collection Given" );
- }
- if ( ! $itemnumber ) {
- return ( 0, 2, "No Itemnumber Given" );
- }
-
- if ( isItemInThisCollection( $itemnumber, $colId ) ) {
- return ( 0, 2, "Item is already in the collection!" );
- } elsif ( isItemInAnyCollection( $itemnumber ) ) {
- return ( 0, 3, "Item is already in a different collection!" );
- }
-
- my $dbh = C4::Context->dbh;
-
- my $sth;
- $sth = $dbh->prepare("INSERT INTO collections_tracking ( ctId, colId, itemnumber )
- VALUES ( NULL, ?, ? )");
- $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
- $sth->finish;
-
- return 1;
-
+ my ( $colId, $itemnumber ) = @_;
+
+ ## Check for all neccessary parameters
+ if ( !$colId ) {
+ return ( 0, 1, "NO_ID" );
+ }
+ if ( !$itemnumber ) {
+ return ( 0, 2, "NO_ITEM" );
+ }
+
+ if ( isItemInThisCollection( $itemnumber, $colId ) ) {
+ return ( 0, 2, "IN_COLLECTION" );
+ }
+ elsif ( isItemInAnyCollection($itemnumber) ) {
+ return ( 0, 3, "IN_COLLECTION_OTHER" );
+ }
+
+ my $dbh = C4::Context->dbh;
+
+ my $sth;
+ $sth = $dbh->prepare("
+ INSERT INTO collections_tracking (
+ colId,
+ itemnumber
+ ) VALUES ( ?, ? )
+ ");
+ $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
+
+ return 1;
+