sync with rel_2_2
This commit is contained in:
parent
5bf0a8e95d
commit
d72214aa96
143
C4/Bull.pm
143
C4/Bull.pm
|
|
@ -110,33 +110,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,
|
||||
$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,
|
||||
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,
|
||||
$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 +150,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 +165,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 +174,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 +202,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 +226,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 +246,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},
|
||||
|
|
@ -301,24 +305,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%");
|
||||
}
|
||||
|
|
@ -345,7 +349,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;
|
||||
|
|
@ -358,27 +365,36 @@ sub getserials {
|
|||
my ($subscriptionid) = @_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
# OK, now add the last 5 issues arrives/missing
|
||||
my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate,notes from serial where subscriptionid = ? and (status in (2,4,5)) order by serialid DESC");
|
||||
my $sth=$dbh->prepare("
|
||||
SELECT serialid,serialseq, status, publisheddate,planneddate,notes
|
||||
FROM serial
|
||||
WHERE subscriptionid = ? AND (status IN (2,4,5))
|
||||
ORDER BY serialid DESC");
|
||||
$sth->execute($subscriptionid);
|
||||
my $counter=0;
|
||||
my @serials;
|
||||
while((my $line = $sth->fetchrow_hashref) && $counter <5) {
|
||||
$counter++;
|
||||
$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;
|
||||
}
|
||||
|
||||
# status = 2 is "arrived"
|
||||
my $sth=$dbh->prepare("select serialid,serialseq, status, planneddate,notes from serial where subscriptionid = ? and status <>2 and status <>4 and status <>5");
|
||||
my $sth=$dbh->prepare("
|
||||
SELECT serialid,serialseq, status, publisheddate, planneddate,notes
|
||||
FROM serial
|
||||
WHERE subscriptionid = ? AND status NOT IN (2,4,5)");
|
||||
$sth->execute($subscriptionid);
|
||||
my @serials;
|
||||
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);
|
||||
|
|
@ -389,7 +405,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;
|
||||
|
|
@ -398,27 +414,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) {
|
||||
|
|
@ -431,14 +447,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 = ?");
|
||||
|
|
@ -447,11 +463,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) {
|
||||
|
|
@ -672,7 +691,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) {
|
||||
|
|
@ -682,7 +701,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;
|
||||
|
|
@ -717,12 +736,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)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ use HTML::Template;
|
|||
use C4::Auth; # get_template_and_user
|
||||
use C4::Interface::CGI::Output;
|
||||
use C4::Suggestions;
|
||||
use C4::Biblio;
|
||||
use C4::SearchMarc;
|
||||
|
||||
my $input = new CGI;
|
||||
|
||||
|
|
@ -22,6 +24,9 @@ my $volumedesc = $input->param('volumedesc');
|
|||
my $publicationyear = $input->param('publicationyear');
|
||||
my $place = $input->param('place');
|
||||
my $isbn = $input->param('isbn');
|
||||
my $duplicateNumber = $input->param('duplicateNumber');
|
||||
my $suggestionid = $input->param('suggestionid');
|
||||
|
||||
my $status = 'ACCEPTED';
|
||||
my $suggestedbyme = -1; # search ALL suggestors
|
||||
my $op = $input->param('op');
|
||||
|
|
@ -36,7 +41,58 @@ my ($template, $borrowernumber, $cookie)
|
|||
flagsrequired => {acquisition => 1},
|
||||
});
|
||||
|
||||
if ($op eq 'connectDuplicate') {
|
||||
connectSuggestionAndBiblio($suggestionid,$duplicateNumber);
|
||||
}
|
||||
my $suggestions_loop= &searchsuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
|
||||
foreach (@$suggestions_loop) {
|
||||
unless ($_->{biblionumber}) {
|
||||
my (@tags, @and_or, @excluding, @operator, @value, $offset,$length);
|
||||
# search on biblio.title
|
||||
if ($_->{title}) {
|
||||
my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.title","");
|
||||
push @tags, "'".$tag.$subfield."'";
|
||||
push @and_or, "and";
|
||||
push @excluding, "";
|
||||
push @operator, "contains";
|
||||
push @value, $_->{title};
|
||||
}
|
||||
if ($_->{author}) {
|
||||
my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblio.author","");
|
||||
push @tags, "'".$tag.$subfield."'";
|
||||
push @and_or, "and";
|
||||
push @excluding, "";
|
||||
push @operator, "contains";
|
||||
push @value, $_->{author};
|
||||
}
|
||||
# ... and on publicationyear.
|
||||
if ($_->{publicationyear}) {
|
||||
my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publicationyear","");
|
||||
push @tags, "'".$tag.$subfield."'";
|
||||
push @and_or, "and";
|
||||
push @excluding, "";
|
||||
push @operator, "=";
|
||||
push @value, $_->{publicationyear};
|
||||
}
|
||||
# ... and on publisher.
|
||||
if ($_->{publishercode}) {
|
||||
my ($tag,$subfield) = MARCfind_marc_from_kohafield($dbh,"biblioitems.publishercode","");
|
||||
push @tags, "'".$tag.$subfield."'";
|
||||
push @and_or, "and";
|
||||
push @excluding, "";
|
||||
push @operator, "=";
|
||||
push @value, $_->{publishercode};
|
||||
}
|
||||
|
||||
my ($finalresult,$nbresult) = C4::SearchMarc::catalogsearch($dbh,\@tags,\@and_or,\@excluding,\@operator,\@value,0,10);
|
||||
# there is at least 1 result => return the 1st one
|
||||
if ($nbresult) {
|
||||
# warn "$nbresult => ".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
|
||||
# warn "DUPLICATE ==>".@$finalresult[0]->{biblionumber},@$finalresult[0]->{bibid},@$finalresult[0]->{title};
|
||||
$_->{duplicateBiblionumber} = @$finalresult[0]->{biblionumber};
|
||||
}
|
||||
}
|
||||
}
|
||||
$template->param(suggestions_loop => $suggestions_loop,
|
||||
title => $title,
|
||||
author => $author,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 203 B |
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
Binary file not shown.
|
After Width: | Height: | Size: 218 B |
Binary file not shown.
|
After Width: | Height: | Size: 164 B |
Binary file not shown.
|
After Width: | Height: | Size: 203 B |
Binary file not shown.
|
After Width: | Height: | Size: 218 B |
Loading…
Reference in New Issue