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 (+123 lines)
Lines 41-46 BEGIN { Link Here
41
		&GetCategoryTypes
41
		&GetCategoryTypes
42
		&GetBranchCategories
42
		&GetBranchCategories
43
		&GetBranchesInCategory
43
		&GetBranchesInCategory
44
        &GetCategoriesForBranch
44
		&ModBranchCategoryInfo
45
		&ModBranchCategoryInfo
45
		&DelBranch
46
		&DelBranch
46
		&DelBranchCategory
47
		&DelBranchCategory
Lines 447-452 sub GetBranchesInCategory { Link Here
447
	return( \@branches );
448
	return( \@branches );
448
}
449
}
449
450
451
=head2 GetCategoriesForBranch
452
453
    my @categories = GetCategoriesForBranch({
454
        branchcode   => $branchcode,
455
        categorytype => 'independent_group'
456
    });
457
458
    Called in a list context, returns an array of branch category codes
459
    that branch is part of.
460
461
    Called in a scalar context, returns an array ref.
462
463
=cut
464
465
sub GetCategoriesForBranch {
466
    my ( $params ) = @_;
467
    my $branchcode = $params->{branchcode};
468
    my $categorytype = $params->{categorytype} || '%';
469
470
    carp("Missing branchcode parameter!") unless ( $branchcode );
471
472
    my $sql = q{
473
        SELECT categorycode FROM branchrelations
474
        JOIN branchcategories USING ( categorycode )
475
        WHERE branchcode   = ?
476
          AND categorytype = ?
477
    };
478
479
    my $categories = C4::Context->dbh->selectcol_arrayref( $sql, {}, ( $branchcode, $categorytype ) );
480
481
    return wantarray() ? $categories : @$categories;
482
}
483
484
=head2 GetIndependentGroupModificationRights
485
486
    GetIndependentGroupModificationRights(
487
                                           {
488
                                               branch => $this_branch,
489
                                               for => $other_branch,
490
                                               stringify => 1,
491
                                           } 
492
                                          );
493
494
    Returns a list of branches this branch shares a common
495
    independent group with.
496
497
    If 'branch' is not provided, it will be looked up via
498
    C4::Context->userenv->{branch}.
499
500
    If 'for' is provided, the lookup is limited to that branch.
501
502
    If called in a list context, returns a list of
503
    branchcodes ( including $this_branch ). 
504
    
505
    If called in a scalar context, it returns
506
    a count of matching branchcodes. Returns 1 if
507
508
    If stringify param is passed, the return value will
509
    be a string of the comma delimited branchcodes. This
510
    is useful for "branchcode IN $branchcodes" clauses 
511
    in SQL queries.
512
513
    $this_branch and $other_branch are equal for efficiency.
514
515
    So you can write:
516
    my @branches = GetIndependentGroupModificationRights();
517
    or something like:
518
    if ( GetIndependentGroupModificationRights( { for => $other_branch } ) ) { do_stuff(); }
519
520
=cut 
521
522
sub GetIndependentGroupModificationRights {
523
    my ($params) = @_;
524
525
    my $this_branch  = $params->{branch};
526
    my $other_branch = $params->{for};
527
    my $stringify    = $params->{stringify};
528
529
    $this_branch ||= C4::Context->userenv->{branch};
530
    $this_branch ||= $ENV{BRANCHCODE};
531
532
    return 1 if ( $this_branch && $this_branch eq $other_branch );
533
534
    my $allow_all = 0;
535
    $allow_all = 1 if C4::Context->IsSuperLibrarian();
536
    $allow_all = 1 if C4::Context->userenv->{type} eq 'opac' && !$ENV{BRANCHCODE};
537
538
    my $sql;
539
    my @params;
540
    if ( $allow_all ) {
541
        $sql = q{
542
            SELECT branchcode FROM branches WHERE 1
543
        }
544
    } else {
545
        $sql = q{
546
            SELECT DISTINCT(branchcode)
547
            FROM branchrelations
548
            JOIN branchcategories USING ( categorycode )
549
            WHERE categorycode IN (
550
                SELECT categorycode
551
                FROM branchrelations
552
                WHERE branchcode = ?
553
            )
554
            AND branchcategories.categorytype = 'independent_group'
555
        };
556
        push( @params, $this_branch );
557
    }
558
559
    if ($other_branch) {
560
        $sql .= q{ AND branchcode = ? };
561
        push( @params, $other_branch );
562
    }
563
564
    my $dbh = C4::Context->dbh;
565
    my @branchcodes = @{ $dbh->selectcol_arrayref( $sql, {}, @params ) };
566
567
    return join( ',', map { qq{'$_'} } ( @branchcodes, $this_branch ) )
568
      if ($stringify);
569
570
    return wantarray() ? ( @branchcodes, $this_branch ) : scalar(@branchcodes);
571
}
572
450
=head2 GetBranchInfo
573
=head2 GetBranchInfo
451
574
452
$results = GetBranchInfo($branchcode);
575
$results = GetBranchInfo($branchcode);
(-)a/C4/Context.pm (-14 / +22 lines)
Lines 1104-1126 set_userenv is called in Auth.pm Link Here
1104
1104
1105
#'
1105
#'
1106
sub set_userenv {
1106
sub set_userenv {
1107
    my ($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $branchname, $userflags, $emailaddress, $branchprinter, $persona)= @_;
1107
    my (
1108
    my $var=$context->{"activeuser"} || '';
1108
        $usernum,      $userid,        $usercnum,   $userfirstname,
1109
        $usersurname,  $userbranch,    $branchname, $userflags,
1110
        $emailaddress, $branchprinter, $persona,    $type
1111
    ) = @_;
1112
1113
    my $var = $context->{"activeuser"} || '';
1114
1109
    my $cell = {
1115
    my $cell = {
1110
        "number"     => $usernum,
1116
        "number"        => $usernum,
1111
        "id"         => $userid,
1117
        "id"            => $userid,
1112
        "cardnumber" => $usercnum,
1118
        "cardnumber"    => $usercnum,
1113
        "firstname"  => $userfirstname,
1119
        "firstname"     => $userfirstname,
1114
        "surname"    => $usersurname,
1120
        "surname"       => $usersurname,
1115
        #possibly a law problem
1121
        "branch"        => $userbranch,
1116
        "branch"     => $userbranch,
1122
        "branchname"    => $branchname,
1117
        "branchname" => $branchname,
1123
        "flags"         => $userflags,
1118
        "flags"      => $userflags,
1124
        "emailaddress"  => $emailaddress,
1119
        "emailaddress"     => $emailaddress,
1125
        "branchprinter" => $branchprinter,
1120
        "branchprinter"    => $branchprinter,
1126
        "persona"       => $persona,
1121
        "persona"    => $persona,
1127
        "type"          => $type,
1122
    };
1128
    };
1129
1123
    $context->{userenv}->{$var} = $cell;
1130
    $context->{userenv}->{$var} = $cell;
1131
1124
    return $cell;
1132
    return $cell;
1125
}
1133
}
1126
1134
(-)a/C4/Items.pm (-1 / +9 lines)
Lines 1201-1206 If this is set, it is set to C<One Order>. Link Here
1201
1201
1202
sub GetItemsInfo {
1202
sub GetItemsInfo {
1203
    my ( $biblionumber ) = @_;
1203
    my ( $biblionumber ) = @_;
1204
1205
    my $IndependentBranchesRecordsAndItems =
1206
      C4::Context->preference('IndependentBranchesRecordsAndItems')
1207
      && !C4::Context->IsSuperLibrarian();
1208
1204
    my $dbh   = C4::Context->dbh;
1209
    my $dbh   = C4::Context->dbh;
1205
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1210
    # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance.
1206
    my $query = "
1211
    my $query = "
Lines 1230-1236 sub GetItemsInfo { Link Here
1230
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1235
     LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber
1231
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1236
     LEFT JOIN itemtypes   ON   itemtypes.itemtype         = "
1232
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1237
     . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype');
1233
    $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1238
    $query .= " WHERE items.biblionumber = ? ";
1239
    $query .= " AND items.homebranch IN ( " . GetIndependentGroupModificationRights({ stringify => 1}) . " ) " if ( $IndependentBranchesRecordsAndItems );
1240
    $query .= " ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ;
1241
1234
    my $sth = $dbh->prepare($query);
1242
    my $sth = $dbh->prepare($query);
1235
    $sth->execute($biblionumber);
1243
    $sth->execute($biblionumber);
1236
    my $i = 0;
1244
    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 (-17 / +28 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-719 foreach my $field (@fields) { Link Here
689
						|| $subfieldvalue;
693
						|| $subfieldvalue;
690
        }
694
        }
691
695
692
        if (($field->tag eq $branchtagfield) && ($subfieldcode eq $branchtagsubfield) && C4::Context->preference("IndependentBranches")) {
696
        if (   $field->tag eq $branchtagfield
697
            && $subfieldcode eq $branchtagsubfield
698
            && $IndependentBranches )
699
        {
693
            #verifying rights
700
            #verifying rights
694
            my $userenv = C4::Context->userenv();
701
            unless (
695
            unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subfieldvalue))){
702
                GetIndependentGroupModificationRights(
703
                    { for => $subfieldvalue }
704
                )
705
              )
706
            {
696
                $this_row{'nomod'} = 1;
707
                $this_row{'nomod'} = 1;
697
            }
708
            }
698
        }
709
        }
699
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
700
710
701
	if ( C4::Context->preference('EasyAnalyticalRecords') ) {
711
        $this_row{itemnumber} = $subfieldvalue if ($field->tag() eq $itemtagfield && $subfieldcode eq $itemtagsubfield);
702
	    foreach my $hostitemnumber (@hostitemnumbers){
703
		if ($this_row{itemnumber} eq $hostitemnumber){
704
			$this_row{hostitemflag} = 1;
705
			$this_row{hostbiblionumber}= GetBiblionumberFromItemnumber($hostitemnumber);
706
			last;
707
		}
708
	    }
709
712
710
#	    my $countanalytics=GetAnalyticsCount($this_row{itemnumber});
713
        if ( C4::Context->preference('EasyAnalyticalRecords') ) {
711
#           if ($countanalytics > 0){
714
            foreach my $hostitemnumber (@hostitemnumbers) {
712
#                $this_row{countanalytics} = $countanalytics;
715
                if ( $this_row{itemnumber} eq $hostitemnumber ) {
713
#           }
716
                    $this_row{hostitemflag} = 1;
714
	}
717
                    $this_row{hostbiblionumber} =
718
                      GetBiblionumberFromItemnumber($hostitemnumber);
719
                    last;
720
                }
721
            }
722
        }
715
723
716
    }
724
    }
725
726
    next if ( $this_row{'nomod'} && $IndependentBranchesRecordsAndItems );
727
717
    if (%this_row) {
728
    if (%this_row) {
718
        push(@big_array, \%this_row);
729
        push(@big_array, \%this_row);
719
    }
730
    }
(-)a/installer/data/mysql/updatedatabase.pl (+20 lines)
Lines 6983-6988 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6983
    SetVersion($DBversion);
6983
    SetVersion($DBversion);
6984
}
6984
}
6985
6985
6986
$DBversion = "3.13.00.XXX";
6987
if ( CheckVersion($DBversion) ) {
6988
    print "Upgrade to $DBversion done (IndependentBranches)\n";
6989
    $dbh->do("
6990
        INSERT INTO systempreferences (
6991
            variable,
6992
            value,
6993
            options,
6994
            explanation,
6995
            type
6996
        ) VALUES (
6997
            'IndependentBranchesRecordsAndItems',
6998
            '0',
6999
            '',
7000
            '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.',
7001
            'YesNo'
7002
        )
7003
    ");
7004
    SetVersion ($DBversion);
7005
}
6986
7006
6987
=head1 FUNCTIONS
7007
=head1 FUNCTIONS
6988
7008
(-)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