Bugzilla – Attachment 64 Details for
Bug 1088
expand independant branches functionallity
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patches.
moreIndBranch.patch (text/plain), 37.36 KB, created by
Chris Cormack
on 2006-05-31 06:38:00 UTC
(
hide
)
Description:
proposed patches.
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2006-05-31 06:38:00 UTC
Size:
37.36 KB
patch
obsolete
>diff -rc koha-2.2.5-orig/intranet-cgi/acqui.simple/addbooks.pl koha-2.2.5-patch/intranet-cgi/acqui.simple/addbooks.pl >*** koha-2.2.5-orig/intranet-cgi/acqui.simple/addbooks.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/acqui.simple/addbooks.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 71,74 **** >--- 71,78 ---- > $template->param( NOTMARC => !$marc_p, > frameworkcodeloop => \@frameworkcodeloop ); > >+ if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv) && (C4::Context->userenv->{flags} != 1)) { >+ $template->param( IndBranch => C4::Context->userenv->{branch} ); >+ } >+ > output_html_with_http_headers $query, $cookie, $template->output; >diff -rc koha-2.2.5-orig/intranet-cgi/acqui.simple/additem.pl koha-2.2.5-patch/intranet-cgi/acqui.simple/additem.pl >*** koha-2.2.5-orig/intranet-cgi/acqui.simple/additem.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/acqui.simple/additem.pl 2006-05-24 12:03:33.000000000 -0600 >*************** >*** 46,53 **** >--- 46,65 ---- > } > return($indicator,$result); > } >+ > my $input = new CGI; > my $dbh = C4::Context->dbh; >+ my ($template, $loggedinuser, $cookie) >+ = get_template_and_user({template_name => "acqui.simple/additem.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => {editcatalogue => 1}, >+ debug => 1, >+ }); >+ >+ my $userenv = C4::Context->userenv; >+ > my $error = $input->param('error'); > my $bibid = $input->param('bibid'); > my $oldbiblionumber = &MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid); >*************** >*** 147,160 **** > #------------------------------------------------------------------------------------------------------------------------------ > # build screen with existing items. and "new" one > #------------------------------------------------------------------------------------------------------------------------------ >- my ($template, $loggedinuser, $cookie) >- = get_template_and_user({template_name => "acqui.simple/additem.tmpl", >- query => $input, >- type => "intranet", >- authnotrequired => 0, >- flagsrequired => {editcatalogue => 1}, >- debug => 1, >- }); > > my %indicators; > $indicators{995}=' '; >--- 171,176 ---- >*************** >*** 177,191 **** > next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10 && ($field->tag() ne $itemtagfield && $subf[$i][0] ne $itemtagsubfield)); > $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10); > $this_row{$subf[$i][0]} =$subf[$i][1] if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10); >! if (($field->tag eq $branchtagfield) && ($subf[$i][$0] eq $branchtagsubfield) && C4::Context->preference("IndependantBranches")) { > #verifying rights >- my $userenv = C4::Context->userenv; > unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subf[$i][1]))){ > $this_row{'nomod'}=1; > } > } > $this_row{itemnum} = $subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield); > } > if (%this_row) { > push(@big_array, \%this_row); > } >--- 193,209 ---- > next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10 && ($field->tag() ne $itemtagfield && $subf[$i][0] ne $itemtagsubfield)); > $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib} if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10); > $this_row{$subf[$i][0]} =$subf[$i][1] if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} eq 10); >! if (($field->tag eq $branchtagfield) && ($subf[$i][0] eq $branchtagsubfield) && C4::Context->preference("IndependantBranches")) { > #verifying rights > unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subf[$i][1]))){ > $this_row{'nomod'}=1; > } > } > $this_row{itemnum} = $subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield); > } >+ if (C4::Context->preference("IndependantBranches") && $userenv->{flags} != 1) { >+ undef %this_row if $this_row{$branchtagsubfield} ne $userenv->{branch}; >+ } > if (%this_row) { > push(@big_array, \%this_row); > } >*************** >*** 243,249 **** > #testing branch value if IndependantBranches. > my $test = (C4::Context->preference("IndependantBranches")) && > ($tag eq $branchtagfield) && ($subfield eq $branchtagsubfield) && >! (C4::Context->userenv->{flags} != 1) && ($value) && ($value ne C4::Context->userenv->{branch}) ; > # print $input->redirect(".pl?bibid=$bibid") if ($test); > # search for itemcallnumber if applicable > if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) { >--- 265,271 ---- > #testing branch value if IndependantBranches. > my $test = (C4::Context->preference("IndependantBranches")) && > ($tag eq $branchtagfield) && ($subfield eq $branchtagsubfield) && >! ($userenv->{flags} != 1) && ($value) && ($value ne $userenv->{branch}) ; > # print $input->redirect(".pl?bibid=$bibid") if ($test); > # search for itemcallnumber if applicable > if ($tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' && C4::Context->preference('itemcallnumber')) { >*************** >*** 260,268 **** > # builds list, depending on authorised value... > #---- branch > if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { >! if ((C4::Context->preference("IndependantBranches")) && (C4::Context->userenv->{flags} != 1)){ > my $sth=$dbh->prepare("select branchcode,branchname from branches where branchcode = ? order by branchname"); >! $sth->execute(C4::Context->userenv->{branch}); > push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); > while (my ($branchcode,$branchname) = $sth->fetchrow_array) { > push @authorised_values, $branchcode; >--- 282,290 ---- > # builds list, depending on authorised value... > #---- branch > if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { >! if ((C4::Context->preference("IndependantBranches")) && ($userenv->{flags} != 1)){ > my $sth=$dbh->prepare("select branchcode,branchname from branches where branchcode = ? order by branchname"); >! $sth->execute($userenv->{branch}); > push @authorised_values, "" unless ($tagslib->{$tag}->{$subfield}->{mandatory}); > while (my ($branchcode,$branchname) = $sth->fetchrow_array) { > push @authorised_values, $branchcode; >diff -rc koha-2.2.5-orig/intranet-cgi/admin/issuingrules.pl koha-2.2.5-patch/intranet-cgi/admin/issuingrules.pl >*** koha-2.2.5-orig/intranet-cgi/admin/issuingrules.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/admin/issuingrules.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 32,40 **** > my $dbh = C4::Context->dbh; > > my $type=$input->param('type'); >- my $branch = $input->param('branch'); >- $branch="" unless $branch; >- my $op = $input->param('op'); > > # my $flagsrequired; > # $flagsrequired->{circulation}=1; >--- 32,37 ---- >*************** >*** 46,51 **** >--- 43,58 ---- > flagsrequired => {parameters => 1, management => 1}, > debug => 1, > }); >+ >+ my $userenv = C4::Context->userenv; >+ my $branch = $input->param('branch'); >+ my $op = $input->param('op'); >+ if (C4::Context->preference("IndependantBranches")) { >+ if ($userenv->{'flags'} != 1){ >+ $branch = $userenv->{branch}; >+ } >+ } >+ > # save the values entered > if ($op eq 'save') { > my @names=$input->param(); >*************** >*** 98,109 **** > # } > } > } >- > } > my $branches = getbranches; > my @branchloop; > foreach my $thisbranch (keys %$branches) { > my $selected = 1 if $thisbranch eq $branch; > my %row =(value => $thisbranch, > selected => $selected, > branchname => $branches->{$thisbranch}->{'branchname'}, >--- 105,126 ---- > # } > } > } > } >+ > my $branches = getbranches; > my @branchloop; >+ if (($userenv->{flags} == 1) or ! C4::Context->preference("IndependantBranches")) { >+ my $selected = 1 if $branch eq ""; >+ push @branchloop, {value => "", selected => $selected, branchname => 'Default'}; >+ } > foreach my $thisbranch (keys %$branches) { > my $selected = 1 if $thisbranch eq $branch; >+ if (C4::Context->preference("IndependantBranches")) { >+ if ($userenv->{flags} != 1){ >+ next if ($userenv->{branch} ne $thisbranch); >+ $selected = ($thisbranch eq $userenv->{branch}); >+ } >+ } > my %row =(value => $thisbranch, > selected => $selected, > branchname => $branches->{$thisbranch}->{'branchname'}, >diff -rc koha-2.2.5-orig/intranet-cgi/detail.pl koha-2.2.5-patch/intranet-cgi/detail.pl >*** koha-2.2.5-orig/intranet-cgi/detail.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/detail.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 15,24 **** > = get_template_and_user({template_name => "catalogue/detail.tmpl", > query => $query, > type => "intranet", >! authnotrequired => 1, > flagsrequired => {borrow => 1}, > }); > > my $biblionumber=$query->param('bib'); > $template->param(biblionumber => $biblionumber); > >--- 15,25 ---- > = get_template_and_user({template_name => "catalogue/detail.tmpl", > query => $query, > type => "intranet", >! authnotrequired => 0, > flagsrequired => {borrow => 1}, > }); > >+ my $userenv = C4::Context->userenv; > my $biblionumber=$query->param('bib'); > $template->param(biblionumber => $biblionumber); > >*************** >*** 31,36 **** >--- 32,46 ---- > my ($websitecount, @websites) = &getwebsites($biblionumber); > my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); > >+ if (C4::Context->preference("IndependantBranches") && $userenv->{flags} != 1) { >+ for ( my $c = 0; $c <= $#items; $c++ ) { >+ if ($items[$c]->{'homebranch'} ne $userenv->{branch}) { >+ splice @items, $c, 1; >+ $c--; >+ } >+ } >+ } >+ > $dat->{'count'}=@items; > > $dat->{'additional'}=$addauthor->[0]->{'author'}; >diff -rc koha-2.2.5-orig/intranet-cgi/MARCdetail.pl koha-2.2.5-patch/intranet-cgi/MARCdetail.pl >*** koha-2.2.5-orig/intranet-cgi/MARCdetail.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/MARCdetail.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 86,91 **** >--- 86,93 ---- > debug => 1, > }); > >+ my $userenv = C4::Context->userenv; >+ > #Getting the list of all frameworks > my $queryfwk =$dbh->prepare("select frameworktext, frameworkcode from biblio_framework"); > $queryfwk->execute; >*************** >*** 220,225 **** >--- 223,237 ---- > my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$itemtype); > @big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array; > >+ if (C4::Context->preference("IndependantBranches") && $userenv->{flags} != 1) { >+ for ( my $c = 0; $c <= $#big_array; $c++ ) { >+ if ($big_array[$c]->{$holdingbrtagsubf} ne $userenv->{branch}) { >+ splice @big_array, $c, 1; >+ $c--; >+ } >+ } >+ } >+ > #fill big_row with missing datas > foreach my $subfield_code (keys(%witness)) { > for (my $i=0;$i<=$#big_array;$i++) { >diff -rc koha-2.2.5-orig/intranet-cgi/moredetail.pl koha-2.2.5-patch/intranet-cgi/moredetail.pl >*** koha-2.2.5-orig/intranet-cgi/moredetail.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/moredetail.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 47,52 **** >--- 47,54 ---- > flagsrequired => {catalogue => 1}, > }); > >+ my $userenv = C4::Context->userenv; >+ > # get variables > > my $biblionumber=$query->param('bib'); >*************** >*** 69,74 **** >--- 71,86 ---- > my @results; > > my (@items)=itemissues($bi); >+ >+ if (C4::Context->preference("IndependantBranches") && $userenv->{flags} != 1) { >+ for ( my $c = 0; $c <= $#items; $c++ ) { >+ if ($items[$c]->{'homebranch'} ne $userenv->{branch}) { >+ splice @items, $c, 1; >+ $c--; >+ } >+ } >+ } >+ > my $count=@items; > $data->{'count'}=$count; > my ($order,$ordernum)=getorder($bi,$biblionumber); >diff -rc koha-2.2.5-orig/intranet-cgi/overdue.pl koha-2.2.5-patch/intranet-cgi/overdue.pl >*** koha-2.2.5-orig/intranet-cgi/overdue.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/overdue.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 47,53 **** >--- 70,85 ---- > flagsrequired => {borrowers => 1}, > debug => 1, > }); >+ > my $dbh = C4::Context->dbh; >+ my $userenv = C4::Context->userenv; >+ >+ my (@overduedata, $CGIsort1, $CGIsort2); >+ >+ if (C4::Context->preference("IndependantBranches")) { >+ $branchfilter = $userenv->{branch} unless ($userenv->{flags} == 1); >+ } >+ > my $req; > $req = $dbh->prepare( "select categorycode, description from categories order by description"); > $req->execute; >*************** >*** 76,81 **** >--- 108,118 ---- > my $branches=getbranches(); > my @branchloop; > foreach my $thisbranch (keys %$branches) { >+ if (C4::Context->preference("IndependantBranches")) { >+ if ($userenv->{flags} != 1){ >+ next if ($thisbranch != $userenv->{branch}); >+ } >+ } > my $selected = 1 if $thisbranch eq $branchfilter; > my %row =(value => $thisbranch, > selected => $selected, >diff -rc koha-2.2.5-orig/intranet-cgi/search.marc/dictionary.pl koha-2.2.5-patch/intranet-cgi/search.marc/dictionary.pl >*** koha-2.2.5-orig/intranet-cgi/search.marc/dictionary.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/search.marc/dictionary.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 92,119 **** > push @tags, $dbh->quote("$tagfield$tagsubfield"); > } > > $resultsperpage= $input->param('resultsperpage'); > $resultsperpage = 19 if(!defined $resultsperpage); > my $orderby = $input->param('orderby'); > > findseealso($dbh,\@tags); > >! my @results, my $total; > my $strsth="select distinct subfieldvalue, count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in "; > my $listtags="("; > foreach my $tag (@tags){ > $listtags .= $tag .","; > } > $listtags =~s/,$/)/; > $strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue "; > # warn "search in biblio : ".$strsth; > my $value = uc($search[0]); > $value=~s/\*/%/g; > $value.= "%" if not($value=~m/%/); > # warn " texte : ".$value; > > $sth=$dbh->prepare($strsth); >! $sth->execute($value); > my $total; > my @catresults; > my $javalue; >--- 97,148 ---- > push @tags, $dbh->quote("$tagfield$tagsubfield"); > } > >+ if (C4::Context->preference("IndependantBranches") && $userenv->{branch} && ($userenv->{flags} != 1)) { >+ $sth->execute("items.homebranch"); >+ while ( my ($tagfield, $tagsubfield, $liblibrarian) = $sth->fetchrow) { >+ push @tags, $dbh->quote("$tagfield$tagsubfield"); >+ } >+ } >+ > $resultsperpage= $input->param('resultsperpage'); > $resultsperpage = 19 if(!defined $resultsperpage); > my $orderby = $input->param('orderby'); > > findseealso($dbh,\@tags); > > foreach (@tags) { > $_ =~ s/[\'\s]//g; # fix tags > } > >! my @results, my $total, my @bind; > my $strsth = "select marc_word.word, count(marc_word.bibid) from marc_word "; > >! if (C4::Context->preference("IndependantBranches") && $userenv->{branch} && ($userenv->{flags} != 1)) { >! $strsth .= " cross join marc_subfield_table as m1 on m1.bibid = marc_word.bibid "; >! } >! > $strsth .= "where marc_word.word like ? and marc_word.tagsubfield in "; > > my $listtags="('"; > $listtags .= join "','", split(',', $tags[0]); > $listtags .= "') "; > $strsth .= $listtags; > >! if (C4::Context->preference("IndependantBranches") && $userenv->{branch} && ($userenv->{flags} != 1)) { >! $strsth .= "and m1.subfieldvalue = ? and concat(m1.tag,m1.subfieldcode) in ('". join("','", split(',', $tags[1])) ."') "; >! push @bind, $userenv->{branch} >! } > > $strsth .= "group by marc_word.word"; > > my $value = uc($search[0]); > $value=~s/\*/%/g; > $value.= "%" if not($value=~m/%/); >! unshift @bind, $value; > > $sth=$dbh->prepare($strsth); >! $sth->execute(@bind); >! > my $total; > my @catresults; > my $javalue; >diff -rc koha-2.2.5-orig/intranet-cgi/search.marc/search.pl koha-2.2.5-patch/intranet-cgi/search.marc/search.pl >*** koha-2.2.5-orig/intranet-cgi/search.marc/search.pl 2006-01-13 14:24:18.000000000 -0700 >--- koha-2.2.5-patch/intranet-cgi/search.marc/search.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 106,111 **** >--- 106,122 ---- > my @excluding = $query->param('excluding'); > my @operator = $query->param('operator'); > my @value = $query->param('value'); >+ my $branch_set = 0; >+ >+ for (my $i = 0; $i <= $#marclist; $i++) { >+ if (($marclist[$i] eq '') || ($marclist[$i] eq 'items.barcode')) { >+ $value[$i] =~ s/^\s*//; >+ #$value[$i] =~ s/^0*//; >+ } >+ if ( $marclist[$i] eq 'items.homebranch' ) { >+ $branch_set = $value[$i]; >+ } >+ } > > $resultsperpage= $query->param('resultsperpage'); > $resultsperpage = 19 if(!defined $resultsperpage); >*************** >*** 139,147 **** > my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, > \@excluding, \@operator, \@value, > $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc); > if ($total == 1) { > # if only 1 answer, jump directly to the biblio > print $query->redirect("/cgi-bin/koha/MARCdetail.pl?bib=".@$results[0]->{biblionumber}); > exit > } > ($template, $loggedinuser, $cookie) >--- 159,194 ---- > my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, > \@excluding, \@operator, \@value, > $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc); >+ >+ # hide record not in this branch if IndependantBranches >+ if (C4::Context->preference("IndependantBranches") && $branch_set) { >+ for (my $i=0; $i <= $#$results; $i++) { >+ my @items = @{$$results[$i]->{CN}}; >+ for (my $it=0; $it <= $#items; $it++) { >+ if ($items[$it]{holdingbranch} != $branch_set) { >+ splice @items,$it,1; # remove that element >+ $it--; # counter $it++ in for() >+ $$results[$i]{totitem}--; >+ } else { # IndependantBranches is on, so hide holdingbranch >+ $items[$it]{holdingbranch} = ""; >+ $items[$it]{holdingbranchname} = ""; >+ $items[$it]{location} = ""; >+ } >+ } >+ if (@items) { >+ @{$$results[$i]->{CN}} = @items; # re-store items >+ $$results[$i]->{totitem} = $#items + 1; >+ } else { >+ splice @$results,$i,1; # items empty, remove record >+ $i--; # counter $i++ in for() >+ $total--; # one less total >+ } >+ } >+ } >+ > if ($total == 1) { > # if only 1 answer, jump directly to the biblio > print $query->redirect("/cgi-bin/koha/MARCdetail.pl?bib=".@$results[0]->{biblionumber}); > exit > } > ($template, $loggedinuser, $cookie) >diff -rc koha-2.2.5-orig/modules/C4/Circulation/Circ2.pm koha-2.2.5-patch/modules/C4/Circulation/Circ2.pm >*** koha-2.2.5-orig/modules/C4/Circulation/Circ2.pm 2006-01-13 14:24:20.000000000 -0700 >--- koha-2.2.5-patch/modules/C4/Circulation/Circ2.pm 2006-05-24 11:48:33.000000000 -0600 >*************** >*** 328,338 **** > my $dbh = C4::Context->dbh; > my $sth; > if ($itemnumber) { > $sth=$dbh->prepare("select * from biblio,items,biblioitems where items.itemnumber=? and biblio.biblionumber=items.biblionumber and biblioitems.biblioitemnumber = items.biblioitemnumber"); > $sth->execute($itemnumber); > } elsif ($barcode) { > $sth=$dbh->prepare("select * from biblio,items,biblioitems where items.barcode=? and biblio.biblionumber=items.biblionumber and biblioitems.biblioitemnumber = items.biblioitemnumber"); >! $sth->execute($barcode); > } else { > $env->{'apierror'}="getiteminformation() subroutine must be called with either an itemnumber or a barcode"; > # Error condition. >--- 335,353 ---- > my $dbh = C4::Context->dbh; > my $sth; > if ($itemnumber) { > $sth=$dbh->prepare("select * from biblio cross join items cross join biblioitems on biblio.biblionumber=items.biblionumber and biblioitems.biblioitemnumber = items.biblioitemnumber where items.itemnumber=?"); > $sth->execute($itemnumber); > } elsif ($barcode) { > my $query = "select * from biblio cross join items cross join biblioitems on biblio.biblionumber=items.biblionumber and biblioitems.biblioitemnumber = items.biblioitemnumber where items.barcode=?"; >! my @bind = ($barcode); >! >! if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv) && (C4::Context->userenv->{flags} != 1)) { >! $query .= " and items.homebranch=?"; >! push @bind, C4::Context->userenv->{branch}; >! } >! >! $sth=$dbh->prepare($query); >! $sth->execute(@bind); > } else { > $env->{'apierror'}="getiteminformation() subroutine must be called with either an itemnumber or a barcode"; > # Error condition. >diff -rc koha-2.2.5-orig/modules/C4/Search.pm koha-2.2.5-patch/modules/C4/Search.pm >*** koha-2.2.5-orig/modules/C4/Search.pm 2006-01-13 14:24:20.000000000 -0700 >--- koha-2.2.5-patch/modules/C4/Search.pm 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 1459,1467 **** > sub itemdata { > my ($barcode)=@_; > my $dbh = C4::Context->dbh; >! my $sth=$dbh->prepare("Select * from items,biblioitems where barcode=? >! and items.biblioitemnumber=biblioitems.biblioitemnumber"); >! $sth->execute($barcode); > my $data=$sth->fetchrow_hashref; > $sth->finish; > return($data); >--- 1468,1483 ---- > sub itemdata { > my ($barcode)=@_; > my $dbh = C4::Context->dbh; >! my $query = "Select * from items cross join biblioitems >! on items.biblioitemnumber=biblioitems.biblioitemnumber >! where barcode=?"; >! my @bind = ($barcode); >! if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv) && (C4::Context->userenv->{flags} != 1)) { >! $query .= " and items.homebranch=?"; >! push @bind, C4::Context->userenv->{branch}; >! } >! my $sth=$dbh->prepare($query); >! $sth->execute(@bind); > my $data=$sth->fetchrow_hashref; > $sth->finish; > return($data); >*************** >*** 1826,1832 **** > > if($type eq "simple") # simple search for one letter only > { >! $query="Select * from borrowers where surname like ? order by $orderby"; > @bind=("$searchstring%"); > } > else # advanced search looking in surname, firstname and othernames >--- 1846,1852 ---- > > if($type eq "simple") # simple search for one letter only > { >! $query="Select * from borrowers where surname like ? "; > @bind=("$searchstring%"); > } > else # advanced search looking in surname, firstname and othernames >*************** >*** 1834,1840 **** > @data=split(' ',$searchstring); > $count=@data; > $query="Select * from borrowers >! where ((surname like ? or surname like ? > or firstname like ? or firstname like ? > or othernames like ? or othernames like ?) > "; >--- 1854,1860 ---- > @data=split(' ',$searchstring); > $count=@data; > $query="Select * from borrowers >! where (((surname like ? or surname like ? > or firstname like ? or firstname like ? > or othernames like ? or othernames like ?) > "; >*************** >*** 1847,1864 **** > push(@bind,"$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%"); > # FIXME - .= <<EOT; > } >! $query=$query.") or cardnumber like ? >! order by $orderby"; > push(@bind,$searchstring); > # FIXME - .= <<EOT; > } > > my $sth=$dbh->prepare($query); > $sth->execute(@bind); > my @results; > my $cnt=$sth->rows; > while (my $data=$sth->fetchrow_hashref){ > push(@results,$data); > } > # $sth->execute; > $sth->finish; >--- 1867,1896 ---- > push(@bind,"$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%","$data[$i]%","% $data[$i]%"); > # FIXME - .= <<EOT; > } >! $query=$query.") or cardnumber like ? )"; > push(@bind,$searchstring); > # FIXME - .= <<EOT; > } >+ # This restricts patron lookups to the user's branch if IndepenantBranches is on >+ # FIXME This uses a specific branch categorycode. Not portable. >+ # DO is District Wide Branch. Has all access to patrons. >+ if (C4::Context->preference("IndependantBranches") && (C4::Context->userenv) && (C4::Context->userenv->{flags} != 1)) { >+ my $bc_sth = $dbh->prepare("Select branchcode from branchrelations where branchcode = ? and categorycode = ?"); >+ $bc_sth->execute(C4::Context->userenv->{branch}, 'DO'); >+ unless ( $bc_sth->rows ) { >+ $query .= " and branchcode = ? "; >+ push @bind, C4::Context->userenv->{branch}; >+ } >+ } >+ >+ $query .= "order by $orderby"; > > my $sth=$dbh->prepare($query); > $sth->execute(@bind); > my @results; > my $cnt=$sth->rows; > while (my $data=$sth->fetchrow_hashref){ > push(@results,$data); > } > # $sth->execute; > $sth->finish; >diff -rc koha-2.2.5-orig/opac-cgi/opac-dictionary.pl koha-2.2.5-patch/opac-cgi/opac-dictionary.pl >*** koha-2.2.5-orig/opac-cgi/opac-dictionary.pl 2006-01-13 14:24:19.000000000 -0700 >--- koha-2.2.5-patch/opac-cgi/opac-dictionary.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 49,76 **** > =cut > > my $input = new CGI; > my $field =$input->param('marclist'); >- #warn "field :$field"; > my ($tablename, $kohafield)=split /./,$field; >- #my $tablename=$input->param('tablename'); > $tablename="biblio" unless ($tablename); >! #my $kohafield = $input->param('kohafield'); > my @search = $input->param('search'); >! # warn " ".$search[0]; > my $index = $input->param('index'); >! # warn " index: ".$index; > my $op=$input->param('op'); > if (($search[0]) and not ($op eq 'do_search')){ > $op='do_search'; > } >! my $script_name = 'opac-dictionary.pl'; >! my $query; >! my $type=$input->param('type'); >! #warn " ".$type; > > my $dbh = C4::Context->dbh; > my ($template, $loggedinuser, $cookie); >! > my $env; > > my $startfrom=$input->param('startfrom'); >--- 49,75 ---- > =cut > > my $input = new CGI; >+ > my $field =$input->param('marclist'); > my ($tablename, $kohafield)=split /./,$field; > $tablename="biblio" unless ($tablename); >! > my @search = $input->param('search'); >! > my $index = $input->param('index'); >! > my $op=$input->param('op'); > if (($search[0]) and not ($op eq 'do_search')){ > $op='do_search'; > } >! my $type = $input->param('type'); >! >! my $branch = $input->cookie('branch'); > > my $dbh = C4::Context->dbh; >+ my $script_name = 'opac-dictionary.pl'; > my ($template, $loggedinuser, $cookie); >! my $query; > my $env; > > my $startfrom=$input->param('startfrom'); >*************** >*** 88,123 **** > $sth->execute("$field"); > my (@tags, @and_or, @operator, @excluding,@value); > >! while ((my $tagfield,my $tagsubfield,my $liblibrarian) = $sth->fetchrow) { > push @tags, $dbh->quote("$tagfield$tagsubfield"); > } > > $resultsperpage= $input->param('resultsperpage'); > $resultsperpage = 19 if(!defined $resultsperpage); > my $orderby = $input->param('orderby'); > > findseealso($dbh,\@tags); > >! my @results, my $total; > my $strsth="select distinct subfieldvalue, count(marc_subfield_table.bibid) from marc_subfield_table,marc_word where marc_word.word like ? and marc_subfield_table.bibid=marc_word.bibid and marc_subfield_table.tagorder=marc_word.tagorder and marc_word.tagsubfield in "; >! my $listtags="("; >! foreach my $tag (@tags){ >! $listtags .= $tag .","; >! } >! $listtags =~s/,$/)/; > $strsth .= $listtags." and marc_word.tagsubfield=concat(marc_subfield_table.tag,marc_subfield_table.subfieldcode) group by subfieldvalue "; >! # warn "search in biblio : ".$strsth; > my $value = uc($search[0]); > $value=~s/\*/%/g; > $value.= "%" if not($value=~m/%/); >! # warn " texte : ".$value; > > $sth=$dbh->prepare($strsth); >! $sth->execute($value); > my $total; > my @catresults; > while (my ($value,$ctresults)=$sth->fetchrow) { >- # warn "countresults : ".$ctresults; > push @catresults,{value=> $value, > even=>($total-$startfrom*$resultsperpage)%2, > count=>$ctresults >--- 87,145 ---- > $sth->execute("$field"); > my (@tags, @and_or, @operator, @excluding,@value); > >! while ( my ( $tagfield, $tagsubfield ) = $sth->fetchrow) { > push @tags, $dbh->quote("$tagfield$tagsubfield"); > } > >+ if (C4::Context->preference("IndependantBranches") && $branch) { >+ $sth->execute("items.homebranch"); >+ while ( my ( $tagfield, $tagsubfield ) = $sth->fetchrow ) { >+ push @tags, $dbh->quote("$tagfield$tagsubfield"); >+ } >+ } >+ > $resultsperpage= $input->param('resultsperpage'); > $resultsperpage = 19 if(!defined $resultsperpage); > my $orderby = $input->param('orderby'); > > findseealso($dbh,\@tags); > >! foreach (@tags) { >! $_ =~ s/[\'\s]//g; # fix tags >! } >! >! my @results, my $total, my @bind; > my $strsth = "select marc_word.word, count(marc_word.bibid) from marc_word "; >! >! if (C4::Context->preference("IndependantBranches") && $branch) { >! $strsth .= "cross join marc_subfield_table as m1 on m1.bibid = marc_word.bibid "; >! } >! >! $strsth .= "where marc_word.word like ? and marc_word.tagsubfield in "; >! >! my $listtags = "('"; >! $listtags .= join "','", split(',', $tags[0]); >! $listtags .= "') "; >! $strsth .= $listtags; >! >! if (C4::Context->preference("IndependantBranches") && $branch) { >! $strsth .= "and m1.subfieldvalue = ? and concat(m1.tag,m1.subfieldcode) in ('". join("','", split(',', $tags[1])) ."') "; >! push @bind, $branch; >! } >! >! $strsth .= "group by marc_word.word"; >! > my $value = uc($search[0]); > $value=~s/\*/%/g; > $value.= "%" if not($value=~m/%/); >! unshift @bind, $value; > > $sth=$dbh->prepare($strsth); >! $sth->execute(@bind); >! > my $total; > my @catresults; > while (my ($value,$ctresults)=$sth->fetchrow) { > push @catresults,{value=> $value, > even=>($total-$startfrom*$resultsperpage)%2, > count=>$ctresults >diff -rc koha-2.2.5-orig/opac-cgi/opac-main.pl koha-2.2.5-patch/opac-cgi/opac-main.pl >*** koha-2.2.5-orig/opac-cgi/opac-main.pl 2006-01-13 14:24:19.000000000 -0700 >--- koha-2.2.5-patch/opac-cgi/opac-main.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 5,10 **** >--- 5,11 ---- > use HTML::Template; > > use C4::Auth; # get_template_and_user >+ use C4::Acquisition; # branches() > use C4::Interface::CGI::Output; > use C4::BookShelves; > use C4::Koha; >*************** >*** 51,56 **** >--- 53,77 ---- > } > my $languages_count = @options; > >+ my @branches; >+ my @select_branch; >+ my %select_branches; >+ my ($count2,@branches)=branches(); >+ push @select_branch, ""; >+ $select_branches{''} = ""; >+ for (my $i=0;$i<$count2;$i++){ >+ push @select_branch, $branches[$i]->{'branchcode'};# >+ $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'}; >+ } >+ my $CGIbranch=CGI::scrolling_list( -name => 'value', >+ -id => 'branch', >+ -values => \@select_branch, >+ -labels => \%select_branches, >+ -defaults => [$template->param('Branch')], >+ -size => 1, >+ -tabindex => '', >+ -multiple => 0 ); >+ > if($languages_count > 1){ > $template->param(languages => \@options); > } >*************** >*** 59,63 **** >--- 80,85 ---- > virtualshelves => C4::Context->preference("virtualshelves"), > textmessaging => $borrower->{textmessaging}, > opaclargeimage => C4::Context->preference("opaclargeimage"), >+ CGIbranch => $CGIbranch, > ); > output_html_with_http_headers $input, $cookie, $template->output; >diff -rc koha-2.2.5-orig/opac-cgi/opac-reserve.pl koha-2.2.5-patch/opac-cgi/opac-reserve.pl >*** koha-2.2.5-orig/opac-cgi/opac-reserve.pl 2006-01-13 14:24:19.000000000 -0700 >--- koha-2.2.5-patch/opac-cgi/opac-reserve.pl 2006-05-24 11:56:12.000000000 -0600 >*************** >*** 53,59 **** > $template->param(rank => $rank); > > # pass the pickup branch along.... >! my $branch = $query->param('branch'); > $template->param(branch => $branch); > > my $branches = getbranches(); >--- 53,59 ---- > $template->param(rank => $rank); > > # pass the pickup branch along.... >! my $branch = $query->param('branch') || $query->cookie('branch'); > $template->param(branch => $branch); > > my $branches = getbranches(); >*************** >*** 71,81 **** > > my @CGIbranchlooparray; > >! foreach my $branch (keys %$branches) { >! if ($branch) { > my %line; >! $line{branch} = $branches->{$branch}->{'branchname'}; >! $line{value} = $branch; > push @CGIbranchlooparray, \%line; > } > } >--- 71,82 ---- > > my @CGIbranchlooparray; > >! foreach my $brnch (keys %$branches) { >! if ($brnch) { > my %line; >! $line{branch} = $branches->{$brnch}->{'branchname'}; >! $line{value} = $brnch; >! $line{select} = ($brnch == $branch); > push @CGIbranchlooparray, \%line; > } > } >diff -rc koha-2.2.5-orig/opac-cgi/opac-search.pl koha-2.2.5-patch/opac-cgi/opac-search.pl >*** koha-2.2.5-orig/opac-cgi/opac-search.pl 2006-01-13 14:24:19.000000000 -0700 >--- koha-2.2.5-patch/opac-cgi/opac-search.pl 2006-05-23 16:19:52.000000000 -0600 >*************** >*** 32,37 **** >--- 32,38 ---- > my ($template, $loggedinuser, $cookie); > my $resultsperpage; > my $searchdesc; >+ my $branch = $query->cookie('branch'); > > if ($op eq "do_search") { > my @marclist = $query->param('marclist'); >*************** >*** 42,53 **** > my $orderby = $query->param('orderby'); > my $desc_or_asc = $query->param('desc_or_asc'); > my $exactsearch = $query->param('exact'); > > for (my $i=0;$i<=$#marclist;$i++) { > if ($searchdesc) { # don't put the and_or on the 1st search term >! $searchdesc .= $and_or[$i].$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]); > } else { >! $searchdesc = $excluding[$i].($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]); > } > } > $resultsperpage= $query->param('resultsperpage'); >--- 43,67 ---- > my $orderby = $query->param('orderby'); > my $desc_or_asc = $query->param('desc_or_asc'); > my $exactsearch = $query->param('exact'); >+ my $passes = 0; >+ >+ my $list_index; >+ for ($list_index = 0; $list_index <= $#marclist; $list_index++) { >+ if ($marclist[$list_index] eq 'items.homebranch') { >+ $branch = $value[$list_index]; >+ } >+ >+ if (($marclist[$list_index] eq '') || ($marclist[$list_index] eq 'items.barcode')) { >+ $value[$list_index] =~ s/^\s*//; >+ #$value[$list_index] =~ s/^0*//; >+ } >+ } > > for (my $i=0;$i<=$#marclist;$i++) { > if ($searchdesc) { # don't put the and_or on the 1st search term >! $searchdesc .= " ".$and_or[$i].$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i] if ($value[$i]); > } else { >! $searchdesc = $excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*")." ".$operator[$i]." ".$value[$i] if ($value[$i]); > } > } > $resultsperpage= $query->param('resultsperpage'); >*************** >*** 74,82 **** > } > } > findseealso($dbh,\@tags); > my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, > \@excluding, \@operator, \@value, > $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc); > if ($total ==1) { > if (C4::Context->preference("BiblioDefaultView") eq "normal") { > print $query->redirect("/cgi-bin/koha/opac-detail.pl?bib=".@$results[0]->{biblionumber}); >--- 88,132 ---- > } > } > findseealso($dbh,\@tags); > my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, > \@excluding, \@operator, \@value, > $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc); > > # hide records not to be returned in opac. > for (my $i=0; $i <= $#$results; $i++) { > if ($$results[$i]->{notforopac}) { > splice @$results,$i,1; # remove that element > $i--; # counter $i++ in for() > $total-- if ($total <= $resultsperpage); # one less total > } > } >! >! # hide record not in this branch if IndependantBranches >! if (C4::Context->preference("IndependantBranches") && $branch) { >! for (my $i=0; $i <= $#$results; $i++) { >! my @items = @{$$results[$i]->{CN}}; >! for (my $it=0; $it <= $#items; $it++) { >! if ($items[$it]{holdingbranch} != $branch) { >! splice @items,$it,1; # remove that element >! $it--; # counter $it++ in for() >! $$results[$i]{totitem}--; >! } else { # IndependantBranches is on, so hide holdingbranch >! $items[$it]{holdingbranch} = ""; >! $items[$it]{holdingbranchname} = ""; >! $items[$it]{location} = ""; >! } >! } >! if (@items) { >! @{$$results[$i]->{CN}} = @items; # re-store items >! $$results[$i]->{totitem} = $#items + 1; >! } else { >! splice @$results,$i,1; # items empty, remove record >! $i--; # counter $i++ in for() >! $total--; # one less total >! } >! } >! } >! > if ($total ==1) { > if (C4::Context->preference("BiblioDefaultView") eq "normal") { > print $query->redirect("/cgi-bin/koha/opac-detail.pl?bib=".@$results[0]->{biblionumber}); >*************** >*** 202,207 **** >--- 275,281 ---- > my $CGIbranch=CGI::scrolling_list( -name => 'value', > -values => \@select_branch, > -labels => \%select_branches, >+ -defaults => [$branch], > -size => 1, > -multiple => 0 ); > $sth->finish; >*************** >*** 215,218 **** >--- 290,298 ---- > ); > } > >+ if ($branch != $query->cookie('branch')) { >+ my $branchcookie=$query->cookie(-name => 'branch', -value => "$branch", -expires => '+1y'); >+ $cookie = [@$cookie,$branchcookie]; >+ $template->param(branch => $branch, branchname => &getbranchname($branch)); >+ } > output_html_with_http_headers $query, $cookie, $template->output;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 1088
:
64