From b38997925f603dc9784c25d3db3501644c19e068 Mon Sep 17 00:00:00 2001 From: tipaul Date: Wed, 26 Oct 2005 09:11:02 +0000 Subject: [PATCH] big commit, still breaking things... * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. * code cleaning (cleaning warnings from perl -w) continued --- C4/Acquisition.pm | 74 +-- C4/Amazon.pm | 4 +- C4/Auth.pm | 87 ++-- C4/AuthoritiesMarc.pm | 57 ++- C4/Biblio.pm | 33 +- C4/Bull.pm | 53 +-- C4/Circulation/Circ2.pm | 48 +- C4/Circulation/Fines.pm | 2 +- C4/Circulation/Returns.pm | 2 +- C4/Context.pm | 30 +- C4/Koha.pm | 4 +- C4/Members.pm | 82 ++-- C4/Reserves2.pm | 2 +- C4/SearchMarc.pm | 45 +- acqui.simple/addbiblio.pl | 12 +- acqui.simple/additem-nomarc.pl | 80 +++- acqui.simple/additem.pl | 71 +-- acqui/acqui-home.pl | 3 +- acqui/histsearch.pl | 4 +- acqui/newbiblio.pl | 6 +- admin/aqbookfund.pl | 99 ++-- admin/aqbudget.pl | 63 +-- admin/branches.pl | 8 +- admin/systempreferences.pl | 44 +- authorities/authorities.pl | 3 +- authorities/blinddetail-biblio-search.pl | 15 +- barcodes/barcodes.pl | 2 +- bull/lateissues.pl | 10 +- bull/statecollection.pl | 3 + circ/branchtransfers.pl | 67 ++- circ/circulation.pl | 6 +- circ/returns.pl | 27 +- .../default/en/acqui.simple/addbiblio.tmpl | 285 ++++++++---- .../default/en/acqui.simple/additem.tmpl | 3 +- .../default/en/acqui/basket.tmpl | 30 +- .../default/en/acqui/histsearch.tmpl | 138 +++++- .../default/en/acqui/newbiblio.tmpl | 8 +- .../default/en/acqui/suggestion-select.tmpl | 3 +- .../default/en/authorities/auth_finder.tmpl | 2 +- .../en/authorities/authorities-home.tmpl | 2 +- .../default/en/authorities/authorities.tmpl | 46 +- .../default/en/authorities/detail.tmpl | 11 +- .../en/bookshelves/addbookbybiblionumber.tmpl | 2 +- .../default/en/bookshelves/shelves.tmpl | 32 +- .../default/en/bull/lateissues.tmpl | 6 +- .../intranet-tmpl/default/en/bull/search.tmpl | 22 +- .../default/en/bull/statecollection.tmpl | 4 +- .../default/en/bull/subscription-detail.tmpl | 4 + .../default/en/bull/subscription-renew.tmpl | 2 +- .../default/en/catalogue/MARCdetail.tmpl | 52 +-- .../default/en/circ/branchtransfers.tmpl | 17 +- .../default/en/circ/returns.tmpl | 3 +- .../default/en/includes/common-style.css | 7 +- .../default/en/includes/members-top.inc | 2 - .../default/en/includes/parameters-top.inc | 9 + .../default/en/includes/reportswcal-top.inc | 27 +- .../default/en/members/moremember.tmpl | 86 +--- .../default/en/members/readingrec.tmpl | 5 +- .../default/en/parameters/aqbookfund.tmpl | 16 +- .../en/parameters/auth_tag_structure.tmpl | 4 +- .../default/en/parameters/viewlog.tmpl | 230 ---------- .../en/reports/acquisitions_stats.tmpl | 1 - .../default/en/reports/borrowers_stats.tmpl | 10 +- .../default/en/reports/issues_stats.tmpl | 3 +- .../default/en/search.marc/result.tmpl | 6 +- .../default/en/search.marc/search.tmpl | 28 +- .../default/en/search.marc/suggest.tmpl | 6 +- .../default/en/value_builder/labs_theses.tmpl | 126 +++++ .../en/value_builder/unimarc_field_100.tmpl | 27 +- .../en/value_builder/unimarc_field_210c.tmpl | 6 +- members/deletemem.pl | 7 +- members/imemberentry.pl | 4 +- members/memberentry.pl | 22 +- members/moremember.pl | 13 +- opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 + opac/opac-basket.pl | 9 +- opac/opac-main.pl | 6 +- opac/opac-search.pl | 26 +- opac/opac-sendbasket.pl | 78 +--- opac/opac-user.pl | 4 + reports/acquisitions_stats.pl | 430 ++++++++++-------- reports/borrowers_stats.pl | 35 +- reports/catalogue_stats.pl | 16 +- reports/issues_by_borrower_category.plugin | 8 +- reports/issues_stats.pl | 5 +- search.marc/search.pl | 5 +- updater/updatedatabase | 128 +++++- value_builder/labs_theses.pl | 186 ++++++++ value_builder/unimarc_field_100.pl | 1 + value_builder/unimarc_field_210c.pl | 2 +- z3950/z3950-daemon-launch.sh | 11 +- 92 files changed, 1987 insertions(+), 1330 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/default/en/parameters/viewlog.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/value_builder/labs_theses.tmpl create mode 100644 value_builder/labs_theses.pl diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 7ce298c090..df119583e1 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -20,6 +20,7 @@ package C4::Acquisition; use strict; require Exporter; use C4::Context; +use C4::Date; use MARC::Record; # use C4::Biblio; @@ -487,7 +488,7 @@ C<@results> is sorted alphabetically by book title. #' sub getallorders { #gets all orders from a certain supplier, orders them alphabetically - my ($supid)=@_; + my ($supplierid)=@_; my $dbh = C4::Context->dbh; my @results = (); my $strsth="Select *,aqorders.title as suggestedtitle,biblio.title as truetitle from aqorders,biblio,biblioitems,aqbasket,aqbooksellers "; @@ -506,14 +507,13 @@ sub getallorders { } $strsth .= " group by aqorders.biblioitemnumber order by biblio.title"; my $sth=$dbh->prepare($strsth); - $sth->execute($supid); + $sth->execute($supplierid); while (my $data=$sth->fetchrow_hashref){ push(@results,$data); } $sth->finish; return(scalar(@results),@results); } - =item getsupplierlistwithlateorders %results = &getsupplierlistwithlateorders; @@ -590,7 +590,7 @@ sub getlateorders { AND ((datereceived = '' OR datereceived is null) OR (aqorders.quantityreceived < aqorders.quantity) ) "; $strsth .= " AND aqbasket.booksellerid = $supplierid " if ($supplierid); $strsth .= " AND borrowers.branchcode like \'".$branch."\'" if ($branch); - $strsth .= " AND borrowers.branchcode like \'".C4::Context->userenv->{branch}."\'" if (C4::Context->preference("IndependantBranches") && C4::Context->userenv->{flags}!=1); + $strsth .= " AND borrowers.branchcode like \'".C4::Context->userenv->{branch}."\'" if (C4::Context->preference("IndependantBranches") && C4::Context->userenv && C4::Context->userenv->{flags}!=1); $strsth .= " ORDER BY latesince,basketno,borrowers.branchcode, supplier"; } else { $strsth ="SELECT aqbasket.basketno, @@ -728,33 +728,43 @@ sub ordersearch { sub histsearch { my ($title,$author,$name,$from_placed_on,$to_placed_on)=@_; - my $dbh= C4::Context->dbh; - my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio"; - - $query .= ",borrowers " if (C4::Context->preference("IndependantBranches")); - $query .=" where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and biblio.biblionumber=aqorders.biblionumber "; - $query .= " and aqbasket.authorisedby=borrowers.borrowernumber" if (C4::Context->preference("IndependantBranches")); - $query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title; - $query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author; - $query .= " and name like ".$dbh->quote("%".$name."%") if $name; - $query .= " and creationdate >" .$dbh->quote($from_placed_on) if $from_placed_on; - $query .= " and creationdate<".$dbh->quote($to_placed_on) if $to_placed_on; - if (C4::Context->preference("IndependantBranches")) { - my $userenv = C4::Context->userenv; - unless ($userenv->{flags} == 1){ - $query .= " and (borrowers.branchcode = '".$userenv->{branch}."' or borrowers.branchcode ='')"; - } - } - warn "C4:Acquisition : ".$query; - my $sth = $dbh->prepare($query); - $sth->execute; my @order_loop; - my $cnt=1; - while (my $line = $sth->fetchrow_hashref) { - $line->{count}=$cnt++; - push @order_loop, $line; + my $total_qty=0; + my $total_price=0; + # don't run the query if there are no parameters (list would be too long for sure ! + if ($title || $author || $name || $from_placed_on || $to_placed_on) { + my $dbh= C4::Context->dbh; + my $query = "select biblio.title,biblio.author,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio"; + + $query .= ",borrowers " if (C4::Context->preference("IndependantBranches")); + $query .=" where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and biblio.biblionumber=aqorders.biblionumber "; + $query .= " and aqbasket.authorisedby=borrowers.borrowernumber" if (C4::Context->preference("IndependantBranches")); + $query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title; + $query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author; + $query .= " and name like ".$dbh->quote("%".$name."%") if $name; + $query .= " and creationdate >" .$dbh->quote($from_placed_on) if $from_placed_on; + $query .= " and creationdate<".$dbh->quote($to_placed_on) if $to_placed_on; + if (C4::Context->preference("IndependantBranches")) { + my $userenv = C4::Context->userenv; + if (($userenv) &&($userenv->{flags} != 1)){ + $query .= " and (borrowers.branchcode = '".$userenv->{branch}."' or borrowers.branchcode ='')"; + } + } + $query .=" order by booksellerid"; + my $sth = $dbh->prepare($query); + $sth->execute; + my $cnt=1; + while (my $line = $sth->fetchrow_hashref) { + $line->{count}=$cnt++; + $line->{toggle}=1 if $cnt %2; + push @order_loop, $line; + $line->{creationdate} = format_date($line->{creationdate}); + $line->{datereceived} = format_date($line->{datereceived}); + $total_qty += $line->{'quantity'}; + $total_price += $line->{'quantity'}*$line->{'ecost'}; + } } - return \@order_loop; + return \@order_loop,$total_qty,$total_price;; } # @@ -809,13 +819,13 @@ sub bookfunds { my $dbh = C4::Context->dbh; my $strsth; - if ($branch eq '') { + if ($branch) { $strsth="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid - =aqbudget.bookfundid + =aqbudget.bookfundid and (aqbookfund.branchcode is null or aqbookfund.branchcode='' or aqbookfund.branchcode= ? ) group by aqbookfund.bookfundid order by bookfundname"; } else { $strsth="Select * from aqbookfund,aqbudget where aqbookfund.bookfundid - =aqbudget.bookfundid and (aqbookfund.branchcode is null or aqbookfund.branchcode='' or aqbookfund.branchcode= ? ) + =aqbudget.bookfundid group by aqbookfund.bookfundid order by bookfundname"; } my $sth=$dbh->prepare($strsth); diff --git a/C4/Amazon.pm b/C4/Amazon.pm index 1ab08034aa..5071e0a2a9 100755 --- a/C4/Amazon.pm +++ b/C4/Amazon.pm @@ -70,8 +70,8 @@ my $url = "http://xml.amazon.com/onca/xml3?t=$dev_key&dev-t=$af_tag&type=heavy&f #Here's an example asin for the book "Cryptonomicon" #0596005423"; -use XML::Simple; -use LWP::Simple; +# use XML::Simple; +# use LWP::Simple; my $content = get($url); die "could not regrieve $url" unless $content; diff --git a/C4/Auth.pm b/C4/Auth.pm index 338df98045..b8aa3d0a43 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -146,53 +146,53 @@ sub get_template_and_user { $template->param(CAN_user_management => 1); $template->param(CAN_user_tools => 1); } - if ($flags && $flags->{circulate} == 1) { + if ($flags && $flags->{circulate} eq 1) { $template->param(CAN_user_circulate => 1); } - if ($flags && $flags->{catalogue} == 1) { + if ($flags && $flags->{catalogue} eq 1) { $template->param(CAN_user_catalogue => 1); } - if ($flags && $flags->{parameters} == 1) { + if ($flags && $flags->{parameters} eq 1) { $template->param(CAN_user_parameters => 1); $template->param(CAN_user_management => 1); $template->param(CAN_user_tools => 1); } - if ($flags && $flags->{borrowers} == 1) { + if ($flags && $flags->{borrowers} eq 1) { $template->param(CAN_user_borrowers => 1); } - if ($flags && $flags->{permissions} == 1) { + if ($flags && $flags->{permissions} eq 1) { $template->param(CAN_user_permission => 1); } - if ($flags && $flags->{reserveforothers} == 1) { + if ($flags && $flags->{reserveforothers} eq 1) { $template->param(CAN_user_reserveforothers => 1); } - if ($flags && $flags->{borrow} == 1) { + if ($flags && $flags->{borrow} eq 1) { $template->param(CAN_user_borrow => 1); } - if ($flags && $flags->{reserveforself} == 1) { + if ($flags && $flags->{reserveforself} eq 1) { $template->param(CAN_user_reserveforself => 1); } - if ($flags && $flags->{editcatalogue} == 1) { + if ($flags && $flags->{editcatalogue} eq 1) { $template->param(CAN_user_editcatalogue => 1); } - if ($flags && $flags->{updatecharges} == 1) { + if ($flags && $flags->{updatecharges} eq 1) { $template->param(CAN_user_updatecharge => 1); } - if ($flags && $flags->{acquisition} == 1) { + if ($flags && $flags->{acquisition} eq 1) { $template->param(CAN_user_acquisition => 1); } - if ($flags && $flags->{management} == 1) { + if ($flags && $flags->{management} eq 1) { $template->param(CAN_user_management => 1); $template->param(CAN_user_tools => 1); } - if ($flags && $flags->{tools} == 1) { + if ($flags && $flags->{tools} eq 1) { $template->param(CAN_user_tools => 1); } } @@ -285,7 +285,7 @@ sub checkauth { # state variables my $loggedin = 0; my %info; - my ($userid, $cookie, $sessionID, $flags, $envcookie); + my ($userid, $cookie, $sessionID, $flags,$envcookie); my $logout = $query->param('logout.x'); if ($userid = $ENV{'REMOTE_USER'}) { # Using Basic Authentication, no cookies required @@ -308,19 +308,20 @@ sub checkauth { ); } my ($ip , $lasttime); + ($userid, $ip, $lasttime) = $dbh->selectrow_array( "SELECT userid,ip,lasttime FROM sessions WHERE sessionid=?", undef, $sessionID); if ($logout) { - # voluntary logout the user - $dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID); - C4::Context->_unset_userenv($sessionID); - $sessionID = undef; - $userid = undef; - open L, ">>/tmp/sessionlog"; - my $time=localtime(time()); - printf L "%20s from %16s logged out at %30s (manually).\n", $userid, $ip, $time; - close L; + # voluntary logout the user + $dbh->do("DELETE FROM sessions WHERE sessionID=?", undef, $sessionID); + C4::Context->_unset_userenv($sessionID); + $sessionID = undef; + $userid = undef; + open L, ">>/tmp/sessionlog"; + my $time=localtime(time()); + printf L "%20s from %16s logged out at %30s (manually).\n", $userid, $ip, $time; + close L; } if ($userid) { if ($lasttimeparam('userid'); C4::Context->_new_userenv($sessionID); my $password=$query->param('password'); + C4::Context->_new_userenv($sessionID); my ($return, $cardnumber) = checkpw($dbh,$userid,$password); if ($return) { $dbh->do("DELETE FROM sessions WHERE sessionID=? AND userid=?", @@ -380,20 +382,29 @@ sub checkauth { $cookie=$query->cookie(-name => 'sessionID', -value => $sessionID, -expires => ''); - if ($flags = haspermission($dbh, $userid, $flagsrequired)) { $loggedin = 1; } else { $info{'nopermission'} = 1; - C4::Context->_unset_userenv($sessionID); + C4::Context->_unset_userenv($sessionID); } if ($return == 1){ - my $sth=$dbh->prepare( - "select cardnumber,borrowernumber,userid,firstname,surname,flags,branchcode,emailaddress - from borrowers where userid=?" - ); + my ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress); + my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where userid=?"); $sth->execute($userid); - my ($cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow; + ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows); +# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress"; + unless ($sth->rows){ + my $sth=$dbh->prepare("select borrowernumber,firstname,surname,flags,branchcode,emailaddress from borrowers where cardnumber=?"); + $sth->execute($cardnumber); + ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows); +# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress"; + unless ($sth->rows){ + $sth->execute($userid); + ($bornum,$firstname,$surname,$userflags,$branchcode,$emailaddress) = $sth->fetchrow if ($sth->rows); + } +# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress"; + } my $hash = C4::Context::set_userenv( $bornum, $userid, @@ -404,6 +415,7 @@ sub checkauth { $userflags, $emailaddress, ); +# warn "$cardnumber,$bornum,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress"; $envcookie=$query->cookie(-name => 'userenv', -value => $hash, -expires => ''); @@ -414,7 +426,7 @@ sub checkauth { C4::Context->config('user'), C4::Context->config('user'), C4::Context->config('user'), - "",1,'nobody@nowhere_koha.com' + "",1,C4::Context->preference('KohaAdminEmailAddress') ); $envcookie=$query->cookie(-name => 'userenv', -value => $hash, @@ -456,7 +468,7 @@ sub checkauth { $template->param(loginprompt => 1) unless $info{'nopermission'}; my $self_url = $query->url(-absolute => 1); - $template->param(url => $self_url, LibraryName=> C4::Context->preference("LibraryName"),); + $template->param(url => $self_url, LibraryName=> => C4::Context->preference("LibraryName"),); $template->param(\%info); $cookie=$query->cookie(-name => 'sessionID', -value => $sessionID, @@ -484,7 +496,7 @@ sub checkpw { return 1,$cardnumber; } } - my $sth=$dbh->prepare("select password from borrowers where cardnumber=?"); + $sth=$dbh->prepare("select password from borrowers where cardnumber=?"); $sth->execute($userid); if ($sth->rows) { my ($md5password) = $sth->fetchrow; @@ -513,12 +525,15 @@ sub getuserflags { my $sth=$dbh->prepare("SELECT flags FROM borrowers WHERE cardnumber=?"); $sth->execute($cardnumber); my ($flags) = $sth->fetchrow; + $flags=0 unless $flags; $sth=$dbh->prepare("SELECT bit, flag, defaulton FROM userflags"); $sth->execute; while (my ($bit, $flag, $defaulton) = $sth->fetchrow) { - if (($flags & (2**$bit)) || $defaulton) { - $userflags->{$flag}=1; - } + if (($flags & (2**$bit)) || $defaulton) { + $userflags->{$flag}=1; + } else { + $userflags->{$flag}=0; + } } return $userflags; } diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 2b42ca1830..d571a62f96 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -135,12 +135,13 @@ sub authoritysearch { while (my ($authid) = $sth->fetchrow) { push @result,$authid; } - # we have authid list. Now, loads summary from [offset] to [offset]+[length] - my $counter = $offset; +# my $counter = $offset; my @finalresult = (); my $oldline; - while (($counter <= $#result) && ($counter <= ($offset + $length))) { +# while (($counter <= $#result) && ($counter <= ($offset + $length))) { + # retrieve everything + for (my $counter=0;$counter <=$#result;$counter++) { # warn " HERE : $counter, $#result, $offset, $length"; # get MARC::Record of the authority my $record = AUTHgetauthority($dbh,$result[$counter]); @@ -158,7 +159,7 @@ sub authoritysearch { my $subfieldcode = $subf[$i][0]; my $subfieldvalue = $subf[$i][1]; my $tagsubf = $tag.$subfieldcode; - $summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue\[$1$tagsubf$2]$2/g; + $summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; } } } @@ -184,11 +185,18 @@ sub authoritysearch { $newline{biblio_fields} = $tags_using_authtype; $newline{even} = $counter % 2; $newline{mainentry} = $record->field($mainentrytag)->subfield('a')." ".$record->field($mainentrytag)->subfield('b') if $record->field($mainentrytag); - $counter++; push @finalresult, \%newline; } + # sort everything + my @finalresult3= sort {$a->{summary} cmp $b->{summary}} @finalresult; + # cut from $offset to $offset+$length; + my @finalresult2; + for (my $i=$offset;$i<=$offset+$length;$i++) { + push @finalresult2,$finalresult3[$i] if $finalresult3[$i]; + } my $nbresults = $#result + 1; - return (\@finalresult, $nbresults); + + return (\@finalresult2, $nbresults); } # Creates the SQL Request @@ -400,7 +408,6 @@ sub AUTHaddauthority { # pass the MARC::Record to this function, and it will create the records in the marc tables my ($dbh,$record,$authid,$authtypecode) = @_; my @fields=$record->fields(); -# warn "IN AUTHaddauthority $authid => ".$record->as_formatted; # adding main table, and retrieving authid # if authid is sent, then it's not a true add, it's only a re-add, after a delete (ie, a mod) # if authid empty => true add, find a new authid number @@ -428,15 +435,19 @@ sub AUTHaddauthority { ); } else { my @subfields=$field->subfields(); - foreach my $subfieldcount (0..$#subfields) { - &AUTHaddsubfield($dbh,$authid, - $field->tag(), - $field->indicator(1).$field->indicator(2), - $fieldcount, - $subfields[$subfieldcount][0], - $subfieldcount+1, - $subfields[$subfieldcount][1] - ); + my $subfieldorder; + foreach my $subfield (@subfields) { + foreach (split /\|/,@$subfield[1]) { + $subfieldorder++; + &AUTHaddsubfield($dbh,$authid, + $field->tag(), + $field->indicator(1).$field->indicator(2), + $fieldcount, + @$subfield[0], + $subfieldorder, + $_ + ); + } } } } @@ -458,6 +469,7 @@ sub AUTHaddsubfield { my @subfieldvalues = split /\|/,$subfieldvalues; foreach my $subfieldvalue (@subfieldvalues) { my $sth=$dbh->prepare("insert into auth_subfield_table (authid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values (?,?,?,?,?,?,?)"); +# warn "==> $authid,".(sprintf "%03s",$tagid).",TAG : $tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue"; $sth->execute($authid,(sprintf "%03s",$tagid),$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue); if ($sth->errstr) { warn "ERROR ==> insert into auth_subfield_table (authid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue) values ($authid,$tagid,$tagorder,$tag_indicator,$subfieldcode,$subfieldorder,$subfieldvalue)\n"; @@ -474,7 +486,7 @@ sub AUTHgetauthority { $record->leader(' '); my $sth=$dbh->prepare("select authid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue from auth_subfield_table - where authid=? order by tag,tagorder,subfieldcode + where authid=? order by tag,tagorder,subfieldorder "); $sth->execute($authid); my $prevtagorder=1; @@ -927,8 +939,15 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ -# Revision 1.20 2005/08/04 13:27:47 tipaul -# synch'ing 2.2 and head +# Revision 1.21 2005/10/26 09:12:33 tipaul +# big commit, still breaking things... +# +# * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. +# * code cleaning (cleaning warnings from perl -w) continued +# +# Revision 1.9.2.8 2005/10/25 12:38:59 tipaul +# * fixing bug in summary (separator before subfield was in fact after) +# * fixing bug in authority order : authorities are not ordered alphabetically instead of no order. Requires all the dataset to be retrieved, but the benefits is important ! # # Revision 1.9.2.7 2005/08/01 15:14:50 tipaul # minor change in summary handling (accepting 4 digits before the field) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index a3af5b98d1..9ceb656737 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -142,7 +142,7 @@ sub zebra_create { unless (opendir(DIR, "$cgidir")) { $cgidir = C4::Context->intranetdir."/"; } - + closedir DIR; my $filename = $cgidir."/zebra/biblios/BIBLIO".$biblionumber."iso2709"; open F,"> $filename"; print F $record->as_usmarc(); @@ -202,7 +202,7 @@ sub MARCgettagslib { while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) { $res->{$tag}->{lib} = ($forlibrarian or !$libopac)?$liblibrarian:$libopac; - $res->{$tab}->{tab} = ""; # XXX + $res->{$tag}->{tab} = ""; # XXX $res->{$tag}->{mandatory} = $mandatory; $res->{$tag}->{repeatable} = $repeatable; } @@ -376,7 +376,7 @@ sub MARCkoha2marcBiblio { foreach (keys %$biblio) { $bibliohash->{$_}=$biblio->{$_}; } - my $sth = $dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"); + $sth = $dbh->prepare("select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"); my $record = MARC::Record->new(); foreach ( keys %$bibliohash ) { &MARCkoha2marcOnefield( $sth, $record, "biblio." . $_, $bibliohash->{$_}, '') if $bibliohash->{$_}; @@ -548,17 +548,20 @@ sub MARCmarc2koha { $sth2->execute; my $field; while (($field)=$sth2->fetchrow) { +# warn "biblio.".$field; $result=&MARCmarc2kohaOneField($sth,"biblio",$field,$record,$result,$frameworkcode); } $sth2=$dbh->prepare("SHOW COLUMNS from biblioitems"); $sth2->execute; while (($field)=$sth2->fetchrow) { if ($field eq 'notes') { $field = 'bnotes'; } +# warn "biblioitems".$field; $result=&MARCmarc2kohaOneField($sth,"biblioitems",$field,$record,$result,$frameworkcode); } $sth2=$dbh->prepare("SHOW COLUMNS from items"); $sth2->execute; while (($field)=$sth2->fetchrow) { +# warn "items".$field; $result=&MARCmarc2kohaOneField($sth,"items",$field,$record,$result,$frameworkcode); } # additional authors : specific @@ -566,12 +569,14 @@ sub MARCmarc2koha { $result = &MARCmarc2kohaOneField($sth,"additionalauthors","additionalauthors",$record,$result,$frameworkcode); # modify copyrightdate to keep only the 1st year found my $temp = $result->{'copyrightdate'}; - $temp =~ m/c(\d\d\d\d)/; # search cYYYY first - if ($1>0) { - $result->{'copyrightdate'} = $1; - } else { # if no cYYYY, get the 1st date. - $temp =~ m/(\d\d\d\d)/; - $result->{'copyrightdate'} = $1; + if ($temp){ + $temp =~ m/c(\d\d\d\d)/; # search cYYYY first + if ($1>0) { + $result->{'copyrightdate'} = $1; + } else { # if no cYYYY, get the 1st date. + $temp =~ m/(\d\d\d\d)/; + $result->{'copyrightdate'} = $1; + } } # modify publicationyear to keep only the 1st year found $temp = $result->{'publicationyear'}; @@ -1000,7 +1005,7 @@ sub REALmodsubject { # my $dbh = C4Connect; my $count = @subject; - my $error; + my $error=""; for ( my $i = 0 ; $i < $count ; $i++ ) { $subject[$i] =~ s/^ //g; $subject[$i] =~ s/ $//g; @@ -1042,7 +1047,7 @@ sub REALmodsubject { } # else $sth->finish; } # else - if ( $error eq '' ) { + if ($error eq '') { my $sth = $dbh->prepare("Delete from bibliosubject where biblionumber = ?"); $sth->execute($bibnum); @@ -2876,6 +2881,12 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.132 2005/10/26 09:12:33 tipaul +# big commit, still breaking things... +# +# * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. +# * code cleaning (cleaning warnings from perl -w) continued +# # Revision 1.131 2005/09/22 10:01:45 tipaul # see mail on koha-devel : code cleaning on Search.pm + normalizing API + use of biblionumber everywhere (instead of bn, biblio, ...) # diff --git a/C4/Bull.pm b/C4/Bull.pm index ccca9f8e18..6bf871c378 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -186,6 +186,7 @@ sub get_subscription_list_from_biblionumber { $subs->{missinglist} =~ s/\n/\/g; $subs->{recievedlist} =~ s/\n/\/g; $subs->{"periodicity".$subs->{periodicity}} = 1; + $subs->{"status".$subs->{'status'}} = 1; if ($subs->{enddate} eq '0000-00-00') { $subs->{enddate}=''; } else { @@ -199,7 +200,7 @@ sub get_subscription_list_from_biblionumber { sub get_full_subscription_list_from_biblionumber { my ($biblionumber) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select serial.serialseq, serial.planneddate, serial.status, year(serial.planneddate) as year,subscription.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + my $sth = $dbh->prepare('select serial.serialseq, serial.planneddate, serial.status, serial.notes, year(serial.planneddate) as year, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle from serial left join subscription on (serial.subscriptionid=subscription.subscriptionid and subscription.biblionumber=serial.biblionumber) left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid left join aqbooksellers on subscription.aqbooksellerid=aqbooksellers.id @@ -227,10 +228,7 @@ sub get_full_subscription_list_from_biblionumber { push @$temp, {'planneddate' => format_date($subs->{'planneddate'}), 'serialseq' => $subs->{'serialseq'}, - 'status1' => $subs->{'status'}==1, - 'status2' => $subs->{'status'}==2, - 'status3' => $subs->{'status'}==3, - 'status4' => $subs->{'status'}==4, + "status".$subs->{'status'} => 1, 'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes}, }; }else { @@ -243,10 +241,7 @@ sub get_full_subscription_list_from_biblionumber { push @temp, {'planneddate' => format_date($subs->{'planneddate'}), 'serialseq' => $subs->{'serialseq'}, - 'status1' => $subs->{'status'}==1, - 'status2' => $subs->{'status'}==2, - 'status3' => $subs->{'status'}==3, - 'status4' => $subs->{'status'}==4, + "status".$subs->{'status'} => 1, 'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes}, }; @@ -291,15 +286,11 @@ sub modsubscription { sub delsubscription { my ($subscriptionid) = @_; - # check again there is only one issue (the subscription is new) - my ($totalissues) = getserials($subscriptionid); - if ($totalissues eq 1) { - my $dbh = C4::Context->dbh; - $subscriptionid=$dbh->quote($subscriptionid); - $dbh->do("delete from subscription where subscriptionid=$subscriptionid"); - $dbh->do("delete from subscriptionhistory where subscriptionid=$subscriptionid"); - $dbh->do("delete from serial where subscriptionid=$subscriptionid"); - } + my $dbh = C4::Context->dbh; + $subscriptionid=$dbh->quote($subscriptionid); + $dbh->do("delete from subscription where subscriptionid=$subscriptionid"); + $dbh->do("delete from subscriptionhistory where subscriptionid=$subscriptionid"); + $dbh->do("delete from serial where subscriptionid=$subscriptionid"); } sub getsubscriptions { my ($title,$ISSN,$biblionumber) = @_; @@ -360,8 +351,7 @@ sub getserials { my ($subscriptionid) = @_; my $dbh = C4::Context->dbh; # status = 2 is "arrived" - my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate, notes from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5"); - + my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate,notes from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5"); $sth->execute($subscriptionid); my @serials; while(my $line = $sth->fetchrow_hashref) { @@ -396,7 +386,8 @@ sub getlatestserials{ } sub serialchangestatus { - my ($serialid,$serialseq,$planneddate,$status,$note)=@_; + my ($serialid,$serialseq,$planneddate,$status,$notes)=@_; +# warn "($serialid,$serialseq,$planneddate,$status)"; # 1st, get previous status : if we change from "waited" to something else, then we will have to create a new "waited" entry my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?"); @@ -406,8 +397,8 @@ sub serialchangestatus { if ($status eq 6){ delissue($serialseq, $subscriptionid) }else{ - $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=?, notes=? where serialid = ?"); - $sth->execute($serialseq,$planneddate,$status,$note,$serialid); + $sth = $dbh->prepare("update serial set serialseq=?,planneddate=?,status=?,notes=? where serialid = ?"); + $sth->execute($serialseq,$planneddate,$status,$notes,$serialid); $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); $sth->execute($subscriptionid); my ($missinglist,$recievedlist) = $sth->fetchrow; @@ -420,24 +411,20 @@ sub serialchangestatus { $sth->execute($recievedlist,$missinglist,$subscriptionid); } # create new waited entry if needed (ie : was a "waited" and has changed) - $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); - $sth->execute($subscriptionid); - my $subscription = $sth->fetchrow_hashref; if ($oldstatus eq 1 && $status ne 1) { + $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); + $sth->execute($subscriptionid); + my $val = $sth->fetchrow_hashref; # next issue number - my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($subscription); + my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val); # next date (calculated from actual date & frequency parameters) - my $nextplanneddate = Get_Next_Date($planneddate,$subscription); - newissue($newserialseq, $subscriptionid, $subscription->{'biblionumber'}, 1, $nextplanneddate); + my $nextplanneddate = Get_Next_Date($planneddate,$val); + newissue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate); $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?, innerloop1=?,innerloop2=?,innerloop3=? where subscriptionid = ?"); $sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid); } - # check if an alert must be sent... (= a letter is defined & status became "arrived" - if ($subscription->{letter} && $status eq 2) { - sendalerts('issue',$subscription->{subscriptionid},$subscription->{letter}); - } } sub newissue { diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index 6e1feb17ad..069d5708da 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -34,7 +34,7 @@ use C4::Context; use C4::Stats; use C4::Reserves2; use C4::Koha; -use C4::Accounts; +use C4::Accounts2; use Date::Manip; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -618,7 +618,8 @@ sub TooMany ($$){ $sth->execute($iteminformation->{'biblionumber'}); my $type = $sth->fetchrow; $sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?'); - my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?"); +# my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?"); + my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s1, items s2 where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s2.itemnumber and s1.itemtype like ? and s1.biblioitemnumber = s2.biblioitemnumber"); my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null'); my $alreadyissued; # check the 3 parameters @@ -632,7 +633,7 @@ sub TooMany ($$){ } # check for branch=* $sth->execute($cat_borrower, $type, ""); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth2->execute($borrower->{'borrowernumber'}, "%$type%"); my $alreadyissued = $sth2->fetchrow; @@ -640,7 +641,7 @@ sub TooMany ($$){ } # check for itemtype=* $sth->execute($cat_borrower, "*", $branch_borrower); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth3->execute($borrower->{'borrowernumber'}); my ($alreadyissued) = $sth3->fetchrow; @@ -649,7 +650,7 @@ sub TooMany ($$){ } #check for borrowertype=* $sth->execute("*", $type, $branch_borrower); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth2->execute($borrower->{'borrowernumber'}, "%$type%"); my $alreadyissued = $sth2->fetchrow; @@ -657,7 +658,7 @@ sub TooMany ($$){ } $sth->execute("*", "*", $branch_borrower); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth3->execute($borrower->{'borrowernumber'}); my $alreadyissued = $sth3->fetchrow; @@ -665,7 +666,7 @@ sub TooMany ($$){ } $sth->execute("*", $type, ""); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result) && $result->{maxissueqty}>=0) { $sth2->execute($borrower->{'borrowernumber'}, "%$type%"); my $alreadyissued = $sth2->fetchrow; @@ -673,7 +674,7 @@ sub TooMany ($$){ } $sth->execute($cat_borrower, "*", ""); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth2->execute($borrower->{'borrowernumber'}, "%$type%"); my $alreadyissued = $sth2->fetchrow; @@ -681,7 +682,7 @@ sub TooMany ($$){ } $sth->execute("*", "*", ""); - my $result = $sth->fetchrow_hashref; + $result = $sth->fetchrow_hashref; if (defined($result)) { $sth3->execute($borrower->{'borrowernumber'}); my $alreadyissued = $sth3->fetchrow; @@ -937,31 +938,31 @@ sub getLoanLength { return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute($borrowertype,$itemtype,""); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute($borrowertype,"*",$branchcode); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute("*",$itemtype,$branchcode); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute($borrowertype,"*",""); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute("*","*",$branchcode); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute("*",$itemtype,""); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; $sth->execute("*","*",""); - my $loanlength = $sth->fetchrow_hashref; + $loanlength = $sth->fetchrow_hashref; return $loanlength->{issuelength} if defined($loanlength) && $loanlength->{issuelength} ne 'NULL'; # if no rule is set => 21 days (hardcoded) @@ -1649,7 +1650,7 @@ sub renewstatus { if ($resfound) { $renewokay = 0; } - my ($resfound, $resrec) = CheckReserves($itemno); + ($resfound, $resrec) = CheckReserves($itemno); if ($resfound) { $renewokay = 0; } @@ -1792,19 +1793,6 @@ EOT } -sub getnextacctno { -# Stolen from Accounts.pm - my ($env,$bornumber,$dbh)=@_; - my $nextaccntno = 1; - my $sth = $dbh->prepare("select * from accountlines where (borrowernumber = ?) order by accountno desc"); - $sth->execute($bornumber); - if (my $accdata=$sth->fetchrow_hashref){ - $nextaccntno = $accdata->{'accountno'} + 1; - } - $sth->finish; - return($nextaccntno); -} - =item find_reserves ($status, $record) = &find_reserves($itemnumber); diff --git a/C4/Circulation/Fines.pm b/C4/Circulation/Fines.pm index 8ff1a96ceb..dac6d92963 100644 --- a/C4/Circulation/Fines.pm +++ b/C4/Circulation/Fines.pm @@ -147,7 +147,7 @@ sub CalcFine { # firstremind, chargeperiod, accountsent, and chargename from the # categoryitem table. - my $sth=$dbh->prepare("Select * from items,biblioitems,itemtypes,categoryitem where items.itemnumber=? + my $sth=$dbh->prepare("Select * from items,biblioitems,itemtypes,issuingrules where items.itemnumber=? and items.biblioitemnumber=biblioitems.biblioitemnumber and biblioitems.itemtype=itemtypes.itemtype and categoryitem.itemtype=itemtypes.itemtype and diff --git a/C4/Circulation/Returns.pm b/C4/Circulation/Returns.pm index ccb139d1a2..44712a4f5d 100755 --- a/C4/Circulation/Returns.pm +++ b/C4/Circulation/Returns.pm @@ -31,7 +31,7 @@ use strict; require Exporter; use DBI; use C4::Context; -use C4::Accounts; +use C4::Accounts2; use C4::InterfaceCDK; use C4::Circulation::Main; # FIXME - C4::Circulation::Main and C4::Circulation::Returns diff --git a/C4/Context.pm b/C4/Context.pm index 3fc51f6047..f270d2655f 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -600,21 +600,6 @@ sub _new_stopwords return $stopwordlist; } -=item userenv - - %userenv = C4::Context->userenv; - -Returns a hash with userenvironment variables. - -This hash is cached for future use: if you call -Cuserenv> twice, you will get the same hash without real DB access - -Returns Null if userenv is not set. -userenv is set in _new_userenv, called in Auth.pm - -=cut -#' - =item userenv C4::Context->userenv; @@ -632,14 +617,15 @@ sub userenv { my $var = $context->{"activeuser"}; return $context->{"userenv"}->{$var} if (defined $context->{"userenv"}->{$var}); + return 0; warn "NO CONTEXT for $var"; } -=item userenv +=item set_userenv - C4::Context->set_userenv; + C4::Context->set_userenv($usernum, $userid, $usercnum, $userfirstname, $usersurname, $userbranch, $userflags, $emailaddress); -Builds a hash for user environment variables. +Informs a hash for user environment variables. This hash shall be cached for future use: if you call Cuserenv> twice, you will get the same hash without real DB access @@ -655,8 +641,9 @@ sub set_userenv{ "number" => $usernum, "id" => $userid, "cardnumber" => $usercnum, - "firstname" => $userfirstname, - "surname" => $usersurname, +# "firstname" => $userfirstname, +# "surname" => $usersurname, +#possibly a law problem "branch" => $userbranch, "flags" => $userflags, "emailaddress" => $emailaddress, @@ -697,12 +684,11 @@ Destroys the hash for activeuser user environment variables. sub _unset_userenv { my ($sessionID)= @_; -# undef $context->{$sessionID}; undef $context->{"activeuser"} if ($context->{"activeuser"} eq $sessionID); -# $context->{"activeuser"}--; } + 1; __END__ diff --git a/C4/Koha.pm b/C4/Koha.pm index 3dbef30d5e..9da807075c 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -491,7 +491,7 @@ sub getbranchname sub getprinter ($$) { my($query, $printers) = @_; # get printer for this query from printers my $printer = $query->param('printer'); - ($printer) || ($printer = $query->cookie('printer')); + ($printer) || ($printer = $query->cookie('printer')) || ($printer=''); ($printers->{$printer}) || ($printer = (keys %$printers)[0]); return $printer; } @@ -567,7 +567,7 @@ sub getalllanguages { $lang->{$language}=1; } } - my $htdocs=C4::Context->config('opachtdocs'); + $htdocs=C4::Context->config('opachtdocs'); foreach my $theme (getallthemes('opac')) { opendir D, "$htdocs/$theme"; foreach my $language (readdir D) { diff --git a/C4/Members.pm b/C4/Members.pm index 1d749126e4..21c0acb8b2 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -375,43 +375,53 @@ sub fixup_cardnumber ($) { # automatically. Should be either "1" or something else. # Defaults to "0", which is interpreted as "no". - if ($cardnumber !~ /\S/ && $autonumber_members) { - my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select max(substring(borrowers.cardnumber,2,7)) from borrowers"); - $sth->execute; - - my $data=$sth->fetchrow_hashref; - $cardnumber=$data->{'max(substring(borrowers.cardnumber,2,7))'}; - $sth->finish; - - # purpose: generate checksum'd member numbers. - # We'll assume we just got the max value of digits 2-8 of member #'s - # from the database and our job is to increment that by one, - # determine the 1st and 9th digits and return the full string. - - if (! $cardnumber) { # If DB has no values, - $cardnumber = 1000000; # start at 1000000 - } else { - $cardnumber += 1; - } - - my $sum = 0; - for (my $i = 0; $i < 8; $i += 1) { - # read weightings, left to right, 1 char at a time - my $temp1 = $weightings[$i]; - - # sequence left to right, 1 char at a time - my $temp2 = substr($cardnumber,$i,1); - - # mult each char 1-7 by its corresponding weighting - $sum += $temp1 * $temp2; +# if ($cardnumber !~ /\S/ && $autonumber_members) { + if ($autonumber_members) { + my $dbh = C4::Context->dbh; + if (C4::Context->preference('checkdigit') eq 'katipo') { + # if checkdigit is selected, calculate katipo-style cardnumber. + # otherwise, just use the max() + # purpose: generate checksum'd member numbers. + # We'll assume we just got the max value of digits 2-8 of member #'s + # from the database and our job is to increment that by one, + # determine the 1st and 9th digits and return the full string. + my $sth=$dbh->prepare("select max(substring(borrowers.cardnumber,2,7)) from borrowers"); + $sth->execute; + + my $data=$sth->fetchrow_hashref; + $cardnumber=$data->{'max(substring(borrowers.cardnumber,2,7))'}; + $sth->finish; + if (! $cardnumber) { # If DB has no values, + $cardnumber = 1000000; # start at 1000000 + } else { + $cardnumber += 1; + } + + my $sum = 0; + for (my $i = 0; $i < 8; $i += 1) { + # read weightings, left to right, 1 char at a time + my $temp1 = $weightings[$i]; + + # sequence left to right, 1 char at a time + my $temp2 = substr($cardnumber,$i,1); + + # mult each char 1-7 by its corresponding weighting + $sum += $temp1 * $temp2; + } + + my $rem = ($sum%11); + $rem = 'X' if $rem == 10; + + $cardnumber="V$cardnumber$rem"; + } else { + my $sth=$dbh->prepare("select max(borrowers.cardnumber) from borrowers"); + $sth->execute; + + my ($result)=$sth->fetchrow; + $sth->finish; + $cardnumber=$result+1; + } } - - my $rem = ($sum%11); - $rem = 'X' if $rem == 10; - - $cardnumber="V$cardnumber$rem"; - } return $cardnumber; } diff --git a/C4/Reserves2.pm b/C4/Reserves2.pm index 4ed9829f12..054ddb212e 100755 --- a/C4/Reserves2.pm +++ b/C4/Reserves2.pm @@ -312,7 +312,7 @@ sub CancelReserve { $sth->finish; # update the database, removing the record... - my $sth = $dbh->prepare("update reserves set cancellationdate = now(), + $sth = $dbh->prepare("update reserves set cancellationdate = now(), found = Null, priority = 0 where biblionumber = ? diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index f06140c253..64758bc70a 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -161,7 +161,12 @@ String... so ',items,issues,reserves' allows the items, issues and reserves tabl returns an array containing hashes. The hash contains all biblio & biblioitems fields and a reference to an item hash. The "item hash contains one line for each callnumber & the number of items related to the callnumber. =cut +=head2 my $marcurlsarray = &getMARCurls($dbh,$bibid,$marcflavour); +Returns a reference to an array containing all the URLS stored in the MARC database for the given bibid. +$marcflavour ("MARC21" or "UNIMARC") isn't used in this version because both flavours of MARC use the same subfield for URLS (but eventually when we get the lables working we'll need to change this. + +=cut sub catalogsearch { my ($dbh, $tags, $and_or, $excluding, $operator, $value, $offset,$length,$orderby,$desc_or_asc,$sqlstring, $extratables) = @_; @@ -413,26 +418,44 @@ sub getMARCsubjects { $maxtag = "699"; } else { # assume unimarc if not marc21 $mintag = "600"; - $maxtag = "619"; + $maxtag = "699"; } - my $sth=$dbh->prepare("SELECT subfieldvalue,subfieldcode FROM marc_subfield_table WHERE bibid=? AND tag BETWEEN ? AND ? ORDER BY tagorder"); + my $sth=$dbh->prepare("SELECT subfieldvalue,subfieldcode,tagorder,tag FROM marc_subfield_table WHERE bibid=? AND tag BETWEEN ? AND ? ORDER BY tagorder,subfieldorder"); $sth->execute($bibid,$mintag,$maxtag); my @marcsubjcts; - my $subjct = ""; - my $subfield = ""; + my $subject = ""; my $marcsubjct; - - while (my $data=$sth->fetchrow_arrayref) { - my $value = $data->[0]; - my $subfield = $data->[1]; - if ($subfield eq "a" && $value ne $subjct) { - $marcsubjct = {MARCSUBJCT => $value,}; + my $field9; + my $activetagorder=0; + my $lasttag; + my ($subfieldvalue,$subfieldcode,$tagorder,$tag); + while (($subfieldvalue,$subfieldcode,$tagorder,$tag)=$sth->fetchrow) { + $lasttag=$tag if $tag; + if ($activetagorder && $tagorder != $activetagorder) { + $subject=~ s/ -- $//; + $marcsubjct = {MARCSUBJCT => $subject, + link => $tag."9", + linkvalue => $field9, + }; push @marcsubjcts, $marcsubjct; - $subjct = $value; + $subject=''; + $tag=''; + $field9=''; + } + if ($subfieldcode eq 9) { + $field9=$subfieldvalue; + } else { + $subject .= $subfieldvalue." -- "; } + $activetagorder=$tagorder; } + $marcsubjct = {MARCSUBJCT => $subject, + link => $lasttag."9", + linkvalue => $field9, + }; + push @marcsubjcts, $marcsubjct; $sth->finish; diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl index bebc5ae1a1..eef321f6df 100755 --- a/acqui.simple/addbiblio.pl +++ b/acqui.simple/addbiblio.pl @@ -173,6 +173,7 @@ sub create_input () { $subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; $subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{kohafield}; + $subfield_data{index} = $i; # it's an authorised field if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { $subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth); @@ -277,7 +278,7 @@ sub build_tabs ($$$$) { push (@loop_data, \%tag_data); } # If there is more than 1 field, add an empty hidden field as separator. - if ($#fields >1) { + if ($#fields >=1 && $#loop_data >=0 && $loop_data[$#loop_data]->{'tag'} eq $tag) { my @subfields_data; my %tag_data; push(@subfields_data, &create_input('','','',$i,$tabloop,$record,$authorised_values_sth)); @@ -353,6 +354,7 @@ my $z3950 = $input->param('z3950'); my $op = $input->param('op'); my $frameworkcode = $input->param('frameworkcode'); my $dbh = C4::Context->dbh; +my $bibid; $frameworkcode = &MARCfind_frameworkcode($dbh,$biblionumber) if ($biblionumber and not ($frameworkcode)); @@ -430,9 +432,8 @@ if ($op eq "addbiblio") { if (!$duplicatebiblionumber or $confirm_not_duplicate) { # MARC::Record built => now, record in DB if ($is_a_modif) { - NEWmodbiblioframework($dbh,$biblionumber,$frameworkcode); - NEWmodbiblio($dbh,$record,$biblionumber,$frameworkcode); - logaction($loggedinuser,"acqui.simple","modify",$biblionumber,"record : ".$record->as_formatted) if (C4::Context->preference("Activate_Log")); + NEWmodbiblioframework($dbh,$bibid,$frameworkcode); + NEWmodbiblio($dbh,$record,$bibid,$frameworkcode); } else { my $biblioitemnumber; ($biblionumber,$biblioitemnumber) = NEWnewbiblio($dbh,$record,$frameworkcode); @@ -514,6 +515,7 @@ if ($op eq "addbiblio") { } $template->param( frameworkcode => $frameworkcode, - itemtype => $frameworkcode # HINT: if the library has itemtype = framework, itemtype is auto filled ! + itemtype => $frameworkcode, # HINT: if the library has itemtype = framework, itemtype is auto filled ! + hide_marc => C4::Context->preference('hide_marc'), ); output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file diff --git a/acqui.simple/additem-nomarc.pl b/acqui.simple/additem-nomarc.pl index e9ede8d5ca..867e3410a8 100755 --- a/acqui.simple/additem-nomarc.pl +++ b/acqui.simple/additem-nomarc.pl @@ -20,12 +20,11 @@ # Suite 330, Boston, MA 02111-1307 USA # $Log$ -# Revision 1.7 2005/09/02 14:46:40 tipaul -# * road to zebra for MARC=OFF -# * removing Acquisitions/branches.pm call, as it's now in Koha.pm +# Revision 1.8 2005/10/26 09:11:34 tipaul +# big commit, still breaking things... # -# Revision 1.6 2005/08/04 12:12:13 tipaul -# synch'ing 2.2 and head +# * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. +# * code cleaning (cleaning warnings from perl -w) continued # # Revision 1.4.2.1 2005/03/25 12:52:44 tipaul # needs "editcatalogue" flag, not "catalogue" @@ -133,7 +132,76 @@ else { branchloop => \@branchloop, itemtypeloop => \@itemtypeloop, - ); + ( $bibliocount, @biblios ) = &getbiblio($biblionumber); + + if ( !$bibliocount ) { + print $input->redirect('addbooks.pl'); + } + else { + + ( $biblioitemcount, @biblioitems ) = + &getbiblioitembybiblionumber($biblionumber); + ( $branchcount, @branches ) = &branches; + ( $itemtypecount, @itemtypes ) = &getitemtypes; + + for ( my $i = 0 ; $i < $itemtypecount ; $i++ ) { + $itemtypedescriptions{ $itemtypes[$i]->{'itemtype'} } = + $itemtypes[$i]->{'description'}; + } # for + + for ( my $i = 0 ; $i < $branchcount ; $i++ ) { + $branchnames{ $branches[$i]->{'branchcode'} } = + $branches[$i]->{'branchname'}; + } # for + + # print $input->header; + # print startpage(); + # print startmenu('acquisitions'); + my $input = new CGI; + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "acqui.simple/additem-nomarc.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { editcatalogue => 1 }, + debug => 1, + } + ); + + if ( $error eq "nobarcode" ) { + $template->param( NOBARCODE => 1 ); + } + elsif ( $error eq "nobiblioitem" ) { + $template->param( NOBIBLIOITEM => 1 ); + } + elsif ( $error eq "barcodeinuse" ) { + $template->param( BARCODEINUSE => 1 ); + } # elsif + + for ( my $i = 0 ; $i < $biblioitemcount ; $i++ ) { + if ( $biblioitems[$i]->{'itemtype'} eq "WEB" ) { + $biblioitems[$i]->{'WEB'} = 1; + + } + $biblioitems[$i]->{'dewey'} =~ /(\d*\.\d\d)/; + $biblioitems[$i]->{'dewey'} = $1; + ( $itemcount, @items ) = + &getitemsbybiblioitem( $biblioitems[$i]->{'biblioitemnumber'} ); + $biblioitems[$i]->{'items'} = \@items; + } # for + $template->param( + BIBNUM => $biblionumber, + AUTHOR => $biblios[0]->{'author'}, + TITLE => $biblios[0]->{'title'}, + COPYRIGHT => $biblios[0]->{'copyrightdate'}, + SERIES => $biblios[0]->{'seriestitle'}, + NOTES => $biblios[0]->{'notes'}, + BIBITEMS => \@biblioitems, + BRANCHES => \@branches, + ITEMTYPES => \@itemtypes, + + ); output_html_with_http_headers $input, $cookie, $template->output; } # if diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl index 6310f57e4d..e93cd6edcd 100755 --- a/acqui.simple/additem.pl +++ b/acqui.simple/additem.pl @@ -58,7 +58,9 @@ my $op = $input->param('op'); my $itemtype = &MARCfind_frameworkcode($dbh,$biblionumber); my $tagslib = &MARCgettagslib($dbh,1,$itemtype); - +my $record = MARCgetbiblio($dbh,$bibid); +# warn "==>".$record->as_formatted; +my $oldrecord = MARCmarc2koha($dbh,$record); my $itemrecord; my $nextop="additem"; my @errors; # store errors found while checking data BEFORE saving item. @@ -76,7 +78,22 @@ if ($op eq "additem") { for (my $i=0;$i<=$#ind_tag;$i++) { $indicators{$ind_tag[$i]} = $indicator[$i]; } - my $addeditem = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); + my $record = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); + # if autoBarcode is ON, calculate barcode... + if (C4::Context->preference('autoBarcode')) { + my ($tagfield,$tagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.barcode"); + unless ($record->field($tagfield)->subfield($tagsubfield)) { + my $sth_barcode = $dbh->prepare("select max(abs(barcode)) from items"); + $sth_barcode->execute; + my ($newbarcode) = $sth_barcode->fetchrow; + $newbarcode++; + # OK, we have the new barcode, now create the entry in MARC record + my $fieldItem = $record->field($tagfield); + $record->delete_field($fieldItem); + $fieldItem->add_subfields($tagsubfield => $newbarcode); + $record->insert_fields_ordered($fieldItem); + } + } # check for item barcode # being unique my $addedolditem = MARCmarc2koha($dbh,$addeditem); my $exists = get_item_from_barcode($addedolditem->{'barcode'}); @@ -113,9 +130,9 @@ if ($op eq "additem") { } my $itemrecord = MARChtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); # MARC::Record builded => now, record in DB -# warn "ITEM TO MODIFY : ".$itemrecord->as_formatted; - NEWmoditem($dbh, $itemrecord, $biblionumber, $biblioitemnumber, $itemnumber,0); - $itemnumber=""; +# warn "R: ".$record->as_formatted; + my ($oldbiblionumber,$oldbibnum,$oldbibitemnum) = NEWmoditem($dbh,$record,$bibid,$itemnum,0); + $itemnum=""; $nextop="additem"; } @@ -132,22 +149,18 @@ my ($template, $loggedinuser, $cookie) debug => 1, }); -# load the biblio to have the title, the biblioitemnumber & any other useful field -my $record = MARCgetbiblio($dbh,$biblionumber); -# warn $record ->as_formatted; -# warn "REC ".$record->as_formatted; -my $oldrecord = MARCmarc2koha($dbh,$record); - my %indicators; $indicators{995}=' '; # now, build existiing item list -my @fields = $record->fields(); +my $temp = MARCgetbiblio($dbh,$bibid); +my @fields = $temp->fields(); +#my @fields = $record->fields(); my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code my @big_array; #---- finds where items.itemnumber is stored my ($itemtagfield,$itemtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.itemnumber",$itemtype); my ($branchtagfield,$branchtagsubfield) = &MARCfind_marc_from_kohafield($dbh,"items.homebranch",$itemtype); -my @itemnums; # array to store itemnums + foreach my $field (@fields) { next if ($field->tag()<10); my @subf=$field->subfields; @@ -160,14 +173,11 @@ foreach my $field (@fields) { 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){ - if (not ($userenv->{'branch'} eq $subf[$i][1])) { + unless (($userenv->{'flags'} == 1) or (($userenv->{'branch'} eq $subf[$i][1]))){ $this_row{'nomod'}=1; - warn "nomod" - } } } - push @itemnums,$this_row{$subf[$i][0]} =$subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield); + $this_row{itemnum} = $subf[$i][1] if ($field->tag() eq $itemtagfield && $subf[$i][0] eq $itemtagsubfield); } if (%this_row) { push(@big_array, \%this_row); @@ -179,6 +189,9 @@ foreach my $subfield_code (keys(%witness)) { $big_array[$i]{$subfield_code}=" " unless ($big_array[$i]{$subfield_code}); } } +my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$itemtype); +@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array; + # now, construct template ! my @item_value_loop; my @header_value_loop; @@ -189,7 +202,7 @@ for (my $i=0;$i<=$#big_array; $i++) { } my %row_data; $row_data{item_value} = $items_data; - $row_data{itemnumber} = $itemnums[$i]; + $row_data{itemnum} = $big_array[$i]->{itemnum}; #reporting this_row values $row_data{'nomod'} = $big_array[$i]{'nomod'}; push(@item_value_loop,\%row_data); @@ -220,13 +233,11 @@ foreach my $tag (sort keys %{$tagslib}) { $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; my ($x,$value); ($x,$value) = find_value($tag,$subfield,$itemrecord) if ($itemrecord); - #testing branch value if IndependantBranches. my $test = (C4::Context->preference("IndependantBranches")) && - ($tag==$branchtagfield) && ($subfield==$branchtagsubfield) && - (C4::Context->userenv->{flags} != 1) && ($value != C4::Context->userenv->{branch}) ; - print $input->redirect("additem.pl?biblionumber=$biblionumber") if ($test); - + ($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')) { my $CNtag = substr(C4::Context->preference('itemcallnumber'),0,3); @@ -301,20 +312,12 @@ foreach my $tag (sort keys %{$tagslib}) { $i++ } } -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, - }); # what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit. $template->param(item_loop => \@item_value_loop, item_header_loop => \@header_value_loop, - biblionumber =>$biblionumber, - biblioitemnumber => $oldrecord->{biblioitemnumber}, + bibid => $bibid, + biblionumber =>$oldbiblionumber, title => $oldrecord->{title}, author => $oldrecord->{author}, item => \@loop_data, diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 438c721371..21241e0585 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -49,7 +49,8 @@ for (my $i=0;$i<$count;$i++){ $totavail+=$avail; } #currencies -my ($count,$rates)=getcurrencies(); +my $rates; +($count,$rates)=getcurrencies(); my @loop_currency = (); for (my $i=0;$i<$count;$i++){ my %line; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index 75e910842d..6c47ad832a 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -24,8 +24,10 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {acquisition => 1}, debug => 1, }); -my $order_loop= &histsearch($title,$author,$name,$from_placed_on,$to_placed_on); +my ($order_loop,$total_qty,$total_price)= &histsearch($title,$author,$name,$from_placed_on,$to_placed_on); $template->param(suggestions_loop => $order_loop, + total_qty => $total_qty, + total_price => sprintf ("%.2f",$total_price), numresults => scalar(@$order_loop), title => $title, author => $author, diff --git a/acqui/newbiblio.pl b/acqui/newbiblio.pl index f40e615212..8343d75f59 100755 --- a/acqui/newbiblio.pl +++ b/acqui/newbiblio.pl @@ -177,9 +177,9 @@ $template->param( existing => $biblio, listincgst => $booksellers[0]->{'listincgst'}, listprice => $booksellers[0]->{'listprice'}, gstreg => $booksellers[0]->{'gstreg'}, - invoiceinc => $booksellers[0]->{'invoiceincgst'}, - invoicedisc => $booksellers[0]->{'invoicedisc'}, - nocalc => $booksellers[0]->{'nocalc'}, + invoiceinc => $booksellers[0]->{'invoiceincgst'}, + invoicedisc => $booksellers[0]->{'invoicedisc'}, + nocalc => $booksellers[0]->{'nocalc'}, name => $booksellers[0]->{'name'}, currency => $booksellers[0]->{'listprice'}, gstrate => C4::Context->preference("gist") , diff --git a/admin/aqbookfund.pl b/admin/aqbookfund.pl index 8e876c6bdc..ad9734c3ad 100755 --- a/admin/aqbookfund.pl +++ b/admin/aqbookfund.pl @@ -40,6 +40,7 @@ use strict; use CGI; use C4::Auth; +use C4::Koha; use C4::Context; use C4::Acquisition; use C4::Output; @@ -49,21 +50,21 @@ use C4::Date; use HTML::Template; sub StringSearch { - my ($env,$searchstring,%branches)=@_; + my ($env,$searchstring,$branches)=@_; my $dbh = C4::Context->dbh; $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); my $count=@data; my $strsth= "select bookfundid,bookfundname,bookfundgroup,branchcode from aqbookfund where bookfundname like ? "; - if (%branches){ + if ($branches){ $strsth.= "AND (aqbookfund.branchcode is null " ; - foreach my $branchcode (keys %branches){ + foreach my $branchcode (keys %$branches){ $strsth .= "or aqbookfund.branchcode = '".$branchcode."' "; } $strsth .= ") "; } $strsth.= "order by aqbookfund.bookfundid"; - warn "chaine de recherche : ".$strsth; +# warn "chaine de recherche : ".$strsth; my $sth=$dbh->prepare($strsth); $sth->execute("%$data[0]%"); @@ -78,12 +79,12 @@ sub StringSearch { my $dbh = C4::Context->dbh; my $input = new CGI; -my $searchfield=$input->param('searchfield'); +my $searchfield=$input->param('searchfield') || ''; my $offset=$input->param('offset'); my $script_name="/cgi-bin/koha/admin/aqbookfund.pl"; my $bookfundid=$input->param('bookfundid'); my $pagesize=20; -my $op = $input->param('op'); +my $op = $input->param('op') || ''; $searchfield=~ s/\,//g; my ($template, $borrowernumber, $cookie) @@ -104,39 +105,34 @@ $template->param(script_name => $script_name, } $template->param(action => $script_name); -my @branches; -my @select_branch; -my %select_branches; -my ($count2,@branches)=branches(); - -push @select_branch,""; -$select_branches{""}=""; - -my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where borrowernumber = ?"); -$sthtemp->execute($borrowernumber); -my ($flags, $homebranch)=$sthtemp->fetchrow; -if ($flags>1){ - if ($homebranch){ - push @select_branch, $homebranch;# - for (my $i=0;$i<$count2;$i++){ - $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'} if ($branches[$i]->{'branchcode'} eq $homebranch); - } - } -} else { - for (my $i=0;$i<$count2;$i++){ - push @select_branch, $branches[$i]->{'branchcode'};# - $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'}; - } +# my @branches; +# my @select_branch; +# my %select_branches; + +my $branches = getbranches; +my @branchloop; +foreach my $thisbranch (sort keys %$branches) { +# my $selected = 1 if $thisbranch eq $branch; + my %row =(value => $thisbranch, +# selected => $selected, + branchname => $branches->{$thisbranch}->{'branchname'}, + ); + push @branchloop, \%row; +# $select_branches{$thisbranch} = $branches->{$thisbranch}->{'branchname'}; } -my $CGIbranch=CGI::scrolling_list( -name => 'branchcode', - -values => \@select_branch, - -labels => \%select_branches, - -size => 1, - -multiple => 0 ); -$template->param(CGIbranch => $CGIbranch); -warn "bornum=".$borrowernumber . "flags = ".$flags. " homebranch= ".$homebranch; -$sthtemp->finish; +# my $homebranch=C4::Context->userenv->{branch}; +# 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 => 'branchcode', +# -values => \@select_branch, +# -labels => \%select_branches, +# -size => 1, +# -multiple => 0 ); +$template->param(branchloop => \@branchloop); ################## ADD_FORM ################################## # called by default. Used to create form to add or modify a record @@ -175,7 +171,7 @@ if ($op eq 'add_form') { my $sth=$dbh->prepare("delete from aqbookfund where bookfundid =?"); $sth->execute($bookfundid); $sth->finish; - my $sth=$dbh->prepare("replace aqbookfund (bookfundid,bookfundname, branchcode) values (?,?,?)"); + $sth=$dbh->prepare("replace aqbookfund (bookfundid,bookfundname,branchcode) values (?,?,?)"); $sth->execute($input->param('bookfundid'),$input->param('bookfundname'),$input->param('branchcode')); $sth->finish; print "Content-Type: text/html\n\n"; @@ -211,33 +207,36 @@ if ($op eq 'add_form') { $template->param(searchfield => $searchfield); } my $env; - my ($count,$results)=StringSearch($env,$searchfield,%select_branches); + my ($count,$results)=StringSearch($env,$searchfield,$branches); my $toggle="white"; my @loop_data =(); + my $dbh = C4::Context->dbh; for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ my %row_data; $row_data{bookfundid} =$results->[$i]{'bookfundid'}; $row_data{bookfundname} = $results->[$i]{'bookfundname'}; - warn "".$results->[$i]{'bookfundid'}." ".$results->[$i]{'bookfundname'}." ".$results->[$i]{'branchcode'}; - $row_data{branchname} = $select_branches{$results->[$i]{'branchcode'}}; - my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget where aqbudget.bookfundid = ?"; - if ($homebranch){ - $strsth2 .= " AND ((aqbudget.branchcode='') OR (aqbudget.branchcode= ".$dbh->quote($homebranch).")) " ; - } else { - $strsth2 .= " AND (aqbudget.branchcode='') " if ($flags>1); - } +# warn "".$results->[$i]{'bookfundid'}." ".$results->[$i]{'bookfundname'}." ".$results->[$i]{'branchcode'}; + $row_data{branchname} = $branches->{$results->[$i]{'branchcode'}}->{branchname}; + my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount from aqbudget where aqbudget.bookfundid = ?"; +# my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount,branchcode from aqbudget where aqbudget.bookfundid = ?"; +# if ($homebranch){ +# $strsth2 .= " AND ((aqbudget.branchcode is null) OR (aqbudget.branchcode='') OR (aqbudget.branchcode= ".$dbh->quote($homebranch).")) " ; +# } else { +# $strsth2 .= " AND (aqbudget.branchcode='') " if ((C4::Context->userenv) && (C4::Context->userenv->{flags}>1)); +# } $strsth2 .= " order by aqbudgetid"; - warn "".$strsth2; +# warn "".$strsth2; my $sth2 = $dbh->prepare($strsth2); $sth2->execute($row_data{bookfundid}); my @budget_loop; - while (my ($aqbudgetid,$startdate,$enddate,$budgetamount,$branchcode) = $sth2->fetchrow) { +# while (my ($aqbudgetid,$startdate,$enddate,$budgetamount,$branchcode) = $sth2->fetchrow) { + while (my ($aqbudgetid,$startdate,$enddate,$budgetamount) = $sth2->fetchrow) { my %budgetrow_data; $budgetrow_data{aqbudgetid} = $aqbudgetid; $budgetrow_data{startdate} = format_date($startdate); $budgetrow_data{enddate} = format_date($enddate); $budgetrow_data{budgetamount} = $budgetamount; - $budgetrow_data{branchcode} = $branchcode; +# $budgetrow_data{branchcode} = $branchcode; push @budget_loop,\%budgetrow_data; } if ($sth2->rows){ diff --git a/admin/aqbudget.pl b/admin/aqbudget.pl index 008d1b1176..9ba8d9e556 100755 --- a/admin/aqbudget.pl +++ b/admin/aqbudget.pl @@ -109,11 +109,19 @@ if ($op eq 'add_form') { my $dataaqbookfund; if ($aqbudgetid) { my $dbh = C4::Context->dbh; - my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid"); +# my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as bfbranch,startdate,enddate,budgetamount,aqbudget.branchcode from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid"); + my $sth=$dbh->prepare("select aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as bfbranch,startdate,enddate,budgetamount from aqbudget,aqbookfund where aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid"); $sth->execute($aqbudgetid); $dataaqbudget=$sth->fetchrow_hashref; $sth->finish; } + if ($bookfundid) { + my $dbh = C4::Context->dbh; + my $sth=$dbh->prepare("select aqbookfund.branchcode, branches.branchname from aqbookfund LEFT JOIN branches ON aqbookfund.branchcode=branches.branchcode where bookfundid=?"); + $sth->execute($bookfundid); + $dataaqbookfund=$sth->fetchrow_hashref; + $sth->finish; + } my $header; if ($aqbudgetid) { $header = "Modify budget"; @@ -123,38 +131,35 @@ if ($op eq 'add_form') { $template->param(header => $header); if ($aqbudgetid) { $template->param(modify => 1); - $template->param(bookfundid => $dataaqbudget->{bookfundid}); - $template->param(bookfundname => $dataaqbudget->{bookfundname}); + $template->param(bookfundid => $dataaqbudget->{'bookfundid'}); + $template->param(bookfundname => $dataaqbudget->{'bookfundname'}); } else { $template->param(bookfundid => $bookfundid, adding => 1); } - my @branches; - my @select_branch; - my %select_branches; - my ($count2,@branches)=branches(); - push @select_branch,""; - $select_branches{""}=""; - if ($flags>1){ - if ($homebranch){ - push @select_branch, $homebranch;# - for (my $i=0;$i<$count2;$i++){ - $select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'} if ($branches[$i]->{'branchcode'} eq $homebranch); - } - } - } else { - 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 => 'branchcode', - -values => \@select_branch, - -labels => \%select_branches, - -default => $dataaqbudget->{branchcode}, - -size => 1, - -multiple => 0 ); - $template->param(CGIbranch => $CGIbranch); +# my @select_branch; +# my %select_branches; +# if ($dataaqbookfund->{branchcode}){ +# push @select_branch,$dataaqbookfund->{'branchcode'}; +# $select_branches{$dataaqbookfund->{'branchcode'}}=$dataaqbookfund->{'branchname'}; +# }else { +# my @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 => 'branchcode', +# -values => \@select_branch, +# -labels => \%select_branches, +# -default => ($dataaqbookfund->{branchcode}?$dataaqbookfund->{branchcode}:$dataaqbudget->{branchcode}), +# -size => 1, +# -multiple => 0 ); +# $template->param(CGIbranch => $CGIbranch); + $template->param(dateformat => display_date_format(), aqbudgetid => $dataaqbudget->{'aqbudgetid'}, startdate => format_date($dataaqbudget->{'startdate'}), diff --git a/admin/branches.pl b/admin/branches.pl index 1f3f2cac25..fd804b1447 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -66,7 +66,7 @@ my $input = new CGI; my $branchcode=$input->param('branchcode'); my $branchname=$input->param('branchname'); my $categorycode = $input->param('categorycode'); -my $op = $input->param('op'); +my $op = $input->param('op') || ''; my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => "parameters/branches.tmpl", @@ -166,7 +166,7 @@ if ($op eq 'add') { # html output functions.... sub default { - my ($message) = @_; + my ($message) = @_ || ""; heading("Branches"); $template->param('heading-branches-p' => 1); $template->param("$message" => 1); @@ -261,7 +261,7 @@ sub branchinfotable { $branchinfo = getbranchinfo(); } my $toggle; - my $i; + my $i=0; my @loop_data =(); foreach my $branch (@$branchinfo) { ($i % 2) ? ($toggle = 1) : ($toggle = 0); @@ -329,8 +329,6 @@ sub branchinfotable { } my @branchcategories =(); my $catinfo = getcategoryinfo(); - my $toggle; - my $i = 0; foreach my $cat (@$catinfo) { ($i % 2) ? ($toggle = 1) : ($toggle = 0); push @branchcategories, { diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 3fc2fa52d2..a18d7b7b46 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -54,12 +54,13 @@ $tabsysprefs{gist}="Acquisitions"; $tabsysprefs{authoritysep}="Authorities"; $tabsysprefs{ISBD}="Catalogue"; $tabsysprefs{marc}="Catalogue"; +$tabsysprefs{autoBarcode}="Catalogue"; $tabsysprefs{marcflavour}="Catalogue"; -$tabsysprefs{SubscriptionHistory}="Catalogue"; +$tabsysprefs{SubscriptionHistory}="OPAC"; $tabsysprefs{maxoutstanding}="Circulation"; $tabsysprefs{printcirculationslips}="Circulation"; $tabsysprefs{ReturnBeforeExpiry}="Circulation"; -$tabsysprefs{suggestion}="Acquisitions"; +$tabsysprefs{suggestion}="OPAC"; $tabsysprefs{automembernum}="Members"; $tabsysprefs{noissuescharge}="Circulation"; $tabsysprefs{opacthemes}="OPAC"; @@ -67,39 +68,11 @@ $tabsysprefs{opaclanguages}="OPAC"; $tabsysprefs{LibraryName}="OPAC"; $tabsysprefs{opacstylesheet}="OPAC"; $tabsysprefs{BiblioDefaultView}="OPAC"; -$tabsysprefs{hidelostitem}="OPAC"; +$tabsysprefs{opaclargeimage}="OPAC"; +$tabsysprefs{opacsmallimage}="OPAC"; +$tabsysprefs{hidelostitems}="OPAC"; $tabsysprefs{KohaAdmin}="Admin"; -$tabsysprefs{checkdigit}="Admin"; -$tabsysprefs{dateformat}="Admin"; -$tabsysprefs{insecure}="Admin"; -$tabsysprefs{ldapinfos}="Admin"; -$tabsysprefs{ldapserver}="Admin"; -$tabsysprefs{itemcallnumber}="Catalogue"; -$tabsysprefs{maxreserves}="Circulation"; -$tabsysprefs{virtualshelves}="OPAC"; - -my %tabsysprefs; -$tabsysprefs{acquisitions}="Acquisitions"; -$tabsysprefs{gist}="Acquisitions"; -$tabsysprefs{authoritysep}="Authorities"; -$tabsysprefs{ISBD}="Catalogue"; -$tabsysprefs{marc}="Catalogue"; -$tabsysprefs{marcflavour}="Catalogue"; -$tabsysprefs{SubscriptionHistory}="Catalogue"; -$tabsysprefs{maxoutstanding}="Circulation"; -$tabsysprefs{printcirculationslips}="Circulation"; -$tabsysprefs{ReturnBeforeExpiry}="Circulation"; -$tabsysprefs{suggestion}="Acquisitions"; -$tabsysprefs{automembernum}="Members"; -$tabsysprefs{noissuescharge}="Circulation"; -$tabsysprefs{opacthemes}="OPAC"; -$tabsysprefs{opaclanguages}="OPAC"; -$tabsysprefs{LibraryName}="OPAC"; -$tabsysprefs{opacstylesheet}="OPAC"; -$tabsysprefs{BiblioDefaultView}="OPAC"; -$tabsysprefs{hidelostitem}="OPAC"; -$tabsysprefs{KohaAdmin}="Admin"; -$tabsysprefs{checkdigit}="Admin"; +$tabsysprefs{checkdigit}="Members"; $tabsysprefs{dateformat}="Admin"; $tabsysprefs{insecure}="Admin"; $tabsysprefs{ldapinfos}="Admin"; @@ -107,6 +80,7 @@ $tabsysprefs{ldapserver}="Admin"; $tabsysprefs{itemcallnumber}="Catalogue"; $tabsysprefs{maxreserves}="Circulation"; $tabsysprefs{virtualshelves}="OPAC"; +$tabsysprefs{hide_marc}="Catalogue"; sub StringSearch { my ($env,$searchstring,$type)=@_; @@ -334,7 +308,7 @@ if ($op eq 'add_form') { } } $sth->finish; - print "Content-Type: text/html\n\n"; + print "Content-Type: text/html\n\nparam('variable')}."\">"; exit; ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 40ce13e225..00a3bcf461 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -139,7 +139,7 @@ sub create_input () { $subfield_data{tag_mandatory}=$tagslib->{$tag}->{mandatory}; $subfield_data{mandatory}=$tagslib->{$tag}->{$subfield}->{mandatory}; $subfield_data{repeatable}=$tagslib->{$tag}->{$subfield}->{repeatable}; -# $subfield_data{kohafield}=$tagslib->{$tag}->{$subfield}->{kohafield}; + $subfield_data{index} = $i; if ($tagslib->{$tag}->{$subfield}->{authorised_value}) { $subfield_data{marc_value}= build_authorized_values_list($tag, $subfield, $value, $dbh,$authorised_values_sth); } elsif ($tagslib->{$tag}->{$subfield}->{thesaurus_category}) { @@ -419,5 +419,6 @@ foreach my $thisauthtype (keys %$authtypes) { $template->param(authtypesloop => \@authtypesloop, authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, + hide_marc => C4::Context->preference('hide_marc'), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index a87d09c9ef..c4d22aba3e 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -80,15 +80,20 @@ my $tag; my @loop_data =(); if ($authid) { foreach my $field ($record->field($auth_type->{auth_tag_to_report})) { - my @subfields_data; - my @subf=$field->subfields; + my @subfields_data; + my @subf=$field->subfields; # loop through each subfield + my %result; for my $i (0..$#subf) { $subf[$i][0] = "@" unless $subf[$i][0]; + $result{$subf[$i][0]}.=$subf[$i][1]."|"; + } + foreach (keys %result) { my %subfield_data; - $subfield_data{marc_value}=$subf[$i][1]; - $subfield_data{marc_subfield}=$subf[$i][0]; - $subfield_data{marc_tag}=$field->tag(); + chop $result{$_}; + $subfield_data{marc_value}=$result{$_}; + $subfield_data{marc_subfield}=$_; +# $subfield_data{marc_tag}=$field->tag(); push(@subfields_data, \%subfield_data); } if ($#subfields_data>=0) { diff --git a/barcodes/barcodes.pl b/barcodes/barcodes.pl index 70f95de987..45914fc712 100755 --- a/barcodes/barcodes.pl +++ b/barcodes/barcodes.pl @@ -82,7 +82,7 @@ my $input = new CGI; my @labelTable = C4::Barcodes::PrinterConfig::labelsPage($labelConfig{'rows'}, $labelConfig{'columns'}); # It creates a list of posible intervals to choose codes to generate -my %list = ('continuous' => 'Continuous Range of items', 'individuals' => 'Individual Codes', 'continuous2' => 'Continuous range (from - to)'); +my %list = ('continuous' => 'Continuous Range of items', 'individuals' => 'Individual Codes'); my @listValues = keys(%list); my $rangeType = CGI::scrolling_list(-name => 'rangeType', -values => \@listValues, diff --git a/bull/lateissues.pl b/bull/lateissues.pl index e85e9be9a3..11858d3b45 100755 --- a/bull/lateissues.pl +++ b/bull/lateissues.pl @@ -4,6 +4,7 @@ use strict; use CGI; use C4::Auth; use C4::Bull; +use C4::Acquisition; use C4::Output; use C4::Interface::CGI::Output; use C4::Context; @@ -30,6 +31,10 @@ my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid', my @lateissues; @lateissues = GetLateIssues($supplierid) if $supplierid; +my @supplierinfo; +my $nothing; +($nothing,@supplierinfo)=bookseller($supplierid) if $supplierid; + my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "bull/lateissues.tmpl", query => $query, @@ -41,6 +46,9 @@ my ($template, $loggedinuser, $cookie) $template->param( CGIsupplier => $CGIsupplier, - lateissues => \@lateissues + lateissues => \@lateissues, + phone => $supplierinfo[0]->{phone}, + booksellerfax => $supplierinfo[0]->{booksellerfax}, + bookselleremail => $supplierinfo[0]->{bookselleremail}, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/bull/statecollection.pl b/bull/statecollection.pl index 79d70e3ce2..c8a6b84d20 100755 --- a/bull/statecollection.pl +++ b/bull/statecollection.pl @@ -37,6 +37,7 @@ my ($template, $loggedinuser, $cookie) }); my $hassubscriptionexpired = hassubscriptionexpired($subscriptionid); +my $subscription=getsubscription($subscriptionid); if ($op eq 'modsubscriptionhistory') { modsubscriptionhistory($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote); } @@ -66,6 +67,7 @@ my $solhistory = $sth->fetchrow_hashref; $template->param( serialslist => \@serialslist, + biblionumber => $subscription->{biblionumber}, histstartdate => format_date($solhistory->{'histstartdate'}), enddate => format_date($solhistory->{'enddate'}), recievedlist => $solhistory->{'recievedlist'}, @@ -74,6 +76,7 @@ my $solhistory = $sth->fetchrow_hashref; librariannote => $solhistory->{'librariannote'}, subscriptionid => $subscriptionid, bibliotitle => $subs->{bibliotitle}, + biblionumber => $subs->{biblionumber}, hassubscriptionexpired =>$hassubscriptionexpired, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 447e8b8353..fe42edec2e 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -36,8 +36,8 @@ use C4::Koha; # constants my %env; -my $linecolor1='#ffffcc'; -my $linecolor2='white'; +my $linecolor1= 0; +my $linecolor2= 1; my $branches = getbranches(); my $printers = getprinters(\%env); @@ -63,6 +63,7 @@ my $reqmessage; my $cancelled; my $setwaiting; my $reqbrchname; +my $allmessages; my $request=$query->param('request'); my $borrnum = $query->param('borrowernumber'); @@ -77,6 +78,7 @@ if ($request eq "KillWaiting") { CancelReserve(0, $item, $borrnum); $cancelled = 1; $reqmessage =1; + $allmessages = 1; } my $ignoreRs = 0; @@ -87,12 +89,14 @@ if ($request eq "SetWaiting") { $ignoreRs = 1; $setwaiting = 1; $reqmessage =1; + $allmessages = 1; } if ($request eq 'KillReserved'){ my $biblio = $query->param('biblionumber'); CancelReserve($biblio, 0, $borrnum); $cancelled = 1; $reqmessage =1; + $allmessages = 1; } @@ -180,13 +184,21 @@ foreach ($query->param){ push (@trsfitemloop, \%item); } - -my $name; +my $title; +my $surname; +my $firstname; +my $bornum; +my $borphone; +my $borstraddress; +my $borcity; +my $borzip; +my $boremail; my $bornum; my $borcnum; my $itemnumber; my $biblionum; my $branchname; +my $wastransferred; ##################### @@ -195,8 +207,17 @@ if ($found) { my $res = $messages->{'ResFound'}; $branchname = $branches->{$res->{'branchcode'}}->{'branchname'}; my ($borr) = getpatroninformation(\%env, $res->{'borrowernumber'}, 0); - $name = name($borr); - $bornum = $borr->{'borrowernumber'}; #Hopefully, borr->{borrowernumber}=res->{borrowernumber} + $title = $borr->{'title'}; + $surname = $borr->{'surname'}; + $firstname = $borr->{'firstname'}; + $bornum = $borr->{'borrowernumber'}; + $borphone = $borr->{'phone'}; + $borstraddress = $borr->{'streetaddress'}; + $borcity = $borr->{'city'}; + $borzip = $borr->{'zipcode'}; + $boremail = $borr->{'emailadress'}; + + #Hopefully, borr->{borrowernumber}=res->{borrowernumber} $borcnum = $borr->{'cardnumber'}; $itemnumber = $res->{'itemnumber'}; @@ -214,33 +235,39 @@ if ($found) { my @errmsgloop; foreach my $code (keys %$messages) { my %err; - $err{errbadcode} = ($code eq 'BadBarcode'); + if ($code eq 'BadBarcode') { $err{msg}=$messages->{'BadBarcode'}; + $err{errbadcode} = 1; + $allmessages = 1; } - $err{errispermanent} = ($code eq 'IsPermanent'); if ($code eq 'IsPermanent'){ + $err{errispermanent} = 1; $err{msg} = $branches->{$messages->{'IsPermanent'}}->{'branchname'}; # Here, msg contains the branchname # Not so satisfied with this... But should work + $allmessages = 1; } $err{errdesteqholding} = ($code eq 'DestinationEqualsHolding'); - $err{errwasreturned} = ($code eq 'WasReturned'); if ($code eq 'WasReturned') { + $err{errwasreturned} = 1; + $allmessages = 1; my ($borrowerinfo) = getpatroninformation(\%env, $messages->{'WasReturned'}, 0); - $name =name($borrowerinfo); + $title = $borrowerinfo->{'title'}; + $surname = $borrowerinfo->{'surname'}; + $firstname = $borrowerinfo->{'firstname'}; $bornum =$borrowerinfo->{'borrowernumber'}; $borcnum =$borrowerinfo->{'cardnumber'}; } - if ($code eq 'WasTransfered'){ +# if ($code eq 'WasTransfered'){ # Put code here if you want to notify the user that item was transfered... - } +# $wastransferred = 1; +# } push (@errmsgloop, \%err); } - ####################################################################################### # Make the page ..... my ($template, $borrowernumber, $cookie) @@ -250,6 +277,10 @@ my ($template, $borrowernumber, $cookie) authnotrequired => 0, flagsrequired => {circulate => 1}, }); +if($allmessages){ + $template->param(allmessages => 1); +} + $template->param( genbrname => $genbrname, genprname => $genprname, branch => $branch, @@ -257,7 +288,14 @@ $template->param( genbrname => $genbrname, found => $found, reserved => $reserved, waiting => $waiting, - name => $name, + title => $title, + surname => $surname, + firstname => $firstname, + borphone => $borphone, + borstraddress => $borstraddress, + borcity => $borcity, + borzip => $borzip, + boremail => $boremail, bornum => $bornum, borcnum => $borcnum, branchname => $branchname, @@ -268,6 +306,7 @@ $template->param( genbrname => $genbrname, reqmessage => $reqmessage, cancelled => $cancelled, setwaiting => $setwaiting, + wastransferred => $wastransferred, trsfitemloop => \@trsfitemloop, branchoptionloop => \@branchoptionloop, errmsgloop => \@errmsgloop diff --git a/circ/circulation.pl b/circ/circulation.pl index e183539b1f..8dc7473ed9 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -58,8 +58,8 @@ my $findborrower = $query->param('findborrower'); $findborrower =~ s|,| |g; $findborrower =~ s|'| |g; my $borrowernumber = $query->param('borrnumber'); -my $print=$query->param('print'); -my $barcode = $query->param('barcode'); +my $print=$query->param('print') || ''; +my $barcode = $query->param('barcode') || ''; my $year=$query->param('year'); my $month=$query->param('month'); my $day=$query->param('day'); @@ -280,7 +280,7 @@ if ($borrowerslist) { #title my ($patrontable, $flaginfotable) = patrontable($borrower); -my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'}; +my $amountold=$borrower->{flags}->{'CHARGES'}->{'message'} || 0; my @temp=split(/\$/,$amountold); $amountold=$temp[1]; $template->param( diff --git a/circ/returns.pl b/circ/returns.pl index 1fe02b652d..ea34ad533a 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -26,6 +26,7 @@ use strict; use CGI; use C4::Circulation::Circ2; +use C4::Date; use C4::Search; use C4::Output; use C4::Print; @@ -201,6 +202,12 @@ if ( $messages->{'ResFound'} ) { my ($iteminfo) = getiteminformation( \%env, 0, $barcode ); if ( $res->{'ResFound'} eq "Waiting" ) { + if($branch eq $res->{'branchcode'}){ + $template->param(intransit => 0); + } else { + $template->param(intransit => 1); + } + $template->param( found => 1, name => $name, @@ -208,11 +215,15 @@ if ( $messages->{'ResFound'} ) { borsurname => $borr->{'surname'}, bortitle => $borr->{'title'}, borphone => $borr->{'phone'}, + boremail => $borr->{'emailaddress'}, borstraddress => $borr->{'streetaddress'}, borcity => $borr->{'city'}, borzip => $borr->{'zipcode'}, bornum => $res->{'borrowernumber'}, borcnum => $borr->{'cardnumber'}, + debarred => $borr->{'debarred'}, + gonenoaddress => $borr->{'gonenoaddress'}, + currentbranch => $branches->{ $branch }->{'branchname'}, branchname => $branches->{ $res->{'branchcode'} }->{'branchname'}, waiting => 1, itemnumber => $res->{'itemnumber'}, @@ -230,8 +241,16 @@ if ( $messages->{'ResFound'} ) { sprintf( "%0.2d", ( $da[3] + 1 ) ) . "/" . sprintf( "%0.2d", ( $da[4] + 1 ) ) . "/" . ( $da[5] + 1900 ); + + if($branch eq $res->{'branchcode'}){ + $template->param(intransit => 0); + } else { + $template->param(intransit => 1); + } + $template->param( found => 1, + currentbranch => $branches->{ $branch }->{'branchname'}, branchname => $branches->{ $res->{'branchcode'} }->{'branchname'}, reserved => 1, today => $todaysdate, @@ -251,7 +270,9 @@ if ( $messages->{'ResFound'} ) { borsub => $borr->{'suburb'}, borcity => $borr->{'city'}, borzip => $borr->{'zipcode'}, - boremail => $borr->{'emailadress'}, + boremail => $borr->{'emailaddress'}, + debarred => $borr->{'debarred'}, + gonenoaddress => $borr->{'gonenoaddress'}, barcode => $barcode ); } @@ -353,7 +374,7 @@ if ($borrower) { my ($iteminformation) = getiteminformation( \%env, $item->{'itemnumber'}, 0 ); my %overdueitem; - $overdueitem{duedate} = $item->{'date_due'}; + $overdueitem{duedate} = format_date($item->{'date_due'}); $overdueitem{biblionum} = $iteminformation->{'biblionumber'}; $overdueitem{barcode} = $iteminformation->{'barcode'}; $overdueitem{title} = $iteminformation->{'title'}; @@ -409,7 +430,7 @@ foreach ( sort { $a <=> $b } keys %returneditems ) { $datearr[5] . '-' . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-' . sprintf( "%0.2d", $datearr[3] ); - $ri{duedate}=$duedate; + $ri{duedate}=format_date($duedate); my ($borrower) = getpatroninformation( \%env, $riborrowernumber{$_}, 0 ); $ri{bornum} = $borrower->{'borrowernumber'}; diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl index e426eeede7..72924d722e 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl @@ -63,9 +63,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -74,14 +79,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -94,9 +104,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -105,14 +120,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -125,9 +145,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -136,14 +161,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -156,9 +186,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -167,14 +202,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -187,9 +227,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -198,14 +243,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -218,9 +268,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -229,14 +284,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -249,9 +309,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -260,14 +325,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -280,9 +350,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -291,14 +366,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -311,9 +391,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -322,14 +407,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -342,9 +432,14 @@

- "> - "> - + + + "> - + + "> + + ')">+ @@ -353,14 +448,19 @@

"> - "> + " size="2" maxlength="1"> "> "> "> @@ -491,28 +591,28 @@ function Check(f) { } alert(alertString2); } else { - document.forms[0].submit(); + document.forms['f'].submit(); } } function Dopop(link,i) { - defaultvalue=document.forms[0].field_value[i].value; + defaultvalue=document.forms['f'].field_value[i].value; newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes'); } function PopupZ3950() { var strQuery=""; - for (i=0 ; i0) { - strQuery += "&isbn="+document.forms[0].field_value[i].value; + for (i=0 ; i0) { + strQuery += "&isbn="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblio.title" && document.forms[0].field_value[i].value.length>0) { - strQuery += "&title="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) { + strQuery += "&title="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblio.author" &&document.forms[0].field_value[i].value.length>0) { - strQuery += "&author="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) { + strQuery += "&author="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblioitems.issn" && document.forms[0].field_value[i].value.length>0) { - strQuery += "&issn="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) { + strQuery += "&issn="+document.forms['f'].field_value[i].value; } } newin=window.open("../z3950/search.pl?biblionumber="+strQuery,"z3950search",'width=800,height=400,toolbar=false,scrollbars=yes'); @@ -523,10 +623,29 @@ function Changefwk(FwkList) { } function AddField(field) { - document.forms[0].op.value = "addfield"; - document.forms[0].addfield_field.value=field; + document.forms['f'].op.value = "addfield"; + document.forms['f'].addfield_field.value=field; document.f.submit(); } + +function upSubfield(index) { +// alert("UP "+index); + temp = document.forms['f'].field_value[index-1].value; + document.forms['f'].field_value[index-1].value=document.forms['f'].field_value[index].value; + document.forms['f'].field_value[index].value= temp; + temp = document.forms['f'].subfield[index-1].value; + document.forms['f'].subfield[index-1].value=document.forms['f'].subfield[index].value; + document.forms['f'].subfield[index].value = temp; + temp = document.forms['f'].mandatory[index-1].value; + document.forms['f'].mandatory[index-1].value=document.forms['f'].mandatory[index].value; + document.forms['f'].mandatory[index].value = temp; + temp = document.forms['f'].kohafield[index-1].value; + document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value; + document.forms['f'].kohafield[index].value = temp; +// temp = document.getElementById('error'+index).value = "XXX"; +// document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value; +// document.forms['f'].kohafield[index].value = temp; +} diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl index 6245d601ed..53f65294d5 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl @@ -76,7 +76,6 @@ - +
+ To /includes/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" valign="top" border="0" hspace="0" vspace="0"> + " type="text"> + From /includes/calendar/cal.gif" border="0" hspace="0" vspace="0" id="openCalendarFrom" style="cursor: pointer;" valign="top"> @@ -107,32 +164,77 @@ - - - - - "> - - - + + + + + + - + + + + + - + + + + + +

">

+

+ + + + + + - + + + + + - + + + + + - + + + + + + + + + + +   + + + +   +   +   +   +   +   + + +   + diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl index 2627a98db1..952e53ff30 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/newbiblio.tmpl @@ -170,19 +170,19 @@ function check(f) {

- " onchange="update(this.form)"> + ">

- " onchange="update(this.form)"> + ">

- +

- +

diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/suggestion-select.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/suggestion-select.tmpl index c5c426afc0..f50ff24840 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui/suggestion-select.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/suggestion-select.tmpl @@ -9,7 +9,7 @@   -

+

Filter on : title: "> @@ -56,6 +56,5 @@ - \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl index 8ea0abf0d0..5c8a419118 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/auth_finder.tmpl @@ -3,7 +3,7 @@

Authority search

- + "> diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl index 8c97dfc575..5b93aae7b3 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities-home.tmpl @@ -3,7 +3,7 @@

Authority search

- + "> diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities.tmpl index a56d7745ab..763ea0f45c 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/authorities.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/authorities.tmpl @@ -47,14 +47,18 @@

"> - "> "> "> "> @@ -150,28 +154,28 @@ function Check(f) { alertString2 += "\n- "+ total_missing_mandatory_subfields +_(" mandatory fields empty (see bold subfields)"); alert(alertString2); } else { - document.forms[1].submit(); + document.forms[0].submit(); } } function Dopop(link,i) { - defaultvalue=document.forms[0].field_value[i].value; + defaultvalue=document.forms['f'].field_value[i].value; newin=window.open(link+"&result="+defaultvalue,"value builder",'width=550,height=550,toolbar=false,scrollbars=yes'); } function PopupZ3950() { var strQuery=""; - for (i=0 ; i0) { - strQuery += "&isbn="+document.forms[0].field_value[i].value; + for (i=0 ; i0) { + strQuery += "&isbn="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblio.title" && document.forms[0].field_value[i].value.length>0) { - strQuery += "&title="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblio.title" && document.forms['f'].field_value[i].value.length>0) { + strQuery += "&title="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblio.author" &&document.forms[0].field_value[i].value.length>0) { - strQuery += "&author="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblio.author" &&document.forms['f'].field_value[i].value.length>0) { + strQuery += "&author="+document.forms['f'].field_value[i].value; } - if (document.forms[0].kohafield[i].value == "biblioitems.issn" && document.forms[0].field_value[i].value.length>0) { - strQuery += "&issn="+document.forms[0].field_value[i].value; + if (document.forms['f'].kohafield[i].value == "biblioitems.issn" && document.forms['f'].field_value[i].value.length>0) { + strQuery += "&issn="+document.forms['f'].field_value[i].value; } } newin=window.open("../z3950/search.pl?bibid="+strQuery,"z3950search",'width=500,height=400,toolbar=false,scrollbars=yes'); @@ -182,6 +186,22 @@ function AddField(field) { document.forms[1].addfield_field.value=field; document.f.submit(); } + +function upSubfield(index) { + temp = document.forms['f'].field_value[index-1].value; + document.forms['f'].field_value[index-1].value=document.forms['f'].field_value[index].value; + document.forms['f'].field_value[index].value= temp; + temp = document.forms['f'].subfield[index-1].value; + document.forms['f'].subfield[index-1].value=document.forms['f'].subfield[index].value; + document.forms['f'].subfield[index].value = temp; + temp = document.forms['f'].mandatory[index-1].value; + document.forms['f'].mandatory[index-1].value=document.forms['f'].mandatory[index].value; + document.forms['f'].mandatory[index].value = temp; + temp = document.forms['f'].kohafield[index-1].value; + document.forms['f'].kohafield[index-1].value=document.forms['f'].kohafield[index].value; + document.forms['f'].kohafield[index].value = temp; +} + diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/detail.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/detail.tmpl index 57259746ce..a820e6498b 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/detail.tmpl @@ -5,9 +5,11 @@ "> //images/fileopen.png"> - - //images/edittrash.png"> - + + + //images/edittrash.png"> + + ')" class="button authority"> Print @@ -22,9 +24,6 @@

diff --git a/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl b/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl index b2a45a8e30..bf73e4ea0a 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bookshelves/addbookbybiblionumber.tmpl @@ -1,7 +1,7 @@

Select bookshelf

- + ">

diff --git a/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl index a8711eb988..3ab8d15a53 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bookshelves/shelves.tmpl @@ -2,23 +2,23 @@
- +

-

Shelf content

+

Shelf contents

- - - + + + - + - + @@ -34,7 +34,7 @@
- +

Add a book by barcode

"> @@ -47,7 +47,7 @@
@@ -62,7 +62,7 @@

Select Shelves to Delete

- + @@ -80,7 +80,7 @@
-
+

Add Shelf

@@ -98,7 +98,7 @@

- back to shelf list + back to shelf list

@@ -116,7 +116,7 @@
@@ -136,7 +136,7 @@ @@ -147,14 +147,14 @@
deletebarcodetitleDelete BarcodeTitle Author
">">  ">">
- "> + "> - " class="button catalogue">Modify + " class="button catalogue">Modify
-
+

Modify shelf

"> diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/lateissues.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/lateissues.tmpl index a2db8eefb8..ad54f0710a 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/lateissues.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/lateissues.tmpl @@ -16,7 +16,11 @@ -   +

+ Phone: + Fax: +

" class="button bull"> +

diff --git a/koha-tmpl/intranet-tmpl/default/en/bull/search.tmpl b/koha-tmpl/intranet-tmpl/default/en/bull/search.tmpl index f37d5e6c20..fb9a57e1ff 100644 --- a/koha-tmpl/intranet-tmpl/default/en/bull/search.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/bull/search.tmpl @@ -3,7 +3,7 @@

Catalogue search

- + "> @@ -15,7 +15,7 @@ - +

@@ -41,24 +41,10 @@
- diff --git a/koha-tmpl/intranet-tmpl/default/en/circ/branchtransfers.tmpl b/koha-tmpl/intranet-tmpl/default/en/circ/branchtransfers.tmpl index c9aec1935f..3b1f2e1613 100644 --- a/koha-tmpl/intranet-tmpl/default/en/circ/branchtransfers.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/circ/branchtransfers.tmpl @@ -69,6 +69,7 @@ +
Messages
@@ -97,7 +98,7 @@ onclick="openWindow(this,'Member', 480, 640); return false;">  
- +

Select Destination Branch: - - - - - - -

- Koha User : -

-

Action type : -

-

From - /includes/calendar/cal.gif" border="0" hspace="0" vspace="0" id="openCalendarFrom" style="cursor: pointer;" valign="top"> - - To - /includes/calendar/cal.gif" id="openCalendarTo" style="cursor: pointer;" valign="top" border="0" hspace="0" vspace="0"> - - - - - -

-

Output

- To screen into the browser -
- To file into an application - - -

-
-

- - "> - -

- -
- diff --git a/koha-tmpl/intranet-tmpl/default/en/reports/acquisitions_stats.tmpl b/koha-tmpl/intranet-tmpl/default/en/reports/acquisitions_stats.tmpl index 7b8a48e1cc..eaedd3766e 100644 --- a/koha-tmpl/intranet-tmpl/default/en/reports/acquisitions_stats.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/reports/acquisitions_stats.tmpl @@ -255,7 +255,6 @@ To file into an application -

diff --git a/koha-tmpl/intranet-tmpl/default/en/reports/borrowers_stats.tmpl b/koha-tmpl/intranet-tmpl/default/en/reports/borrowers_stats.tmpl index 6a45b88af8..d1e9f705a6 100644 --- a/koha-tmpl/intranet-tmpl/default/en/reports/borrowers_stats.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/reports/borrowers_stats.tmpl @@ -98,8 +98,14 @@   + + Branch + + + + - + Sort1 @@ -107,7 +113,7 @@ - + Sort2 diff --git a/koha-tmpl/intranet-tmpl/default/en/reports/issues_stats.tmpl b/koha-tmpl/intranet-tmpl/default/en/reports/issues_stats.tmpl index 34e1103497..b569e38d8c 100644 --- a/koha-tmpl/intranet-tmpl/default/en/reports/issues_stats.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/reports/issues_stats.tmpl @@ -206,7 +206,8 @@

Cell value

Count issues

Count borrowers

-

Circulation rate

+

Count Items

+

Circulation rate

Output

diff --git a/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl b/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl index df9c75e5c3..ef9e2a9dac 100644 --- a/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/search.marc/result.tmpl @@ -20,7 +20,11 @@ - class="hilighted"> + + + + + "> diff --git a/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl b/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl index a1fb3a4a69..e8bd13e4cc 100644 --- a/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/search.marc/search.tmpl @@ -30,9 +30,11 @@ - - ... - + + + ... + +

@@ -40,9 +42,11 @@ - - ... - + + + ... + +

@@ -51,9 +55,11 @@ - - ... - + + + ... + +

@@ -186,12 +192,12 @@ document.f.sql.value=""; function AddStatement() { - document.forms[0].op.value="AddStatement"; + document.forms['f'].op.value="AddStatement"; document.f.submit(); } function Dopop(link,i) { - var searchstring=document.forms[0].value[i].value; + var searchstring=document.forms['f'].value[i].value; newin=window.open(link+'&search='+searchstring,"popup",'width=700,height=550,toolbar=false,scrollbars=yes'); } diff --git a/koha-tmpl/intranet-tmpl/default/en/search.marc/suggest.tmpl b/koha-tmpl/intranet-tmpl/default/en/search.marc/suggest.tmpl index 7ff4f29a76..ea5be295e8 100644 --- a/koha-tmpl/intranet-tmpl/default/en/search.marc/suggest.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/search.marc/suggest.tmpl @@ -39,9 +39,9 @@ + + + + + + +

+

Laboratory Search

+ +
+
+

Search on

+

+ + "> + "> + + " > + " size="35"> + + +

+
+
+ + +
+

Laboratory Search results

+
+

+ + Results to of No results found. + +

+
+
+ + + + + + + + + + + + + + + +
LaboratorySelect
+ + + ','',,0)" class="button catalogue">Select + ','',,1)" class="button catalogue">Sel&close +
+
+ + +
+ +
+ + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl index 0e030689dc..16dede7bd7 100644 --- a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_100.tmpl @@ -160,9 +160,16 @@ + + + + + + - + @@ -214,9 +221,16 @@ + + + + + + - + @@ -268,9 +282,16 @@ + + + + + + - + diff --git a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl index 64197eeeb2..7ca1531a8e 100644 --- a/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/value_builder/unimarc_field_210c.tmpl @@ -32,7 +32,7 @@

- &&authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index="> + &&authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index="> @@ -40,12 +40,12 @@ -highlight.gif"> - &authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index="> + &authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index="> .gif" border="0"> - &&authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index="> + &authtypecode=EDITORS&and_or=and&operator=contains&value=&op=do_search&type=intranet&index=">

diff --git a/members/deletemem.pl b/members/deletemem.pl index 2f0e1b33b7..cbda883d76 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -55,32 +55,29 @@ foreach (sort keys %$issues) { $i++; } my ($bor,$flags)=getpatroninformation(\%env, $member,''); - if (C4::Context->preference("IndependantBranches")) { my $userenv = C4::Context->userenv; unless ($userenv->{flags} == 1){ unless ($userenv->{'branch'} eq $bor->{'branchcode'}){ - warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'}; +# warn "user ".$userenv->{'branch'} ."borrower :". $bor->{'branchcode'}; print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$member"); exit 1; } } } - my $dbh = C4::Context->dbh; my $sth=$dbh->prepare("Select * from borrowers where guarantor=?"); $sth->execute($member); my $data=$sth->fetchrow_hashref; $sth->finish; - if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){ my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => "members/deletemem.tmpl", query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {circulate => 1}, + flagsrequired => {borrower => 1}, debug => 1, }); # print $input->header; diff --git a/members/imemberentry.pl b/members/imemberentry.pl index 0e9922919a..c0530c4ef1 100755 --- a/members/imemberentry.pl +++ b/members/imemberentry.pl @@ -26,11 +26,11 @@ use strict; use C4::Auth; use C4::Output; use CGI; -use C4::Search; +use C4::Members; use C4::Interface::CGI::Output; use C4::Koha; use HTML::Template; -use C4::Members; +use C4::Search; use C4::Date; my $input = new CGI; diff --git a/members/memberentry.pl b/members/memberentry.pl index 7f27125272..234be6b0c6 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -111,7 +111,7 @@ if ($op eq 'add' or $op eq 'modify') { } if (C4::Context->preference("IndependantBranches")) { my $userenv = C4::Context->userenv; - if ($userenv->{flags} == 1){ + if ($userenv->{flags} != 1){ unless ($userenv->{branch} eq $data{'branchcode'}){ push @errors, "ERROR_branch"; $nok=1; @@ -171,7 +171,8 @@ if ($delete){ } else { $template->param( updtype => 'M'); } - my $cardnumber=C4::Members::fixup_cardnumber($data->{'cardnumber'}); + my $cardnumber=$data->{'cardnumber'}; + $cardnumber=fixup_cardnumber($data->{'cardnumber'}) if $actionType eq 'Add'; if ($data->{'sex'} eq 'F'){ $template->param(female => 1); } @@ -241,21 +242,14 @@ if ($delete){ my $branches=getbranches(); my $default; foreach my $branch (keys %$branches) { - if (C4::Context->preference("IndependantBranches")) { - my $userenv = C4::Context->userenv; - if ($userenv->{flags} == 1){ - push @select_branch, $branch; - $select_branches{$branch} = $branches->{$branch}->{'branchname'}; - $default = $data->{'branchcode'}; - } else { - push @select_branch, $branch if ($branch eq $userenv->{branch}); - $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq $userenv->{branch}); - $default = $userenv->{branch}; - } - } else { + if ((not C4::Context->preference("IndependantBranches")) || (C4::Context->userenv->{'flags'} == 1)) { push @select_branch, $branch; $select_branches{$branch} = $branches->{$branch}->{'branchname'}; $default = $data->{'branchcode'}; + } else { + push @select_branch, $branch if ($branch eq C4::Context->userenv->{'branch'}); + $select_branches{$branch} = $branches->{$branch}->{'branchname'} if ($branch eq C4::Context->userenv->{'branch'}); + $default = C4::Context->userenv->{'branch'}; } } diff --git a/members/moremember.pl b/members/moremember.pl index 5030ff2785..fe0aa0f4a4 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -128,6 +128,9 @@ if ($data->{'categorycode'} ne 'C'){ } } +#Independant branches management +my $unvalidlibrarian = ((C4::Context->preference("IndependantBranches")) && (C4::Context->userenv->{flags}!=1) && ($data->{'branchcode'} ne C4::Context->userenv->{branch})); + my %bor; $bor{'borrowernumber'}=$bornum; @@ -174,8 +177,7 @@ for (my $i=0;$i<$count;$i++){ # return the correct item type either (or a properly-formatted # charge, for that matter). my ($charge,$itemtype)=calc_charges($dbh,$issue->[$i]{'itemnumber'},$bornum); - my $itemtypedef = getitemtypeinfo($itemtype); - $row{'itemtype'}=$itemtypedef->{description}; + $row{'itemtype'}=&ItemType($itemtype); $row{'charge'}= sprintf("%.2f",$charge); #check item is not reserved @@ -226,10 +228,7 @@ $template->param( totalprice =>$totalprice, totaldue =>$total, issueloop => \@issuedata, - reserveloop => \@reservedata, - alertloop => $alerts); - independantbranches => C4::Context->preference("IndependantBranches"), - samebranch => C4::Context->preference("IndependantBranches"?"":$samebranch, - ); + unvalidlibrarian => $unvalidlibrarian, + reserveloop => \@reservedata); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index de47723c1a..51f84b5c9a 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -114,7 +114,7 @@ my $res; my $subfieldcode = $subf[$i][0]; my $subfieldvalue = get_authorised_value_desc($tag, $subf[$i][0], $subf[$i][1], '', $dbh); my $tagsubf = $tag.$subfieldcode; - $calculated =~ s/\{(.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g; + $calculated =~ s/\{(.?.?.?.?)$tagsubf(.*?)\}/$1$subfieldvalue$2\{$1$tagsubf$2\}/g; } # field builded, store the result if ($calculated && !$hasputtextbefore) { # put textbefore if not done diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index ac23ef55c3..49c1baf503 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -168,6 +168,8 @@ foreach my $field (@fields) { push(@big_array, \%this_row); } } +my ($holdingbrtagf,$holdingbrtagsubf) = &MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$itemtype); +@big_array = sort {$a->{$holdingbrtagsubf} cmp $b->{$holdingbrtagsubf}} @big_array; #fill big_row with missing datas foreach my $subfield_code (keys(%witness)) { for (my $i=0;$i<=$#big_array;$i++) { diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl index 4156dd7d81..128775eae7 100755 --- a/opac/opac-basket.pl +++ b/opac/opac-basket.pl @@ -33,7 +33,7 @@ foreach my $biblionumber (@bibs) { $template->param(biblionumber => $biblionumber); my $dat = &bibdata($biblionumber); - my ($authorcount, $addauthor) = &getaddauthor($biblionumber); + my ($authorcount, $addauthor) = &addauthor($biblionumber); my @items = &ItemInfo(undef, $biblionumber, 'opac'); $dat->{'additional'}=$addauthor->[0]->{'author'}; @@ -46,6 +46,13 @@ foreach my $biblionumber (@bibs) { $num++; $dat->{'biblionumber'} = $biblionumber; $dat->{ITEM_RESULTS} = \@items; + if (C4::Context->preference("BiblioDefaultView") eq "normal") { + $dat->{dest} = "opac-detail.pl"; + } elsif (C4::Context->preference("BiblioDefaultView") eq "marc") { + $dat->{dest} ="opac-MARCdetail.pl"; + } else { + $dat->{dest} = "opac-ISBDdetail.pl"; + } push (@results, $dat); } diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 1f6adbc8f1..5143248aa0 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -43,16 +43,20 @@ my @options; my $counter=0; foreach my $language (getalllanguages()) { next if $language eq 'images'; + next if $language eq 'CVS'; my $selected='0'; # next if $currently_selected_languages->{$language}; push @options, { language => $language, counter => $counter }; $counter++; } +my $languages_count = @options; +if($languages_count > 1){ + $template->param(languages => \@options); +} $template->param(CGIitemtype => $CGIitemtype, suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), - languages => \@options, textmessaging => $borrower->{textmessaging}, opaclargeimage => C4::Context->preference("opaclargeimage"), kohaversion => $kohaVersion diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 0145b3c4a2..3aa515dfb0 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -97,8 +97,16 @@ if ($op eq "do_search") { } $resultsperpage= $query->param('resultsperpage'); $resultsperpage = 19 if(!defined $resultsperpage); + my $orderby = $query->param('orderby'); my $desc_or_asc = $query->param('desc_or_asc'); + my $exactsearch = $query->param('exact'); + if ($exactsearch) { + warn "EXACT"; + foreach (@operator) { + $_='='; + } + } # builds tag and subfield arrays my @tags; @@ -152,14 +160,14 @@ if ($op eq "do_search") { } my ($results,$total) = catalogsearch($dbh, \@tags,\@and_or, \@excluding, \@operator, \@value, - $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc,$sqlstring, $extratables); + $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}); - } elsif (C4::Context->preference("BiblioDefaultView") eq "MARC") { - print $query->redirect("/cgi-bin/koha/MARCdetail.pl?bib=".@$results[0]->{biblionumber}); + } elsif (C4::Context->preference("BiblioDefaultView") eq "marc") { + print $query->redirect("/cgi-bin/koha/opac-MARCdetail.pl?bib=".@$results[0]->{biblionumber}); } else { - print $query->redirect("/cgi-bin/koha/ISBDdetail.pl?bib=".@$results[0]->{biblionumber}); + print $query->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?bib=".@$results[0]->{biblionumber}); } exit; } @@ -353,13 +361,6 @@ $template->param( phraseorterm => $phraseorterm ); $defaultview => 1, suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), - itemtypelist => $itemtypelist, - subcategorylist => $subcategorylist, - brancheslist => $brancheslist, - categorylist => $categorylist, - mediatypelist => $mediatypelist, - itemtypesstring => $itemtypesstring, - avail => $avail, ); } else { @@ -406,7 +407,8 @@ $template->param( phraseorterm => $phraseorterm ); -multiple => 0 ); $sth->finish; - $template->param(itemtypelist => $itemtypelist, + $template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary")) if (C4::Context->preference("Disable_Dictionary")); + $template->param(classlist => $classlist, CGIitemtype => $CGIitemtype, CGIbranch => $CGIbranch, suggestion => C4::Context->preference("suggestion"), diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 90835a91d2..9fc65536d0 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -5,7 +5,8 @@ use CGI; use Mail::Sendmail; use MIME::QuotedPrint; use MIME::Base64; -use C4::Context; + +use C4::Search; use C4::Biblio; use C4::Auth; use C4::Interface::CGI::Output; @@ -51,7 +52,7 @@ if ($email_add) { $template2->param(biblionumber => $biblionumber); my $dat = &bibdata($biblionumber); - my ($authorcount, $addauthor) = &getaddauthor($biblionumber); + my ($authorcount, $addauthor) = &addauthor($biblionumber); my @items = &ItemInfo(undef, $biblionumber, 'opac'); $dat->{'additional'}=$addauthor->[0]->{'author'}; @@ -69,8 +70,14 @@ if ($email_add) { push (@results, $dat); } - # Getting template result - my $template_res = $template2->output(); + my $resultsarray=\@results; + $template2->param(BIBLIO_RESULTS => $resultsarray, + email_sender => $email_sender); + + # Getting template result + my $template_res = $template2->output(); + my $body; + # Analysing information and getting mail properties if ($template_res =~ /\n(.*)\n/s) { $mail{'subject'} = $1; } else { $mail{'subject'} = "no subject"; } @@ -81,7 +88,7 @@ if ($email_add) { my $email_file = "basket.txt"; if ($template_res =~ /\n(.*)\n/s) { $email_file = $1; } - if ($template_res =~ /\n(.*)\n/s) { $mail{'body'} = $1; } + if ($template_res =~ /\n(.*)\n/s) { $body = $1; } my $boundary = "====" . time() . "===="; # $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; @@ -93,77 +100,34 @@ if ($email_add) { # # Writing mail # $mail{body} = $mail{'content-type'} = "multipart/mixed; boundary=\"$boundary\""; - - my $message = encode_qp( "" ); - -# $file = $^X; # This is the perl executable -# -# open (F, $file) or die "Cannot read $file: $!"; -# binmode F; undef $/; -$mail{body} = encode_base64($iso2709); -# close F; - -$boundary = '--'.$boundary; -$mail{body} = <param(SENT => "1"); $template->param(email_add => $email_add); } else { # do something if it doesnt work.... warn "Error sending mail: $Mail::Sendmail::error \n"; } - - output_html_with_http_headers $query, $cookie, $template->output; + output_html_with_http_headers $query, $cookie, $template->output; } else { $template->param(bib_list => $bib_list); diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 0d417b6d64..bc13b39c2c 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -31,6 +31,10 @@ $borr->{'expiry'} = format_date($borr->{'expiry'}); $borr->{'dateofbirth'} = format_date($borr->{'dateofbirth'}); $borr->{'ethnicity'} = fixEthnicity($borr->{'ethnicity'}); +if($borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'}){ + $borr->{'flagged'} =1; +} + if ($borr->{'amountoutstanding'} > 5) { $borr->{'amountoverfive'} = 1; } diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl index 355a848d3f..961fd1236d 100755 --- a/reports/acquisitions_stats.pl +++ b/reports/acquisitions_stats.pl @@ -307,6 +307,79 @@ sub calculate { $colfilter[0] = @$filters[9] if ($column =~ /sort1/ ) ; $colfilter[0] = @$filters[10] if ($column =~ /sort2/ ) ; #warn "filtre col ".$colfilter[0]." ".$colfilter[1]; + +# 1st, loop rows. + my $linefield; + my $lineorder; + if (($line =~/closedate/) and ($podsp == 1)) { + #Display by day + $linefield .="dayname($line)"; + $lineorder .="weekday($line)"; + } elsif (($line=~/closedate/) and ($podsp == 2)) { + #Display by Month + $linefield .="monthname($line)"; + $lineorder .="month($line)"; + } elsif (($line=~/closedate/) and ($podsp == 3)) { + #Display by Year + $linefield .="Year($line)"; + $lineorder .=$linefield; + } elsif (($line =~/received/) and ($rodsp == 1)) { + #Display by day + $linefield .="dayname($line)"; + $lineorder .="weekday($line)"; + } elsif (($line=~/received/) and ($rodsp == 2)) { + #Display by Month + $linefield .="monthname($line)"; + $lineorder .="month($line)"; + } elsif (($line=~/received/) and ($rodsp == 3)) { + #Display by Year + $linefield .="Year($line)"; + $lineorder .=$linefield; + } else { + $linefield .= $line; + $lineorder .=$linefield; + } + + my $strsth; + $strsth .= "select distinctrow $linefield from aqorders, aqbasket,aqorderbreakdown left join aqorderdelivery on (aqorders.ordernumber =aqorderdelivery.ordernumber ) left join aqbooksellers on (aqbasket.booksellerid=aqbooksellers.id) where (aqorders.basketno=aqbasket.basketno) and (aqorderbreakdown.ordernumber=aqorders.ordernumber) and $line is not null "; + + if ( @linefilter ) { + if ($linefilter[1]){ + if ($linefilter[0]){ + $strsth .= " and $line between ? and ? " ; + } else { + $strsth .= " and $line < ? " ; + } + } elsif (($linefilter[0]) and (($line=~/closedate/) or ($line=~/received/))){ + $strsth .= " and $line > ? " ; + } elsif ($linefilter[0]) { + $linefilter[0] =~ s/\*/%/g; + $strsth .= " and $line LIKE ? " ; + } + } + $strsth .=" group by $linefield"; + $strsth .=" order by $lineorder"; + warn "". $strsth; + + my $sth = $dbh->prepare( $strsth ); + if (( @linefilter ) and ($linefilter[1])){ + $sth->execute("'".$linefilter[0]."'","'".$linefilter[1]."'"); + } elsif ($linefilter[0]) { + $sth->execute($linefilter[0]); + } else { + $sth->execute; + } + + while ( my ($celvalue) = $sth->fetchrow) { + my %cell; + if ($celvalue) { + $cell{rowtitle} = $celvalue; +# } else { +# $cell{rowtitle} = ""; + } + $cell{totalrow} = 0; + push @loopline, \%cell; + } warn "line=$line, podsp=$podsp, rodsp=$rodsp, aodsp=$aodsp\n"; @@ -395,197 +468,176 @@ warn "line=$line, podsp=$podsp, rodsp=$rodsp, aodsp=$aodsp\n"; warn "column=$column, podsp=$podsp, rodsp=$rodsp, aodsp=$aodsp\n"; # 2nd, loop cols. - my $colfield; - if (($column =~/closedate/) and ($podsp == 1)) { - #Display by day - $colfield .="dayname($column)"; - } elsif (($column=~/closedate/) and ($podsp == 2)) { - #Display by Month - $colfield .="monthname($column)"; - } elsif (($column=~/closedate/) and ($podsp == 3)) { - #Display by Year - $colfield .="Year($column)"; - - } elsif (($column =~/deliverydate/) and ($rodsp == 1)) { - #Display by day - $colfield .="dayname($column)"; - } elsif (($column=~/deliverydate/) and ($rodsp == 2)) { - #Display by Month - $colfield .="monthname($column)"; - } elsif (($column=~/deliverydate/) and ($rodsp == 3)) { - #Display by Year - $colfield .="Year($column)"; - - } elsif (($column =~/dateaccessioned/) and ($aodsp == 1)) { - #Display by day - $colfield .="dayname($column)"; - } elsif (($column=~/dateaccessioned/) and ($aodsp == 2)) { - #Display by Month - $colfield .="monthname($column)"; - } elsif (($column=~/dateaccessioned/) and ($aodsp == 3)) { - #Display by Year - $colfield .="Year($column)"; - - } else { - $colfield .= $column; - } - - my $strsth2; - $strsth2 .= "SELECT distinctrow $colfield FROM aqorders, aqbasket,aqorderbreakdown - LEFT JOIN items ON (aqorders.biblioitemnumber= items.biblioitemnumber) - LEFT JOIN biblioitems ON (aqorders.biblioitemnumber= biblioitems.biblioitemnumber) - LEFT JOIN aqorderdelivery ON (aqorders.ordernumber =aqorderdelivery.ordernumber ) - LEFT JOIN aqbooksellers ON (aqbasket.booksellerid=aqbooksellers.id) - WHERE (aqorders.basketno=aqbasket.basketno) AND (aqorderbreakdown.ordernumber=aqorders.ordernumber) - AND $column IS NOT NULL"; - - if ( @colfilter ) { - if ($colfilter[1]){ - if ($colfilter[0]){ - $strsth2 .= " AND $column BETWEEN ? AND ? " ; - } else { - $strsth2 .= " AND $column < ? " ; - } - } elsif (($colfilter[0]) and (($column=~/closedate/) or ($line=~/received/) or ($line=~/acquired/))){ - $strsth2 .= " AND $column > ? " ; - } elsif ($colfilter[0]) { - $colfilter[0] =~ s/\*/%/g; - $strsth2 .= " AND $column LIKE ? " ; - } - } - $strsth2 .=" GROUP BY $colfield"; - $strsth2 .=" ORDER BY $colfield"; -# warn "MASON:. $strsth2"; - - my $sth2 = $dbh->prepare( $strsth2 ); - if (( @colfilter ) and ($colfilter[1])){ -# warn "from : ".$colfilter[0]." To :".$colfilter[1]; - $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); - } elsif ($colfilter[0]) { - $sth2->execute($colfilter[0]); - } else { - $sth2->execute; - } - - while (my ($celvalue) = $sth2->fetchrow) { - my %cell; - if ($celvalue){ -# warn "coltitle :".$celvalue; - $cell{coltitle} = $celvalue; - } - push @loopcol, \%cell; - } -# warn "fin des titres colonnes"; - - my $i=0; - my @totalcol; - my $hilighted=-1; - - #Initialization of cell values..... - my %table; -# warn "init table"; - foreach my $row ( @loopline ) { - foreach my $col ( @loopcol ) { -# warn " init table : $row->{rowtitle} / $col->{coltitle} "; - $table{$row->{rowtitle}}->{$col->{coltitle}}=0; - } - $table{$row->{rowtitle}}->{totalrow}=0; - } + my $colfield; + my $colorder; + if (($column =~/closedate/) and ($podsp == 1)) { + #Display by day + $colfield .="dayname($column)"; + $colorder .="weekday($column)"; + } elsif (($column=~/closedate/) and ($podsp == 2)) { + #Display by Month + $colfield .="monthname($column)"; + $colorder .="month($column)"; + } elsif (($column=~/closedate/) and ($podsp == 3)) { + #Display by Year + $colfield .="Year($column)"; + $colorder .= $colfield; + } elsif (($column =~/received/) and ($rodsp == 1)) { + #Display by day + $colfield .="dayname($column)"; + $colorder .="weekday($column)"; + } elsif (($column=~/received/) and ($rodsp == 2)) { + #Display by Month + $colfield .="monthname($column)"; + $colorder .="month($column)"; + } elsif (($column=~/received/) and ($rodsp == 3)) { + #Display by Year + $colfield .="Year($column)"; + $colorder .= $colfield; + } else { + $colfield .= $column; + $colorder .= $colfield; + } + + my $strsth2; + $strsth2 .= "select distinctrow $colfield from aqorders, aqbasket,aqorderbreakdown left join aqorderdelivery on (aqorders.ordernumber =aqorderdelivery.ordernumber ) left join aqbooksellers on (aqbasket.booksellerid=aqbooksellers.id) where (aqorders.basketno=aqbasket.basketno) and (aqorderbreakdown.ordernumber=aqorders.ordernumber) and $column is not null "; + + if ( @colfilter ) { + if ($colfilter[1]){ + if ($colfilter[0]){ + $strsth2 .= " and $column between ? and ? " ; + } else { + $strsth2 .= " and $column < ? " ; + } + } elsif (($colfilter[0]) and (($column=~/closedate/) or ($column=~/received/))){ + $strsth2 .= " and $column > ? " ; + } elsif ($colfilter[0]) { + $colfilter[0] =~ s/\*/%/g; + $strsth2 .= " and $column LIKE ? " ; + } + } + $strsth2 .=" group by $colfield"; + $strsth2 .=" order by $colorder"; + warn "". $strsth2; + + my $sth2 = $dbh->prepare( $strsth2 ); + if (( @colfilter ) and ($colfilter[1])){ + warn "from : ".$colfilter[0]." To :".$colfilter[1]; + $sth2->execute("'".$colfilter[0]."'","'".$colfilter[1]."'"); + } elsif ($colfilter[0]) { + $sth2->execute($colfilter[0]); + } else { + $sth2->execute; + } + + while (my ($celvalue) = $sth2->fetchrow) { + my %cell; + if ($celvalue){ +# warn "coltitle :".$celvalue; + $cell{coltitle} = $celvalue; + } + push @loopcol, \%cell; + } +# warn "fin des titres colonnes"; + + my $i=0; + my @totalcol; + my $hilighted=-1; + + #Initialization of cell values..... + my %table; +# warn "init table"; + foreach my $row ( @loopline ) { + foreach my $col ( @loopcol ) { +# warn " init table : $row->{rowtitle} / $col->{coltitle} "; + $table{$row->{rowtitle}}->{$col->{coltitle}}=0; + } + $table{$row->{rowtitle}}->{totalrow}=0; + } # preparing calculation - my $strcalc ; - $strcalc .= "SELECT $linefield, $colfield, "; - $strcalc .= "COUNT( aqorders.ordernumber ) " if ($process ==1); - $strcalc .= "SUM( aqorders.quantity * aqorders.listprice ) " if ($process ==2); - $strcalc .= "FROM aqorders, aqbasket,aqorderbreakdown - LEFT JOIN items ON (aqorders.biblioitemnumber= items.biblioitemnumber) - LEFT JOIN biblioitems ON (aqorders.biblioitemnumber= biblioitems.biblioitemnumber) - LEFT JOIN aqorderdelivery ON (aqorders.ordernumber =aqorderdelivery.ordernumber ) - LEFT JOIN aqbooksellers ON (aqbasket.booksellerid=aqbooksellers.id) WHERE (aqorders.basketno=aqbasket.basketno) - AND (aqorderbreakdown.ordernumber=aqorders.ordernumber) "; - - @$filters[0]=~ s/\*/%/g if (@$filters[0]); - $strcalc .= " AND aqbasket.closedate > '" . @$filters[0] ."'" if ( @$filters[0] ); - @$filters[1]=~ s/\*/%/g if (@$filters[1]); - $strcalc .= " AND aqbasket.closedate < '" . @$filters[1] ."'" if ( @$filters[1] ); - @$filters[2]=~ s/\*/%/g if (@$filters[2]); - $strcalc .= " AND aqorderdelivery.deliverydate > '" . @$filters[2] ."'" if ( @$filters[2] ); - @$filters[3]=~ s/\*/%/g if (@$filters[3]); - $strcalc .= " AND aqorderdelivery.deliverydate < '" . @$filters[3] ."'" if ( @$filters[3] ); - @$filters[4]=~ s/\*/%/g if (@$filters[4]); - $strcalc .= " AND aqbasket.closedate > '" . @$filters[4] ."'" if ( @$filters[4] ); - @$filters[5]=~ s/\*/%/g if (@$filters[5]); - $strcalc .= " AND aqbasket.closedate < '" . @$filters[5] ."'" if ( @$filters[5] ); - @$filters[6]=~ s/\*/%/g if (@$filters[6]); - $strcalc .= " AND aqbooksellers.name LIKE '" . @$filters[6] ."'" if ( @$filters[6] ); - @$filters[7]=~ s/\*/%/g if (@$filters[7]); - $strcalc .= " AND biblioitems.itemtype LIKE '" . @$filters[7] ."'" if ( @$filters[7] ); - @$filters[8]=~ s/\*/%/g if (@$filters[8]); - $strcalc .= " AND aqbookfund.bookfundid LIKE '" . @$filters[8] ."'" if ( @$filters[8] ); - @$filters[9]=~ s/\*/%/g if (@$filters[9]); - $strcalc .= " AND aqorders.sort1 LIKE '" . @$filters[9] ."'" if ( @$filters[9] ); - @$filters[10]=~ s/\*/%/g if (@$filters[10]); - $strcalc .= " AND aqorders.sort2 LIKE '" . @$filters[10] ."'" if ( @$filters[10] ); - $strcalc .= " GROUP BY $linefield, $colfield ORDER BY $linefield,$colfield"; -# warn "/n/n". $strcalc; - my $dbcalc = $dbh->prepare($strcalc); - $dbcalc->execute; - -# warn "filling table"; - my $emptycol; - while (my ($row, $col, $value) = $dbcalc->fetchrow) { -# warn "filling table $row / $col / $value "; - $emptycol = 1 if ($col eq undef); - $col = "zzEMPTY" if ($col eq undef); - $row = "zzEMPTY" if ($row eq undef); - - $table{$row}->{$col}+=$value; - $table{$row}->{totalrow}+=$value; - $grantotal += $value; - } - - push @loopcol,{coltitle => "NULL"} if ($emptycol); - - foreach my $row ( sort keys %table ) { - my @loopcell; - #@loopcol ensures the order for columns is common with column titles - # and the number matches the number of columns - foreach my $col ( @loopcol ) { - my $value =$table{$row}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; - push @loopcell, {value => $value } ; - } - push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row, - 'loopcell' => \@loopcell, - 'hilighted' => ($hilighted >0), - 'totalrow' => $table{$row}->{totalrow} - }; - $hilighted = -$hilighted; - } - -# warn "footer processing"; - foreach my $col ( @loopcol ) { - my $total=0; - foreach my $row ( @looprow ) { - $total += $table{($row->{rowtitle} eq "NULL")?"zzEMPTY":$row->{rowtitle}}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; -# warn "value added ".$table{$row->{rowtitle}}->{$col->{coltitle}}. "for line ".$row->{rowtitle}; - } -# warn "summ for column ".$col->{coltitle}." = ".$total; - push @loopfooter, {'totalcol' => $total}; - } - - - # the header of the table -# $globalline{loopfilter}=\@loopfilter; - # the core of the table - $globalline{looprow} = \@looprow; - $globalline{loopcol} = \@loopcol; -# # the foot (totals by borrower type) - $globalline{loopfooter} = \@loopfooter; - $globalline{total}= $grantotal; - $globalline{line} = $line; - $globalline{column} = $column; - push @mainloop,\%globalline; - return \@mainloop; + my $strcalc ; + $strcalc .= "SELECT $linefield, $colfield, "; + $strcalc .= "COUNT( aqorders.ordernumber ) " if ($process ==1); + $strcalc .= "SUM( aqorders.quantity * aqorders.listprice ) " if ($process ==2); + $strcalc .= "FROM aqorders, aqbasket,aqorderbreakdown left join aqorderdelivery on (aqorders.ordernumber =aqorderdelivery.ordernumber ) left join aqbooksellers on (aqbasket.booksellerid=aqbooksellers.id) where (aqorders.basketno=aqbasket.basketno) and (aqorderbreakdown.ordernumber=aqorders.ordernumber) "; + + @$filters[0]=~ s/\*/%/g if (@$filters[0]); + $strcalc .= " AND aqbasket.closedate > '" . @$filters[0] ."'" if ( @$filters[0] ); + @$filters[1]=~ s/\*/%/g if (@$filters[1]); + $strcalc .= " AND aqbasket.closedate < '" . @$filters[1] ."'" if ( @$filters[1] ); + @$filters[2]=~ s/\*/%/g if (@$filters[2]); + $strcalc .= " AND aqorderdelivery.deliverydate > '" . @$filters[2] ."'" if ( @$filters[2] ); + @$filters[3]=~ s/\*/%/g if (@$filters[3]); + $strcalc .= " AND aqorderdelivery.deliverydate < '" . @$filters[3] ."'" if ( @$filters[3] ); + @$filters[4]=~ s/\*/%/g if (@$filters[4]); + $strcalc .= " AND aqbooksellers.name like '" . @$filters[4] ."'" if ( @$filters[4] ); + @$filters[5]=~ s/\*/%/g if (@$filters[5]); + $strcalc .= " AND aqbookfund.bookfundid like '" . @$filters[5] ."'" if ( @$filters[5] ); + @$filters[6]=~ s/\*/%/g if (@$filters[6]); + $strcalc .= " AND aqorders.sort1 like '" . @$filters[6] ."'" if ( @$filters[6] ); + @$filters[7]=~ s/\*/%/g if (@$filters[7]); + $strcalc .= " AND aqorders.sort2 like '" . @$filters[7] ."'" if ( @$filters[7] ); + $strcalc .= " group by $linefield, $colfield order by $lineorder,$colorder"; + warn "". $strcalc; + my $dbcalc = $dbh->prepare($strcalc); + $dbcalc->execute; + +# warn "filling table"; + my $emptycol; + while (my ($row, $col, $value) = $dbcalc->fetchrow) { +# warn "filling table $row / $col / $value "; + $emptycol = 1 if ($col eq undef); + $col = "zzEMPTY" if ($col eq undef); + $row = "zzEMPTY" if ($row eq undef); + + $table{$row}->{$col}+=$value; + $table{$row}->{totalrow}+=$value; + $grantotal += $value; + } + + push @loopcol,{coltitle => "NULL"} if ($emptycol); + + foreach my $row ( sort keys %table ) { + my @loopcell; + #@loopcol ensures the order for columns is common with column titles + # and the number matches the number of columns + foreach my $col ( @loopcol ) { + my $value =$table{$row}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; + push @loopcell, {value => $value } ; + } + push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row, + 'loopcell' => \@loopcell, + 'hilighted' => ($hilighted >0), + 'totalrow' => $table{$row}->{totalrow} + }; + $hilighted = -$hilighted; + } + +# warn "footer processing"; + foreach my $col ( @loopcol ) { + my $total=0; + foreach my $row ( @looprow ) { + $total += $table{($row->{rowtitle} eq "NULL")?"zzEMPTY":$row->{rowtitle}}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}}; +# warn "value added ".$table{$row->{rowtitle}}->{$col->{coltitle}}. "for line ".$row->{rowtitle}; + } +# warn "summ for column ".$col->{coltitle}." = ".$total; + push @loopfooter, {'totalcol' => $total}; + } + + + # the header of the table + $globalline{loopfilter}=\@loopfilter; + # the core of the table + $globalline{looprow} = \@looprow; + $globalline{loopcol} = \@loopcol; +# # the foot (totals by borrower type) + $globalline{loopfooter} = \@loopfooter; + $globalline{total}= $grantotal; + $globalline{line} = $line; + $globalline{column} = $column; + push @mainloop,\%globalline; + return \@mainloop; } 1; diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl index 1d05600ab0..e7f1294992 100755 --- a/reports/borrowers_stats.pl +++ b/reports/borrowers_stats.pl @@ -27,6 +27,7 @@ use HTML::Template; use C4::Search; use C4::Output; use C4::Koha; +use C4::Acquisition; use C4::Interface::CGI::Output; use C4::Circulation::Circ2; @@ -121,6 +122,22 @@ if ($do_it) { -size => 1, -multiple => 0 ); + 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 => 'pickup', + -values => \@select_branch, + -labels => \%select_branches, + -size => 1, + -multiple => 0 ); + $req = $dbh->prepare( "select distinctrow sort1 from borrowers order by sort1"); $req->execute; my @select_sort1; @@ -180,7 +197,8 @@ if ($do_it) { CGISort2 => $CGIsort2, hassort2 => $hassort2, CGIextChoice => $CGIextChoice, - CGIsepChoice => $CGIsepChoice + CGIsepChoice => $CGIsepChoice, + CGIBranch => $CGIbranch ); } @@ -209,14 +227,16 @@ sub calculate { $linefilter = @$filters[0] if ($line =~ /categorycode/ ) ; $linefilter = @$filters[1] if ($line =~ /zipcode/ ) ; - $linefilter = @$filters[2] if ($line =~ /sort1/ ) ; - $linefilter = @$filters[3] if ($line =~ /sort2/ ) ; + $linefilter = @$filters[2] if ($line =~ /branccode/ ) ; + $linefilter = @$filters[3] if ($line =~ /sort1/ ) ; + $linefilter = @$filters[4] if ($line =~ /sort2/ ) ; # my $colfilter = ""; $colfilter = @$filters[0] if ($column =~ /categorycode/); $colfilter = @$filters[1] if ($column =~ /zipcode/); - $colfilter = @$filters[2] if ($column =~ /sort1/); - $colfilter = @$filters[3] if ($column =~ /sort2/); + $colfilter = @$filters[2] if ($column =~ /branchcode/); + $colfilter = @$filters[3] if ($column =~ /sort1/); + $colfilter = @$filters[4] if ($column =~ /sort2/); my @loopfilter; for (my $i=0;$i<=3;$i++) { @@ -225,8 +245,9 @@ sub calculate { $cell{filter} .= @$filters[$i]; $cell{crit} .="Cat Code " if ($i==0); $cell{crit} .="Zip Code" if ($i==1); - $cell{crit} .="Sort1" if ($i==2); - $cell{crit} .="Sort2" if ($i==3); + $cell{crit} .="Branchcode" if ($i==2); + $cell{crit} .="Sort1" if ($i==3); + $cell{crit} .="Sort2" if ($i==4); push @loopfilter, \%cell; } } diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index dbbfbf65ca..a40d5c893e 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -220,7 +220,7 @@ if ($do_it) { $req->execute; undef @select; push @select,""; - my $CGIholdingbranch=CGI::scrolling_list( -name => 'Filter', + my $CGIlocation=CGI::scrolling_list( -name => 'Filter', -id => 'holdingbranch', -values => \@select, -size => 1, @@ -332,8 +332,8 @@ sub calculate { $linefilter[0] = @$filters[7] if ($line =~ /publishercode/ ) ; $linefilter[0] = @$filters[8] if ($line =~ /publicationyear/ ) ; $linefilter[1] = @$filters[9] if ($line =~ /publicationyear/ ) ; - $linefilter[0] = @$filters[10] if ($line =~ /items.homebranch/ ) ; - $linefilter[0] = @$filters[11] if ($line =~ /items.holdingbranch/ ) ; + @linefilter[0] = @$filters[10] if ($line =~ /items.homebranch/ ) ; + @linefilter[0] = @$filters[11] if ($line =~ /items.holdingbranch/ ) ; # my @colfilter ; $colfilter[0] = @$filters[0] if ($column =~ /dewey/ ) ; @@ -346,8 +346,8 @@ sub calculate { $colfilter[0] = @$filters[7] if ($column =~ /publishercode/ ) ; $colfilter[0] = @$filters[8] if ($column =~ /publicationyear/ ) ; $colfilter[1] = @$filters[9] if ($column =~ /publicationyear/ ) ; - $colfilter[0] = @$filters[10] if ($column =~ /items.homebranch/ ) ; - $colfilter[0] = @$filters[11] if ($column =~ /items.holdingbranch/ ) ; + @colfilter[0] = @$filters[10] if ($column =~ /items.homebranch/ ) ; + @colfilter[0] = @$filters[11] if ($column =~ /items.holdingbranch/ ) ; # 1st, loop rows. my $linefield; @@ -506,7 +506,11 @@ sub calculate { } if (@$filters[11]){ @$filters[11]=~ s/\*/%/g; - $strcalc .= " AND items.holdingbranch like '" . @$filters[11] ."'" if ( @$filters[11] ); + if ($cond){ + $strcalc .= " AND items.holdingbranch like '" . @$filters[11] ."'" if ( @$filters[11] ); + } else { + $strcalc .= " WHERE items.holdingbranch like '" . @$filters[11] ."'" if ( @$filters[11] ); + } } $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; diff --git a/reports/issues_by_borrower_category.plugin b/reports/issues_by_borrower_category.plugin index c767bb833e..80cd0a30a2 100644 --- a/reports/issues_by_borrower_category.plugin +++ b/reports/issues_by_borrower_category.plugin @@ -100,13 +100,15 @@ sub calculate { $itemtypes{$itemtype}->{total} = 0; } # now, parse each category. Before filling the result array, fill it with 0 to have every itemtype column. - my $sth = $dbh->prepare("SELECT itemtype, count( * ) + my $strsth="SELECT itemtype, count( * ) FROM issues, borrowers, biblioitems, items WHERE issues.borrowernumber = borrowers.borrowernumber AND items.itemnumber = issues.itemnumber AND biblioitems.biblionumber = items.biblionumber - AND borrowers.categorycode = ? - GROUP BY biblioitems.itemtype"); + AND borrowers.categorycode = ?"; + $strsth.= " AND borrowers.branchcode = ".$dbh->quote($branch) if ($branch); + $strsth .= " GROUP BY biblioitems.itemtype"; + my $sth = $dbh->prepare($strsth); my $sthcategories = $dbh->prepare("select categorycode,description from categories"); $sthcategories->execute; my %borrowertype; diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index c7229e9d64..59edac2371 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -453,10 +453,13 @@ sub calculate { $strcalc .= "(COUNT(DISTINCT borrowers.borrowernumber))" ; } if ($process ==3){ + $strcalc .= "(COUNT(DISTINCT itemnumber))" ; + } + if ($process ==4){ my $rqbookcount = $dbh->prepare("SELECT count(*) FROM items"); $rqbookcount->execute; my ($bookcount) = $rqbookcount->fetchrow; - $strcalc .= "100*(COUNT(itemnumber))/ $bookcount " ; + $strcalc .= "100*(COUNT(DISTINCT itemnumber))/ $bookcount " ; } $strcalc .= "FROM statistics,borrowers where (statistics.borrowernumber=borrowers.borrowernumber) "; diff --git a/search.marc/search.pl b/search.marc/search.pl index 6d0d88fba6..ddb75f658e 100755 --- a/search.marc/search.pl +++ b/search.marc/search.pl @@ -24,7 +24,7 @@ use CGI; use C4::Auth; use HTML::Template; use C4::Context; -use C4::Search; +# use C4::Search; use C4::Auth; use C4::Output; use C4::Interface::CGI::Output; @@ -92,7 +92,7 @@ sub create_scrolling_list { my $query=new CGI; my $type=$query->param('type'); -my $op = $query->param('op'); +my $op = $query->param('op') || ""; my $dbh = C4::Context->dbh; my $startfrom=$query->param('startfrom'); @@ -364,6 +364,7 @@ else { $sth->finish; + $template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary")) if (C4::Context->preference("Disable_Dictionary")); $template->param("statements" => \@statements, "nbstatements" => 3, CGIitemtype => $CGIitemtype, diff --git a/updater/updatedatabase b/updater/updatedatabase index 3284285a6f..2325c3a050 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -155,6 +155,120 @@ my %tabledata = ( explanation => 'If Yes, Returndate on issuing can\'t be after borrower card expiry', type => 'YesNo', }, + { + uniquefieldrequired => 'variable', + variable => 'opacstylesheet', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter a complete URL to use an alternate stylesheet in OPAC', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'opacsmallimage', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter a complete URL to an image, will be on top/left instead of the Koha logo', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'opaclargeimage', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter a complete URL to an image, will be on the main page, instead of the Koha logo', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'delimiter', + value => ';', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'separator for reports exported to spreadsheet', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'MIME', + value => 'OPENOFFICE.ORG', + forceupdate => { 'explanation' => 1, + 'type' => 1, + 'options' => 1}, + explanation => 'Define the default application for report exportations into files', + type => 'Choice', + options => 'EXCEL|OPENOFFICE.ORG' + }, + { + uniquefieldrequired => 'variable', + variable => 'Delimiter', + value => ';', + forceupdate => { 'explanation' => 1, + 'type' => 1, + 'options' => 1}, + explanation => 'Define the default separator character for report exportations into files', + type => 'Choice', + options => ';|tabulation|,|/|\|#' + }, + { + uniquefieldrequired => 'variable', + variable => 'SubscriptionHistory', + value => ';', + forceupdate => { 'explanation' => 1, + 'type' => 1, + 'options' => 1}, + explanation => 'Define the information level for serials history in OPAC', + type => 'Choice', + options => 'simplified|full' + }, + { + uniquefieldrequired => 'variable', + variable => 'hidelostitems', + value => 'No', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'show or hide "lost" items in OPAC.', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'IndependantBranches', + value => '0', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Turn Branch independancy management On an Off', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'ReturnBeforeExpiry', + value => '0', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'If Yes, Returndate on issuing can\'t be after borrower card expiry', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'Disable_Dictionary', + value => '0', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Disables Dictionary buttons if set to yes', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'hide_marc', + value => '0', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'hide marc specific datas like subfield code & indicators to library', + type => 'YesNo', + }, ], ); @@ -268,6 +382,7 @@ foreach $table ( keys %fielddefinitions ) { { $definitions->{$column}->{type} = $type; $definitions->{$column}->{null} = $null; + $definitions->{$column}->{null} = 'NULL' if $null eq 'YES'; $definitions->{$column}->{key} = $key; $definitions->{$column}->{default} = $default; $definitions->{$column}->{extra} = $extra; @@ -280,16 +395,16 @@ foreach $table ( keys %fielddefinitions ) { # $null = 'YES' if $row->{null} eq 'NULL'; my $key = $row->{key}; my $default = $row->{default}; - $default="''" unless $default; + my $null = $row->{null}; +# $default="''" unless $default; my $extra = $row->{extra}; my $def = $definitions->{$field}; + unless ( $type eq $def->{type} && $null eq $def->{null} && $key eq $def->{key} - && $default eq $def->{default} && $extra eq $def->{extra} ) { - if ( $null eq '' ) { $null = 'NOT NULL'; } @@ -299,6 +414,7 @@ foreach $table ( keys %fielddefinitions ) { unless ( $extra eq 'auto_increment' ) { $extra = ''; } + # if it's a new column use "add", if it's an old one, use "change". my $action; if ($definitions->{$field}->{type}) { @@ -621,6 +737,12 @@ sub MARCgetitem { exit; # $Log$ +# Revision 1.123 2005/10/26 09:13:37 tipaul +# big commit, still breaking things... +# +# * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. +# * code cleaning (cleaning warnings from perl -w) continued +# # Revision 1.122 2005/09/02 14:18:38 tipaul # new feature : image for itemtypes. # diff --git a/value_builder/labs_theses.pl b/value_builder/labs_theses.pl new file mode 100644 index 0000000000..2ed6da98be --- /dev/null +++ b/value_builder/labs_theses.pl @@ -0,0 +1,186 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +use strict; +require Exporter; +use CGI; +use HTML::Template; +use C4::Interface::CGI::Output; +use C4::Context; +use C4::Auth; +use C4::Output; +use C4::Database; +use C4::Koha; + +sub plugin_parameters { +my ($dbh,$record,$tagslib,$i,$tabloop) = @_; +return ""; +} + +sub plugin_javascript { +my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; +my $function_name= "328".(int(rand(100000))+1); +my $res=" + +"; + +return ($function_name,$res); +} + +sub plugin { + my ($input) = @_; + my %env; + + + my $dbh=C4::Context->dbh; + my $query = new CGI; + my $op = $query->param('op'); + my $cat_auth=$query->param('cat_auth'); + + my $startfrom=$query->param('startfrom'); + $startfrom=0 if(!defined $startfrom); + my ($template, $loggedinuser, $cookie); + my $resultsperpage; + my $search = $query->param('search'); + + if ($op eq "do_search") { + + $resultsperpage= $query->param('resultsperpage'); + $resultsperpage = 19 if(!defined $resultsperpage); +# my $upperlimit=$startfrom+$resultsperpage; + # builds tag and subfield arrays + my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?"; +# $strquery .= " LIMIT $startfrom,$upperlimit"; + + warn 'category : '.$cat_auth.' recherche :'.$search; + warn "$strquery"; + $search=~s/\*/%/g; + my $sth = $dbh->prepare($strquery); + $sth->execute($cat_auth,$search); + $search=~s/%/\*/g; + + + my @results; + my $total; + while (my $data = $sth->fetchrow_hashref){ + my $libjs=$data->{'lib'}; + $libjs=~s#\'#\\\'#g; + my $authjs=$data->{'authorised_value'}; + $authjs=~s#\'#\\\'#g; + push @results, {'libjs'=>$libjs, + 'lib'=>$data->{'lib'}, + 'authjs'=>$authjs, + 'auth_value'=>$data->{'authorised_value'}} + unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage)); + $total++; + } + + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/labs_theses.tmpl", + query => $query, + type => 'intranet', + authnotrequired => 1, + debug => 1, + }); + + # multi page display gestion + my $displaynext=0; + my $displayprev=$startfrom; + if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){ + $displaynext = 1; + } + + my @numbers = (); + + if ($total>$resultsperpage) + { + for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++) + { + my $highlight=0; + ($startfrom==($i-1)) && ($highlight=1); + push @numbers, { number => $i, + highlight => $highlight , + search=> $search, + startfrom => $resultsperpage*($i-1)}; + } + } + + my $from = $startfrom+1; + my $to; + + if($total < (($startfrom+1)*$resultsperpage)) + { + $to = $total; + } else { + $to = (($startfrom+1)*$resultsperpage); + } + $template->param(catresult => \@results, + cat_auth=>$cat_auth, + index => $query->param('index')."", + startfrom=> $startfrom, + displaynext=> $displaynext, + displayprev=> $displayprev, + resultsperpage => $resultsperpage, + startfromnext => $startfrom+$resultsperpage, + startfromprev => $startfrom-$resultsperpage, + search=>$search, + total=>$total, + from=>$from, + to=>$to, + numbers=>\@numbers, + resultlist=>1 + ); + + } else { + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/labs_theses.tmpl", + query => $query, + type => "intranet", + authnotrequired => 1, + }); + + $template->param( + 'search'=>$query->param('search'), + ); + $template->param( + 'index'=>''.$query->param('index') + ) if ($query->param('index')); + warn 'index : '.$query->param('index'); + $template->param( + 'cat_auth'=>$cat_auth + ) if ($cat_auth); + } + output_html_with_http_headers $query, $cookie, $template->output ; +} + +1; diff --git a/value_builder/unimarc_field_100.pl b/value_builder/unimarc_field_100.pl index 4dfe4d2c39..a8fa419f64 100755 --- a/value_builder/unimarc_field_100.pl +++ b/value_builder/unimarc_field_100.pl @@ -79,6 +79,7 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {parameters => 1}, debug => 1, }); + $result=' d u y0frey03 ba' unless $result; my $f1 = substr($result,0,8); my $f2 = substr($result,8,1); my $f3 = substr($result,9,4); diff --git a/value_builder/unimarc_field_210c.pl b/value_builder/unimarc_field_210c.pl index d42e498860..4614b5b2e9 100644 --- a/value_builder/unimarc_field_210c.pl +++ b/value_builder/unimarc_field_210c.pl @@ -107,7 +107,7 @@ function Blur$function_name(subfield_managed) { function Clic$function_name(subfield_managed) { defaultvalue=escape(document.forms[0].field_value[subfield_managed].value); - newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&index=\"+subfield_managed,\"unimarc 225a\",'width=500,height=600,toolbar=false,scrollbars=no'); + newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&index=\"+subfield_managed,\"unimarc 225a\",'width=500,height=600,toolbar=false,scrollbars=yes'); } "; diff --git a/z3950/z3950-daemon-launch.sh b/z3950/z3950-daemon-launch.sh index 621ba86ae5..cbb4ed0042 100755 --- a/z3950/z3950-daemon-launch.sh +++ b/z3950/z3950-daemon-launch.sh @@ -32,15 +32,20 @@ then exit 1 fi -#MJR: removed -s option, as we have a #! at the start of z3950-daemon-shell.sh su -c $KohaZ3950Shell - $RunAsUser & exit #-------------- # $Log$ -# Revision 1.5 2005/06/20 17:05:17 slef -# Removed -s from su call after Thomas D reports it breaks FreeBSD +# Revision 1.6 2005/10/26 09:13:54 tipaul +# big commit, still breaking things... +# +# * synch with rel_2_2. Probably the last non manual synch, as rel_2_2 should not be modified deeply. +# * code cleaning (cleaning warnings from perl -w) continued +# +# Revision 1.4.4.1 2005/06/27 23:10:55 hdl +# Removing -s from su call after Thomas D reports it breaks FreeBSD # # Revision 1.4 2003/11/05 23:33:45 slef # Now figures out what directory the scripts are in -- 2.39.5