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

(-)a/C4/Acquisition.pm (-8 / +14 lines)
Lines 1949-1957 sub GetParcel { Link Here
1949
    my @query_params = ( $supplierid, $code, $datereceived );
1949
    my @query_params = ( $supplierid, $code, $datereceived );
1950
    if ( C4::Context->preference("IndependentBranches") ) {
1950
    if ( C4::Context->preference("IndependentBranches") ) {
1951
        unless ( C4::Context->IsSuperLibrarian() ) {
1951
        unless ( C4::Context->IsSuperLibrarian() ) {
1952
            my $branches =
1952
            my @branches = GetIndependentGroupModificationRights();
1953
              GetIndependentGroupModificationRights( { stringify => 1 } );
1953
            $strsth .=
1954
            $strsth .= " AND ( borrowers.branchcode IN ( $branches ) OR borrowers.branchcode  = '')";
1954
                " AND ( borrowers.branchcode IN ( "
1955
              . join( ',', ('?') x @branches )
1956
              . " ) OR borrowers.branchcode  = '')";
1957
            push( @query_params, @branches );
1955
        }
1958
        }
1956
    }
1959
    }
1957
    $strsth .= " ORDER BY aqbasket.basketno";
1960
    $strsth .= " ORDER BY aqbasket.basketno";
Lines 2166-2173 sub GetLateOrders { Link Here
2166
    }
2169
    }
2167
    if (C4::Context->preference("IndependentBranches")
2170
    if (C4::Context->preference("IndependentBranches")
2168
            && !C4::Context->IsSuperLibrarian() ) {
2171
            && !C4::Context->IsSuperLibrarian() ) {
2169
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2172
        my @branches = GetIndependentGroupModificationRights();
2170
        $from .= qq{ AND borrowers.branchcode IN ( $branches ) };
2173
        $from .= "AND borrowers.branchcode IN ( " . join(',', ('?') x @branches) . " ) ";
2174
        push( @query_params, @branches );
2171
    }
2175
    }
2172
    $from .= " AND orderstatus <> 'cancelled' ";
2176
    $from .= " AND orderstatus <> 'cancelled' ";
2173
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
2177
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
Lines 2394-2402 sub GetHistory { Link Here
2394
    if ( C4::Context->preference("IndependentBranches")
2398
    if ( C4::Context->preference("IndependentBranches")
2395
        && !C4::Context->IsSuperLibrarian() )
2399
        && !C4::Context->IsSuperLibrarian() )
2396
    {
2400
    {
2397
        my $branches =
2401
        my @branches = GetIndependentGroupModificationRights();
2398
          GetIndependentGroupModificationRights( { stringify => 1 } );
2402
        $query .=
2399
        $query .= qq{ AND ( borrowers.branchcode = ? OR borrowers.branchcode IN ( $branches ) ) };
2403
          " AND ( borrowers.branchcode = ? OR borrowers.branchcode IN ( "
2404
          . join( ',', ('?') x @branches ) . " ) ) ";
2405
        push( @query_params, @branches );
2400
    }
2406
    }
2401
    $query .= " ORDER BY id";
2407
    $query .= " ORDER BY id";
2402
2408
(-)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 431-442 sub GetBranchesInCategory { Link Here
431
=head2 GetIndependentGroupModificationRights
432
=head2 GetIndependentGroupModificationRights
432
433
433
    GetIndependentGroupModificationRights(
434
    GetIndependentGroupModificationRights(
434
                                           {
435
        {
435
                                               branch => $this_branch,
436
            branch => $this_branch,
436
                                               for => $other_branch,
437
            for => $other_branch,
437
                                               stringify => 1,
438
        }
438
                                           }
439
    );
439
                                          );
440
440
441
    Returns a list of branches this branch shares a common
441
    Returns a list of branches this branch shares a common
442
    independent group with.
442
    independent group with.
Lines 451-462 sub GetBranchesInCategory { Link Here
451
451
452
    If called in a scalar context, it returns
452
    If called in a scalar context, it returns
453
    a count of matching branchcodes. Returns 1 if
453
    a count of matching branchcodes. Returns 1 if
454
455
    If stringify param is passed, the return value will
456
    be a string of the comma delimited branchcodes. This
457
    is useful for "branchcode IN $branchcodes" clauses
458
    in SQL queries.
459
460
    $this_branch and $other_branch are equal for efficiency.
454
    $this_branch and $other_branch are equal for efficiency.
461
455
462
    So you can write:
456
    So you can write:
Lines 471-477 sub GetIndependentGroupModificationRights { Link Here
471
465
472
    my $this_branch  = $params->{branch};
466
    my $this_branch  = $params->{branch};
473
    my $other_branch = $params->{for};
467
    my $other_branch = $params->{for};
474
    my $stringify    = $params->{stringify};
475
468
476
    $this_branch ||= C4::Context->userenv->{branch};
469
    $this_branch ||= C4::Context->userenv->{branch};
477
470
Lines 505-512 sub GetIndependentGroupModificationRights { Link Here
505
    my $dbh = C4::Context->dbh;
498
    my $dbh = C4::Context->dbh;
506
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
499
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
507
500
508
    return join( ',', map { qq{'$_'} } @branchcodes ) if $stringify;
509
510
    if ( wantarray() ) {
501
    if ( wantarray() ) {
511
        if ( @branchcodes ) {
502
        if ( @branchcodes ) {
512
            return @branchcodes;
503
            return @branchcodes;
(-)a/C4/Items.pm (-3 / +8 lines)
Lines 2969-2977 sub PrepareItemrecordDisplay { Link Here
2969
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2969
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2970
                        if (   ( C4::Context->preference("IndependentBranches") )
2970
                        if (   ( C4::Context->preference("IndependentBranches") )
2971
                            && !C4::Context->IsSuperLibrarian() ) {
2971
                            && !C4::Context->IsSuperLibrarian() ) {
2972
                            my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2972
                            my @branches =
2973
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode IN ( $branches ) ORDER BY branchname" );
2973
                              GetIndependentGroupModificationRights();
2974
                            $sth->execute();
2974
                            my $sql =
2975
                                "SELECT branchcode,branchname FROM branches WHERE branchcode IN ("
2976
                              . join( ',', ('?') x @branches )
2977
                              . ") ORDER BY branchname";
2978
                            my $sth = $dbh->prepare($sql);
2979
                            $sth->execute(@branches);
2975
                            push @authorised_values, ""
2980
                            push @authorised_values, ""
2976
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2981
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2977
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
2982
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
(-)a/C4/Members.pm (-9 / +15 lines)
Lines 1410-1428 sub checkuniquemember { Link Here
1410
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1410
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1411
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1411
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1412
1412
1413
    my @params;
1414
    if ($collectivity) {
1415
        push( @params, uc($surname) );
1416
    }
1417
    elsif ($dateofbirth) {
1418
        push( @params, uc($surname), ucfirst($firstname), $dateofbirth );
1419
    }
1420
    else {
1421
        push( @params, uc($surname), ucfirst($firstname) );
1422
    }
1423
1413
    if ( C4::Context->preference('IndependentBranches') ) {
1424
    if ( C4::Context->preference('IndependentBranches') ) {
1414
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
1425
        my @branches = GetIndependentGroupModificationRights();
1415
        $request .= " AND branchcode IN ( $branches )";
1426
        $request .= " AND branchcode IN ( " . join(',', ('?') x @branches) ." )";
1427
        push( @params, @branches );
1416
    }
1428
    }
1417
1429
1418
    my $sth = $dbh->prepare($request);
1430
    my $sth = $dbh->prepare($request);
1419
    if ($collectivity) {
1431
    $sth->execute( @params );
1420
        $sth->execute( uc($surname) );
1421
    } elsif($dateofbirth){
1422
        $sth->execute( uc($surname), ucfirst($firstname), $dateofbirth );
1423
    }else{
1424
        $sth->execute( uc($surname), ucfirst($firstname));
1425
    }
1426
    my @data = $sth->fetchrow;
1432
    my @data = $sth->fetchrow;
1427
    ( $data[0] ) and return $data[0], $data[1];
1433
    ( $data[0] ) and return $data[0], $data[1];
1428
    return 0;
1434
    return 0;
(-)a/C4/Serials.pm (-23 / +36 lines)
Lines 180-200 sub GetSerialInformation { Link Here
180
               subscription.*,
180
               subscription.*,
181
               subscription.subscriptionid as subsid
181
               subscription.subscriptionid as subsid
182
    |;
182
    |;
183
    my @branches;
183
    if (   C4::Context->preference('IndependentBranches')
184
    if (   C4::Context->preference('IndependentBranches')
184
        && C4::Context->userenv
185
        && C4::Context->userenv
185
        && C4::Context->userenv->{'flags'} % 2 != 1
186
        && C4::Context->userenv->{'flags'} % 2 != 1
186
        && C4::Context->userenv->{'branch'} ) {
187
        && C4::Context->userenv->{'branch'} ) {
187
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
188
        @branches = GetIndependentGroupModificationRights();
188
        $query .= qq|
189
        $query .= "
189
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
190
            , (
190
        |;
191
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) ." ) )
192
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
193
            ) AS cannotedit
194
        ";
191
    }
195
    }
192
    $query .= qq|
196
    $query .= qq|
193
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
197
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
194
        WHERE  serialid = ?
198
        WHERE  serialid = ?
195
    |;
199
    |;
196
    my $rq = $dbh->prepare($query);
200
    my $rq = $dbh->prepare($query);
197
    $rq->execute($serialid);
201
    $rq->execute($serialid, @branches);
198
    my $data = $rq->fetchrow_hashref;
202
    my $data = $rq->fetchrow_hashref;
199
203
200
    # create item information if we have serialsadditems for this subscription
204
    # create item information if we have serialsadditems for this subscription
Lines 301-317 sub GetSubscription { Link Here
301
                subscription.biblionumber as bibnum
305
                subscription.biblionumber as bibnum
302
    |;
306
    |;
303
307
308
    my @branches;
304
    if (   C4::Context->preference('IndependentBranches')
309
    if (   C4::Context->preference('IndependentBranches')
305
        && C4::Context->userenv
310
        && C4::Context->userenv
306
        && C4::Context->userenv->{'flags'} % 2 != 1
311
        && C4::Context->userenv->{'flags'} % 2 != 1
307
        && C4::Context->userenv->{'branch'} )
312
        && C4::Context->userenv->{'branch'} )
308
    {
313
    {
309
        my $branches =
314
        @branches = GetIndependentGroupModificationRights();
310
          GetIndependentGroupModificationRights( { stringify => 1 } );
311
315
312
        $query .= qq|
316
        $query .= "
313
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
317
            , (
314
        |;
318
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) ." ) )
319
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
320
            ) AS cannotedit
321
        ";
315
    }
322
    }
316
323
317
    $query .= qq|
324
    $query .= qq|
Lines 324-330 sub GetSubscription { Link Here
324
331
325
    $debug and warn "query : $query\nsubsid :$subscriptionid";
332
    $debug and warn "query : $query\nsubsid :$subscriptionid";
326
    my $sth = $dbh->prepare($query);
333
    my $sth = $dbh->prepare($query);
327
    $sth->execute($subscriptionid);
334
    $sth->execute($subscriptionid, @branches);
328
    my $subscription = $sth->fetchrow_hashref;
335
    my $subscription = $sth->fetchrow_hashref;
329
    $subscription->{cannotedit} = not can_edit_subscription( $subscription );
336
    $subscription->{cannotedit} = not can_edit_subscription( $subscription );
330
    return $subscription;
337
    return $subscription;
Lines 359-375 sub GetFullSubscription { Link Here
359
            subscription.subscriptionid AS subscriptionid
366
            subscription.subscriptionid AS subscriptionid
360
    |;
367
    |;
361
368
369
    my @branches;
362
    if (   C4::Context->preference('IndependentBranches')
370
    if (   C4::Context->preference('IndependentBranches')
363
        && C4::Context->userenv
371
        && C4::Context->userenv
364
        && C4::Context->userenv->{'flags'} % 2 != 1
372
        && C4::Context->userenv->{'flags'} % 2 != 1
365
        && C4::Context->userenv->{'branch'} )
373
        && C4::Context->userenv->{'branch'} )
366
    {
374
    {
367
        my $branches =
375
        @branches = GetIndependentGroupModificationRights();
368
          GetIndependentGroupModificationRights( { stringify => 1 } );
369
376
370
        $query .= qq|
377
        $query .= "
371
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
378
            , (
372
        |;
379
                ( subscription.branchcode NOT IN ( " . join(',', ('?') x @branches) . " ) )
380
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
381
            ) AS cannotedit
382
        ";
373
    }
383
    }
374
384
375
    $query .= qq|
385
    $query .= qq|
Lines 385-391 sub GetFullSubscription { Link Here
385
          |;
395
          |;
386
    $debug and warn "GetFullSubscription query: $query";
396
    $debug and warn "GetFullSubscription query: $query";
387
    my $sth = $dbh->prepare($query);
397
    my $sth = $dbh->prepare($query);
388
    $sth->execute($subscriptionid);
398
    $sth->execute( $subscriptionid, @branches );
389
    my $subscriptions = $sth->fetchall_arrayref( {} );
399
    my $subscriptions = $sth->fetchall_arrayref( {} );
390
    for my $subscription ( @$subscriptions ) {
400
    for my $subscription ( @$subscriptions ) {
391
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
401
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
Lines 542-558 sub GetFullSubscriptionsFromBiblionumber { Link Here
542
            subscription.subscriptionid AS subscriptionid
552
            subscription.subscriptionid AS subscriptionid
543
    |;
553
    |;
544
554
555
    my @branches;
545
    if (   C4::Context->preference('IndependentBranches')
556
    if (   C4::Context->preference('IndependentBranches')
546
        && C4::Context->userenv
557
        && C4::Context->userenv
547
        && C4::Context->userenv->{'flags'} != 1
558
        && C4::Context->userenv->{'flags'} != 1
548
        && C4::Context->userenv->{'branch'} )
559
        && C4::Context->userenv->{'branch'} )
549
    {
560
    {
550
        my $branches =
561
        @branches = GetIndependentGroupModificationRights();
551
          GetIndependentGroupModificationRights( { stringify => 1 } );
552
562
553
        $query .= qq|
563
        $query .= "
554
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
564
            , (
555
        |;
565
                ( subscription.branchcode NOT IN (" . join(',', ('?') x @branches) . ") )
566
                AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL
567
            ) AS cannotedit
568
        ";
556
    }
569
    }
557
570
558
    $query .= qq|
571
    $query .= qq|
Lines 567-573 sub GetFullSubscriptionsFromBiblionumber { Link Here
567
          serial.subscriptionid
580
          serial.subscriptionid
568
          |;
581
          |;
569
    my $sth = $dbh->prepare($query);
582
    my $sth = $dbh->prepare($query);
570
    $sth->execute($biblionumber);
583
    $sth->execute($biblionumber, @branches);
571
    my $subscriptions = $sth->fetchall_arrayref( {} );
584
    my $subscriptions = $sth->fetchall_arrayref( {} );
572
    for my $subscription ( @$subscriptions ) {
585
    for my $subscription ( @$subscriptions ) {
573
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
586
        $subscription->{cannotedit} = not can_edit_subscription( $subscription );
(-)a/C4/Suggestions.pm (-14 / +16 lines)
Lines 138-146 sub SearchSuggestion { Link Here
138
        && !C4::Context->IsSuperLibrarian()
138
        && !C4::Context->IsSuperLibrarian()
139
        && !$suggestion->{branchcode} )
139
        && !$suggestion->{branchcode} )
140
    {
140
    {
141
        my $branches =
141
        my @branches =
142
          GetIndependentGroupModificationRights( { stringify => 1 } );
142
          GetIndependentGroupModificationRights();
143
        push( @query, qq{ AND (suggestions.branchcode IN ( $branches ) OR suggestions.branchcode='') } );
143
        push( @query, " AND (suggestions.branchcode IN ( " . join(',', ('?') x @branches) ." ) OR suggestions.branchcode='') " );
144
        push( @sql_params, @branches );
144
    }
145
    }
145
    else {
146
    else {
146
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
147
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
Lines 345-356 sub GetSuggestionByStatus { Link Here
345
            && !C4::Context->IsSuperLibrarian() )
346
            && !C4::Context->IsSuperLibrarian() )
346
        {
347
        {
347
348
348
            my $branches =
349
            my @branches =
349
              GetIndependentGroupModificationRights( { stringify => 1 } );
350
              GetIndependentGroupModificationRights();
350
351
351
            $query .= qq{
352
            $query .= "
352
                AND (U1.branchcode IN ( $branches ) OR U1.branchcode ='')
353
                AND (U1.branchcode IN ( " . join(',', ('?') x @branches) . " ) OR U1.branchcode ='')
353
            };
354
            ";
355
            push( @sql_params, @branches );
354
        }
356
        }
355
357
356
        if ($branchcode) {
358
        if ($branchcode) {
Lines 398-419 sub CountSuggestion { Link Here
398
    if ( C4::Context->preference("IndependentBranches")
400
    if ( C4::Context->preference("IndependentBranches")
399
        && !C4::Context->IsSuperLibrarian() )
401
        && !C4::Context->IsSuperLibrarian() )
400
    {
402
    {
401
        my $branches =
403
        my @branches =
402
          GetIndependentGroupModificationRights( { stringify => 1 } );
404
          GetIndependentGroupModificationRights();
403
405
404
        my $query = qq{
406
        my $query = "
405
            SELECT count(*)
407
            SELECT count(*)
406
            FROM suggestions
408
            FROM suggestions
407
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
409
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
408
            WHERE STATUS=?
410
            WHERE STATUS=?
409
                AND (
411
                AND (
410
                    borrowers.branchcode IN ( $branches )
412
                    borrowers.branchcode IN (" . join(',', ('?') x @branches) . ")
411
                    OR
413
                    OR
412
                    borrowers.branchcode=?
414
                    borrowers.branchcode=?
413
                )
415
                )
414
        };
416
        ";
415
        $sth = $dbh->prepare($query);
417
        $sth = $dbh->prepare($query);
416
        $sth->execute( $status, $userenv->{branch} );
418
        $sth->execute( $status, @branches, $userenv->{branch} );
417
    }
419
    }
418
    else {
420
    else {
419
        my $query = q{
421
        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