View | Details | Raw Unified | Return to bug 26618
Collapse All | Expand All

(-)a/C4/RotatingCollections.pm (-3 / +3 lines)
Lines 399-405 sub RemoveItemFromCollection { Link Here
399
399
400
=head2 TransferCollection
400
=head2 TransferCollection
401
401
402
 ( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode );
402
 ( $success, $messages ) = TransferCollection( $colId, $colBranchcode );
403
403
404
Transfers a collection to another branch
404
Transfers a collection to another branch
405
405
Lines 418-427 sub TransferCollection { Link Here
418
418
419
    ## Check for all necessary parameters
419
    ## Check for all necessary parameters
420
    if ( !$colId ) {
420
    if ( !$colId ) {
421
        return ( 0, 1, "NO_ID" );
421
        return ( 0, [{ type => 'error', code => 'NO_ID' }] );
422
    }
422
    }
423
    if ( !$colBranchcode ) {
423
    if ( !$colBranchcode ) {
424
        return ( 0, 2, "NO_BRANCHCODE" );
424
        return ( 0, [{ type => 'error', code => 'NO_BRANCHCODE' }] );
425
    }
425
    }
426
426
427
    my $dbh = C4::Context->dbh;
427
    my $dbh = C4::Context->dbh;
(-)a/rotating_collections/transferCollection.pl (-1 / +1 lines)
Lines 43-49 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
43
## Transfer collection
43
## Transfer collection
44
my ( $success, $messages );
44
my ( $success, $messages );
45
if ($toBranch) {
45
if ($toBranch) {
46
    ( $success, $messages) =
46
    ( $success, $messages ) =
47
      TransferCollection( $colId, $toBranch );
47
      TransferCollection( $colId, $toBranch );
48
48
49
    if ($success) {
49
    if ($success) {
(-)a/t/db_dependent/RotatingCollections.t (-8 / +7 lines)
Lines 194-200 my $samplebranch = { Link Here
194
    opac_info      => 'sample opac',
194
    opac_info      => 'sample opac',
195
};
195
};
196
Koha::Library->new($samplebranch)->store;
196
Koha::Library->new($samplebranch)->store;
197
is( TransferCollection( $collection_id1, $samplebranch->{branchcode} ),
197
my ( $transferred, $messages ) = TransferCollection( $collection_id1, $samplebranch->{branchcode} );
198
is( $transferred,
198
    1, "Collection1 has been transfered in the branch SAB" );
199
    1, "Collection1 has been transfered in the branch SAB" );
199
@collection1 = GetCollection($collection_id1);
200
@collection1 = GetCollection($collection_id1);
200
is_deeply(
201
is_deeply(
Lines 205-216 is_deeply( Link Here
205
    ],
206
    ],
206
    "Collection1 belongs to the sample branch (SAB)"
207
    "Collection1 belongs to the sample branch (SAB)"
207
);
208
);
208
is( TransferCollection, "NO_ID", "TransferCollection without ID" );
209
( $transferred, $messages ) = TransferCollection();
209
is(
210
is( $messages->[0]->{code}, "NO_ID", "TransferCollection without ID" );
210
    TransferCollection($collection_id1),
211
( $transferred, $messages ) = TransferCollection($collection_id1);
211
    'NO_BRANCHCODE',
212
is( $messages->[0]->{code},
212
    "TransferCollection without branchcode"
213
    'NO_BRANCHCODE', "TransferCollection without branchcode" );
213
);
214
214
215
#Test AddItemToCollection
215
#Test AddItemToCollection
216
my $record = MARC::Record->new();
216
my $record = MARC::Record->new();
217
- 

Return to bug 26618