Fix for Bug 4932, Serial Enumeration / chronology not populated on receive

- Correcting JavaScript so that serial enumeration / chronology is always
  prepopulated in the add item form when receiving a new issue.
- Altering the behavior of the "click to add item" link so that the
  "Arrived" option is automatically selected. This makes the link's
  behavior mirror the <select>'s behavior so that Arrived -> Add item
  and Add item -> Arrived.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
Owen Leonard 2010-07-02 10:02:44 -04:00 committed by Galen Charlton
parent c9b59307b2
commit 8ef86f1875

View file

@ -81,6 +81,9 @@ function HideItems(index,labelindex) {
label = document.getElementById(labelindex);
label.style.display='block';
}
function setStatus(serialid){
$("#status"+serialid).val("2").attr("selected","selected");
}
function changeDate(adate) {
var elem = document.getElementById("expecteddate");
elem.value = adate;
@ -224,7 +227,7 @@ 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"-->'); 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" -->')}" >
<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" -->'); 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" -->" onchange="if (this.value==2 || this.value==7){changeDate('<!-- TMPL_VAR NAME="arriveddate" -->')} else {changeDate('<!-- TMPL_VAR NAME="planneddate" -->')}" >
<!--/TMPL_IF-->
@ -273,7 +276,7 @@ function CloneSubfield(index){
<!--TMPL_IF Name="serialsadditems"-->
<tr>
<td colspan="5">
<a id="label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->" style="color: grey; font-size: 80%; cursor: pointer;" onclick="unHideItems('items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->','label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->', '<!--TMPL_VAR Name="serialid"-->')">
<a id="label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->" style="color: grey; font-size: 80%; cursor: pointer;" onclick="unHideItems('items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->','label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->', '<!--TMPL_VAR Name="serialid"-->');setStatus(<!-- TMPL_VAR NAME="serialid" -->);">
Click to add item</a>
<fieldset class="rows" style="display:none;" id="items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->">
<legend><a style="cursor: pointer;" onclick="HideItems('items<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->','label<!-- TMPL_VAR NAME="subscriptionid" --><!--TMPL_VAR Name="serialid"-->')">