$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
- $numberingmethod, $status, $biblionumber,
+ $numberingmethod, $status, $biblionumber,
$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory,$serialsadditems, $location);
my @budgets;
my $sub_on;
my @subscription_types = (
'issues', 'weeks', 'months'
- );
+ );
my @sub_type_data;
my $subs;
if ($subs->{'cannotedit'} && $op eq 'mod'){
warn "Attempt to modify subscription $subscriptionid by ".C4::Context->userenv->{'id'}." not allowed";
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
- }
+ }
$firstissuedate = $subs->{firstacquidate}; # in iso format.
for (qw(startdate firstacquidate histstartdate enddate histenddate)) {
next unless defined $subs->{$_};
if ($subs->{$_} eq '0000-00-00') {
$subs->{$_} = ''
} else {
- $subs->{$_} = format_date($subs->{$_});
+ $subs->{$_} = format_date($subs->{$_});
}
}
$subs->{'letter'}='' unless($subs->{'letter'});
$nextexpected->{'isfirstissue'} = $nextexpected->{planneddate}->output('iso') eq $firstissuedate ;
$subs->{nextacquidate} = $nextexpected->{planneddate}->output() if($op eq 'mod');
unless($op eq 'modsubscription') {
- if($subs->{numberlength} > 0){
- $sublength = $subs->{numberlength};
- $sub_on = $subscription_types[0];
- } elsif ($subs->{weeklength}>0){
- $sublength = $subs->{weeklength};
- $sub_on = $subscription_types[1];
- } else {
- $sublength = $subs->{monthlength};
- $sub_on = $subscription_types[2];
- }
- while (@subscription_types) {
- my $sub_type = shift @subscription_types;
- my %row = ( 'name' => $sub_type );
- if ( $sub_on eq $sub_type ) {
- $row{'selected'} = ' selected';
- } else {
- $row{'selected'} = '';
- }
- push( @sub_type_data, \%row );
- }
-
+ foreach my $length_unit qw(numberlength weeklength monthlength){
+ if ($subs->{$length_unit}){
+ $sublength=$subs->{$length_unit};
+ $sub_on=$length_unit;
+ last;
+ }
+ }
+
$template->param($subs);
$template->param("dow".$subs->{'dow'} => 1) if defined $subs->{'dow'};
$template->param(
$op => 1,
- subtype => \@sub_type_data,
+ "subtype_$sub_on" => 1,
sublength =>$sublength,
- history => ($op eq 'mod' && $subs->{manualhistory} == 1 ),
+ history => ($op eq 'mod'),
"periodicity".$subs->{'periodicity'} => 1,
"numberpattern".$subs->{'numberpattern'} => 1,
firstacquiyear => substr($firstissuedate,0,4),
}
}
-my $onlymine=C4::Context->preference('IndependantBranches') &&
- C4::Context->userenv &&
- C4::Context->userenv->{flags}!=1 &&
+my $onlymine=C4::Context->preference('IndependantBranches') &&
+ C4::Context->userenv &&
+ C4::Context->userenv->{flags} % 2 !=1 &&
C4::Context->userenv->{branch};
my $branches = GetBranches($onlymine);
my @branchloop;
my $branchcode = $query->param('branchcode');
my $aqbooksellerid = $query->param('aqbooksellerid');
my $cost = $query->param('cost');
- my $aqbudgetid = $query->param('aqbudgetid');
+ my $aqbudgetid = $query->param('aqbudgetid');
my $startdate = $query->param('startdate');
- my $firstacquidate = $query->param('firstacquidate');
+ my $firstacquidate = $query->param('firstacquidate');
my $periodicity = $query->param('periodicity');
my $dow = $query->param('dow');
my @irregularity = $query->param('irregularity_select');
my $internalnotes = $query->param('internalnotes');
my $hemisphere = $query->param('hemisphere') || 1;
my $letter = $query->param('letter');
- # ## BugFIX : hdl doesnot know what innerloops or letter stand for but it seems necessary. So he adds them.
my $manualhistory = $query->param('manualhist');
my $serialsadditems = $query->param('serialsadditems');
my $staffdisplaycount = $query->param('staffdisplaycount');
my $opacdisplaycount = $query->param('opacdisplaycount');
my $location = $query->param('location');
+ my $startdate = format_date_in_iso($query->param('startdate'));
+ my $enddate = format_date_in_iso($query->param('enddate'));
+ my $firstacquidate = format_date_in_iso($query->param('firstacquidate'));
+ my $histenddate = format_date_in_iso($query->param('histenddate'));
+ my $histstartdate = format_date_in_iso($query->param('histstartdate'));
+ my $recievedlist = $query->param('recievedlist');
+ my $missinglist = $query->param('missinglist');
+ my $opacnote = $query->param('opacnote');
+ my $librariannote = $query->param('librariannote');
my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",",@irregularity),
$numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
- $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location
+ $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate
);
+ ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
} elsif ($op eq 'modsubscription') {
my $biblionumber = $query->param('biblionumber');
my $aqbudgetid = $query->param('aqbudgetid');
my $startdate = format_date_in_iso($query->param('startdate'));
+ my $enddate = format_date_in_iso($query->param('enddate'));
my $nextacquidate = $query->param('nextacquidate') ?
format_date_in_iso($query->param('nextacquidate')):
format_date_in_iso($query->param('startdate'));
+ my $enddate = format_date_in_iso($query->param('enddate'));
my $periodicity = $query->param('periodicity');
my $dow = $query->param('dow');
my $sublength = $query->param('sublength');
my $hemisphere = $query->param('hemisphere');
my $letter = $query->param('letter');
my $manualhistory = $query->param('manualhist');
- my $enddate = $query->param('enddate');
my $serialsadditems = $query->param('serialsadditems');
# subscription history
my $histenddate = format_date_in_iso($query->param('histenddate'));
my $missinglist = $query->param('missinglist');
my $opacnote = $query->param('opacnote');
my $librariannote = $query->param('librariannote');
- my $history_only = $query->param('history_only');
my $staffdisplaycount = $query->param('staffdisplaycount');
my $opacdisplaycount = $query->param('opacdisplaycount');
my $graceperiod = $query->param('graceperiod') || 0;
# if we have not received any issues yet, then we also must change the firstacquidate for the subs.
$firstissuedate = $nextacquidate if($nextexpected->{isfirstissue});
}
-
- if ($history_only) {
- ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
- } else {
+
&ModSubscription(
$auser, $branchcode, $aqbooksellerid, $cost,
$aqbudgetid, $startdate, $periodicity, $firstissuedate,
$whenmorethan3, $setto3, $lastvalue3, $innerloop3,
$numberingmethod, $status, $biblionumber, $callnumber,
$notes, $letter, $hemisphere, $manualhistory,$internalnotes,
- $serialsadditems, $subscriptionid,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location
+ $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid
);
- }
+ ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
} else {
-
while (@subscription_types) {
my $sub_type = shift @subscription_types;
my %row = ( 'name' => $sub_type );
$row{'selected'} = '';
}
push( @sub_type_data, \%row );
- }
+ }
$template->param(subtype => \@sub_type_data,
);
+ letter_loop('', $template);
+
my $new_biblionumber = $query->param('biblionumber_for_new_subscription');
if (defined $new_biblionumber) {
my $bib = GetBiblioData($new_biblionumber);
};
}
$template->param(letterloop => \@letterloop) if @letterloop;
+ return;
}
-