[Koha-cvs] CVS: koha/C4 Auth.pm,1.37,1.38 Auth_with_ldap.pm,1.2,1.3 Biblio.pm,1.117,1.118 Bull.pm,1.8,1.9 Members.pm,1.6,1.7 SearchMarc.pm,1.41,1.42 Search.pm,1.101,1.102 Suggestions.pm,1.4,1.5

Paul POULAIN tipaul at users.sourceforge.net
Wed May 4 17:40:05 CEST 2005


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29407/C4

Modified Files:
	Auth.pm Auth_with_ldap.pm Biblio.pm Bull.pm Members.pm 
	SearchMarc.pm Search.pm Suggestions.pm 
Log Message:
synch'ing 2.2 and head

Index: Auth.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Auth.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** Auth.pm	23 Mar 2005 09:25:20 -0000	1.37
--- Auth.pm	4 May 2005 15:40:01 -0000	1.38
***************
*** 131,135 ****
  		# to create the template's parameters that will indicate
  		# which menus the user can access.
! 		if ($flags->{superlibrarian} == 1)
  		{
  			$template->param(CAN_user_circulate => 1);
--- 131,135 ----
  		# to create the template's parameters that will indicate
  		# which menus the user can access.
! 		if ($flags && $flags->{superlibrarian} == 1)
  		{
  			$template->param(CAN_user_circulate => 1);
***************
*** 147,190 ****
  			$template->param(CAN_user_tools => 1); }
  		
! 		if ($flags->{circulate} == 1) {
  			$template->param(CAN_user_circulate => 1); }
  
! 		if ($flags->{catalogue} == 1) {
  			$template->param(CAN_user_catalogue => 1); }
! 		

! 		if ($flags->{parameters} == 1) {
  			$template->param(CAN_user_parameters => 1);	
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
! 		

! 		if ($flags->{borrowers} == 1) {
  			$template->param(CAN_user_borrowers => 1); }
! 		

! 		if ($flags->{permissions} == 1) {
  			$template->param(CAN_user_permission => 1); }
  		
! 		if ($flags->{reserveforothers} == 1) {
  			$template->param(CAN_user_reserveforothers => 1); }
! 		

! 		if ($flags->{borrow} == 1) {
  			$template->param(CAN_user_borrow => 1); }
! 		

! 		if ($flags->{reserveforself} == 1) {
  			$template->param(CAN_user_reserveforself => 1); }
! 		

! 		if ($flags->{editcatalogue} == 1) {
  			$template->param(CAN_user_editcatalogue => 1); }
! 		

! 		if ($flags->{updatecharges} == 1) {
  			$template->param(CAN_user_updatecharge => 1); }
  		
! 		if ($flags->{acquisition} == 1) {
  			$template->param(CAN_user_acquisition => 1); }
  		
! 		if ($flags->{management} == 1) {
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
  		
! 		if ($flags->{tools} == 1) {
  			$template->param(CAN_user_tools => 1); }
  		
--- 147,197 ----
  			$template->param(CAN_user_tools => 1); }
  		
! 		if ($flags && $flags->{circulate} == 1) {
  			$template->param(CAN_user_circulate => 1); }
  
! 		if ($flags && $flags->{catalogue} == 1) {
  			$template->param(CAN_user_catalogue => 1); }
! 		
! 
! 		if ($flags && $flags->{parameters} == 1) {
  			$template->param(CAN_user_parameters => 1);	
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
! 		
! 
! 		if ($flags && $flags->{borrowers} == 1) {
  			$template->param(CAN_user_borrowers => 1); }
! 		
! 
! 		if ($flags && $flags->{permissions} == 1) {
  			$template->param(CAN_user_permission => 1); }
  		
! 		if ($flags && $flags->{reserveforothers} == 1) {
  			$template->param(CAN_user_reserveforothers => 1); }
! 		
! 
! 		if ($flags && $flags->{borrow} == 1) {
  			$template->param(CAN_user_borrow => 1); }
! 		
! 
! 		if ($flags && $flags->{reserveforself} == 1) {
  			$template->param(CAN_user_reserveforself => 1); }
! 		
! 
! 		if ($flags && $flags->{editcatalogue} == 1) {
  			$template->param(CAN_user_editcatalogue => 1); }
! 		
! 
! 		if ($flags && $flags->{updatecharges} == 1) {
  			$template->param(CAN_user_updatecharge => 1); }
  		
! 		if ($flags && $flags->{acquisition} == 1) {
  			$template->param(CAN_user_acquisition => 1); }
  		
! 		if ($flags && $flags->{management} == 1) {
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
  		
! 		if ($flags && $flags->{tools} == 1) {
  			$template->param(CAN_user_tools => 1); }
  		

Index: Auth_with_ldap.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Auth_with_ldap.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Auth_with_ldap.pm	23 Mar 2005 09:25:50 -0000	1.2
--- Auth_with_ldap.pm	4 May 2005 15:40:01 -0000	1.3
***************
*** 163,175 ****
  		if ($flags->{catalogue} == 1) {
  			$template->param(CAN_user_catalogue => 1); }
! 		

  		if ($flags->{parameters} == 1) {
  			$template->param(CAN_user_parameters => 1);	
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
! 		

  		if ($flags->{borrowers} == 1) {
  			$template->param(CAN_user_borrowers => 1); }
! 		

  		if ($flags->{permissions} == 1) {
  			$template->param(CAN_user_permission => 1); }
--- 163,175 ----
  		if ($flags->{catalogue} == 1) {
  			$template->param(CAN_user_catalogue => 1); }
! 		
  		if ($flags->{parameters} == 1) {
  			$template->param(CAN_user_parameters => 1);	
  			$template->param(CAN_user_management => 1);
  			$template->param(CAN_user_tools => 1); }
! 		
  		if ($flags->{borrowers} == 1) {
  			$template->param(CAN_user_borrowers => 1); }
! 		
  		if ($flags->{permissions} == 1) {
  			$template->param(CAN_user_permission => 1); }
***************
*** 177,190 ****
  		if ($flags->{reserveforothers} == 1) {
  			$template->param(CAN_user_reserveforothers => 1); }
! 		

  		if ($flags->{borrow} == 1) {
  			$template->param(CAN_user_borrow => 1); }
! 		

  		if ($flags->{reserveforself} == 1) {
  			$template->param(CAN_user_reserveforself => 1); }
! 		

  		if ($flags->{editcatalogue} == 1) {
  			$template->param(CAN_user_editcatalogue => 1); }
! 		

  		if ($flags->{updatecharges} == 1) {
  			$template->param(CAN_user_updatecharge => 1); }
--- 177,190 ----
  		if ($flags->{reserveforothers} == 1) {
  			$template->param(CAN_user_reserveforothers => 1); }
! 		
  		if ($flags->{borrow} == 1) {
  			$template->param(CAN_user_borrow => 1); }
! 		
  		if ($flags->{reserveforself} == 1) {
  			$template->param(CAN_user_reserveforself => 1); }
! 		
  		if ($flags->{editcatalogue} == 1) {
  			$template->param(CAN_user_editcatalogue => 1); }
! 		
  		if ($flags->{updatecharges} == 1) {
  			$template->param(CAN_user_updatecharge => 1); }

Index: Biblio.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Biblio.pm,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -r1.117 -r1.118
*** Biblio.pm	7 Mar 2005 08:55:29 -0000	1.117
--- Biblio.pm	4 May 2005 15:40:01 -0000	1.118
***************
*** 242,252 ****
      $sth =
        $dbh->prepare(
! "select tagfield,$libfield as lib,mandatory,repeatable from marc_tag_structure where frameworkcode=? order by tagfield"
      );
      $sth->execute($frameworkcode);
!     my ( $lib, $tag, $res, $tab, $mandatory, $repeatable );
  
!     while ( ( $tag, $lib, $mandatory, $repeatable ) = $sth->fetchrow ) {
!         $res->{$tag}->{lib}        = $lib;
          $res->{$tab}->{tab}        = "";            # XXX
          $res->{$tag}->{mandatory}  = $mandatory;
--- 242,252 ----
      $sth =
        $dbh->prepare(
! "select tagfield,liblibrarian,libopac,mandatory,repeatable from marc_tag_structure where frameworkcode=? order by tagfield"
      );
      $sth->execute($frameworkcode);
!     my ( $liblibrarian, $libopac, $tag, $res, $tab, $mandatory, $repeatable );
  
!     while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = $sth->fetchrow ) {
!         $res->{$tag}->{lib}        = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
          $res->{$tab}->{tab}        = "";            # XXX
          $res->{$tag}->{mandatory}  = $mandatory;
***************
*** 256,260 ****
      $sth =
        $dbh->prepare(
! "select tagfield,tagsubfield,$libfield as lib,tab, mandatory, repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link from marc_subfield_structure where frameworkcode=? order by tagfield,tagsubfield"
      );
      $sth->execute($frameworkcode);
--- 256,260 ----
      $sth =
        $dbh->prepare(
! "select tagfield,tagsubfield,liblibrarian,libopac,tab, mandatory, repeatable,authorised_value,authtypecode,value_builder,kohafield,seealso,hidden,isurl,link from marc_subfield_structure where frameworkcode=? order by tagfield,tagsubfield"
      );
      $sth->execute($frameworkcode);
***************
*** 271,275 ****
  
      while (
!         ( $tag,         $subfield,   $lib,              $tab,
          $mandatory,     $repeatable, $authorised_value, $authtypecode,
          $value_builder, $kohafield,  $seealso,          $hidden,
--- 271,275 ----
  
      while (
!         ( $tag,         $subfield,   $liblibrarian,   , $libopac,      $tab,
          $mandatory,     $repeatable, $authorised_value, $authtypecode,
          $value_builder, $kohafield,  $seealso,          $hidden,
***************
*** 278,282 ****
        )
      {
!         $res->{$tag}->{$subfield}->{lib}              = $lib;
          $res->{$tag}->{$subfield}->{tab}              = $tab;
          $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
--- 278,282 ----
        )
      {
!         $res->{$tag}->{$subfield}->{lib}              = ($forlibrarian or !$libopac)?$liblibrarian:$libopac;
          $res->{$tag}->{$subfield}->{tab}              = $tab;
          $res->{$tag}->{$subfield}->{mandatory}        = $mandatory;
***************
*** 299,309 ****
  	my $relations = C4::Context->marcfromkohafield;
  	return ($relations->{$frameworkcode}->{$kohafield}->[0],$relations->{$frameworkcode}->{$kohafield}->[1]);
- #     my $sth =
- #       $dbh->prepare(
- # "select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
- #     );
- #     $sth->execute($frameworkcode,$kohafield);
- #     my ( $tagfield, $tagsubfield ) = $sth->fetchrow;
- #     return ( $tagfield, $tagsubfield );
  }
  
--- 299,302 ----
***************
*** 419,422 ****
--- 412,416 ----
        )
        = @_;
+ 	  return unless $subfieldvalues;
  # warn "$tagid / $subfieldcode / $subfieldvalues";
      # if not value, end of job, we do nothing
***************
*** 711,745 ****
  sub MARCmoditem {
  	my ($dbh,$record,$bibid,$itemnumber,$delete)=@_;
! 
! 	my $oldrecord=&MARCgetitem($dbh,$bibid,$itemnumber);
! 	# if nothing to change, don't waste time...
! 	if ($oldrecord eq $record) {
! 		return;
! 	}
! 	# otherwise, skip through each subfield...
! 	my @fields = $record->fields();
! 	# search old MARC item
! 	my $sth2 = $dbh->prepare("select tagorder from marc_subfield_table,marc_subfield_structure where marc_subfield_table.tag=marc_subfield_structure.tagfield and marc_subfield_table.subfieldcode=marc_subfield_structure.tagsubfield and bibid=? and kohafield='items.itemnumber' and subfieldvalue=?");
! 	$sth2->execute($bibid,$itemnumber);
! 	my ($tagorder) = $sth2->fetchrow_array();
! 	foreach my $field (@fields) {
! 		my $oldfield = $oldrecord->field($field->tag());
! 		my @subfields=$field->subfields();
! 		my $subfieldorder=0;
! 		foreach my $subfield (@subfields) {
! 			$subfieldorder++;
! 			if ($oldfield eq 0 or (length($oldfield->subfield(@$subfield[0])) ==0) ) {
! 		# just adding datas...
! 				&MARCaddsubfield($dbh,$bibid,$field->tag(),$field->indicator(1).$field->indicator(2),
! 						$tagorder,@$subfield[0],$subfieldorder,@$subfield[1]);
! 			} else {
! 		# modify he subfield if it's a different string
! 				if ($oldfield->subfield(@$subfield[0]) ne @$subfield[1] ) {
! 					my $subfieldid=&MARCfindsubfieldid($dbh,$bibid,$field->tag(),$tagorder,@$subfield[0],$subfieldorder);
! 					&MARCmodsubfield($dbh,$subfieldid,@$subfield[1]);
! 				}
! 			}
! 		}
! 	}
  }
  
--- 705,711 ----
  sub MARCmoditem {
  	my ($dbh,$record,$bibid,$itemnumber,$delete)=@_;
! 	my $biblionumber = MARCfind_oldbiblionumber_from_MARCbibid($dbh,$bibid);
! 	&MARCdelitem($dbh,$bibid,$itemnumber);
! 	&MARCadditem($dbh,$record,$biblionumber);
  }
  
***************
*** 1181,1185 ****
        )
        = @_;
!     $sentence =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\})/ /g;
      my @words = split / /, $sentence;
      my $stopwords = C4::Context->stopwords;
--- 1147,1151 ----
        )
        = @_;
!     $sentence =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/)/ /g;
      my @words = split / /, $sentence;
      my $stopwords = C4::Context->stopwords;
***************
*** 2550,2558 ****
  	my $dbh = C4::Context->dbh;
  	my $result = MARCmarc2koha($dbh,$record,'');
  	# search duplicate on ISBN, easy and fast...
! 	my $sth = $dbh->prepare("select biblio.biblionumber,bibid,title from biblio,biblioitems,marc_biblio where biblio.biblionumber=biblioitems.biblionumber and marc_biblio.biblionumber=biblioitems.biblionumber and isbn=?");
! 	$sth->execute($result->{'isbn'});
! 	my ($biblionumber,$bibid,$title) = $sth->fetchrow;
! 	return $biblionumber,$bibid,$title if ($biblionumber);
  	# a more complex search : build a request for SearchMarc::catalogsearch()
  	my (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
--- 2516,2528 ----
  	my $dbh = C4::Context->dbh;
  	my $result = MARCmarc2koha($dbh,$record,'');
+ 	my $sth;
+ 	my ($biblionumber,$bibid,$title);
  	# search duplicate on ISBN, easy and fast...
! 	if ($result->{isbn}) {
! 		$sth = $dbh->prepare("select biblio.biblionumber,bibid,title from biblio,biblioitems,marc_biblio where biblio.biblionumber=biblioitems.biblionumber and marc_biblio.biblionumber=biblioitems.biblionumber and isbn=?");
! 		$sth->execute($result->{'isbn'});
! 		($biblionumber,$bibid,$title) = $sth->fetchrow;
! 		return $biblionumber,$bibid,$title if ($biblionumber);
! 	}
  	# a more complex search : build a request for SearchMarc::catalogsearch()
  	my (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
***************
*** 2654,2659 ****
  # $Id$
  # $Log$
! # Revision 1.117  2005/03/07 08:55:29  tipaul
! # synch'ing with 2.2
  #
  # Revision 1.115.2.5  2005/02/24 13:54:04  tipaul
--- 2624,2648 ----
  # $Id$
  # $Log$
! # Revision 1.118  2005/05/04 15:40:01  tipaul
! # synch'ing 2.2 and head
! #
! # Revision 1.115.2.9  2005/04/07 10:05:25  tipaul
! # adding / to the list of symbols that are replace by spaces for searches
! #
! # Revision 1.115.2.8  2005/03/25 16:23:49  tipaul
! # some improvements :
! # * return immediatly when a subfield is empty
! # * search duplicate on isbn must be done only when there is an isbn ;-)
! #
! # Revision 1.115.2.7  2005/03/10 15:52:28  tipaul
! # * adding glass to opac marc detail.
! # * changing glasses behaviour : It now appears only on subfields that have a "link" value. Avoid useless glasses and removes nothing. **** WARNING **** : if you don't change you MARC parameters, glasses DISAPPEAR, because no subfields have a link value. So you MUST "reactivate" them manually. If you want to enable the search glass on field 225$a (collection in UNIMARC), just put 225a to "link" field (Koha >> parameters >> framework >> 225 field >> subfield >> modify $a >> enter 225a in link input field (without quotes or anything else)
! # * fixing bug with libopac
! #
! # Revision 1.115.2.6  2005/03/09 15:56:01  tipaul
! # Changing MARCmoditem to be like MARCmodbiblio : a modif is a delete & create.
! # Longer, but solves problems with repeated subfields.
! #
! # The previous version was not buggy except under certain circumstances (a repeated subfield, that does not exist usually in items)
  #
  # Revision 1.115.2.5  2005/02/24 13:54:04  tipaul

Index: Bull.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Bull.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Bull.pm	15 Apr 2005 14:31:51 -0000	1.8
--- Bull.pm	4 May 2005 15:40:01 -0000	1.9
***************
*** 47,51 ****
  @EXPORT = qw(&newsubscription &modsubscription &delsubscription &getsubscriptions &getsubscription 
  			&getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber
! 			&modsubscriptionhistory
  			&getserials &serialchangestatus
  			&Find_Next_Date, &Get_Next_Seq
--- 47,51 ----
  @EXPORT = qw(&newsubscription &modsubscription &delsubscription &getsubscriptions &getsubscription 
  			&getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber
! 			&modsubscriptionhistory &newissue
  			&getserials &serialchangestatus
  			&Find_Next_Date, &Get_Next_Seq
***************
*** 177,181 ****
  	my @res;
  	while (my $subs = $sth->fetchrow_hashref) {
! 		$subs->{'startdate'} = format_date($subs->{'startdate'});
  		push @res,$subs;
  	}
--- 177,184 ----
  	my @res;
  	while (my $subs = $sth->fetchrow_hashref) {
! 		$subs->{startdate} = format_date($subs->{startdate});
! 		$subs->{opacnote} =~ s/\n/\<br\/\>/g;
! 		$subs->{missinglist} =~ s/\n/\<br\/\>/g;
! 		$subs->{recievedlist} =~ s/\n/\<br\/\>/g;
  		push @res,$subs;
  	}
***************
*** 260,263 ****
--- 263,269 ----
  	my $dbh=C4::Context->dbh;
  	my $sth = $dbh->prepare("update subscriptionhistory set histstartdate=?,enddate=?,recievedlist=?,missinglist=?,opacnote=?,librariannote=? where subscriptionid=?");
+ 	$recievedlist =~ s/^,//g;
+ 	$missinglist =~ s/^,//g;
+ 	$opacnote =~ s/^,//g;
  	$sth->execute($histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote,$subscriptionid);
  }
***************
*** 314,319 ****
  		# next date (calculated from actual date & frequency parameters)
  		my $nextplanneddate = Get_Next_Date($planneddate,$val);
! 		$sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)");
! 		$sth->execute($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate);
  		$sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?,
  														innerloop1=?,innerloop2=?,innerloop3=?
--- 320,324 ----
  		# next date (calculated from actual date & frequency parameters)
  		my $nextplanneddate = Get_Next_Date($planneddate,$val);
! 		newissue($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, $nextplanneddate);
  		$sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?,
  														innerloop1=?,innerloop2=?,innerloop3=?
***************
*** 323,326 ****
--- 328,338 ----
  }
  
+ sub newissue {
+ 	my ($serialseq,$subscriptionid,$biblionumber,$status, $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);
+ }
+ 
  sub Get_Next_Date(@) {
  	my ($planneddate,$subscription) = @_;
***************
*** 351,355 ****
  	}
  	if ($subscription->{periodicity} == 9) {
! 		$resultdate=DateCalc($planneddate,"2 weeks");
  	}
  	if ($subscription->{periodicity} == 10) {
--- 363,367 ----
  	}
  	if ($subscription->{periodicity} == 9) {
! 		$resultdate=DateCalc($planneddate,"6 months");
  	}
  	if ($subscription->{periodicity} == 10) {

Index: Members.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Members.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** Members.pm	4 Oct 2004 20:19:08 -0000	1.6
--- Members.pm	4 May 2005 15:40:01 -0000	1.7
***************
*** 104,108 ****
  	my $query="update borrowers set title='$data{'title'}',expiry='$data{'expiry'}',
  	cardnumber='$data{'cardnumber'}',sex='$data{'sex'}',ethnotes='$data{'ethnicnotes'}',
! 	streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',firstname='$data{'firstname'}',
  	altnotes='$data{'altnotes'}',dateofbirth='$data{'dateofbirth'}',contactname='$data{'contactname'}',
  	emailaddress='$data{'emailaddress'}',dateenrolled='$data{'joining'}',streetcity='$data{'streetcity'}',
--- 104,108 ----
  	my $query="update borrowers set title='$data{'title'}',expiry='$data{'expiry'}',
  	cardnumber='$data{'cardnumber'}',sex='$data{'sex'}',ethnotes='$data{'ethnicnotes'}',
! 	streetaddress='$data{'streetaddress'}',faxnumber='$data{'faxnumber'}',firstname='$data{'firstname'}',
  	altnotes='$data{'altnotes'}',dateofbirth='$data{'dateofbirth'}',contactname='$data{'contactname'}',
  	emailaddress='$data{'emailaddress'}',dateenrolled='$data{'joining'}',streetcity='$data{'streetcity'}',
***************
*** 110,114 ****
  	categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
  	borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}',
! 	initials='$data{'initials'}',physstreet='$data{'streetaddress'}',ethnicity='$data{'ethnicity'}',
  	gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}',
  	textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}',
--- 110,114 ----
  	categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
  	borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}',
! 	initials='$data{'initials'}',physstreet='$data{'physstreet'}',ethnicity='$data{'ethnicity'}',
  	gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}',
  	textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}',
***************
*** 138,147 ****
  	altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
  	initials,ethnicity,physstreet,branchcode,zipcode,homezipcode,sort1,sort2) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
! 	'$data{'sex'}','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
  	'$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
  	'$data{'joining'}','$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
  	'$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
  	'$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
! 	'$data{'ethnicity'}','$data{'streetaddress'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}','$data{'sort1'}','$data{'sort2'}')";
  	my $sth=$dbh->prepare($query);
  	$sth->execute;
--- 138,147 ----
  	altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
  	initials,ethnicity,physstreet,branchcode,zipcode,homezipcode,sort1,sort2) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
! 	'$data{'sex'}','$data{'ethnotes'}','$data{'streetaddress'}','$data{'faxnumber'}',
  	'$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
  	'$data{'joining'}','$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
  	'$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
  	'$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
! 	'$data{'ethnicity'}','$data{'physstreet'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}','$data{'sort1'}','$data{'sort2'}')";
  	my $sth=$dbh->prepare($query);
  	$sth->execute;

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -r1.41 -r1.42
*** SearchMarc.pm	7 Mar 2005 09:09:03 -0000	1.41
--- SearchMarc.pm	4 May 2005 15:40:01 -0000	1.42
***************
*** 217,221 ****
  		# remove % at the beginning
  		@$value[$i] =~ s/^%//g;
! 	    @$value[$i] =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\})/ /g if @$operator[$i] eq "contains";
  		if(@$excluding[$i])	# NOT statements
  		{
--- 217,221 ----
  		# remove % at the beginning
  		@$value[$i] =~ s/^%//g;
! 	    @$value[$i] =~ s/(\.|\?|\:|\!|\'|,|\-|\"|\(|\)|\[|\]|\{|\}|\/)/ /g if @$operator[$i] eq "contains";
  		if(@$excluding[$i])	# NOT statements
  		{
***************
*** 336,340 ****
  	# HINT : biblionumber as bn is important. The hash is fills biblionumber with items.biblionumber.
  	# so if you dont' has an item, you get a not nice empty value.
! 	$sth = $dbh->prepare("SELECT biblio.biblionumber as bn,biblio.*, biblioitems.*,marc_biblio.bibid,itemtypes.notforloan
  							FROM biblio, marc_biblio 
  							LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
--- 336,340 ----
  	# HINT : biblionumber as bn is important. The hash is fills biblionumber with items.biblionumber.
  	# so if you dont' has an item, you get a not nice empty value.
! 	$sth = $dbh->prepare("SELECT biblio.biblionumber as bn,biblio.*, biblioitems.*,marc_biblio.bibid,itemtypes.notforloan,itemtypes.description
  							FROM biblio, marc_biblio 
  							LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
***************
*** 389,393 ****
  			$lineCN{location} = $item->{location};
  			$lineCN{date_due} = format_date($date_due);
! 			$lineCN{notforloan} = $notforloanstatus{$item->{notforloan}} if ($item->{notforloan});
  			$notforloan=0 unless ($item->{notforloan} or $item->{wthdrawn} or $item->{itemlost});
  			push @CNresults,\%lineCN;
--- 389,394 ----
  			$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});
  			push @CNresults,\%lineCN;
***************
*** 400,404 ****
  		# if $totalitems == 0, check if it's being ordered.
  		if ($totalitems == 0) {
! 			my $sth = $dbh->prepare("select count(*) from aqorders where biblionumber=?");
  			$sth->execute($biblionumber);
  			my ($ordered) = $sth->fetchrow;
--- 401,405 ----
  		# if $totalitems == 0, check if it's being ordered.
  		if ($totalitems == 0) {
! 			my $sth = $dbh->prepare("select count(*) from aqorders where biblionumber=? and datecancellationprinted is NULL");
  			$sth->execute($biblionumber);
  			my ($ordered) = $sth->fetchrow;

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -r1.101 -r1.102
*** Search.pm	7 Mar 2005 08:55:30 -0000	1.101
--- Search.pm	4 May 2005 15:40:01 -0000	1.102
***************
*** 65,69 ****
  &addauthor &bibitems &barcodes &findguarantees &allissues
  &findguarantor &getwebsites &getwebbiblioitems &catalogsearch &itemcount2
! &isbnsearch &breedingsearch &getbranchname &getborrowercategory);
  # make all your functions, whether exported or not;
  
--- 65,69 ----
  &addauthor &bibitems &barcodes &findguarantees &allissues
  &findguarantor &getwebsites &getwebbiblioitems &catalogsearch &itemcount2
! &isbnsearch &getbranchname &getborrowercategory);
  # make all your functions, whether exported or not;
  
***************
*** 1306,1314 ****
  					AND biblioitems.biblioitemnumber = items.biblioitemnumber
  					AND biblio.biblionumber = items.biblionumber";
! 	if ($type ne 'intra'){
! 		$query .= " and ((items.itemlost<>1 and items.itemlost <> 2)
! 		or items.itemlost is NULL)
! 		and (wthdrawn <> 1 or wthdrawn is NULL)";
! 	}
  	$query .= " order by items.dateaccessioned desc";
  	my $sth=$dbh->prepare($query);
--- 1306,1315 ----
  					AND biblioitems.biblioitemnumber = items.biblioitemnumber
  					AND biblio.biblionumber = items.biblionumber";
! # buggy : opac & librarian interface can show the same info level & itemstatus should not be hardcoded
! # 	if ($type ne 'intra'){
! # 		$query .= " and ((items.itemlost<>1 and items.itemlost <> 2)
! # 		or items.itemlost is NULL)
! # 		and (wthdrawn <> 1 or wthdrawn is NULL)";
! # 	}
  	$query .= " order by items.dateaccessioned desc";
  	my $sth=$dbh->prepare($query);
***************
*** 1325,1337 ****
  		$datedue = format_date($idata->{'date_due'});
  		}
! 		if ($data->{'itemlost'} eq '2'){
! 			$datedue='Very Overdue';
! 		}
! 		if ($data->{'itemlost'} eq '1'){
! 			$datedue='Lost';
! 		}
! 		if ($data->{'wthdrawn'} eq '1'){
! 			$datedue="Cancelled";
! 		}
  		if ($datedue eq ''){
  	#	$datedue="Available";
--- 1326,1340 ----
  		$datedue = format_date($idata->{'date_due'});
  		}
! # buggy : hardcoded & non-translatable
! # more : why don't you want to show the datedue if it's very very overdue ?
! # 		if ($data->{'itemlost'} eq '2'){
! # 			$datedue='Very Overdue';
! # 		}
! # 		if ($data->{'itemlost'} eq '1'){
! # 			$datedue='Lost';
! # 		}
! # 		if ($data->{'wthdrawn'} eq '1'){
! # 			$datedue="Cancelled";
! # 		}
  		if ($datedue eq ''){
  	#	$datedue="Available";
***************
*** 1366,1383 ****
  	$sth->finish;
  	#FIXME: ordering/indentation here looks wrong
! 	my $sth2=$dbh->prepare("Select * from aqorders where biblionumber=?");
! 	$sth2->execute($biblionumber);
! 	my $data;
! 	my $ocount;
! 	if ($data=$sth2->fetchrow_hashref){
! 		$ocount=$data->{'quantity'} - $data->{'quantityreceived'};
! 		if ($ocount > 0){
! 		$data->{'ocount'}=$ocount;
! 		$data->{'order'}="One Order";
! 		$results[$i]=$data;
! 		}
! 	}
! 	$sth2->finish;
! 	
  	return(@results);
  }
--- 1369,1388 ----
  	$sth->finish;
  	#FIXME: ordering/indentation here looks wrong
! # buggy : count in $i+1 the info on qty ordered for $i : total shown is real total +1
! # useless : Koha 2.2.2 now automatically show the existing number of items
! # and if there is no items, and at least one is on order, show "on order".
! # 	my $sth2=$dbh->prepare("Select * from aqorders where biblionumber=?");
! # 	$sth2->execute($biblionumber);
! # 	my $data;
! # 	my $ocount;
! # 	if ($data=$sth2->fetchrow_hashref){
! # 		$ocount=$data->{'quantity'} - $data->{'quantityreceived'};
! # 		if ($ocount > 0){
! # 		$data->{'ocount'}=$ocount;
! # 		$data->{'order'}="One Order";
! # 		$results[$i]=$data;
! # 		}
! # 	}
! # 	$sth2->finish;
  	return(@results);
  }
***************
*** 2444,2499 ****
  
  
- =item breedingsearch
- 
-   ($count, @results) = &breedingsearch($title,$isbn,$random);
- C<$title> contains the title,
- C<$isbn> contains isbn or issn,
- C<$random> contains the random seed from a z3950 search.
- 
- C<$count> is the number of items in C<@results>. C<@results> is an
- array of references-to-hash; the keys are the items from the C<marc_breeding> table of the Koha database.
- 
- =cut
- 
- sub breedingsearch {
- 	my ($title,$isbn,$z3950random) = @_;
- 	my $dbh   = C4::Context->dbh;
- 	my $count = 0;
- 	my ($query, at bind);
- 	my $sth;
- 	my @results;
- 
- 	$query = "Select id,file,isbn,title,author from marc_breeding where ";
- 	if ($z3950random) {
- 		$query .= "z3950random = ?";
- 		@bind=($z3950random);
- 	} else {
- 	    @bind=();
- 		if ($title) {
- 			$query .= "title like ?";
- 			push(@bind,"$title%");
- 		}
- 		if ($title && $isbn) {
- 			$query .= " and ";
- 		}
- 		if ($isbn) {
- 			$query .= "isbn like ?";
- 			push(@bind,"$isbn%");
- 		}
- 	}
- 	$sth   = $dbh->prepare($query);
- 	$sth->execute(@bind);
- 	while (my $data = $sth->fetchrow_hashref) {
- 			$results[$count] = $data;
- 			$count++;
- 	} # while
- 
- 	$sth->finish;
- 	return($count, @results);
- } # sub breedingsearch
- 
- 
- 
- 
  
  =item isbnsearch
--- 2449,2452 ----

Index: Suggestions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Suggestions.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Suggestions.pm	13 Sep 2004 15:25:38 -0000	1.4
--- Suggestions.pm	4 May 2005 15:40:02 -0000	1.5
***************
*** 25,28 ****
--- 25,29 ----
  use C4::Context;
  use C4::Output;
+ use Mail::Sendmail;
  # use C4::Interface::CGI::Output;
  use vars qw($VERSION @ISA @EXPORT);
***************
*** 109,114 ****
  	}
  	if ($suggestedbyme) {
! 		push @sql_params,$user;
! 		$query .= " and suggestedby=?";
  	} else {
  		$query .= " and managedby is NULL";
--- 110,118 ----
  	}
  	if ($suggestedbyme) {
! 		if ($suggestedbyme eq -1) {
! 		} else {
! 			push @sql_params,$user;
! 			$query .= " and suggestedby=?";
! 		}
  	} else {
  		$query .= " and managedby is NULL";
***************
*** 201,205 ****
  					bysurname => $emailinfo->{bysurname},
  					);
! 	warn "mailing => ".$template->output;
  # 	warn "sending email to $emailinfo->{byemail} from $emailinfo->{libemail} to notice new status $emailinfo->{status} for $emailinfo->{title} / $emailinfo->{author}";
  }
--- 205,214 ----
  					bysurname => $emailinfo->{bysurname},
  					);
! 	my %mail = ( To => $emailinfo->{byemail},
! 				 From => $emailinfo->{libemail},
! 				 Subject => 'Koha suggestion',
! 				 Message => "".$template->output
! 				 );
! sendmail(%mail);
  # 	warn "sending email to $emailinfo->{byemail} from $emailinfo->{libemail} to notice new status $emailinfo->{status} for $emailinfo->{title} / $emailinfo->{author}";
  }





More information about the Koha-cvs mailing list