@@ -, +, @@ change --- C4/RotatingCollections.pm | 6 +++--- rotating_collections/transferCollection.pl | 2 +- t/db_dependent/RotatingCollections.t | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) --- a/C4/RotatingCollections.pm +++ a/C4/RotatingCollections.pm @@ -399,7 +399,7 @@ sub RemoveItemFromCollection { =head2 TransferCollection - ( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode ); + ( $success, $messages ) = TransferCollection( $colId, $colBranchcode ); Transfers a collection to another branch @@ -418,10 +418,10 @@ sub TransferCollection { ## Check for all necessary parameters if ( !$colId ) { - return ( 0, 1, "NO_ID" ); + return ( 0, [{ type => 'error', code => 'NO_ID' }] ); } if ( !$colBranchcode ) { - return ( 0, 2, "NO_BRANCHCODE" ); + return ( 0, [{ type => 'error', code => 'NO_BRANCHCODE' }] ); } my $dbh = C4::Context->dbh; --- a/rotating_collections/transferCollection.pl +++ a/rotating_collections/transferCollection.pl @@ -43,7 +43,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ## Transfer collection my ( $success, $messages ); if ($toBranch) { - ( $success, $messages) = + ( $success, $messages ) = TransferCollection( $colId, $toBranch ); if ($success) { --- a/t/db_dependent/RotatingCollections.t +++ a/t/db_dependent/RotatingCollections.t @@ -194,7 +194,8 @@ my $samplebranch = { opac_info => 'sample opac', }; Koha::Library->new($samplebranch)->store; -is( TransferCollection( $collection_id1, $samplebranch->{branchcode} ), +my ( $transferred, $messages ) = TransferCollection( $collection_id1, $samplebranch->{branchcode} ); +is( $transferred, 1, "Collection1 has been transfered in the branch SAB" ); @collection1 = GetCollection($collection_id1); is_deeply( @@ -205,12 +206,11 @@ is_deeply( ], "Collection1 belongs to the sample branch (SAB)" ); -is( TransferCollection, "NO_ID", "TransferCollection without ID" ); -is( - TransferCollection($collection_id1), - 'NO_BRANCHCODE', - "TransferCollection without branchcode" -); +( $transferred, $messages ) = TransferCollection(); +is( $messages->[0]->{code}, "NO_ID", "TransferCollection without ID" ); +( $transferred, $messages ) = TransferCollection($collection_id1); +is( $messages->[0]->{code}, + 'NO_BRANCHCODE', "TransferCollection without branchcode" ); #Test AddItemToCollection my $record = MARC::Record->new(); --