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

(-)a/C4/Branch.pm (-8 / +5 lines)
Lines 500-515 sub GetIndependentGroupModificationRights { Link Here
500
        push( @params, $other_branch );
500
        push( @params, $other_branch );
501
    }
501
    }
502
502
503
    $sql .= q{ UNION SELECT branchcode FROM branches WHERE branchcode = ? };
504
    push( @params, $this_branch );
505
503
    my $dbh = C4::Context->dbh;
506
    my $dbh = C4::Context->dbh;
504
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
507
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
505
508
506
    if ( $stringify ) {
509
    return join( ',', map { qq{'$_'} } @branchcodes ) if $stringify;
507
        if ( @branchcodes ) {
508
            return join( ',', map { qq{'$_'} } @branchcodes );
509
        } else {
510
            return qq{'$this_branch'};
511
        }
512
    }
513
510
514
    if ( wantarray() ) {
511
    if ( wantarray() ) {
515
        if ( @branchcodes ) {
512
        if ( @branchcodes ) {
Lines 518-524 sub GetIndependentGroupModificationRights { Link Here
518
            return $this_branch;
515
            return $this_branch;
519
        }
516
        }
520
    } else {
517
    } else {
521
        return scalar(@branchcodes);
518
        return scalar(@branchcodes) > 1;
522
    }
519
    }
523
}
520
}
524
521
(-)a/t/db_dependent/Branch.t (-2 / +4 lines)
Lines 21-27 use Modern::Perl; Link Here
21
use C4::Context;
21
use C4::Context;
22
use Data::Dumper;
22
use Data::Dumper;
23
23
24
use Test::More tests => 69;
24
use Test::More tests => 70;
25
25
26
use C4::Branch;
26
use C4::Branch;
27
27
Lines 389-394 is_deeply( \@branches_bra, [ 'BRA', 'BRB' ], 'Libraries in LIBCATCODE returned c Link Here
389
$string = GetIndependentGroupModificationRights({ branch => 'BRA', stringify => 1 });
389
$string = GetIndependentGroupModificationRights({ branch => 'BRA', stringify => 1 });
390
ok( $string eq q{'BRA','BRB'}, "String returns correctly" );
390
ok( $string eq q{'BRA','BRB'}, "String returns correctly" );
391
391
392
$string = GetIndependentGroupModificationRights({ branch => 'BRC', stringify => 1 });
393
ok( $string eq q{'BRC'}, "String returns correctly" );
394
392
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
395
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
393
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB'}), 'Boolean test for BRA rights to BRB returns true' );
396
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB'}), 'Boolean test for BRA rights to BRB returns true' );
394
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC'}), 'Boolean test for BRA rights to BRC returns false' );
397
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC'}), 'Boolean test for BRA rights to BRC returns false' );
395
- 

Return to bug 10276