[Koha-patches] [PATCH] Bug 3928: Modification of date for serials.
Chris Cormack
chris at bigballofwax.co.nz
Tue May 11 10:10:58 CEST 2010
From: J. David Bavousett <dbavousett at ptfs.com>
When a serial status is changed to "Arrived" or "Claimed", the "Expected on"
date is changed to the current date.
A bit of rewriting to get it to apply on master - chris at bigballowax.co.nz
---
.../prog/en/modules/serials/serials-edit.tmpl | 10 +++++++---
serials/serials-edit.pl | 3 +++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl
index 6548174..774247f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tmpl
@@ -81,6 +81,10 @@ function HideItems(index,labelindex) {
label = document.getElementById(labelindex);
label.style.display='block';
}
+function changeDate(adate) {
+ var elem = document.getElementById("expecteddate");
+ elem.value = adate;
+}
function CloneSubfield(index){
var original = document.getElementById(index); //original <div>
var clone = original.cloneNode(true);
@@ -210,7 +214,7 @@ function CloneSubfield(index){
<input type="text" name="publisheddate" value="<!-- TMPL_VAR name="publisheddate" -->" size="10" maxlength="15" />
</td>
<td>
- <input type="text" name="planneddate" value="<!-- TMPL_VAR name="planneddate" -->" size="10" maxlength="15" />
+ <input type="text" id="expecteddate" name="planneddate" value="<!-- TMPL_VAR name="planneddate" -->" size="10" maxlength="15" />
</td>
<td>
<!--TMPL_IF name="editdisable"-->
@@ -218,9 +222,9 @@ function CloneSubfield(index){
<select name="status" size="1" disabled="disabled">
<!--TMPL_ELSE-->
<!--TMPL_IF Name="serialsadditems"-->
- <select name="status" size="1" id="status<!-- TMPL_VAR NAME="serialid" -->" onchange="if (this.value==2){unHideItems('items'+<!-- TMPL_VAR NAME="subscriptionid" -->+<!-- TMPL_VAR NAME="serialid" -->,'label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->', '<!--TMPL_VAR Name="serialid"-->')} else { HideItems('items'+<!-- TMPL_VAR NAME="subscriptionid" -->+<!-- TMPL_VAR NAME="serialid" -->,'label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->')}" >
+ <select name="status" size="1" id="status<!-- TMPL_VAR NAME="serialid" -->" onchange="if (this.value==2){unHideItems('items'+<!-- TMPL_VAR NAME="subscriptionid" -->+<!-- TMPL_VAR NAME="serialid" -->,'label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->'); changeDate('<!-- TMPL_VAR NAME="arriveddate" -->')} else if (this.value==7){changeDate('<!-- TMPL_VAR NAME="arriveddate" -->')} else { HideItems('items'+<!-- TMPL_VAR NAME="subscriptionid" -->+<!-- TMPL_VAR NAME="serialid" -->,'label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->'); changeDate('<!-- TMPL_VAR NAME="planneddate" -->')}" >
<!--TMPL_ELSE -->
- <select name="status" size="1" id="status<!-- TMPL_VAR NAME="serialid" -->" >
+ <select name="status" size="1" id="status<!-- TMPL_VAR NAME="serialid" -->" onchange="if (this.value==2 || this.value==7){changeDate('<!-- TMPL_VAR NAME="arriveddate" -->')} else {changeDate('<!-- TMPL_VAR NAME="planneddate" -->')}" >
<!--/TMPL_IF-->
<!--/TMPL_IF-->
<!--TMPL_IF name="status1" -->
diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl
index 3e2a852..bd7d420 100755
--- a/serials/serials-edit.pl
+++ b/serials/serials-edit.pl
@@ -121,6 +121,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my @serialdatalist;
my %processedserialid;
+
+my $today = C4::Dates->new();
foreach my $tmpserialid (@serialids) {
#filtering serialid for duplication
@@ -132,6 +134,7 @@ foreach my $tmpserialid (@serialids) {
my $data = GetSerialInformation($tmpserialid);
$data->{publisheddate} = format_date( $data->{publisheddate} );
$data->{planneddate} = format_date( $data->{planneddate} );
+ $data->{arriveddate}=$today->output('us');
$data->{'editdisable'} = (
(
HasSubscriptionExpired( $data->{subscriptionid} )
--
1.6.3.3
More information about the Koha-patches
mailing list