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

(-)a/C4/Acquisition.pm (-8 / +14 lines)
Lines 1950-1958 sub GetParcel { Link Here
1950
    my @query_params = ( $supplierid, $code, $datereceived );
1950
    my @query_params = ( $supplierid, $code, $datereceived );
1951
    if ( C4::Context->preference("IndependentBranches") ) {
1951
    if ( C4::Context->preference("IndependentBranches") ) {
1952
        unless ( C4::Context->IsSuperLibrarian() ) {
1952
        unless ( C4::Context->IsSuperLibrarian() ) {
1953
            my $branches =
1953
            my @branches = GetIndependentGroupModificationRights();
1954
              GetIndependentGroupModificationRights( { stringify => 1 } );
1954
            $strsth .=
1955
            $strsth .= " AND ( borrowers.branchcode IN ( $branches ) OR borrowers.branchcode  = '')";
1955
                " AND ( borrowers.branchcode IN ( "
1956
              . join( ',', ('?') x @branches )
1957
              . " ) OR borrowers.branchcode  = '')";
1958
            push( @query_params, @branches );
1956
        }
1959
        }
1957
    }
1960
    }
1958
    $strsth .= " ORDER BY aqbasket.basketno";
1961
    $strsth .= " ORDER BY aqbasket.basketno";
Lines 2167-2174 sub GetLateOrders { Link Here
2167
    }
2170
    }
2168
    if (C4::Context->preference("IndependentBranches")
2171
    if (C4::Context->preference("IndependentBranches")
2169
            && !C4::Context->IsSuperLibrarian() ) {
2172
            && !C4::Context->IsSuperLibrarian() ) {
2170
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2173
        my @branches = GetIndependentGroupModificationRights();
2171
        $from .= qq{ AND borrowers.branchcode IN ( $branches ) };
2174
        $from .= "AND borrowers.branchcode IN ( " . join(',', ('?') x @branches) . " ) ";
2175
        push( @query_params, @branches );
2172
    }
2176
    }
2173
    $from .= " AND orderstatus <> 'cancelled' ";
2177
    $from .= " AND orderstatus <> 'cancelled' ";
2174
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
2178
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
Lines 2395-2403 sub GetHistory { Link Here
2395
    if ( C4::Context->preference("IndependentBranches")
2399
    if ( C4::Context->preference("IndependentBranches")
2396
        && !C4::Context->IsSuperLibrarian() )
2400
        && !C4::Context->IsSuperLibrarian() )
2397
    {
2401
    {
2398
        my $branches =
2402
        my @branches = GetIndependentGroupModificationRights();
2399
          GetIndependentGroupModificationRights( { stringify => 1 } );
2403
        $query .=
2400
        $query .= qq{ AND ( borrowers.branchcode = ? OR borrowers.branchcode IN ( $branches ) ) };
2404
          " AND ( borrowers.branchcode = ? OR borrowers.branchcode IN ( "
2405
          . join( ',', ('?') x @branches ) . " ) ) ";
2406
        push( @query_params, @branches );
2401
    }
2407
    }
2402
    $query .= " ORDER BY id";
2408
    $query .= " ORDER BY id";
2403
2409
(-)a/C4/Branch.pm (-17 / +8 lines)
Lines 116-123 sub GetBranches { Link Here
116
    my $query = "SELECT * FROM branches";
116
    my $query = "SELECT * FROM branches";
117
    my @bind_parameters;
117
    my @bind_parameters;
118
    if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
118
    if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
119
      my $branches = GetIndependentGroupModificationRights({ stringify => 1 });
119
      my @branches = GetIndependentGroupModificationRights();
120
      $query .= qq{ WHERE branchcode IN ( $branches ) };
120
      $query .= " WHERE branchcode IN ( " . join(',', ('?') x @branches) . " ) ";
121
      push( @bind_parameters, @branches );
121
    }
122
    }
122
    $query .= " ORDER BY branchname";
123
    $query .= " ORDER BY branchname";
123
    $sth = $dbh->prepare($query);
124
    $sth = $dbh->prepare($query);
Lines 432-443 sub GetBranchesInCategory { Link Here
432
=head2 GetIndependentGroupModificationRights
433
=head2 GetIndependentGroupModificationRights
433
434
434
    GetIndependentGroupModificationRights(
435
    GetIndependentGroupModificationRights(
435
                                           {
436
        {
436
                                               branch => $this_branch,
437
            branch => $this_branch,
437
                                               for => $other_branch,
438
            for => $other_branch,
438
                                               stringify => 1,
439
        }
439
                                           }
440
    );
440
                                          );
441
441
442
    Returns a list of branches this branch shares a common
442
    Returns a list of branches this branch shares a common
443
    independent group with.
443
    independent group with.
Lines 452-463 sub GetBranchesInCategory { Link Here
452
452
453
    If called in a scalar context, it returns
453
    If called in a scalar context, it returns
454
    a count of matching branchcodes. Returns 1 if
454
    a count of matching branchcodes. Returns 1 if
455
456
    If stringify param is passed, the return value will
457
    be a string of the comma delimited branchcodes. This
458
    is useful for "branchcode IN $branchcodes" clauses
459
    in SQL queries.
460
461
    $this_branch and $other_branch are equal for efficiency.
455
    $this_branch and $other_branch are equal for efficiency.
462
456
463
    So you can write:
457
    So you can write:
Lines 472-478 sub GetIndependentGroupModificationRights { Link Here
472
466
473
    my $this_branch  = $params->{branch};
467
    my $this_branch  = $params->{branch};
474
    my $other_branch = $params->{for};
468
    my $other_branch = $params->{for};
475
    my $stringify    = $params->{stringify};
476
469
477
    $this_branch ||= C4::Context->userenv->{branch};
470
    $this_branch ||= C4::Context->userenv->{branch};
478
471
Lines 506-513 sub GetIndependentGroupModificationRights { Link Here
506
    my $dbh = C4::Context->dbh;
499
    my $dbh = C4::Context->dbh;
507
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
500
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
508
501
509
    return join( ',', map { qq{'$_'} } @branchcodes ) if $stringify;
510
511
    if ( wantarray() ) {
502
    if ( wantarray() ) {
512
        if ( @branchcodes ) {
503
        if ( @branchcodes ) {
513
            return @branchcodes;
504
            return @branchcodes;
(-)a/C4/Items.pm (-3 / +8 lines)
Lines 2990-2998 sub PrepareItemrecordDisplay { Link Here
2990
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2990
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2991
                        if (   ( C4::Context->preference("IndependentBranches") )
2991
                        if (   ( C4::Context->preference("IndependentBranches") )
2992
                            && !C4::Context->IsSuperLibrarian() ) {
2992
                            && !C4::Context->IsSuperLibrarian() ) {
2993
                            my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2993
                            my @branches =
2994
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode IN ( $branches ) ORDER BY branchname" );
2994
                              GetIndependentGroupModificationRights();
2995
                            $sth->execute();
2995
                            my $sql =
2996
                                "SELECT branchcode,branchname FROM branches WHERE branchcode IN ("
2997
                              . join( ',', ('?') x @branches )
2998
                              . ") ORDER BY branchname";
2999
                            my $sth = $dbh->prepare($sql);
3000
                            $sth->execute(@branches);
2996
                            push @authorised_values, ""
3001
                            push @authorised_values, ""
2997
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
3002
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2998
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
3003
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
(-)a/C4/Members.pm (-9 / +15 lines)
Lines 1296-1314 sub checkuniquemember { Link Here
1296
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1296
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1297
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1297
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1298
1298
1299
    my @params;
1300
    if ($collectivity) {
1301
        push( @params, uc($surname) );
1302
    }
1303
    elsif ($dateofbirth) {
1304
        push( @params, uc($surname), ucfirst($firstname), $dateofbirth );
1305
    }
1306
    else {
1307
        push( @params, uc($surname), ucfirst($firstname) );
1308
    }
1309
1299
    if ( C4::Context->preference('IndependentBranches') ) {
1310
    if ( C4::Context->preference('IndependentBranches') ) {
1300
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
1311
        my @branches = GetIndependentGroupModificationRights();
1301
        $request .= " AND branchcode IN ( $branches )";
1312
        $request .= " AND branchcode IN ( " . join(',', ('?') x @branches) ." )";
1313
        push( @params, @branches );
1302
    }
1314
    }
1303
1315
1304
    my $sth = $dbh->prepare($request);
1316
    my $sth = $dbh->prepare($request);
1305
    if ($collectivity) {
1317
    $sth->execute( @params );
1306
        $sth->execute( uc($surname) );
1307
    } elsif($dateofbirth){
1308
        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
1309
    }else{
1310
        $sth->execute( uc($surname), ucfirst($firstname));
1311
    }
1312
    my @data = $sth->fetchrow;
1318
    my @data = $sth->fetchrow;
1313
    ( $data[0] ) and return $data[0], $data[1];
1319
    ( $data[0] ) and return $data[0], $data[1];
1314
    return 0;
1320
    return 0;
(-)a/C4/Serials.pm (-23 / +36 lines)
Lines 203-223 sub GetSerialInformation { Link Here
203
               subscription.*,
203
               subscription.*,
204
               subscription.subscriptionid as subsid
204
               subscription.subscriptionid as subsid
205
    |;
205
    |;
206
    my @branches;
206
    if (   C4::Context->preference('IndependentBranches')
207
    if (   C4::Context->preference('IndependentBranches')
207
        && C4::Context->userenv
208
        && C4::Context->userenv
208
        && C4::Context->userenv->{'flags'} % 2 != 1
209
        && C4::Context->userenv->{'flags'} % 2 != 1
209
        && C4::Context->userenv->{'branch'} ) {
210
        && C4::Context->userenv->{'branch'} ) {
210
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
211
        @branches = GetIndependentGroupModificationRights();
211
        $query .= qq|
212
        $query .= "
212
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
213
            , (
213
        |;
214
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) ." ) )
215
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
216
            ) AS cannotedit
217
        ";
214
    }
218
    }
215
    $query .= qq|
219
    $query .= qq|
216
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
220
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
217
        WHERE  serialid = ?
221
        WHERE  serialid = ?
218
    |;
222
    |;
219
    my $rq = $dbh->prepare($query);
223
    my $rq = $dbh->prepare($query);
220
    $rq->execute($serialid);
224
    $rq->execute($serialid, @branches);
221
    my $data = $rq->fetchrow_hashref;
225
    my $data = $rq->fetchrow_hashref;
222
226
223
    # create item information if we have serialsadditems for this subscription
227
    # create item information if we have serialsadditems for this subscription
Lines 324-340 sub GetSubscription { Link Here
324
                subscription.biblionumber as bibnum
328
                subscription.biblionumber as bibnum
325
    |;
329
    |;
326
330
331
    my @branches;
327
    if (   C4::Context->preference('IndependentBranches')
332
    if (   C4::Context->preference('IndependentBranches')
328
        && C4::Context->userenv
333
        && C4::Context->userenv
329
        && C4::Context->userenv->{'flags'} % 2 != 1
334
        && C4::Context->userenv->{'flags'} % 2 != 1
330
        && C4::Context->userenv->{'branch'} )
335
        && C4::Context->userenv->{'branch'} )
331
    {
336
    {
332
        my $branches =
337
        @branches = GetIndependentGroupModificationRights();
333
          GetIndependentGroupModificationRights( { stringify => 1 } );
334
338
335
        $query .= qq|
339
        $query .= "
336
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
340
            , (
337
        |;
341
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) ." ) )
342
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
343
            ) AS cannotedit
344
        ";
338
    }
345
    }
339
346
340
    $query .= qq|
347
    $query .= qq|
Lines 347-353 sub GetSubscription { Link Here
347
354
348
    $debug and warn "query : $query\nsubsid :$subscriptionid";
355
    $debug and warn "query : $query\nsubsid :$subscriptionid";
349
    my $sth = $dbh->prepare($query);
356
    my $sth = $dbh->prepare($query);
350
    $sth->execute($subscriptionid);
357
    $sth->execute($subscriptionid, @branches);
351
    my $subscription = $sth->fetchrow_hashref;
358
    my $subscription = $sth->fetchrow_hashref;
352
    $subscription->{cannotedit} = not can_edit_subscription( $subscription );
359
    $subscription->{cannotedit} = not can_edit_subscription( $subscription );
353
    return $subscription;
360
    return $subscription;
Lines 382-398 sub GetFullSubscription { Link Here
382
            subscription.subscriptionid AS subscriptionid
389
            subscription.subscriptionid AS subscriptionid
383
    |;
390
    |;
384
391
392
    my @branches;
385
    if (   C4::Context->preference('IndependentBranches')
393
    if (   C4::Context->preference('IndependentBranches')
386
        && C4::Context->userenv
394
        && C4::Context->userenv
387
        && C4::Context->userenv->{'flags'} % 2 != 1
395
        && C4::Context->userenv->{'flags'} % 2 != 1
388
        && C4::Context->userenv->{'branch'} )
396
        && C4::Context->userenv->{'branch'} )
389
    {
397
    {
390
        my $branches =
398
        @branches = GetIndependentGroupModificationRights();
391
          GetIndependentGroupModificationRights( { stringify => 1 } );
392
399
393
        $query .= qq|
400
        $query .= "
394
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
401
            , (
395
        |;
402
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) . " ) )
403
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
404
            ) AS cannotedit
405
        ";
396
    }
406
    }
397
407
398
    $query .= qq|
408
    $query .= qq|
Lines 408-414 sub GetFullSubscription { Link Here
408
          |;
418
          |;
409
    $debug and warn "GetFullSubscription query: $query";
419
    $debug and warn "GetFullSubscription query: $query";
410
    my $sth = $dbh->prepare($query);
420
    my $sth = $dbh->prepare($query);
411
    $sth->execute($subscriptionid);
421
    $sth->execute( $subscriptionid, @branches );
412
    my $subscriptions = $sth->fetchall_arrayref( {} );
422
    my $subscriptions = $sth->fetchall_arrayref( {} );
413
    for my $subscription ( @$subscriptions ) {
423
    for my $subscription ( @$subscriptions ) {
414
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
424
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
Lines 565-581 sub GetFullSubscriptionsFromBiblionumber { Link Here
565
            subscription.subscriptionid AS subscriptionid
575
            subscription.subscriptionid AS subscriptionid
566
    |;
576
    |;
567
577
578
    my @branches;
568
    if (   C4::Context->preference('IndependentBranches')
579
    if (   C4::Context->preference('IndependentBranches')
569
        && C4::Context->userenv
580
        && C4::Context->userenv
570
        && C4::Context->userenv->{'flags'} != 1
581
        && C4::Context->userenv->{'flags'} != 1
571
        && C4::Context->userenv->{'branch'} )
582
        && C4::Context->userenv->{'branch'} )
572
    {
583
    {
573
        my $branches =
584
        @branches = GetIndependentGroupModificationRights();
574
          GetIndependentGroupModificationRights( { stringify => 1 } );
575
585
576
        $query .= qq|
586
        $query .= "
577
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
587
            , (
578
        |;
588
                ( subscription.branchcode NOT IN (" . join(',', ('?') x @branches) . ") )
589
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
590
            ) AS cannotedit
591
        ";
579
    }
592
    }
580
593
581
    $query .= qq|
594
    $query .= qq|
Lines 590-596 sub GetFullSubscriptionsFromBiblionumber { Link Here
590
          serial.subscriptionid
603
          serial.subscriptionid
591
          |;
604
          |;
592
    my $sth = $dbh->prepare($query);
605
    my $sth = $dbh->prepare($query);
593
    $sth->execute($biblionumber);
606
    $sth->execute($biblionumber, @branches);
594
    my $subscriptions = $sth->fetchall_arrayref( {} );
607
    my $subscriptions = $sth->fetchall_arrayref( {} );
595
    for my $subscription ( @$subscriptions ) {
608
    for my $subscription ( @$subscriptions ) {
596
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
609
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
(-)a/C4/Suggestions.pm (-14 / +16 lines)
Lines 140-148 sub SearchSuggestion { Link Here
140
        && !C4::Context->IsSuperLibrarian()
140
        && !C4::Context->IsSuperLibrarian()
141
        && !$suggestion->{branchcode} )
141
        && !$suggestion->{branchcode} )
142
    {
142
    {
143
        my $branches =
143
        my @branches =
144
          GetIndependentGroupModificationRights( { stringify => 1 } );
144
          GetIndependentGroupModificationRights();
145
        push( @query, qq{ AND (suggestions.branchcode IN ( $branches ) OR suggestions.branchcode='') } );
145
        push( @query, " AND (suggestions.branchcode IN ( " . join(',', ('?') x @branches) ." ) OR suggestions.branchcode='') " );
146
        push( @sql_params, @branches );
146
    }
147
    }
147
    else {
148
    else {
148
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
149
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
Lines 347-358 sub GetSuggestionByStatus { Link Here
347
            && !C4::Context->IsSuperLibrarian() )
348
            && !C4::Context->IsSuperLibrarian() )
348
        {
349
        {
349
350
350
            my $branches =
351
            my @branches =
351
              GetIndependentGroupModificationRights( { stringify => 1 } );
352
              GetIndependentGroupModificationRights();
352
353
353
            $query .= qq{
354
            $query .= "
354
                AND (U1.branchcode IN ( $branches ) OR U1.branchcode ='')
355
                AND (U1.branchcode IN ( " . join(',', ('?') x @branches) . " ) OR U1.branchcode ='')
355
            };
356
            ";
357
            push( @sql_params, @branches );
356
        }
358
        }
357
359
358
        if ($branchcode) {
360
        if ($branchcode) {
Lines 400-421 sub CountSuggestion { Link Here
400
    if ( C4::Context->preference("IndependentBranches")
402
    if ( C4::Context->preference("IndependentBranches")
401
        && !C4::Context->IsSuperLibrarian() )
403
        && !C4::Context->IsSuperLibrarian() )
402
    {
404
    {
403
        my $branches =
405
        my @branches =
404
          GetIndependentGroupModificationRights( { stringify => 1 } );
406
          GetIndependentGroupModificationRights();
405
407
406
        my $query = qq{
408
        my $query = "
407
            SELECT count(*)
409
            SELECT count(*)
408
            FROM suggestions
410
            FROM suggestions
409
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
411
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
410
            WHERE STATUS=?
412
            WHERE STATUS=?
411
                AND (
413
                AND (
412
                    borrowers.branchcode IN ( $branches )
414
                    borrowers.branchcode IN (" . join(',', ('?') x @branches) . ")
413
                    OR
415
                    OR
414
                    borrowers.branchcode=?
416
                    borrowers.branchcode=?
415
                )
417
                )
416
        };
418
        ";
417
        $sth = $dbh->prepare($query);
419
        $sth = $dbh->prepare($query);
418
        $sth->execute( $status, $userenv->{branch} );
420
        $sth->execute( $status, @branches, $userenv->{branch} );
419
    }
421
    }
420
    else {
422
    else {
421
        my $query = q{
423
        my $query = q{
(-)a/circ/pendingreserves.pl (-2 / +3 lines)
Lines 154-161 if ( $run_report ) { Link Here
154
154
155
155
156
    if (C4::Context->preference('IndependentBranches')){
156
    if (C4::Context->preference('IndependentBranches')){
157
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
157
        my @branches = GetIndependentGroupModificationRights();
158
        $strsth .= " AND items.holdingbranch IN ( $branches ) ";
158
        $strsth .= " AND items.holdingbranch IN ( " . join(',', ('?') x @branches) . " ) ";
159
        push( @query_params, @branches );
159
    }
160
    }
160
    $strsth .= " GROUP BY reserves.biblionumber ORDER BY biblio.title ";
161
    $strsth .= " GROUP BY reserves.biblionumber ORDER BY biblio.title ";
161
162
(-)a/circ/reserveratios.pl (-2 / +3 lines)
Lines 125-132 my $strsth = Link Here
125
";
125
";
126
126
127
if ( C4::Context->preference('IndependentBranches') ) {
127
if ( C4::Context->preference('IndependentBranches') ) {
128
    my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
128
    my @branches = GetIndependentGroupModificationRights();
129
    $strsth .= " AND items.holdingbranch IN ( $branches ) ";
129
    $strsth .= " AND items.holdingbranch IN (" . join(',', ('?') x @branches) . ") ";
130
    push( @query_params, @branches );
130
}
131
}
131
132
132
$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
133
$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
(-)a/t/db_dependent/Branch.t (-14 / +1 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 => 70;
24
use Test::More tests => 66;
25
25
26
use C4::Branch;
26
use C4::Branch;
27
27
Lines 359-367 is( scalar(@$loop), GetBranchesCount(), 'There is the right number of branches' Link Here
359
my @branches_bra = GetIndependentGroupModificationRights({ branch => 'BRA' });
359
my @branches_bra = GetIndependentGroupModificationRights({ branch => 'BRA' });
360
is_deeply( \@branches_bra, [ 'BRA' ], 'Library with no group only has rights for its own branch' );
360
is_deeply( \@branches_bra, [ 'BRA' ], 'Library with no group only has rights for its own branch' );
361
361
362
my $string = GetIndependentGroupModificationRights({ branch => 'BRA', stringify => 1 });
363
ok( $string eq q{'BRA'}, "String returns correctly" );
364
365
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
362
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
366
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB' }), 'Boolean test for BRA rights to BRB returns false' );
363
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB' }), 'Boolean test for BRA rights to BRB returns false' );
367
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC' }), 'Boolean test for BRA rights to BRC returns false' );
364
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC' }), 'Boolean test for BRA rights to BRC returns false' );
Lines 386-397 ModBranch({ Link Here
386
@branches_bra = GetIndependentGroupModificationRights({ branch => 'BRA' });
383
@branches_bra = GetIndependentGroupModificationRights({ branch => 'BRA' });
387
is_deeply( \@branches_bra, [ 'BRA', 'BRB' ], 'Libraries in LIBCATCODE returned correctly' );
384
is_deeply( \@branches_bra, [ 'BRA', 'BRB' ], 'Libraries in LIBCATCODE returned correctly' );
388
385
389
$string = GetIndependentGroupModificationRights({ branch => 'BRA', stringify => 1 });
390
ok( $string eq q{'BRA','BRB'}, "String returns correctly" );
391
392
$string = GetIndependentGroupModificationRights({ branch => 'BRC', stringify => 1 });
393
ok( $string eq q{'BRC'}, "String returns correctly" );
394
395
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
386
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRA' }), 'Boolean test for BRA rights to BRA returns true' );
396
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB'}), 'Boolean test for BRA rights to BRB returns true' );
387
ok( GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRB'}), 'Boolean test for BRA rights to BRB returns true' );
397
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC'}), 'Boolean test for BRA rights to BRC returns false' );
388
ok( !GetIndependentGroupModificationRights({ branch => 'BRA', for => 'BRC'}), 'Boolean test for BRA rights to BRC returns false' );
Lines 421-429 ok( GetIndependentGroupModificationRights({ branch => 'BRC', for => 'BRC' }), 'B Link Here
421
ok( GetIndependentGroupModificationRights({ branch => 'BRC', for => 'BRA'}), 'Boolean test for BRC rights to BRA returns true' );
412
ok( GetIndependentGroupModificationRights({ branch => 'BRC', for => 'BRA'}), 'Boolean test for BRC rights to BRA returns true' );
422
ok( GetIndependentGroupModificationRights({ branch => 'BRC', for => 'BRA'}), 'Boolean test for BRC rights to BRB returns true' );
413
ok( GetIndependentGroupModificationRights({ branch => 'BRC', for => 'BRA'}), 'Boolean test for BRC rights to BRB returns true' );
423
414
424
$string = GetIndependentGroupModificationRights({ branch => 'BRA', stringify => 1 });
425
ok( $string eq q{'BRA','BRB','BRC'}, "String returns correctly" );
426
427
# End transaction
415
# End transaction
428
$dbh->rollback;
416
$dbh->rollback;
429
417
430
- 

Return to bug 10276