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

(-)a/C4/Branch.pm (-8 / +5 lines)
Lines 499-514 sub GetIndependentGroupModificationRights { Link Here
499
        push( @params, $other_branch );
499
        push( @params, $other_branch );
500
    }
500
    }
501
501
502
    $sql .= q{ UNION SELECT branchcode FROM branches WHERE branchcode = ? };
503
    push( @params, $this_branch );
504
502
    my $dbh = C4::Context->dbh;
505
    my $dbh = C4::Context->dbh;
503
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
506
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
504
507
505
    if ( $stringify ) {
508
    return join( ',', map { qq{'$_'} } @branchcodes ) if $stringify;
506
        if ( @branchcodes ) {
507
            return join( ',', map { qq{'$_'} } @branchcodes );
508
        } else {
509
            return qq{'$this_branch'};
510
        }
511
    }
512
509
513
    if ( wantarray() ) {
510
    if ( wantarray() ) {
514
        if ( @branchcodes ) {
511
        if ( @branchcodes ) {
Lines 517-523 sub GetIndependentGroupModificationRights { Link Here
517
            return $this_branch;
514
            return $this_branch;
518
        }
515
        }
519
    } else {
516
    } else {
520
        return scalar(@branchcodes);
517
        return scalar(@branchcodes) > 1;
521
    }
518
    }
522
}
519
}
523
520
(-)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