<!--TMPL_IF Name="history"-->
<div id="subscription_form_history">
<h2>Subscription history</h2>
- <table>
- <tr>
- <td>Subscription start date</td>
- <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (start date of the 1st subscription)</td>
- </tr>
- <tr>
- <td>Subscription end date</td>
- <td><input type="text" name="enddate" value="<!-- TMPL_VAR name="enddate" -->" />(if empty, subscription is still active)</td>
- </tr>
- <tr>
- <td>Received issues</td>
- <td><textarea name="recievedlist" cols="60" rows="5" disabled="true" ><!-- TMPL_VAR name="recievedlist" --></textarea></td>
- </tr>
- <tr>
- <td>Missing issues</td>
- <td><textarea name="missinglist" cols="60" rows="5" disabled="true"><!-- TMPL_VAR name="missinglist" --></textarea></td>
- </tr>
- </table>
+ <form method="post" action="/cgi-bin/koha/serials/subscription-add.pl">
+ <input type="hidden" name="op" value="modsubscription" />
+ <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR name="subscriptionid" -->" />
+ <input type="hidden" name="history_only" value="1" />
+ <p>Hint : you can update the serial history manually. This can be useful for an old subscription or to clean the existing history. Modify those fields with care, as future serial recieve will continue to update them automatically.</p>
+ <table>
+ <tr>
+ <td>Subscription start date</td>
+ <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->" /> (start date of the 1st subscription)</td>
+ </tr>
+ <tr>
+ <td>Subscription end date</td>
+ <td><input type="text" name="histenddate" value="<!-- TMPL_VAR name="histenddate" -->" />(if empty, subscription is still active)</td>
+ </tr>
+ <tr>
+ <td>Received issues</td>
+ <td><textarea name="recievedlist" cols="60" rows="5"><!-- TMPL_VAR name="recievedlist" --></textarea></td>
+ </tr>
+ <tr>
+ <td>Missing issues</td>
+ <td><textarea name="missinglist" cols="60" rows="5"><!-- TMPL_VAR name="missinglist" --></textarea></td>
+ </tr>
+ <tr>
+ <td>Note for OPAC</td>
+ <td><textarea name="opacnote" cols="60" rows="5"><!-- TMPL_VAR name="opacnote" --></textarea></td>
+ </tr>
+ <tr>
+ <td>Note for staff</td>
+ <td><textarea name="librariannote" cols="60" rows="5"><!-- TMPL_VAR name="librariannote" --></textarea></td>
+ </tr>
+ </table>
+ <input type="submit" value="Save subscription history" />
+ </form>
</div>
<!--/TMPL_IF-->
<div id="subscription_summary">
<h2>Subscription summary</h2>
<table cellpadding="0" cellspacing="0">
- <tr>
- <td><label>Start date</label></td>
- <td> <!-- TMPL_VAR name="startdate" --> </td>
- </tr>
- <tr>
- <td><label>End date</label></td>
- <td> <!-- TMPL_VAR name="enddate" --></td>
- </tr>
- <tr><td><label>Received issues</label></td><td><!-- TMPL_VAR name="recievedlist" --></td></tr>
- <tr><td><label>Missing issues</label></td><td><!-- TMPL_VAR name="missinglist" --></td></tr>
- <tr><td><label>Nonpublic note</label></td><td><!-- TMPL_VAR name="librariannote" --></td></tr>
- <tr><td><label>Public note</label></td><td><!-- TMPL_VAR name="opacnote" --></td></tr>
+ <tr>
+ <td><label>Start date</label></td>
+ <td> <!-- TMPL_VAR name="startdate" --> </td>
+ </tr>
+ <tr>
+ <td><label>End date</label></td>
+ <td> <!-- TMPL_VAR name="enddate" --></td>
+ </tr>
+ <tr>
+ <td><label>History start date</label></td>
+ <td> <!-- TMPL_VAR name="histstartdate" --> </td>
+ </tr>
+ <tr>
+ <td><label>History end date</label></td>
+ <td> <!-- TMPL_VAR name="histenddate" --></td>
+ </tr>
+ <tr><td><label>Received issues</label></td><td><!-- TMPL_VAR name="recievedlist" --></td></tr>
+ <tr><td><label>Missing issues</label></td><td><!-- TMPL_VAR name="missinglist" --></td></tr>
+ <tr><td><label>Nonpublic note</label></td><td><!-- TMPL_VAR name="librariannote" --></td></tr>
+ <tr><td><label>Public note</label></td><td><!-- TMPL_VAR name="opacnote" --></td></tr>
</table>
</div>
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");
}
- for (qw(startdate firstacquidate histstartdate enddate)) {
- $subs->{$_} = format_date($subs->{$_}) if $subs->{$_};
+ for (qw(startdate firstacquidate histstartdate enddate histenddate)) {
+ if ($subs->{$_} eq '0000-00-00') {
+ $subs->{$_} = ''
+ } else {
+ $subs->{$_} = format_date($subs->{$_});
+ }
}
$subs->{'letter'}='' unless($subs->{'letter'});
$irregularity = $subs->{'irregularity'};
my $letter = $query->param('letter');
my $manualhistory = $query->param('manualhist');
my $enddate = $query->param('enddate');
+ # subscription history
+ my $histenddate = format_date_in_iso($query->param('histenddate'));
+ warn "HIST END : $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');
- &ModSubscription(
- $auser, $branchcode, $aqbooksellerid, $cost,
- $aqbudgetid, $startdate, $periodicity, $firstacquidate,
- $dow, $irregularity, $numberpattern, $numberlength,
- $weeklength, $monthlength, $add1, $every1,
- $whenmorethan1, $setto1, $lastvalue1, $innerloop1,
- $add2, $every2, $whenmorethan2, $setto2,
- $lastvalue2, $innerloop2, $add3, $every3,
- $whenmorethan3, $setto3, $lastvalue3, $innerloop3,
- $numberingmethod, $status, $biblionumber, $callnumber,
- $notes, $letter, $hemisphere, $manualhistory,$internalnotes,
- $subscriptionid);
-
- ModSubscriptionHistory ($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
+ my $history_only = $query->param('history_only');
+ if ($history_only) {
+ ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote);
+ } else {
+ &ModSubscription(
+ $auser, $branchcode, $aqbooksellerid, $cost,
+ $aqbudgetid, $startdate, $periodicity, $firstacquidate,
+ $dow, $irregularity, $numberpattern, $numberlength,
+ $weeklength, $monthlength, $add1, $every1,
+ $whenmorethan1, $setto1, $lastvalue1, $innerloop1,
+ $add2, $every2, $whenmorethan2, $setto2,
+ $lastvalue2, $innerloop2, $add3, $every3,
+ $whenmorethan3, $setto3, $lastvalue3, $innerloop3,
+ $numberingmethod, $status, $biblionumber, $callnumber,
+ $notes, $letter, $hemisphere, $manualhistory,$internalnotes,
+ $subscriptionid);
+ }
print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
} else {