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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 658-664 sub checkauth { Link Here
658
                $session->param('surname'),      $session->param('branch'),
658
                $session->param('surname'),      $session->param('branch'),
659
                $session->param('branchname'),   $session->param('flags'),
659
                $session->param('branchname'),   $session->param('flags'),
660
                $session->param('emailaddress'), $session->param('branchprinter'),
660
                $session->param('emailaddress'), $session->param('branchprinter'),
661
                $session->param('persona')
661
                $session->param('persona'),      $type
662
            );
662
            );
663
            C4::Context::set_shelves_userenv('bar',$session->param('barshelves'));
663
            C4::Context::set_shelves_userenv('bar',$session->param('barshelves'));
664
            C4::Context::set_shelves_userenv('pub',$session->param('pubshelves'));
664
            C4::Context::set_shelves_userenv('pub',$session->param('pubshelves'));
(-)a/C4/Branch.pm (-17 / +65 lines)
Lines 42-47 BEGIN { Link Here
42
		&GetCategoryTypes
42
		&GetCategoryTypes
43
		&GetBranchCategories
43
		&GetBranchCategories
44
		&GetBranchesInCategory
44
		&GetBranchesInCategory
45
        &GetCategoriesForBranch
45
		&ModBranchCategoryInfo
46
		&ModBranchCategoryInfo
46
        &GetIndependentGroupModificationRights
47
        &GetIndependentGroupModificationRights
47
		&DelBranch
48
		&DelBranch
Lines 445-450 sub GetBranchesInCategory { Link Here
445
	return( \@branches );
446
	return( \@branches );
446
}
447
}
447
448
449
=head2 GetCategoriesForBranch
450
451
    my @categories = GetCategoriesForBranch({
452
        branchcode   => $branchcode,
453
        categorytype => 'independent_group'
454
    });
455
456
    Called in a list context, returns an array of branch category codes
457
    that branch is part of.
458
459
    Called in a scalar context, returns an array ref.
460
461
=cut
462
463
sub GetCategoriesForBranch {
464
    my ( $params ) = @_;
465
    my $branchcode = $params->{branchcode};
466
    my $categorytype = $params->{categorytype} || '%';
467
468
    carp("Missing branchcode parameter!") unless ( $branchcode );
469
470
    my $sql = q{
471
        SELECT categorycode FROM branchrelations
472
        JOIN branchcategories USING ( categorycode )
473
        WHERE branchcode   = ?
474
          AND categorytype = ?
475
    };
476
477
    my $categories = C4::Context->dbh->selectcol_arrayref( $sql, {}, ( $branchcode, $categorytype ) );
478
479
    return wantarray() ? $categories : @$categories;
480
}
481
448
=head2 GetIndependentGroupModificationRights
482
=head2 GetIndependentGroupModificationRights
449
483
450
    GetIndependentGroupModificationRights(
484
    GetIndependentGroupModificationRights(
Lines 474-480 sub GetBranchesInCategory { Link Here
474
    is useful for "branchcode IN $branchcodes" clauses
508
    is useful for "branchcode IN $branchcodes" clauses
475
    in SQL queries.
509
    in SQL queries.
476
510
477
    $this_branch and $other_branch are equal for efficiency.
511
    Returns 1 if $this_branch and $other_branch are equal for efficiency.
478
512
479
    So you can write:
513
    So you can write:
480
    my @branches = GetIndependentGroupModificationRights();
514
    my @branches = GetIndependentGroupModificationRights();
Lines 486-515 sub GetBranchesInCategory { Link Here
486
sub GetIndependentGroupModificationRights {
520
sub GetIndependentGroupModificationRights {
487
    my ($params) = @_;
521
    my ($params) = @_;
488
522
489
    my $this_branch  = $params->{branch};
523
    my $this_branch  = $params->{branch}    ||= q{};
490
    my $other_branch = $params->{for};
524
    my $other_branch = $params->{for}       ||= q{};
491
    my $stringify    = $params->{stringify};
525
    my $stringify    = $params->{stringify} ||= q{};
492
526
527
    $this_branch ||= $ENV{BRANCHCODE};
493
    $this_branch ||= C4::Context->userenv->{branch};
528
    $this_branch ||= C4::Context->userenv->{branch};
494
529
495
    carp("No branch found!") unless ($this_branch);
530
    unless ($this_branch) {
531
        carp("No branch found!");
532
        return;
533
    }
496
534
497
    return 1 if ( $this_branch eq $other_branch );
535
    return 1 if ( $this_branch eq $other_branch );
498
536
499
    my $sql = q{
537
    my $allow_all = 0;
500
        SELECT DISTINCT(branchcode)
538
    $allow_all = 1 if C4::Context->IsSuperLibrarian();
501
        FROM branchrelations
539
    $allow_all = 1 if C4::Context->userenv->{type} eq 'opac' && !$ENV{BRANCHCODE};
502
        JOIN branchcategories USING ( categorycode )
503
        WHERE categorycode IN (
504
            SELECT categorycode
505
            FROM branchrelations
506
            WHERE branchcode = ?
507
        )
508
        AND branchcategories.categorytype = 'independent_group'
509
    };
510
540
541
    my $sql;
511
    my @params;
542
    my @params;
512
    push( @params, $this_branch );
543
    if ( $allow_all ) {
544
        $sql = q{
545
            SELECT branchcode FROM branches WHERE 1
546
        }
547
    } else {
548
        $sql = q{
549
            SELECT DISTINCT(branchcode)
550
            FROM branchrelations
551
            JOIN branchcategories USING ( categorycode )
552
            WHERE categorycode IN (
553
                SELECT categorycode
554
                FROM branchrelations
555
                WHERE branchcode = ?
556
            )
557
            AND branchcategories.categorytype = 'independent_group'
558
        };
559
        push( @params, $this_branch );
560
    }
513
561
514
    if ($other_branch) {
562
    if ($other_branch) {
515
        $sql .= q{ AND branchcode = ? };
563
        $sql .= q{ AND branchcode = ? };
(-)a/C4/Context.pm (-14 / +22 lines)
Lines 1105-1127 set_userenv is called in Auth.pm Link Here
1105
1105
1106
#'
1106
#'
1107
sub set_userenv {
1107
sub set_userenv {
1108
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= @_;
1108
    my (
1109
    my $var=$context->{"activeuser"} || '';
1109
        $usernum,      $userid,        $usercnum,   $userfirstname,
1110
        $usersurname,  $userbranch,    $branchname, $userflags,
1111
        $emailaddress, $branchprinter, $persona,    $type
1112
    ) = @_;
1113
1114
    my $var = $context->{"activeuser"} || '';
1115
1110
    my $cell = {
1116
    my $cell = {
1111
        "number"     => $usernum,
1117
        "number"        => $usernum,
1112
        "id"         => $userid,
1118
        "id"            => $userid,
1113
        "cardnumber" => $usercnum,
1119
        "cardnumber"    => $usercnum,
1114
        "firstname"  => $userfirstname,
1120
        "firstname"     => $userfirstname,
1115
        "surname"    => $usersurname,
1121
        "surname"       => $usersurname,
1116
        #possibly a law problem
1122
        "branch"        => $userbranch,
1117
        "branch"     => $userbranch,
1123
        "branchname"    => $branchname,
1118
        "branchname" => $branchname,
1124
        "flags"         => $userflags,
1119
        "flags"      => $userflags,
1125
        "emailaddress"  => $emailaddress,
1120
        "emailaddress"     => $emailaddress,
1126
        "branchprinter" => $branchprinter,
1121
        "branchprinter"    => $branchprinter,
1127
        "persona"       => $persona,
1122
        "persona"    => $persona,
1128
        "type"          => $type,
1123
    };
1129
    };
1130
1124
    $context->{userenv}->{$var} = $cell;
1131
    $context->{userenv}->{$var} = $cell;
1132
1125
    return $cell;
1133
    return $cell;
1126
}
1134
}
1127
1135
(-)a/C4/Items.pm (-1 / +9 lines)
Lines 1202-1207 If this is set, it is set to C<One Order>. Link Here
1202
1202
1203
sub GetItemsInfo {
1203
sub GetItemsInfo {
1204
    my ( $biblionumber ) = @_;
1204
    my ( $biblionumber ) = @_;
1205
1206
    my $IndependentBranchesRecordsAndItems =
1207
      C4::Context->preference('IndependentBranchesRecordsAndItems')
1208
      && !C4::Context->IsSuperLibrarian();
1209
1205
    my $dbh   = C4::Context->dbh;
1210
    my $dbh   = C4::Context->dbh;
1206
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1211
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1207
    my $query = "
1212
    my $query = "
Lines 1231-1237 sub GetItemsInfo { Link Here
1231
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1236
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1232
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1237
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1233
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1238
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1234
    $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1239
    $query .= " WHERE items.biblionumber = ? ";
1240
    $query .= " AND items.homebranch IN ( " . GetIndependentGroupModificationRights({ stringify => 1}) . " ) " if ( $IndependentBranchesRecordsAndItems );
1241
    $query .= " ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1242
1235
    my $sth = $dbh->prepare($query);
1243
    my $sth = $dbh->prepare($query);
1236
    $sth->execute($biblionumber);
1244
    $sth->execute($biblionumber);
1237
    my $i = 0;
1245
    my $i = 0;
(-)a/C4/Koha.pm (-37 / +37 lines)
Lines 36-78 BEGIN { Link Here
36
    $VERSION = 3.07.00.049;
36
    $VERSION = 3.07.00.049;
37
	require Exporter;
37
	require Exporter;
38
	@ISA    = qw(Exporter);
38
	@ISA    = qw(Exporter);
39
	@EXPORT = qw(
39
    @EXPORT = qw(
40
		&slashifyDate
40
      &slashifyDate
41
		&subfield_is_koha_internal_p
41
      &subfield_is_koha_internal_p
42
		&GetPrinters &GetPrinter
42
      &GetPrinters &GetPrinter
43
		&GetItemTypes &getitemtypeinfo
43
      &GetItemTypes &getitemtypeinfo
44
		&GetCcodes
44
      &GetCcodes
45
		&GetSupportName &GetSupportList
45
      &GetSupportName &GetSupportList
46
		&get_itemtypeinfos_of
46
      &get_itemtypeinfos_of
47
		&getframeworks &getframeworkinfo
47
      &getframeworks &getframeworkinfo
48
		&getauthtypes &getauthtype
48
      &getauthtypes &getauthtype
49
		&getallthemes
49
      &getallthemes
50
		&getFacets
50
      &getFacets
51
		&displayServers
51
      &displayServers
52
		&getnbpages
52
      &getnbpages
53
		&get_infos_of
53
      &get_infos_of
54
		&get_notforloan_label_of
54
      &get_notforloan_label_of
55
		&getitemtypeimagedir
55
      &getitemtypeimagedir
56
		&getitemtypeimagesrc
56
      &getitemtypeimagesrc
57
		&getitemtypeimagelocation
57
      &getitemtypeimagelocation
58
		&GetAuthorisedValues
58
      &GetAuthorisedValues
59
		&GetAuthorisedValueCategories
59
      &GetAuthorisedValueCategories
60
                &IsAuthorisedValueCategory
60
      &IsAuthorisedValueCategory
61
		&GetKohaAuthorisedValues
61
      &GetKohaAuthorisedValues
62
		&GetKohaAuthorisedValuesFromField
62
      &GetKohaAuthorisedValuesFromField
63
    &GetKohaAuthorisedValueLib
63
      &GetKohaAuthorisedValueLib
64
    &GetAuthorisedValueByCode
64
      &GetAuthorisedValueByCode
65
    &GetKohaImageurlFromAuthorisedValues
65
      &GetKohaImageurlFromAuthorisedValues
66
		&GetAuthValCode
66
      &GetAuthValCode
67
        &AddAuthorisedValue
67
      &AddAuthorisedValue
68
		&GetNormalizedUPC
68
      &GetNormalizedUPC
69
		&GetNormalizedISBN
69
      &GetNormalizedISBN
70
		&GetNormalizedEAN
70
      &GetNormalizedEAN
71
		&GetNormalizedOCLCNumber
71
      &GetNormalizedOCLCNumber
72
        &xml_escape
72
      &xml_escape
73
73
74
		$DEBUG
74
      $DEBUG
75
	);
75
    );
76
	$DEBUG = 0;
76
	$DEBUG = 0;
77
@EXPORT_OK = qw( GetDailyQuote );
77
@EXPORT_OK = qw( GetDailyQuote );
78
}
78
}
(-)a/C4/Search.pm (+34 lines)
Lines 36-41 use URI::Escape; Link Here
36
use Business::ISBN;
36
use Business::ISBN;
37
use MARC::Record;
37
use MARC::Record;
38
use MARC::Field;
38
use MARC::Field;
39
use List::MoreUtils qw(none);
39
use utf8;
40
use utf8;
40
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
41
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG);
41
42
Lines 1828-1841 sub searchResults { Link Here
1828
        my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1;
1829
        my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1;
1829
        my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref
1830
        my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref
1830
1831
1832
        my $IndependentBranchesRecordsAndItems;
1833
        if ( $search_context eq 'opac' ) {
1834
            # For the OPAC, if IndependentBranchesRecordsAndItems is enabled,
1835
            # and BRANCHCODE has been set in the httpd conf,
1836
            # we need to filter the items
1837
            $IndependentBranchesRecordsAndItems =
1838
              C4::Context->preference('IndependentBranchesRecordsAndItems')
1839
              && $ENV{BRANCHCODE};
1840
        }
1841
        else {
1842
            # For the intranet, if IndependentBranchesRecordsAndItems is enabled,
1843
            # and the user is not a superlibrarian,
1844
            # we need to filter the items
1845
            $IndependentBranchesRecordsAndItems =
1846
              C4::Context->preference('IndependentBranchesRecordsAndItems')
1847
              && !C4::Context->IsSuperLibrarian();
1848
        }
1849
        my @allowed_branches = $IndependentBranchesRecordsAndItems ? GetIndependentGroupModificationRights() : undef;
1850
1831
        # loop through every item
1851
        # loop through every item
1852
        my $index = -1;
1832
        foreach my $field (@fields) {
1853
        foreach my $field (@fields) {
1854
            $index++;
1833
            my $item;
1855
            my $item;
1834
1856
1835
            # populate the items hash
1857
            # populate the items hash
1836
            foreach my $code ( keys %subfieldstosearch ) {
1858
            foreach my $code ( keys %subfieldstosearch ) {
1837
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
1859
                $item->{$code} = $field->subfield( $subfieldstosearch{$code} );
1838
            }
1860
            }
1861
1862
            # if IndependentBranchesRecordsAndItems is enabled, and this record
1863
            # isn't allowed to be viewed, remove it from the items list and go
1864
            # right to the next item.
1865
            if ( $IndependentBranchesRecordsAndItems ) {
1866
                if ( none { $_ eq $item->{homebranch} } @allowed_branches ) {
1867
                    splice(@fields, $index, 1);
1868
                    $items_count--;
1869
                    next;
1870
                }
1871
            }
1872
1839
            $item->{description} = $itemtypes{ $item->{itype} }{description};
1873
            $item->{description} = $itemtypes{ $item->{itype} }{description};
1840
1874
1841
	        # OPAC hidden items
1875
	        # OPAC hidden items
(-)a/catalogue/search.pl (-15 / +37 lines)
Lines 135-140 Not yet completed... Link Here
135
use strict;            # always use
135
use strict;            # always use
136
#use warnings; FIXME - Bug 2505
136
#use warnings; FIXME - Bug 2505
137
137
138
use List::MoreUtils qw(any);
139
138
## STEP 1. Load things that are used in both search page and
140
## STEP 1. Load things that are used in both search page and
139
# results page and decide which template to load, operations 
141
# results page and decide which template to load, operations 
140
# to perform, etc.
142
# to perform, etc.
Lines 179-187 else { Link Here
179
    flagsrequired   => { catalogue => 1 },
181
    flagsrequired   => { catalogue => 1 },
180
    }
182
    }
181
);
183
);
184
182
if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
185
if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
183
    $template->param('UNIMARC' => 1);
186
    $template->param('UNIMARC' => 1);
184
}
187
}
188
185
if (C4::Context->preference("IntranetNumbersPreferPhrase")) {
189
if (C4::Context->preference("IntranetNumbersPreferPhrase")) {
186
    $template->param('numbersphr' => 1);
190
    $template->param('numbersphr' => 1);
187
}
191
}
Lines 226-245 my $branches = GetBranches(); Link Here
226
# Populate branch_loop with all branches sorted by their name.  If
230
# Populate branch_loop with all branches sorted by their name.  If
227
# IndependentBranches is activated, set the default branch to the borrower
231
# IndependentBranches is activated, set the default branch to the borrower
228
# branch, except for superlibrarian who need to search all libraries.
232
# branch, except for superlibrarian who need to search all libraries.
229
my $user = C4::Context->userenv;
233
$template->param(
230
my @branch_loop = map {
234
    branchloop       => GetBranchesLoop(),
231
     {
235
    searchdomainloop => GetBranchCategories( undef, 'searchdomain' ),
232
        value      => $_,
236
);
233
        branchname => $branches->{$_}->{branchname},
234
        selected   => $user->{branch} eq $_ && C4::Branch::onlymine(),
235
     }
236
} sort {
237
    $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
238
} keys %$branches;
239
240
my $categories = GetBranchCategories(undef,'searchdomain');
241
242
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
243
237
244
# load the Type stuff
238
# load the Type stuff
245
my $itemtypes = GetItemTypes;
239
my $itemtypes = GetItemTypes;
Lines 411-417 my @operands = $cgi->param('q'); Link Here
411
# limits are use to limit to results to a pre-defined category such as branch or language
405
# limits are use to limit to results to a pre-defined category such as branch or language
412
my @limits = $cgi->param('limit');
406
my @limits = $cgi->param('limit');
413
407
414
if($params->{'multibranchlimit'}) {
408
if ( C4::Context->preference('IndependentBranchesRecordsAndItems') ) {
409
    # Get list of branches this branch can access
410
    my @branches = GetIndependentGroupModificationRights();
411
412
    # Strip out any branch search limits that are not in the list of allowable branches
413
    my $has_valid_branch_limits; # If at least one allowable branch limit is passed,
414
                                 # use the valid ones, otherwise make it an "all branches"
415
                                 # search with the allowed branches
416
417
    my @new_limits;
418
    foreach my $limit ( @limits ) {
419
        if ( $limit =~ /^branch:/ ) {
420
            my ( undef, $branch ) = split(':', $limit);
421
            push( @new_limits, $limit ) if any { $_ eq $branch } @branches;
422
            $has_valid_branch_limits = 1;
423
        } else {
424
            push( @new_limits, $limit );
425
        }
426
    }
427
    @limits = @new_limits;
428
429
    # If the limits contain any branch limits, if not, do a search on all allowable branches
430
    unless ($has_valid_branch_limits) {
431
        my $new_branch_limit =
432
          '(' . join( " or ", map { "branch: $_ " } @branches ) . ')';
433
        push( @limits, $new_branch_limit );
434
    }
435
}
436
elsif( $params->{'multibranchlimit'} ) {
415
    my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
437
    my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
416
    push @limits, $multibranch if ($multibranch ne  '()');
438
    push @limits, $multibranch if ($multibranch ne  '()');
417
}
439
}
(-)a/cataloguing/additem.pl (-20 / +23 lines)
Lines 666-671 if ( C4::Context->preference('EasyAnalyticalRecords') ) { Link Here
666
    }
666
    }
667
}
667
}
668
668
669
my $IndependentBranches = !C4::Context->IsSuperLibrarian()
670
  && C4::Context->preference('IndependentBranches');
671
my $IndependentBranchesRecordsAndItems = $IndependentBranches
672
  && C4::Context->preference('IndependentBranchesRecordsAndItems');
669
673
670
foreach my $field (@fields) {
674
foreach my $field (@fields) {
671
    next if ( $field->tag() < 10 );
675
    next if ( $field->tag() < 10 );
Lines 689-703 foreach my $field (@fields) { Link Here
689
						|| $subfieldvalue;
693
						|| $subfieldvalue;
690
        }
694
        }
691
695
692
        if (   $field->tag eq $branchtagfield
696
        if (   $IndependentBranches
693
            && $subfieldcode eq $branchtagsubfield
697
            && $field->tag   eq $branchtagfield
694
            && C4::Context->preference("IndependentBranches") )
698
            && $subfieldcode eq $branchtagsubfield )
695
        {
699
        {
700
696
            #verifying rights
701
            #verifying rights
697
            my $userenv = C4::Context->userenv();
698
            unless (
702
            unless (
699
                $userenv->{'flags'} % 2 == 1
703
                GetIndependentGroupModificationRights(
700
                || GetIndependentGroupModificationRights(
701
                    { for => $subfieldvalue }
704
                    { for => $subfieldvalue }
702
                )
705
                )
703
              )
706
              )
Lines 705-728 foreach my $field (@fields) { Link Here
705
                $this_row{'nomod'} = 1;
708
                $this_row{'nomod'} = 1;
706
            }
709
            }
707
        }
710
        }
708
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
709
711
710
	if ( C4::Context->preference('EasyAnalyticalRecords') ) {
712
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
711
	    foreach my $hostitemnumber (@hostitemnumbers){
712
		if ($this_row{itemnumber} eq $hostitemnumber){
713
			$this_row{hostitemflag} = 1;
714
			$this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
715
			last;
716
		}
717
	    }
718
713
719
#	    my $countanalytics=GetAnalyticsCount($this_row{itemnumber});
714
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
720
#           if ($countanalytics > 0){
715
            foreach my $hostitemnumber (@hostitemnumbers) {
721
#                $this_row{countanalytics} = $countanalytics;
716
                if ( $this_row{itemnumber} eq $hostitemnumber ) {
722
#           }
717
                    $this_row{hostitemflag} = 1;
723
	}
718
                    $this_row{hostbiblionumber} =
719
                      GetBiblionumberFromItemnumber($hostitemnumber);
720
                    last;
721
                }
722
            }
723
        }
724
724
725
    }
725
    }
726
727
    next if ( $this_row{'nomod'} && $IndependentBranchesRecordsAndItems );
728
726
    if (%this_row) {
729
    if (%this_row) {
727
        push(@big_array, \%this_row);
730
        push(@big_array, \%this_row);
728
    }
731
    }
(-)a/installer/data/mysql/updatedatabase.pl (+20 lines)
Lines 6995-7000 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6995
    SetVersion($DBversion);
6995
    SetVersion($DBversion);
6996
}
6996
}
6997
6997
6998
$DBversion = "3.13.00.XXX";
6999
if ( CheckVersion($DBversion) ) {
7000
    $dbh->do("
7001
        INSERT INTO systempreferences (
7002
            variable,
7003
            value,
7004
            options,
7005
            explanation,
7006
            type
7007
        ) VALUES (
7008
            'IndependentBranchesRecordsAndItems',
7009
            '0',
7010
            '',
7011
            'If on, the staff interface search will hide all records that do not contain an item owned by the logged in branch, and hide the items themselves.',
7012
            'YesNo'
7013
        )
7014
    ");
7015
    print "Upgrade to $DBversion done (Bug 10278 - Add ability to hide items and records from search results for Independent Branches)\n";
7016
    SetVersion ($DBversion);
7017
}
6998
7018
6999
=head1 FUNCTIONS
7019
=head1 FUNCTIONS
7000
7020
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc (-28 / +36 lines)
Lines 1-33 Link Here
1
<div class="gradient">
1
<div class="gradient">
2
<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Catalogue Resident Search Box -->
2
    <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Catalogue Resident Search Box -->
3
<div id="header_search">
3
    <div id="header_search">
4
4
5
[% INCLUDE 'patron-search-box.inc' %]
5
        [% INCLUDE 'patron-search-box.inc' %]
6
6
7
[% IF ( CAN_user_circulate ) %]
7
        [% IF ( CAN_user_circulate ) %]
8
<div id="checkin_search" class="residentsearch">
8
            <div id="checkin_search" class="residentsearch">
9
    <p class="tip">Scan a barcode to check in:</p>
9
                <p class="tip">Scan a barcode to check in:</p>
10
    <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off">
10
                <form method="post" action="/cgi-bin/koha/circ/returns.pl" autocomplete="off">
11
        <input name="barcode" id="ret_barcode" size="40" />
11
                    <input name="barcode" id="ret_barcode" size="40" />
12
        <input value="Submit" class="submit" type="submit" />
12
                    <input value="Submit" class="submit" type="submit" />
13
    </form>
13
                </form>
14
</div>
14
            </div>
15
	[% END %]
15
        [% END %]
16
	[% IF ( CAN_user_catalogue ) %]
16
17
	<div id="catalog_search" class="residentsearch">
17
        [% IF ( CAN_user_catalogue ) %]
18
	<p class="tip">Enter search keywords:</p>
18
            <div id="catalog_search" class="residentsearch">
19
		<form action="/cgi-bin/koha/catalogue/search.pl"  method="get" id="cat-search-block">
19
            <p class="tip">Enter search keywords:</p>
20
			 <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
20
                <form action="/cgi-bin/koha/catalogue/search.pl"  method="get" id="cat-search-block">
21
				<input type="submit" class="submit" value="Submit" />
21
                    <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
22
		</form>
22
                    <input type="submit" class="submit" value="Submit" />
23
	</div>
23
                </form>
24
	[% END %]
24
            </div>
25
	
25
        [% END %]
26
			<ul>
26
27
            [% IF ( CAN_user_circulate ) %]<li><a href="#circ_search">Check out</a></li>[% END %]
27
28
    [% IF ( CAN_user_circulate ) %]<li><a href="#checkin_search">Check in</a></li>[% END %]
28
        <ul>
29
            [% IF ( CAN_user_catalogue ) %]<li class="ui-tabs-selected"><a href="#catalog_search">Search the catalog</a></li>[% END %]
29
            [% IF ( CAN_user_circulate ) %]
30
			</ul>	
30
                <li><a href="#circ_search">Check out</a></li>
31
</div><!-- /header_search -->
31
            [% END %]
32
            [% IF ( CAN_user_circulate ) %]
33
                <li><a href="#checkin_search">Check in</a></li>
34
            [% END %]
35
            [% IF ( CAN_user_catalogue ) %]
36
                <li class="ui-tabs-selected"><a href="#catalog_search">Search the catalog</a></li>
37
            [% END %]
38
        </ul>
39
    </div><!-- /header_search -->
32
</div><!-- /gradient -->
40
</div><!-- /gradient -->
33
<!-- End Catalogue Resident Search Box -->
41
<!-- End Catalogue Resident Search Box -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+7 lines)
Lines 70-75 Administration: Link Here
70
                  yes: Prevent
70
                  yes: Prevent
71
                  no: "Don't prevent"
71
                  no: "Don't prevent"
72
            - staff (but not superlibrarians) from modifying objects (holds, items, patrons, etc.) belonging to other libraries.
72
            - staff (but not superlibrarians) from modifying objects (holds, items, patrons, etc.) belonging to other libraries.
73
        -
74
            - pref: IndependentBranchesRecordsAndItems
75
              default: 0
76
              choices:
77
                  yes: Prevent
78
                  no: "Don't prevent"
79
            - staff from seeing items owned by other libraries, and records without any items the library.
73
    CAS Authentication:
80
    CAS Authentication:
74
        -
81
        -
75
            - pref: casAuthentication
82
            - pref: casAuthentication
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt (-27 / +33 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Catalog &rsaquo; Advanced search</title>
3
<title>Koha &rsaquo; Catalog &rsaquo; Advanced search</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
Lines 229-262 Link Here
229
[% END %]
230
[% END %]
230
231
231
<!-- AVAILABILITY LIMITS -->
232
<!-- AVAILABILITY LIMITS -->
232
    <fieldset id="availability"><legend>Location and availability</legend>
233
<fieldset id="availability"><legend>Location and availability</legend>
233
<fieldset id="currently-avail">
234
    <fieldset id="currently-avail">
234
        <p><label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" /></p>
235
            <p><label for="available-items">Only items currently available</label> <input type="checkbox" id="available-items" name="limit" value="available" /></p>
235
</fieldset>
236
    </fieldset>
236
237
237
<fieldset id="select-libs">
238
    <fieldset id="select-libs">
238
        <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
239
            <p>
239
        <option value="">All libraries</option>
240
                <label for="branchloop">Individual libraries:</label>
240
        [% FOREACH branchloo IN branchloop %]
241
                <select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'>
241
        [% IF ( branchloo.selected ) %]
242
                    <option value="">All libraries</option>
242
        <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
243
                    [% FOREACH branchloo IN branchloop %]
243
        [% ELSE %]
244
                        [% IF ( branchloo.selected ) %]
244
        <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option>
245
                            <option value="branch:[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
245
        [% END %]
246
                        [% ELSE %]
246
        [% END %]
247
                            <option value="branch:[% branchloo.value %]">[% branchloo.branchname %]</option>
247
        </select></p>
248
                        [% END %]
248
    <!-- <input type="hidden" name="limit" value="branch: MAIN" /> -->
249
                    [% END %]
249
        [% IF ( searchdomainloop ) %]
250
                </select>
250
    <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. -->
251
            </p>
251
        <p><label for="categoryloop">Groups of libraries: </label><select name="multibranchlimit" id="categoryloop">
252
252
        <option value=""> -- none -- </option>
253
            [% IF searchdomainloop && !Koha.Preference('IndependentBranchesRecordsAndItems') %]
253
        [% FOREACH searchdomainloo IN searchdomainloop %]
254
                <p>OR</p> <!-- should addjs to grey out group pulldown if a library is selected. -->
254
        <option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option>
255
                <p>
255
        [% END %]
256
                    <label for="categoryloop">Groups of libraries: </label>
256
        </select></p>
257
                    <select name="multibranchlimit" id="categoryloop">
257
    [% END %]
258
                        <option value=""> -- none -- </option>
258
</fieldset>
259
                        [% FOREACH searchdomainloo IN searchdomainloop %]
260
                            <option value="[% searchdomainloo.categorycode %]">[% searchdomainloo.categoryname %]</option>
261
                        [% END %]
262
                    </select>
263
                </p>
264
            [% END %]
259
    </fieldset>
265
    </fieldset>
266
</fieldset>
260
<!-- /AVAILABILITY LIMITS -->
267
<!-- /AVAILABILITY LIMITS -->
261
268
262
<!-- RANK LIMITS -->
269
<!-- RANK LIMITS -->
263
- 

Return to bug 10278