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

(-)a/C4/Acquisition.pm (-10 / +11 lines)
Lines 1893-1901 sub GetParcel { Link Here
1893
    my @query_params = ( $supplierid, $code, $datereceived );
1893
    my @query_params = ( $supplierid, $code, $datereceived );
1894
    if ( C4::Context->preference("IndependentBranches") ) {
1894
    if ( C4::Context->preference("IndependentBranches") ) {
1895
        unless ( C4::Context->IsSuperLibrarian() ) {
1895
        unless ( C4::Context->IsSuperLibrarian() ) {
1896
            $strsth .= " and (borrowers.branchcode = ?
1896
            my $branches =
1897
                        or borrowers.branchcode  = '')";
1897
              GetIndependentGroupModificationRights( { stringify => 1 } );
1898
            push @query_params, C4::Context->userenv->{branch};
1898
            $strsth .= " AND ( borrowers.branchcode IN ( $branches ) OR borrowers.branchcode  = '')";
1899
        }
1899
        }
1900
    }
1900
    }
1901
    $strsth .= " ORDER BY aqbasket.basketno";
1901
    $strsth .= " ORDER BY aqbasket.basketno";
Lines 2111-2118 sub GetLateOrders { Link Here
2111
    }
2111
    }
2112
    if (C4::Context->preference("IndependentBranches")
2112
    if (C4::Context->preference("IndependentBranches")
2113
            && !C4::Context->IsSuperLibrarian() ) {
2113
            && !C4::Context->IsSuperLibrarian() ) {
2114
        $from .= ' AND borrowers.branchcode LIKE ? ';
2114
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2115
        push @query_params, C4::Context->userenv->{branch};
2115
        $from .= qq{ AND borrowers.branchcode IN ( $branches ) };
2116
    }
2116
    }
2117
    $from .= " AND orderstatus <> 'cancelled' ";
2117
    $from .= " AND orderstatus <> 'cancelled' ";
2118
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
2118
    my $query = "$select $from $having\nORDER BY latesince, basketno, borrowers.branchcode, supplier";
Lines 2305-2315 sub GetHistory { Link Here
2305
        push @query_params, "%$basketgroupname%";
2305
        push @query_params, "%$basketgroupname%";
2306
    }
2306
    }
2307
2307
2308
    if ( C4::Context->preference("IndependentBranches") ) {
2308
    if ( C4::Context->preference("IndependentBranches")
2309
        unless ( C4::Context->IsSuperLibrarian() ) {
2309
        && !C4::Context->IsSuperLibrarian() )
2310
            $query .= " AND (borrowers.branchcode = ? OR borrowers.branchcode ='' ) ";
2310
    {
2311
            push @query_params, C4::Context->userenv->{branch};
2311
        my $branches =
2312
        }
2312
          GetIndependentGroupModificationRights( { stringify => 1 } );
2313
        $query .= qq{ AND ( borrowers.branchcode = ? OR borrowers.branchcode IN ( $branches ) ) };
2313
    }
2314
    }
2314
    $query .= " ORDER BY id";
2315
    $query .= " ORDER BY id";
2315
    my $sth = $dbh->prepare($query);
2316
    my $sth = $dbh->prepare($query);
(-)a/C4/Branch.pm (-4 / +89 lines)
Lines 19-24 package C4::Branch; Link Here
19
use strict;
19
use strict;
20
#use warnings; FIXME - Bug 2505
20
#use warnings; FIXME - Bug 2505
21
require Exporter;
21
require Exporter;
22
use Carp;
22
use C4::Context;
23
use C4::Context;
23
24
24
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
25
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Lines 42-47 BEGIN { Link Here
42
		&GetBranchCategories
43
		&GetBranchCategories
43
		&GetBranchesInCategory
44
		&GetBranchesInCategory
44
		&ModBranchCategoryInfo
45
		&ModBranchCategoryInfo
46
        &GetIndependentGroupModificationRights
45
		&DelBranch
47
		&DelBranch
46
		&DelBranchCategory
48
		&DelBranchCategory
47
	        &CheckCategoryUnique
49
	        &CheckCategoryUnique
Lines 114-121 sub GetBranches { Link Here
114
    my $query="SELECT * FROM branches";
116
    my $query="SELECT * FROM branches";
115
    my @bind_parameters;
117
    my @bind_parameters;
116
    if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
118
    if ($onlymine && C4::Context->userenv && C4::Context->userenv->{branch}){
117
      $query .= ' WHERE branchcode = ? ';
119
      my $branches = GetIndependentGroupModificationRights({ stringify => 1 });
118
      push @bind_parameters, C4::Context->userenv->{branch};
120
      $query .= qq{ WHERE branchcode IN ( $branches ) };
119
    }
121
    }
120
        $query.=" ORDER BY branchname";
122
        $query.=" ORDER BY branchname";
121
    $sth = $dbh->prepare($query);
123
    $sth = $dbh->prepare($query);
Lines 301-307 C<$results> is an hashref Link Here
301
303
302
sub GetBranchCategory {
304
sub GetBranchCategory {
303
    my ($catcode) = @_;
305
    my ($catcode) = @_;
304
    return unless $catcode;
306
    unless ( $catcode ) {
307
        carp("No category code passed in!");
308
        return;
309
    }
305
310
306
    my $dbh = C4::Context->dbh;
311
    my $dbh = C4::Context->dbh;
307
    my $sth;
312
    my $sth;
Lines 371-377 the categories were already here, and minimally used. Link Here
371
376
372
	#TODO  manage category types.  rename possibly to 'agency domains' ? as borrowergroups are called categories.
377
	#TODO  manage category types.  rename possibly to 'agency domains' ? as borrowergroups are called categories.
373
sub GetCategoryTypes {
378
sub GetCategoryTypes {
374
	return ( 'searchdomain','properties');
379
 return ( 'searchdomain','independent_groups');
375
}
380
}
376
381
377
=head2 GetBranch
382
=head2 GetBranch
Lines 426-431 sub GetBranchesInCategory { Link Here
426
	return( \@branches );
431
	return( \@branches );
427
}
432
}
428
433
434
=head2 GetIndependentGroupModificationRights
435
436
    GetIndependentGroupModificationRights(
437
                                           {
438
                                               branch => $this_branch,
439
                                               for => $other_branch,
440
                                               stringify => 1,
441
                                           }
442
                                          );
443
444
    Returns a list of branches this branch shares a common
445
    independent group with.
446
447
    If 'branch' is not provided, it will be looked up via
448
    C4::Context->userenv->{branch}.
449
450
    If 'for' is provided, the lookup is limited to that branch.
451
452
    If called in a list context, returns a list of
453
    branchcodes ( including $this_branch ).
454
455
    If called in a scalar context, it returns
456
    a count of matching branchcodes. Returns 1 if
457
458
    If stringify param is passed, the return value will
459
    be a string of the comma delimited branchcodes. This
460
    is useful for "branchcode IN $branchcodes" clauses
461
    in SQL queries.
462
463
    $this_branch and $other_branch are equal for efficiency.
464
465
    So you can write:
466
    my @branches = GetIndependentGroupModificationRights();
467
    or something like:
468
    if ( GetIndependentGroupModificationRights( { for => $other_branch } ) ) { do_stuff(); }
469
470
=cut
471
472
sub GetIndependentGroupModificationRights {
473
    my ($params) = @_;
474
475
    my $this_branch  = $params->{branch};
476
    my $other_branch = $params->{for};
477
    my $stringify    = $params->{stringify};
478
479
    $this_branch ||= C4::Context->userenv->{branch};
480
481
    carp("No branch found!") unless ($this_branch);
482
483
    return 1 if ( $this_branch eq $other_branch );
484
485
    my $sql = q{
486
        SELECT DISTINCT(branchcode)
487
        FROM branchrelations
488
        JOIN branchcategories USING ( categorycode )
489
        WHERE categorycode IN (
490
            SELECT categorycode
491
            FROM branchrelations
492
            WHERE branchcode = ?
493
        )
494
        AND branchcategories.categorytype = 'independent_group'
495
    };
496
497
    my @params;
498
    push( @params, $this_branch );
499
500
    if ($other_branch) {
501
        $sql .= q{ AND branchcode = ? };
502
        push( @params, $other_branch );
503
    }
504
505
    my $dbh = C4::Context->dbh;
506
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
507
508
    return join( ',', map { qq{'$_'} } ( @branchcodes, $this_branch ) )
509
      if ($stringify);
510
511
    return wantarray() ? ( @branchcodes, $this_branch ) : scalar(@branchcodes);
512
}
513
429
=head2 GetBranchInfo
514
=head2 GetBranchInfo
430
515
431
$results = GetBranchInfo($branchcode);
516
$results = GetBranchInfo($branchcode);
(-)a/C4/Circulation.pm (-5 / +16 lines)
Lines 895-908 sub CanBookBeIssued { Link Here
895
        $alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
895
        $alerts{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
896
    }
896
    }
897
    if ( C4::Context->preference("IndependentBranches") ) {
897
    if ( C4::Context->preference("IndependentBranches") ) {
898
        my $userenv = C4::Context->userenv;
899
        unless ( C4::Context->IsSuperLibrarian() ) {
898
        unless ( C4::Context->IsSuperLibrarian() ) {
900
            if ( $item->{C4::Context->preference("HomeOrHoldingBranch")} ne $userenv->{branch} ){
899
            unless (
900
                GetIndependentGroupModificationRights(
901
                    {
902
                        for => $item->{ C4::Context->preference(
903
                                "HomeOrHoldingBranch") }
904
                    }
905
                )
906
              )
907
            {
901
                $issuingimpossible{ITEMNOTSAMEBRANCH} = 1;
908
                $issuingimpossible{ITEMNOTSAMEBRANCH} = 1;
902
                $issuingimpossible{'itemhomebranch'} = $item->{C4::Context->preference("HomeOrHoldingBranch")};
909
                $issuingimpossible{'itemhomebranch'} =
910
                  $item->{ C4::Context->preference("HomeOrHoldingBranch") };
903
            }
911
            }
904
            $needsconfirmation{BORRNOTSAMEBRANCH} = GetBranchName( $borrower->{'branchcode'} )
912
905
              if ( $borrower->{'branchcode'} ne $userenv->{branch} );
913
            $needsconfirmation{BORRNOTSAMEBRANCH} =
914
              GetBranchName( $borrower->{'branchcode'} )
915
              if (
916
                $borrower->{'branchcode'} ne C4::Context->userenv->{branch} );
906
        }
917
        }
907
    }
918
    }
908
919
(-)a/C4/Items.pm (-18 / +30 lines)
Lines 33-38 use List::MoreUtils qw/any/; Link Here
33
use YAML qw/Load/;
33
use YAML qw/Load/;
34
use Data::Dumper; # used as part of logging item record changes, not just for
34
use Data::Dumper; # used as part of logging item record changes, not just for
35
                  # debugging; so please don't remove this
35
                  # debugging; so please don't remove this
36
use C4::Branch qw/GetIndependentGroupModificationRights/;
36
37
37
use vars qw($VERSION @ISA @EXPORT);
38
use vars qw($VERSION @ISA @EXPORT);
38
39
Lines 1273-1290 sub GetItemsInfo { Link Here
1273
        my $datedue = '';
1274
        my $datedue = '';
1274
        $isth->execute( $data->{'itemnumber'} );
1275
        $isth->execute( $data->{'itemnumber'} );
1275
        if ( my $idata = $isth->fetchrow_hashref ) {
1276
        if ( my $idata = $isth->fetchrow_hashref ) {
1276
            $data->{borrowernumber} = $idata->{borrowernumber};
1277
            $data->{borrowernumber}  = $idata->{borrowernumber};
1277
            $data->{cardnumber}     = $idata->{cardnumber};
1278
            $data->{cardnumber}      = $idata->{cardnumber};
1278
            $data->{surname}     = $idata->{surname};
1279
            $data->{surname}         = $idata->{surname};
1279
            $data->{firstname}     = $idata->{firstname};
1280
            $data->{firstname}       = $idata->{firstname};
1280
            $data->{lastreneweddate} = $idata->{lastreneweddate};
1281
            $data->{lastreneweddate} = $idata->{lastreneweddate};
1281
            $datedue                = $idata->{'date_due'};
1282
            $datedue                 = $idata->{'date_due'};
1282
        if (C4::Context->preference("IndependentBranches")){
1283
1283
        my $userenv = C4::Context->userenv;
1284
            if ( C4::Context->preference("IndependentBranches") && C4::Context->userenv ) {
1284
        unless ( C4::Context->IsSuperLibrarian() ) {
1285
                unless (
1285
            $data->{'NOTSAMEBRANCH'} = 1 if ($idata->{'bcode'} ne $userenv->{branch});
1286
                    C4::Context->IsSuperLibrarian()
1286
        }
1287
                    || GetIndependentGroupModificationRights( { for => $idata->{'bcode'} } )
1287
        }
1288
                  )
1289
                {
1290
                    $data->{'NOTSAMEBRANCH'} = 1 if ($idata->{'bcode'} ne C4::Context->userenv->{branch});
1291
                }
1292
            }
1288
        }
1293
        }
1289
		if ( $data->{'serial'}) {	
1294
		if ( $data->{'serial'}) {	
1290
			$ssth->execute($data->{'itemnumber'}) ;
1295
			$ssth->execute($data->{'itemnumber'}) ;
Lines 2237-2248 sub DelItemCheck { Link Here
2237
    my $item = GetItem($itemnumber);
2242
    my $item = GetItem($itemnumber);
2238
    my $onloan=$sth->fetchrow;
2243
    my $onloan=$sth->fetchrow;
2239
2244
2240
    if ($onloan){
2245
    if ($onloan) {
2241
        $error = "book_on_loan" 
2246
        $error = "book_on_loan";
2242
    }
2247
    }
2243
    elsif ( !C4::Context->IsSuperLibrarian()
2248
    elsif (
2244
        and C4::Context->preference("IndependentBranches")
2249
           !C4::Context->IsSuperLibrarian()
2245
        and ( C4::Context->userenv->{branch} ne $item->{'homebranch'} ) )
2250
        && C4::Context->preference("IndependentBranches")
2251
        && !GetIndependentGroupModificationRights(
2252
            {
2253
                for => $item->{ C4::Context->preference("HomeOrHoldingBranch") }
2254
            }
2255
        )
2256
      )
2246
    {
2257
    {
2247
        $error = "not_same_branch";
2258
        $error = "not_same_branch";
2248
    }
2259
    }
Lines 2718-2725 sub PrepareItemrecordDisplay { Link Here
2718
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2729
                    if ( $tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) {
2719
                        if (   ( C4::Context->preference("IndependentBranches") )
2730
                        if (   ( C4::Context->preference("IndependentBranches") )
2720
                            && !C4::Context->IsSuperLibrarian() ) {
2731
                            && !C4::Context->IsSuperLibrarian() ) {
2721
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode = ? ORDER BY branchname" );
2732
                            my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
2722
                            $sth->execute( C4::Context->userenv->{branch} );
2733
                            my $sth = $dbh->prepare( "SELECT branchcode,branchname FROM branches WHERE branchcode IN ( $branches ) ORDER BY branchname" );
2734
                            $sth->execute();
2723
                            push @authorised_values, ""
2735
                            push @authorised_values, ""
2724
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2736
                              unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
2725
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
2737
                            while ( my ( $branchcode, $branchname ) = $sth->fetchrow_array ) {
(-)a/C4/Letters.pm (-1 / +1 lines)
Lines 126-132 our %letter; Link Here
126
sub getletter {
126
sub getletter {
127
    my ( $module, $code, $branchcode ) = @_;
127
    my ( $module, $code, $branchcode ) = @_;
128
128
129
    $branchcode ||= '';
129
    $branchcode ||= q{};
130
130
131
    if ( C4::Context->preference('IndependentBranches')
131
    if ( C4::Context->preference('IndependentBranches')
132
            and $branchcode
132
            and $branchcode
(-)a/C4/Members.pm (-49 / +69 lines)
Lines 25-30 use strict; Link Here
25
use C4::Context;
25
use C4::Context;
26
use C4::Dates qw(format_date_in_iso format_date);
26
use C4::Dates qw(format_date_in_iso format_date);
27
use String::Random qw( random_string );
27
use String::Random qw( random_string );
28
use Clone qw(clone);
28
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
29
use Date::Calc qw/Today Add_Delta_YM check_date Date_to_Days/;
29
use C4::Log; # logaction
30
use C4::Log; # logaction
30
use C4::Overdues;
31
use C4::Overdues;
Lines 41-47 use Koha::DateUtils; Link Here
41
use Koha::Borrower::Debarments qw(IsDebarred);
42
use Koha::Borrower::Debarments qw(IsDebarred);
42
use Text::Unaccent qw( unac_string );
43
use Text::Unaccent qw( unac_string );
43
use Koha::AuthUtils qw(hash_password);
44
use Koha::AuthUtils qw(hash_password);
44
45
use C4::Branch qw( GetIndependentGroupModificationRights );
45
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
46
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
46
47
47
BEGIN {
48
BEGIN {
Lines 259-283 sub Search { Link Here
259
    # $showallbranches was not used at the time SearchMember() was mainstreamed into Search().
260
    # $showallbranches was not used at the time SearchMember() was mainstreamed into Search().
260
    # Mentioning for the reference
261
    # Mentioning for the reference
261
262
262
    if ( C4::Context->preference("IndependentBranches") ) { # && !$showallbranches){
263
    if ( C4::Context->preference("IndependentBranches") ) {
263
        if ( my $userenv = C4::Context->userenv ) {
264
        unless ( C4::Context->IsSuperLibrarian() ) {
264
            my $branch =  $userenv->{'branch'};
265
            $filter = clone($filter);    # Modify a copy only
265
            if ( !C4::Context->IsSuperLibrarian() && $branch ){
266
            my @branches = GetIndependentGroupModificationRights();
266
                if (my $fr = ref $filter) {
267
            if ( my $fr = ref $filter ) {
267
                    if ( $fr eq "HASH" ) {
268
                if ( $fr eq "HASH" ) {
268
                        $filter->{branchcode} = $branch;
269
                    $filter->{branchcode} = \@branches;
269
                    }
270
                    else {
271
                        foreach (@$filter) {
272
                            $_ = { '' => $_ } unless ref $_;
273
                            $_->{branchcode} = $branch;
274
                        }
275
                    }
276
                }
270
                }
277
                else {
271
                else {
278
                    $filter = { '' => $filter, branchcode => $branch };
272
                    foreach (@$filter) {
273
                        $_ = { '' => $_ } unless ref $_;
274
                        $_->{branchcode} = \@branches;
275
                    }
279
                }
276
                }
280
            }      
277
            }
278
            else {
279
                $filter = { '' => $filter, branchcode => \@branches };
280
            }
281
        }
281
        }
282
    }
282
    }
283
283
Lines 1315-1320 sub checkuniquemember { Link Here
1315
            ($dateofbirth) ?
1315
            ($dateofbirth) ?
1316
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1316
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?  and dateofbirth=?" :
1317
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1317
            "SELECT borrowernumber,categorycode FROM borrowers WHERE surname=? and firstname=?";
1318
1319
    if ( C4::Context->preference('IndependentBranches') ) {
1320
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
1321
        $request .= " AND branchcode IN ( $branches )";
1322
    }
1323
1318
    my $sth = $dbh->prepare($request);
1324
    my $sth = $dbh->prepare($request);
1319
    if ($collectivity) {
1325
    if ($collectivity) {
1320
        $sth->execute( uc($surname) );
1326
        $sth->execute( uc($surname) );
Lines 2043-2055 sub GetBorrowersToExpunge { Link Here
2043
    my $filterdate     = $params->{'not_borrowered_since'};
2049
    my $filterdate     = $params->{'not_borrowered_since'};
2044
    my $filterexpiry   = $params->{'expired_before'};
2050
    my $filterexpiry   = $params->{'expired_before'};
2045
    my $filtercategory = $params->{'category_code'};
2051
    my $filtercategory = $params->{'category_code'};
2046
    my $filterbranch   = $params->{'branchcode'} ||
2052
    my $filterbranch   = $params->{'branchcode'};
2047
                        ((C4::Context->preference('IndependentBranches')
2053
    my @filterbranches =
2048
                             && C4::Context->userenv 
2054
      (      C4::Context->preference('IndependentBranches')
2049
                             && !C4::Context->IsSuperLibrarian()
2055
          && C4::Context->userenv
2050
                             && C4::Context->userenv->{branch})
2056
          && !C4::Context->IsSuperLibrarian()
2051
                         ? C4::Context->userenv->{branch}
2057
          && C4::Context->userenv->{branch} )
2052
                         : "");  
2058
      ? GetIndependentGroupModificationRights()
2059
      : ($filterbranch);
2053
2060
2054
    my $dbh   = C4::Context->dbh;
2061
    my $dbh   = C4::Context->dbh;
2055
    my $query = "
2062
    my $query = "
Lines 2064-2072 sub GetBorrowersToExpunge { Link Here
2064
        AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0)
2071
        AND borrowernumber NOT IN (SELECT guarantorid FROM borrowers WHERE guarantorid IS NOT NULL AND guarantorid <> 0)
2065
   ";
2072
   ";
2066
    my @query_params;
2073
    my @query_params;
2067
    if ( $filterbranch && $filterbranch ne "" ) {
2074
    if ( @filterbranches ) {
2068
        $query.= " AND borrowers.branchcode = ? ";
2075
        my $placeholders = join( ',', ('?') x @filterbranches );
2069
        push( @query_params, $filterbranch );
2076
        $query.= " AND borrowers.branchcode IN ( $placeholders )";
2077
        push( @query_params, @filterbranches );
2070
    }
2078
    }
2071
    if ( $filterexpiry ) {
2079
    if ( $filterexpiry ) {
2072
        $query .= " AND dateexpiry < ? ";
2080
        $query .= " AND dateexpiry < ? ";
Lines 2109-2121 I<$result> is a ref to an array which all elements are a hasref. Link Here
2109
=cut
2117
=cut
2110
2118
2111
sub GetBorrowersWhoHaveNeverBorrowed {
2119
sub GetBorrowersWhoHaveNeverBorrowed {
2112
    my $filterbranch = shift || 
2120
    my $filterbranch = shift;
2113
                        ((C4::Context->preference('IndependentBranches')
2121
2114
                             && C4::Context->userenv 
2122
    my @filterbranches =
2115
                             && !C4::Context->IsSuperLibrarian()
2123
      (      C4::Context->preference('IndependentBranches')
2116
                             && C4::Context->userenv->{branch})
2124
          && C4::Context->userenv
2117
                         ? C4::Context->userenv->{branch}
2125
          && !C4::Context->IsSuperLibrarian()
2118
                         : "");  
2126
          && C4::Context->userenv->{branch} )
2127
      ? GetIndependentGroupModificationRights()
2128
      : ($filterbranch);
2129
2119
    my $dbh   = C4::Context->dbh;
2130
    my $dbh   = C4::Context->dbh;
2120
    my $query = "
2131
    my $query = "
2121
        SELECT borrowers.borrowernumber,max(timestamp) as latestissue
2132
        SELECT borrowers.borrowernumber,max(timestamp) as latestissue
Lines 2123-2132 sub GetBorrowersWhoHaveNeverBorrowed { Link Here
2123
          LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber
2134
          LEFT JOIN issues ON borrowers.borrowernumber = issues.borrowernumber
2124
        WHERE issues.borrowernumber IS NULL
2135
        WHERE issues.borrowernumber IS NULL
2125
   ";
2136
   ";
2137
2126
    my @query_params;
2138
    my @query_params;
2127
    if ($filterbranch && $filterbranch ne ""){ 
2139
    if (@filterbranches) {
2128
        $query.=" AND borrowers.branchcode= ?";
2140
        my $placeholders = join( ',', ('?') x @filterbranches );
2129
        push @query_params,$filterbranch;
2141
        $query .= " AND borrowers.branchcode IN ( $placeholders ) ";
2142
        push( @query_params, @filterbranches );
2130
    }
2143
    }
2131
    warn $query if $debug;
2144
    warn $query if $debug;
2132
  
2145
  
Lines 2159-2183 This hashref is containt the number of time this borrowers has borrowed before I Link Here
2159
sub GetBorrowersWithIssuesHistoryOlderThan {
2172
sub GetBorrowersWithIssuesHistoryOlderThan {
2160
    my $dbh  = C4::Context->dbh;
2173
    my $dbh  = C4::Context->dbh;
2161
    my $date = shift ||POSIX::strftime("%Y-%m-%d",localtime());
2174
    my $date = shift ||POSIX::strftime("%Y-%m-%d",localtime());
2162
    my $filterbranch = shift || 
2175
    my $filterbranch = shift;
2163
                        ((C4::Context->preference('IndependentBranches')
2176
2164
                             && C4::Context->userenv 
2177
    my @filterbranches =
2165
                             && !C4::Context->IsSuperLibrarian()
2178
      (      C4::Context->preference('IndependentBranches')
2166
                             && C4::Context->userenv->{branch})
2179
          && C4::Context->userenv
2167
                         ? C4::Context->userenv->{branch}
2180
          && !C4::Context->IsSuperLibrarian()
2168
                         : "");  
2181
          && C4::Context->userenv->{branch} )
2182
      ? GetIndependentGroupModificationRights()
2183
      : ($filterbranch);
2184
2169
    my $query = "
2185
    my $query = "
2170
       SELECT count(borrowernumber) as n,borrowernumber
2186
       SELECT count(borrowernumber) as n,borrowernumber
2171
       FROM old_issues
2187
       FROM old_issues
2172
       WHERE returndate < ?
2188
       WHERE returndate < ?
2173
         AND borrowernumber IS NOT NULL 
2189
         AND borrowernumber IS NOT NULL 
2174
    "; 
2190
    "; 
2191
2175
    my @query_params;
2192
    my @query_params;
2176
    push @query_params, $date;
2193
    push( @query_params, $date );
2177
    if ($filterbranch){
2194
2178
        $query.="   AND branchcode = ?";
2195
    if (@filterbranches) {
2179
        push @query_params, $filterbranch;
2196
        my $placeholders = join( ',', ('?') x @filterbranches );
2180
    }    
2197
        $query .= " AND branchcode IN ( $placeholders ) ";
2198
        push( @query_params, @filterbranches );
2199
    }
2200
2181
    $query.=" GROUP BY borrowernumber ";
2201
    $query.=" GROUP BY borrowernumber ";
2182
    warn $query if $debug;
2202
    warn $query if $debug;
2183
    my $sth = $dbh->prepare($query);
2203
    my $sth = $dbh->prepare($query);
(-)a/C4/Serials.pm (-17 / +99 lines)
Lines 30-35 use C4::Log; # logaction Link Here
30
use C4::Debug;
30
use C4::Debug;
31
use C4::Serials::Frequency;
31
use C4::Serials::Frequency;
32
use C4::Serials::Numberpattern;
32
use C4::Serials::Numberpattern;
33
use C4::Branch qw(GetIndependentGroupModificationRights);
33
34
34
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
35
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
35
36
Lines 230-236 sub GetSerialInformation { Link Here
230
    my ($serialid) = @_;
231
    my ($serialid) = @_;
231
    my $dbh        = C4::Context->dbh;
232
    my $dbh        = C4::Context->dbh;
232
    my $query      = qq|
233
    my $query      = qq|
233
        SELECT serial.*, serial.notes as sernotes, serial.status as serstatus,subscription.*,subscription.subscriptionid as subsid
234
        SELECT serial.*,
235
               serial.notes as sernotes,
236
               serial.status as serstatus,
237
               subscription.*,
238
               subscription.subscriptionid as subsid
239
    |;
240
    if (   C4::Context->preference('IndependentBranches')
241
        && C4::Context->userenv
242
        && C4::Context->userenv->{'flags'} % 2 != 1
243
        && C4::Context->userenv->{'branch'} ) {
244
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
245
        $query .= qq|
246
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
247
        |;
248
    }
249
    $query .= qq|
234
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
250
        FROM   serial LEFT JOIN subscription ON subscription.subscriptionid=serial.subscriptionid
235
        WHERE  serialid = ?
251
        WHERE  serialid = ?
236
    |;
252
    |;
Lines 329-346 subscription, subscriptionhistory, aqbooksellers.name, biblio.title Link Here
329
sub GetSubscription {
345
sub GetSubscription {
330
    my ($subscriptionid) = @_;
346
    my ($subscriptionid) = @_;
331
    my $dbh              = C4::Context->dbh;
347
    my $dbh              = C4::Context->dbh;
332
    my $query            = qq(
348
349
    my $query = qq|
333
        SELECT  subscription.*,
350
        SELECT  subscription.*,
334
                subscriptionhistory.*,
351
                subscriptionhistory.*,
335
                aqbooksellers.name AS aqbooksellername,
352
                aqbooksellers.name AS aqbooksellername,
336
                biblio.title AS bibliotitle,
353
                biblio.title AS bibliotitle,
337
                subscription.biblionumber as bibnum
354
                subscription.biblionumber as bibnum
355
    |;
356
357
    if (   C4::Context->preference('IndependentBranches')
358
        && C4::Context->userenv
359
        && C4::Context->userenv->{'flags'} % 2 != 1
360
        && C4::Context->userenv->{'branch'} )
361
    {
362
        my $branches =
363
          GetIndependentGroupModificationRights( { stringify => 1 } );
364
365
        $query .= qq|
366
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
367
        |;
368
    }
369
370
    $query .= qq|
338
       FROM subscription
371
       FROM subscription
339
       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
372
       LEFT JOIN subscriptionhistory ON subscription.subscriptionid=subscriptionhistory.subscriptionid
340
       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
373
       LEFT JOIN aqbooksellers ON subscription.aqbooksellerid=aqbooksellers.id
341
       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
374
       LEFT JOIN biblio ON biblio.biblionumber=subscription.biblionumber
342
       WHERE subscription.subscriptionid = ?
375
       WHERE subscription.subscriptionid = ?
343
    );
376
    |;
344
377
345
    $debug and warn "query : $query\nsubsid :$subscriptionid";
378
    $debug and warn "query : $query\nsubsid :$subscriptionid";
346
    my $sth = $dbh->prepare($query);
379
    my $sth = $dbh->prepare($query);
Lines 363-370 sub GetFullSubscription { Link Here
363
    return unless ($subscriptionid);
396
    return unless ($subscriptionid);
364
397
365
    my $dbh              = C4::Context->dbh;
398
    my $dbh              = C4::Context->dbh;
366
    my $query            = qq|
399
367
  SELECT    serial.serialid,
400
    my $query = qq|
401
        SELECT
402
            serial.serialid,
368
            serial.serialseq,
403
            serial.serialseq,
369
            serial.planneddate, 
404
            serial.planneddate, 
370
            serial.publisheddate, 
405
            serial.publisheddate, 
Lines 375-380 sub GetFullSubscription { Link Here
375
            biblio.title as bibliotitle,
410
            biblio.title as bibliotitle,
376
            subscription.branchcode AS branchcode,
411
            subscription.branchcode AS branchcode,
377
            subscription.subscriptionid AS subscriptionid
412
            subscription.subscriptionid AS subscriptionid
413
    |;
414
415
    if (   C4::Context->preference('IndependentBranches')
416
        && C4::Context->userenv
417
        && C4::Context->userenv->{'flags'} % 2 != 1
418
        && C4::Context->userenv->{'branch'} )
419
    {
420
        my $branches =
421
          GetIndependentGroupModificationRights( { stringify => 1 } );
422
423
        $query .= qq|
424
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
425
        |;
426
    }
427
428
    $query .= qq|
378
  FROM      serial 
429
  FROM      serial 
379
  LEFT JOIN subscription ON 
430
  LEFT JOIN subscription ON 
380
          (serial.subscriptionid=subscription.subscriptionid )
431
          (serial.subscriptionid=subscription.subscriptionid )
Lines 493-498 sub GetSubscriptionsFromBiblionumber { Link Here
493
        $subs->{ "periodicity" . $subs->{periodicity} }     = 1;
544
        $subs->{ "periodicity" . $subs->{periodicity} }     = 1;
494
        $subs->{ "numberpattern" . $subs->{numberpattern} } = 1;
545
        $subs->{ "numberpattern" . $subs->{numberpattern} } = 1;
495
        $subs->{ "status" . $subs->{'status'} }             = 1;
546
        $subs->{ "status" . $subs->{'status'} }             = 1;
547
        $subs->{'cannotedit'} = (
548
                 C4::Context->preference('IndependentBranches')
549
              && C4::Context->userenv
550
              && !C4::Context->IsSuperLibrarian()
551
              && C4::Context->userenv->{branch}
552
              && $subs->{branchcode}
553
              && GetIndependentGroupModificationRights(
554
                { for => $subs->{branchcode} }
555
              )
556
        );
496
557
497
        if ( $subs->{enddate} eq '0000-00-00' ) {
558
        if ( $subs->{enddate} eq '0000-00-00' ) {
498
            $subs->{enddate} = '';
559
            $subs->{enddate} = '';
Lines 517-524 sub GetSubscriptionsFromBiblionumber { Link Here
517
sub GetFullSubscriptionsFromBiblionumber {
578
sub GetFullSubscriptionsFromBiblionumber {
518
    my ($biblionumber) = @_;
579
    my ($biblionumber) = @_;
519
    my $dbh            = C4::Context->dbh;
580
    my $dbh            = C4::Context->dbh;
520
    my $query          = qq|
581
521
  SELECT    serial.serialid,
582
    my $query = qq|
583
        SELECT
584
            serial.serialid,
522
            serial.serialseq,
585
            serial.serialseq,
523
            serial.planneddate, 
586
            serial.planneddate, 
524
            serial.publisheddate, 
587
            serial.publisheddate, 
Lines 528-533 sub GetFullSubscriptionsFromBiblionumber { Link Here
528
            biblio.title as bibliotitle,
591
            biblio.title as bibliotitle,
529
            subscription.branchcode AS branchcode,
592
            subscription.branchcode AS branchcode,
530
            subscription.subscriptionid AS subscriptionid
593
            subscription.subscriptionid AS subscriptionid
594
    |;
595
596
    if (   C4::Context->preference('IndependentBranches')
597
        && C4::Context->userenv
598
        && C4::Context->userenv->{'flags'} != 1
599
        && C4::Context->userenv->{'branch'} )
600
    {
601
        my $branches =
602
          GetIndependentGroupModificationRights( { stringify => 1 } );
603
604
        $query .= qq|
605
            , ( ( subscription.branchcode NOT IN ( $branches ) ) AND subscription.branchcode <> '' AND subscription.branchcode IS NOT NULL ) AS cannotedit
606
        |;
607
    }
608
609
    $query .= qq|
531
  FROM      serial 
610
  FROM      serial 
532
  LEFT JOIN subscription ON 
611
  LEFT JOIN subscription ON 
533
          (serial.subscriptionid=subscription.subscriptionid)
612
          (serial.subscriptionid=subscription.subscriptionid)
Lines 2806-2826 Return 1 if the subscription is editable by the current logged user (or a given Link Here
2806
2885
2807
sub can_edit_subscription {
2886
sub can_edit_subscription {
2808
    my ( $subscription, $userid ) = @_;
2887
    my ( $subscription, $userid ) = @_;
2888
2809
    return 0 unless C4::Context->userenv;
2889
    return 0 unless C4::Context->userenv;
2890
2810
    my $flags = C4::Context->userenv->{flags};
2891
    my $flags = C4::Context->userenv->{flags};
2892
2811
    $userid ||= C4::Context->userenv->{'id'};
2893
    $userid ||= C4::Context->userenv->{'id'};
2894
2812
    my $independent_branches = C4::Context->preference('IndependentBranches');
2895
    my $independent_branches = C4::Context->preference('IndependentBranches');
2813
    return 1 unless $independent_branches;
2896
    return 1 unless $independent_branches;
2814
    if( C4::Context->IsSuperLibrarian()
2897
2815
        or C4::Auth::haspermission( $userid, {serials => 'superserials'}),
2898
    return
2816
        or C4::Auth::haspermission( $userid, {serials => 'edit_subscription'}),
2899
         C4::Context->IsSuperLibrarian()
2817
        or not defined $subscription->{branchcode}
2900
      or C4::Auth::haspermission( $userid, { serials => 'superserials' } ),
2818
        or $subscription->{branchcode} eq ''
2901
      or C4::Auth::haspermission( $userid, { serials => 'edit_subscription' } ),
2819
        or $subscription->{branchcode} eq C4::Context->userenv->{'branch'}
2902
      or not defined $subscription->{branchcode}
2820
    ) {
2903
      or $subscription->{branchcode} eq ''
2821
        return 1;
2904
      or GetIndependentGroupModificationRights(
2822
    }
2905
        { for => $subscription->{branchcode} } );
2823
     return 0;
2824
}
2906
}
2825
2907
2826
1;
2908
1;
(-)a/C4/Suggestions.pm (-20 / +31 lines)
Lines 32-37 use C4::Letters; Link Here
32
use List::MoreUtils qw(any);
32
use List::MoreUtils qw(any);
33
use C4::Dates qw(format_date_in_iso);
33
use C4::Dates qw(format_date_in_iso);
34
use base qw(Exporter);
34
use base qw(Exporter);
35
use C4::Branch qw(GetIndependentGroupModificationRights);
35
36
36
our $VERSION = 3.07.00.049;
37
our $VERSION = 3.07.00.049;
37
our @EXPORT  = qw(
38
our @EXPORT  = qw(
Lines 132-149 sub SearchSuggestion { Link Here
132
    }
133
    }
133
134
134
    # filter on user branch
135
    # filter on user branch
135
    if ( C4::Context->preference('IndependentBranches') ) {
136
    if (   C4::Context->preference('IndependentBranches')
136
        my $userenv = C4::Context->userenv;
137
        && !C4::Context->IsSuperLibrarian()
137
        if ($userenv) {
138
        && !$suggestion->{branchcode} )
138
            if ( !C4::Context->IsSuperLibrarian() && !$suggestion->{branchcode} )
139
    {
139
            {
140
        my $branches =
140
                push @sql_params, $$userenv{branch};
141
          GetIndependentGroupModificationRights( { stringify => 1 } );
141
                push @query,      q{
142
        push( @query, qq{ AND (suggestions.branchcode IN ( $branches ) OR suggestions.branchcode='') } );
142
                    AND (suggestions.branchcode=? OR suggestions.branchcode='')
143
    }
143
                };
144
    else {
144
            }
145
        }
146
    } else {
147
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
145
        if ( defined $suggestion->{branchcode} && $suggestion->{branchcode} ) {
148
            unless ( $suggestion->{branchcode} eq '__ANY__' ) {
146
            unless ( $suggestion->{branchcode} eq '__ANY__' ) {
149
                push @sql_params, $suggestion->{branchcode};
147
                push @sql_params, $suggestion->{branchcode};
Lines 340-352 sub GetSuggestionByStatus { Link Here
340
338
341
    # filter on branch
339
    # filter on branch
342
    if ( C4::Context->preference("IndependentBranches") || $branchcode ) {
340
    if ( C4::Context->preference("IndependentBranches") || $branchcode ) {
343
        my $userenv = C4::Context->userenv;
341
        if (   C4::Context->userenv
344
        if ($userenv) {
342
            && C4::Context->preference("IndependentBranches")
345
            unless ( C4::Context->IsSuperLibrarian() ) {
343
            && !C4::Context->IsSuperLibrarian() )
346
                push @sql_params, $userenv->{branch};
344
        {
347
                $query .= q{ AND (U1.branchcode = ? OR U1.branchcode ='') };
345
348
            }
346
            my $branches =
347
              GetIndependentGroupModificationRights( { stringify => 1 } );
348
349
            $query .= qq{
350
                AND (U1.branchcode IN ( $branches ) OR U1.branchcode ='')
351
            };
349
        }
352
        }
353
350
        if ($branchcode) {
354
        if ($branchcode) {
351
            push @sql_params, $branchcode;
355
            push @sql_params, $branchcode;
352
            $query .= q{ AND (U1.branchcode = ? OR U1.branchcode ='') };
356
            $query .= q{ AND (U1.branchcode = ? OR U1.branchcode ='') };
Lines 392-403 sub CountSuggestion { Link Here
392
    if ( C4::Context->preference("IndependentBranches")
396
    if ( C4::Context->preference("IndependentBranches")
393
        && !C4::Context->IsSuperLibrarian() )
397
        && !C4::Context->IsSuperLibrarian() )
394
    {
398
    {
395
        my $query = q{
399
        my $branches =
400
          GetIndependentGroupModificationRights( { stringify => 1 } );
401
402
        my $query = qq{
396
            SELECT count(*)
403
            SELECT count(*)
397
            FROM suggestions
404
            FROM suggestions
398
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
405
                LEFT JOIN borrowers ON borrowers.borrowernumber=suggestions.suggestedby
399
            WHERE STATUS=?
406
            WHERE STATUS=?
400
                AND (borrowers.branchcode='' OR borrowers.branchcode=?)
407
                AND (
408
                    borrowers.branchcode IN ( $branches )
409
                    OR
410
                    borrowers.branchcode=?
411
                )
401
        };
412
        };
402
        $sth = $dbh->prepare($query);
413
        $sth = $dbh->prepare($query);
403
        $sth->execute( $status, $userenv->{branch} );
414
        $sth->execute( $status, $userenv->{branch} );
(-)a/acqui/basket.pl (-4 / +18 lines)
Lines 36-41 use C4::Members qw/GetMember/; #needed for permissions checking for changing ba Link Here
36
use C4::Items;
36
use C4::Items;
37
use C4::Suggestions;
37
use C4::Suggestions;
38
use Date::Calc qw/Add_Delta_Days/;
38
use Date::Calc qw/Add_Delta_Days/;
39
use C4::Branch qw/GetIndependentGroupModificationRights/;
39
40
40
=head1 NAME
41
=head1 NAME
41
42
Lines 155-164 if ( $op eq 'delete_confirm' ) { Link Here
155
    if ( C4::Context->preference("IndependentBranches") ) {
156
    if ( C4::Context->preference("IndependentBranches") ) {
156
        my $userenv = C4::Context->userenv;
157
        my $userenv = C4::Context->userenv;
157
        unless ( C4::Context->IsSuperLibrarian() ) {
158
        unless ( C4::Context->IsSuperLibrarian() ) {
158
            my $validtest = ( $basket->{creationdate} eq '' )
159
            my $validtest =
160
                 ( $basket->{creationdate} eq '' )
159
              || ( $userenv->{branch} eq $basket->{branch} )
161
              || ( $userenv->{branch} eq $basket->{branch} )
160
              || ( $userenv->{branch} eq '' )
162
              || ( $userenv->{branch} eq '' )
161
              || ( $basket->{branch}  eq '' );
163
              || ( $basket->{branch}  eq '' )
164
              || (
165
                GetIndependentGroupModificationRights(
166
                    { for => $basket->{branch} }
167
                )
168
              );
169
162
            unless ($validtest) {
170
            unless ($validtest) {
163
                print $query->redirect("../mainpage.pl");
171
                print $query->redirect("../mainpage.pl");
164
                exit 1;
172
                exit 1;
Lines 258-267 if ( $op eq 'delete_confirm' ) { Link Here
258
    if ( C4::Context->preference("IndependentBranches") ) {
266
    if ( C4::Context->preference("IndependentBranches") ) {
259
        my $userenv = C4::Context->userenv;
267
        my $userenv = C4::Context->userenv;
260
        unless ( C4::Context->IsSuperLibrarian() ) {
268
        unless ( C4::Context->IsSuperLibrarian() ) {
261
            my $validtest = ( $basket->{creationdate} eq '' )
269
            my $validtest =
270
                 ( $basket->{creationdate} eq '' )
262
              || ( $userenv->{branch} eq $basket->{branch} )
271
              || ( $userenv->{branch} eq $basket->{branch} )
263
              || ( $userenv->{branch} eq '' )
272
              || ( $userenv->{branch} eq '' )
264
              || ( $basket->{branch}  eq '' );
273
              || ( $basket->{branch}  eq '' )
274
              || (
275
                GetIndependentGroupModificationRights(
276
                    { for => $basket->{branch} }
277
                )
278
              );
265
            unless ($validtest) {
279
            unless ($validtest) {
266
                print $query->redirect("../mainpage.pl");
280
                print $query->redirect("../mainpage.pl");
267
                exit 1;
281
                exit 1;
(-)a/admin/branches.pl (-37 / +15 lines)
Lines 258-264 sub editbranchform { Link Here
258
        $oldprinter = $data->{'branchprinter'} || '';
258
        $oldprinter = $data->{'branchprinter'} || '';
259
        _branch_to_template($data, $innertemplate);
259
        _branch_to_template($data, $innertemplate);
260
    }
260
    }
261
    $innertemplate->param( categoryloop => $catinfo );
261
    $innertemplate->param( branch_categories  => $catinfo );
262
262
263
    foreach my $thisprinter ( keys %$printers ) {
263
    foreach my $thisprinter ( keys %$printers ) {
264
        push @printerloop, {
264
        push @printerloop, {
Lines 277-301 sub editbranchform { Link Here
277
}
277
}
278
278
279
sub editcatform {
279
sub editcatform {
280
280
    my ( $categorycode, $innertemplate ) = @_;
281
    # prepares the edit form...
281
    $innertemplate->param( category => GetBranchCategory($categorycode) );
282
    my ($categorycode,$innertemplate) = @_;
283
    # warn "cat : $categorycode";
284
	my @cats;
285
    my $data;
286
	if ($categorycode) {
287
        my $data = GetBranchCategory($categorycode);
288
        $innertemplate->param(
289
            categorycode    => $data->{'categorycode'},
290
            categoryname    => $data->{'categoryname'},
291
            codedescription => $data->{'codedescription'},
292
            show_in_pulldown => $data->{'show_in_pulldown'},
293
		);
294
    }
295
	for my $ctype (GetCategoryTypes()) {
296
		push @cats , { type => $ctype , selected => ($data->{'categorytype'} and $data->{'categorytype'} eq $ctype) };
297
	}
298
    $innertemplate->param(categorytype => \@cats);
299
}
282
}
300
283
301
sub branchinfotable {
284
sub branchinfotable {
Lines 366-390 sub branchinfotable { Link Here
366
349
367
        push @loop_data, \%row;
350
        push @loop_data, \%row;
368
    }
351
    }
369
    my @branchcategories = ();
352
370
	for my $ctype ( GetCategoryTypes() ) {
353
    my $catinfo = GetBranchCategories();
371
        my $catinfo = GetBranchCategories($ctype);
354
    my $categories;
372
        my @categories;
355
    foreach my $cat (@$catinfo) {
373
		foreach my $cat (@$catinfo) {
356
        $categories->{ $cat->{categorytype} }->{ $cat->{'categorycode'} } = {
374
            push @categories, {
357
            categoryname    => $cat->{'categoryname'},
375
                categoryname    => $cat->{'categoryname'},
358
            codedescription => $cat->{'codedescription'},
376
                categorycode    => $cat->{'categorycode'},
359
        };
377
                codedescription => $cat->{'codedescription'},
360
    }
378
                categorytype    => $cat->{'categorytype'},
361
379
            };
380
    	}
381
        push @branchcategories, { categorytype => $ctype , $ctype => 1 , catloop => ( @categories ? \@categories : undef) };
382
	}
383
    $innertemplate->param(
362
    $innertemplate->param(
384
        branches         => \@loop_data,
363
        branches          => \@loop_data,
385
        branchcategories => \@branchcategories
364
        branch_categories => $categories
386
    );
365
    );
387
388
}
366
}
389
367
390
sub _branch_to_template {
368
sub _branch_to_template {
(-)a/catalogue/moredetail.pl (-4 / +11 lines)
Lines 172-184 foreach my $item (@items){ Link Here
172
        $item->{status_advisory} = 1;
172
        $item->{status_advisory} = 1;
173
    }
173
    }
174
174
175
    if (C4::Context->preference("IndependentBranches")) {
175
    if ( C4::Context->preference("IndependentBranches") ) {
176
        #verifying rights
176
177
        my $userenv = C4::Context->userenv();
177
        my $userenv = C4::Context->userenv();
178
        unless (($userenv->{'flags'} == 1) or ($userenv->{'branch'} eq $item->{'homebranch'})) {
178
        unless (
179
                $item->{'nomod'}=1;
179
            $userenv->{'flags'} % 2 != 1
180
            || GetIndependentGroupModificationRights(
181
                { for => $item->{'homebranch'} }
182
            )
183
          )
184
        {
185
            $item->{'nomod'} = 1;
180
        }
186
        }
181
    }
187
    }
188
182
    $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
189
    $item->{'homebranchname'} = GetBranchName($item->{'homebranch'});
183
    $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
190
    $item->{'holdingbranchname'} = GetBranchName($item->{'holdingbranch'});
184
    if ($item->{'datedue'}) {
191
    if ($item->{'datedue'}) {
(-)a/cataloguing/additem.pl (-2 / +11 lines)
Lines 695-704 foreach my $field (@fields) { Link Here
695
						|| $subfieldvalue;
695
						|| $subfieldvalue;
696
        }
696
        }
697
697
698
        if (($field->tag eq $branchtagfield) && ($subfieldcode eq $branchtagsubfield) && C4::Context->preference("IndependentBranches")) {
698
        if (   $field->tag eq $branchtagfield
699
            && $subfieldcode eq $branchtagsubfield
700
            && C4::Context->preference("IndependentBranches") )
701
        {
699
            #verifying rights
702
            #verifying rights
700
            my $userenv = C4::Context->userenv();
703
            my $userenv = C4::Context->userenv();
701
            unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subfieldvalue))){
704
            unless (
705
                $userenv->{'flags'} % 2 == 1
706
                || GetIndependentGroupModificationRights(
707
                    { for => $subfieldvalue }
708
                )
709
              )
710
            {
702
                $this_row{'nomod'} = 1;
711
                $this_row{'nomod'} = 1;
703
            }
712
            }
704
        }
713
        }
(-)a/circ/circulation-home.pl (-2 / +5 lines)
Lines 23-28 use C4::Auth; Link Here
23
use C4::Output;
23
use C4::Output;
24
use C4::Context;
24
use C4::Context;
25
use C4::Koha;
25
use C4::Koha;
26
use C4::Branch qw/GetIndependentGroupModificationRights/;
26
27
27
my $query = new CGI;
28
my $query = new CGI;
28
my ($template, $loggedinuser, $cookie, $flags)
29
my ($template, $loggedinuser, $cookie, $flags)
Lines 38-45 my $fa = getframeworkinfo('FA'); Link Here
38
$template->param( fast_cataloging => 1 ) if (defined $fa);
39
$template->param( fast_cataloging => 1 ) if (defined $fa);
39
40
40
# Checking if the transfer page needs to be displayed
41
# Checking if the transfer page needs to be displayed
41
$template->param( display_transfer => 1 ) if ( ($flags->{'superlibrarian'} == 1) || (C4::Context->preference("IndependentBranches") == 0) );
42
$template->param( display_transfer => 1 )
42
$template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation');
43
  if ( $flags->{'superlibrarian'} == 1
44
    || scalar GetIndependentGroupModificationRights() );
43
45
46
$template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation');
44
47
45
output_html_with_http_headers $query, $cookie, $template->output;
48
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/circ/pendingreserves.pl (-2 / +3 lines)
Lines 36-41 use C4::Auth; Link Here
36
use C4::Dates qw/format_date format_date_in_iso/;
36
use C4::Dates qw/format_date format_date_in_iso/;
37
use C4::Debug;
37
use C4::Debug;
38
use Date::Calc qw/Today Add_Delta_YMD/;
38
use Date::Calc qw/Today Add_Delta_YMD/;
39
use C4::Branch qw/GetIndependentGroupModificationRights/;
39
40
40
my $input = new CGI;
41
my $input = new CGI;
41
my $startdate=$input->param('from');
42
my $startdate=$input->param('from');
Lines 154-161 if ( $run_report ) { Link Here
154
155
155
156
156
    if (C4::Context->preference('IndependentBranches')){
157
    if (C4::Context->preference('IndependentBranches')){
157
        $strsth .= " AND items.holdingbranch=? ";
158
        my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
158
        push @query_params, C4::Context->userenv->{'branch'};
159
        $strsth .= " AND items.holdingbranch IN ( $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 (-3 / +3 lines)
Lines 113-121 my $strsth = Link Here
113
 $sqldatewhere
113
 $sqldatewhere
114
";
114
";
115
115
116
if (C4::Context->preference('IndependentBranches')){
116
if ( C4::Context->preference('IndependentBranches') ) {
117
    $strsth .= " AND items.holdingbranch=? ";
117
    my $branches = GetIndependentGroupModificationRights( { stringify => 1 } );
118
    push @query_params, C4::Context->userenv->{'branch'};
118
    $strsth .= " AND items.holdingbranch IN ( $branches ) ";
119
}
119
}
120
120
121
$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
121
$strsth .= " GROUP BY reserves.biblionumber ORDER BY reservecount DESC";
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 362-368 CREATE TABLE `branchcategories` ( -- information related to library/branch group Link Here
362
  `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
362
  `categorycode` varchar(10) NOT NULL default '', -- unique identifier for the library/branch group
363
  `categoryname` varchar(32), -- name of the library/branch group
363
  `categoryname` varchar(32), -- name of the library/branch group
364
  `codedescription` mediumtext, -- longer description of the library/branch group
364
  `codedescription` mediumtext, -- longer description of the library/branch group
365
  `categorytype` varchar(16), -- says whether this is a search group or a properties group
365
  `categorytype` ENUM(  'searchdomain',  'independent_group' ) NULL DEFAULT NULL, -- says whether this is a search group or an independent group
366
  `show_in_pulldown` tinyint(1) NOT NULL DEFAULT '0', -- says this group should be in the opac libararies pulldown if it is enabled
366
  `show_in_pulldown` tinyint(1) NOT NULL DEFAULT '0', -- says this group should be in the opac libararies pulldown if it is enabled
367
  PRIMARY KEY  (`categorycode`),
367
  PRIMARY KEY  (`categorycode`),
368
  KEY `show_in_pulldown` (`show_in_pulldown`)
368
  KEY `show_in_pulldown` (`show_in_pulldown`)
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +13 lines)
Lines 6938-6944 $DBversion = "3.13.00.002"; Link Here
6938
if ( CheckVersion($DBversion) ) {
6938
if ( CheckVersion($DBversion) ) {
6939
   $dbh->do("UPDATE systempreferences SET variable = 'IndependentBranches' WHERE variable = 'IndependantBranches'");
6939
   $dbh->do("UPDATE systempreferences SET variable = 'IndependentBranches' WHERE variable = 'IndependantBranches'");
6940
   print "Upgrade to $DBversion done (Bug 10080 - Change system pref IndependantBranches to IndependentBranches)\n";
6940
   print "Upgrade to $DBversion done (Bug 10080 - Change system pref IndependantBranches to IndependentBranches)\n";
6941
   SetVersion ($DBversion);
6941
    SetVersion ($DBversion);
6942
}
6943
6944
$DBversion = "3.11.00.XXX";
6945
if ( CheckVersion($DBversion) ) {
6946
    $dbh->do(q{
6947
        ALTER TABLE branchcategories
6948
        CHANGE categorytype categorytype
6949
          ENUM( 'searchdomain', 'independent_group' )
6950
            NULL DEFAULT NULL
6951
    });
6952
    print "Upgrade to $DBversion done (Remove branch property groups, add independent groups)\n";
6953
    SetVersion ($DBversion);
6942
}
6954
}
6943
6955
6944
$DBversion = '3.13.00.003';
6956
$DBversion = '3.13.00.003';
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-71 / +139 lines)
Lines 101-120 tinyMCE.init({ Link Here
101
        </li>
101
        </li>
102
	</ol>
102
	</ol>
103
	</fieldset>
103
	</fieldset>
104
	[% IF ( categoryloop ) %]<fieldset class="rows"><legend>Group(s):</legend>
104
105
        <ol>
105
     [% IF ( branch_categories ) %]
106
		[% FOREACH categoryloo IN categoryloop %]
106
        <fieldset class="rows">
107
            <li><label for="[% categoryloo.categorycode %]">[% categoryloo.categoryname %]: </label>
107
            <legend>Group(s):</legend>
108
                [% IF categoryloo.selected %]
108
            <ol>
109
                    <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" checked="checked" />
109
                <fieldset>
110
                [% ELSE %]
110
                    <legend>Search domain</legend>
111
                    <input type="checkbox" id="[% categoryloo.categorycode %]" name="[% categoryloo.categorycode %]" />
111
                    [% FOREACH bc IN branch_categories %]
112
                [% END %]
112
                        [% IF bc.categorytype == "searchdomain" %]
113
                <span class="hint">[% categoryloo.codedescription %]</span>
113
                            <li>
114
            </li>
114
                                <label for="[% bc.categorycode %]">[% bc.categoryname %]: </label>
115
        [% END %]
115
                                [% IF ( bc.selected ) %]
116
		</ol>
116
                                    <input type="checkbox" id="[% bc.categorycode %]" name="[% bc.categorycode %]" checked="checked" />
117
</fieldset>[% END %]
117
                                [% ELSE %]
118
                                    <input type="checkbox" id="[% bc.categorycode %]" name="[% bc.categorycode %]" />
119
                                [% END %]
120
                                <span class="hint">[% bc.codedescription %]</span>
121
                            </li>
122
                        [% END %]
123
                    [% END %]
124
                </fieldset>
125
            </ol>
126
            <ol>
127
                <fieldset>
128
                    <legend>Independent library groups</legend>
129
                    [% FOREACH bc IN branch_categories %]
130
                        [% IF bc.categorytype == "independent_group" %]
131
                            <li>
132
                                <label for="[% bc.categorycode %]">[% bc.categoryname %]: </label>
133
                                [% IF ( bc.selected ) %]
134
                                    <input type="checkbox" id="[% bc.categorycode %]" name="[% bc.categorycode %]" checked="checked" />
135
                                [% ELSE %]
136
                                    <input type="checkbox" id="[% bc.categorycode %]" name="[% bc.categorycode %]" />
137
                                [% END %]
138
                                <span class="hint">[% bc.codedescription %]</span>
139
                            </li>
140
                        [% END %]
141
                    [% END %]
142
                <li><label>Note:</label><span class="hint">If independent library groups are enabled ( via the IndependentBranches system preference ), a library may access and alter records and patrons from libraries in any group that also library belongs to. A library may belong to multiple library groups.</span></li>
143
                </fieldset>
144
            </ol>
145
        </fieldset>
146
    [% END %]
147
118
	<fieldset class="rows">
148
	<fieldset class="rows">
119
	<ol>
149
	<ol>
120
        <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% branchaddress1 |html %]" /></li>
150
        <li><label for="branchaddress1">Address line 1: </label><input type="text" name="branchaddress1" id="branchaddress1" size="60" value="[% branchaddress1 |html %]" /></li>
Lines 250-339 tinyMCE.init({ Link Here
250
	[% ELSE %]
280
	[% ELSE %]
251
	<div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add">Start defining libraries</a>.</div>
281
	<div class="dialog message">There are no libraries defined. <a href="/cgi-bin/koha/admin/branches.pl?op=add">Start defining libraries</a>.</div>
252
	[% END %]
282
	[% END %]
253
    
283
254
   [% IF ( branchcategories ) %]
284
    <h3>Search domain groups</h3>
255
   [% FOREACH branchcategorie IN branchcategories %]
285
    [% IF branch_categories.searchdomain %]
256
    <h3>Group(s):  [% IF ( branchcategorie.properties ) %]Properties[% ELSE %][% IF ( branchcategorie.searchdomain ) %]Search domain[% END %][% END %]</h3>
286
        <table>
257
    [% IF ( branchcategorie.catloop ) %]
287
            <thead>
258
      <table>
288
                <tr>
259
        <thead>
289
                    <th>Name</th>
260
          <tr>
290
                    <th>Code</th>
261
            <th>Name</th>
291
                    <th>Description</th>
262
            <th>Code</th>
292
                    <th>&nbsp;</th>
263
            <th>Description</th>
293
                    <th>&nbsp;</th>
264
            <th>&nbsp;</th>
294
                  </tr>
265
            <th>&nbsp;</th>
295
            </thead>
266
          </tr>
296
            <tbody>
267
        </thead>
297
                [% FOREACH bc IN branch_categories.searchdomain %]
268
        <tbody>
298
                    <tr>
269
          [% FOREACH catloo IN branchcategorie.catloop %]
299
                      <td>[% bc.value.categoryname %]</td>
270
            <tr>
300
                      <td>[% bc.key %]</td>
271
              <td>[% catloo.categoryname %]</td>
301
                      <td>[% bc.value.codedescription %]</td>
272
              <td>[% catloo.categorycode %]</td>
302
                      <td>
273
              <td>[% catloo.codedescription %]</td>
303
                        <a href="?op=editcategory&amp;categorycode=[% bc.key |url %]">Edit</a>
274
              <td>
304
                      </td>
275
                <a href="[% catloo.action %]?op=editcategory&amp;categorycode=[% catloo.categorycode |url %]">Edit</a>
305
                      <td>
276
              </td>
306
                        <a href="?op=delete_category&amp;categorycode=[% bc.key |url %]">Delete</a>
277
              <td>
307
                      </td>
278
                <a href="[% catloo.action %]?op=delete_category&amp;categorycode=[% catloo.categorycode |url %]">Delete</a>
308
                    </tr>
279
              </td>
309
                [% END %]
280
            </tr>
310
            </tbody>
281
          [% END %]
311
        </table>
282
        </tbody>
312
    [% ELSE %]
283
      </table>
313
        No search domain groups defined.
314
    [% END %]
315
    <a href="/cgi-bin/koha/admin/branches.pl?op=editcategory">Add a new group</a>.
316
317
    <h3>Independent library groups:</h3>
318
    [% IF branch_categories.independent_group %]
319
        <table>
320
            <thead>
321
                <tr>
322
                    <th>Name</th>
323
                    <th>Code</th>
324
                    <th>Description</th>
325
                    <th>&nbsp;</th>
326
                    <th>&nbsp;</th>
327
                  </tr>
328
            </thead>
329
            <tbody>
330
                [% FOREACH bc IN branch_categories.independent_group %]
331
                    <tr>
332
                      <td>[% bc.value.categoryname %]</td>
333
                      <td>[% bc.key %]</td>
334
                      <td>[% bc.value.codedescription %]</td>
335
                      <td>
336
                        <a href="?op=editcategory&amp;categorycode=[% bc.key |url %]">Edit</a>
337
                      </td>
338
                      <td>
339
                        <a href="?op=delete_category&amp;categorycode=[% bc.key |url %]">Delete</a>
340
                      </td>
341
                    </tr>
342
                [% END %]
343
            </tbody>
344
        </table>
284
    [% ELSE %]
345
    [% ELSE %]
285
      No [% IF ( branchcategorie.properties ) %]properties[% ELSIF ( branchcategorie.searchdomain ) %]search domain[% END %] defined. <a href="/cgi-bin/koha/admin/branches.pl?op=editcategory">Add a new group</a>.
346
        No independent library groups defined.
286
    [% END %]
347
    [% END %]
287
  [% END %]
348
    <a href="/cgi-bin/koha/admin/branches.pl?op=editcategory">Add a new group</a>.
288
  [% ELSE %]
289
    <p>No groups defined.</p>
290
  [% END %] <!-- NAME="branchcategories" -->
291
[% END %]
349
[% END %]
292
350
293
[% IF ( editcategory ) %]
351
[% IF ( editcategory ) %]
294
    <h3>[% IF ( categorycode ) %]Edit group [% categorycode %][% ELSE %]Add group[% END %]</h3>
352
    <h3>[% IF ( category ) %]Edit group [% category.categorycode %][% ELSE %]Add group[% END %]</h3>
295
    <form action="[% action %]" name="Aform" method="post">
353
    <form action="[% action %]" name="Aform" method="post">
296
    <input type="hidden" name="op" value="addcategory_validate" />
354
    <input type="hidden" name="op" value="addcategory_validate" />
297
	[% IF ( categorycode ) %]
355
    [% IF ( category.categorycode ) %]
298
	<input type="hidden" name="add" value="0">
356
        <input type="hidden" name="add" value="0">
299
	[% ELSE %]
357
    [% ELSE %]
300
	<input type="hidden" name="add" value="1">
358
        <input type="hidden" name="add" value="1">
301
	[% END %]
359
    [% END %]
302
    <fieldset class="rows">
360
    <fieldset class="rows">
303
        
361
        
304
        <ol><li>
362
        <ol><li>
305
                [% IF ( categorycode ) %]
363
                [% IF ( category.categorycode ) %]
306
				<span class="label">Category code: </span>
364
				<span class="label">Category code: </span>
307
                    <input type="hidden" name="categorycode" id="categorycode" value="[% categorycode |html %]" />
365
                    <input type="hidden" name="categorycode" id="categorycode" value="[% category.categorycode | html %]" />
308
                    [% categorycode %]
366
                    [% category.categorycode %]
309
                [% ELSE %]
367
                [% ELSE %]
310
                <label for="categorycode">Category code:</label>
368
                    <label for="categorycode">Category code:</label>
311
                    <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" value="[% categorycode |html %]" />
369
                    <input type="text" name="categorycode" id="categorycode" size="10" maxlength="10" value="[% categorycode | html %]" />
312
                [% END %]
370
                [% END %]
313
            </li>
371
            </li>
314
        <li>
372
        <li>
315
            <label for="categoryname">Name: </label>
373
            <label for="categoryname">Name: </label>
316
            <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% categoryname |html %]" />
374
            <input type="text" name="categoryname" id="categoryname" size="32" maxlength="32" value="[% category.categoryname | html %]" />
317
        </li>
375
        </li>
318
        <li>
376
        <li>
319
            <label for="codedescription">Description: </label>
377
            <label for="codedescription">Description: </label>
320
            <input type="text" name="codedescription" id="codedescription" size="70" value="[% codedescription |html %]" />
378
            <input type="text" name="codedescription" id="codedescription" size="70" value="[% category.codedescription | html %]" />
321
        </li>
379
        </li>
322
		<li>
380
		<li>
323
        <label for="categorytype">Category type: </label>
381
        <label for="categorytype">Category type: </label>
324
            <select id="categorytype" name="categorytype">
382
            <select id="categorytype" name="categorytype">
325
            [% FOREACH categorytyp IN categorytype %]
383
                [% IF ( category.categorytype == 'searchdomain' ) %]
326
                [% IF ( categorytyp.selected ) %]
384
                    <option value="searchdomain" selected="selected">Search domain</option>
327
                    <option value="[% categorytyp.type %]" selected="selected">
328
                [% ELSE %]
385
                [% ELSE %]
329
                    <option value="[% categorytyp.type %]">
386
                    <option value="searchdomain">Search domain</option>
330
                [% END %] [% categorytyp.type %]</option>
387
                [% END %]
331
            [% END %]
388
389
                [% IF ( category.categorytype == 'independent_group' ) %]
390
                    <option value="independent_group" selected="selected">Independent group</option>
391
                [% ELSE %]
392
                    <option value="independent_group">Independent group</option>
393
                [% END %]
332
            </select>
394
            </select>
333
		</li>
395
		</li>
334
        <li>
396
        <li>
335
            <label for="show_in_pulldown">Show in search pulldown: </label>
397
            <label for="show_in_pulldown">Show in search pulldown: </label>
336
            [% IF ( show_in_pulldown ) %]
398
            [% IF ( category.show_in_pulldown ) %]
337
                <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" checked="checked"/>
399
                <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" checked="checked"/>
338
            [% ELSE %]
400
            [% ELSE %]
339
                <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" />
401
                <input type="checkbox" name="show_in_pulldown" id="show_in_pulldown" />
Lines 341-347 tinyMCE.init({ Link Here
341
        </li>
403
        </li>
342
		</ol>
404
		</ol>
343
    </fieldset>
405
    </fieldset>
344
	<fieldset class="action"><input type="submit" value="Update" /></fieldset>
406
  <fieldset class="action">
407
        [% IF category %]
408
            <input type="submit" value="Update group" />
409
        [% ELSE %]
410
            <input type="submit" value="Add group" />
411
        [% END %]
412
    </fieldset>
345
    </form>
413
    </form>
346
[% END %]
414
[% END %]
347
415
(-)a/members/deletemem.pl (-4 / +10 lines)
Lines 66-76 if ($bor->{category_type} eq "S") { Link Here
66
    }
66
    }
67
}
67
}
68
68
69
if (C4::Context->preference("IndependentBranches")) {
69
if ( C4::Context->preference("IndependentBranches") ) {
70
    my $userenv = C4::Context->userenv;
71
    if ( !C4::Context->IsSuperLibrarian() && $bor->{'branchcode'}){
70
    if ( !C4::Context->IsSuperLibrarian() && $bor->{'branchcode'}){
72
        unless ($userenv->{branch} eq $bor->{'branchcode'}){
71
        unless (
73
            print $input->redirect("/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_OTHERLIBRARY");
72
            GetIndependentGroupModificationRights(
73
                { for => $bor->{'branchcode'} }
74
            )
75
          )
76
        {
77
            print $input->redirect(
78
                "/cgi-bin/koha/members/moremember.pl?borrowernumber=$member&error=CANT_DELETE_OTHERLIBRARY"
79
            );
74
            exit;
80
            exit;
75
        }
81
        }
76
    }
82
    }
(-)a/members/member.pl (-2 / +1 lines)
Lines 58-64 $input->delete( Link Here
58
    'new_patron_list',    'borrowernumber',
58
    'new_patron_list',    'borrowernumber',
59
);
59
);
60
60
61
my $patron = $input->Vars;
61
my $patron = { $input->Vars };
62
foreach (keys %$patron){
62
foreach (keys %$patron){
63
	delete $$patron{$_} unless($$patron{$_});
63
	delete $$patron{$_} unless($$patron{$_});
64
}
64
}
65
- 

Return to bug 10276