|
Lines 48-99
BEGIN {
Link Here
|
| 48 |
require Exporter; |
48 |
require Exporter; |
| 49 |
@ISA = qw( Exporter ); |
49 |
@ISA = qw( Exporter ); |
| 50 |
@EXPORT = qw( |
50 |
@EXPORT = qw( |
| 51 |
RemoveItemFromCollection |
|
|
| 52 |
TransferCollection |
51 |
TransferCollection |
| 53 |
); |
52 |
); |
| 54 |
} |
53 |
} |
| 55 |
|
54 |
|
| 56 |
=head2 RemoveItemFromCollection |
|
|
| 57 |
|
| 58 |
( $success, $errorcode, $errormessage ) = RemoveItemFromCollection( $colId, $itemnumber ); |
| 59 |
|
| 60 |
Removes an item to a collection |
| 61 |
|
| 62 |
Input: |
| 63 |
$colId: Collection to add the item to. |
| 64 |
$itemnumber: Item to be removed from collection |
| 65 |
|
| 66 |
Output: |
| 67 |
$success: 1 if all database operations were successful, 0 otherwise |
| 68 |
$errorCode: Code for reason of failure, good for translating errors in templates |
| 69 |
$errorMessage: English description of error |
| 70 |
|
| 71 |
=cut |
| 72 |
|
| 73 |
sub RemoveItemFromCollection { |
| 74 |
my ( $colId, $itemnumber ) = @_; |
| 75 |
|
| 76 |
## Check for all necessary parameters |
| 77 |
if ( !$itemnumber ) { |
| 78 |
return ( 0, 2, "NO_ITEM" ); |
| 79 |
} |
| 80 |
|
| 81 |
if ( !isItemInThisCollection( $itemnumber, $colId ) ) { |
| 82 |
return ( 0, 2, "NOT_IN_COLLECTION" ); |
| 83 |
} |
| 84 |
|
| 85 |
my $dbh = C4::Context->dbh; |
| 86 |
|
| 87 |
my $sth; |
| 88 |
$sth = $dbh->prepare( |
| 89 |
"DELETE FROM collections_tracking |
| 90 |
WHERE itemnumber = ?" |
| 91 |
); |
| 92 |
$sth->execute($itemnumber) or return ( 0, 3, $sth->errstr() ); |
| 93 |
|
| 94 |
return 1; |
| 95 |
} |
| 96 |
|
| 97 |
=head2 TransferCollection |
55 |
=head2 TransferCollection |
| 98 |
|
56 |
|
| 99 |
( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode ); |
57 |
( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode ); |