[Koha-cvs] koha/C4 Acquisition.pm Auth.pm AuthoritiesMarc....
Tumer Garip
tgarip at neu.edu.tr
Wed Sep 20 23:48:44 CEST 2006
CVSROOT: /sources/koha
Module name: koha
Changes by: Tumer Garip <tgarip1957> 06/09/20 21:48:44
Modified files:
C4 : Acquisition.pm Auth.pm AuthoritiesMarc.pm
Biblio.pm Bookfund.pm Members.pm Suggestions.pm
C4/Circulation : Circ2.pm Fines.pm
Log message:
Some bug fixing, new acquisitions handling
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Acquisition.pm?cvsroot=koha&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Auth.pm?cvsroot=koha&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&r1=1.182&r2=1.183
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Bookfund.pm?cvsroot=koha&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Suggestions.pm?cvsroot=koha&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Fines.pm?cvsroot=koha&r1=1.17&r2=1.18
Patches:
Index: Acquisition.pm
===================================================================
RCS file: /sources/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- Acquisition.pm 6 Sep 2006 16:21:03 -0000 1.46
+++ Acquisition.pm 20 Sep 2006 21:48:44 -0000 1.47
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Acquisition.pm,v 1.46 2006/09/06 16:21:03 tgarip1957 Exp $
+# $Id: Acquisition.pm,v 1.47 2006/09/20 21:48:44 tgarip1957 Exp $
use strict;
require Exporter;
@@ -30,7 +30,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.46 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.47 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
# used in receiveorder subroutine
# to provide library specific handling
@@ -60,9 +60,9 @@
&GetBasket &NewBasket &CloseBasket
&GetPendingOrders &GetOrder &GetOrders
&GetOrderNumber &GetLateOrders &NewOrder &DelOrder
- &SearchOrder &GetHistory
- &ModOrder &ModReceiveOrder &ModOrderBiblioNumber
- &GetParcels &GetParcel &GetSingleOrder
+ &GetHistory
+ &ModOrder &ModReceiveOrder
+ &GetSingleOrder
);
@@ -92,7 +92,7 @@
=cut
sub GetBasket {
- my ($basketno) = @_;
+ my ($basketno) = shift;
my $dbh = C4::Context->dbh;
my $query = "
SELECT aqbasket.*,
@@ -209,19 +209,17 @@
=cut
sub GetPendingOrders {
- my $supplierid = @_;
+ my $supplierid = shift;
my $dbh = C4::Context->dbh;
- my $strsth = "
- SELECT count(*),authorisedby,creationdate,aqbasket.basketno,
- closedate,surname,firstname,aqorders.title
+ my $strsth = "SELECT aqorders.*,aqbasket.*,borrowers.firstname,borrowers.surname
FROM aqorders
LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
WHERE booksellerid=?
AND (quantity > quantityreceived OR quantityreceived is NULL)
AND datecancellationprinted IS NULL
- AND (to_days(now())-to_days(closedate) < 180 OR closedate IS NULL)
- ";
+ AND (to_days(now())-to_days(closedate) < 180 OR closedate IS NULL) ";
+
if ( C4::Context->preference("IndependantBranches") ) {
my $userenv = C4::Context->userenv;
if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
@@ -231,12 +229,12 @@
. "' or borrowers.branchcode ='')";
}
}
- $strsth .= " group by basketno order by aqbasket.basketno";
+ $strsth .= " group by aqbasket.basketno order by aqbasket.basketno";
my $sth = $dbh->prepare($strsth);
$sth->execute($supplierid);
- my @results = ();
- while ( my $data = $sth->fetchrow_hashref ) {
- push( @results, $data );
+ my @results;
+ while (my $data = $sth->fetchrow_hashref ) {
+ push @results, $data ;
}
$sth->finish;
return \@results;
@@ -250,7 +248,7 @@
@orders = &GetOrders($basketnumber, $orderby);
-Looks up the pending (non-cancelled) orders with the given basket
+Looks up the non-cancelled orders (whether received or not) with the given basket
number. If C<$booksellerID> is non-empty, only orders from that seller
are returned.
@@ -269,8 +267,7 @@
my $query ="
SELECT aqorderbreakdown.*,
biblio.*,
- aqorders.*,
- biblio.title
+ aqorders.*
FROM aqorders,biblio
LEFT JOIN aqorderbreakdown ON
aqorders.ordernumber=aqorderbreakdown.ordernumber
@@ -409,7 +406,7 @@
$listprice, $booksellerid, $authorisedby, $notes,
$bookfund, $rrp, $ecost,
$gst, $budget, $cost, $sub,
- $invoice, $sort1, $sort2
+ $purchaseorderno, $sort1, $sort2,$discount,$branch
)
= @_;
@@ -420,17 +417,6 @@
$budget = "now()";
}
- # if month is july or more, budget start is 1 jul, next year.
- elsif ( $month >= '7' ) {
- ++$year; # add 1 to year , coz its next year
- $budget = "'$year-07-01'";
- }
- else {
-
- # START OF NEW BUDGET, 1ST OF JULY, THIS YEAR
- $budget = "'$year-07-01'";
- }
-
if ( $sub eq 'yes' ) {
$sub = 1;
}
@@ -447,26 +433,26 @@
my $query = "
INSERT INTO aqorders
( biblionumber,title,basketno,quantity,listprice,notes,
- rrp,ecost,gst,unitprice,subscription,sort1,sort2,budgetdate,entrydate)
- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,$budget,now() )
+ rrp,ecost,gst,unitprice,subscription,sort1,sort2,purchaseordernumber,discount,budgetdate,entrydate)
+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,$budget,now() )
";
my $sth = $dbh->prepare($query);
$sth->execute(
$biblionumber, $title, $basketno, $quantity, $listprice,
$notes, $rrp, $ecost, $gst,
- $cost, $sub, $sort1, $sort2
+ $cost, $sub, $sort1, $sort2,$purchaseorderno,$discount
);
$sth->finish;
#get ordnum MYSQL dependant, but $dbh->last_insert_id returns null
my $ordnum = $dbh->{'mysql_insertid'};
my $query = "
- INSERT INTO aqorderbreakdown (ordernumber,bookfundid)
- VALUES (?,?)
+ INSERT INTO aqorderbreakdown (ordernumber,bookfundid,branchcode)
+ VALUES (?,?,?)
";
$sth = $dbh->prepare($query);
- $sth->execute( $ordnum, $bookfund );
+ $sth->execute( $ordnum, $bookfund,$branch );
$sth->finish;
return ( $basketno, $ordnum );
}
@@ -499,7 +485,7 @@
$title, $ordnum, $quantity, $listprice, $biblionumber,
$basketno, $supplier, $who, $notes, $bookfund,
$rrp, $ecost, $gst, $budget,
- $cost, $invoice, $sort1, $sort2
+ $cost, $invoice, $sort1, $sort2,$discount,$branch
)
= @_;
my $dbh = C4::Context->dbh;
@@ -507,51 +493,31 @@
UPDATE aqorders
SET title=?,
quantity=?,listprice=?,basketno=?,
- rrp=?,ecost=?,unitprice=?,booksellerinvoicenumber=?,
- notes=?,sort1=?, sort2=?
+ rrp=?,ecost=?,unitprice=?,purchaseordernumber=?,gst=?,
+ notes=?,sort1=?, sort2=?,discount=?
WHERE ordernumber=? AND biblionumber=?
";
my $sth = $dbh->prepare($query);
$sth->execute(
$title, $quantity, $listprice, $basketno, $rrp,
- $ecost, $cost, $invoice, $notes, $sort1,
- $sort2, $ordnum, $biblionumber
+ $ecost, $cost, $invoice, $gst, $notes, $sort1,
+ $sort2, $discount,$ordnum, $biblionumber
);
$sth->finish;
my $query = "
- UPDATE aqorderbreakdown
- SET bookfundid=?
- WHERE ordernumber=?
+ REPLACE aqorderbreakdown
+ SET ordernumber=?, bookfundid=?, branchcode=?
";
$sth = $dbh->prepare($query);
- unless ( $sth->execute( $bookfund, $ordnum ) )
- { # zero rows affected [Bug 734]
- my $query ="
- INSERT INTO aqorderbreakdown
- (ordernumber,bookfundid)
- VALUES (?,?)
- ";
- $sth = $dbh->prepare($query);
- $sth->execute( $ordnum, $bookfund );
- }
+ $sth->execute( $ordnum,$bookfund, $branch );
+
$sth->finish;
}
#------------------------------------------------------------#
-=head3 ModOrderBiblioNumber
-
-=over 4
-
-&ModOrderBiblioNumber($biblioitemnumber,$ordnum, $biblionumber);
-Modifies the biblioitemnumber for an existing order.
-Updates the order with order number C<$ordernum> and biblionumber C<$biblionumber>.
-
-=back
-
-=cut
#------------------------------------------------------------#
@@ -571,7 +537,6 @@
Updates the order with bibilionumber C<$biblionumber> and ordernumber
C<$ordernumber>.
-Also updates the book fund ID in the aqorderbreakdown table.
=back
@@ -580,157 +545,28 @@
sub ModReceiveOrder {
my (
- $biblionumber, $ordnum, $quantrec, $user, $cost,
- $invoiceno, $freight, $rrp, $bookfund
+ $biblionumber, $ordnum, $quantrec, $cost,
+ $invoiceno, $freight, $rrp, $listprice,$input
)
= @_;
my $dbh = C4::Context->dbh;
my $query = "
UPDATE aqorders
- SET quantityreceived=?,datereceived=now(),booksellerinvoicenumber=?,
- unitprice=?,freight=?,rrp=?
+ SET quantityreceived=quantityreceived+?,datereceived=now(),booksellerinvoicenumber=?,
+ unitprice=?,freight=?,rrp=?,listprice=?
WHERE biblionumber=? AND ordernumber=?
";
my $sth = $dbh->prepare($query);
my $suggestionid = GetSuggestionFromBiblionumber( $dbh, $biblionumber );
if ($suggestionid) {
- ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber );
+ ModStatus( $suggestionid, 'AVAILABLE', '', $biblionumber,$input );
}
- $sth->execute( $quantrec, $invoiceno, $cost, $freight, $rrp, $biblionumber,
+ $sth->execute( $quantrec, $invoiceno, $cost, $freight, $rrp, $listprice, $biblionumber,
$ordnum );
$sth->finish;
- # Allows libraries to change their bookfund during receiving orders
- # allows them to adjust budgets
- if ( C4::Context->preferene("LooseBudgets") ) {
- my $query = "
- UPDATE aqorderbreakdown
- SET bookfundid=?
- WHERE ordernumber=?
- ";
- my $sth = $dbh->prepare($query);
- $sth->execute( $bookfund, $ordnum );
- $sth->finish;
- }
}
-#------------------------------------------------------------#
-
-=head3 SearchOrder
-
- at results = &SearchOrder($search, $biblionumber, $complete);
-
-Searches for orders.
-
-C<$search> may take one of several forms: if it is an ISBN,
-C<&ordersearch> returns orders with that ISBN. If C<$search> is an
-order number, C<&ordersearch> returns orders with that order number
-and biblionumber C<$biblionumber>. Otherwise, C<$search> is considered
-to be a space-separated list of search terms; in this case, all of the
-terms must appear in the title (matching the beginning of title
-words).
-
-If C<$complete> is C<yes>, the results will include only completed
-orders. In any case, C<&ordersearch> ignores cancelled orders.
-
-C<&ordersearch> returns an array.
-C<@results> is an array of references-to-hash with the following keys:
-
-=over 4
-
-=item C<author>
-
-=item C<seriestitle>
-
-=item C<branchcode>
-
-=item C<bookfundid>
-
-=back
-
-=cut
-
-sub SearchOrder {
-### Requires fixing for KOHA 3 API for performance. Currently just fiixed so it works
-## Very CPU expensive searches seems to be repeated!!
-## This search can be directed to ZEBRA for title,isbn etc. ordernumber ,booksellerid to acquiorders
- my ( $search, $id, $biblio, $catview ) = @_;
- my $dbh = C4::Context->dbh;
- my @data = split( ' ', $search );
- my @searchterms;
- if ($id) {
- @searchterms = ($id);
- }
- map { push( @searchterms, "$_%", "% $_%" ) } @data;
- push( @searchterms, $search, $search, $biblio );
- my $query;
- if ($id) {
- $query =
- "SELECT *,biblio.title FROM aqorders,biblio,aqbasket
- WHERE biblio.biblionumber=aqorders.biblionumber AND
- aqorders.basketno = aqbasket.basketno
- AND aqbasket.booksellerid = ?
-
- AND ((datecancellationprinted is NULL)
- OR (datecancellationprinted = '0000-00-00'))
- AND (("
- . (
- join( " AND ",
- map { "(biblio.title like ? or biblio.title like ?)" } @data )
- )
- . ") OR biblio.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) ";
-
- }
- else {
- $query =
- " SELECT *,biblio.title
- FROM aqorders,biblio,aqbasket
- WHERE aqorders.biblionumber = biblio.biblionumber
- AND aqorders.basketno = aqbasket.basketno
-
- AND ((datecancellationprinted is NULL)
- OR (datecancellationprinted = '0000-00-00'))
- AND (aqorders.quantityreceived < aqorders.quantity OR aqorders.quantityreceived is NULL)
- AND (("
- . (
- join( " AND ",
- map { "(biblio.title like ? OR biblio.title like ?)" } @data )
- )
- . ") or biblio.isbn=? OR (aqorders.ordernumber=? AND aqorders.biblionumber=?)) ";
- }
- $query .= " GROUP BY aqorders.ordernumber";
- my $sth = $dbh->prepare($query);
- $sth->execute(@searchterms);
- my @results = ();
-
-
-
- my $query3 = "
- SELECT *
- FROM aqorderbreakdown
- WHERE ordernumber=?
- ";
- my $sth3 = $dbh->prepare($query3);
-
- while ( my $data = $sth->fetchrow_hashref ) {
-## Retrieving a whole marc record just to extract seriestitle is very poor performance
-## Rewrite these searches
-my $record=XMLgetbibliohash($dbh,$data->{'biblionumber'});
-my $seriestitle=XML_readline_onerecord($record,"seriestitle","biblios");
-
-# $data->{'author'} = $data->{'author'};
- $data->{'seriestitle'} = $seriestitle;
- $sth3->execute( $data->{'ordernumber'} );
- my $data3 = $sth3->fetchrow_hashref;
- $data->{'branchcode'} = $data3->{'branchcode'};
- $data->{'bookfundid'} = $data3->{'bookfundid'};
- push( @results, $data );
- }
- $sth->finish;
-
- $sth3->finish;
- return @results;
-}
#------------------------------------------------------------#
@@ -749,15 +585,15 @@
=cut
sub DelOrder {
- my ( $biblionumber, $ordnum ) = @_;
+ my ( $biblionumber, $ordnum,$user ) = @_;
my $dbh = C4::Context->dbh;
my $query = "
UPDATE aqorders
- SET datecancellationprinted=now()
+ SET datecancellationprinted=now(), cancelledby=?
WHERE biblionumber=? AND ordernumber=?
";
my $sth = $dbh->prepare($query);
- $sth->execute( $biblionumber, $ordnum );
+ $sth->execute( $user,$biblionumber, $ordnum );
$sth->finish;
}
@@ -791,22 +627,21 @@
=back
=cut
-
+## This routine is not used will be cleaned
sub GetParcel {
#gets all orders from a certain supplier, orders them alphabetically
- my ( $supplierid, $code, $datereceived ) = @_;
+ my ( $supplierid, $invoice, $datereceived ) = @_;
my $dbh = C4::Context->dbh;
my @results = ();
- $code .= '%'
- if $code; # add % if we search on a given code (otherwise, let him empty)
+ $invoice .= '%' if $invoice; # add % if we search on a given invoice
my $strsth ="
SELECT authorisedby,
creationdate,
aqbasket.basketno,
closedate,surname,
firstname,
- aqorders.biblionumber,
+ biblionumber,
aqorders.title,
aqorders.ordernumber,
aqorders.quantity,
@@ -819,8 +654,8 @@
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\'";
+ AND (aqorders.datereceived= \"$datereceived\" OR aqorders.datereceived is NULL)";
+ $strsth.= " AND aqorders.purchaseordernumber LIKE \"$invoice\"" if $invoice ne "%";
if ( C4::Context->preference("IndependantBranches") ) {
my $userenv = C4::Context->userenv;
@@ -836,7 +671,7 @@
my $sth = $dbh->prepare($strsth);
$sth->execute($supplierid);
while ( my $data = $sth->fetchrow_hashref ) {
- push( @results, $data );
+ push @results, $data ;
}
### countparcelbiblio: $count
$sth->finish;
@@ -881,7 +716,7 @@
=back
=cut
-
+### This routine is not used will be cleaned
sub GetParcels {
my ($bookseller,$order, $code, $datefrom, $dateto) = @_;
my $dbh = C4::Context->dbh;
Index: Auth.pm
===================================================================
RCS file: /sources/koha/koha/C4/Auth.pm,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- Auth.pm 11 Sep 2006 17:09:59 -0000 1.55
+++ Auth.pm 20 Sep 2006 21:48:44 -0000 1.56
@@ -28,6 +28,7 @@
use C4::Output; # to get the template
use C4::Interface::CGI::Output;
use C4::Members; # getpatroninformation
+use C4::Koha;## to get branch
# use Net::LDAP;
# use Net::LDAP qw(:all);
@@ -127,6 +128,8 @@
$bordat[0] = $borr;
$template->param(USER_INFO => \@bordat,
);
+ my $branches=GetBranches();
+ $template->param(branchname=>$branches->{$borr->{branchcode}}->{branchname},);
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
Index: AuthoritiesMarc.pm
===================================================================
RCS file: /sources/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- AuthoritiesMarc.pm 11 Sep 2006 17:09:59 -0000 1.31
+++ AuthoritiesMarc.pm 20 Sep 2006 21:48:44 -0000 1.32
@@ -73,7 +73,7 @@
my $n=0;
my @authtypecode;
my @auths=split / /,$authtypecode ;
- my ($attrfield)=MARCfind_attr_from_kohafield("auth_authtypecode");
+ my ($attrfield)=MARCfind_attr_from_kohafield("authtypecode");
foreach my $auth (@auths){
$query .=$attrfield." ".$auth." "; ##No truncation on authtype
push @authtypecode ,$auth;
@@ -92,9 +92,9 @@
if (@$value[$i]){
##If mainentry search $a tag
if (@$tags[$i] eq "mainentry") {
- ($attr)=MARCfind_attr_from_kohafield("auth_mainentry")." ";
+ ($attr)=MARCfind_attr_from_kohafield("mainentry")." ";
}else{
- ($attr) =MARCfind_attr_from_kohafield("auth_allentry")." ";
+ ($attr) =MARCfind_attr_from_kohafield("allentry")." ";
}
if (@$operator[$i] eq 'phrase') {
$attr.=" \@attr 4=1 \@attr 5=100 \@attr 6=3 ";##Phrase, No truncation,all of subfield field must match
@@ -122,8 +122,8 @@
my @oAuth;
my $i;
$oAuth[0]=C4::Context->Zconnauth("authorityserver");
-my ($mainentry)=MARCfind_attr_from_kohafield("auth_mainentry");
-my ($allentry)=MARCfind_attr_from_kohafield("auth_allentry");
+my ($mainentry)=MARCfind_attr_from_kohafield("mainentry");
+my ($allentry)=MARCfind_attr_from_kohafield("allentry");
$query="\@attr 2=102 \@or \@or ".$query." \@attr 7=1 ".$mainentry." 0 \@attr 7=1 ".$allentry." 1"; ## sort on mainfield and subfields
@@ -162,8 +162,8 @@
my @linkids;
my $separator=C4::Context->preference('authoritysep');
my $linksummary=" ".$separator;
-my $authid=XML_readline_onerecord($authrecord,"auth_authid","authorities");
-my @linkid=XML_readline_asarray($authrecord,"auth_linkid","authorities");##May have many linked records
+my $authid=XML_readline_onerecord($authrecord,"authid","authorities");
+my @linkid=XML_readline_asarray($authrecord,"linkid","authorities");##May have many linked records
foreach my $linkid (@linkid){
my $linktype=AUTHfind_authtypecode($dbh,$linkid);
@@ -220,7 +220,7 @@
my @oConnection;
$oConnection[0]=C4::Context->Zconn("biblioserver");
my $query;
-my ($attrfield)=MARCfind_attr_from_kohafield("auth_authid");
+my ($attrfield)=MARCfind_attr_from_kohafield("authid");
$query= $attrfield." ".$authid;
my $oResult = $oConnection[0]->search_pqf($query);
@@ -319,17 +319,15 @@
}
##Modified record may also come here use REPLACE -- bulk import comes here
-XML_writeline($record,"auth_authid",$authid,"authorities");
-XML_writeline($record,"auth_authtypecode",$authtypecode,"authorities");
+XML_writeline($record,"authid",$authid,"authorities");
+XML_writeline($record,"authtypecode",$authtypecode,"authorities");
my $xml=XML_hash2xml($record);
my $sth=$dbh->prepare("REPLACE auth_header set marcxml=?, authid=?,authtypecode=?,datecreated=now()");
$sth->execute($xml,$authid,$authtypecode);
$sth->finish;
-
-
ZEBRAop($dbh,$authid,'specialUpdate',"authorityserver");
## If the record is linked to another update the linked authorities with new authid
-my @linkids=XML_readline_asarray($record,"auth_linkid","authorities");
+my @linkids=XML_readline_asarray($record,"linkid","authorities");
foreach my $linkid (@linkids){
##Modify the record of linked
AUTHaddlink($dbh,$linkid,$authid);
@@ -342,9 +340,9 @@
my $record=XMLgetauthorityhash($dbh,$linkid);
my $authtypecode=AUTHfind_authtypecode($dbh,$linkid);
#warn "adding l:$linkid,a:$authid,auth:$authtypecode";
-XML_writeline($record,"auth_linkid",$authid,"authorities");
+XML_writeline($record,"linkid",$authid,"authorities");
my $xml=XML_hash2xml($record);
-$dbh->do("lock tables auth_header WRITE");
+$dbh->do("lock tables header WRITE");
my $sth=$dbh->prepare("update auth_header set marcxml=? where authid=?");
$sth->execute($xml,$linkid);
$sth->finish;
@@ -395,17 +393,17 @@
##
my $sth=$dbh->prepare("update auth_header set marcxml=? where authid=?");
# find if linked records exist and delete the link in them
-my @linkids=XML_readline_asarray($oldrecord,"auth_linkid","authorities");
+my @linkids=XML_readline_asarray($oldrecord,"linkid","authorities");
foreach my $linkid (@linkids){
##Modify the record of linked
my $linkrecord=XMLgetauthorityhash($dbh,$linkid);
my $linktypecode=AUTHfind_authtypecode($dbh,$linkid);
- my @linkfields=XML_readline_asarray($linkrecord,"auth_linkid","authorities");
+ my @linkfields=XML_readline_asarray($linkrecord,"linkid","authorities");
my $updated;
foreach my $linkfield (@linkfields){
if ($linkfield eq $authid){
- XML_writeline_id($linkrecord,"auth_linkid",$linkfield,"","authorities");
+ XML_writeline_id($linkrecord,"linkid",$linkfield,"","authorities");
$updated=1;
}
}#foreach linkfield
@@ -695,7 +693,7 @@
$oConnection[0]=C4::Context->Zconn("biblioserver");
##$oConnection[0]->option(elementSetName=>"biblios"); ## Needs a fix
my $query;
-my ($attr2)=MARCfind_attr_from_kohafield("auth_authid");
+my ($attr2)=MARCfind_attr_from_kohafield("authid");
my $attrfield.=$attr2;
$query= $attrfield." ".$mergefrom;
my ($event,$i);
@@ -849,7 +847,7 @@
=cut
-# $Id: AuthoritiesMarc.pm,v 1.31 2006/09/11 17:09:59 tgarip1957 Exp $
+# $Id: AuthoritiesMarc.pm,v 1.32 2006/09/20 21:48:44 tgarip1957 Exp $
# Revision 1.30 2006/09/06 16:21:03 tgarip1957
# Clean up before final commits
@@ -903,4 +901,4 @@
# Revision 1.1 2004/06/07 07:35:01 tipaul
# MARC authority management package
#
->>>>>>> 1.30
+
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.182
retrieving revision 1.183
diff -u -b -r1.182 -r1.183
--- Biblio.pm 11 Sep 2006 17:09:59 -0000 1.182
+++ Biblio.pm 20 Sep 2006 21:48:44 -0000 1.183
@@ -75,7 +75,7 @@
&XMLmoditemonefield
&XMLkoha2marc
&XML_separate
-
+&XML_record_header
&ZEBRAdelbiblio
&ZEBRAgetrecord
&ZEBRAop
@@ -235,7 +235,7 @@
my $biblio=$xml->{'datafield'};
my $controlfield=$xml->{'controlfield'};
($tag,$subf)=MARCfind_marc_from_kohafield($kohafield,$recordtype) if $kohafield;
-my $updated=0;
+my $updated;
if ($tag>9){
foreach my $data (@$biblio){
if ($data->{'tag'} eq $tag){
@@ -281,7 +281,7 @@
} ;
}
}## created now
- }else{
+ }elsif ($tag>0){
foreach my $control (@$controlfield){
if ($control->{'tag'} eq $tag){
$control->{'content'}=$newvalue;
@@ -348,6 +348,7 @@
sub XML_xml2hash_onerecord{
##make a perl hash from xml file
my ($xml)=@_;
+return undef unless $xml;
my $hashed = XMLin( $xml ,KeyAttr =>['leader','controlfield','datafield'],ForceArray => ['leader','controlfield','datafield','subfield'],KeepRoot=>0);
return $hashed;
}
@@ -567,14 +568,14 @@
$year=substr($year,2,2);
my $accdate=sprintf("%2d%02d%02d",$year,$mon,$mday);
my ($titletag,$titlesubf)=MARCfind_marc_from_kohafield("title","biblios");
-my $xml="<record><leader> naa a22 7ar4500</leader><controlfield tag='005'>$timestamp</controlfield><controlfield tag='008'>$accdate</controlfield><datafield ind1='' ind2='' tag='$titletag'></datafield></record>";
+##create a dummy record
+my $xml="<record><leader> naa a22 7ar4500</leader><controlfield tag='xxx'></controlfield><datafield ind1='' ind2='' tag='$titletag'></datafield></record>";
## Now build XML
my $record = XML_xml2hash($xml);
my $sth2=$dbh->prepare("SELECT marctokoha from koha_attr where tagfield is not null and recordtype=?");
$sth2->execute($recordtype);
my $field;
while (($field)=$sth2->fetchrow) {
-warn $field;
$record=XML_writeline($record,$field,$result->{$field},$recordtype) if $result->{$field};
}
return $record;
@@ -836,7 +837,7 @@
$xml=Encode::decode('utf8',$xml);
return $xml;
}
-sub marc_record_header {
+sub XML_record_header {
#### this one is for <record>
my $format = shift;
my $enc = shift || 'UTF-8';
Index: Bookfund.pm
===================================================================
RCS file: /sources/koha/koha/C4/Bookfund.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Bookfund.pm 6 Sep 2006 16:21:03 -0000 1.6
+++ Bookfund.pm 20 Sep 2006 21:48:44 -0000 1.7
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Bookfund.pm,v 1.6 2006/09/06 16:21:03 tgarip1957 Exp $
+# $Id: Bookfund.pm,v 1.7 2006/09/20 21:48:44 tgarip1957 Exp $
use strict;
@@ -25,7 +25,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.6 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.7 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -78,7 +78,7 @@
=cut
sub GetBookFund {
- my $bookfundid = @_;
+ my $bookfundid = shift;
my $dbh = C4::Context->dbh;
my $query = "
SELECT
@@ -90,6 +90,7 @@
WHERE bookfundid = ?
";
my $sth=$dbh->prepare($query);
+$sth->execute($bookfundid);
return $sth->fetchrow_hashref;
}
@@ -147,12 +148,12 @@
my $branch = $userenv->{branch};
my $strsth;
- if ( $branch ne '' ) {
+ if ( $branch ) {
$strsth = "
SELECT *
FROM aqbookfund,aqbudget
WHERE aqbookfund.bookfundid=aqbudget.bookfundid
- AND startdate<now()
+ AND startdate<=now()
AND enddate>now()
AND (aqbookfund.branchcode IS NULL OR aqbookfund.branchcode='' OR aqbookfund.branchcode= ? )
GROUP BY aqbookfund.bookfundid ORDER BY bookfundname";
@@ -169,7 +170,7 @@
";
}
my $sth = $dbh->prepare($strsth);
- if ( $branch ne '' ) {
+ if ( $branch ) {
$sth->execute($branch);
}
else {
Index: Members.pm
===================================================================
RCS file: /sources/koha/koha/C4/Members.pm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Members.pm 11 Sep 2006 17:09:59 -0000 1.36
+++ Members.pm 20 Sep 2006 21:48:44 -0000 1.37
@@ -19,7 +19,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Members.pm,v 1.36 2006/09/11 17:09:59 tgarip1957 Exp $
+# $Id: Members.pm,v 1.37 2006/09/20 21:48:44 tgarip1957 Exp $
use strict;
require Exporter;
@@ -36,7 +36,7 @@
use Date::Manip;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = do { my @v = '$Revision: 1.36 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.37 $' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
Index: Suggestions.pm
===================================================================
RCS file: /sources/koha/koha/C4/Suggestions.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- Suggestions.pm 6 Sep 2006 16:21:03 -0000 1.15
+++ Suggestions.pm 20 Sep 2006 21:48:44 -0000 1.16
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Suggestions.pm,v 1.15 2006/09/06 16:21:03 tgarip1957 Exp $
+# $Id: Suggestions.pm,v 1.16 2006/09/20 21:48:44 tgarip1957 Exp $
use strict;
require Exporter;
@@ -27,7 +27,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.15 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.16 $' =~ /\d+/g;
shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
=head1 NAME
@@ -298,6 +298,7 @@
sub NewSuggestion {
my ($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,$biblionumber) = @_;
my $dbh = C4::Context->dbh;
+
my $query = qq |
INSERT INTO suggestions
(status,suggestedby,title,author,publishercode,note,copyrightdate,
@@ -323,7 +324,7 @@
=cut
sub ModStatus {
- my ($suggestionid,$status,$managedby,$biblionumber) = @_;
+ my ($suggestionid,$status,$managedby,$biblionumber,$input) = @_;
my $dbh = C4::Context->dbh;
my $sth;
if ($managedby>0) {
@@ -382,7 +383,7 @@
$sth->execute($suggestionid);
my $emailinfo = $sth->fetchrow_hashref;
if ($emailinfo->{byemail}){
- my $template = gettemplate("suggestion/mail_suggestion_$status.tmpl","intranet");
+ my $template = gettemplate("suggestion/mail_suggestion_$status.tmpl","intranet",$input);
$template->param(
byemail => $emailinfo->{byemail},
Index: Circulation/Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- Circulation/Circ2.pm 6 Sep 2006 16:21:03 -0000 1.117
+++ Circulation/Circ2.pm 20 Sep 2006 21:48:44 -0000 1.118
@@ -3,7 +3,7 @@
package C4::Circulation::Circ2;
-# $Id: Circ2.pm,v 1.117 2006/09/06 16:21:03 tgarip1957 Exp $
+# $Id: Circ2.pm,v 1.118 2006/09/20 21:48:44 tgarip1957 Exp $
#package to deal with Returns
#written 3/11/99 by olwen at katipo.co.nz
@@ -348,6 +348,7 @@
my ($env, $itemnumber, $barcode) = @_;
my $dbh=C4::Context->dbh;
my ($itemrecord)=XMLgetitem($dbh,$itemnumber,$barcode);
+ return undef unless $itemrecord; ## This is to prevent a system crash if barcode does not exist
my $itemhash=XML_xml2hash_onerecord($itemrecord);
my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemhash,"holdings");
##Now get full biblio details from MARC
@@ -894,9 +895,9 @@
### fix me STOP using koha hashes, change so that XML hash is used
my ($env,$borrower,$barcode,$date,$cancelreserve) = @_;
my $dbh = C4::Context->dbh;
- my ($itemrecord)=XMLgetitem($dbh,"",$barcode);
- $itemrecord=XML_xml2hash_onerecord($itemrecord);
+ my $itemrecord=XMLgetitemhash($dbh,"",$barcode);
my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemrecord,"holdings");
+ $iteminformation->{'itemtype'}=MARCfind_itemtype($dbh,$iteminformation->{biblionumber});
my $error;
#
# check if we just renew the issue.
@@ -973,6 +974,7 @@
my $sth=$dbh->prepare("insert into issues (borrowernumber, itemnumber, date_due, branchcode,issue_date) values (?,?,?,?,NOW())");
my $loanlength = getLoanLength($borrower->{'categorycode'},$iteminformation->{'itemtype'},$borrower->{'branchcode'});
+
my $dateduef;
my @datearr = localtime();
$dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-". $datearr[3];
@@ -1139,9 +1141,9 @@
my $doreturn = 1;
die '$branch not defined' unless defined $branch; # just in case (bug 170)
# get information on item
- my ($itemrecord)=XMLgetitem($dbh,"",$barcode);
- $itemrecord=XML_xml2hash_onerecord($itemrecord);
+ my $itemrecord=XMLgetitemhash($dbh,"",$barcode);
my $iteminformation=XMLmarc2koha_onerecord($dbh,$itemrecord,"holdings");
+ $iteminformation->{'itemtype'}=MARCfind_itemtype($dbh,$iteminformation->{biblionumber});
if (not $iteminformation) {
$messages->{'BadBarcode'} = $barcode;
$doreturn = 0;
Index: Circulation/Fines.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Fines.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- Circulation/Fines.pm 11 Sep 2006 17:10:00 -0000 1.17
+++ Circulation/Fines.pm 20 Sep 2006 21:48:44 -0000 1.18
@@ -1,6 +1,6 @@
package C4::Circulation::Fines;
-# $Id: Fines.pm,v 1.17 2006/09/11 17:10:00 tgarip1957 Exp $
+# $Id: Fines.pm,v 1.18 2006/09/20 21:48:44 tgarip1957 Exp $
# Copyright 2000-2002 Katipo Communications
#
More information about the Koha-cvs
mailing list