From cc9524a875d8b032a40fa943de3973d4c93854bf Mon Sep 17 00:00:00 2001 From: toins Date: Tue, 4 Jul 2006 14:36:51 +0000 Subject: [PATCH] Head & rel_2_2 merged --- C4/Acquisition.pm | 111 +- C4/Auth.pm | 6 +- C4/AuthoritiesMarc.pm | 398 +++-- C4/Biblio.pm | 15 + C4/Bull.pm | 259 ++- C4/Context.pm | 7 +- C4/Input.pm | 2 +- C4/Members.pm | 3 +- C4/Output.pm | 1 + C4/SearchMarc.pm | 37 +- C4/Suggestions.pm | 14 +- admin/aqbookfund.pl | 5 +- admin/aqbudget.pl | 5 +- admin/auth_subfields_structure.pl | 7 +- admin/auth_tag_structure.pl | 18 +- admin/authorised_values.pl | 6 +- admin/authtypes.pl | 4 + admin/biblio_framework.pl | 4 + admin/branches.pl | 5 +- admin/categorie.pl | 5 +- admin/categoryitem.pl | 5 +- admin/checkmarc.pl | 6 +- admin/currency.pl | 5 +- admin/issuingrules.pl | 6 +- admin/itemtypes.pl | 4 + admin/koha2marclinks.pl | 17 +- admin/marc_subfields_structure.pl | 35 +- admin/marctagstructure.pl | 9 +- admin/printers.pl | 5 +- admin/thesaurus.pl | 7 +- admin/z3950servers.pl | 5 +- authorities/auth_finder.pl | 10 +- authorities/authorities-home.pl | 8 +- authorities/authorities.pl | 7 +- authorities/blinddetail-biblio-search.pl | 8 +- authorities/detail-biblio-search.pl | 6 +- authorities/detail.pl | 12 +- barcodes/barcodes.pl | 6 +- barcodes/printerConfig.pl | 6 +- bookshelves/addbookbybiblionumber.pl | 20 + bookshelves/shelves.pl | 20 +- circ/branchtransfers.pl | 5 +- circ/reserve.pl | 10 +- circ/returns.pl | 11 +- circ/selectbranchprinter.pl | 5 +- export/marc.pl | 11 +- import/breeding.pl | 13 +- maint/catmaintain.pl | 6 +- members/deletemem.pl | 4 + members/member-flags.pl | 6 +- members/member-password.pl | 6 +- members/member.pl | 8 +- members/memberentry.pl | 1 + members/members-home.pl | 5 +- members/moremember.pl | 11 +- members/setdebar.pl | 1 - misc/Install.pm | 12 + opac/opac-MARCdetail.pl | 12 +- opac/opac-addbookbybiblionumber.pl | 4 + opac/opac-dictionary.pl | 5 +- opac/opac-main.pl | 4 +- opac/opac-moredetail.pl | 2 +- opac/opac-passwd.pl | 4 + opac/opac-search.pl | 8 +- opac/opac-searchresults.pl | 3 - opac/opac-suggestions.pl | 29 +- reports/acquisitions_stats.pl | 24 +- reports/bor_issues_top.pl | 8 +- reports/borrowers_out.pl | 8 +- reports/borrowers_stats.pl | 3 +- reports/cat_issues_top.pl | 8 +- reports/catalogue_out.pl | 8 +- reports/inventory.pl | 71 +- reports/issues_avg_stats.pl | 8 +- reports/issues_stats.pl | 8 +- reports/manager.pl | 6 +- reports/reports-home.pl | 4 + search.marc/dictionary.pl | 10 +- search.marc/search.pl | 30 +- search.marc/suggest.pl | 6 +- suggestion/acceptorreject.pl | 5 +- updater/updatedatabase | 2014 ++++++++++++++++++++-- value_builder/marc21_leader.pl | 12 +- value_builder/unimarc_field_4XX.pl | 4 +- z3950/processz3950queue | 23 +- z3950/search.pl | 5 +- 86 files changed, 3028 insertions(+), 542 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 09c47d0b97..3854177def 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -670,7 +670,48 @@ sub getparcelinformation { return ( scalar(@results), @results ); } +=item getparcelinformation + + ($count, @results) = &getparcelinformation($booksellerid, $code, $date); + +Looks up all of the received items from the supplier with the given +bookseller ID at the given date, for the given code. Ignores cancelled and completed orders. + +C<$count> is the number of elements in C<@results>. C<@results> is an +array of references-to-hash. The keys of each element are fields from +the aqorders, biblio, and biblioitems tables of the Koha database. +C<@results> is sorted alphabetically by book title. + +=cut +#' +sub getparcelinformation { + #gets all orders from a certain supplier, orders them alphabetically + my ($supplierid,$code, $datereceived)=@_; + my $dbh = C4::Context->dbh; + my @results = (); + $code .='%' if $code; # add % if we search on a given code (otherwise, let him empty) + my $strsth ="Select authorisedby,creationdate,aqbasket.basketno,closedate,surname,firstname,aqorders.biblionumber,aqorders.title,aqorders.ordernumber, aqorders.quantity, aqorders.quantityreceived, aqorders.unitprice, aqorders.listprice, aqorders.rrp, aqorders.ecost from aqorders,aqbasket left join borrowers on aqbasket.authorisedby=borrowers.borrowernumber where aqbasket.basketno=aqorders.basketno and aqbasket.booksellerid=? and aqorders.booksellerinvoicenumber like \"$code\" and aqorders.datereceived= \'$datereceived\'"; + + if (C4::Context->preference("IndependantBranches")) { + my $userenv = C4::Context->userenv; + if (($userenv) &&($userenv->{flags} != 1)){ + $strsth .= " and (borrowers.branchcode = '".$userenv->{branch}."' or borrowers.branchcode ='')"; + } + } + $strsth.=" order by aqbasket.basketno"; + ### parcelinformation : $strsth + my $sth=$dbh->prepare($strsth); + $sth->execute($supplierid); + while (my $data=$sth->fetchrow_hashref){ + push(@results,$data); + } + my $count =scalar(@results); + ### countparcelbiblio: $count + $sth->finish; + + return(scalar(@results),@results); +} =item getsupplierlistwithlateorders %results = &getsupplierlistwithlateorders; @@ -1328,26 +1369,18 @@ sub updatesup { contemail=?,contnotes=?,active=?, listprice=?, invoiceprice=?,gstreg=?, listincgst=?, invoiceincgst=?, specialty=?,discount=?,invoicedisc=?, - nocalc=? - where id=?" - ); - $sth->execute( - $data->{'name'}, $data->{'address1'}, - $data->{'address2'}, $data->{'address3'}, - $data->{'address4'}, $data->{'postal'}, - $data->{'phone'}, $data->{'fax'}, - $data->{'url'}, $data->{'contact'}, - $data->{'contpos'}, $data->{'contphone'}, - $data->{'contfax'}, $data->{'contaltphone'}, - $data->{'contemail'}, $data->{'contnote'}, - $data->{'active'}, $data->{'listprice'}, - $data->{'invoiceprice'}, $data->{'gstreg'}, - $data->{'listincgst'}, $data->{'invoiceincgst'}, - $data->{'specialty'}, $data->{'discount'}, - $data->{'invoicedisc'}, $data->{'nocalc'}, - $data->{'id'} - ); - $sth->finish; + nocalc=?, notes=? + where id=?"); + $sth->execute($data->{'name'},$data->{'address1'},$data->{'address2'}, + $data->{'address3'},$data->{'address4'},$data->{'postal'},$data->{'phone'}, + $data->{'fax'},$data->{'url'},$data->{'contact'},$data->{'contpos'}, + $data->{'contphone'},$data->{'contfax'},$data->{'contaltphone'}, + $data->{'contemail'}, + $data->{'contnotes'},$data->{'active'},$data->{'listprice'}, + $data->{'invoiceprice'},$data->{'gstreg'},$data->{'listincgst'}, + $data->{'invoiceincgst'},$data->{'specialty'},$data->{'discount'}, + $data->{'invoicedisc'},$data->{'nocalc'},$data->{'notes'},$data->{'id'}); + $sth->finish; } =item insertsup @@ -1420,7 +1453,43 @@ sub getparcels { return ( scalar(@results), @results ); } -END { } # module clean-up code here (global destructor) +=item getparcels + + ($count, $results) = &getparcels($dbh, $bookseller, $order, $limit); + +get a lists of parcels +Returns the count of parcels returned and a pointer on a hash list containing parcel informations as such : + Creation date + Last operation + Number of biblio + Number of items + + +=cut +#' +sub getparcels { + my ($bookseller, $order, $code,$datefrom,$dateto, $limit)=@_; + my $dbh = C4::Context->dbh; + my $strsth = "SELECT aqorders.booksellerinvoicenumber, datereceived, count(DISTINCT biblionumber) as biblio, sum(quantity) as itemsexpected, sum(quantityreceived) as itemsreceived from aqorders, aqbasket where aqbasket.basketno = aqorders.basketno and aqbasket.booksellerid = $bookseller and datereceived is not null "; + $strsth .= "and aqorders.booksellerinvoicenumber like \"$code%\" " if ($code); + $strsth .= "and datereceived >=".$dbh->quote($datefrom)." " if ($datefrom); + $strsth .= "and datereceived <=".$dbh->quote($dateto)." " if ($dateto); + $strsth .= "group by aqorders.booksellerinvoicenumber,datereceived "; + $strsth .= "order by $order " if ($order); + $strsth .= " LIMIT 0,$limit" if ($limit); + my $sth=$dbh->prepare($strsth); +### getparcels: $strsth + $sth->execute; + my @results; + while (my $data2=$sth->fetchrow_hashref) { + push @results, $data2; + } + + $sth->finish; + return(scalar(@results), @results); +} + +END { } # module clean-up code here (global destructor) 1; __END__ diff --git a/C4/Auth.pm b/C4/Auth.pm index 9da0032874..c086619a14 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -226,9 +226,9 @@ sub get_template_and_user { ); } $template->param( - TemplateEncoding => C4::Context->preference("TemplateEncoding"), - AmazonContent => C4::Context->preference("AmazonContent"), - LibraryName => C4::Context->preference("LibraryName"), + TemplateEncoding => C4::Context->preference('TemplateEncoding'), + AmazonContent => C4::Context->preference('AmazonContent'), + LibraryName => C4::Context->preference('LibraryName'), branchname => C4::Context->userenv->{'branchname'}, ); return ( $template, $borrowernumber, $cookie ); diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 836dc6e11a..33f29c2fe8 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -47,9 +47,11 @@ $VERSION = 0.01; &authoritysearch - &AUTHhtml2marc - - &merge + &MARCmodsubfield + &AUTHhtml2marc &AUTHhtml2xml + &AUTHaddword + &MARCaddword &MARCdelword + &char_decode &FindDuplicate ); @@ -109,7 +111,7 @@ sub authoritysearch { } ##Add how many queries generated $query= $and.$query.$q2; -warn $query; +# warn $query; $offset=0 unless $offset; my $counter = $offset; @@ -141,87 +143,141 @@ my $nbresults=0; my @finalresult = (); -if ($nbresults>0){ -##fIND tags using authority - - my $newsth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?"); - $newsth->execute($authtypecode); + my $oldline; +# 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]); + # then build the summary + #FIXME: all of this should be moved to the template eventually + my $authtypecode = AUTHfind_authtypecode($dbh,$result[$counter]); + my $authref = getauthtype($authtypecode); + my $authtype =$authref->{authtypetext}; + my $summary = $authref->{summary}; + # find biblio MARC field using this authtypecode (to jump to biblio) + my $sth = $dbh->prepare("select distinct tagfield from marc_subfield_structure where authtypecode=?"); + $sth->execute($authtypecode); my $tags_using_authtype; + my $newsth; while (my ($tagfield) = $newsth->fetchrow) { $tags_using_authtype.= "'".$tagfield."9',"; } -##Find authid and linkid fields -my ($authidfield,$authidsubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.authid",$authtypecode); -my ($linkidfield,$linkidsubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.linkid",$authtypecode); -while (($counter < $nbresults) && ($counter < ($offset + $length))) { - -##Here we have to extract MARC record and $authid from ZEBRA AUTHORITIES -my $rec=$oAResult->record($counter); -my $marcdata=$rec->raw(); -my $authrecord; -my $linkid; -my @linkids; -my $separator=C4::Context->preference('authoritysep'); -my $linksummary=" ".$separator; - - $authrecord = MARC::File::USMARC::decode($marcdata); -my $authid=$authrecord->field($authidfield)->subfield($authidsubfield); ## we could have these defined in system pref. - if ($authrecord->field($linkidfield)){ -my @fields=$authrecord->field($linkidfield); - - foreach my $field (@fields){ - $linkid=$field->subfield($linkidsubfield) ; - if ($linkid){ ##There is a linked record add fields to produce summary -my $linktype=AUTHfind_authtypecode($dbh,$linkid); - my $linkrecord=AUTHgetauthority($dbh,$linkid); - $linksummary.=getsummary($dbh,$linkrecord,$linkid,$linktype).$separator; + chop $tags_using_authtype; + # if the library has a summary defined, use it. Otherwise, build a standard one + if ($summary) { + my @fields = $record->fields(); + foreach my $field (@fields) { + my $tag = $field->tag(); + my $tagvalue = $field->as_string(); + $summary =~ s/\[(.?.?.?.?)$tag\*(.*?)]/$1$tagvalue$2\[$1$tag$2]/g; + if ($tag<10) { + } else { + my @subf = $field->subfields; + for my $i (0..$#subf) { + my $subfieldcode = $subf[$i][0]; + my $subfieldvalue = $subf[$i][1]; + my $tagsubf = $tag.$subfieldcode; + $summary =~ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; + } + } + } + $summary =~ s/\[(.*?)]//g; + $summary =~ s/\n/
/g; + } else { + my $heading; # = $authref->{summary}; + my $altheading; + my $seeheading; + my $see; + my @fields = $record->fields(); + if (C4::Context->preference('marcflavour') eq 'UNIMARC') { + # construct UNIMARC summary, that is quite different from MARC21 one + # accepted form + foreach my $field ($record->field('2..')) { + $heading.= $field->as_string(); + } + # rejected form(s) + foreach my $field ($record->field('4..')) { + $summary.= "   ".$field->as_string()."
"; + $summary.= "      see: ".$heading."
"; + } + # see : + foreach my $field ($record->field('5..')) { + $summary.= "   ".$field->as_string()."
"; + $summary.= "      see: ".$heading."
"; + } + # // form + foreach my $field ($record->field('7..')) { + $seeheading.= "      see also: ".$field->as_string()."
"; + $altheading.= "   ".$field->as_string()."
"; + $altheading.= "      see also: ".$heading."
"; + } + $summary = "".$heading."
".$seeheading.$altheading.$summary; + } else { + # construct MARC21 summary + foreach my $field ($record->field('1..')) { + if ($record->field('100')) { + $heading.= $field->as_string('abcdefghjklmnopqrstvxyz68'); + } elsif ($record->field('110')) { + $heading.= $field->as_string('abcdefghklmnoprstvxyz68'); + } elsif ($record->field('111')) { + $heading.= $field->as_string('acdefghklnpqstvxyz68'); + } elsif ($record->field('130')) { + $heading.= $field->as_string('adfghklmnoprstvxyz68'); + } elsif ($record->field('148')) { + $heading.= $field->as_string('abvxyz68'); + } elsif ($record->field('150')) { + $heading.= $field->as_string('abvxyz68'); + } elsif ($record->field('151')) { + $heading.= $field->as_string('avxyz68'); + } elsif ($record->field('155')) { + $heading.= $field->as_string('abvxyz68'); + } elsif ($record->field('180')) { + $heading.= $field->as_string('vxyz68'); + } elsif ($record->field('181')) { + $heading.= $field->as_string('vxyz68'); + } elsif ($record->field('182')) { + $heading.= $field->as_string('vxyz68'); + } elsif ($record->field('185')) { + $heading.= $field->as_string('vxyz68'); + } else { + $heading.= $field->as_string(); + } + } #See From + foreach my $field ($record->field('4..')) { + $seeheading.= "   ".$field->as_string()."
"; + $seeheading.= "      see: ".$seeheading."
"; + } #See Also + foreach my $field ($record->field('5..')) { + $altheading.= "      see also: ".$field->as_string()."
"; + $altheading.= "   ".$field->as_string()."
"; + $altheading.= "      see also: ".$altheading."
"; + } + $summary.=$heading.$seeheading.$altheading; + } } - } - }# + # then add a line for the template loop + my %newline; + $newline{summary} = $summary; + $newline{authtype} = $authtype; + $newline{authid} = $result[$counter]; + $newline{used} = &AUTHcount_usage($result[$counter]); + $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); + 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; -my $summary=getsummary($dbh,$authrecord,$authid,$authtypecode); -if ($linkid && $linksummary ne " ".$separator){ -$summary="".$summary."".$linksummary; -} -## Fix Async search and move Zconn to here - my %newline; - $newline{summary} = $summary; - $newline{authid} = $authid; - $newline{linkid} = $linkid; -# $newline{used} =$count; - $newline{biblio_fields} = $tags_using_authtype; - $newline{even} = $counter % 2; - $counter++; - push @finalresult, \%newline; - }## while counter -$oAResult->destroy(); -#$oAuth->destroy(); - -### -my $oConnection=C4::Context->Zconn("biblioserver"); - if ($oConnection eq "error"){ - warn "Error/CONNECTING \n"; - } -my $oResult; -for (my $z=0; $z<@finalresult; $z++){ - my $nquery; - - $nquery= "\@attr GILS 1=2057 ".$finalresult[$z]{authid}; - $nquery="\@or ".$nquery." \@attr GILS 1=2057 ".$finalresult[$z]{linkid} if $finalresult[$z]{linkid}; - - eval{ - $oResult = $oConnection->search_pqf($nquery); - }; - if($@){ - warn " /CODE:", $@->code()," /MSG:",$@->message(),"\n"; - } - my $count=$oResult->size() if ($oResult); - $finalresult[$z]{used}=$count; -}##for Zconn - $oResult->destroy(); -# $oConnection->destroy(); -}## if nbresult - return (\@finalresult, $nbresults); + return (\@finalresult2, $nbresults); } # Creates the SQL Request @@ -244,21 +300,62 @@ sub create_request { $sql_tables = "auth_subfield_table as m$nb_table,"; $sql_where1 .= "( m$nb_table.subfieldvalue like '@$value[$i]' "; if (@$tags[$i]) { - $sql_where1 .=" and concat(m$nb_table.tag,m$nb_table.subfieldcode) IN (@$tags[$i])"; - } + $sql_where1 .=" and concat(m1.tag,m1.subfieldcode) in (@$tags[$i])"; + } + $sql_where1.=")"; + } elsif (@$operator[$i] eq "contains") { + $sql_tables .= "auth_word as m$nb_table,"; + $sql_where1 .= "(m1.word like ".$dbh->quote("@$value[$i]%"); + if (@$tags[$i]) { + $sql_where1 .=" and m1.tagsubfield in (@$tags[$i])"; + } + $sql_where1.=")"; + } else { + + $sql_tables .= "auth_subfield_table as m$nb_table,"; + $sql_where1 .= "(m1.subfieldvalue @$operator[$i] ".$dbh->quote("@$value[$i]"); + if (@$tags[$i]) { + $sql_where1 .=" and concat(m1.tag,m1.subfieldcode) in (@$tags[$i])"; + } + $sql_where1.=")"; + } + } else { + if (@$operator[$i] eq "start") { + $nb_table++; + $sql_tables .= "auth_subfield_table as m$nb_table,"; + $sql_where1 .= "@$and_or[$i] (m$nb_table.subfieldvalue like ".$dbh->quote("@$value[$i]%"); + if (@$tags[$i]) { + $sql_where1 .=" and concat(m$nb_table.tag,m$nb_table.subfieldcode) in (@$tags[$i])"; + } $sql_where1.=")"; + $sql_where2 .= "m1.authid=m$nb_table.authid and "; + } elsif (@$operator[$i] eq "contains") { + if (@$and_or[$i] eq 'and') { + $nb_table++; + $sql_tables .= "auth_word as m$nb_table,"; + $sql_where1 .= "@$and_or[$i] (m$nb_table.word like ".$dbh->quote("@$value[$i]%"); + if (@$tags[$i]) { + $sql_where1 .=" and m$nb_table.tagsubfield in(@$tags[$i])"; + } + $sql_where1.=")"; + $sql_where2 .= "m1.authid=m$nb_table.authid and "; } else { - - - - + $sql_where1 .= "@$and_or[$i] (m$nb_table.word like ".$dbh->quote("@$value[$i]%"); + if (@$tags[$i]) { + $sql_where1 .=" and concat(m$nb_table.tag,m$nb_table.subfieldid) in (@$tags[$i])"; + } + $sql_where1.=")"; + $sql_where2 .= "m1.authid=m$nb_table.authid and "; + } + } else { $nb_table++; $sql_tables .= "auth_subfield_table as m$nb_table,"; $sql_where1 .= "@$and_or[$i] (m$nb_table.subfieldvalue like '@$value[$i]' "; if (@$tags[$i]) { - $sql_where1 .=" and concat(m$nb_table.tag,m$nb_table.subfieldcode) IN (@$tags[$i])"; - } + $sql_where1 .=" and concat(m$nb_table.tag,m$nb_table.subfieldcode) in (@$tags[$i])"; + } + $sql_where2 .= "m1.authid=m$nb_table.authid and "; $sql_where1.=")"; $sql_where2.="m1.authid=m$nb_table.authid and "; @@ -399,56 +496,26 @@ $sth->execute($authtypecode); sub AUTHaddauthority { # pass the MARC::Record to this function, and it will create the records in the authority table my ($dbh,$record,$authid,$authtypecode) = @_; - -#my $leadercode=AUTHfind_leader($dbh,$authtypecode); -my $leader=' a ';##Fixme correct leader as this one just adds utf8 to MARC21 -#substr($leader,8,1)=$leadercode; -# $record->leader($leader); -my ($authfield,$authidsubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.authid",$authtypecode); -my ($authfield2,$authtypesubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.authtypecode",$authtypecode); -my ($linkidfield,$linkidsubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.linkid",$authtypecode); - -# if authid empty => true add, find a new authid number - if (!$authid) { - my $sth=$dbh->prepare("select max(authid) from auth_header"); - $sth->execute; - ($authid)=$sth->fetchrow; - $authid=$authid+1; - -##Insert the recordID in MARC record - -##Both authid and authtypecode is expected to be in the same field. Modify if other requirements arise - $record->add_fields($authfield,'','',$authidsubfield=>$authid,$authtypesubfield=>$authtypecode); - - $dbh->do("lock tables auth_header WRITE"); - $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode,marc) values (?,now(),?,?)"); - $sth->execute($authid,$authtypecode,$record->as_usmarc); + my @fields=$record->fields(); +# 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) +# In fact, it could still be a true add, in the case of a bulkauthimort for instance with previously +# existing authids in the records. I've adjusted below to account for this instance --JF. + if ($authid) { + $dbh->do("lock tables auth_header WRITE,auth_subfield_table WRITE, auth_word WRITE, stopwords READ"); + my $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode) values (?,now(),?)"); + $sth->execute($authid,$authtypecode); $sth->finish; - - }else{ -##Modified record reinsertid -$record->delete_field($authfield); -$record->add_fields($authfield,'','',$authidsubfield=>$authid,$authtypesubfield=>$authtypecode); - - $dbh->do("lock tables auth_header WRITE"); - my $sth=$dbh->prepare("update auth_header set marc=? where authid=?"); - $sth->execute($record->as_usmarc,$authid); - $sth->finish; - } - $dbh->do("unlock tables"); - zebraopauth($dbh,$authid,'specialUpdate'); - -if ($record->field($linkidfield)){ -my @fields=$record->field($linkidfield); - - foreach my $field (@fields){ -my $linkid=$field->subfield($linkidsubfield) ; - if ($linkid){ - ##Modify the record of linked - AUTHaddlink($dbh,$linkid,$authid); - } +# if authid empty => true add, find a new authid number + } else { + $dbh->do("lock tables auth_header WRITE,auth_subfield_table WRITE, auth_word WRITE, stopwords READ"); + my $sth=$dbh->prepare("insert into auth_header (datecreated,authtypecode) values (now(),?)"); + $sth->execute($authtypecode); + $sth=$dbh->prepare("select max(authid) from auth_header"); + $sth->execute; + ($authid)=$sth->fetchrow; + $sth->finish; } -} return ($authid); } @@ -650,6 +717,64 @@ sub AUTHfind_authtypecode { +sub AUTHhtml2xml { + my ($tags,$subfields,$values,$indicator,$ind_tag) = @_; + use MARC::File::XML; + my $xml= MARC::File::XML::header(); + my $prevvalue; + my $prevtag=-1; + my $first=1; + my $j = -1; + for (my $i=0;$i<=@$tags;$i++){ + + if ((@$tags[$i] ne $prevtag)){ + $j++ unless (@$tags[$i] eq ""); + warn "IND:".substr(@$indicator[$j],0,1).substr(@$indicator[$j],1,1)." ".@$tags[$i]; + + if (!$first){ + $xml.="\n"; + $first=1; + } + else { + if (@$values[$i] ne "") { + # leader + if (@$tags[$i] eq "000") { + $xml.="@$values[$i]\n"; + $first=1; + # rest of the fixed fields + } elsif (@$tags[$i] < 10) { + $xml.="@$values[$i]\n"; + $first=1; + } + else { + my $ind1 = substr(@$indicator[$j],0,1); + my $ind2 = substr(@$indicator[$j],1,1); + $xml.="\n"; + $xml.="@$values[$i]\n"; + $first=0; + } + } + } + } else { + if (@$values[$i] eq "") { + } + else { + if ($first){ + my $ind1 = substr(@$indicator[$j],0,1); + my $ind2 = substr(@$indicator[$j],1,1); + $xml.="\n"; + $first=0; + } + $xml.="@$values[$i]\n"; + + } + } + $prevtag = @$tags[$i]; + } + $xml.= MARC::File::XML::footer(); + warn $xml; + return $xml +} sub AUTHhtml2marc { my ($dbh,$rtags,$rsubfields,$rvalues,%indicators) = @_; my $prevtag = -1; @@ -931,6 +1056,9 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.27 2006/07/04 14:36:51 toins +# Head & rel_2_2 merged +# # Revision 1.26 2006/05/20 14:32:54 tgarip1957 # If an authority is modified biblios related to this authority were not updated but a list of modified authorities was written to disk. Now by defult they get modified as well unless a system preference 'dontmerge' is defined. dontmerge=1 will keep the previous behaviour. # diff --git a/C4/Biblio.pm b/C4/Biblio.pm index f70b137178..70ec817ab9 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1796,6 +1796,7 @@ where biblioitemnumber = ?" my $query = "Insert into deleteditems set "; my @bind = (); foreach my $temp ( keys %$data ) { + next if ($temp =~/itemcallnumber/); $query .= "$temp = ?,"; push ( @bind, $data->{$temp} ); } @@ -2946,6 +2947,17 @@ sub FindDuplicate { push @excluding, ""; push @operator, "contains"; push @value, $record->field($tag)->subfield($subfield); +# warn "for title, I add $tag / $subfield".$record->field($tag)->subfield($subfield); + } + } + ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"bibliosubtitle.subtitle",""); + if ($record->field($tag)) { + if ($record->field($tag)->subfields($subfield)) { + push @tags, "'".$tag.$subfield."'"; + push @and_or, "and"; + push @excluding, ""; + push @operator, "contains"; + push @value, $record->field($tag)->subfield($subfield); # warn "for title, I add $tag / $subfield".$record->field($tag)->subfield($subfield); } } @@ -3129,6 +3141,9 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.173 2006/07/04 14:36:51 toins +# Head & rel_2_2 merged +# # Revision 1.172 2006/06/06 23:13:14 bob_lyon # Merging katipo changes... # diff --git a/C4/Bull.pm b/C4/Bull.pm index 563e6d0f8f..f25414b2bb 100755 --- a/C4/Bull.pm +++ b/C4/Bull.pm @@ -22,7 +22,8 @@ use strict; use C4::Date; use Date::Manip; use C4::Suggestions; -use C4::Letters; +use C4::Biblio; +use C4::Search; require Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -48,7 +49,7 @@ Give all XYZ functions @EXPORT = qw(&newsubscription &modsubscription &delsubscription &getsubscriptions &getsubscription &getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber &get_full_subscription_list_from_biblionumber - &modsubscriptionhistory &newissue + &modsubscriptionhistory &newissue &serialsitemize &getserials &getlatestserials &serialchangestatus &Find_Next_Date &Get_Next_Seq &hassubscriptionexpired &subscriptionexpirationdate &subscriptionrenew @@ -110,33 +111,33 @@ sub GetLateIssues { sub newsubscription { my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, $startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength, - $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, - $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, - $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $status, $notes,$letter) = @_; + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, + $numberingmethod, $status, $notes) = @_; my $dbh = C4::Context->dbh; #save subscription my $sth=$dbh->prepare("insert into subscription (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber, startdate,periodicity,dow,numberlength,weeklength,monthlength, - add1,every1,whenmorethan1,setto1,lastvalue1, - add2,every2,whenmorethan2,setto2,lastvalue2, - add3,every3,whenmorethan3,setto3,lastvalue3, - numberingmethod, status, notes, letter) values + add1,every1,whenmorethan1,setto1,lastvalue1,innerloop1, + add2,every2,whenmorethan2,setto2,lastvalue2,innerloop2, + add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3, + numberingmethod, status, notes) values (?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?, - ?,?,?,?,?,?,?,?,?,?,?)"); + ?,?,?,?,?,?,?,?,?,?,?,?,?)"); $sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber, format_date_in_iso($startdate),$periodicity,$dow,$numberlength,$weeklength,$monthlength, - $add1,$every1,$whenmorethan1,$setto1,$lastvalue1, - $add2,$every2,$whenmorethan2,$setto2,$lastvalue2, - $add3,$every3,$whenmorethan3,$setto3,$lastvalue3, - $numberingmethod, $status, $notes,$letter); + $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1, + $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2, + $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3, + $numberingmethod, $status, $notes); #then create the 1st waited number my $subscriptionid = $dbh->{'mysql_insertid'}; $sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, subscriptionid, histstartdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)"); $sth->execute($biblionumber, $subscriptionid, format_date_in_iso($startdate), 0, "", "", "", $notes); # reread subscription to get a hash (for calculation of the 1st issue number) - $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); + $sth = $dbh->prepare("SELECT * from subscription where subscriptionid = ? "); $sth->execute($subscriptionid); my $val = $sth->fetchrow_hashref; @@ -150,7 +151,7 @@ sub newsubscription { sub getsubscription { my ($subscriptionid) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select subscription.*,subscriptionhistory.*,aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + my $sth = $dbh->prepare('SELECT subscription.*,subscriptionhistory.*,aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle from subscription left join subscriptionhistory on subscription.subscriptionid=subscriptionhistory.subscriptionid left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid @@ -165,7 +166,7 @@ sub getsubscription { sub getsubscriptionfrombiblionumber { my ($biblionumber) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select count(*) from subscription where biblionumber=?'); + my $sth = $dbh->prepare('SELECT count(*) from subscription where biblionumber=?'); $sth->execute($biblionumber); my $subscriptionsnumber = $sth->fetchrow; return $subscriptionsnumber; @@ -174,7 +175,7 @@ sub getsubscriptionfrombiblionumber { sub get_subscription_list_from_biblionumber { my ($biblionumber) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare('select subscription.*,subscriptionhistory.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle + my $sth = $dbh->prepare('SELECT subscription.*,subscriptionhistory.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle from subscription left join subscriptionhistory on subscription.subscriptionid=subscriptionhistory.subscriptionid left join aqbudget on subscription.aqbudgetid=aqbudget.aqbudgetid @@ -202,14 +203,20 @@ 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, 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 - left join biblio on biblio.biblionumber=subscription.biblionumber - where subscription.biblionumber = ? order by year,serial.subscriptionid,serial.planneddate'); + my ($biblionumber) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare(' + SELECT serial.serialseq,serial.planneddate, serial.publisheddate, serial.status, serial.notes, + year(serial.publisheddate) 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 + LEFT JOIN biblio on biblio.biblionumber=subscription.biblionumber + WHERE subscription.biblionumber = ? + ORDER BY year,serial.publisheddate,serial.subscriptionid,serial.planneddate'); $sth->execute($biblionumber); my @res; my $year; @@ -220,21 +227,18 @@ sub get_full_subscription_list_from_biblionumber { my $first; my $previousnote=""; while (my $subs = $sth->fetchrow_hashref) { -# my $sth2 = $dbh->prepare('select * from serial where serial.biblionumber = ? and serial.subscriptionid=? order by serial.planneddate'); -# $sth2->execute($biblionumber,$subs->{'subscriptionid'}); -# while (my $issues = $sth2->fetchrow_hashref){ -# warn "planneddate ".$issues->{'planneddate'}; -# warn "serialseq".$issues->{'serialseq'}; -# } +### BUG To FIX: When there is no published date, will create many null ids!!! + if ($year and ($year==$subs->{year})){ if ($first eq 1){$first=0;} my $temp=$res[scalar(@res)-1]->{'serials'}; push @$temp, - {'planneddate' => format_date($subs->{'planneddate'}), - 'serialseq' => $subs->{'serialseq'}, - "status".$subs->{'status'} => 1, - 'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes}, - }; + {'publisheddate' =>format_date($subs->{'publisheddate'}), + 'planneddate' => format_date($subs->{'planneddate'}), + 'serialseq' => $subs->{'serialseq'}, + "status".$subs->{'status'} => 1, + 'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes}, + }; }else { $first=1 if (not $year); $year= $subs->{'year'}; @@ -243,7 +247,8 @@ sub get_full_subscription_list_from_biblionumber { $bibliotitle= $subs->{'bibliotitle'}; my @temp; push @temp, - {'planneddate' => format_date($subs->{'planneddate'}), + {'publisheddate' =>format_date($subs->{'publisheddate'}), + 'planneddate' => format_date($subs->{'planneddate'}), 'serialseq' => $subs->{'serialseq'}, "status".$subs->{'status'} => 1, 'notes' => $subs->{'notes'} eq $previousnote?"":$subs->{notes}, @@ -302,24 +307,24 @@ sub getsubscriptions { my $dbh = C4::Context->dbh; my $sth; if ($biblionumber) { - $sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and biblio.biblionumber=? order by title"); + $sth = $dbh->prepare("SELECT subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and biblio.biblionumber=? order by title"); $sth->execute($biblionumber); } else { if ($ISSN and $title) { - $sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and (biblio.title like ? or biblioitems.issn = ? order by title )"); + $sth = $dbh->prepare("SELECT subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and (biblio.title like ? or biblioitems.issn = ? order by title )"); $sth->execute("%$title%",$ISSN); } else { if ($ISSN) { - $sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and biblioitems.issn = ? order by title"); + $sth = $dbh->prepare("SELECT subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and biblioitems.issn = ? order by title"); $sth->execute($ISSN); } else { - $sth = $dbh->prepare("select subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and + $sth = $dbh->prepare("SELECT subscription.subscriptionid,biblio.title,biblioitems.issn,subscription.notes,biblio.biblionumber from subscription,biblio,biblioitems where biblio.biblionumber = biblioitems.biblionumber and biblio.biblionumber=subscription.biblionumber and biblio.title like ? order by title"); $sth->execute("%$title%"); } @@ -346,7 +351,10 @@ sub getsubscriptions { sub modsubscriptionhistory { my ($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote)=@_; my $dbh=C4::Context->dbh; - my $sth = $dbh->prepare("update subscriptionhistory set histstartdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=? where subscriptionid=?"); + my $sth = $dbh->prepare(" + UPDATE subscriptionhistory + SET histstartdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=? + WHERE subscriptionid=?"); $recievedlist =~ s/^,//g; $missinglist =~ s/^,//g; $opacnote =~ s/^,//g; @@ -372,14 +380,18 @@ sub getserials { } # status = 2 is "arrived" - $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, publisheddate, planneddate,notes + FROM serial + WHERE subscriptionid = ? AND status NOT IN (2,4,5)"); $sth->execute($subscriptionid); while(my $line = $sth->fetchrow_hashref) { $line->{"status".$line->{status}} = 1; # fills a "statusX" value, used for template status select list + $line->{"publisheddate"} = format_date($line->{"publisheddate"}); $line->{"planneddate"} = format_date($line->{"planneddate"}); push @serials,$line; } - $sth=$dbh->prepare("select count(*) from serial where subscriptionid=?"); + $sth=$dbh->prepare("SELECT count(*) FROM serial WHERE subscriptionid=?"); $sth->execute($subscriptionid); my ($totalissues) = $sth->fetchrow; return ($totalissues,@serials); @@ -390,7 +402,7 @@ sub getlatestserials{ my ($subscriptionid,$limit) =@_; my $dbh = C4::Context->dbh; # status = 2 is "arrived" - my $strsth="select serialid,serialseq, status, planneddate from serial where subscriptionid = ? and (status =2 or status=4) order by planneddate DESC LIMIT 0,$limit"; + my $strsth="SELECT serialid,serialseq, status, planneddate FROM serial WHERE subscriptionid = ? AND (status =2 or status=4) ORDER BY planneddate DESC LIMIT 0,$limit"; my $sth=$dbh->prepare($strsth); $sth->execute($subscriptionid); my @serials; @@ -399,27 +411,27 @@ sub getlatestserials{ $line->{"planneddate"} = format_date($line->{"planneddate"}); push @serials,$line; } - $sth=$dbh->prepare("select count(*) from serial where subscriptionid=?"); + $sth=$dbh->prepare("SELECT count(*) from serial where subscriptionid=?"); $sth->execute($subscriptionid); my ($totalissues) = $sth->fetchrow; return \@serials; } sub serialchangestatus { - my ($serialid,$serialseq,$planneddate,$status,$notes)=@_; + my ($serialid,$serialseq, $publisheddate,$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=?"); + my $sth = $dbh->prepare("SELECT subscriptionid,status from serial where serialid=?"); $sth->execute($serialid); my ($subscriptionid,$oldstatus) = $sth->fetchrow; # change status & update subscriptionhistory 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,$notes,$serialid); - $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); + $sth = $dbh->prepare("update serial set serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? where serialid = ?"); + $sth->execute($serialseq,$publisheddate,$planneddate,$status,$notes,$serialid); + $sth = $dbh->prepare("SELECT missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); $sth->execute($subscriptionid); my ($missinglist,$recievedlist) = $sth->fetchrow; if ($status eq 2) { @@ -432,14 +444,14 @@ sub serialchangestatus { } # create new waited entry if needed (ie : was a "waited" and has changed) if ($oldstatus eq 1 && $status ne 1) { - $sth = $dbh->prepare("select * from subscription where subscriptionid = ? "); + $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($val); # next date (calculated from actual date & frequency parameters) - my $nextplanneddate = Get_Next_Date($planneddate,$val); - newissue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate); + my $nextpublisheddate = Get_Next_Date($publisheddate,$val); + newissue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextpublisheddate,0); $sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?, innerloop1=?,innerloop2=?,innerloop3=? where subscriptionid = ?"); @@ -448,11 +460,14 @@ sub serialchangestatus { } sub newissue { - my ($serialseq,$subscriptionid,$biblionumber,$status, $planneddate) = @_; + my ($serialseq,$subscriptionid,$biblionumber,$status, $publisheddate, $planneddate) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)"); - $sth->execute($serialseq,$subscriptionid,$biblionumber,$status, $planneddate); - $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); + my $sth = $dbh->prepare(" + INSERT INTO serial + (serialseq,subscriptionid,biblionumber,status,publisheddate,planneddate) + VALUES (?,?,?,?,?,?)"); + $sth->execute($serialseq,$subscriptionid,$biblionumber,$status,$publisheddate, $planneddate); + $sth = $dbh->prepare("SELECT missinglist,recievedlist from subscriptionhistory where subscriptionid=?"); $sth->execute($subscriptionid); my ($missinglist,$recievedlist) = $sth->fetchrow; if ($status eq 2) { @@ -465,6 +480,117 @@ sub newissue { $sth->execute($recievedlist,$missinglist,$subscriptionid); } +=head2 serialsitemize + + serialitemize($serialid, $info); + $info is a hashref containing barcode branch, itemcallnumber, status, location + $serialid the serialid +=cut +sub serialsitemize { + my ($serialid, $info) =@_; + + my $dbh= C4::Context->dbh; + my $sth=$dbh->prepare("SELECT * from serial WHERE serialid=?"); + $sth->execute($serialid); + my $data=$sth->fetchrow_hashref; + my $bibid=MARCfind_MARCbibid_from_oldbiblionumber($dbh,$data->{biblionumber}); + my $fwk=MARCfind_frameworkcode($dbh,$bibid); + if ($info->{barcode}){ + my @errors; + my $exists = itemdata($info->{'barcode'}); + push @errors,"barcode_not_unique" if($exists); + unless ($exists){ + my $marcrecord = MARC::Record->new(); + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.barcode",$fwk); +# warn "items.barcode : $tag , $subfield"; + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{barcode} + ); + $marcrecord->insert_fields_ordered($newField); + if ($info->{branch}){ + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.homebranch",$fwk); +# warn "items.homebranch : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{branch} + ); + $marcrecord->insert_fields_ordered($newField); + } + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.holdingbranch",$fwk); +# warn "items.holdingbranch : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{branch}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{branch} + ); + $marcrecord->insert_fields_ordered($newField); + } + } + if ($info->{itemcallnumber}){ + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemcallnumber",$fwk); +# warn "items.itemcallnumber : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{itemcallnumber}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{itemcallnumber} + ); + $marcrecord->insert_fields_ordered($newField); + } + } + if ($info->{notes}){ + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.itemnotes",$fwk); +# warn "items.itemnotes : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{notes}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{notes} + ); + $marcrecord->insert_fields_ordered($newField); + } + } + if ($info->{location}){ + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.location",$fwk); +# warn "items.location : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{location}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{location} + ); + $marcrecord->insert_fields_ordered($newField); + } + } + if ($info->{status}){ + my ($tag,$subfield)=MARCfind_marc_from_kohafield($dbh,"items.notforloan",$fwk); +# warn "items.notforloan : $tag , $subfield"; + if ($marcrecord->field($tag)) { + $marcrecord->field($tag)->add_subfields("$subfield" => $info->{status}) + }else { + my $newField = MARC::Field->new( + "$tag",'','', + "$subfield" => $info->{status} + ); + $marcrecord->insert_fields_ordered($newField); + } + } + NEWnewitem($dbh,$marcrecord,$bibid); + return 1; + } + return (0,@errors); + } +} + sub delissue { my ($serialseq,$subscriptionid) = @_; my $dbh = C4::Context->dbh; @@ -472,6 +598,7 @@ sub delissue { $sth->execute($serialseq,$subscriptionid); } + sub Get_Next_Date(@) { my ($planneddate,$subscription) = @_; my $resultdate; @@ -561,7 +688,7 @@ sub hassubscriptionexpired { my $subscription = getsubscription($subscriptionid); # we don't do the same test if the subscription is based on X numbers or on X weeks/months if ($subscription->{numberlength}) { - my $sth = $dbh->prepare("select count(*) from serial where subscriptionid=? and planneddate>=?"); + my $sth = $dbh->prepare("SELECT count(*) from serial where subscriptionid=? and planneddate>=?"); $sth->execute($subscriptionid,$subscription->{startdate}); my $res = $sth->fetchrow; if ($subscription->{numberlength}>=$res) { @@ -571,7 +698,7 @@ sub hassubscriptionexpired { } } else { #a little bit more tricky if based on X weeks/months : search if the latest issue waited is not after subscription startdate + duration - my $sth = $dbh->prepare("select max(planneddate) from serial where subscriptionid=?"); + my $sth = $dbh->prepare("SELECT max(planneddate) from serial where subscriptionid=?"); $sth->execute($subscriptionid); my $res = ParseDate(format_date_in_iso($sth->fetchrow)); my $endofsubscriptiondate; @@ -606,12 +733,12 @@ sub subscriptionrenew { my ($subscriptionid,$user,$startdate,$numberlength,$weeklength,$monthlength,$note) = @_; my $dbh = C4::Context->dbh; my $subscription = getsubscription($subscriptionid); - my $sth = $dbh->prepare("select * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber and biblio.biblionumber=?"); + my $sth = $dbh->prepare("SELECT * from biblio,biblioitems where biblio.biblionumber=biblioitems.biblionumber and biblio.biblionumber=?"); $sth->execute($subscription->{biblionumber}); my $biblio = $sth->fetchrow_hashref; - newsuggestion($user,$subscription->{bibliotitle},$biblio->{author},$biblio->{publishercode},$biblio->{note},,,,,$subscription->{biblionumber}); + newsuggestion($user,$subscription->{bibliotitle},$biblio->{author},$biblio->{publishercode},$biblio->{note},'','','','','',$subscription->{biblionumber}); # renew subscription - $sth=$dbh->prepare("update subscription set startdate=?,numberlength=?,weeklength=?,monthlength=?"); - $sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength); + $sth=$dbh->prepare("update subscription set startdate=?,numberlength=?,weeklength=?,monthlength=? where subscriptionid=?"); + $sth->execute(format_date_in_iso($startdate),$numberlength,$weeklength,$monthlength, $subscriptionid); } END { } # module clean-up code here (global destructor) diff --git a/C4/Context.pm b/C4/Context.pm index d7cdf9f2ee..c9fe249189 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -432,7 +432,7 @@ the data given in the current context and returns it. sub new_Zconn { use ZOOM; my $server=shift; -my $tried==0; +my $tried=0; my $Zconn; my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"}; @@ -462,7 +462,7 @@ retry: sub new_Zconnauth { use ZOOM; my $server=shift; -my $tried==0; +my $tried=0; my $Zconnauth; my ($tcp,$host,$port)=split /:/,$context->{"listen"}->{$server}->{"content"}; retry: @@ -826,6 +826,9 @@ Andrew Arensburger =cut # $Log$ +# Revision 1.42 2006/07/04 14:36:51 toins +# Head & rel_2_2 merged +# # Revision 1.41 2006/05/20 14:36:09 tgarip1957 # Typo error. Missing '>' # diff --git a/C4/Input.pm b/C4/Input.pm index 5bf6dfb4ed..8eafcff426 100644 --- a/C4/Input.pm +++ b/C4/Input.pm @@ -191,7 +191,7 @@ sub buildCGIsort { use strict; my ($name,$input_name,$data) = @_; my $dbh=C4::Context->dbh; - my $query=qq{SELECT * FROM authorised_values WHERE category=?}; + my $query=qq{SELECT * FROM authorised_values WHERE category=? order by lib}; my $sth=$dbh->prepare($query); $sth->execute($name); my $CGISort; diff --git a/C4/Members.pm b/C4/Members.pm index 47642b8d48..b5bcaa179e 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -398,9 +398,8 @@ sub modmember { # is adult check guarantees; updateguarantees(%data); - } + } - } diff --git a/C4/Output.pm b/C4/Output.pm index 0ce78f0be3..0b373bcf92 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -83,6 +83,7 @@ if (!$query){ interface => ($opac ne 'intranet'? '/opac-tmpl': '/intranet-tmpl'), theme => $theme, opacstylesheet => $opacstylesheet, + opaccolorstylesheet => C4::Context->preference('opaccolorstylesheet'), opacsmallimage => C4::Context->preference('opacsmallimage'), lang => $lang); diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index e4410bedf0..8a8bd3c9e8 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -327,24 +327,27 @@ sub catalogsearch { # then all other fields in the main array # search if item is on loan - my $date_due; - $sth_issue->execute($item->{itemnumber}); - while (my $loan = $sth_issue->fetchrow_hashref) { - if ($loan->{date_due} and !$loan->{returndate}) { - $date_due = $loan->{date_due}; - } - } # store this item my %lineCN; $lineCN{holdingbranch} = $item->{holdingbranch}; $lineCN{itemcallnumber} = $item->{itemcallnumber}; $lineCN{location} = $item->{location}; - $lineCN{date_due} = format_date($date_due); - $lineCN{notforloan} = $notforloanstatus{$line->{notforloan}} if ($line->{notforloan}); # setting not forloan if itemtype is not for loan - $lineCN{notforloan} = $notforloanstatus{$item->{notforloan}} if ($item->{notforloan}); # setting not forloan it this item is not for loan - $notforloan=0 unless ($item->{notforloan} or $item->{wthdrawn} or $item->{itemlost}); + $lineCN{cnt} = $item->{cnt} unless ($item->{cnt}==1); + if ($item->{cnt}==1){ + my $date_due; + $sth_issue->execute($item->{itemnumber}); + while (my $loan = $sth_issue->fetchrow_hashref) { + if ($loan->{date_due} and !$loan->{returndate}) { + $date_due = $loan->{date_due}; + } + } + $lineCN{date_due} = format_date($date_due) ; + $lineCN{notforloan} = $notforloanstatus{$item->{notforloan}} if ($item->{notforloan}); # setting not forloan it this item is not for loan + $notforloan=0 unless ($item->{notforloan} or $item->{wthdrawn} or $item->{itemlost}); + } + $lineCN{notforloan} = $notforloanstatus{$line->{notforloan}} if ($line->{notforloan} and not $lineCN{notforloan}); # setting not forloan if itemtype is not for loan push @CNresults,\%lineCN; - $totalitems++; + $totalitems+=$item->{cnt}; } # save the biblio in the final array, with item and item issue status my %newline; @@ -443,7 +446,7 @@ sub getMARCsubjects { my ($dbh, $bibid, $marcflavour) = @_; my ($mintag, $maxtag); if ($marcflavour eq "MARC21") { - $mintag = "600"; + $mintag = "600"; $maxtag = "699"; } else { # assume unimarc if not marc21 $mintag = "600"; @@ -476,11 +479,12 @@ sub getMARCsubjects { my $lasttag; my ($subfieldvalue,$subfieldcode,$tagorder,$tag); while (($subfieldvalue,$subfieldcode,$tagorder,$tag)=$sth->fetchrow) { - $lasttag=$tag if $tag; + #warn "IN MARCSUBJECTS $subfieldvalue $subfieldcode $tagorder $tag\n"; if ($activetagorder && $tagorder != $activetagorder) { + # warn "ACTIVETAGORDER".$activetagorder; $subject=~ s/ -- $//; $marcsubjct = {MARCSUBJCT => $subject, - link => $tag."9", + link => $lasttag."9", linkvalue => $field9, }; push @marcsubjcts, $marcsubjct; @@ -496,6 +500,7 @@ sub getMARCsubjects { $subject .= $subfieldvalue . " -- "; } $activetagorder=$tagorder; + $lasttag=$tag if $tag; } $subject=~ s/ -- $//; $marcsubjct = {MARCSUBJCT => $subject, @@ -507,7 +512,7 @@ sub getMARCsubjects { $sth->finish; my $marcsubjctsarray=\@marcsubjcts; - return $marcsubjctsarray; + return $marcsubjctsarray; } #end getMARCsubjects END { } # module clean-up code here (global destructor) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index dbe147c329..caf8ba2665 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -64,6 +64,7 @@ Suggestions done by other can be seen when not "AVAILABLE" &delsuggestion &countsuggestion &changestatus + &connectSuggestionAndBiblio &findsuggestion_from_biblionumber ); @@ -112,9 +113,11 @@ sub searchsuggestion { if (C4::Context->preference("IndependantBranches")) { my $userenv = C4::Context->userenv; - unless ($userenv->{flags} == 1){ + if ($userenv) { + unless ($userenv->{flags} == 1){ push @sql_params,$userenv->{branch}; $query .= " and (U1.branchcode = ? or U1.branchcode ='')"; + } } } if ($suggestedbyme) { @@ -147,7 +150,7 @@ sub newsuggestion { my ($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber) = @_; my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("insert into suggestions (status,suggestedby,title,author,publishercode,note,copyrightdate,volumedesc,publicationyear,place,isbn,biblionumber) values ('ASKED',?,?,?,?,?,?,?,?,?,?,?)"); - $sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber); + $sth->execute($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber); } sub getsuggestion { @@ -252,6 +255,13 @@ sub findsuggestion_from_biblionumber { return $suggestionid; } +# connect a suggestion to an existing biblio +sub connectSuggestionAndBiblio { + my ($suggestionid,$biblionumber) = @_; + my $dbh=C4::Context->dbh; + my $sth = $dbh->prepare("update suggestions set biblionumber=? where suggestionid=?"); + $sth->execute($biblionumber,$suggestionid); +} =back =head1 SEE ALSO diff --git a/admin/aqbookfund.pl b/admin/aqbookfund.pl index 8a52cd92a1..03d2d11adb 100755 --- a/admin/aqbookfund.pl +++ b/admin/aqbookfund.pl @@ -366,5 +366,8 @@ SELECT bookfundid, ) ); } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/aqbudget.pl b/admin/aqbudget.pl index d8bfdd97f6..689ee5df41 100755 --- a/admin/aqbudget.pl +++ b/admin/aqbudget.pl @@ -425,6 +425,9 @@ SELECT aqbudgetid, ) ); } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/auth_subfields_structure.pl b/admin/auth_subfields_structure.pl index 0fdb0be869..86531e989d 100755 --- a/admin/auth_subfields_structure.pl +++ b/admin/auth_subfields_structure.pl @@ -147,6 +147,7 @@ if ($op eq 'add_form') { }, -default=>$data->{'tab'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden', @@ -195,6 +196,7 @@ if ($op eq 'add_form') { -values=> \@authorised_values, -default=>$data->{'authorised_value'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{value_builder} = CGI::scrolling_list(-name=>'value_builder', @@ -202,6 +204,7 @@ if ($op eq 'add_form') { -values=> \@value_builder, -default=>$data->{'value_builder'}, -size=>1, + -tabindex=>'', -multiple=>0, ); @@ -242,6 +245,7 @@ if ($op eq 'add_form') { }, -default=>"", -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden', @@ -306,6 +310,7 @@ if ($op eq 'add_form') { -id => 'authorised_value', -values=> \@authorised_values, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{link} = CGI::checkbox( -name => "link", @@ -321,7 +326,7 @@ if ($op eq 'add_form') { $template->param('use-heading-flags-p' => 1); $template->param('heading-edit-subfields-p' => 1); $template->param(action => "Edit subfields", - tagfield => "$tagfield", + tagfield => "$tagfield", loop => \@loop_data, more_subfields => $more_subfields, more_tag => $tagfield); diff --git a/admin/auth_tag_structure.pl b/admin/auth_tag_structure.pl index ea96e165ee..5ad9d205bc 100755 --- a/admin/auth_tag_structure.pl +++ b/admin/auth_tag_structure.pl @@ -118,6 +118,7 @@ if ($op eq 'add_form') { my $authorised_value = CGI::scrolling_list(-name=>'authorised_value', -values=> \@authorised_values, -size=>1, + -tabindex=>'', -multiple=>0, -default => $data->{'authorised_value'}, ); @@ -210,13 +211,13 @@ if ($op eq 'add_form') { } my $env; my ($count,$results)=StringSearch($env,$searchfield,$authtypecode); - my $toggle="white"; + my $toggle=1; my @loop_data = (); for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ - if ($toggle eq 'white'){ - $toggle="#ffffcc"; + if ($toggle eq 1){ + $toggle=0; } else { - $toggle="white"; + $toggle=1; } my %row_data; # get a fresh hash for the row data $row_data{tagfield} = $results->[$i]{'tagfield'}; @@ -227,7 +228,7 @@ if ($op eq 'add_form') { $row_data{subfield_link} ="auth_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode; $row_data{edit} = "$script_name?op=add_form&searchfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode; $row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&authtypecode=".$authtypecode; - $row_data{bgcolor} = $toggle; + $row_data{toggle} = $toggle; push(@loop_data, \%row_data); } $template->param(loop => \@loop_data, @@ -250,7 +251,12 @@ if ($op eq 'add_form') { } } #---- END $OP eq DEFAULT -$template->param(loggeninuser => $loggedinuser); +$template->param(loggeninuser => $loggedinuser, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); + output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl index efd1cf7707..bdd102bebb 100755 --- a/admin/authorised_values.pl +++ b/admin/authorised_values.pl @@ -157,6 +157,7 @@ if ($op eq 'add_form') { -values=> \@category_list, -default=>"", -size=>1, + -tabindex=>'', -multiple=>0, ); if (!$searchfield) { @@ -202,5 +203,8 @@ if ($op eq 'add_form') { ); } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/authtypes.pl b/admin/authtypes.pl index ad68d1973c..fa5522dc44 100755 --- a/admin/authtypes.pl +++ b/admin/authtypes.pl @@ -171,6 +171,10 @@ if ($op eq 'add_form') { $template->param(next => "$script_name?offset=".$nextpage); } } #---- END $OP eq DEFAULT +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; # Local Variables: diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index f8a64954e8..96a6447271 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -170,6 +170,10 @@ if ($op eq 'add_form') { $template->param(next => "$script_name?offset=".$nextpage); } } #---- END $OP eq DEFAULT +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; # Local Variables: diff --git a/admin/branches.pl b/admin/branches.pl index 4e730e8577..6a6b88a1d0 100755 --- a/admin/branches.pl +++ b/admin/branches.pl @@ -558,7 +558,10 @@ sub checkcategorycode { } return $message; } - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; # Local Variables: diff --git a/admin/categorie.pl b/admin/categorie.pl index 1453236c86..b33dcc00f2 100755 --- a/admin/categorie.pl +++ b/admin/categorie.pl @@ -211,6 +211,9 @@ if ($op eq 'add_form') { } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/categoryitem.pl b/admin/categoryitem.pl index a1e40b77cb..e99f0571bb 100644 --- a/admin/categoryitem.pl +++ b/admin/categoryitem.pl @@ -193,7 +193,10 @@ if ($op eq 'add_form') { } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/checkmarc.pl b/admin/checkmarc.pl index 707e5ed8d5..206301be58 100755 --- a/admin/checkmarc.pl +++ b/admin/checkmarc.pl @@ -185,5 +185,9 @@ if ($res) { $total++; } -$template->param(total => $total); +$template->param(total => $total, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/currency.pl b/admin/currency.pl index 8a0a8b2d25..f78f0e6ccb 100755 --- a/admin/currency.pl +++ b/admin/currency.pl @@ -194,6 +194,9 @@ if ($op eq 'add_form') { nextpage => $offset+$pagesize); } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/issuingrules.pl b/admin/issuingrules.pl index 1bae83ee14..d8d7eaf3c7 100755 --- a/admin/issuingrules.pl +++ b/admin/issuingrules.pl @@ -186,5 +186,9 @@ $sth->finish; $template->param(title => \@title_loop, row => \@row_loop, branchloop => \@branchloop, - branch => $branch); + branch => $branch, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index bd2b602a38..cbc34e3550 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -250,6 +250,10 @@ UPDATE itemtypes ) ); } #---- END $OP eq DEFAULT +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; # Local Variables: diff --git a/admin/koha2marclinks.pl b/admin/koha2marclinks.pl index 7a572252be..48818b03d3 100755 --- a/admin/koha2marclinks.pl +++ b/admin/koha2marclinks.pl @@ -74,6 +74,7 @@ if ($op eq 'add_form') { -values=> \@marcarray, -default=>"$defaulttagfield $defaulttagsubfield - $defaultliblibrarian", -size=>1, + -tabindex=>'', -multiple=>0, ); $template->param("marclist$i" => $marclist); @@ -129,11 +130,15 @@ if ($op eq 'add_form') { $template->param(loop => \@loop_data, tablename => CGI::scrolling_list(-name=>'tablename', -values=>['biblio','biblioitems','items','bibliosubject','bibliosubtitle','additionalauthors'], - -default=>$tablename, - -size=>1, - -multiple=>0 - ) - ); + -default=>$tablename, + -size=>1, + -tabindex=>'', + -multiple=>0 + ) + ); } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/marc_subfields_structure.pl b/admin/marc_subfields_structure.pl index 79ca9a3af0..e8ca2bf965 100755 --- a/admin/marc_subfields_structure.pl +++ b/admin/marc_subfields_structure.pl @@ -172,6 +172,7 @@ if ($op eq 'add_form') { }, -default=>$data->{'tab'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{tagsubfield} =$data->{'tagsubfield'}."{'tagsubfield'}."\" id=\"tagsubfield\">"; @@ -183,6 +184,7 @@ if ($op eq 'add_form') { -values=> \@kohafields, -default=> "$data->{'kohafield'}", -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{authorised_value} = CGI::scrolling_list(-name=>'authorised_value', @@ -190,6 +192,7 @@ if ($op eq 'add_form') { -values=> \@authorised_values, -default=>$data->{'authorised_value'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{value_builder} = CGI::scrolling_list(-name=>'value_builder', @@ -197,6 +200,7 @@ if ($op eq 'add_form') { -values=> \@value_builder, -default=>$data->{'value_builder'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{authtypes} = CGI::scrolling_list(-name=>'authtypecode', @@ -204,27 +208,27 @@ if ($op eq 'add_form') { -values=> \@authtypes, -default=>$data->{'authtypecode'}, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i", -checked => $data->{'repeatable'}?'checked':'', -value => 1, + -tabindex=>'', -label => '', -id => "repeatable$i"); $row_data{mandatory} = CGI::checkbox(-name => "mandatory$i", -checked => $data->{'mandatory'}?'checked':'', -value => 1, + -tabindex=>'', -label => '', -id => "mandatory$i"); - $row_data{hidden} = CGI::checkbox( -name=>"hidden$i", - -id => "hidden$i", - -checked => $data->{'hidden'}?'checked':'', - -value => 1, - -label => ''); + $row_data{hidden} = CGI::escapeHTML($data->{hidden}); $row_data{isurl} = CGI::checkbox( -name => "isurl$i", -id => "isurl$i", -checked => $data->{'isurl'}?'checked':'', -value => 1, + -tabindex=>'', -label => ''); $row_data{row} = $i; $row_data{toggle} = $toggle; @@ -245,49 +249,52 @@ if ($op eq 'add_form') { }, -default=>"", -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{tagsubfield} = "{'tagsubfield'}."\" size=\"1\" id=\"tagsubfield\" maxlength=\"1\">"; $row_data{liblibrarian} = ""; $row_data{libopac} = ""; $row_data{seealso} = ""; + $row_data{hidden} = ""; $row_data{repeatable} = CGI::checkbox( -name=> 'repeatable', -id => "repeatable$i", -checked => '', -value => 1, + -tabindex=>'', -label => ''); $row_data{mandatory} = CGI::checkbox( -name=> 'mandatory', -id => "mandatory$i", -checked => '', -value => 1, - -label => ''); - $row_data{hidden} = CGI::checkbox( -name => 'hidden', - -id => "hidden$i", - -checked=> '', - -value => 1, + -tabindex=>'', -label => ''); $row_data{isurl} = CGI::checkbox(-name => 'isurl', -id => "isurl$i", -checked => '', -value => 1, + -tabindex=>'', -label => ''); $row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield', -id => "kohafield$i", -values=> \@kohafields, -default=> "", -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{authorised_value} = CGI::scrolling_list(-name=>'authorised_value', -id => 'authorised_value', -values=> \@authorised_values, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{authtypes} = CGI::scrolling_list(-name=>'authtypecode', -id => 'authtypecode', -values=> \@authtypes, -size=>1, + -tabindex=>'', -multiple=>0, ); $row_data{link} = CGI::escapeHTML($data->{'link'}); @@ -317,6 +324,7 @@ if ($op eq 'add_form') { my @kohafield = $input->param('kohafield'); my @tab = $input->param('tab'); my @seealso = $input->param('seealso'); + my @hidden = $input->param('hidden'); my @authorised_values = $input->param('authorised_value'); my @authtypecodes = $input->param('authtypecode'); my @value_builder =$input->param('value_builder'); @@ -335,7 +343,7 @@ if ($op eq 'add_form') { my $authorised_value =$authorised_values[$i]; my $authtypecode =$authtypecodes[$i]; my $value_builder=$value_builder[$i]; - my $hidden = $input->param("hidden$i")?1:0; + my $hidden = $hidden[$i]; #input->param("hidden$i"); my $isurl = $input->param("isurl$i")?1:0; my $link = $link[$i]; if ($liblibrarian) { @@ -444,5 +452,8 @@ if ($op eq 'add_form') { $template->param(next => ""); } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index 22adcb44b7..c6fa2fef74 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -119,6 +119,7 @@ if ($op eq 'add_form') { my $authorised_value = CGI::scrolling_list(-name=>'authorised_value', -values=> \@authorised_values, -size=>1, + -tabindex=>'', -id=>"authorised_value", -multiple=>0, -default => $data->{'authorised_value'}, @@ -138,11 +139,13 @@ if ($op eq 'add_form') { repeatable => CGI::checkbox(-name=>'repeatable', -checked=> $data->{'repeatable'}?'checked':'', -value=> 1, + -tabindex=>'', -label => '', -id=> 'repeatable'), mandatory => CGI::checkbox(-name => 'mandatory', -checked => $data->{'mandatory'}?'checked':'', -value => 1, + -tabindex=>'', -label => '', -id => 'mandatory'), authorised_value => $authorised_value, @@ -332,7 +335,11 @@ if ($op eq 'add_form') { } } #---- END $OP eq DEFAULT -$template->param(loggeninuser => $loggedinuser); +$template->param(loggeninuser => $loggedinuser, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/printers.pl b/admin/printers.pl index 1ea86cb3b9..9ef1d0e7df 100755 --- a/admin/printers.pl +++ b/admin/printers.pl @@ -181,6 +181,9 @@ if ($op eq 'add_form') { } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/thesaurus.pl b/admin/thesaurus.pl index 76ca6c778e..7ce3ac7286 100755 --- a/admin/thesaurus.pl +++ b/admin/thesaurus.pl @@ -153,6 +153,7 @@ if ($op eq 'add_form') { -values=> \@category_list, -default=>"$search_category", -size=>1, + -tabindex=>'', -multiple=>0, ); if (!$search_category) { @@ -201,6 +202,7 @@ if ($op eq 'add_form') { -values=> \@category_list, -default=>"$search_category", -size=>1, + -tabindex=>'', -multiple=>0, ); if (!$search_category) { @@ -263,5 +265,8 @@ if ($op eq 'add_form') { $template->param(next => "$script_name?branch=$branch&search_category=$search_category&searchstring=$searchstring&offset=$nextpage"); } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl index 084bcdf659..23270b3124 100755 --- a/admin/z3950servers.pl +++ b/admin/z3950servers.pl @@ -200,5 +200,8 @@ if ($op eq 'add_form') { nextpage => $offset+$pagesize); } } #---- END $OP eq DEFAULT - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/authorities/auth_finder.pl b/authorities/auth_finder.pl index 86f567571e..fdf03c0020 100755 --- a/authorities/auth_finder.pl +++ b/authorities/auth_finder.pl @@ -37,7 +37,7 @@ my $query=new CGI; my $op = $query->param('op'); my $authtypecode = $query->param('authtypecode'); my $index = $query->param('index'); -# my $category = $query->param('category'); +my $tagid=$query->param('tagid'); my $resultstring = $query->param('result'); my $dbh = C4::Context->dbh; @@ -133,6 +133,7 @@ if ($op eq "do_search") { startfromnext => $startfrom+1, startfromprev => $startfrom-1, index => $index, + tagid => $tagid, searchdata=>\@field_data, total=>$total, from=>$from, @@ -152,12 +153,17 @@ if ($op eq "do_search") { }); $template->param(index=>$query->param('index')."", + tagid => $tagid, resultstring => $resultstring, ); } $template->param(authtypesloop => \@authtypesloop, - authtypecode => $authtypecode); + authtypecode => $authtypecode, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); # Print the page output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/authorities-home.pl b/authorities/authorities-home.pl index f38ace0b9c..5fa365f5a6 100755 --- a/authorities/authorities-home.pl +++ b/authorities/authorities-home.pl @@ -193,6 +193,7 @@ elsif ($op eq "AddStatement") { my $marclist = create_scrolling_list({name=>"marclist", values=> $marcarray, size=> 1, + -tabindex=>'', default=>$marcfields[$i], onChange => "sql_update()"} ); @@ -226,6 +227,7 @@ elsif ($op eq "AddStatement") { my $marclist = create_scrolling_list({name=>"marclist", values=> $marcarray, size=>1, + -tabindex=>'', onChange => "sql_update()"}); push @statements, {"marclist" => $marclist }; @@ -245,7 +247,11 @@ else { } -$template->param(authtypesloop => \@authtypesloop); +$template->param(authtypesloop => \@authtypesloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); # Print the page output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/authorities.pl b/authorities/authorities.pl index 9f456dc915..94d762b0eb 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -128,6 +128,7 @@ sub build_authorized_values_list ($$$$$) { -labels => \%authorised_lib, -override => 1, -size => 1, + -tabindex=>'', -multiple => 0 ); } @@ -488,5 +489,9 @@ foreach my $thisauthtype (keys %$authtypes) { $template->param(authtypesloop => \@authtypesloop, authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, - nonav=>$nonav,); + hide_marc => C4::Context->preference('hide_marc'), + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index c4d22aba3e..c5d5d0fd3d 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -57,6 +57,7 @@ my $dbh=C4::Context->dbh; my $authid = $query->param('authid'); my $index = $query->param('index'); +my $tagid = $query->param('tagid'); my $authtypecode = &AUTHfind_authtypecode($dbh,$authid); my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode); @@ -135,6 +136,11 @@ $template->param("0XX" =>\@loop_data); $template->param(authid => $authid?$authid:"", # authtypesloop => \@authtypesloop, - index => $index); + index => $index, + tagid => $tagid, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/detail-biblio-search.pl b/authorities/detail-biblio-search.pl index 5bfe7620a0..848e2283c9 100755 --- a/authorities/detail-biblio-search.pl +++ b/authorities/detail-biblio-search.pl @@ -179,6 +179,10 @@ foreach my $thisauthtype (keys %$authtypes) { } $template->param(authid => $authid, - authtypesloop => \@authtypesloop, index => $index); + authtypesloop => \@authtypesloop, index => $index, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/authorities/detail.pl b/authorities/detail.pl index 519c09d0f0..eeda2eb33c 100755 --- a/authorities/detail.pl +++ b/authorities/detail.pl @@ -141,9 +141,13 @@ foreach my $thisauthtype (keys %$authtypes) { } $template->param(authid => $authid, - count => $count, - biblio_fields => $biblio_fields, - authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, - authtypesloop => \@authtypesloop); + count => $count, + biblio_fields => $biblio_fields, + authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, + authtypesloop => \@authtypesloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/barcodes/barcodes.pl b/barcodes/barcodes.pl index 45914fc712..e3eaa93f22 100755 --- a/barcodes/barcodes.pl +++ b/barcodes/barcodes.pl @@ -139,5 +139,9 @@ if ($input->param('error')) { } else { $template->param(ERROR => 0); } +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); # Shows the template with the real values replaced -output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/barcodes/printerConfig.pl b/barcodes/printerConfig.pl index 62e6e50291..ad1be1e887 100755 --- a/barcodes/printerConfig.pl +++ b/barcodes/printerConfig.pl @@ -113,4 +113,8 @@ $template->param(MARGIN_TOP => $labelConfig{'marginBottom'}); $template->param(MARGIN_LEFT => $labelConfig{'marginLeft'}); $template->param(SCRIPT_NAME => '/cgi-bin/koha/barcodes/printerConfig.pl'); $template->param("$labelConfig{'pageType'}" => 1); -output_html_with_http_headers $input, $cookie, $template->output; \ No newline at end of file +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/bookshelves/addbookbybiblionumber.pl b/bookshelves/addbookbybiblionumber.pl index e0426bc55e..907ca8b764 100755 --- a/bookshelves/addbookbybiblionumber.pl +++ b/bookshelves/addbookbybiblionumber.pl @@ -70,17 +70,37 @@ if ($shelfnumber) { -values => \@shelvesloop, -labels => \%shelvesloop, -size => 1, + -tabindex=>'', -multiple => 0 ); $template->param(biblionumber => $biblionumber, title => $biblios[0]->{'title'}, author => $biblios[0]->{'author'}, CGIbookshelves => $CGIbookshelves, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); output_html_with_http_headers $query, $cookie, $template->output; } # $Log$ +# Revision 1.4 2006/07/04 14:36:51 toins +# Head & rel_2_2 merged +# +# Revision 1.3.2.4 2006/06/20 16:21:42 oleonard +# Adding "tabindex=''" to CGI:scrolling_lists to prevent incorrect tabbing. See Bug 1098 +# +# Revision 1.3.2.3 2006/02/05 21:59:21 kados +# Adds script support for IntranetNav ... see mail to koha-devel for +# details +# +# Revision 1.3.2.2 2006/02/05 21:45:25 kados +# Adds support for intranetstylesheet system pref in Koha scripts +# +# Revision 1.3.2.1 2006/02/04 21:26:47 kados +# Adds support for intranetcolorstylesheet +# # Revision 1.3 2004/12/15 17:28:22 tipaul # adding bookshelf features : # * create bookshelf on the fly diff --git a/bookshelves/shelves.pl b/bookshelves/shelves.pl index dfd79efe4d..656bcea698 100755 --- a/bookshelves/shelves.pl +++ b/bookshelves/shelves.pl @@ -108,7 +108,11 @@ foreach my $element (sort keys %$shelflist) { ; push (@shelvesloop, \%line); } -$template->param(shelvesloop => \@shelvesloop); +$template->param(shelvesloop => \@shelvesloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; @@ -190,8 +194,18 @@ sub viewshelf { # # $Log$ -# Revision 1.8 2005/08/04 13:19:54 tipaul -# synch'ing 2.2 and head +# Revision 1.9 2006/07/04 14:36:51 toins +# Head & rel_2_2 merged +# +# Revision 1.5.2.5 2006/02/05 21:59:21 kados +# Adds script support for IntranetNav ... see mail to koha-devel for +# details +# +# Revision 1.5.2.4 2006/02/05 21:45:25 kados +# Adds support for intranetstylesheet system pref in Koha scripts +# +# Revision 1.5.2.3 2006/02/04 21:26:47 kados +# Adds support for intranetcolorstylesheet # # Revision 1.5.2.2 2005/04/27 18:15:27 oleonard # Left out some instances in the previous update diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 175b7bfb9d..ae97c6e84c 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -309,7 +309,10 @@ $template->param( genbrname => $genbrname, wastransferred => $wastransferred, trsfitemloop => \@trsfitemloop, branchoptionloop => \@branchoptionloop, - errmsgloop => \@errmsgloop + errmsgloop => \@errmsgloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/reserve.pl b/circ/reserve.pl index c8b296d40b..675268802a 100755 --- a/circ/reserve.pl +++ b/circ/reserve.pl @@ -71,7 +71,7 @@ my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.s my $dbh = C4::Context->dbh; my $strsth="select reservedate,reserves.borrowernumber as bornum, concat(firstname,' ',surname) as borrower, borrowers.phone, borrowers.emailaddress,reserves.biblionumber, reserves.branchcode as branch, items.holdingbranch, items.itemcallnumber, items.itemnumber, notes, notificationdate, reminderdate, priority, reserves.found, biblio.title, biblio.author from reserves left join items on items.itemnumber=reserves.itemnumber, borrowers,biblio where isnull(cancellationdate) && reserves.borrowernumber=borrowers.borrowernumber && reserves.biblionumber=biblio.biblionumber order by reservedate, borrower "; -$strsth="select reservedate,reserves.borrowernumber as bornum,concat(firstname,' ',surname) as borrower, borrowers.phone, borrowers.emailaddress,reserves.biblionumber, reserves.branchcode as branch, items.holdingbranch, items.itemcallnumber, items.itemnumber, notes, notificationdate, reminderdate, priority, reserves.found, biblio.title, biblio.author from reserves left join items on items.itemnumber=reserves.itemnumber , borrowers,biblio where isnull(cancellationdate) && reserves.borrowernumber=borrowers.borrowernumber && reserves.biblionumber=biblio.biblionumberorder by borrower,reservedate " if ($order eq "borrower"); +$strsth="select reservedate,reserves.borrowernumber as bornum,concat(firstname,' ',surname) as borrower, borrowers.phone, borrowers.emailaddress,reserves.biblionumber, reserves.branchcode as branch, items.holdingbranch, items.itemcallnumber, items.itemnumber, notes, notificationdate, reminderdate, priority, reserves.found, biblio.title, biblio.author from reserves left join items on items.itemnumber=reserves.itemnumber , borrowers,biblio where isnull(cancellationdate) && reserves.borrowernumber=borrowers.borrowernumber && reserves.biblionumber=biblio.biblionumber order by borrower,reservedate " if ($order eq "borrower"); $strsth="select reservedate,reserves.borrowernumber as bornum,concat(firstname,' ',surname) as borrower, borrowers.phone, borrowers.emailaddress,reserves.biblionumber, reserves.branchcode as branch, items.holdingbranch, items.itemcallnumber, items.itemnumber, notes, notificationdate, reminderdate, priority, reserves.found, biblio.title, biblio.author from reserves left join items on items.itemnumber=reserves.itemnumber, borrowers,biblio where isnull(cancellationdate) && reserves.borrowernumber=borrowers.borrowernumber && reserves.biblionumber=biblio.biblionumber order by biblio.title, priority,reservedate " if ($order eq "biblio"); my $sth=$dbh->prepare($strsth); warn "".$strsth; @@ -107,7 +107,11 @@ while (my $data=$sth->fetchrow_hashref) { $sth->finish; -$template->param( todaysdate => format_date($todaysdate), - reserveloop => \@reservedata ); +$template->param(todaysdate => format_date($todaysdate), + reserveloop => \@reservedata, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); print "Content-Type: text/html\n\n", $template->output; diff --git a/circ/returns.pl b/circ/returns.pl index d338619ddd..d28ed7d695 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -134,7 +134,7 @@ if ( $query->param('resbarcode') ) { $template->param( itemtitle => $iteminfo->{'title'}, iteminfo => $iteminfo->{'author'}, - branchname => $branchname, + tobranchname => $branchname, name => $name, bornum => $borrnum, borcnum => $borcnum, @@ -267,7 +267,7 @@ if ( $messages->{'ResFound'} ) { debarred => $borr->{'debarred'}, gonenoaddress => $borr->{'gonenoaddress'}, currentbranch => $branches->{ $branch }->{'branchname'}, - branchname => $branches->{ $res->{'branchcode'} }->{'branchname'}, + tobranchname => $branches->{ $res->{'branchcode'} }->{'branchname'}, waiting => 1, itemnumber => $res->{'itemnumber'}, itemtitle => $iteminfo->{'title'}, @@ -506,9 +506,12 @@ $template->param( riloop => \@riloop ); $template->param( genbrname => $branches->{$branch}->{'branchname'}, genprname => $printers->{$printer}->{'printername'}, - branch => $branch, + branchname => $branches->{$branch}->{'branchname'}, printer => $printer, - errmsgloop => \@errmsgloop + errmsgloop => \@errmsgloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); # actually print the page! diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl index 23d32a5cf7..12a46894a3 100644 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -129,7 +129,10 @@ $template->param(headerbackgroundcolor => $headerbackgroundcolor, printername => $printername, branchname => $branchname, printerloop => \@printerloop, - branchloop => \@branchloop + branchloop => \@branchloop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); my $branchcookie=$query->cookie(-name => 'branch', -value => "$branch", -expires => '+1y'); diff --git a/export/marc.pl b/export/marc.pl index 6c4db28859..da8e8ee7ef 100755 --- a/export/marc.pl +++ b/export/marc.pl @@ -15,7 +15,8 @@ my $op=$query->param("op"); my $dbh=C4::Context->dbh; if ($op eq "export") { - print $query->header('Content-Type: text/marc'); + print $query->header( -type => 'application/octet-stream', + -attachment=>'koha.mrc'); my $start_bib = $query->param("start_bib"); my $end_bib = $query->param("end_bib"); my $format = $query->param("format"); @@ -81,6 +82,7 @@ if ($op eq "export") { -default => '', -labels => \%itemtypes, -size => 1, + -tabindex=>'', -multiple => 0 ); $sth->finish; @@ -103,7 +105,12 @@ if ($op eq "export") { flagsrequired => {parameters => 1, management => 1, tools => 1}, debug => 1, }); - $template->param(branchloop=>\@branchloop,CGIitemtype=>$CGIitemtype); + $template->param(branchloop=>\@branchloop, + CGIitemtype=>$CGIitemtype, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; } diff --git a/import/breeding.pl b/import/breeding.pl index 57c8a5bf04..4ab2a2452f 100755 --- a/import/breeding.pl +++ b/import/breeding.pl @@ -30,7 +30,7 @@ use strict; # standard or CPAN modules used -use CGI; +use CGI qw(:standard); use DBI; # Koha modules used @@ -94,7 +94,10 @@ if ($uploadmarc && length($uploadmarc)>0) { ); } - +$template-param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; my $menu; my $file; @@ -103,6 +106,9 @@ my $file; #--------------- # log cleared, as marcimport is (almost) rewritten from scratch. # $Log$ +# Revision 1.5 2006/07/04 14:36:52 toins +# Head & rel_2_2 merged +# # Revision 1.4 2005/05/04 08:52:13 tipaul # synch'ing 2.2 and head # @@ -312,6 +318,9 @@ my $file; #--------------- # log cleared, as marcimport is (almost) rewritten from scratch. # $Log$ +# Revision 1.5 2006/07/04 14:36:52 toins +# Head & rel_2_2 merged +# # Revision 1.4 2005/05/04 08:52:13 tipaul # synch'ing 2.2 and head # diff --git a/maint/catmaintain.pl b/maint/catmaintain.pl index f29b1c8894..f6ca90d603 100755 --- a/maint/catmaintain.pl +++ b/maint/catmaintain.pl @@ -100,6 +100,10 @@ if ($type eq 'allsub'){ $template->param(type => 'intranet', "$type-p" => 1, - %params); + %params, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/deletemem.pl b/members/deletemem.pl index b0bbcfbe7c..1a50fb2e60 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -102,6 +102,10 @@ if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){ # print "Guarantees"; # } # print ""; +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; } else { diff --git a/members/member-flags.pl b/members/member-flags.pl index 2e117f88c9..751665e25d 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -81,7 +81,11 @@ if ($input->param('newflags')) { $template->param(member => $member, surname => $bor->{'surname'}, firstname => $bor->{'firstname'}, - loop => \@loop); + loop => \@loop, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/member-password.pl b/members/member-password.pl index a5251493c3..c929c2adfe 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -80,6 +80,10 @@ if ( $newpassword ) { } -$template->param( member => $member ); +$template->param( member => $member, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/member.pl b/members/member.pl index 85d3535a48..de2df9b6fa 100755 --- a/members/member.pl +++ b/members/member.pl @@ -98,6 +98,8 @@ for (my $i=0; $i < $count; $i++){ streetaddress => $results->[$i]{'streetaddress'}, city => $results->[$i]{'city'}, branchcode => $results->[$i]{'branchcode'}, + overdues => $od, + issues => $issue, odissue => "$od/$issue", fines => sprintf("%.2f",$fines), borrowernotes => $results->[$i]{'borrowernotes'}, @@ -111,6 +113,10 @@ for (my $i=0; $i < $count; $i++){ $template->param( member => $member, numresults => $count, - resultsloop => \@resultsdata ); + resultsloop => \@resultsdata, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/memberentry.pl b/members/memberentry.pl index 8ed7e01cc8..6dea08ced6 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -265,6 +265,7 @@ if ($delete){ if ($ethnicitycategoriescount>=0) { $ethcatpopup = CGI::popup_menu(-name=>'ethnicity', -id => 'ethnicity', + -tabindex=>'', -values=>$categories, -default=>$data{'ethnicity'}, -labels=>$labels); diff --git a/members/members-home.pl b/members/members-home.pl index 1a702b1e8e..2f0ef84dd2 100755 --- a/members/members-home.pl +++ b/members/members-home.pl @@ -33,5 +33,8 @@ if($quicksearch){ }); } - +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/members/moremember.pl b/members/moremember.pl index 8bf6e41640..ab9b54499a 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -229,10 +229,15 @@ if (-e $htdocs."$picture") $template->param($data); $template->param( bornum => $bornum, - totalprice =>$totalprice, - totaldue =>$total, + totalprice =>sprintf("%.2f",$totalprice), + totaldue => sprintf("%.2f",$total), issueloop => \@issuedata, unvalidlibrarian => $unvalidlibrarian, - reserveloop => \@reservedata); + reserveloop => \@reservedata, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + patronimages => C4::Context->preference("patronimages"), + ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/members/setdebar.pl b/members/setdebar.pl index 424f5002af..2c8ec39d11 100644 --- a/members/setdebar.pl +++ b/members/setdebar.pl @@ -35,7 +35,6 @@ my $flagsrequired; $flagsrequired->{borrower}=1; my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); - my $destination = $input->param("destination"); my $cardnumber = $input->param("cardnumber"); my $borrowernumber=$input->param('borrowernumber'); diff --git a/misc/Install.pm b/misc/Install.pm index 6c098fd34e..e4c73abc4b 100644 --- a/misc/Install.pm +++ b/misc/Install.pm @@ -890,6 +890,18 @@ sub checkperlmodules(;$) { push @missing, "Net::Z3950"; } } + unless (eval {require LWP::Simple) { + showmessage(getmessage('LWP::Simple'), 'PressEnter', '', 1); + if ($#missing>=0) { # see above note + push @missing, "LWP::Simple"; + } + } + unless (eval {require XML::Simple) { + showmessage(getmessage('XML::Simple'), 'PressEnter', '', 1); + if ($#missing>=0) { # see above note + push @missing, "XML::Simple"; + } + } # # Print out a list of any missing modules diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 061e23e20a..f8c9237b40 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -80,10 +80,6 @@ my ($template, $loggedinuser, $cookie) authnotrequired => 1, debug => 1, }); -$template->param(LibraryName => C4::Context->preference("LibraryName"), - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), -); # fill arrays my @loop_data =(); @@ -182,7 +178,13 @@ foreach my $field (@fields) { for my $i (0..$#subf) { next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10); $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; - $this_row{$subf[$i][0]} =$subf[$i][1]; + if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) { + $this_row{$subf[$i][0]}="$subf[$i][1]"; + } elsif ($tagslib->{$field->tag()}->{$subf[$i][0]}->{kohafield} eq "biblioitems.isbn") { + $this_row{$subf[$i][0]}=DisplayISBN($subf[$i][1]); + } else { + $this_row{$subf[$i][0]}=get_authorised_value_desc($field->tag(), $subf[$i][0], $subf[$i][1], '', $dbh); + } } if (%this_row) { push(@big_array, \%this_row); diff --git a/opac/opac-addbookbybiblionumber.pl b/opac/opac-addbookbybiblionumber.pl index 11ee7e5e07..470cd38c3b 100755 --- a/opac/opac-addbookbybiblionumber.pl +++ b/opac/opac-addbookbybiblionumber.pl @@ -71,6 +71,7 @@ if ($shelfnumber) { -values => \@shelvesloop, -labels => \%shelvesloop, -size => 1, + -tabindex=>'', -multiple => 0 ); } @@ -91,6 +92,9 @@ if ($shelfnumber) { output_html_with_http_headers $query, $cookie, $template->output; } # $Log$ +# Revision 1.5 2006/07/04 14:36:52 toins +# Head & rel_2_2 merged +# # Revision 1.4 2006/05/21 02:10:32 kados # syncing dev-week and HEAD # diff --git a/opac/opac-dictionary.pl b/opac/opac-dictionary.pl index 4e35c36cee..fb118c7409 100755 --- a/opac/opac-dictionary.pl +++ b/opac/opac-dictionary.pl @@ -205,7 +205,10 @@ if ($op eq "do_search") { } else { $to = (($startfrom+1)*$resultsperpage); } - $template->param(anindex => $input->param('index')); + $template->param(anindex => $input->param('index'), + opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"), + opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"), + ); $template->param(result => \@results, catresult=> \@catresults, search => $search[0], diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 0cc07cf2ab..b65229e3af 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -62,7 +62,6 @@ foreach my $language (getalllanguages()) { $counter++; } my $languages_count = @options; - if($languages_count > 1){ $template->param(languages => \@options); } @@ -92,8 +91,7 @@ sub getbranchinfo { } -$template->param(CGIitemtype => $CGIitemtype, - suggestion => C4::Context->preference("suggestion"), +$template->param( suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), textmessaging => $borrower->{textmessaging}, opaclargeimage => C4::Context->preference("opaclargeimage"), diff --git a/opac/opac-moredetail.pl b/opac/opac-moredetail.pl index 214d13e961..6969e03948 100755 --- a/opac/opac-moredetail.pl +++ b/opac/opac-moredetail.pl @@ -8,7 +8,7 @@ use strict; use C4::Search; use C4::Koha; use C4::Output; -use C4::Acquisitions; +use C4::Acquisition; use C4::Biblio; use C4::Date; use HTML::Template; diff --git a/opac/opac-passwd.pl b/opac/opac-passwd.pl index a1440c952d..bf139236d7 100755 --- a/opac/opac-passwd.pl +++ b/opac/opac-passwd.pl @@ -73,6 +73,10 @@ if ( $query->param('Oldkey') && $query->param('Newkey') && $query->param('Confir # Called Empty, Ask for data. $template->param('Ask_data' => '1'); } + +$template->param(LibraryName => C4::Context->preference("LibraryName"), +); + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 8c9ef0d9c9..00d922b8be 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -85,8 +85,9 @@ if ($op eq "do_search") { $searchdesc .= $and_or[$i].$excluding[$i]." ".($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]); } else { $searchdesc = $excluding[$i].($marclist[$i]?$marclist[$i]:"*").$operator[$i].$value[$i] if ($value[$i]); - if ($marclist[$i] eq "biblioitems.isbn") { - $value[$i] =~ s/-//g; + if ($marclist[$i] eq "biblioitems.isbn") { + $value[$i] =~ s/-//g; + } } } if ($itemtypesstring ne ''){ @@ -391,7 +392,7 @@ $template->param( phraseorterm => $phraseorterm ); my @oldbranches; my @oldselect_branch; my %oldselect_branches; - my ($oldcount2,@oldbranches)=branches(); + my ($oldcount2,@oldbranches)=branches(); push @oldselect_branch, ""; $oldselect_branches{''} = ""; for (my $i=0;$i<$oldcount2;$i++){ @@ -425,7 +426,6 @@ $template->param( phraseorterm => $phraseorterm ); # CHRIS : Whats this? # classlist => $classlist, - CGIitemtype => $CGIitemtype, CGIbranch => $CGIbranch, suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), diff --git a/opac/opac-searchresults.pl b/opac/opac-searchresults.pl index bf54a86034..bacbb3adf1 100755 --- a/opac/opac-searchresults.pl +++ b/opac/opac-searchresults.pl @@ -123,9 +123,6 @@ if ($count>$number_of_results) { } $template->param(numbers => $numbers, - LibraryName => C4::Context->preference("LibraryName"), - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index eb9458a0a8..8883e29b1c 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -23,14 +23,29 @@ my $suggestedbyme = $input->param('suggestedbyme'); my $op = $input->param('op'); $op = 'else' unless $op; +my ($template, $borrowernumber, $cookie); + my $dbh = C4::Context->dbh; -my ($template, $borrowernumber, $cookie) - = get_template_and_user({template_name => "opac-suggestions.tmpl", - type => "opac", - query => $input, - authnotrequired => 1, - flagsrequired => {borrow => 1}, + +if (C4::Context->preference("AnonSuggestions")) { + ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-suggestions.tmpl", + query => $input, + type => "opac", + authnotrequired => 1, + }); +if (!$borrowernumber) { + $borrowernumber = C4::Context->preference("AnonSuggestions"); +} +} else { + ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => "opac-suggestions.tmpl", + query => $input, + type => "opac", + authnotrequired => 1, }); +} + if ($op eq "add_confirm") { &newsuggestion($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,''); # empty fields, to avoid filter in "searchsuggestion" @@ -61,7 +76,5 @@ $template->param(suggestions_loop => $suggestions_loop, status => $status, suggestedbyme => $suggestedbyme, "op_$op" => 1, - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/reports/acquisitions_stats.pl b/reports/acquisitions_stats.pl index 2ef1b6f42d..90225a341e 100755 --- a/reports/acquisitions_stats.pl +++ b/reports/acquisitions_stats.pl @@ -59,17 +59,19 @@ my $mime = $input->param("MIME"); my $del = $input->param("sep"); #warn "calcul : ".$calc; -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => $fullreportname, - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => { editcatalogue => 1 }, - debug => 1, - } -); -$template->param( do_it => $do_it ); +my ($template, $borrowernumber, $cookie) + = get_template_and_user({template_name => $fullreportname, + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {editcatalogue => 1}, + debug => 1, + }); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { #warn diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl index 9f2bbbe770..3c7cba5f53 100755 --- a/reports/bor_issues_top.pl +++ b/reports/bor_issues_top.pl @@ -62,7 +62,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($limit, $column, \@filters); @@ -410,4 +414,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/borrowers_out.pl b/reports/borrowers_out.pl index 49e7d8bbea..c79426e23b 100755 --- a/reports/borrowers_out.pl +++ b/reports/borrowers_out.pl @@ -61,7 +61,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($limit, $column, \@filters); @@ -332,4 +336,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/borrowers_stats.pl b/reports/borrowers_stats.pl index e7f1294992..5d37d55d44 100755 --- a/reports/borrowers_stats.pl +++ b/reports/borrowers_stats.pl @@ -301,7 +301,7 @@ sub calculate { $strsth2 .= "select distinctrow $colfield from borrowers where $column is not null"; if ( $colfilter ) { $strsth2 .= " and $colfield LIKE ? "; - } + } $strsth2 .= " and $status='1' " if ($status); $strsth2 .= " order by $colfield"; # warn "". $strsth2; @@ -408,4 +408,3 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl index d7d50af048..6044b198f8 100755 --- a/reports/cat_issues_top.pl +++ b/reports/cat_issues_top.pl @@ -62,7 +62,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($limit, $column, \@filters); @@ -421,4 +425,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/catalogue_out.pl b/reports/catalogue_out.pl index 05d5ca5cb3..39f0c685f7 100755 --- a/reports/catalogue_out.pl +++ b/reports/catalogue_out.pl @@ -61,7 +61,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($limit, $column, \@filters); @@ -346,4 +350,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/inventory.pl b/reports/inventory.pl index dcd2fc404a..1f32ec91ca 100755 --- a/reports/inventory.pl +++ b/reports/inventory.pl @@ -24,6 +24,7 @@ use C4::Context; use C4::Output; use C4::Interface::CGI::Output; use C4::Circulation::Circ2; +use C4::Date; use HTML::Template; # Fixed variables @@ -46,6 +47,8 @@ my $markseen = $input->param('markseen'); $offset=0 unless $offset; my $pagesize = $input->param('pagesize'); $pagesize=20 unless $pagesize; +my $uploadbarcodes = $input->param('uploadbarcodes'); +# warn "uploadbarcodes : ".$uploadbarcodes; my ($template, $borrowernumber, $cookie) = get_template_and_user({template_name => "reports/inventory.tmpl", @@ -60,20 +63,66 @@ $template->param(minlocation => $minlocation, offset => $offset, pagesize => $pagesize, datelastseen => $datelastseen, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); -if ($markseen) { - foreach my $field ($input->param) { - if ($field =~ /SEEN-(.*)/) { - &itemseen($1); +if ($uploadbarcodes && length($uploadbarcodes)>0){ + my $dbh=C4::Context->dbh; + my $date=format_date($input->param('setdate')); + $date = format_date("today") unless $date; +# warn "$date"; + my $strsth="update items set (datelastseen = $date) where items.barcode =?"; + my $qupdate = $dbh->prepare($strsth); + my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null"; + my $qonloan = $dbh->prepare($strsth); + my $strsth="select * from items where items.barcode =? and issues.wthdrawn=1"; + my $qwthdrawn = $dbh->prepare($strsth); + my @errorloop; + my $count=0; + while (my $barcode=<$uploadbarcodes>){ + chomp $barcode; +# warn "$barcode"; + if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){ + push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1}; + }else{ + $qupdate->execute($barcode); + $count += $qupdate->rows; +# warn "$count"; + if ($count){ + $qonloan->execute($barcode); + if ($qonloan->rows){ + my $data = $qonloan->fetchrow_hashref; + my ($doreturn, $messages, $iteminformation, $borrower) =returnbook($barcode, $data->{homebranch}); + if ($doreturn){push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_RET'=>1}} + else {push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_NOT_RET'=>1}} + } + } else { + push @errorloop, {'barcode'=>$barcode,'ERR_BARCODE'=>1}; + } } } -} -if ($minlocation) { - my $res = C4::Circulation::Circ2::listitemsforinventory($minlocation,$maxlocation,$datelastseen,$offset,$pagesize); - $template->param(loop =>$res, - nextoffset => ($offset+$pagesize), - prevoffset => ($offset?$offset-$pagesize:0), - ); + $qupdate->finish; + $qonloan->finish; + $qwthdrawn->finish; + $template->param(date=>$date,Number=>$count); +# $template->param(errorfile=>$errorfile) if ($errorfile); + $template->param(errorloop=>\@errorloop) if (@errorloop); +}else{ + if ($markseen) { + foreach my $field ($input->param) { + if ($field =~ /SEEN-(.*)/) { + &itemseen($1); + } + } + } + if ($minlocation) { + my $res = C4::Circulation::Circ2::listitemsforinventory($minlocation,$maxlocation,$datelastseen,$offset,$pagesize); + $template->param(loop =>$res, + nextoffset => ($offset+$pagesize), + prevoffset => ($offset?$offset-$pagesize:0), + ); + } } output_html_with_http_headers $input, $cookie, $template->output; diff --git a/reports/issues_avg_stats.pl b/reports/issues_avg_stats.pl index 8721230972..edf5c8dc18 100755 --- a/reports/issues_avg_stats.pl +++ b/reports/issues_avg_stats.pl @@ -64,7 +64,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($line, $column, $rodsp, $podsp, $calc, \@filters); @@ -589,4 +593,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index f672e88eef..cabf3e874b 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -68,7 +68,11 @@ my ($template, $borrowernumber, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param(do_it => $do_it); +$template->param(do_it => $do_it, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); if ($do_it) { # Displaying results my $results = calculate($line, $column, $podsp, $type, $daysel, $monthsel, $calc, \@filters); @@ -541,4 +545,4 @@ sub calculate { return \@mainloop; } -1; \ No newline at end of file +1; diff --git a/reports/manager.pl b/reports/manager.pl index 6b1895244c..22a21df6d8 100755 --- a/reports/manager.pl +++ b/reports/manager.pl @@ -40,7 +40,11 @@ my ($template, $borrowernumber, $cookie) debug => 1, }); $template->param(do_it => $do_it, - report_name => $report_name); + report_name => $report_name, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); my $cgidir = C4::Context->config('intranetdir')."/cgi-bin/reports/"; unless (opendir(DIR, "$cgidir")) { $cgidir = C4::Context->intranetdir."/reports/"; diff --git a/reports/reports-home.pl b/reports/reports-home.pl index a220183ca2..bf5ce35c17 100644 --- a/reports/reports-home.pl +++ b/reports/reports-home.pl @@ -17,4 +17,8 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {catalogue => 1}, debug => 1, }); +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/search.marc/dictionary.pl b/search.marc/dictionary.pl index d358e5d10f..0a5c7ae6d9 100755 --- a/search.marc/dictionary.pl +++ b/search.marc/dictionary.pl @@ -252,9 +252,13 @@ if ($op eq "do_search") { } $template->param(search => $search[0], - marclist =>$field, - type=>$type, - anindex => $input->param('index')); + marclist =>$field, + type=>$type, + anindex => $input->param('index'), + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); # Print the page output_html_with_http_headers $input, $cookie, $template->output; diff --git a/search.marc/search.pl b/search.marc/search.pl index 7e454a5049..24a2015d90 100755 --- a/search.marc/search.pl +++ b/search.marc/search.pl @@ -150,17 +150,14 @@ if ($op eq "do_search") { $startfrom*$resultsperpage, $resultsperpage,$orderby,$desc_or_asc); if ($total == 1) { # if only 1 answer, jump directly to the biblio - # here we need to check if MARC searching is turned on or off. - # if on, go to MARCdetail.pl else go to - # detail.pl - my $marc_bool = C4::Context->boolean_preference("MARC") || 0; - if ($marc_bool eq "1") { - print $query->redirect("/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=".@$results[0]->{biblionumber}); - } - else { - print $query->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=".@$results[0]->{biblionumber}); - } - exit + if (C4::Context->preference("IntranetBiblioDefaultView") eq "normal") { + print $query->redirect("/cgi-bin/koha/detail.pl?bib=".@$results[0]->{biblionumber}); + } elsif (C4::Context->preference("IntranetBiblioDefaultView") eq "marc") { + print $query->redirect("/cgi-bin/koha/MARCdetail.pl?bib=".@$results[0]->{biblionumber}); + } else { + print $query->redirect("/cgi-bin/koha/ISBDdetail.pl?bib=".@$results[0]->{biblionumber}); + } + exit } ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "search.marc/result.tmpl", @@ -213,6 +210,7 @@ if ($op eq "do_search") { } else { $to = (($startfrom+1)*$resultsperpage); } + my $defaultview = 'BiblioDefaultView'.C4::Context->preference('IntranetBiblioDefaultView'); $template->param(result => $results, startfrom=> $startfrom, displaynext=> $displaynext, @@ -226,11 +224,13 @@ if ($op eq "do_search") { to=>$to, numbers=>\@numbers, searchdesc=> $searchdesc, + desc_asc=>$desc_or_asc, + orderby=>$orderby, MARC_ON => C4::Context->preference("marc"), + $defaultview => 1, ); } elsif ($op eq "AddStatement") { - ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "search.marc/search.tmpl", query => $query, @@ -319,6 +319,7 @@ else { my $marclist = CGI::scrolling_list(-name=>"marclist", -values=> $marcarray, -size=>1, + -tabindex=>'', -multiple=>0, -onChange => "sql_update()", ); @@ -345,6 +346,7 @@ else { -values => \@itemtype, -labels => \%itemtypes, -size => 1, + -tabindex=>'', -multiple => 0 ); $sth->finish; @@ -374,6 +376,10 @@ else { # Print the page +$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; # Local Variables: diff --git a/search.marc/suggest.pl b/search.marc/suggest.pl index 5b0e857682..1eb528c5c3 100755 --- a/search.marc/suggest.pl +++ b/search.marc/suggest.pl @@ -54,7 +54,11 @@ my ($template, $loggedinuser, $cookie) flagsrequired => {editcatalogue => 1}, debug => 1, }); -$template->param("loop" => \@loop_suggests); +$template->param("loop" => \@loop_suggests, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), + ); output_html_with_http_headers $query, $cookie, $template->output; 1; diff --git a/suggestion/acceptorreject.pl b/suggestion/acceptorreject.pl index af15cf6725..528340e7aa 100755 --- a/suggestion/acceptorreject.pl +++ b/suggestion/acceptorreject.pl @@ -54,6 +54,9 @@ if ($op eq "delete_confirm") { my $suggestions_loop= &searchsuggestion("","","","",'ASKED',""); $template->param(suggestions_loop => $suggestions_loop, - "op_$op" => 1, + "op_$op" => 1, + intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), + intranetstylesheet => C4::Context->preference("intranetstylesheet"), + IntranetNav => C4::Context->preference("IntranetNav"), ); output_html_with_http_headers $input, $cookie, $template->output; diff --git a/updater/updatedatabase b/updater/updatedatabase index bbb5fda31a..85459b4bf5 100755 --- a/updater/updatedatabase +++ b/updater/updatedatabase @@ -1,6 +1,10 @@ #!/usr/bin/perl +<<<<<<< updatedatabase # $Id$ +======= +# $Id$ +>>>>>>> 1.100.2.46 # Database Updater # This script checks for required updates to the database. @@ -17,6 +21,7 @@ use strict; # CPAN modules use DBI; use Getopt::Long; + # Koha modules use C4::Context; @@ -40,9 +45,7 @@ my ( ); my $silent; -GetOptions( - 's' =>\$silent - ); +GetOptions( 's' => \$silent ); my $dbh = C4::Context->dbh; print "connected to your DB. Checking & modifying it\n" unless $silent; $|=1; # flushes output @@ -140,10 +143,78 @@ my %requiretables = ( `city_zipcode` char(20), PRIMARY KEY (`cityid`) )", +<<<<<<< updatedatabase roadtype => "(`roadtypeid` int auto_increment, `road_type` char(100) NOT NULL, PRIMARY KEY (`roadtypeid`) +======= + marc_word => "( + bibid bigint(20) NOT NULL default '0', + tag char(3) NOT NULL default '', + tagorder tinyint(4) NOT NULL default '1', + subfieldid char(1) NOT NULL default '', + subfieldorder tinyint(4) NOT NULL default '1', + word varchar(255) NOT NULL default '', + sndx_word varchar(255) NOT NULL default '', + KEY bibid (bibid), + KEY tag (tag), + KEY tagorder (tagorder), + KEY subfieldid (subfieldid), + KEY subfieldorder (subfieldorder), + KEY word (word), + KEY sndx_word (sndx_word) + )", + marc_breeding => "( id bigint(20) NOT NULL auto_increment, + file varchar(80) NOT NULL default '', + isbn varchar(10) NOT NULL default '', + title varchar(128) default NULL, + author varchar(80) default NULL, + marc text NOT NULL, + encoding varchar(40) default NULL, + PRIMARY KEY (id), + KEY title (title), + KEY isbn (isbn) + )", + authorised_values => "(id int(11) NOT NULL auto_increment, + category char(10) NOT NULL default '', + authorised_value char(80) NOT NULL default '', + lib char(80) NULL, + PRIMARY KEY (id), + KEY name (category) + )", + userflags => "( bit int(11) NOT NULL default '0', + flag char(30), flagdesc char(255), + defaulton int(11) + )", + auth_types => "( + authtypecode char(10) not NULL, + authtypetext char(255) not NULL, + auth_tag_to_report char(3) not NULL, + summary text not NULL, + PRIMARY KEY (authtypecode) + )", + biblio_framework => "( + frameworkcode char(4) not NULL, + frameworktext char(255) not NULL, + PRIMARY KEY (frameworkcode) + )", + auth_subfield_structure => "( + authtypecode char(10) NOT NULL default '', + tagfield char(3) NOT NULL default '', + tagsubfield char(1) NOT NULL default '', + liblibrarian char(255) NOT NULL default '', + libopac char(255) NOT NULL default '', + repeatable tinyint(4) NOT NULL default '0', + mandatory tinyint(4) NOT NULL default '0', + tab tinyint(1) default NULL, + authorised_value char(10) default NULL, + value_builder char(80) default NULL, + seealso char(255) default NULL, + PRIMARY KEY (authtypecode,tagfield,tagsubfield), + KEY tab (authtypecode,tab) +>>>>>>> 1.100.2.46 )", +<<<<<<< updatedatabase labels => "( labelid int(11) NOT NULL auto_increment, @@ -180,9 +251,160 @@ my %requiretables = ( borrower2 integer )", +======= + auth_tag_structure => "( + authtypecode char(10) NOT NULL default '', + tagfield char(3) NOT NULL default '', + liblibrarian char(255) NOT NULL default '', + libopac char(255) NOT NULL default '', + repeatable tinyint(4) NOT NULL default '0', + mandatory tinyint(4) NOT NULL default '0', + authorised_value char(10) default NULL, + PRIMARY KEY (authtypecode,tagfield) + )", + auth_header => "( + authid bigint(20) unsigned NOT NULL auto_increment, + authtypecode char(10) NOT NULL default '', + datecreated date NOT NULL default '0000-00-00', + datemodified date default NULL, + origincode char(20) default NULL, + PRIMARY KEY (authid), + KEY origincode (origincode) + ) ", + auth_subfield_table => "( + subfieldid bigint(20) unsigned NOT NULL auto_increment, + authid bigint(20) unsigned NOT NULL default '0', + tag char(3) NOT NULL default '', + tagorder tinyint(4) NOT NULL default '1', + tag_indicator char(2) NOT NULL default '', + subfieldcode char(1) NOT NULL default '', + subfieldorder tinyint(4) NOT NULL default '1', + subfieldvalue varchar(255) default NULL, + PRIMARY KEY (subfieldid), + KEY authid (authid), + KEY tag (tag), + KEY subfieldcode (subfieldcode), + KEY subfieldvalue (subfieldvalue) + )", + auth_word => "( + authid bigint(20) NOT NULL default '0', + tagsubfield char(4) NOT NULL default '', + tagorder tinyint(4) NOT NULL default '1', + subfieldorder tinyint(4) NOT NULL default '1', + word varchar(255) NOT NULL default '', + sndx_word varchar(255) NOT NULL default '', + KEY authid (authid), + KEY marc_search (tagsubfield,word), + KEY word (word), + KEY sndx_word (sndx_word) + )", + suggestions => "( + suggestionid int(8) NOT NULL auto_increment, + suggestedby int(11) NOT NULL default '0', + managedby int(11) default NULL , + STATUS varchar(10) NOT NULL default '', + note text, + author varchar(80) default NULL , + title varchar(80) default NULL , + copyrightdate smallint(6) default NULL , + publishercode varchar(255) default NULL , + date timestamp(8) NOT NULL , + volumedesc varchar(255) default NULL , + publicationyear smallint(6) default '0', + place varchar(255) default NULL , + isbn varchar(10) default NULL , + mailoverseeing smallint(1) default '0', + biblionumber int(11) default NULL , + PRIMARY KEY (suggestionid) , + KEY suggestedby(suggestedby) , + KEY managedby(managedby) + )", + aqbasket => "(basketno int(11) NOT NULL auto_increment, + creationdate date, + closedate date, + booksellerid varchar(10), + authorisedby varchar(10), + booksellerinvoicenumber text, + PRIMARY KEY (basketno) + )", + serial => "(serialid int(11) NOT NULL auto_increment, + biblionumber varchar(100) NOT NULL default '', + subscriptionid varchar(100) NOT NULL default '', + serialseq varchar(100) NOT NULL default '', + status tinyint(4) NOT NULL default '0', + planneddate date NOT NULL default '0000-00-00', + publishedddate date NOT NULL default '0000-00-00', + PRIMARY KEY (serialid) + )", + subscription => "(biblionumber int(11) NOT NULL default '0', + subscriptionid int(11) NOT NULL auto_increment, + librarian varchar(100) default '', + startdate date default '0000-00-00', + aqbooksellerid int(11) default '0', + cost int(11) default '0', + aqbudgetid int(11) default '0', + weeklength tinyint(4) default '0', + monthlength tinyint(4) default '0', + numberlength tinyint(4) default '0', + periodicity tinyint(4) default '0', + dow varchar(100) default '', + numberingmethod varchar(100) default '', + notes text, + status varchar(100) NOT NULL default '', + add1 int(11) default 0, + every1 int(11) default 0, + whenmorethan1 int(11) default 0, + setto1 int(11), + lastvalue1 int(11), + add2 int(11) default 0, + every2 int(11) default 0, + whenmorethan2 int(11) default 0, + setto2 int(11), + lastvalue2 int(11), + add3 int(11) default 0, + every3 int(11) default 0, + innerloop1 int(11) default 0, + innerloop2 int(11) default 0, + innerloop3 int(11) default 0, + whenmorethan3 int(11) default 0, + setto3 int(11), + lastvalue3 int(11), + PRIMARY KEY (subscriptionid) + )", + subscriptionhistory => "(biblionumber int(11) NOT NULL default '0', + subscriptionid int(11) NOT NULL default '0', + histstartdate date NOT NULL default '0000-00-00', + enddate date default '0000-00-00', + missinglist longtext NOT NULL, + recievedlist longtext NOT NULL, + opacnote varchar(150) NOT NULL default '', + librariannote varchar(150) NOT NULL default '', + PRIMARY KEY (subscriptionid), + KEY biblionumber (biblionumber) + )", + labels => "(labelid int(11) NOT NULL auto_increment, + itemnumber varchar(100) NOT NULL default '', + timestamp timestamp(14) NOT NULL, + PRIMARY KEY (labelid) + )", + labels_conf => "(id int(4) NOT NULL auto_increment, + barcodetype char(100) default '', + title tinyint(1) default '0', + isbn tinyint(1) default '0', + itemtype tinyint(1) default '0', + barcode tinyint(1) default '0', + dewey tinyint(1) default '0', + class tinyint(1) default '0', + author tinyint(1) default '0', + papertype char(100) default '', + startrow int(2) default NULL, + PRIMARY KEY (id) + )", +>>>>>>> 1.100.2.46 ); my %requirefields = ( +<<<<<<< updatedatabase subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text NULL'}, itemtypes => { 'imageurl' => 'char(200) NULL'}, aqbookfund => { 'branchcode' => 'varchar(4) NULL'}, @@ -191,6 +413,72 @@ my %requirefields = ( auth_subfield_structure =>{ 'hidden' => 'TINYINT(3) NOT NULL UNSIGNED ZEROFILL', 'kohafield' => 'VARCHAR(45) NOT NULL', 'linkid' => 'TINYINT(1) NOT NULL UNSIGNED', 'isurl' => 'TINYINT(1) UNSIGNED'}, statistics => { 'associatedborrower' => 'integer'}, # tablename => { 'field' => 'fieldtype' }, +======= + biblio => { 'abstract' => 'text' }, + deletedbiblio => { 'abstract' => 'text', 'marc' => 'blob' }, + deleteditems => + { 'marc' => 'blob', 'paidfor' => 'text', 'location' => 'varchar(80)' }, + biblioitems => { + 'lccn' => 'char(25)', + 'url' => 'varchar(255)', + 'marc' => 'text' + }, + deletedbiblioitems => { + 'lccn' => 'char(25)', + 'url' => 'varchar(255)', + 'marc' => 'text' + }, + branchtransfers => { 'datearrived' => 'datetime' }, + statistics => { 'borrowernumber' => 'int(11)' }, + aqbooksellers => { + 'invoicedisc' => 'float(6,4)', + 'nocalc' => 'int(11)' + }, + borrowers => { + 'userid' => 'char(30)', + 'password' => 'char(30)', + 'flags' => 'int(11)', + 'textmessaging' => 'varchar(30)', + 'zipcode' => 'varchar(25)', + 'homezipcode' => 'varchar(25)', + 'sort1' => 'char(80)', + 'sort2' => 'char(80)', + }, + aqorders => { + 'budgetdate' => 'date', + 'sort1' => 'char(80)', + 'sort2' => 'char(80)', + }, + aqbudget => { + 'aqbudgetid' => 'tinyint(4) auto_increment primary key', + 'branchcode' => 'varchar(4)', + }, + aqbookfund => { 'branchcode' => 'varchar(4)', }, + items => { 'paidfor' => 'text', 'location' => 'char(80)' }, + + #added so that reference items are not available for reserves... + itemtypes => { 'notforloan' => 'smallint(6)' }, + systempreferences => { + 'explanation' => 'char(80)', + 'type' => 'char(20)', + 'options' => 'text' + }, + z3950servers => { 'syntax' => 'char(80)' }, + marc_tag_structure => + { 'frameworkcode' => 'char(4) not NULL default \'\'' }, + marc_subfield_structure => { + 'seealso' => 'char(255)', + 'frameworkcode' => 'char(4) not NULL default \'\'', + 'hidden' => 'tinyint(1)', + 'isurl' => 'tinyint(1)', + 'link' => 'char(80)', + }, + bookshelf => { + 'owner' => 'char(80)', + 'category' => 'char(1)', + }, + marc_biblio => { 'frameworkcode' => 'char(4) not NULL default \'\'' }, +>>>>>>> 1.100.2.46 ); my %dropable_table = ( @@ -204,10 +492,21 @@ my %dropable_table = ( ); my %uselessfields = ( +<<<<<<< updatedatabase # tablename => "field1,field2", borrowers => "suburb,altstreetaddress,altsuburb,altcity,studentnumber,school,area,preferredcont,altcp", deletedborrowers=> "suburb,altstreetaddress,altsuburb,altcity,studentnumber,school,area,preferredcont,altcp", ); +======= + aqorders => "requisitionedby,authorisedby,booksellerid, + deliverydays,followupdays, + numberfollowupsallowed,numberfollowupssent, + dateprinted,sourced,quantityreceiveddamaged, + subscriptionfrom,subscriptionto + " +); + +>>>>>>> 1.100.2.46 # the other hash contains other actions that can't be done elsewhere. they are done # either BEFORE of AFTER everything else, depending on "when" entry (default => AFTER) @@ -220,171 +519,945 @@ my %uselessfields = ( # values given in the %tabledata hash. my %tabledata = ( +<<<<<<< updatedatabase # tablename => [ # { uniquefielrequired => 'fieldname', # the primary key in the table # fieldname => fieldvalue, # fieldname2 => fieldvalue2, # }, # ], +======= + userflags => [ + { + uniquefieldrequired => 'bit', + bit => 0, + flag => 'superlibrarian', + flagdesc => 'Access to all librarian functions', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 1, + flag => 'circulate', + flagdesc => 'Circulate books', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 2, + flag => 'catalogue', + flagdesc => 'View Catalogue (Librarian Interface)', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 3, + flag => 'parameters', + flagdesc => 'Set Koha system paramters', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 4, + flag => 'borrowers', + flagdesc => 'Add or modify borrowers', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 5, + flag => 'permissions', + flagdesc => 'Set user permissions', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 6, + flag => 'reserveforothers', + flagdesc => 'Reserve books for patrons', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 7, + flag => 'borrow', + flagdesc => 'Borrow books', + defaulton => 1 + }, + { + uniquefieldrequired => 'bit', + bit => 8, + flag => 'reserveforself', + flagdesc => 'Reserve books for self', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 9, + flag => 'editcatalogue', + flagdesc => 'Edit Catalogue (Modify bibliographic/holdings data)', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 10, + flag => 'updatecharges', + flagdesc => 'Update borrower charges', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 11, + flag => 'acquisition', + flagdesc => 'Acquisition and/or suggestion management', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 12, + flag => 'management', + flagdesc => 'Set library management parameters', + defaulton => 0 + }, + { + uniquefieldrequired => 'bit', + bit => 13, + flag => 'tools', + flagdesc => 'Use tools (export, import, barcodes)', + defaulton => 0 + }, + ], +>>>>>>> 1.100.2.46 systempreferences => [ { uniquefieldrequired => 'variable', +<<<<<<< updatedatabase variable => 'Activate_Log', value => 'On', forceupdate => { 'explanation' => 1, 'type' => 1}, explanation => 'Turn Log Actions on DB On an Off', type => 'YesNo', +======= + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + variable => 'LibraryName', + value => +'Koha
Free Software ILS

Koha : a gift, a contribution
in Maori
', + explanation => 'Library name as shown on main opac page', + type => '' + +>>>>>>> 1.100.2.46 }, { uniquefieldrequired => 'variable', +<<<<<<< updatedatabase variable => 'IndependantBranches', value => 0, forceupdate => { 'explanation' => 1, 'type' => 1}, explanation => 'Turn Branch independancy management On an Off', type => 'YesNo', +======= + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + variable => 'autoMemberNum', + value => '1', + explanation => 'Member number is auto-calculated', + type => 'YesNo' + +>>>>>>> 1.100.2.46 }, { uniquefieldrequired => 'variable', +<<<<<<< updatedatabase variable => 'ReturnBeforeExpiry', value => 'Off', forceupdate => { 'explanation' => 1, 'type' => 1}, explanation => 'If Yes, Returndate on issuing can\'t be after borrower card expiry', type => 'YesNo', +======= + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + variable => 'acquisitions', + value => 'normal', + explanation => +'Normal, budget-based acquisitions, or Simple bibliographic-data acquisitions', + type => 'Choice', + options => 'simple|normal' }, + { + uniquefieldrequired => 'variable', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + variable => 'dateformat', + value => 'metric', + explanation => + 'date format (us mm/dd/yyyy, metric dd/mm/yyy, ISO yyyy/mm/dd)', + type => 'Choice', + options => 'metric|us|iso' + }, + { + uniquefieldrequired => 'variable', + variable => 'template', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'default', + explanation => 'Preference order for intranet interface templates', + type => 'Themes' + }, + { + uniquefieldrequired => 'variable', + variable => 'autoBarcode', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'yes', + explanation => 'Barcode is auto-calculated', + type => 'YesNo' + }, + { + uniquefieldrequired => 'variable', + variable => 'insecure', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'no', + explanation => +'If YES, no auth at all is needed. Be careful if you set this to yes!', + type => 'YesNo' + }, + { + uniquefieldrequired => 'variable', + variable => 'authoritysep', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + value => '--', + explanation => + 'the separator used in authority/thesaurus. Usually --', + type => 'free', + options => '10' + }, + { + uniquefieldrequired => 'variable', + variable => 'opaclanguages', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'en', + explanation => +'Set the preferred order for translations. The top language will be tried first.', + type => 'Languages' + }, + { + uniquefieldrequired => 'variable', + variable => 'opacthemes', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'css', + explanation => +'Set the preferred order for themes. The top theme will be tried first.', + type => 'Themes' + }, + { + uniquefieldrequired => 'variable', + variable => 'timeout', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '1200', + explanation => + 'Inactivity timeout for cookies authentication (in seconds)', + type => 'Integer' + }, + { + uniquefieldrequired => 'variable', + variable => 'marc', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'yes', + explanation => 'Turn on MARC support', + type => 'YesNo' + }, + { + uniquefieldrequired => 'variable', + variable => 'sortbynonfiling', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'no', + explanation => 'Sort search results by MARC nonfiling characters', + type => 'YesNo' + }, + { + uniquefieldrequired => 'variable', + variable => 'marcflavour', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + value => 'MARC21', + explanation => +'your MARC flavor (MARC21 or UNIMARC) used for character encoding', + type => 'Choice', + options => 'MARC21|UNIMARC' + }, + { + uniquefieldrequired => 'variable', + variable => 'checkdigit', + value => 'none', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + explanation => +'Validity checks on membership number: none or "Katipo" style checks', + type => 'Choice', + options => 'none|katipo' + }, + { + uniquefieldrequired => 'variable', + variable => 'maxoutstanding', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '5', + explanation => + 'maximum amount withstanding to be able make reserves ', + type => 'Integer' + }, + { + uniquefieldrequired => 'variable', + variable => 'maxreserves', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '5', + explanation => 'maximum number of reserves a member can make', + type => 'Integer' + + }, + { + uniquefieldrequired => 'variable', + variable => 'noissuescharge', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '5', + explanation => + 'maximum amount withstanding to be able to check out an item', + type => 'Integer' + + }, + { + uniquefieldrequired => 'variable', + variable => 'KohaAdminEmailAddress', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'your.mail@here', + explanation => 'the email address where borrowers modifs are sent', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'gist', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '0.125', + explanation => + 'the gist rate. NOT in %, but in numeric form (0.12 for 12%)', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'printcirculationslips', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '0', + explanation => + 'if set to 1, print circulation slips. If set to 0, don\'t', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'suggestion', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '0', + explanation => 'if set to 1, suggestions are activated in OPAC', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'ISBD', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => 'Fill with appropriate value...', + explanation => 'ISBD', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'virtualshelves', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '0', + explanation => 'Set virtual shelves management ON or OFF', + type => 'YesNo' + }, + { + uniquefieldrequired => 'variable', + variable => 'itemcallnumber', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + value => '676a', + explanation => +'The MARC field/subfield that is used to calculate the itemcallnumber (in UNIMARC : 676a for Dewey, 680a for Loc)', + type => 'free' + }, + { + uniquefieldrequired => 'variable', + variable => 'BiblioDefaultView', + value => 'normal', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + explanation => +'Define the default view of a biblio. Can be either normal, marc or isbd', + type => 'Choice', + options => 'normal|marc|isbd' + }, + + { + uniquefieldrequired => 'variable', + variable => 'LabelMARCView', + value => 'standard', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + explanation => 'Define how a MARC record will display', + type => 'Choice', + options => 'standard|economical' +>>>>>>> 1.100.2.46 + }, + { uniquefieldrequired => 'variable', variable => 'opacstylesheet', value => '', - forceupdate => { 'explanation' => 1, - 'type' => 1}, - explanation => 'Enter a complete URL to use an alternate stylesheet in OPAC', - type => 'free', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Enter a complete URL to use an alternate layout stylesheet in OPAC', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'opaccolorstylesheet', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Enter the name of the color stylesheet to use in the OPAC', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'opaclayoutstylesheet', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Enter the name of the layout stylesheet to use in the OPAC', + type => 'free', + }, + + { + uniquefieldrequired => 'variable', + variable => 'opacreadinghistory', + value => '1', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Turn on/off display of Patron Reading History in OPAC', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'opaclanguagesdisplay', + value => '1', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Turn on/off display of Change Language feature on OPAC', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'patronimages', + value => '0', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Turn on/off display of patron images in Intranet and specify a file extension for images', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'intranetstylesheet', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Enter a complete URL to use an alternate layout stylesheet in Intranet', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'intranetcolorstylesheet', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Enter the name of the color stylesheet to use in Intranet', + 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', + 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', + 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', + 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' + 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|,|/|\|#' + 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' + 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', + 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', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => 'Turn Branch independency management On and 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', + 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', + 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', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'hide marc specific datas like subfield code & indicators to library', + type => 'YesNo', }, { uniquefieldrequired => 'variable', variable => 'NotifyBorrowerDeparture', value => '0', - forceupdate => { 'explanation' => 1, - 'type' => 1}, - explanation => 'Delay before expiry where a notice is sent when issuing', - type => 'Integer', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => + 'Delay before expiry where a notice is sent when issuing', + type => 'Integer', }, { uniquefieldrequired => 'variable', variable => 'OpacPasswordChange', value => '1', - forceupdate => { 'explanation' => 1, - 'type' => 1}, - explanation => 'Enable/Disable password change in OPAC (disable it when using LDAP auth)', - type => 'YesNo', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Enable/Disable password change in OPAC (disable it when using LDAP auth)', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'OpacNav', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Use HTML tabs to add navigational links to the left-hand navigational bar in OPAC', + type => 'Textarea', + options => '70|10' + }, + { + uniquefieldrequired => 'variable', + variable => 'IntranetNav', + value => '', + forceupdate => { + 'explanation' => 1, + 'type' => 1 + }, + explanation => +'Use HTML tabs to add navigational links to the left-hand navigational bar in Intranet', + type => 'Textarea', + options => '70|10' + }, + + { + uniquefieldrequired => 'variable', + variable => 'AnonSuggestions', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => + 'Set to anonymous borrowernumber to enable Anonymous suggestions', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'MARCOrgCode', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +'Your MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'AmazonContent', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +'Turn On Amazon Content - You MUST set AmazonDevKey and AmazonAssocTag if enabled', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'AmazonDevKey', + value => '', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +'see: aws-portal.amazon.com/gp/aws/developer/registration/index.html', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + variable => 'AmazonAssocTag', + value => '', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => + 'see: associates.amazon.com/gp/flex/associates/apply-login.html', + type => 'free', + }, + { + uniquefieldrequired => 'variable', + forceupdate => { + 'explanation' => 1, + 'type' => 1, + 'options' => 1 + }, + variable => 'TemplateEncoding', + value => 'iso-8859-1', + explanation => 'Specify the encoding to use in Templates', + type => 'Choice', + options => 'iso-8859-1|utf-8' + }, + + { + uniquefieldrequired => 'variable', + variable => 'opaccredits', + value => '', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => + 'Put any HTML Credits at the bottom of the OPAC page', + type => 'Textarea', + options => '70|10' + }, + +{ + uniquefieldrequired => 'variable', + variable => 'opacheader', + value => '', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enter HTML to be included as a custom header in the OPAC', + type => 'Textarea', + options => '30|10' + }, + + { + uniquefieldrequired => 'variable', + variable => 'IntranetBiblioDefaultView', + value => 'marc', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Define the default view of a biblio in the intranet. Can be either normal, marc, or ISBD', + type => 'Choice', + options => 'normal|marc|isbd' + }, + + { + uniquefieldrequired => 'variable', + variable => 'opacbookbag', + value => '1', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enable or disable display of biblio basket (book bag)', + type => 'YesNo' + }, + + { + uniquefieldrequired => 'variable', + variable => 'opacuserlogin', + value => '1', + forceupdate => { 'explanation' => 1, + 'type' => 1}, + explanation => 'Enable or disable display of user login features', + type => 'YesNo' + }, + + { + uniquefieldrequired => 'variable', + variable => 'serialsadditems', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +'If set, a new item will be automatically added when receiving an issue', + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'advancedMARCeditor', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +"If set, the MARC editor won't show you tag/subfields description", + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'z3950NormalizeAuthor', + value => '0', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +"If set, Personnal Authorities will replace authors in biblio.author", + type => 'YesNo', + }, + { + uniquefieldrequired => 'variable', + variable => 'z3950AuthorAuthFields', + value => '701,702,700', + forceupdate => { + 'explanation' => 1, + ' + type' => 1 + }, + explanation => +"contains the MARC biblio tags of person authorities to fill biblio.author with when importing biblio", + type => 'free', }, { uniquefieldrequired => 'variable', @@ -406,6 +1479,7 @@ my %tabledata = ( type => 'free', }, { +<<<<<<< updatedatabase uniquefieldrequired => 'variable', variable => 'borrowerRelationship', value => 'father|mother,grand-mother', @@ -413,6 +1487,14 @@ my %tabledata = ( 'type' => 1}, explanation => 'The relationships between a guarantor & a guarantee (separated by | or ,)', type => 'free', +======= + field => 'aqbudgetid', + type => 'tinyint(4)', + null => '', + key => 'PRI', + default => '', + extra => 'auto_increment' +>>>>>>> 1.100.2.46 }, { uniquefieldrequired => 'variable', @@ -423,6 +1505,11 @@ my %tabledata = ( explanation => 'Maximum delay to pick up a reserved document', type => 'free', }, +<<<<<<< updatedatabase +======= + ], + marc_breeding => [ +>>>>>>> 1.100.2.46 { uniquefieldrequired => 'variable', variable => 'TransfersMaxDaysWarning', @@ -478,6 +1565,7 @@ my %tabledata = ( type => 'YesNo', }, ], +<<<<<<< updatedatabase ); @@ -491,6 +1579,9 @@ my %fielddefinitions = ( # }, # ], serial => [ +======= + serial => [ +>>>>>>> 1.100.2.46 { field => 'notes', type => 'TEXT', @@ -500,6 +1591,7 @@ my %fielddefinitions = ( extra => '' }, ], +<<<<<<< updatedatabase aqbasket => [ { field => 'booksellerid', @@ -790,6 +1882,18 @@ my %indexes = ( type => 'PRIMARY', } ], +======= + biblioitems => [ + { + field => 'dewey', + type => 'varchar(30)', + null => 'NULL', + key => '', + default => '', + extra => '' + }, + ], +>>>>>>> 1.100.2.46 ); my %foreign_keys = ( @@ -1271,11 +2375,10 @@ while ( my ($table) = $sth->fetchrow ) { $existingtables{$table} = 1; } - # Now add any missing tables foreach $table ( keys %requiretables ) { unless ( $existingtables{$table} ) { - print "Adding $table table...\n" unless $silent; + print "Adding $table table...\n" unless $silent; my $sth = $dbh->prepare("create table $table $requiretables{$table}"); $sth->execute; if ( $sth->err ) { @@ -1287,15 +2390,57 @@ foreach $table ( keys %requiretables ) { # now drop useless tables foreach $table ( keys %dropable_table ) { - if ( $existingtables{$table} ) { - print "Dropping unused table $table\n" if $debug and not $silent; - $dbh->do("drop table $table"); - if ( $dbh->err ) { - print "Error : $dbh->errstr \n"; - } - } + if ( $existingtables{$table} ) { + print "Dropping unused table $table\n" if $debug and not $silent; + $dbh->do("drop table $table"); + if ( $dbh->err ) { + print "Error : $dbh->errstr \n"; + } + } +} +<<<<<<< updatedatabase + +======= +unless ( $existingtables{'z3950servers'} ) { + + #MJR: added syntax entries to close bug 624 + print "Adding z3950servers table...\n" unless $silent; + my $sti = $dbh->prepare( + "create table z3950servers ( + host char(255), + port int, + db char(255), + userid char(255), + password char(255), + name text, + id int, + checked smallint, + rank int, + syntax char(80))" + ); + $sti->execute; + $sti = $dbh->prepare( + "insert into z3950servers + values ('z3950.loc.gov', + 7090, + 'voyager', + '', '', + 'Library of Congress', + 1, 1, 1, 'USMARC')" + ); + $sti->execute; +} +unless ( $existingtables{'issuingrules'} ) { + $dbh->do("alter table categoryitem rename issuingrules"); + $dbh->do("ALTER TABLE issuingrules ADD maxissueqty int(4) default NULL"); + $dbh->do("ALTER TABLE issuingrules ADD issuelength int(4) default NULL"); + $dbh->do( + "ALTER TABLE issuingrules ADD branchcode varchar(4) NOT NULL default ''" + ); + print "renaming categoryitem\n" unless $silent; } +>>>>>>> 1.100.2.46 #--------------------------------- # Columns @@ -1309,7 +2454,8 @@ foreach $table ( keys %requirefields ) { $types{$column} = $type; } # while foreach $column ( keys %{ $requirefields{$table} } ) { - print " Check column $column [$types{$column}]\n" if $debug and not $silent; + print " Check column $column [$types{$column}]\n" + if $debug and not $silent; if ( !$types{$column} ) { # column doesn't exist @@ -1328,6 +2474,7 @@ foreach $table ( keys %requirefields ) { } # foreach table foreach $table ( keys %fielddefinitions ) { +<<<<<<< updatedatabase print "Check table $table\n" if $debug; $sth = $dbh->prepare("show columns from $table"); $sth->execute(); @@ -1388,40 +2535,479 @@ foreach $table ( keys %fielddefinitions ) { print " alter or create $field in $table\n" unless $silent; } } +======= + print "Check table $table\n" if $debug; + $sth = $dbh->prepare("show columns from $table"); + $sth->execute(); + my $definitions; + while ( ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) + { + $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; + } # while + my $fieldrow = $fielddefinitions{$table}; + foreach my $row (@$fieldrow) { + my $field = $row->{field}; + my $type = $row->{type}; + my $key = $row->{key}; + my $default = $row->{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} + && $extra eq $def->{extra} ) + { + if ( $null eq '' ) { + $null = 'NOT NULL'; + } + if ( $key eq 'PRI' ) { + $key = 'PRIMARY KEY'; + } + 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} ) { + $action = "change $field"; + } + else { + $action = "add"; + } + + # if it's a primary key, drop the previous pk, before altering the table + my $sth; + if ( $key ne 'PRIMARY KEY' ) { + $sth = + $dbh->prepare( +"alter table $table $action $field $type $null $key $extra default ?" + ); + } + else { + $sth = + $dbh->prepare( +"alter table $table drop primary key, $action $field $type $null $key $extra default ?" + ); + } + $sth->execute($default); + print " Alter $field in $table\n" unless $silent; + } + } +>>>>>>> 1.100.2.46 } -# Populate tables with required data +<<<<<<< updatedatabase +======= +# Get list of columns from borrowers table +my %itemtypes; +my %nullenabled; +$sth = $dbh->prepare("show columns from borrowers"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $itemtypes{$column} = $type; + $nullenabled{$column} = $null; +} + +unless ( $itemtypes{'cardnumber'} eq 'varchar(20)' ) { + $itemtypes{'cardnumber'} =~ /varchar\((\d+)\)/; + my $oldlength = $1; + if ( $oldlength < 16 ) { + print +"Setting maximum cardnumber length to 16 (was $oldlength) and marking unique.\n" + unless $silent; + my $sti = + $dbh->prepare( + "alter table borrowers change cardnumber cardnumber varchar(16)"); + $sti->execute; + $sti->finish; + $sti = $dbh->prepare("alter table borrowers drop index cardnumber"); + $sti->execute; + $sti->finish; + $sti = $dbh->prepare("alter table borrowers add unique(cardnumber)"); + $sti->execute; + $sti->finish; + } +} + +# +# Get list of columns from items table +$sth = $dbh->prepare("show columns from items"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $itemtypes{$column} = $type; + $nullenabled{$column} = $null; +} + +unless ( $itemtypes{'barcode'} eq 'varchar(20)' ) { + $itemtypes{'barcode'} =~ /varchar\((\d+)\)/; + my $oldlength = $1; + if ( $oldlength < 20 ) { + print "Setting maximum barcode length to 20 (was $oldlength).\n" + unless $silent; + my $sti = + $dbh->prepare("alter table items change barcode barcode varchar(20)"); + $sti->execute; + } +} + +# +# dropping unique barcode index & setting barcode to null allowed. +# +$sth = $dbh->prepare("show index from items"); +$sth->execute; +while ( + my ( + $table, $non_unique, $key_name, $Seq_in_index, + $Column_name, $Collation, $cardinality, $sub_part, + $Packed, $comment + ) + = $sth->fetchrow + ) +{ + if ( $key_name eq 'barcode' && $non_unique eq 0 ) { + print "dropping BARCODE index to enable empty barcodes\n" + unless $silent; + $dbh->do("ALTER TABLE `items` DROP INDEX `barcode`"); + } +} +$dbh->do("ALTER TABLE `items` CHANGE `barcode` `barcode` VARCHAR( 20 )") + unless ( $nullenabled{barcode} eq 'YES' ); + +# +# creating fulltext index in bibliothesaurus if needed +# +$sth = $dbh->prepare("show index from bibliothesaurus"); +$sth->execute; +my $exists = 0; +while ( + my ( + $table, $non_unique, $key_name, $Seq_in_index, + $Column_name, $Collation, $cardinality, $sub_part, + $Packed, $comment + ) + = $sth->fetchrow + ) +{ + if ( $key_name eq 'category_2' ) { + $exists = 1; + } +} +print "Creating fulltext index on bibliothesaurus\n" unless $exists or $silent; +$dbh->do( + 'create fulltext index category_2 on bibliothesaurus (category,freelib)') + unless $exists; + +# +# creating index in z3950results if needed +# +$sth = $dbh->prepare("show index from z3950results"); +$sth->execute; +my $exists = 0; +while ( + my ( + $table, $non_unique, $key_name, $Seq_in_index, + $Column_name, $Collation, $cardinality, $sub_part, + $Packed, $comment + ) + = $sth->fetchrow + ) +{ + if ( $key_name eq 'query_server' ) { + $exists = 1; + } +} +print "Creating index on z3950results\n" unless $exists or $silent; +$dbh->do('create unique index query_server on z3950results (queryid,server)') + unless $exists; + +# changing z3950daemon field to NULL in marc_breeding +$dbh->do( +"ALTER TABLE `marc_breeding` CHANGE `z3950random` `z3950random` VARCHAR( 40 )" +); + +# making borrowernumber an auto_increment field +$dbh->do( +"ALTER TABLE `borrowers` CHANGE `borrowernumber` `borrowernumber` INTEGER auto_increment" +); + +# changing indexes in marc_*_structure to use frameworkcode +$dbh->do('alter table marc_subfield_structure drop index tab'); +$dbh->do('create index tab on marc_subfield_structure (frameworkcode,tab)'); +$dbh->do('alter table marc_subfield_structure drop index kohafield'); +$dbh->do( +'create index kohafield on marc_subfield_structure (frameworkcode,kohafield)' +); +# extending the timestamp in branchtransfers... +my %branchtransfers; + +$sth = $dbh->prepare("show columns from branchtransfers"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $branchtransfers{$column} = $type; +} + +unless ( $branchtransfers{'datesent'} eq 'datetime' ) { + print "Setting type of datesent in branchtransfers to datetime.\n" + unless $silent; + my $sti = + $dbh->prepare( + "alter table branchtransfers change datesent datesent datetime"); + $sti->execute; +} + +unless ( $branchtransfers{'datearrived'} eq 'datetime' ) { + print "Setting type of datearrived in branchtransfers to datetime.\n" + unless $silent; + my $sti = + $dbh->prepare( + "alter table branchtransfers change datearrived datearrived datetime"); + $sti->execute; +} + +# changing the branchcategories table around... +my %branchcategories; + +$sth = $dbh->prepare("show columns from branchcategories"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $branchcategories{$column} = $type; +} + +unless ( $branchcategories{'categorycode'} eq 'varchar(4)' ) { + print +"Setting type of categorycode in branchcategories to varchar(4),\n and making the primary key.\n" + unless $silent; + my $sti = + $dbh->prepare( +"alter table branchcategories change categorycode categorycode varchar(4) not null" + ); + $sti->execute; + $sti = + $dbh->prepare( + "alter table branchcategories add primary key (categorycode)"); + $sti->execute; +} + +unless ( $branchcategories{'categoryname'} eq 'text' ) { + print "Changing branchcode in branchcategories to categoryname text.\n" + unless $silent; + my $sth = + $dbh->prepare( + "alter table branchcategories change branchcode categoryname text"); + $sth->execute; +} + +unless ( $branchcategories{'codedescription'} eq 'text' ) { + print + "Replacing branchholding in branchcategories with codedescription text.\n" + unless $silent; + my $sth = + $dbh->prepare( + "alter table branchcategories change branchholding codedescription text" + ); + $sth->execute; +} + +# changing the items table around... +my %items; + +$sth = $dbh->prepare("show columns from items"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $items{$column} = $type; +} + +if ( $items{'bulk'} eq "varchar(30)" ) { + print " Setting callnumber in items table\n" unless $silent; + my $sti = + $dbh->prepare( +"ALTER TABLE `items` CHANGE `bulk` `itemcallnumber` VARCHAR( 30 ) DEFAULT NULL" + ); + $sti->execute; + $sti = + $dbh->prepare( +"update marc_subfield_structure set kohafield=\"items.itemcallnumber\" where kohafield=\"items.bulk\"" + ); + $sti->execute; +} + +# changing the marc_subfield_structure table around... +my %marc_subfield_structure; + +$sth = $dbh->prepare("show columns from marc_subfield_structure"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $marc_subfield_structure{$column} = $type; +} + +if ( $marc_subfield_structure{thesaurus_category} ) { + print " changing thesaurus_category in marc_subfield_structure table\n" + unless $silent; + my $sti = + $dbh->prepare( +"ALTER TABLE marc_subfield_structure CHANGE `thesaurus_category` `authtypecode` VARCHAR(10 ) DEFAULT NULL" + ); + $sti->execute; +} + +# +# creating index in issuingrules if needed +# +$sth = $dbh->prepare("show index from issuingrules"); +$sth->execute; +my $exists = 0; +while ( + my ( + $table, $non_unique, $key_name, $Seq_in_index, + $Column_name, $Collation, $cardinality, $sub_part, + $Packed, $comment + ) + = $sth->fetchrow + ) +{ + if ( $key_name eq 'PRIMARY' ) { + $exists = 1; + } +} +print "Creating index on issuing rules\n" unless $exists or $silent; +$dbh->do( +'ALTER TABLE issuingrules ADD PRIMARY KEY ( branchcode, categorycode, itemtype )' + ) + unless $exists; + +$dbh->do('ALTER TABLE marc_tag_structure drop primary key'); +$dbh->do( + 'ALTER TABLE marc_tag_structure ADD PRIMARY KEY ( frameworkcode, tagfield )' +); + +$dbh->do('ALTER TABLE marc_subfield_structure drop primary key'); +$dbh->do( +'ALTER TABLE marc_subfield_structure ADD PRIMARY KEY ( frameworkcode, tagfield, tagsubfield )' +); + +$dbh->do( +"alter table marc_subfield_table change tagorder tagorder int not null default '1'" +); + +# Get list of columns from marc_word table +my %marc_word; +my %nullenabled; +$sth = $dbh->prepare("show columns from marc_word"); +$sth->execute; +while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) +{ + $marc_word{$column} = $type; + $nullenabled{$column} = $null; +} +if ( $marc_word{subfieldid} ) { + + #create field tagsubfield, copy tag+subfieldid, then drop tag and subfieldid + print "Modifying marc_word (concat on tag and subfield for better perfs)\n" + unless $silent; + $dbh->do( +"ALTER TABLE `marc_word` ADD `tagsubfield` CHAR( 4 ) NOT NULL AFTER `bibid`" + ); + $dbh->do("update marc_word set tagsubfield=concat(tag,subfieldid)"); + $dbh->do("alter table marc_word drop tag"); + $dbh->do("alter table marc_word drop subfieldid"); + $dbh->do("create index Search_Marc on marc_word (tagsubfield,word)"); +} + +>>>>>>> 1.100.2.46 +# Populate tables with required data # synch table and deletedtable. -foreach my $table (('borrowers','items','biblio','biblioitems')) { - my %deletedborrowers; - print "synch'ing $table\n"; - $sth = $dbh->prepare("show columns from deleted$table"); - $sth->execute; - while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) { - $deletedborrowers{$column}=1; - } - $sth = $dbh->prepare("show columns from $table"); - $sth->execute; - my $previous; - while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) { - unless ($deletedborrowers{$column}) { - my $newcol="alter table deleted$table add $column $type"; - if ($null eq 'YES') { - $newcol .= " NULL "; - } else { - $newcol .= " NOT NULL "; - } - $newcol .= "default $default" if $default; - $newcol .= " after $previous" if $previous; - $previous=$column; - print "creating column $column\n"; - $dbh->do($newcol); - } - } +foreach my $table ( ( 'borrowers', 'items', 'biblio', 'biblioitems' ) ) { + my %deletedborrowers; + print "synch'ing $table\n"; + $sth = $dbh->prepare("show columns from deleted$table"); + $sth->execute; + while ( my ( $column, $type, $null, $key, $default, $extra ) = + $sth->fetchrow ) + { + $deletedborrowers{$column} = 1; + } + $sth = $dbh->prepare("show columns from $table"); + $sth->execute; + my $previous; + while ( my ( $column, $type, $null, $key, $default, $extra ) = + $sth->fetchrow ) + { + unless ( $deletedborrowers{$column} ) { + my $newcol = "alter table deleted$table add $column $type"; + if ( $null eq 'YES' ) { + $newcol .= " NULL "; + } + else { + $newcol .= " NOT NULL "; + } + $newcol .= "default $default" if $default; + $newcol .= " after $previous" if $previous; + $previous = $column; + print "creating column $column\n"; + $dbh->do($newcol); + } + } } +<<<<<<< updatedatabase +======= +# fill aqbasket if it's empty and aqorder is not +# => it means it has just been created & must be filled +$sth = $dbh->prepare("select count(*) from aqbasket"); +$sth->execute; +if ( $sth->fetchrow == 0 ) { + $sth = $dbh->prepare("select count(*) from aqorders"); + $sth->execute; + if ( $sth->fetchrow > 0 ) { + print "Populating new table aqbasket\n"; + print +"IMPORTANT NOTE: error message \"Duplicate entry 'X' for key 1\" may appear. it should not be a real trouble\n"; + $sth = + $dbh->prepare( +"select distinct basketno,booksellerid,authorisedby,entrydate,booksellerinvoicenumber from aqorders" + ); + $sth->execute; + my ( $basketno, $booksellerid, $authorisedby, $entrydate, + $booksellerinvoicenumber ); + my $sth2 = + $dbh->prepare( +"insert into aqbasket (basketno,creationdate,booksellerid,authorisedby,booksellerinvoicenumber) values (?,?,?,?,?)" + ); + while ( + ( + $basketno, $booksellerid, + $authorisedby, $entrydate, + $booksellerinvoicenumber + ) + = $sth->fetchrow + ) + { + print +"$basketno,$entrydate,$booksellerid,$authorisedby,$booksellerinvoicenumber\n"; + $sth2->execute( $basketno, $entrydate, $booksellerid, $authorisedby, + $booksellerinvoicenumber ); + } + } +} +>>>>>>> 1.100.2.46 foreach my $table ( keys %tabledata ) { print "Checking for data required in table $table...\n" unless $silent; my $tablerows = $tabledata{$table}; @@ -1432,8 +3018,9 @@ foreach my $table ( keys %tabledata ) { my $sth = $dbh->prepare( "select $uniquefieldrequired from $table where $uniquefieldrequired=?" - ); + ); $sth->execute($uniquevalue); +<<<<<<< updatedatabase if ($sth->rows) { foreach my $field (keys %$forceupdate) { if ($forceupdate->{$field}) { @@ -1608,32 +3195,70 @@ unless ($marcdone) { print "\r$totaldone / $totaltodo" unless ($totaldone % 100); } print "\rdone\n"; +======= + if ( $sth->rows ) { + foreach my $field ( keys %$forceupdate ) { + if ( $forceupdate->{$field} ) { + my $sth = + $dbh->prepare( +"update systempreferences set $field=? where $uniquefieldrequired=?" + ); + $sth->execute( $row->{$field}, $uniquevalue ); + } + } + } + else { + print "Adding row to $table: " unless $silent; + my @values; + my $fieldlist; + my $placeholders; + foreach my $field ( keys %$row ) { + next if $field eq 'uniquefieldrequired'; + next if $field eq 'forceupdate'; + my $value = $row->{$field}; + push @values, $value; + print " $field => $value" unless $silent; + $fieldlist .= "$field,"; + $placeholders .= "?,"; + } + print "\n" unless $silent; + $fieldlist =~ s/,$//; + $placeholders =~ s/,$//; + my $sth = + $dbh->prepare( + "insert into $table ($fieldlist) values ($placeholders)"); + $sth->execute(@values); + } + } +>>>>>>> 1.100.2.46 } # at last, remove useless fields foreach $table ( keys %uselessfields ) { - my @fields = split /,/,$uselessfields{$table}; - my $fields; - my $exists; - foreach my $fieldtodrop (@fields) { - $fieldtodrop =~ s/\t//g; - $fieldtodrop =~ s/\n//g; - $exists =0; - $sth = $dbh->prepare("show columns from $table"); - $sth->execute; - while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow ) - { - $exists =1 if ($column eq $fieldtodrop); - } - if ($exists) { - print "deleting $fieldtodrop field in $table...\n" unless $silent; - my $sth = $dbh->prepare("alter table $table drop $fieldtodrop"); - $sth->execute; - } - } + my @fields = split /,/, $uselessfields{$table}; + my $fields; + my $exists; + foreach my $fieldtodrop (@fields) { + $fieldtodrop =~ s/\t//g; + $fieldtodrop =~ s/\n//g; + $exists = 0; + $sth = $dbh->prepare("show columns from $table"); + $sth->execute; + while ( my ( $column, $type, $null, $key, $default, $extra ) = + $sth->fetchrow ) + { + $exists = 1 if ( $column eq $fieldtodrop ); + } + if ($exists) { + print "deleting $fieldtodrop field in $table...\n" unless $silent; + my $sth = $dbh->prepare("alter table $table drop $fieldtodrop"); + $sth->execute; + } + } } # foreach +<<<<<<< updatedatabase # MOVE all tables TO UTF-8 and innoDB $sth = $dbh->prepare("show table status"); @@ -1652,6 +3277,8 @@ while ( my $table = $sth->fetchrow_hashref ) { } } +======= +>>>>>>> 1.100.2.46 $sth->finish; # @@ -1821,6 +3448,10 @@ sub MARCgetitem { exit; # $Log$ +# Revision 1.153 2006/07/04 14:36:52 toins +# Head & rel_2_2 merged +# +<<<<<<< updatedatabase # Revision 1.152 2006/06/27 09:26:37 btoumi # modify (initials,phone ) fields property in borrowers and deletedborrowers table # @@ -1894,6 +3525,141 @@ exit; # # Revision 1.136 2006/04/17 21:55:33 sushi # Added 'labels' and 'labels_conf' tables, for spine lable tool. +======= +# Revision 1.100.2.46 2006/06/20 18:02:23 oleonard +# Fixing two minor typos +# +# Revision 1.100.2.45 2006/06/13 12:34:15 hdl +# Adding publication date to issues arrival. So that two dates can be used. +# +# Revision 1.100.2.44 2006/06/02 15:21:40 tipaul +# moving dewey to a varchar +# +# Revision 1.100.2.43 2006/04/27 18:07:40 oleonard +# Adding two new system preferences: +# +# 1. opacuserlogin shows/hides login-based features like reserves, private shelves, and login forms. On by default. +# 2. opacbookbag shows/hides the book bag (biblio basket). On by default. +# +# Revision 1.100.2.42 2006/04/22 13:52:12 oleonard +# Adding opacheader and IntranetBiblioDefaultView system preferences +# +# Revision 1.100.2.41 2006/04/21 08:54:55 hdl +# Adding two new sysprefs : +# - z3950NormalizeAuthor of type YesNo. Set this to yes if you want author field to be filled with authorities fields when importing biblio in z3950 +# - z3950AuthorAuthfields, free text : type in comma-separated list of fields to search for author names for AuthorNormalization. +# +# Adding a feature on a Z3950 import. +# You can now automatically fill author with person name authority contained in the biblio if sysprefs are filled. +# +# Revision 1.100.2.40 2006/04/18 09:34:15 plg +# bug fixed: typo fixed in labels and labels_conf tables creation query. +# +# Revision 1.100.2.39 2006/04/17 21:19:52 sushi +# Added labels, and label_conf tables for spine labels tool. +# +# Revision 1.100.2.38 2006/04/05 14:58:04 kados +# adding TemplateEncoding syspref: allows librarian to specify the +# encoding to use on templates. +# +# Revision 1.100.2.37 2006/04/04 13:54:10 tipaul +# advancedMARCeditor systempref management +# +# Revision 1.100.2.36 2006/03/18 22:55:26 kados +# add syspref for the MARC Organization Code of the library +# +# Revision 1.100.2.35 2006/03/08 17:50:55 kados +# Modifying patronimages: now it can be used to specify the file extension +# of the images (to avoid hard-codeing in templates). +# +# Revision 1.100.2.34 2006/03/08 13:28:23 tipaul +# changing the size of some new systempref to a bloc (more convenient) +# +# Revision 1.100.2.33 2006/03/04 06:05:13 kados +# New syspref: AnonSuggestions to allow an anonymous patron to make a +# suggestion (requested by NPL). To enable, set to the borrowernumber +# of the anonymous patron (must be created). +# +# Revision 1.100.2.32 2006/03/03 16:20:23 kados +# hopefully fixes truncated amazon.com links in syspref +# ---------------------------------------------------------------------- +# +# Revision 1.100.2.31 2006/03/01 21:44:16 kados +# Adds 'opacreadinghistory' syspref for turning this on/off for libraries +# who are scared of their government (ie, in countries where there a +# patriot act) :-) +# +# Revision 1.100.2.30 2006/03/01 15:52:13 kados +# Whoops ... should have checked, that name is already used. Changed it to +# opaclanguagesdisplay. +# +# Revision 1.100.2.29 2006/03/01 15:51:28 kados +# adds opaclanguages syspref, which allows turning on/off the display of +# the languages pref on OPAC (default is on) +# +# Revision 1.100.2.28 2006/03/01 15:38:53 kados +# Adding patronimages syspref. Adding opaclayoutstylesheet. Some explainations +# are in order: +# +# Right now there are three stylesheet sysprefs: +# +# opacstylesheet - an external stylesheet specified by URL (replaces all other +# stylesheets) +# +# opaccolorstylesheet - local stylesheet specified by filename +# opaclayoutstylesheet - local stylesheet specified by filename +# +# Revision 1.100.2.27 2006/02/27 15:40:32 tipaul +# setting serialadditems systempreference to 0 by default : no behaviour change when upgrading Koha +# +# Revision 1.100.2.26 2006/02/23 03:19:48 kados +# Adds the 'sortbynonfiling' systempref. With this enabled, Koha will +# correctly sort title searches according to the nonfiling characters +# in the MARC records. +# +# Revision 1.100.2.25 2006/02/21 20:00:13 kados +# setting default value for LabelMARCView to 'standard' +# ---------------------------------------------------------------------- +# +# Revision 1.100.2.24 2006/02/21 18:40:08 kados +# Adding LabeledMARCView systempref to choose whether tags are displayed +# in standard or economical format. Later, this can be used to display +# 'strict' format with no labels for insane librarians who want that. +# +# Revision 1.100.2.23 2006/02/07 15:33:35 hdl +# Adding a new system preference : serialsadditem +# +# Adding two functions in Biblio.pm : getitemlocation and getitemstatus (helpful to get location list and status list, status is supposed to be in relation with items.notforloan) +# +# Adding a new function in Bull.pm : serialsitemize which take serial id and item information and creates the item +# Modifying statecollection to add a new line (used for data input) +# +# Revision 1.100.2.22 2006/02/05 21:53:54 kados +# Adds database support for IntranetNav systempref -- used to add HTML +# tags to left-hand navigation menu on Intranet. +# ---------------------------------------------------------------------- +# +# Revision 1.100.2.21 2006/02/04 18:17:00 kados +# Adds opaccolorstylesheet, intranetstylesheet, intranetcolorstylesheet +# to systemprefs. +# +# Revision 1.100.2.20 2006/02/04 05:16:40 kados +# Allows putting credits at bottom of OPAC page +# +# Revision 1.100.2.19 2006/02/04 01:44:59 kados +# Adds Fully Preferences-based Amazon.com feature. See mail to koha-devel +# for details. +# +# Revision 1.100.2.18 2006/02/03 23:12:23 kados +# Adds system prefs for using Amazon.com content in the OPAC +# +# Revision 1.100.2.17 2006/02/03 20:55:16 kados +# Adding a new system preference: OpacNav. Can be used to add HTML +# navigation links to the left-hand navbar in the OPAC. +# +# Revision 1.100.2.16 2005/12/30 11:13:29 tipaul +# * tool to synchronise TABLE and deletedTABLE structures in updatedatabase +>>>>>>> 1.100.2.46 # # Revision 1.135 2006/04/15 02:37:03 tgarip1957 # Marc record should be set to UTF-8 in leader.Force it. diff --git a/value_builder/marc21_leader.pl b/value_builder/marc21_leader.pl index 27b3ff3c7a..73bf72b10a 100644 --- a/value_builder/marc21_leader.pl +++ b/value_builder/marc21_leader.pl @@ -43,6 +43,13 @@ my $function_name= "100".(int(rand(100000))+1); my $res="