changing DB structure to calculate next issue number.

Seems to work fine.

Still misses the date calculation & the test of end of subscription (maybe for monday ?)
This commit is contained in:
tipaul 2004-08-06 16:38:41 +00:00
parent e6ab46cc9d
commit 1e33d3ca1a
9 changed files with 413 additions and 446 deletions

View File

@ -19,6 +19,7 @@ package C4::Bull; #assumes C4/Bull.pm
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Date;
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ -44,22 +45,45 @@ Give all XYZ functions
@EXPORT = qw(&newsubscription &modsubscription &getsubscriptions &getsubscription
&modsubscriptionhistory
&getserials &serialchangestatus
&Initialize_Sequence &Find_Next_Date, &Get_Next_Seq);
&Find_Next_Date, &Get_Next_Seq);
sub newsubscription {
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,$seqnum1,$seqnum1,$seqtype1,$freq1, $step1,$seqnum2,$seqnum2,$seqtype2,$freq2, $step2,$seqnum3,$seqnum3,$seqtype3,$freq3, $step3, $numberingmethod, $arrivalplanified, $status, $notes) = @_;
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $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,seqnum1,startseqnum1,seqtype1,freq1,step1,seqnum2,startseqnum2,seqtype2,freq2, step2, seqnum3,startseqnum3,seqtype3, freq3, step3,numberingmethod, arrivalplanified, status, notes, pos1, pos2, pos3) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, 0, 0, 0)");
$sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,$seqnum1,$seqnum1,$seqtype1,$freq1, $step1,$seqnum2,$seqnum2,$seqtype2,$freq2, $step2,$seqnum3,$seqnum3,$seqtype3,$freq3, $step3, $numberingmethod, $arrivalplanified, $status, $notes);
my $sth=$dbh->prepare("insert into subscription (librarian,aqbooksellerid,cost,aqbudgetid,biblionumber,
startdate,periodicity,dow,numberlength,weeklength,monthlength,
add1,every1,whenmorethan1,setto1,lastvalue1,
add2,every2,whenmorethan2,setto2,lastvalue2,
add3,every3,whenmorethan3,setto3,lastvalue3,
numberingmethod, arrivalplanified, status, notes) values
(?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?,
?,?,?,?,?,?,?,?,?,?)");
$sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
format_date_in_iso($startdate),$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, format_date_in_iso($arrivalplanified), $status, $notes);
#then create the 1st waited number
my $subscriptionid = $dbh->{'mysql_insertid'};
$sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, subscriptionid, startdate, enddate, missinglist, recievedlist, opacnote, librariannote) values (?,?,?,?,?,?,?,?)");
$sth->execute($biblionumber, $subscriptionid, $startdate, 0, "", "", 0, $notes);
# reread subscription to get a hash (for calculation of the 1st issue number)
$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
$sth->execute($subscriptionid);
my $val = $sth->fetchrow_hashref;
$sth = $dbh->prepare("insert into serial (biblionumber, subscriptionid, serialseq, status, planneddate) values (?,?,?,?,?)");
$sth->execute($biblionumber, $subscriptionid, Initialize_Sequence($numberingmethod, $seqnum1, $seqtype1, $freq1, $step1, $seqnum2, $seqtype2, $freq2, $step2, $seqnum3, $seqtype3, $freq3, $step3), $status, C4::Bull::Find_Next_Date());
$sth->execute($biblionumber, $subscriptionid,
&Get_Next_Seq($val),
$status, Find_Next_Date());
$sth->finish;
}
sub getsubscription {
my ($subscriptionid) = @_;
@ -78,17 +102,22 @@ sub getsubscription {
sub modsubscription {
my ($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$seqnum1,$startseqnum1,$seqtype1,$freq1,$step1,
$seqnum2,$startseqnum2,$seqtype2,$freq2,$step2,
$seqnum3,$startseqnum3,$seqtype3,$freq3,$step3,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid)= @_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?, periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,seqnum1=?,startseqnum1=?,seqtype1=?,freq1=?,step1=?,seqnum2=?,startseqnum2=?,seqtype2=?,freq2=?, step2=?, seqnum3=?,startseqnum3=?,seqtype3=?, freq3=?, step3=?,numberingmethod=?, arrivalplanified=?, status=?, biblionumber=?, notes=? where subscriptionid = ?");
my $sth=$dbh->prepare("update subscription set librarian=?, aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
periodicity=?,dow=?,numberlength=?,weeklength=?,monthlength=?,
add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,
add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,
add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,
numberingmethod=?, arrivalplanified=?, status=?, biblionumber=?, notes=? where subscriptionid = ?");
$sth->execute($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$seqnum1,$startseqnum1,$seqtype1,$freq1,$step1,
$seqnum2,$startseqnum2,$seqtype2,$freq2,$step2,
$seqnum3,$startseqnum3,$seqtype3,$freq3,$step3,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid);
$sth->finish;
@ -130,8 +159,7 @@ sub getserials {
sub serialchangestatus {
my ($serialid,$serialseq,$planneddate,$status)=@_;
warn "($serialid,$serialseq,$planneddate,$status)";
# return 1;
# 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=?");
@ -153,154 +181,54 @@ sub serialchangestatus {
$sth->execute($recievedlist,$missinglist,$subscriptionid);
# 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->execute($subscriptionid);
my $val = $sth->fetchrow_hashref;
$sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)");
my ($temp, $X, $Y, $Z, $pos1, $pos2, $pos3) = Get_Next_Seq($val->{'numberingmethod'},$val->{'seqnum1'},$val->{'freq1'}, $val->{'step1'}, $val->{'seqtype1'}, $val->{'seqnum2'}, $val->{'freq2'}, $val->{'step2'}, $val->{'seqtype2'}, $val->{'seqnum3'}, $val->{'freq3'}, $val->{'step3'}, $val->{'seqtype3'}, $val->{'pos1'}, $val->{'pos2'}, $val->{'pos3'});
$sth->execute($temp, $subscriptionid, $val->{'biblionumber'}, 1, 0);
$sth = $dbh->prepare("update subscription set seqnum1=?, seqnum2=?,seqnum3=?,pos1=?,pos2=?,pos3=? where subscriptionid = ?");
$sth->execute($X, $Y, $Z, $pos1, $pos2, $pos3, $subscriptionid);
$sth = $dbh->prepare("select * from subscription where subscriptionid = ? ");
$sth->execute($subscriptionid);
my $val = $sth->fetchrow_hashref;
my ($newserialseq,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3) = Get_Next_Seq($val);
$sth = $dbh->prepare("insert into serial (serialseq,subscriptionid,biblionumber,status, planneddate) values (?,?,?,?,?)");
$sth->execute($newserialseq, $subscriptionid, $val->{'biblionumber'}, 1, 0);
$sth = $dbh->prepare("update subscription set lastvalue1=?, lastvalue2=?,lastvalue3=?,
innerloop1=?,innerloop2=?,innerloop3=?
where subscriptionid = ?");
$sth->execute($newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3,$subscriptionid);
}
}
sub GetValue(@) {
my $seq = shift;
my $X = shift;
my $Y = shift;
my $Z = shift;
return $X if ($seq eq 'X');
return $Y if ($seq eq 'Y');
return $Z if ($seq eq 'Z');
return "5 Syntax Error in Sequence";
}
sub Initialize_Sequence(@) {
my $sequence = shift;
my $X = shift;
my $seqtype1 = shift;
my $freq1 = shift;
my $step1 = shift;
my $Y = shift;
my $seqtype2 = shift;
my $freq2 = shift;
my $step2 = shift;
my $Z = shift;
my $seqtype3 = shift;
my $freq3 = shift;
my $step3 = shift;
my $finalstring = "";
my @string = split //, $sequence;
my $etat = 0;
for (my $i = 0; $i < (scalar @string); $i++) {
if ($string[$i] ne '{') {
if (!$etat) {
$finalstring .= $string[$i];
} else {
return "1 Syntax Error in Sequence";
}
} else {
return "3 Syntax Error in Sequence"
if ($string[$i + 1] ne 'X' && $string[$i + 1] ne 'Y' && $string[$i + 1] ne 'Z');
$finalstring .= GetValue($string[$i + 1], $X, $Y, $Z);
$i += 2;
}
}
return "$finalstring";
}
sub Find_Next_Date(@) {
return "2004-29-03";
}
sub Step(@) {
my $seqnum1 = shift;
my $seqtype1 = shift;
my $freq1 = shift;
my $step1 = shift;
my $seqnum2 = shift;
my $seqtype2 = shift;
my $freq2 = shift;
my $step2 = shift;
my $seqnum3 = shift;
my $seqtype3 = shift;
my $freq3 = shift;
my $step3 = shift;
my $pos1 = shift;
my $pos2 = shift;
my $pos3 = shift;
$seqnum1 += $step1 if ($seqtype1 == 1);
if ($seqtype1 == 2) {
$pos1 += 1;
if ($pos1 >= $freq1) {
$pos1 = 0;
$seqnum1 += $step1;
}
}
$seqnum2 += $step2 if ($seqtype2 == 1);
if ($seqtype2 == 2) {
$pos2 += 1;
if ($pos2 >= $freq2) {
$pos2 = 0;
$seqnum2 += $step2;
}
}
$seqnum3 += $step3 if ($seqtype3 == 1);
if ($seqtype3 == 2) {
$pos3 += 1;
if ($pos3 >= $freq3) {
$pos3 = 0;
$seqnum3 += $step3;
}
}
# $Y += $step2; if ($seqtype2 == 1);
# if ($seqtype2 == 2) { $pos2 += 1; if ($pos2 >= $freq2) {
#$pos2 = 0; $Y += $step2; } }
# $Z += $step3; if ($seqtype3 == 1);
# if ($seqtype3 == 2) { $pos3 += 1; if ($pos3 >= $freq3) {
# $pos3 = 0; $Z += $step3; } }
return ($seqnum1, $seqnum2, $seqnum3, $pos1, $pos2, $pos3);
}
sub Get_Next_Seq(@) {
my $sequence = shift;
my $seqnum1 = shift;
my $freq1 = shift;
my $step1 = shift;
my $seqtype1 = shift;
my $seqnum2 = shift;
my $freq2 = shift;
my $step2 = shift;
my $seqtype2 = shift;
my $seqnum3 = shift;
my $freq3 = shift;
my $step3 = shift;
my $seqtype3 = shift;
my $pos1 = shift;
my $pos2 = shift;
my $pos3 = shift;
return ("$sequence", $seqnum1, $seqnum2, $seqnum3)
if (!defined($seqnum1) && !defined($seqnum2) && !defined($seqnum3));
sub Get_Next_Seq {
my ($val) =@_;
# return ("$sequence", $seqnum1, $seqnum2, $seqnum3)
# if (!defined($seqnum1) && !defined($seqnum2) && !defined($seqnum3));
my ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
$calculated = $val->{numberingmethod};
# calculate the (expected) value of the next issue recieved.
$newlastvalue1 = $val->{lastvalue1};
# check if we have to increase the new value.
$newinnerloop1 = $val->{innerloop1}+1;
$newinnerloop1=0 if ($newinnerloop1 >= $val->{every1});
$newlastvalue1 += $val->{add1} if ($newinnerloop1<1); # <1 to be true when 0 or empty.
$newlastvalue1=$val->{setto1} if ($newlastvalue1>$val->{whenmorethan1}); # reset counter if needed.
$calculated =~ s/\{X\}/$newlastvalue1/g;
($seqnum1, $seqnum2, $seqnum3, $pos1, $pos2, $pos3) =
Step($seqnum1, $seqtype1, $freq1, $step1, $seqnum2, $seqtype2, $freq2,
$step2, $seqnum3, $seqtype3, $freq3, $step3, $pos1, $pos2, $pos3);
return (Initialize_Sequence($sequence, $seqnum1, $seqtype1,
$freq1, $step1, $seqnum2, $seqtype2, $freq2,
$step2, $seqnum3, $seqtype3, $freq3, $step3),
$seqnum1, $seqnum2, $seqnum3, $pos1, $pos2, $pos3);
$newlastvalue2 = $val->{lastvalue2};
# check if we have to increase the new value.
$newinnerloop2 = $val->{innerloop2}+1;
$newinnerloop2=0 if ($newinnerloop2 >= $val->{every2});
$newlastvalue2 += $val->{add2} if ($newinnerloop2<1); # <1 to be true when 0 or empty.
$newlastvalue2=$val->{setto2} if ($newlastvalue2>$val->{whenmorethan2}); # reset counter if needed.
$calculated =~ s/\{Y\}/$newlastvalue2/g;
$newlastvalue3 = $val->{lastvalue3};
# check if we have to increase the new value.
$newinnerloop3 = $val->{innerloop3}+1;
$newinnerloop3=0 if ($newinnerloop3 >= $val->{every3});
$newlastvalue3 += $val->{add3} if ($newinnerloop3<1); # <1 to be true when 0 or empty.
$newlastvalue3=$val->{setto3} if ($newlastvalue3>$val->{whenmorethan3}); # reset counter if needed.
$calculated =~ s/\{Z\}/$newlastvalue3/g;
return ($calculated,$newlastvalue1,$newlastvalue2,$newlastvalue3,$newinnerloop1,$newinnerloop2,$newinnerloop3);
}
END { } # module clean-up code here (global destructor)

View File

@ -4,8 +4,10 @@ use strict;
use CGI;
use C4::Koha;
use C4::Auth;
use C4::Date;
use C4::Output;
use C4::Bull;
use C4::Acquisition;
use C4::Interface::CGI::Output;
use C4::Context;
use HTML::Template;
@ -16,12 +18,13 @@ my $op = $query->param('op');
my $dbh = C4::Context->dbh;
my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
$dow, $numberlength, $weeklength, $monthlength,
$seqnum1,$startseqnum1,$seqtype1,$freq1,$step1,
$seqnum2,$startseqnum2,$seqtype2,$freq2,$step2,
$seqnum3,$startseqnum3,$seqtype3,$freq3,$step3,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $biblionumber,
$bibliotitle, $notes);
my @budgets;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "bull/subscription-add.tmpl",
query => $query,
@ -48,21 +51,21 @@ if ($op eq 'mod') {
$numberlength = $subs->{'numberlength'};
$weeklength = $subs->{'weeklength'};
$monthlength = $subs->{'monthlength'};
$seqnum1 = $subs->{'seqnum1'};
$startseqnum1 = $subs->{'startseqnum1'};
$seqtype1 = $subs->{'seqtype1'};
$freq1 = $subs->{'freq1'};
$step1 = $subs->{'step1'};
$seqnum2 = $subs->{'seqnum2'};
$startseqnum2 = $subs->{'startseqnum2'};
$seqtype2 = $subs->{'seqtype2'};
$freq2 = $subs->{'freq2'};
$step2 = $subs->{'step2'};
$seqnum3 = $subs->{'seqnum3'};
$startseqnum3 = $subs->{'startseqnum3'};
$seqtype3 = $subs->{'seqtype3'};
$freq3 = $subs->{'freq3'};
$step3 = $subs->{'step3'};
$add1 = $subs->{'add1'};
$every1 = $subs->{'every1'};
$whenmorethan1 = $subs->{'whenmorethan1'};
$setto1 = $subs->{'setto1'};
$lastvalue1 = $subs->{'lastvalue1'};
$add2 = $subs->{'add2'};
$every2 = $subs->{'every2'};
$whenmorethan2 = $subs->{'whenmorethan2'};
$setto2 = $subs->{'setto2'};
$lastvalue2 = $subs->{'lastvalue2'};
$add3 = $subs->{'add3'};
$every3 = $subs->{'every3'};
$whenmorethan3 = $subs->{'whenmorethan3'};
$setto3 = $subs->{'setto3'};
$lastvalue3 = $subs->{'lastvalue3'};
$numberingmethod = $subs->{'numberingmethod'};
$arrivalplanified = $subs->{'arrivalplanified'};
$status = $subs->{status};
@ -78,50 +81,49 @@ if ($op eq 'mod') {
cost => $cost,
aqbudgetid => $aqbudgetid,
bookfundid => $bookfundid,
startdate => $startdate,
startdate => format_date($startdate),
periodicity => $periodicity,
dow => $dow,
numberlength => $numberlength,
weeklength => $weeklength,
monthlength => $monthlength,
seqnum1 =>$seqnum1,
startseqnum =>$startseqnum1,
seqtype1 =>$seqtype1,
freq1 =>$freq1,
step1 =>$step1,
seqnum2 => $seqnum2,
startseqnum2 => $startseqnum2,
seqtype2 => $seqtype2,
freq2 => $freq2,
step2 => $step2,
seqnum3 => $seqnum3,
startseqnum3 => $startseqnum3,
seqtype3 => $seqtype3,
freq3 => $freq3,
step3 => $step3,
add1 => $add1,
every1 => $every1,
whenmorethan1 => $whenmorethan1,
setto1 => $setto1,
lastvalue1 => $lastvalue1,
add2 => $add2,
every2 => $every2,
whenmorethan2 => $whenmorethan2,
setto2 => $setto2,
lastvalue2 => $lastvalue2,
add3 => $add3,
every3 => $every3,
whenmorethan3 => $whenmorethan3,
setto3 => $setto3,
lastvalue3 => $lastvalue3,
numberingmethod => $numberingmethod,
arrivalplanified => $arrivalplanified,
arrivalplanified => format_date($arrivalplanified),
status => $status,
biblionumber => $biblionumber,
bibliotitle => $bibliotitle,
notes => $notes,
subscriptionid => $subscriptionid
subscriptionid => $subscriptionid,
);
$template->param(
"periodicity$periodicity" => 1,
"seqtype1$seqtype1" => 1,
"seqtype2$seqtype2" => 1,
"seqtype3$seqtype3" => 1,
"dow$dow" => 1,
);
} else {
# fill seqtype with 0 to avoid a javascript error
$template->param(
"seqtype1" => 0,
"seqtype2" => 0,
"seqtype3" => 0,
);
}
(my $temp,@budgets) = bookfunds();
# find default value & set it for the template
for (my $i=0;$i<=$#budgets;$i++) {
if ($budgets[$i]->{'aqbudgetid'} eq $aqbudgetid) {
$budgets[$i]->{'selected'}=1;
}
}
$template->param(budgets => \@budgets);
if ($op eq 'addsubscription') {
my $auser = $query->param('user');
my $aqbooksellerid = $query->param('aqbooksellerid');
@ -133,26 +135,33 @@ if ($op eq 'addsubscription') {
my $numberlength = $query->param('numberlength');
my $weeklength = $query->param('weeklength');
my $monthlength = $query->param('monthlength');
my $seqnum1 = $query->param('seqnum1');
my $seqtype1 = $query->param('seqtype1');
my $freq1 = $query->param('freq1');
my $step1 = $query->param('step1');
my $seqnum2 = $query->param('seqnum2');
my $seqtype2 = $query->param('seqtype2');
my $freq2 = $query->param('freq2');
my $step2 = $query->param('step2');
my $seqnum3 = $query->param('seqnum3');
my $seqtype3 = $query->param('seqtype3');
my $freq3 = $query->param('freq3');
my $step3 = $query->param('step3');
my $add1 = $query->param('add1');
my $every1 = $query->param('every1');
my $whenmorethan1 = $query->param('whenmorethan1');
my $setto1 = $query->param('setto1');
my $lastvalue1 = $query->param('lastvalue1');
my $add2 = $query->param('add2');
my $every2 = $query->param('every2');
my $whenmorethan2 = $query->param('whenmorethan2');
my $setto2 = $query->param('setto2');
my $lastvalue2 = $query->param('lastvalue2');
my $add3 = $query->param('add3');
my $every3 = $query->param('every3');
my $whenmorethan3 = $query->param('whenmorethan3');
my $setto3 = $query->param('setto3');
my $lastvalue3 = $query->param('lastvalue3');
my $numberingmethod = $query->param('numberingmethod');
my $arrivalplanified = $query->param('arrivalplanified');
my $status = 1;
my $biblionumber = $query->param('biblionumber');
my $notes = $query->param('notes');
my $sth=$dbh->prepare("insert into subscription (librarian, aqbooksellerid,cost,aqbudgetid,biblionumber,startdate, periodicity,dow,numberlength,weeklength,monthlength,seqnum1,startseqnum1,seqtype1,freq1,step1,seqnum2,startseqnum2,seqtype2,freq2, step2, seqnum3,startseqnum3,seqtype3, freq3, step3,numberingmethod, arrivalplanified, status, notes, pos1, pos2, pos3) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, 0, 0, 0)");
newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,$seqnum1,$seqnum1,$seqtype1,$freq1, $step1,$seqnum2,$seqnum2,$seqtype2,$freq2, $step2,$seqnum3,$seqnum3,$seqtype3,$freq3, $step3, $numberingmethod, $arrivalplanified, $status, $notes);
newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $notes
);
}

View File

@ -4,6 +4,7 @@ use strict;
use CGI;
use C4::Auth;
use C4::Koha;
use C4::Date;
use C4::Bull;
use C4::Output;
use C4::Interface::CGI::Output;
@ -18,9 +19,9 @@ my $sth;
my ($template, $loggedinuser, $cookie, $subs);
my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, $aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
$dow, $numberlength, $weeklength, $monthlength,
$seqnum1,$startseqnum1,$seqtype1,$freq1,$step1,
$seqnum2,$startseqnum2,$seqtype2,$freq2,$step2,
$seqnum3,$startseqnum3,$seqtype3,$freq3,$step3,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $biblionumber, $bibliotitle, $notes);
$subscriptionid = $query->param('subscriptionid');
@ -38,21 +39,21 @@ if ($op eq 'modsubscription') {
$numberlength = $query->param('numberlength');
$weeklength = $query->param('weeklength');
$monthlength = $query->param('monthlength');
$seqnum1 = $query->param('seqnum1');
$startseqnum1 = $query->param('startseqnum1');
$seqtype1 = $query->param('seqtype1');
$freq1 = $query->param('freq1');
$step1 = $query->param('step1');
$seqnum2 = $query->param('seqnum2');
$startseqnum2 = $query->param('startseqnum2');
$seqtype2 = $query->param('seqtype2');
$freq2 = $query->param('freq2');
$step2 = $query->param('step2');
$seqnum3 = $query->param('seqnum3');
$startseqnum3 = $query->param('startseqnum3');
$seqtype3 = $query->param('seqtype3');
$freq3 = $query->param('freq3');
$step3 = $query->param('step3');
$add1 = $query->param('add1');
$every1 = $query->param('every1');
$whenmorethan1 = $query->param('whenmorethan1');
$setto1 = $query->param('setto1');
$lastvalue1 = $query->param('lastvalue1');
$add2 = $query->param('add2');
$every2 = $query->param('every2');
$whenmorethan2 = $query->param('whenmorethan2');
$setto2 = $query->param('setto2');
$lastvalue2 = $query->param('lastvalue2');
$add3 = $query->param('add3');
$every3 = $query->param('every3');
$whenmorethan3 = $query->param('whenmorethan3');
$setto3 = $query->param('setto3');
$lastvalue3 = $query->param('lastvalue3');
$numberingmethod = $query->param('numberingmethod');
$arrivalplanified = $query->param('arrivalplanified');
$status = 1;
@ -60,49 +61,46 @@ if ($op eq 'modsubscription') {
&modsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$seqnum1,$startseqnum1,$seqtype1,$freq1,$step1,
$seqnum2,$startseqnum2,$seqtype2,$freq2,$step2,
$seqnum3,$startseqnum3,$seqtype3,$freq3,$step3,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
$numberingmethod, $arrivalplanified, $status, $biblionumber, $notes, $subscriptionid);
} else {
my $subs = &getsubscription($subscriptionid);
$auser = $subs->{'user'};
$librarian => $subs->{'librarian'},
$cost = $subs->{'cost'};
$aqbooksellerid = $subs->{'aqbooksellerid'};
$aqbooksellername = $subs->{'aqbooksellername'};
$bookfundid = $subs->{'bookfundid'};
$aqbudgetid = $subs->{'aqbudgetid'};
$startdate = $subs->{'startdate'};
$periodicity = $subs->{'periodicity'};
$dow = $subs->{'dow'};
$numberlength = $subs->{'numberlength'};
$weeklength = $subs->{'weeklength'};
$monthlength = $subs->{'monthlength'};
$seqnum1 = $subs->{'seqnum1'};
$startseqnum1 = $subs->{'startseqnum1'};
$seqtype1 = $subs->{'seqtype1'};
$freq1 = $subs->{'freq1'};
$step1 = $subs->{'step1'};
$seqnum2 = $subs->{'seqnum2'};
$startseqnum2 = $subs->{'startseqnum2'};
$seqtype2 = $subs->{'seqtype2'};
$freq2 = $subs->{'freq2'};
$step2 = $subs->{'step2'};
$seqnum3 = $subs->{'seqnum3'};
$startseqnum3 = $subs->{'startseqnum3'};
$seqtype3 = $subs->{'seqtype3'};
$freq3 = $subs->{'freq3'};
$step3 = $subs->{'step3'};
$numberingmethod = $subs->{'numberingmethod'};
$arrivalplanified = $subs->{'arrivalplanified'};
$status = $subs->{status};
$biblionumber = $subs->{'biblionumber'};
$bibliotitle = $subs->{'bibliotitle'},
$notes = $subs->{'notes'};
}
my $subs = &getsubscription($subscriptionid);
$auser = $subs->{'user'};
$librarian => $subs->{'librarian'},
$cost = $subs->{'cost'};
$aqbooksellerid = $subs->{'aqbooksellerid'};
$aqbooksellername = $subs->{'aqbooksellername'};
$bookfundid = $subs->{'bookfundid'};
$aqbudgetid = $subs->{'aqbudgetid'};
$startdate = $subs->{'startdate'};
$periodicity = $subs->{'periodicity'};
$dow = $subs->{'dow'};
$numberlength = $subs->{'numberlength'};
$weeklength = $subs->{'weeklength'};
$monthlength = $subs->{'monthlength'};
$add1 = $subs->{'add1'};
$every1 = $subs->{'every1'};
$whenmorethan1 = $subs->{'whenmorethan1'};
$setto1 = $subs->{'setto1'};
$lastvalue1 = $subs->{'lastvalue1'};
$add2 = $subs->{'add2'};
$every2 = $subs->{'every2'};
$whenmorethan2 = $subs->{'whenmorethan2'};
$setto2 = $subs->{'setto2'};
$lastvalue2 = $subs->{'lastvalue2'};
$add3 = $subs->{'add3'};
$every3 = $subs->{'every3'};
$whenmorethan3 = $subs->{'whenmorethan3'};
$setto3 = $subs->{'setto3'};
$lastvalue3 = $subs->{'lastvalue3'};
$numberingmethod = $subs->{'numberingmethod'};
$arrivalplanified = $subs->{'arrivalplanified'};
$status = $subs->{status};
$biblionumber = $subs->{'biblionumber'};
$bibliotitle = $subs->{'bibliotitle'},
$notes = $subs->{'notes'};
($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "bull/subscription-detail.tmpl",
@ -124,27 +122,27 @@ $template->param(
cost => $cost,
aqbudgetid => $aqbudgetid,
bookfundid => $bookfundid,
startdate => $startdate,
startdate => format_date($startdate),
periodicity => $periodicity,
dow => $dow,
numberlength => $numberlength,
weeklength => $weeklength,
monthlength => $monthlength,
seqnum1 =>$seqnum1,
startseqnum1 =>$startseqnum1,
seqtype1 =>$seqtype1,
freq1 =>$freq1,
step1 =>$step1,
seqnum2 => $seqnum2,
startseqnum2 => $startseqnum2,
seqtype2 => $seqtype2,
freq2 => $freq2,
step2 => $step2,
seqnum3 => $seqnum3,
startseqnum3 => $startseqnum3,
seqtype3 => $seqtype3,
freq3 => $freq3,
step3 => $step3,
add1 => $add1,
every1 => $every1,
whenmorethan1 => $whenmorethan1,
setto1 => $setto1,
lastvalue1 => $lastvalue1,
add2 => $add2,
every2 => $every2,
whenmorethan2 => $whenmorethan2,
setto2 => $setto2,
lastvalue2 => $lastvalue2,
add3 => $add3,
every3 => $every3,
whenmorethan3 => $whenmorethan3,
setto3 => $setto3,
lastvalue3 => $lastvalue3,
numberingmethod => $numberingmethod,
arrivalplanified => $arrivalplanified,
status => $status,
@ -155,11 +153,7 @@ $template->param(
);
$template->param(
"periodicity$periodicity" => 1,
"seqtype1$seqtype1" => 1,
"seqtype2$seqtype2" => 1,
"seqtype3$seqtype3" => 1,
"arrival$dow" => 1,
);
output_html_with_http_headers $query, $cookie, $template->output;

View File

@ -14,7 +14,7 @@
<!-- TMPL_VAR name="name" -->
</td>
<td>
<a href="#" onClick="GetIdInOpener('<!-- TMPL_VAR name=id -->')">
<a href="#" onClick="GetIdInOpener('<!-- TMPL_VAR name=id -->','<!-- TMPL_VAR name="name" -->')">
<img src="<!-- TMPL_VAR NAME='interface' -->/<!-- TMPL_VAR name="theme" -->/images/arrow.gif" title="select this supplier" BORDER=0 height=40 width=40>
</a>
</td>
@ -28,9 +28,10 @@
<script language="javascript">
function GetIdInOpener(value)
function GetIdInOpener(value,name)
{
opener.document.f.aqbooksellerid.value = value;
opener.document.f.aqbooksellername.value= name;
self.close();
}

View File

@ -1,6 +1,6 @@
<!-- TMPL_INCLUDE NAME="neutral-top.inc" -->
<div id="mainbloc">
<h1 class="catalogue">MARC search results</h1>
<h1 class="catalogue">Search results</h1>
<div id="resultnumber">
<p>
<!-- TMPL_IF NAME=displayprev -->
@ -31,15 +31,13 @@
<table>
<tr>
<th class="catalogue">Summary</th>
<th class="catalogue">Item Count</th>
<th class="catalogue">Location</th>
<th class="catalogue">&nbsp;</th>
</tr>
<!-- TMPL_LOOP name="result" -->
<tr>
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
<p>
<p> <b><a class="transparent" href="/cgi-bin/koha/MARCdetail.pl?bib=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --></a></b></p>
<p><b><!-- TMPL_VAR NAME="title" --></b></p>
<p><!-- TMPL_VAR NAME="author" -->
<!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR name="publishercode" --><!-- /TMPL_IF -->
<!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR name="place" --><!-- /TMPL_IF -->
@ -48,17 +46,9 @@
<!-- TMPL_IF name="size" --> ; <!-- TMPL_VAR name="size" --><!-- /TMPL_IF -->
</p>
</td>
<td align="center" <!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
<!-- TMPL_VAR name="totitem" -->
</td>
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
<!-- TMPL_LOOP name="CN" -->
<!-- TMPL_VAR name="holdingbranch" --> <!-- TMPL_IF name="itemcallnumber" -->(<!-- TMPL_VAR name="itemcallnumber" -->)<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</td>
<td <!-- TMPL_IF name="even" -->class="hilighted"<!-- /TMPL_IF -->>
<!-- TMPL_UNLESS NAME="norequests" -->
<a class="transparent" href="#" onclick="GetIt('<!-- TMPL_VAR NAME="biblionumber" -->') ">Get it!</a>
<a class="transparent" href="#" onclick="GetIt('<!-- TMPL_VAR NAME="biblionumber" -->','<!-- TMPL_VAR name="title" -->') ">Get it!</a>
<!-- TMPL_ELSE -->
Not Reservable
<!-- /TMPL_UNLESS -->
@ -89,9 +79,10 @@
<script language="Javascript">
function GetIt(bibno)
function GetIt(bibno,title)
{
opener.document.f.perioid.value = bibno;
opener.document.f.biblionumber.value = bibno;
opener.document.f.title.value = title;
self.close();
}
</script>

View File

@ -15,15 +15,28 @@
<input type="hidden" name="op" value="addsubscription">
<input type="hidden" name="user" value="<!-- TMPL_VAR name="user" -->">
<p>Librarian</td><td> <!-- TMPL_VAR name="user" --></p>
<p><label>Supplier (*):</label><input type="text" name="aqbooksellerid" value="<!-- TMPL_VAR name="aqbooksellerid"-->"><a href="#" OnClick="FindAcqui()">...</a></p>
<p><label>Cost</label><input type="text" name="cost" value="<!-- TMPL_VAR name="cost" -->"></label></p>
<p><label>Budget</label><input type="text" name="aqbudgetid" value="<!-- TMPL_VAR name="aqbudgetid" -->"></p>
<p><label>Biblio</label><input type="text" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->"> <a href="#" onClick="Plugin(f)">...</a></p>
<p><label>Supplier (*):</label><input type="text" name="aqbooksellerid" value="<!-- TMPL_VAR name="aqbooksellerid"-->" size=4> (<input type="text" name="aqbooksellername" value="<!-- TMPL_VAR name="aqbooksellername" -->" disabled readonly>) <a href="#" OnClick="FindAcqui()">...</a></p>
<p><label>Cost</label><input type="text" name="cost" value="<!-- TMPL_VAR name="cost" -->" size=4></label></p>
<p><label>Budget</label>
<select name="aqbudgetid">
<!-- TMPL_LOOP name="budgets" -->
<!-- TMPL_IF name="selected" -->
<option value="<!-- TMPL_VAR name="aqbudgetid" -->" selected>
<!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR name="aqbudgetid" -->">
<!-- /TMPL_IF -->
<!-- TMPL_VAR name="bookfundname" --> (<!-- TMPL_VAR name="startdate" --> - <!-- TMPL_VAR name="enddate" -->)
</option>
<!-- /TMPL_LOOP -->
</select>
</p>
<p><label>Biblio</label><input type="text" name="biblionumber" value="<!-- TMPL_VAR name="biblionumber" -->" size=4> (<input type="text" name="title" value="<!-- TMPL_VAR name="title" -->" disabled readonly>)<a href="#" onClick="Plugin(f)">...</a></p>
<p><label>Notes</label><TEXTAREA NAME="notes" COLS=30 ROWS=2><!-- TMPL_VAR name="notes" --></TEXTAREA></p>
</div>
<div id="bloc25">
<h2 class="bull">Planning</h2>
<p><label class="label100">Beginnning date:</label> <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->"></p>
<p><label class="label100">Beginnning date:</label> <input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" size=13 maxlength=10></p>
<p><label class="label100">Next issue (expected)</label><input type="text" name="arrivalplanified" value="<!-- TMPL_VAR name="arrivalplanified" -->" size=13 maxlength=10></p>
<p><label class="label100">Frequency (*)</label>
<select name="periodicity" size="1">
<option value="" selected>None</option>
@ -143,88 +156,49 @@
<th class="bull">Z</th>
</tr>
<tr>
<td class="bull">Evolution</td>
<td class="bull">Add</td>
<td>
<select name="seqtype1" size="1" onChange="select(this[this.selectedIndex].value, 'X')">
<option value="">None</option>
<!-- TMPL_IF name="seqtype11" -->
<option value="1" selected>Added each</option>
<!-- TMPL_ELSE -->
<option value="1">Added each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype12" -->
<option value="2" selected>Reinitialize each</option>
<!-- TMPL_ELSE -->
<option value="2">Reinitialize each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype13" -->
<option value="3" selected>Constant</option>
<!-- TMPL_ELSE -->
<option value="3">Constant</option>
<!-- /TMPL_IF -->
</select>
<input type="text" name="add1" value="<!-- TMPL_VAR name="add1" -->">
</td>
<td>
<select name="seqtype2" size="1" onChange="select(this[this.selectedIndex].value, 'Y')">
<option value="" selected>None</option>
<!-- TMPL_IF name="seqtype21" -->
<option value="1" selected>Added each</option>
<!-- TMPL_ELSE -->
<option value="1">Added each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype22" -->
<option value="2" selected>Reinitialize each</option>
<!-- TMPL_ELSE -->
<option value="2">Reinitialize each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype23" -->
<option value="3" selected>Constant</option>
<!-- TMPL_ELSE -->
<option value="3">Constant</option>
<!-- /TMPL_IF -->
</select>
<input type="text" name="add2" value="<!-- TMPL_VAR name="add2" -->">
</td>
<td>
<select name="seqtype3" size="1" onChange="select(this[this.selectedIndex].value, 'Z')">
<option value="" selected>None</option>
<!-- TMPL_IF name="seqtype31" -->
<option value="1" selected>Added each</option>
<!-- TMPL_ELSE -->
<option value="1">Added each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype32" -->
<option value="2" selected>Reinitialize each</option>
<!-- TMPL_ELSE -->
<option value="2">Reinitialize each</option>
<!-- /TMPL_IF -->
<!-- TMPL_IF name="seqtype33" -->
<option value="3" selected>Constant</option>
<!-- TMPL_ELSE -->
<option value="3">Constant</option>
<!-- /TMPL_IF -->
</select>
<input type="text" name="add3" value="<!-- TMPL_VAR name="add3" -->">
</td>
</tr>
<tr>
<td class="bull">Value</td>
<td><input type="text" name="seqnum1" value="<!-- TMPL_VAR name="seqnum1" -->"></td>
<td><input type="text" name="seqnum2" value="<!-- TMPL_VAR name="seqnum2" -->"></td>
<td><input type="text" name="seqnum3" value="<!-- TMPL_VAR name="seqnum3" -->"></td>
<td class="bull">once every</td>
<td><input type="text" name="every1" value="<!-- TMPL_VAR name="every1" -->"></td>
<td><input type="text" name="every2" value="<!-- TMPL_VAR name="every2" -->"></td>
<td><input type="text" name="every3" value="<!-- TMPL_VAR name="every3" -->"></td>
</tr>
<tr>
<td class="bull">Frequency</td>
<td><input type="text" name="freq1" value="<!-- TMPL_VAR name="freq1" -->"></td>
<td><input type="text" name="freq2" value="<!-- TMPL_VAR name="freq2" -->"></td>
<td><input type="text" name="freq3" value="<!-- TMPL_VAR name="freq3" -->"></td>
<td class="bull">When more than</td>
<td><input type="text" name="whenmorethan1" value="<!-- TMPL_VAR name="whenmorethan1" -->"></td>
<td><input type="text" name="whenmorethan2" value="<!-- TMPL_VAR name="whenmorethan2" -->"></td>
<td><input type="text" name="whenmorethan3" value="<!-- TMPL_VAR name="whenmorethan3" -->"></td>
</tr>
<tr>
<td class="bull">Step</td>
<td><input type="text" name="step1" value="<!-- TMPL_VAR name="step1" -->"></td>
<td><input type="text" name="step2" value="<!-- TMPL_VAR name="step2" -->"></td>
<td><input type="text" name="step3" value="<!-- TMPL_VAR name="step3" -->"></td>
<td class="bull">Set back to</td>
<td><input type="text" name="setto1" value="<!-- TMPL_VAR name="setto1" -->"></td>
<td><input type="text" name="setto2" value="<!-- TMPL_VAR name="setto2" -->"></td>
<td><input type="text" name="setto3" value="<!-- TMPL_VAR name="setto3" -->"></td>
</tr>
<tr>
<td class="bull">
<!-- TMPL_IF name="mod" -->
Last value
<!-- TMPL_ELSE -->
Begins with
<!-- /TMPL_IF -->
</td>
<td><input type="text" name="lastvalue1" value="<!-- TMPL_VAR name="lastvalue1" -->"></td>
<td><input type="text" name="lastvalue2" value="<!-- TMPL_VAR name="lastvalue2" -->"></td>
<td><input type="text" name="lastvalue3" value="<!-- TMPL_VAR name="lastvalue3" -->"></td>
</tr>
</table>
<td>Arrival date : </td><td> <input type="text" name="arrivalplanified" value="<!-- TMPL_VAR name="arrivalplanified" -->">
</p>
</div>
<!-- TMPL_IF name="mod" -->
<input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" class="button bull">
@ -238,10 +212,6 @@
<script language="JavaScript" type="text/javascript">
select(<!--TMPL_VAR name="seqtype1"-->, 'X');
select(<!--TMPL_VAR name="seqtype2"-->, 'Y');
select(<!--TMPL_VAR name="seqtype3"-->, 'Z');
function Plugin(f)
{
window.open("subscription-bib-search.pl","Find a bib index",'width=500,height=400,toolbar=false,scrollbars=yes');

View File

@ -86,68 +86,51 @@
<h2 class="bull">Numbering calculation</h2>
<p>
<p>Numbering formula: <!-- TMPL_VAR name="numberingmethod" --></p>
<table class="small">
<table class="small" width="20%">
<tr>
<th class="bull">&nbsp;</th>
<th class="bull">X</th>
<th class="bull">Y</th>
<th class="bull">Z</th>
<th class="bull">&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th class="bull">&nbsp;&nbsp;&nbsp;&nbsp;Y&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th class="bull">&nbsp;&nbsp;&nbsp;&nbsp;Z&nbsp;&nbsp;&nbsp;&nbsp;</th>
</tr>
<tr>
<td class="bull">Evolution</td>
<td class="bull">Add</td>
<td>
<!-- TMPL_IF NAME="seqtype11" -->
Added
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype12" -->
Reinitialize each
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype13" -->
Constant
<!-- /TMPL_IF -->
<!-- TMPL_VAR name="add1" -->
</td>
<td>
<!-- TMPL_IF NAME="seqtype21" -->
Added
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype22" -->
Reinitialize each
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype23" -->
Constant
<!-- /TMPL_IF -->
<!-- TMPL_VAR name="add2" -->
</td>
<td>
<!-- TMPL_IF NAME="seqtype31" -->
Added
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype32" -->
Reinitialize each
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="seqtype33" -->
Constant
<!-- /TMPL_IF -->
<!-- TMPL_VAR name="add3" -->
</td>
</tr>
<tr>
<td class="bull">Value</td>
<td><!-- TMPL_VAR name="seqnum1" --></td>
<td><!-- TMPL_VAR name="seqnum2" --></td>
<td><!-- TMPL_VAR name="seqnum3" --></td>
<td class="bull">once every</td>
<td><!-- TMPL_VAR name="every1" --></td>
<td><!-- TMPL_VAR name="every2" --></td>
<td><!-- TMPL_VAR name="every3" --></td>
</tr>
<tr>
<td class="bull">Frequency</td>
<td><!-- TMPL_VAR name="freq1" --></td>
<td><!-- TMPL_VAR name="freq2" --></td>
<td><!-- TMPL_VAR name="freq3" --></td>
<td class="bull">When more than</td>
<td><!-- TMPL_VAR name="whenmorethan1" --></td>
<td><!-- TMPL_VAR name="whenmorethan2" --></td>
<td><!-- TMPL_VAR name="whenmorethan3" --></td>
</tr>
<tr>
<td class="bull">Step</td>
<td><!-- TMPL_VAR name="step1" --></td>
<td><!-- TMPL_VAR name="step2" --></td>
<td><!-- TMPL_VAR name="step3" --></td>
<td class="bull">Set back to</td>
<td><!-- TMPL_VAR name="setto1" --></td>
<td><!-- TMPL_VAR name="setto2" --></td>
<td><!-- TMPL_VAR name="setto3" --></td>
</tr>
</table>
<tr>
<td class="bull">
Last value
</td>
<td><!-- TMPL_VAR name="lastvalue1" --></td>
<td><!-- TMPL_VAR name="lastvalue2" --></td>
<td><!-- TMPL_VAR name="lastvalue3" --></td>
</tr> </table>
</div>
</div>

View File

@ -11,14 +11,18 @@
<h2>Numbering calculation</h2>
<p>The numbering of items recieved can contain complex formulas. The "numbering formula" can be filled with any text and/or numbers. 3 special tokens <b>{X} {Y}</b> and <b>{Z}</b> can be user to define the calculation formula. XYZ values are calculated with the following method:</p>
<ul>
<li>Added : a XYZ number "Added" has "step" increase for each new recieve. The "value" contains the next number to recieve (= the 1st one when subscription is created)</li>
<li>Reinitialize each : a XYZ number "Reinitialize each" has a "step" increase on each recieve, but the number is reinitialized every "frequency"</li>
<li>Constant is a constant number. Should be useless, as a contant number can be set in the formula</li>
<li>Add : the number here is added to XYZ</li>
<li>once every : the number before can be added on every issue or less often</li>
<li>When more than : if the calculated number is more than the value here</li>
<li>Set back to : if the previous condition is valid, the calculated number is set to this one instead</li>
<li>Last value / begins with : the last value calculated or the 1st value (when adding a subscription</li>
</ul>
<h2>Sample</h2>
Consider the formula <b>N°{X}/{Y}</b>. The following XYZ settings :
<li> <b>X</b> add <b>1</b> once every <b>4</b> times. When more than <b>9999999</b> set back to <b>empty</b>. Begins with <b>2004</b></li>
<li> <b>Y</b> add <b>1</b> once every <b>1</b> times. When more than <b>4</b> set back to <b>4</b>. Begins with <b>1</b></li>
will result in the following issues numbers :
<b>N°2004/1,N°2004/2,N°2004/3,N°2004/4,N°2005/1,N°2005/2,N°2005/3,N°2005/4,N°2006/1
<p>
<li>Added, value=1021, step=1 gives : 1021,1022,1023,1024...</li>
<li>Added, value=0, step=4 gives : 0,4,8,12,16,20,...</li>
<li>Reinitialize each, value=1, frequency=4, step=1 gives : 1,2,3,4,1,2,3,4...</li>
</p>
<!-- TMPL_INCLUDE name="help-bottom.inc" -->

View File

@ -313,6 +313,80 @@ my %requiretables = (
booksellerinvoicenumber text,
PRIMARY KEY (basketno)
)",
serial => "(serialid int(11) NOT NULL auto_increment,
biblionumber varchar(100) NOT NULL default '',
subscriptionid varchar(100) NOT NULL default '',
serialseq varchar(100) NOT NULL default '',
status tinyint(4) NOT NULL default '0',
planneddate date NOT NULL default '0000-00-00',
PRIMARY KEY (serialid)
)",
subscription => "(biblionumber int(11) NOT NULL default '0',
subscriptionid int(11) NOT NULL auto_increment,
librarian varchar(100) default '',
startdate date default '0000-00-00',
aqbooksellerid int(11) default '0',
cost int(11) default '0',
aqbudgetid int(11) default '0',
weeklength tinyint(4) default '0',
monthlength tinyint(4) default '0',
numberlength tinyint(4) default '0',
periodicity tinyint(4) default '0',
dow varchar(100) default '',
numberingmethod varchar(100) default '',
notes text,
arrivalplanified varchar(100) NOT NULL default '',
status varchar(100) NOT NULL default '',
add1 int(11) default 0,
every1 int(11) default 0,
whenmorethan1 int(11) default 0,
setto1 int(11),
lastvalue1 int(11),
add2 int(11) default 0,
every2 int(11) default 0,
whenmorethan2 int(11) default 0,
setto2 int(11),
lastvalue2 int(11),
add3 int(11) default 0,
every3 int(11) default 0,
innerloop1 int(11) default 0,
innerloop2 int(11) default 0,
innerloop3 int(11) default 0,
whenmorethan3 int(11) default 0,
setto3 int(11),
lastvalue3 int(11),
PRIMARY KEY (subscriptionid)
)",
# seqnum1 int(11) default '0',
# startseqnum1 int(11) default '0',
# seqtype1 int(11) default '0',
# freq1 int(11) default '0',
# step1 int(11) default '0',
# seqnum2 int(11) default '0',
# step2 int(11) default '0',
# startseqnum2 int(11) default '0',
# freq2 int(11) default '0',
# seqtype2 int(11) default '0',
# seqnum3 int(11) default '0',
# freq3 int(11) default '0',
# notes varchar(100) NOT NULL default '',
# step3 int(11) default '0',
# pos3 int(11) NOT NULL default '0',
# pos2 int(11) NOT NULL default '0',
# pos1 int(11) NOT NULL default '0',
# seqtype3 int(11) default '0',
subscriptionhistory => "(biblionumber int(11) NOT NULL default '0',
subscriptionid int(11) NOT NULL default '0',
startdate date NOT NULL default '0000-00-00',
enddate date default '0000-00-00',
missinglist longtext NOT NULL,
recievedlist longtext NOT NULL,
opacnote varchar(150) NOT NULL default '',
librariannote varchar(150) NOT NULL default '',
PRIMARY KEY (subscriptionid),
KEY biblionumber (biblionumber)
)",
);
my %requirefields = (
@ -1287,16 +1361,23 @@ foreach my $table ( keys %tabledata ) {
# at last, remove useless fields
foreach $table ( keys %uselessfields ) {
my @fields = split /,/,$uselessfields{$table};
my $fields;
my $exists;
foreach my $fieldtodrop (@fields) {
$fieldtodrop =~ s/\t//g;
$fieldtodrop =~ s/\n//g;
print "deleting $fieldtodrop field in $table...\n" unless $silent;
my $sth = $dbh->prepare("alter table $table drop $fieldtodrop");
$exists =0;
$sth = $dbh->prepare("show columns from $table");
$sth->execute;
if ( $sth->err ) {
print "Error : $sth->errstr \n";
$sth->finish;
} # if error
while ( my ( $column, $type, $null, $key, $default, $extra ) = $sth->fetchrow )
{
$exists =1 if ($column eq $fieldtodrop);
}
if ($exists) {
print "deleting $fieldtodrop field in $table...\n" unless $silent;
my $sth = $dbh->prepare("alter table $table drop $fieldtodrop");
$sth->execute;
}
}
} # foreach
@ -1306,6 +1387,12 @@ $sth->finish;
exit;
# $Log$
# Revision 1.92 2004/08/06 16:38:42 tipaul
# changing DB structure to calculate next issue number.
# Seems to work fine.
#
# Still misses the date calculation & the test of end of subscription (maybe for monday ?)
#
# Revision 1.91 2004/07/15 09:52:28 tipaul
# Acquisition & Suggestion :
# * acquisition rewritte : create a aqbasket table to deal with "bookseller order header".