diff --git a/C4/Accounts2.pm b/C4/Accounts2.pm
index 06d485bc16..bb2a1ccae8 100755
--- a/C4/Accounts2.pm
+++ b/C4/Accounts2.pm
@@ -301,11 +301,6 @@ sub manualinvoice{
$amountleft=refund('',$bornum,$amount);
}
if ($itemnum ne ''){
-#FIXME to use ? before uncommenting
-# my $sth=$dbh->prepare("Select * from items where barcode='$itemnum'");
-# $sth->execute;
-# my $data=$sth->fetchrow_hashref;
-# $sth->finish;
$desc.=" ".$itemnum;
my $sth=$dbh->prepare("INSERT INTO accountlines
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber)
@@ -313,7 +308,6 @@ sub manualinvoice{
# $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, $data->{'itemnumber'});
$sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, $itemnum);
} else {
- $desc=$dbh->quote($desc);
my $sth=$dbh->prepare("INSERT INTO accountlines
(borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding)
VALUES (?, ?, now(), ?, ?, ?, ?)");
diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index ddebef8b74..7a4098d6b7 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -104,7 +104,7 @@ number of elements in C<@orders>.
sub getbasketcontent {
my ($basketno,$supplier,$orderby)=@_;
my $dbh = C4::Context->dbh;
- my $query="Select *,biblio.title,aqorders.ordernumber from aqorders,biblio,biblioitems
+ my $query="Select biblio.*,biblioitems.*,aqorders.*,aqorderbreakdown.*,biblio.title from aqorders,biblio,biblioitems
left join aqorderbreakdown on aqorderbreakdown.ordernumber=aqorders.ordernumber
where basketno='$basketno'
and biblio.biblionumber=aqorders.biblionumber and biblioitems.biblioitemnumber
@@ -562,7 +562,7 @@ sub ordersearch {
my @searchterms = ($id);
map { push(@searchterms,"$_%","% $_%") } @data;
push(@searchterms,$search,$search,$biblio);
- my $sth=$dbh->prepare("Select *,biblio.title from aqorders,biblioitems,biblio,aqbasket
+ my $sth=$dbh->prepare("Select biblio.*,biblioitems.*,aqorders.*,aqbasket.*,biblio.title from aqorders,biblioitems,biblio,aqbasket
where aqorders.biblioitemnumber = biblioitems.biblioitemnumber and
aqorders.basketno = aqbasket.basketno
and aqbasket.booksellerid = ?
@@ -597,15 +597,17 @@ sub ordersearch {
sub histsearch {
- my ($title,$author,$name)=@_;
+ my ($title,$author,$name,$from_placed_on,$to_placed_on)=@_;
my $dbh= C4::Context->dbh;
- my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost
- from aqorders,aqbasket,aqbooksellers,biblio
- where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and
- biblio.biblionumber=aqorders.biblionumber";
+ my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity, aqorders.ecost from aqorders,aqbasket,aqbooksellers,biblio
+where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and
+biblio.biblionumber=aqorders.biblionumber";
$query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title;
$query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author;
$query .= " and name like ".$dbh->quote("%".$name."%") if $name;
+ $query .= " and creationdate >" .$dbh->quote($from_placed_on) if $from_placed_on;
+ $query .= " and creationdate<".$dbh->quote($to_placed_on) if $to_placed_on;
+ warn "C4:Acquisition : ".$query;
my $sth = $dbh->prepare($query);
$sth->execute;
my @order_loop;
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 0f85d3cd9e..fd41470011 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -399,7 +399,7 @@ sub checkauth {
$template->param(loginprompt => 1) unless $info{'nopermission'};
my $self_url = $query->url(-absolute => 1);
- $template->param(url => $self_url);
+ $template->param(url => $self_url, LibraryName=> => C4::Context->preference("LibraryName"),);
$template->param(\%info);
$cookie=$query->cookie(-name => 'sessionID',
-value => $sessionID,
diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm
index eee1ac58be..27aaf53ade 100644
--- a/C4/Auth_with_ldap.pm
+++ b/C4/Auth_with_ldap.pm
@@ -137,7 +137,6 @@ sub get_template_and_user {
$bordat[0] = $borr;
$template->param(USER_INFO => \@bordat,
);
-
# We are going to use the $flags returned by checkauth
# to create the template's parameters that will indicate
# which menus the user can access.
@@ -163,29 +162,36 @@ sub get_template_and_user {
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); }
diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index be598d1e3b..875ee35809 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -666,7 +666,9 @@ sub AUTHhtml2marc {
$indicators{@$rtags[$i]}.=' ';
if (@$rtags[$i] <10) {
$prevvalue= @$rvalues[$i];
+ undef $field;
} else {
+ undef $prevvalue;
$field = MARC::Field->new( (sprintf "%03s",@$rtags[$i]), substr($indicators{@$rtags[$i]},0,1),substr($indicators{@$rtags[$i]},1,1), @$rsubfields[$i] => @$rvalues[$i]);
}
$prevtag = @$rtags[$i];
@@ -674,7 +676,7 @@ sub AUTHhtml2marc {
if (@$rtags[$i] <10) {
$prevvalue=@$rvalues[$i];
} else {
- if (@$rvalues[$i]) {
+ if (length(@$rvalues[$i])>0) {
$field->add_subfields(@$rsubfields[$i] => @$rvalues[$i]);
}
}
@@ -682,8 +684,7 @@ sub AUTHhtml2marc {
}
}
# the last has not been included inside the loop... do it now !
- $record->add_fields($field);
-# warn $record->as_formatted;
+ $record->add_fields($field) if $field;
return $record;
}
@@ -921,6 +922,9 @@ Paul POULAIN paul.poulain@free.fr
# $Id$
# $Log$
+# Revision 1.19 2005/06/20 14:10:00 tipaul
+# synch'ing 2.2 and head
+#
# Revision 1.18 2005/06/07 10:00:47 tipaul
# adding $b to mainentry (in UNIMARC, for personal names, $a is the surname, $b is the firstname)
#
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index 602027483a..8f75db95d9 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -58,6 +58,7 @@ $VERSION = 0.01;
&NEWnewbiblio &NEWnewitem
&NEWmodbiblio &NEWmoditem
&NEWdelbiblio &NEWdelitem
+ &NEWmodbiblioframework
&MARCaddbiblio &MARCadditem
&MARCmodsubfield &MARCaddsubfield
@@ -929,14 +930,14 @@ sub MARCkoha2marcBiblio {
&MARCkoha2marcOnefield( $sth, $record, "additionalauthors.author",
$row->{'author'},'' );
}
- my $sth2 =
+ $sth2 =
$dbh->prepare(" SELECT subject FROM bibliosubject WHERE biblionumber=?");
$sth2->execute($biblionumber);
while ( my $row = $sth2->fetchrow_hashref ) {
&MARCkoha2marcOnefield( $sth, $record, "bibliosubject.subject",
$row->{'subject'},'' );
}
- my $sth2 =
+ $sth2 =
$dbh->prepare(
" SELECT subtitle FROM bibliosubtitle WHERE biblionumber=?");
$sth2->execute($biblionumber);
@@ -1043,7 +1044,9 @@ sub MARChtml2marc {
$indicators{@$rtags[$i]}.=' ';
if (@$rtags[$i] <10) {
$prevvalue= @$rvalues[$i];
+ undef $field;
} else {
+ undef $prevvalue;
$field = MARC::Field->new( (sprintf "%03s",@$rtags[$i]), substr($indicators{@$rtags[$i]},0,1),substr($indicators{@$rtags[$i]},1,1), @$rsubfields[$i] => @$rvalues[$i]);
# warn "1=>".@$rtags[$i].@$rsubfields[$i]." = ".@$rvalues[$i].": ".$field->as_formatted;
}
@@ -1061,7 +1064,7 @@ sub MARChtml2marc {
}
}
# the last has not been included inside the loop... do it now !
- $record->add_fields($field);
+ $record->add_fields($field) if $field;
# warn "HTML2MARC=".$record->as_formatted;
return $record;
}
@@ -1100,7 +1103,7 @@ sub MARCmarc2koha {
$result->{'copyrightdate'} = $1;
}
# modify publicationyear to keep only the 1st year found
- my $temp = $result->{'publicationyear'};
+ $temp = $result->{'publicationyear'};
$temp =~ m/c(\d\d\d\d)/; # search cYYYY first
if ($1>0) {
$result->{'publicationyear'} = $1;
@@ -1274,6 +1277,12 @@ sub NEWnewbiblio {
return ( $bibid, $oldbibnum, $oldbibitemnum );
}
+sub NEWmodbiblioframework {
+ my ($dbh,$bibid,$frameworkcode) =@_;
+ my $sth = $dbh->prepare("Update marc_biblio SET frameworkcode=? WHERE bibid=$bibid");
+ $sth->execute($frameworkcode);
+ return 1;
+}
sub NEWmodbiblio {
my ($dbh,$record,$bibid,$frameworkcode) =@_;
$frameworkcode="" unless $frameworkcode;
@@ -1347,7 +1356,7 @@ sub NEWnewitem {
my ( $itemnumber, $error ) = &OLDnewitems( $dbh, $item, $item->{barcode} );
# add itemnumber to MARC::Record before adding the item.
- my $sth =
+ $sth =
$dbh->prepare(
"select tagfield,tagsubfield from marc_subfield_structure where frameworkcode=? and kohafield=?"
);
@@ -1457,13 +1466,14 @@ sub OLDnewbiblio {
$sth->finish;
$sth =
$dbh->prepare(
-"insert into biblio set biblionumber = ?, title = ?, author = ?, copyrightdate = ?, serial = ?, seriestitle = ?, notes = ?, abstract = ?"
+"insert into biblio set biblionumber = ?, title = ?, author = ?, copyrightdate = ?, serial = ?, seriestitle = ?, notes = ?, abstract = ?, unititle = ?"
);
$sth->execute(
$bibnum, $biblio->{'title'},
$biblio->{'author'}, $biblio->{'copyrightdate'},
$biblio->{'serial'}, $biblio->{'seriestitle'},
- $biblio->{'notes'}, $biblio->{'abstract'}
+ $biblio->{'notes'}, $biblio->{'abstract'},
+ $biblio->{'unititle'},
);
$sth->finish;
@@ -2671,6 +2681,9 @@ Paul POULAIN paul.poulain@free.fr
# $Id$
# $Log$
+# Revision 1.121 2005/06/20 14:10:00 tipaul
+# synch'ing 2.2 and head
+#
# Revision 1.120 2005/06/15 16:09:43 hdl
# Displaying dashed isbn.
#
diff --git a/C4/Bull.pm b/C4/Bull.pm
index 2bbc0a9b91..2eedc274ea 100755
--- a/C4/Bull.pm
+++ b/C4/Bull.pm
@@ -46,6 +46,7 @@ Give all XYZ functions
@ISA = qw(Exporter);
@EXPORT = qw(&newsubscription &modsubscription &delsubscription &getsubscriptions &getsubscription
&getsubscriptionfrombiblionumber &get_subscription_list_from_biblionumber
+ &get_full_subscription_list_from_biblionumber
&modsubscriptionhistory &newissue
&getserials &serialchangestatus
&Find_Next_Date, &Get_Next_Seq
@@ -100,6 +101,7 @@ sub GetLateIssues {
}
return @issuelist;
}
+
sub newsubscription {
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
@@ -139,6 +141,7 @@ sub newsubscription {
$sth->execute($serialseq, $subscriptionid, $val->{'biblionumber'}, 1, format_date_in_iso($startdate));
return $subscriptionid;
}
+
sub getsubscription {
my ($subscriptionid) = @_;
my $dbh = C4::Context->dbh;
@@ -166,7 +169,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
@@ -177,14 +180,85 @@ sub get_subscription_list_from_biblionumber {
my @res;
while (my $subs = $sth->fetchrow_hashref) {
$subs->{startdate} = format_date($subs->{startdate});
+ $subs->{histstartdate} = format_date($subs->{histstartdate});
$subs->{opacnote} =~ s/\n/\
/g;
$subs->{missinglist} =~ s/\n/\
/g;
$subs->{recievedlist} =~ s/\n/\
/g;
+ $subs->{"periodicity".$subs->{periodicity}} = 1;
+ if ($subs->{enddate} eq '0000-00-00') {
+ $subs->{enddate}='';
+ } else {
+ $subs->{enddate} = format_date($subs->{enddate});
+ }
push @res,$subs;
}
return \@res;
}
+sub get_full_subscription_list_from_biblionumber {
+ my ($biblionumber) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare('select serial.serialseq, serial.planneddate, serial.status, year(serial.planneddate) as year,subscription.*, aqbudget.bookfundid,aqbooksellers.name as aqbooksellername,biblio.title as bibliotitle
+ 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.planneddate');
+ $sth->execute($biblionumber);
+ my @res;
+ my $year;
+ my $startdate;
+ my $aqbooksellername;
+ my $bibliotitle;
+ my @loopissues;
+ my $first;
+ 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'};
+# }
+ 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'},
+ 'status1' => $subs->{'status'}==1,
+ 'status2' => $subs->{'status'}==2,
+ 'status3' => $subs->{'status'}==3,
+ 'status4' => $subs->{'status'}==4,
+ };
+ }else {
+ $first=1 if (not $year);
+ $year= $subs->{'year'};
+ $startdate= format_date($subs->{'startdate'});
+ $aqbooksellername= $subs->{'aqbooksellername'};
+ $bibliotitle= $subs->{'bibliotitle'};
+ my @temp;
+ push @temp,
+ {'planneddate' => format_date($subs->{'planneddate'}),
+ 'serialseq' => $subs->{'serialseq'},
+ 'status1' => $subs->{'status'}==1,
+ 'status2' => $subs->{'status'}==2,
+ 'status3' => $subs->{'status'}==3,
+ 'status4' => $subs->{'status'}==4,
+ };
+
+ push @res,{
+ 'year'=>$year,
+ 'startdate'=>$startdate,
+ 'aqbooksellername'=>$aqbooksellername,
+ 'bibliotitle'=>$bibliotitle,
+ 'serials'=>\@temp,
+ 'first'=>$first
+ };
+ }
+ }
+ return \@res;
+}
+
sub modsubscription {
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
@@ -300,25 +374,10 @@ sub getlatestserials{
$line->{"planneddate"} = format_date($line->{"planneddate"});
push @serials,$line;
}
- return \@serials;
-}
-
-sub serialdelete {
- my ($serialid,$serialseq)=@_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("select subscriptionid,status from serial where serialid=?");
- $sth->execute($serialid);
- my ($subscriptionid,$oldstatus) = $sth->fetchrow;
- # change status & update subscriptionhistory
- my $sth = $dbh->prepare("delete * from serial where serialid = ?");
- $sth->execute($serialid);
- $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?");
+ $sth=$dbh->prepare("select count(*) from serial where subscriptionid=?");
$sth->execute($subscriptionid);
- my ($missinglist,$recievedlist) = $sth->fetchrow;
- $recievedlist =~ s/",$serialseq"//;
- $missinglist =~ s/",$serialseq"//;
- $sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?");
- $sth->execute($recievedlist,$missinglist,$subscriptionid);
+ my ($totalissues) = $sth->fetchrow;
+ return ($totalissues,@serials);
}
sub serialchangestatus {
@@ -369,13 +428,17 @@ sub newissue {
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 delissue {
- my ($serialseq,$subscriptionid) = @_;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("delete from serial where serialseq= ? and subscriptionid= ? ");
- $sth->execute($serialseq,$subscriptionid);
+ $sth = $dbh->prepare("select missinglist,recievedlist from subscriptionhistory where subscriptionid=?");
+ $sth->execute($subscriptionid);
+ my ($missinglist,$recievedlist) = $sth->fetchrow;
+ if ($status eq 2) {
+ $recievedlist .= ",$serialseq";
+ }
+ if ($status eq 4) {
+ $missinglist .= ",$serialseq";
+ }
+ $sth=$dbh->prepare("update subscriptionhistory set recievedlist=?, missinglist=? where subscriptionid=?");
+ $sth->execute($recievedlist,$missinglist,$subscriptionid);
}
sub Get_Next_Date(@) {
diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm
index a0d535da21..d5ea79be8d 100755
--- a/C4/Circulation/Circ2.pm
+++ b/C4/Circulation/Circ2.pm
@@ -608,7 +608,7 @@ sub TooMany ($$){
# check the 3 parameters
$sth->execute($cat_borrower, $type, $branch_borrower);
my $result = $sth->fetchrow_hashref;
-# warn "==>".$result->{maxissueqty};
+# warn "==>".$result->{maxissueqty};
if (defined($result)) {
$sth2->execute($borrower->{'borrowernumber'}, "%$type%");
my $alreadyissued = $sth2->fetchrow;
@@ -627,7 +627,8 @@ sub TooMany ($$){
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
- my $alreadyissued = $sth2->fetchrow;
+ my ($alreadyissued) = $sth3->fetchrow;
+ warn "HERE : $alreadyissued / ($result->{maxissueqty} for $borrower->{'borrowernumber'}";
return ("c $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
}
#check for borrowertype=*
@@ -643,7 +644,7 @@ sub TooMany ($$){
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
- my $alreadyissued = $sth2->fetchrow;
+ my $alreadyissued = $sth3->fetchrow;
return ("e $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
}
@@ -667,7 +668,7 @@ sub TooMany ($$){
my $result = $sth->fetchrow_hashref;
if (defined($result)) {
$sth3->execute($borrower->{'borrowernumber'});
- my $alreadyissued = $sth2->fetchrow;
+ my $alreadyissued = $sth3->fetchrow;
return ("h $alreadyissued / ".($result->{maxissueqty}+0)) if ($result->{'maxissueqty'} <= $alreadyissued);
}
return;
@@ -698,6 +699,9 @@ sub canbookbeissued {
if ($borrower->{flags}->{'DBARRED'}) {
$issuingimpossible{DEBARRED} = 1;
}
+ if (&Date_Cmp(&ParseDate($borrower->{expiry}),&ParseDate("today"))<0) {
+ $issuingimpossible{EXPIRED} = 1;
+ }
#
# BORROWER STATUS
#
@@ -766,7 +770,7 @@ sub canbookbeissued {
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
$needsconfirmation{RESERVE_WAITING} = "$resborrower->{'firstname'} $resborrower->{'surname'} ($resborrower->{'cardnumber'}, $branchname)";
- CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
+ # CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'}); Doesn't belong in a checking subroutine.
} elsif ($restype eq "Reserved") {
# The item is on reserve for someone else.
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
@@ -841,7 +845,9 @@ sub issuebook {
my ($resborrower, $flags)=getpatroninformation($env, $resbor,0);
my $branches = getbranches();
my $branchname = $branches->{$res->{'branchcode'}}->{'branchname'};
- CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
+ if ($cancelreserve){
+ CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
+ }
} elsif ($restype eq "Reserved") {
warn "Reserved";
# The item is on reserve for someone else.
@@ -852,11 +858,11 @@ sub issuebook {
# cancel reserves on this item
CancelReserve(0, $res->{'itemnumber'}, $res->{'borrowernumber'});
# also cancel reserve on biblio related to this item
- my $st_Fbiblio = $dbh->prepare("select biblionumber from items where itemnumber=?");
- $st_Fbiblio->execute($res->{'itemnumber'});
- my $biblionumber = $st_Fbiblio->fetchrow;
- CancelReserve($biblionumber,0,$res->{'borrowernumber'});
- warn "CancelReserve $res->{'itemnumber'}, $res->{'borrowernumber'}";
+ #my $st_Fbiblio = $dbh->prepare("select biblionumber from items where itemnumber=?");
+ #$st_Fbiblio->execute($res->{'itemnumber'});
+ #my $biblionumber = $st_Fbiblio->fetchrow;
+ #CancelReserve($biblionumber,0,$res->{'borrowernumber'});
+ #warn "CancelReserve $res->{'itemnumber'}, $res->{'borrowernumber'}";
} else {
# my $tobrcd = ReserveWaiting($res->{'itemnumber'}, $res->{'borrowernumber'});
# transferbook($tobrcd,$barcode, 1);
@@ -1618,6 +1624,15 @@ sub renewstatus {
$renewokay = 1;
}
$sth2->finish;
+ my ($resfound, $resrec) = CheckReserves($itemno);
+ if ($resfound) {
+ $renewokay = 0;
+ }
+ my ($resfound, $resrec) = CheckReserves($itemno);
+ if ($resfound) {
+ $renewokay = 0;
+ }
+
}
$sth1->finish;
return($renewokay);
diff --git a/C4/Circulation/Fines.pm b/C4/Circulation/Fines.pm
index 4ac2279207..8ff1a96ceb 100644
--- a/C4/Circulation/Fines.pm
+++ b/C4/Circulation/Fines.pm
@@ -151,8 +151,7 @@ sub CalcFine {
and items.biblioitemnumber=biblioitems.biblioitemnumber and
biblioitems.itemtype=itemtypes.itemtype and
categoryitem.itemtype=itemtypes.itemtype and
- categoryitem.categorycode=? and
- (items.itemlost <> 1 or items.itemlost is NULL)");
+ categoryitem.categorycode=? and (items.itemlost <> 1 or items.itemlost is NULL)");
# print $query;
$sth->execute($itemnumber,$bortype);
my $data=$sth->fetchrow_hashref;
diff --git a/C4/Members.pm b/C4/Members.pm
index 560f1d4557..a510e4b1c5 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -99,13 +99,12 @@ sub modmember {
my (%data) = @_;
my $dbh = C4::Context->dbh;
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
- $data{'joining'}=format_date_in_iso($data{'joining'});
$data{'expiry'}=format_date_in_iso($data{'expiry'});
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'}',
+ emailaddress='$data{'emailaddress'}',streetcity='$data{'streetcity'}',
altrelationship='$data{'altrelationship'}',othernames='$data{'othernames'}',phoneday='$data{'phoneday'}',
categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}',
@@ -130,7 +129,16 @@ sub newmember {
my (%data) = @_;
my $dbh = C4::Context->dbh;
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
+ $data{'joining'} = &ParseDate("today") unless $data{'joining'};
$data{'joining'}=format_date_in_iso($data{'joining'});
+ # if expirydate is not set, calculate it from borrower category subscription duration
+ unless ($data{'expiry'}) {
+ my $sth = $dbh->prepare("select enrolmentperiod from categories where categorycode=?");
+ $sth->execute($data{'categorycode'});
+ my ($enrolmentperiod) = $sth->fetchrow;
+ $enrolmentperiod = 12 unless ($enrolmentperiod);
+ $data{'expiry'} = &DateCalc($data{'joining'},"$enrolmentperiod years");
+ }
$data{'expiry'}=format_date_in_iso($data{'expiry'});
# $data{'borrowernumber'}=NewBorrowerNumber();
my $query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
diff --git a/C4/Output.pm b/C4/Output.pm
index 60d34ffbce..343326f832 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,
+ opacsmallimage => C4::Context->preference('opacsmallimage'),
lang => $lang);
diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm
index 20aa79b1f4..73500fc5fb 100644
--- a/C4/SearchMarc.pm
+++ b/C4/SearchMarc.pm
@@ -339,7 +339,7 @@ sub catalogsearch {
my $counter = $offset;
# 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
+ $sth = $dbh->prepare("SELECT biblio.biblionumber as bn,biblioitems.*,biblio.*, marc_biblio.bibid,itemtypes.notforloan,itemtypes.description
FROM biblio, marc_biblio
LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
LEFT JOIN itemtypes on itemtypes.itemtype=biblioitems.itemtype
@@ -350,7 +350,12 @@ sub catalogsearch {
my $totalitems=0;
my $oldline;
my ($oldbibid, $oldauthor, $oldtitle);
- my $sth_itemCN = $dbh->prepare("select items.* from items where biblionumber=?");
+ my $sth_itemCN;
+ if (C4::Context->preference('hidelostitem')) {
+ $sth_itemCN = $dbh->prepare("select items.* from items where biblionumber=? and (itemlost = 0 or itemlost is NULL)");
+ } else {
+ $sth_itemCN = $dbh->prepare("select items.* from items where biblionumber=?");
+ }
my $sth_issue = $dbh->prepare("select date_due,returndate from issues where itemnumber=?");
# parse all biblios between start & end.
while (($counter <= $#result) && ($counter <= ($offset + $length))) {
diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl
index 1941115832..56e85a377c 100644
--- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl
+++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/addbiblio.tmpl
@@ -1,7 +1,7 @@