koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/Serials.pm koha-tmpl/intranet-tmpl/prog... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/Serials.pm koha-tmpl/intranet-tmpl/prog... [rel_3_0]
Date: Wed, 06 Sep 2006 12:57:42 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      06/09/06 12:57:42

Modified files:
        C4             : Serials.pm 
        koha-tmpl/intranet-tmpl/prog/en/serials: subscription-add.tmpl 
                                                 subscription-detail.tmpl 
        serials        : acqui-search.pl subscription-add.pl 
                         subscription-bib-search.pl 
                         subscription-detail.pl 

Log message:
        Bug Fixing serials :
        Some functions had old names.
        Calendars couldnot work.
        
        Still to be done updatedatabase must be updated so that routing list 
tables are added, firstacquidate and routing notes are added to subscription 
table.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5&r2=1.5.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3&r2=1.3.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3&r2=1.3.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/serials/acqui-search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.4&r2=1.4.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-add.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6&r2=1.6.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-bib-search.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3&r2=1.3.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3&r2=1.3.2.1

Patches:
Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -b -r1.5 -r1.5.2.1
--- C4/Serials.pm       11 Aug 2006 14:35:10 -0000      1.5
+++ C4/Serials.pm       6 Sep 2006 12:57:41 -0000       1.5.2.1
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Serials.pm,v 1.5 2006/08/11 14:35:10 tipaul Exp $
+# $Id: Serials.pm,v 1.5.2.1 2006/09/06 12:57:41 hdl Exp $
 
 use strict;
 use C4::Date;
@@ -31,7 +31,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.5 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.1 $' =~ /\d+/g;
         shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 
@@ -52,15 +52,34 @@
 =cut
 @ISA = qw(Exporter);
 @EXPORT = qw(
-    &NewSubscription &ModSubscription &DelSubscription &GetSubscriptions 
&GetSubscription
-    &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber
-    &GetFullSubscriptionsFromBiblionumber &GetNextSeq
-    &ModSubscriptionHistory &NewIssue &ItemizeSerials
-    &GetSerials &GetLatestSerials &ModSerialStatus
-    &HasSubscriptionExpired &GetSubscriptionExpirationDate &ReNewSubscription
-    &GetSuppliersWithLateIssues &GetLateIssues &GetMissingIssues
-    &GetDistributedTo &SetDistributedto &serialchangestatus
-    &getroutinglist &delroutingmember &addroutingmember &reorder_members
+    &NewSubscription 
+    &ModSubscription
+    &DelSubscription
+    &GetSubscriptions
+    &GetSubscription
+    &CountSubscriptionFromBiblionumber
+    &GetSubscriptionsFromBiblionumber
+    &GetFullSubscriptionsFromBiblionumber
+    &GetNextSeq
+    &ModSubscriptionHistory
+    &NewIssue
+    &ItemizeSerials
+    &GetSerials
+    &GetLatestSerials
+    &ModSerialStatus
+    &HasSubscriptionExpired
+    &GetSubscriptionExpirationDate
+    &ReNewSubscription
+    &GetSuppliersWithLateIssues
+    &GetLateIssues
+    &GetMissingIssues
+    &GetDistributedTo
+    &SetDistributedTo
+    &serialchangestatus
+    &getroutinglist
+    &delroutingmember
+    &addroutingmember
+    &reorder_members
     &check_routing &getsupplierbyserialid &updateClaim &removeMissingIssue 
&abouttoexpire
     &old_newsubscription &old_modsubscription &old_getserials &Get_Next_Date
 );
@@ -1799,7 +1818,7 @@
 sub abouttoexpire { 
     my ($subscriptionid) = @_;
     my $dbh = C4::Context->dbh;
-    my $subscription = getsubscription($subscriptionid);
+    my $subscription = GetSubscription($subscriptionid);
     # we don't do the same test if the subscription is based on X numbers or 
on X weeks/months
     if ($subscription->{numberlength}) {
        my $sth = $dbh->prepare("select count(*) from serial where 
subscriptionid=?  and planneddate>=?");
@@ -1892,7 +1911,7 @@
                                                    $numberingmethod, 
$status,$callnumber, $notes, $hemisphere);
         #then create the 1st waited number
         my $subscriptionid = $dbh->{'mysql_insertid'};
-        my $enddate = subscriptionexpirationdate($subscriptionid);
+        my $enddate = GetSubscriptionExpirationDate($subscriptionid);
 
         $sth = $dbh->prepare("insert into subscriptionhistory (biblionumber, 
subscriptionid, histstartdate, enddate, missinglist, recievedlist, opacnote, 
librariannote) values (?,?,?,?,?,?,?,?)");
         $sth->execute($biblionumber, $subscriptionid, 
format_date_in_iso($startdate), format_date_in_iso($enddate), "", "", "", 
$notes);
@@ -1902,7 +1921,7 @@
         my $val = $sth->fetchrow_hashref;
 
         # calculate issue number
-        my $serialseq = Get_Seq($val);
+        my $serialseq = GetSeq($val);
         $sth = $dbh->prepare("insert into serial 
(serialseq,subscriptionid,biblionumber,status, planneddate) values 
(?,?,?,?,?)");
         $sth->execute($serialseq, $subscriptionid, $val->{'biblionumber'}, 1, 
format_date_in_iso($startdate));
         return $subscriptionid;
@@ -2138,8 +2157,6 @@
     #    warn "date: ".$resultdate;
     return format_date_in_iso($resultdate);
 }
-
-
 END { }       # module clean-up code here (global destructor)
 
 1;

Index: koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl       12 Jul 
2006 12:29:03 -0000      1.3
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl       6 Sep 
2006 12:57:42 -0000       1.3.2.1
@@ -1,53 +1,712 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit<!-- 
TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit<!--
+TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-serials.inc" -->
+<!--TMPL_INCLUDE NAME="menu-serials.inc" -->
 
-<!--------------------------MAIN BODY OF PAGE-------------------------->
+<!-- Additions to enable Calendar system -->
+<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-system.css">
+<!-- End of additions -->
+
+<style type="text/css">
+<!--
+
+#bloc25 {
+       border: 1px solid #666666;
+       margin-bottom: 5px;
+}
+-->
+</style>
+<!-- Additions to enable Calendar system -->
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-en.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-setup.js"></script>
+<!-- End of additions -->
+
+<script type="text/javascript" language="javascript">
+<!--
+// the english words used in display purposes
+var text = new Array('Number','Volume','Issue','Month','Week','Starting 
with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
+'Autumn','Winter','Spring','Summer','Fall','Season','Year');
+var is_season = 0;
+var is_hemisphere = 1;
+
+// common pre defined number patterns
+function num_pattern() {
+var patternchoice = document.getElementById("numberpattern").value;
+       switch(patternchoice){
+       case "2":
+               document.f.add1.value=1;
+               document.f.add2.value=1;
+               document.f.add3.value=1;
+               document.f.every1.value=12;
+               document.f.every2.value=1;
+               document.f.every3.value=1;
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value=12;
+               document.f.whenmorethan3.value=4;
+               document.f.setto1.value=0;
+               document.f.setto2.value=1;
+               document.f.setto3.value=1;
+               document.f.lastvalue1.value=1;
+               document.f.lastvalue2.value=1;
+               document.f.lastvalue3.value=1;
+               document.f.numberingmethod.value='Vol {X}, No {Y}, Issue {Z}';
+               moreoptions(text[1],text[0],text[2]);
+               display_table(0); // toggle info box on (1) or off (0)
+               break;
+       case "3":
+               document.f.add1.value=1;
+               document.f.add2.value=1;
+               document.f.add3.value='';
+               document.f.every1.value=12;
+               document.f.every2.value=1;
+               document.f.every3.value='';
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value=12;
+               document.f.whenmorethan3.value='';
+               document.f.setto1.value=0;
+               document.f.setto2.value=1;
+               document.f.setto3.value='';
+               document.f.lastvalue1.value=1;
+               document.f.lastvalue2.value=1;
+               document.f.lastvalue3.value='';
+               document.f.numberingmethod.value='Vol {X}, No {Y}';
+               moreoptions(text[1],text[0]);
+               display_table(0);
+               break;
+       case "4":
+               document.f.add1.value=1;
+               document.f.add2.value=1;
+               document.f.add3.value='';
+               document.f.every1.value=12;
+               document.f.every2.value=1;
+               document.f.every3.value='';
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value=12;
+               document.f.whenmorethan3.value='';
+               document.f.setto1.value=0;
+               document.f.setto2.value=1;
+               document.f.setto3.value='';
+               document.f.lastvalue1.value=1;
+               document.f.lastvalue2.value=1;
+               document.f.lastvalue3.value='';
+               document.f.numberingmethod.value='Vol {X}, Issue {Y}';
+               moreoptions(text[1],text[2]);
+               display_table(0);
+               break;
+       case "5":
+               document.f.add1.value=1;
+               document.f.add2.value=1;
+               document.f.add3.value='';
+               document.f.every1.value=12;
+               document.f.every2.value=1;
+               document.f.every3.value='';
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value=12;
+               document.f.whenmorethan3.value='';
+               document.f.setto1.value=0;
+               document.f.setto2.value=1;
+               document.f.setto3.value='';
+               document.f.lastvalue1.value=1;
+               document.f.lastvalue2.value=1;
+               document.f.lastvalue3.value='';
+               document.f.numberingmethod.value='No {X}, Issue {Y}';
+               moreoptions(text[0],text[2]);
+               display_table(0);
+               break;
+       case "6":
+               var d = new Date();
+               var sYear = d.getFullYear();
+               document.f.add1.value=1;
+               document.f.add2.value='1';
+               document.f.add3.value='';
+               document.f.every1.value=4;
+               document.f.every2.value='1';
+               document.f.every3.value='';
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value='4';
+               document.f.whenmorethan3.value='';
+               document.f.setto1.value=0;
+               document.f.setto2.value='1';
+               document.f.setto3.value='';
+               document.f.lastvalue1.value=sYear;
+               document.f.lastvalue2.value='1';
+               document.f.lastvalue3.value='';
+               document.f.periodicity.value='8';
+               document.f.numberingmethod.value='{Y} {X}';
+               moreoptions_seasons(text[15],sYear);
+               display_table(0);
+               is_season = 1;
+               break;
+       case "7":
+               display_table(1);
+               document.f.irreg_check.value=1; 
+               break;
+       default:
+               document.f.add1.value=1;
+               document.f.add2.value='';
+               document.f.add3.value='';
+               document.f.every1.value=1;
+               document.f.every2.value='';
+               document.f.every3.value='';
+               document.f.whenmorethan1.value=9999999;
+               document.f.whenmorethan2.value='';
+               document.f.whenmorethan3.value='';
+               document.f.setto1.value=0;
+               document.f.setto2.value='';
+               document.f.setto3.value='';
+               document.f.lastvalue1.value=1;
+               document.f.lastvalue2.value='';
+               document.f.lastvalue3.value='';
+               document.f.numberingmethod.value='{X}';
+               moreoptions_daily_check(text[0]);
+               document.f.irreg_check.value=1;
+               display_table(0);
+               break;
+       }
+}
+
+function display_table(n) {
+       if(n==1){
+               document.getElementById("basetable").style.display = 'block';
+       } else {
+               document.getElementById("basetable").style.display = 'none';
+       }
+}
+
+function modify_num_pattern() {
+       document.getElementById("numberpattern").value = '<!-- TMPL_VAR 
NAME="numberpattern" -->';
+       num_pattern();
+       
+       document.f.add1.value='<!-- TMPL_VAR NAME="add1" -->';
+       document.f.add2.value='<!-- TMPL_VAR NAME="add2" -->';
+       document.f.add3.value='<!-- TMPL_VAR NAME="add3" -->';
+       document.f.every1.value='<!-- TMPL_VAR NAME="every1" -->';
+       document.f.every2.value='<!-- TMPL_VAR NAME="every2" -->';
+       document.f.every3.value='<!-- TMPL_VAR NAME="every3" -->';
+       document.f.whenmorethan1.value='<!-- TMPL_VAR NAME="whenmorethan1" -->';
+       document.f.whenmorethan2.value='<!-- TMPL_VAR NAME="whenmorethan2" -->';
+       document.f.whenmorethan3.value='<!-- TMPL_VAR NAME="whenmorethan3" -->';
+       document.f.setto1.value='<!-- TMPL_VAR NAME="setto1" -->';
+       document.f.setto2.value='<!-- TMPL_VAR NAME="setto2" -->';
+       document.f.setto3.value='<!-- TMPL_VAR NAME="setto3" -->';
+       document.f.lastvalue1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
+       document.f.lastvalue2.value='<!-- TMPL_VAR NAME="lastvalue2" -->';
+       document.f.lastvalue3.value='<!-- TMPL_VAR NAME="lastvalue3" -->';
+       document.f.numberingmethod.value='<!-- TMPL_VAR NAME="numberingmethod" 
-->';
+
+       var more_strY;
+       var more_strZ;
+       <!-- TMPL_IF NAME="add2" -->
+       if(<!-- TMPL_VAR NAME="add2" --> > 0){
+               more_strY="Y";
+       }
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF NAME="add3" -->
+       if(<!-- TMPL_VAR NAME="add3" --> > 0){
+               more_strZ="Z";
+       }
+       <!-- /TMPL_IF -->
+
+       document.f.lastvaluetemp1.value='<!-- TMPL_VAR NAME="lastvalue1" -->';
+       if(more_strY){
+               document.f.lastvaluetemp2.value='<!-- TMPL_VAR 
NAME="lastvalue2" -->';
+       document.f.whenmorethantemp2.value='<!-- TMPL_VAR NAME="whenmorethan2" 
-->';
+       }
+       if(more_strZ){
+               document.f.lastvaluetemp3.value='<!-- TMPL_VAR 
NAME="lastvalue3" -->';
+       document.f.whenmorethantemp3.value='<!-- TMPL_VAR NAME="whenmorethan3" 
-->';
+       }
+}
+
+// a pre check with more options to see if 'number' and '1/day' are chosen
+function moreoptions_daily_check(x) {
+       var periodicity = document.f.periodicity.value;
+       var errortext='';
+       if(periodicity == 1){
+               document.getElementById("irregularity").innerHTML = '';
+               document.getElementById("more_options").innerHTML = '';
+               var daynames = new 
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+               errortext ="Please indicate which days of the week you <b>DO 
NOT<\/b> expect to receive issues.<br \/>";
+               for(var j=0;j<daynames.length;j++){
+                       errortext +="<input type='checkbox' name='irregular' 
id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" &nbsp; ";
+               }
+       var error = errortext;
+       document.getElementById("irregularity").innerHTML = error;
+       } else {
+               document.getElementById("irregularity").innerHTML = '';
+               document.getElementById("more_options").innerHTML = '';
+               moreoptions(x);
+       }
+}
+
+// to dispaly the more options section
+function moreoptions(x,y,z){
+document.getElementById("irregularity").innerHTML = '';
+document.getElementById("more_options").innerHTML = '';
+var textbox = '';
+       // alert("X: "+x+"Y: "+y+"Z: "+z);
+       if(x){
+               textbox +="<table>\n<tr><td>&nbsp;<\/td><td>"+x+"<\/td>";
+               if(y){
+                       textbox +="<td>"+y+"<\/td>";
+                       if(z){
+                               textbox +="<td>"+z+"<\/td>";
+                       }
+               }
+               textbox +="<\/tr>\n";
+               textbox +="<tr><td>"+text[5]+"<\/td><td><input type='text' 
name='lastvaluetemp1' size='4' 
onkeyup='moreoptionsupdate(\"lastvalue1\")'><\/td>\n";
+               if(y){
+                       textbox +="<td><input type='text' name='lastvaluetemp2' 
size='4' onkeyup='moreoptionsupdate(\"lastvalue2\")'><\/td>\n";
+                       if(z){
+                               textbox +="<td><input type='text' 
name='lastvaluetemp3' size='4' 
onkeyup='moreoptionsupdate(\"lastvalue3\")'><\/td>\n";
+                       }
+               }
+               textbox +="<\/tr>\n";
+               if(y){
+                       textbox +="<tr><td>"+text[6]+"<\/td>";
+                       textbox +="<td><a 
href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
+                       textbox +="<td><input type='text' 
name='whenmorethantemp2' size='4' 
onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
+                       if(z){
+                               textbox +="<td><input type='text' 
name='whenmorethantemp3' size='4' 
onkeyup='moreoptionsupdate(\"whenmorethan3\",1)'><\/td>\n";
+                       }
+                       textbox +="<\/tr>";
+               }
+               textbox +="<\/table>\n";
+       }
+       document.getElementById("more_options").innerHTML = textbox;
+}
+
+function hemispheres(chosen){
+var selbox = document.getElementById("season1");
+    if(selbox){
+       var selboxselected = selbox.options[selbox.selectedIndex].value;
+       selbox.options.length = 0;
+
+       if (chosen == "1") {
+               selbox.options[selbox.options.length] = new 
Option(text[11],'1');
+               selbox.options[selbox.options.length] = new 
Option(text[12],'2');
+               selbox.options[selbox.options.length] = new 
Option(text[13],'3');
+               selbox.options[selbox.options.length] = new 
Option(text[14],'4');
+               is_hemisphere = 1;
+               selbox.options[selboxselected-1].selected = true;
+       }
+
+       if (chosen == "2") {
+               selbox.options[selbox.options.length] = new 
Option(text[13],'1');
+               selbox.options[selbox.options.length] = new 
Option(text[10],'2');
+               selbox.options[selbox.options.length] = new 
Option(text[11],'3');
+               selbox.options[selbox.options.length] = new 
Option(text[12],'4');
+               is_hemisphere = 2;
+               selbox.options[selboxselected-1].selected = true;
+       }
+    }
+}
+
+// to dispaly the more options section for seasons
+function moreoptions_seasons(x,y){
+document.getElementById("irregularity").innerHTML = '';
+document.getElementById("more_options").innerHTML = '';
+var textbox = '';
+       // alert("X: "+x+"Year: "+y);
+       if(x){
+               var hemi_select = parseInt('<!-- TMPL_VAR NAME="hemisphere" 
-->');
+               textbox +="<table>\n<tr><td>"+ text[7]  +"<\/td><td 
colspan='2'><select name='hemisphere' 
onchange='hemispheres(this.options[this.selectedIndex].value)'>";
+               for(var i = 1; i <= 2; i++){
+                       textbox +="<option value='"+i+"'";
+                       if(i == hemi_select){
+                               textbox += " selected "
+                       }
+                       textbox +=">"+text[i+7]+"<\/option>";
+               }
+               textbox +="<\/select><\/td><\/tr>\n";
+               textbox +="<tr><td>&nbsp;<\/td><td>"+x+"<\/td>";
+               textbox +="<td>"+text[16]+"<\/td>";
+               textbox +="<\/tr>\n";
+               textbox +="<tr><td>"+text[5]+"<\/td><td><select 
name='lastvaluetemp2' id='season1' 
onchange='moreoptionsupdate(\"lastvalue2\")'>";
+               for(var j = 1; j <= 4; j++){
+                       textbox +="<option 
value='"+j+"'>"+text[j+10]+"<\/option>";
+               }
+               textbox +="<\/select><\/td><td><select name='lastvaluetemp1' 
onchange='moreoptionsupdate(\"lastvalue1\")'>";
+               for(var k = parseInt(y); k <= parseInt(y)+15; k++){
+                       textbox +="<option value='"+k+"'>"+k+"<\/option>";
+               }
+               textbox +="<\/select><\/td><\/tr>\n";
+               textbox +="<tr><td>"+text[6]+"<\/td>";
+               textbox +="<td><a 
href='javascript:irregularity_check()'>Irregularity?<\/a><\/td>\n";
+               textbox +="<td><input type='text' name='whenmorethantemp2' 
size='4' onkeyup='moreoptionsupdate(\"whenmorethan2\",1)'><\/td>\n";
+               textbox +="<\/tr><\/table>\n";
+       }
+       document.getElementById("more_options").innerHTML = textbox;
+}
+
+function irregularity_check(){
+       document.f.irreg_check.value = 1; // Irregularity button now pushed
+       var periodicity = document.f.periodicity.value;
+       var rollover = document.f.whenmorethantemp2.value;
+       if(document.f.whenmorethantemp3){
+               rollover = document.f.whenmorethantemp3.value;
+       }
+       var error='';
+       var toobig;
+       var expected; 
+       var errortext = "<b>Warning irregularity detected<\/b><br \/>";
+       switch(periodicity){
+       case "1":
+               if(rollover < 365) expected =365;
+               if(rollover > 365) {
+                       expectedover=365;
+                       toobig=1;
+               }
+               break;
+       case "2":
+               if(rollover < 52) expected =52;
+               if(rollover > 52){
+                       expectedover=52;
+                       toobig=1;
+               }
+               break;
+       case "3":
+               if(rollover < 26) expected =26;
+               if(rollover > 26){
+                       expectedover=26;
+                       toobig=1;
+               }
+               break;
+       case "4":
+               if(rollover < 17) expected =17;
+               if(rollover > 17){
+                       expectedover=17;
+                       toobig=1;
+               }
+               break;
+       case "5":
+               if(rollover < 12) expected =12;
+               if(rollover > 12){
+                       expectedover=12;
+                       toobig=1;
+               }
+               break;
+       case "6":
+               if(rollover < 6) expected =6;
+               if(rollover > 6){
+                       expectedover=6;
+                       toobig=1;
+               }
+               break;
+       case "7":
+               if(rollover < 4) expected =4;
+               if(rollover > 4){
+                       expectedover=4;
+                       toobig=1;
+               }
+               break;
+       case "8":
+               if(rollover < 4) expected =4;
+               if(rollover > 4){
+                       expectedover=4;
+                       toobig=1;
+               }
+               break;
+       case "9":
+               if(rollover < 2) expected =2;
+               if(rollover > 2){
+                       expectedover=2;
+                       toobig=1;
+               }
+               break;
+       case "10":
+               if(rollover < 1) expected =1;
+               if(rollover > 1){
+                       expectedover=1;
+                       toobig=1;
+               }
+               break;
+       default:
+               break;
+       }
+       if(expected){
+               if(expected == 365){
+                       var daynames = new 
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+                       errortext +="Please indicate which days of the week you 
<b>DO NOT<\/b> expect to receive issues.<br \/>";
+                       for(var j=0;j<daynames.length;j++){
+                               errortext +="<input type='checkbox' 
name='irregular' id='irregular"+(j+1)+"' value='"+(j+1)+"' />"+daynames[j]+" 
&nbsp; ";
+                       }
+                       error=errortext;
+               } else {
+                       errortext +=expected+" issues expected "+rollover+" 
were entered. <br \/>Please indicate which date(s) an issue is not expected<br 
\/>";
+                       var count=0;
+                       for(var i=rollover;i<expected;i++){
+                               errortext +="<select name='irregular' 
id='irregular"+count+"' onchange='display_example(expected)'>\n";
+                               errortext +=irregular_options(periodicity);
+                               errortext +="<\/select>\n";
+                               count++;
+                       }
+                       error=errortext;
+               }
+       }
+       if(toobig){
+               errortext +=expectedover+" issues expected "+rollover+" were 
entered.<br \/> You seem to have indicated more issues per year than expected.";
+               error=errortext;
+       }
+       if(error.length ==0){
+               error='No irregularities noticed';
+       }
+       display_example(expected);
+       document.getElementById("irregularity").innerHTML = error;
+}
+
+function irregular_options(periodicity){
+       var titles;
+       var count;
+<!-- TMPL_IF NAME="weekarrayjs" -->
+       var weeks = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
+<!-- /TMPL_IF -->
+       var months = new 
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+       var seasons = new Array('Autumn','Winter','Spring','Summer','Fall');
+       var errortext='';
+       if(periodicity == 1) {
+               expected = 366;
+               titles = "Day";
+               count = 1;
+       }
+       if(periodicity == 2 || periodicity == 3 || periodicity == 4) { 
+               expected = 52;
+       <!-- TMPL_IF NAME="weekarrayjs" -->
+               titles = weeks;
+               count = <!-- TMPL_VAR NAME="weekno" -->;
+       <!-- TMPL_ELSE -->
+               titles = "Week";
+               count = 1;
+       <!-- /TMPL_IF -->
+       }
+       if(periodicity == 5 || periodicity == 6 || periodicity == 7 || 
periodicity == 8 || periodicity == 9) {
+               if(periodicity == 8) {
+                       is_season = 1; // setting up from edit page
+               } 
+               if(is_season){
+                       titles = seasons;
+                       expected = 4;
+                       if(is_hemisphere == 2){
+                               count = 2;
+                       } else {
+                               count = 1;
+                       }
+               } else {
+                       titles = months;
+                       expected = 12;
+                       count = 1;
+               }
+       }
+       for(var j=1;j<=expected;j++){
+               if(isArray(titles)){
+                       if(count>expected){
+                               count = count-expected;
+                       }
+                       if(is_season && is_hemisphere == 1){
+                               errortext +="<option 
value='"+((count*3)-2)+"'>"+titles[j]+"<\/option>\n";
+// alert("value: "+((count*3)-2)+" title: "+titles[j]);
+                       } else if(is_season && is_hemisphere == 2){
+                               errortext +="<option 
value='"+((count*3)-2)+"'>"+titles[j-1]+"<\/option>\n";
+// alert("value: "+((count*3)-2)+" title: "+titles[j-1]);
+                       } else {
+                               errortext +="<option 
value='"+count+"'>"+titles[j-1]+"<\/option>\n";
+                       }
+                       count++;
+               } else {
+                       errortext +="<option value='"+j+"'>"+titles+" 
"+j+"<\/option>\n";
+               }
+       }
+       return errortext;
+}
+
+function irregular_order(){
+       var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
+       var periodicity = document.f.periodicity.value;
+       var irregarray = irregular.split('|');
+       if(periodicity ==1){
+               for(j=0;j<irregarray.length;j++){
+               document.getElementById("irregular"+irregarray[j]).checked = 
true; 
+               }
+       } else {
+               for(i=0;i<irregarray.length;i++){    
+                       document.getElementById("irregular"+i).value = 
irregarray[i];
+               }
+       }
+}
+
+function display_example(expected){
+       var startfrom1 = parseInt(document.f.lastvalue1.value);
+       var startfrom2 = parseInt(document.f.lastvalue2.value);
+       var startfrom3 = parseInt(document.f.lastvalue3.value);
+       var every1 = parseInt(document.f.every1.value);
+       var every2 = parseInt(document.f.every2.value);
+       var every3 = parseInt(document.f.every3.value);
+       var numberpattern = document.f.numberingmethod.value;
+       var whenmorethan2 = parseInt(document.f.whenmorethan2.value);
+       var whenmorethan3 = parseInt(document.f.whenmorethan3.value);
+       var setto2 = parseInt(document.f.setto2.value);
+       var setto3 = parseInt(document.f.setto3.value);
+       var displaytext = 'Based on the information<br \/>entered the Numbering 
Pattern<br \/>will look like this<br \/>\n';
+       if(startfrom3>0){
+               var count=startfrom3-1;
+               var count2=startfrom2;
+               for(var i=0;i<12;i++){
+                       if(count>=whenmorethan3){
+                               count=setto3;
+                               if(count2>=whenmorethan2){
+                                       startfrom1++;
+                                       count2=setto2;
+                               } else {
+                                       count2++;
+                               }
+                       } else {
+                               count++;
+                       }
+                       displaytext += numberpattern.replace(/{Z}/,count)+'\n';
+                       displaytext = displaytext.replace(/{Y}/,count2)+'<br 
\/>\n';
+                       displaytext = 
displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
+
+               }
+       }
+       if(startfrom2>0 && !startfrom3){
+               var count=startfrom2-1;
+               for(var i=0;i<12;i++){
+                       if(count>=whenmorethan2){
+                               startfrom1++;
+                               count=setto2;
+                       } else {
+                               count++;
+                       }
+
+                       if(is_season){
+                               if(is_hemisphere == 2){
+                                       if(count == 1) {
+                                               displaytext += 
numberpattern.replace(/{Y}/,text[count+12])+'\n';
+                                       } else {
+                                               displaytext += 
numberpattern.replace(/{Y}/,text[count+8])+'\n';
+                                       }
+                               } else {
+                               displaytext += 
numberpattern.replace(/{Y}/,text[count+10])+'\n';
+                               }
+                       } else {
+                               displaytext += 
numberpattern.replace(/{Y}/,count)+'\n';
+                       }
+                       displaytext = 
displaytext.replace(/{X}/,startfrom1)+'<br \/>\n';
+               }
+       }
+       if(startfrom1>0 && !startfrom2 && !startfrom3){
+               for(var i=startfrom1;i<(startfrom1+12);i=i+(1*every1)){
+                       startfrom1 = i;
+                       displaytext += 
numberpattern.replace(/{X}/,startfrom1)+'<br \/>\n';
+               }
+       }
+       displaytext = "<div style='padding: 5px; background-color: 
#CCCCCC'>"+displaytext+"<\/div>";
+       document.getElementById("displayexample").innerHTML = displaytext;
+}
+
+function isArray(obj) {
+   if (obj.constructor.toString().indexOf("Array") == -1)
+      return false;
+   else
+      return true;
+}
+
+function moreoptionsupdate(fieldnames,rollover){
+       fieldname = fieldnames;
+       fld = fieldname.length;
+       fld = fld-1;
+       fieldnametempnumber = fieldname.substr(fld);
+       //alert(fieldnametempnumber);
+       fieldnametemp = fieldname.slice(0,-1)+"temp"+fieldnametempnumber;
+       // alert(fieldnametemp);
+       eval("document.f."+fieldname+".value = 
document.f."+fieldnametemp+".value");
+       if(rollover){
+               eval("document.f.every"+(fieldnametempnumber-1)+".value = 
document.f."+fieldnametemp+".value");
+       }
+}
+
+
+function check_input(e){
+       var unicode=e.charCode? e.charCode : e.keyCode
+       if (unicode!=8 && unicode !=46){ // if key isn't backspace or delete
+               if (unicode<48||unicode>57) { // if not a number
+                       alert("Needs to be entered in digit form -eg 10");
+                       return false // disable key press
+               }
+       }
+}
+
+-->
+</script>
+
+<div id="mainbloc">
 <!-- TMPL_IF name="mod" -->
        <h1>Modify subscription</h1>
-       <form method="post" name="f" action="subscription-detail.pl">
-               <input type="hidden" name="op" value="modsubscription" />
-               <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR 
name="subscriptionid" -->" />
+       <form method="post" name="f" action="alt_subscription-detail.pl">
+               <input type="hidden" name="op" value="modsubscription">
+               <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR 
name="subscriptionid" -->">
 <!-- TMPL_ELSE -->
-       <h1>Add a subscription</h1>
+       <h1>Add a subscription (Serial Holdings Record)</h1>
        <form method="post" name="f">
+               <input type="hidden" name="op" value="addsubscription">
 <!-- /TMPL_IF -->
-<div id="serials_subscription_add_information">
+               <input type="hidden" name="user" value="<!-- TMPL_VAR 
name="loggedinusername" -->">
+               <input type="hidden" name="irreg_check" value="0">
+
+
+<div id="bloc25">
        <h2>Subscription information</h2>
-               <input type="hidden" name="op" value="addsubscription" />
-               <input type="hidden" name="user" value="<!-- TMPL_VAR 
name="loggedinusername" -->" />
-               <p>Librarian <!-- TMPL_VAR name="loggedinusername" --></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(f)">...</a></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="bibliotitle" -->" 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>
-               <!-- TMPL_IF name="letters" -->
-                       <p><label>Enable issue alert</label>
-                               <select name="letter">
-                                       <option value=""></option>
-                                       <!-- TMPL_LOOP name="letters" -->
-                                               <!-- TMPL_IF name="selected" -->
-                                                       <option value="<!-- 
TMPL_VAR name="code" -->" selected><!-- TMPL_VAR name="name" --></option>
-                                               <!-- TMPL_ELSE -->
-                                                       <option value="<!-- 
TMPL_VAR name="code" -->"><!-- TMPL_VAR name="name" --></option>
-                                               <!-- /TMPL_IF -->
-                                       <!-- /TMPL_LOOP -->
-                               </select>
-                       </p>
-               <!-- /TMPL_IF -->
-               <p><label>Distributed to </label><a href="#" 
onClick="DistributedTo()">...</a></p>
-               <p>warning</p>
+       <table border="0" cellspacing="5" cellpadding="0">
+       <tr><td>Librarian:</td>
+           <td><!-- TMPL_VAR name="loggedinusername" --></td></tr>
+       <tr><td><label>Supplier:</label></td>
+           <td><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(f)">Search for a 
Supplier</a></td>
+       <tr><td><label>Biblio</label></td>
+           <td><input type="text" name="biblionumber" value="<!-- TMPL_VAR 
name="biblionumber" -->" size="4"> (<input type="text" name="title" value="<!-- 
TMPL_VAR name="bibliotitle" -->" disabled readonly>) <a href="#" 
onClick="Plugin(f)">Search for Biblio</a> | <a 
href="/cgi-bin/koha/acqui/acqui-home.pl">Create Biblio</a></td>
+       <tr><td><label>Call Number</label></td>
+           <td><input type="text" name="callnumber" value="<!-- TMPL_VAR 
name="callnumber" -->" size="20"></td></tr>
+       <tr><td><label>Notes</label></td>
+           <td><textarea name="notes" cols="30" rows="2"><!-- TMPL_VAR 
name="notes" --></textarea></td>
+       <tr><td><b>Warning:</b></td>
+           <td>
                <ul>
-                       <li>remember you <b>must</b> have created a biblio 
<b>before</b> creating a subscription</li>
+                       <li>Remember you <b>must</b> have created a biblio 
<b>before</b> creating a subscription</li>
                        <li>You also must have selected a supplier if you want 
to ask for late issues</li>
-               </ul>
+               </ul></td></tr>
+       </table>
 </div>
-<div id="serials_subscription_add_planning">
+<div id="bloc25">
        <h2>Planning</h2>
-       <p><label>Beginnning date:</label> <input type="text" name="startdate" 
value="<!-- TMPL_VAR name="startdate" -->" size=13 maxlength=10 /></p>
-       <p><label>Frequency (*)</label>
-                       <select name="periodicity" size="1">
-                               <option value="" selected>Unknown</option>
+       <table border="0" cellspacing="5" cellpadding="0">
+       <tr><td><label class="label100">First Issue ETA:</label></td>
+           <td> <img src="<!-- TMPL_VAR Name="themelang" 
-->/includes/calendar/cal.gif" id="button2" style="cursor: pointer;"  />
+
+<input type="text" name="firstacquidate" value="<!-- TMPL_VAR name="startdate" 
-->" size=13 maxlength=10 id="acqui_date" style="border-width: 0px;" />
+<!-- both scripts for calendar must follow the input field --> 
+                                        <script type="text/javascript">
+                                            Calendar.setup({
+                                                inputField:"acqui_date",
+                                                ifFormat       :   "%d/%m/%Y",
+                                                button         :   "button2",
+                                                align          :   "Tl"
+                                            });
+                                        </script>
+                                        <script type="text/javascript">
+                                            Calendar.setup({
+                                                inputField     :   
"acqui_date",
+                                                ifFormat       :   "%d/%m/%Y",
+                                                button         :   
"acqui_date",
+                                                align          :   "Tl"
+                                            });
+                                        </script></td>
+           <td rowspan="5"><div id="displayexample"></div></td></tr>
+       <tr><td><label class="label100">Frequency: (*)</label></td>
+           <td>        <select name="periodicity" size="1">
+                               <option value="" selected>-- please choose 
--</option>
+                               <option value="">Unknown</option>
+
                                <!-- TMPL_IF name="periodicity1" -->
                                        <option value="1" 
selected>1/day</option>
                                <!-- TMPL_ELSE -->
@@ -83,11 +742,17 @@
                                <!-- TMPL_ELSE -->
                                        <option value="7">1/3 months 
(1/quarter)</option>
                                <!-- /TMPL_IF -->
-                               <!-- periodicity8 is 1/quarter, exactly like 
periodicity7 -->
+                               <!-- periodicity8 is 1/quarter, exactly like 
periodicity7 but will use it for seasonal option -->
+                               <!-- TMPL_IF name="periodicity8" -->
+                                       <option value="8" selected>1/quarter 
(seasonal)</option>
+                               <!-- TMPL_ELSE -->
+                                       <option value="8">1/quarter 
(seasonal)</option>
+                               <!-- /TMPL_IF -->
+
                                <!-- TMPL_IF name="periodicity9" -->
                                        <option value="9" 
selected>2/years</option>
                                <!-- TMPL_ELSE -->
-                                       <option value="9">2/years</option>
+                                       <option value="9">2/year</option>
                                <!-- /TMPL_IF -->
                                <!-- TMPL_IF name="periodicity10" -->
                                        <option value="10" 
selected>1/year</option>
@@ -100,9 +765,74 @@
                                        <option value="11">1/2 years</option>
                                <!-- /TMPL_IF -->
                        </select>
-       </p>
-       <p><label>Arrives on</label>
-                       <select name="dow" size="1">
+       </td></tr>
+       <tr><td><label class="label100">Numbering Pattern:</label></td>
+           <td><select name="numbering_pattern" size="1" id="numberpattern" 
onchange="num_pattern()">
+               <option value="" selected>-- please choose --</option>
+               <!-- TMPL_IF name="numberpattern1" -->
+                       <option value="1" selected>Number</option>
+               <!-- TMPL_ELSE -->
+                       <option value="1">Number</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern2" -->
+                       <option value="2" selected>Volume, Number, 
Issue</option>
+               <!-- TMPL_ELSE -->
+                       <option value="2">Volume, Number, Issue</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern3" -->
+                       <option value="3" selected>Volume, Number</option>
+               <!-- TMPL_ELSE -->
+                       <option value="3">Volume, Number</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern4" -->
+                       <option value="4" selected>Volume, Issue</option>
+               <!-- TMPL_ELSE -->
+                       <option value="4">Volume, Issue</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern5" -->
+                       <option value="5" selected>Number, Issue</option>
+               <!-- TMPL_ELSE -->
+                       <option value="5">Number, Issue</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern6" -->
+                       <option value="6" selected>Seasonal only</option>
+               <!-- TMPL_ELSE -->
+                       <option value="6">Seasonal only</option>
+               <!-- /TMPL_IF -->
+               <!-- TMPL_IF name="numberpattern7" -->
+                       <option value="7" selected>None of the above</option>
+               <!-- TMPL_ELSE -->
+                       <option value="7">None of the above</option>
+               <!-- /TMPL_IF -->
+
+               </select>
+<div id="more_options"></div>
+<div id="irregularity"></div></td></tr>
+       <tr><td><label class="label100">Begins On: (*)</label></td>
+           <td><img src="<!-- TMPL_VAR Name="themelang" 
-->/includes/calendar/cal.gif" id="button1" style="cursor: pointer;"  />
+<input type="text" name="startdate" value="<!-- TMPL_VAR name="startdate" -->" 
size=13 maxlength=10 id="beginning_date" style="border-width: 0px;">
+<!-- both scripts for calendar must follow the input field --> 
+                                        <script type="text/javascript">
+                                            Calendar.setup({
+                                                inputField   : 
"beginning_date",
+                                                ifFormat     : "%d/%m/%Y",
+                                                button       : "button1",
+                                                align        : "Tl"
+                                            });
+                                        </script>
+                                        <script type="text/javascript">
+                                            Calendar.setup({
+                                                inputField   : 
"beginning_date",
+                                                ifFormat     : "%d/%m/%Y",
+                                                button       : 
"beginning_date",
+                                                align        : "Tl"
+                                            });
+                                        </script></td></tr>
+</table> 
+</div>
+
+<!--   <tr><td><label class="label100">Arrives on</label></td>
+           <td>        <select name="dow" size="1">
                                <option value="">None</option>
                                <!-- TMPL_IF name="dow1" -->
                                        <option value="1" 
selected>Monday</option>
@@ -139,21 +869,21 @@
                                <!-- TMPL_ELSE -->
                                        <option value="7">Sunday</option>
                                <!-- /TMPL_IF -->
-                       </select>
-</div>
-<div id="serials_subscription_add_length">
+                       </select></td></tr> -->
+
+<div id="bloc25">
        <h2>Subscription length</h2>
-       <p>* fill 1 from :</p>
-       <ul>
-               <p><label>Number of issues</label><input type="text" 
name="numberlength" value="<!-- TMPL_VAR name="numberlength" -->" /></p>
-               <p><label>Number of weeks</label><input type="text" 
name="weeklength" value="<!-- TMPL_VAR name="weeklength" -->" /></p>
-               <p><label>Number of months</label><input type="text" 
name="monthlength" value="<!-- TMPL_VAR name="monthlength" -->" /></p>
-       </ul>
+               <p><select name="subtype">
+<!-- TMPL_LOOP NAME="subtype" -->
+<option value="<!-- TMPL_VAR NAME="name" -->" <!-- TMPL_IF NAME="selected" --> 
selected="SELECTED" <!-- /TMPL_IF -->><!-- TMPL_VAR NAME="name" --></option>
+<!-- /TMPL_LOOP -->
+</select> <input type="text" name="sublength" value="<!-- TMPL_VAR 
name="sublength" -->" size="3" onkeypress="return check_input(event)"> (*) 
(enter amount in numerals)</p>
+
 </div>
-<div id="serials_subscription_add_calculation">
+<div id="bloc25">
        <h2>Numbering calculation</h2>
-       <p>
                <p>Numbering formula: <input type="text" name="numberingmethod" 
value="<!-- TMPL_VAR name="numberingmethod" -->"></p>
+       <div id="basetable" style="display: none;">
                <table class="small">
                        <tr>
                                <th>&nbsp;</th>
@@ -164,40 +894,40 @@
                        <tr>
                                <td>Add</td>
                                <td>
-                                       <input type="text" name="add1" 
value="<!-- TMPL_VAR name="add1" -->" />
+                                       <input type="text" name="add1" 
value="<!-- TMPL_VAR name="add1" -->">
                                </td>
                                <td>
-                                       <input type="text" name="add2" 
value="<!-- TMPL_VAR name="add2" -->" />
+                                       <input type="text" name="add2" 
value="<!-- TMPL_VAR name="add2" -->">
                                </td>
                                <td>
-                                       <input type="text" name="add3" 
value="<!-- TMPL_VAR name="add3" -->" />
+                                       <input type="text" name="add3" 
value="<!-- TMPL_VAR name="add3" -->">
                                </td>
                        </tr>
                        <tr>
                                <td>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>
+                               <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>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>
+                               <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>
                        <!-- TMPL_IF name="mod" -->
                        <tr>
                                <td>The loop is for instance</td>
-                               <td><input type="text" name="innerloop1" 
value="<!-- TMPL_VAR name="innerloop1" -->" /></td>
-                               <td><input type="text" name="innerloop2" 
value="<!-- TMPL_VAR name="innerloop2" -->" /></td>
-                               <td><input type="text" name="innerloop3" 
value="<!-- TMPL_VAR name="innerloop3" -->" /></td>
+                               <td><input type="text" name="innerloop1" 
value="<!-- TMPL_VAR name="innerloop1" -->"></td>
+                               <td><input type="text" name="innerloop2" 
value="<!-- TMPL_VAR name="innerloop2" -->"></td>
+                               <td><input type="text" name="innerloop3" 
value="<!-- TMPL_VAR name="innerloop3" -->"></td>
                        </tr>
                        <!-- /TMPL_IF -->
                        <tr>
                                <td>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>
+                               <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>
@@ -207,52 +937,69 @@
                                                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>
+                               <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>
-       </p>
+               </table> </div>
 </div>
 <!-- TMPL_IF name="mod" -->
-       <input type="button" value="Save subscription" 
onclick="Check(this.form)" accesskey="w" />
+       <input type="button" value="Save subscription" 
onclick="Check(this.form)" accesskey="w" class="button">
 <!-- TMPL_ELSE -->
-       <input type="button" value="Add subscription" 
onclick="Check(this.form)" accesskey="w" />
+       <input type="button" value="Add subscription" 
onclick="Check(this.form)" accesskey="w" class="button">
 <!-- /TMPL_IF -->
+</form>
 </div>
 
-</form>
+
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
 
 <script language="JavaScript" type="text/javascript">
 
 function Plugin(f)
 {
-        window.open("subscription-bib-search.pl","Find a bib 
index",'width=500,height=400,toolbar=false,scrollbars=yes');
+        
window.open('subscription-bib-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
 }
 
 function FindAcqui(f)
 {
-        window.open("acqui-search.pl","Find a 
supplier",'width=500,height=400,toolbar=false,scrollbars=yes');
+        
window.open('acqui-search.pl','FindASupplier','width=500,height=400,toolbar=no,scrollbars=yes');
 }
 
-function DistributedTo()
+function Find_ISSN(f)
 {
-        window.open("distributedto.pl?subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->","Distributed 
to",'width=800,height=600,toolbar=false,scrollbars=yes');
+        
window.open('issn-search.pl','FindABibIndex','width=500,height=400,toolbar=no,scrollbars=yes');
 }
 
 
-function Check(f)
-{
-       if (f.startdate.value.length != 0 && 
-                       
f.numberlength.value+f.weeklength.value+f.monthlength.value > 0)
-               {
+function Check(f) {
+       if (f.startdate.value.length != 0 && f.sublength.value > 0) {
+               if (f.irreg_check.value == 1) {
                        document.f.submit();
+               } else {
+                       if(f.numbering_pattern.value == ''){
+                               alert("need to choose a numbering pattern");
+                       } else {
+                               alert("need to check for irregularity by 
clicking 'Irregularity?'");
                }
-else
-{
+               }
+       } else {
        alert('field marked with * are mandatory');
-}
+       }
        return false;
 }
 </script>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
+<!-- TMPL_IF name="mod" -->
+<script type="text/javascript">
+window.onload = modify_num_pattern();
+       <!-- TMPL_IF name="hemisphere" -->
+       window.onload = hemispheres(<!-- TMPL_VAR NAME="hemisphere" -->);
+       <!-- /TMPL_IF -->
+</script>
+<!-- /TMPL_IF -->
+<!-- TMPL_IF name="irregularity" -->
+<script type="text/javascript">
+window.onload = irregularity_check();
+window.onload = irregular_order();
+</script>
+<!-- /TMPL_IF -->

Index: koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl    12 Jul 
2006 14:00:28 -0000      1.3
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl    6 Sep 
2006 12:57:42 -0000       1.3.2.1
@@ -1,31 +1,184 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription detail<!-- 
TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- Subscription edit<!--
+TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
-<!-- TMPL_INCLUDE NAME="menu-serials.inc" -->
+<!--TMPL_INCLUDE NAME="menu-serials.inc" -->
 
-<h1>Subscription for <!-- TMPL_VAR name="bibliotitle" --></h1>
-<div id="serials_subscription_detail">
-       <h2>Subscription information</h2>
-               <p>Librarian identity :</td><td> <!-- TMPL_VAR name="librarian" 
--></p>
-               <p><label>Supplier </label><!-- TMPL_VAR 
name="aqbooksellername" --></p>
-               <p><label>Cost</label><!-- TMPL_VAR name="cost" --></p>
-               <p><label>Budget </label><!-- TMPL_VAR name="bookfundid" --></p>
-               <p><label>Biblio</label><i>(<!-- TMPL_VAR name="biblionumber" 
-->)</i> <!-- TMPL_VAR name="bibliotitle" --></p>
-               <p><label>Notes:</label><!-- TMPL_VAR name="notes" --></p>
-               <p>
-                       <!-- TMPL_IF name="letter" -->
-                               <label>Issue alert with letter:</label><!-- 
TMPL_VAR name="letter" -->
-                       <!-- TMPL_ELSE -->
-                               Borrowers can't subscribe to issue alerts
+<script type="text/javascript" language="javascript">
+<!--
+// the english words used in display purposes
+var text = new Array('Number','Volume','Issue','Month','Week','Starting 
with:','Rollover at:','Choose Hemisphere:','Northern','Southern',
+'Autumn','Winter','Spring','Summer','Fall','Season','Year');
+
+// common pre defined number patterns
+function num_pattern() {
+var patternchoice = '<!--TMPL_VAR NAME='numberpattern'-->';
+       switch(patternchoice){
+       case "2":
+               options(text[1],text[0],text[2]);
+               irregularity();
+               display_table(0);
+               break;
+       case "3":
+               options(text[1],text[0]);
+               irregularity();
+               display_table(0);
+               break;
+       case "4":
+               options(text[1],text[2]);
+               irregularity();
+               display_table(0);
+               break;
+       case "5":
+               options(text[0],text[2]);
+               irregularity();
+               display_table(0);
+               break;
+       case "6":
+               var d = new Date();
+               var sYear = d.getFullYear();
+               // options_seasons(text[15],sYear);
+               irregularity();
+               is_season = 1;
+               display_table(0);
+               break;
+       case "7":
+               display_table(1);
+               irregularity();
+               break;
+       default:
+               options(text[0]);
+               irregularity();
+               display_table(0);
+               break;
+       }
+}
+
+function display_table(n) {
+       if(n==1){
+               document.getElementById("basetable").style.display = 'block';
+       } else {
+               document.getElementById("basetable").style.display = 'none';
+       }
+}
+
+// to dispaly the options section
+function options(x,y,z){
+var textbox = '';
+       // alert("X: "+x+"Y: "+y+"Z: "+z);
+       if(x){
+               document.f.xfield.value = x;
+               if(y){
+                       document.f.yfield.value = y;
+                       if(z){
+                               document.f.zfield.value = z;
+                       }
+               }
+       }
+}
+
+function irregularity(){
+       var periodicity = '<!-- TMPL_VAR NAME="periodicity"-->';
+       switch(periodicity){
+       case "1":
+               var names = new 
Array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
+               break;
+       case "2":
+               <!-- TMPL_IF NAME="weekarrayjs" -->
+               var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
+               <!-- /TMPL_IF -->
+               break;
+       case "3":
+               <!-- TMPL_IF NAME="weekarrayjs" -->
+               var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
+               <!-- /TMPL_IF -->
+               break;
+       case "4":
+               <!-- TMPL_IF NAME="weekarrayjs" -->
+               var names = new Array(<!-- TMPL_VAR NAME="weekarrayjs" -->); 
+               <!-- /TMPL_IF -->
+               break;
+       case "5":
+               var names = new 
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+               break;
+       case "6":
+               var names = new 
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+               break;
+       case "7":
+               var names = new 
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+               break;
+       case "8":
+               var names = new 
Array('Autumn','Winter','Spring','Summer','Fall');
+               break;
+       case "9":
+               var names = new 
Array('January','February','March','April','May','June','July','August','September','October','November','December');
+               break;
+       case "10":
+               expected =1;
+               break;
+       default:
+               break;
+       }
+
+       <!-- TMPL_IF NAME="irregularity" -->
+       var irregular = '<!-- TMPL_VAR NAME="irregularity" -->';
+       var irregarray = irregular.split('|');
+       var irregtext = '<p>';
+       for(var i=0;i<irregarray.length;i++){
+               irregtext += names[i]+' &nbsp;';
+       }
+       irregtext += '</p>';
+       document.getElementById("irreg").innerHTML = irregtext;
                        <!-- /TMPL_IF -->
-               </p>
-               <p><label>Distributed to</label>
-               <p><ul><!-- TMPL_VAR name="distributedto" --></ul></p>
+}
+
+-->
+</script>
+<div id="mainbloc">
+<h1>Subscription</h1>
+<a href="subscription-add.pl?op=mod&amp;subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->" class="button">Edit</a>
+<a href="statecollection.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" 
-->" class="button">Receive</a>
+<!--<a href="/cgi-bin/koha/MARCdetail.pl?bib=<!-- TMPL_VAR name="biblionumber" 
-->" class="button">Biblio</a>-->
+<a href="/cgi-bin/koha/detail.pl?bib=<!-- TMPL_VAR name="biblionumber" -->" 
class="button">Biblio</a>
+<!-- TMPL_IF NAME="routing" -->
+<a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=<!-- TMPL_VAR 
NAME="subscriptionid" -->" class="button">Edit Routing List</a>
+<!-- TMPL_ELSE -->
+<a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=<!-- TMPL_VAR 
NAME="subscriptionid" -->&op=new" class="button">Create Routing List</a>
+<!-- /TMPL_IF -->
+<a href="subscription-copy.pl?subscriptionid=<!-- TMPL_VAR 
name="subscriptionid" -->" class="button">Copy</a>
+
+
+<!-- TMPL_UNLESS name="totalissues" -->
+               <a href="javascript:confirm_deletion()" class="button">
+                       delete
+               </a>
+<!-- /TMPL_UNLESS -->
+
+<table>
+<tr valign="top"><td>
+
+<div class="bloc25">
+       <h2>Subscription information</h2>
+       <p><label class="label100">Librarian identity:</label> <!-- TMPL_VAR 
name="librarian" --></p><br />
+
+       <p><label class="label100">Supplier:</label> <!-- TMPL_VAR 
name="aqbooksellername" -->&nbsp;</p>
+
+       <p><label class="label100">Cost:</label> <!-- TMPL_VAR name="cost" 
-->&nbsp;</p>
+
+       <p><label class="label100">Budget:</label> <!-- TMPL_VAR 
name="bookfundid" -->&nbsp;</p>
+
+       <p><label class="label100">Biblio:</label> <i>(<!-- TMPL_VAR 
name="biblionumber" -->)</i> <!-- TMPL_VAR name="bibliotitle" --></p><br />
+       <p><label class="label100">Call Number:</label> <!-- TMPL_VAR 
name="callnumber" -->&nbsp;</p>
+
+       <p><label class="label100">Notes:</label> <!-- TMPL_VAR name="notes" 
--></p>
 </div>
-<div id="serials_subscription_detail_planning">
+
+<div class="bloc25">
+       <form name="f">
        <h2>Planning</h2>
-       <p><label>Beginnning date:</label> <!-- TMPL_VAR name="startdate" 
--></p>
-       <p><label>Frequency (*):</label>
+       <p><label class="label100">Beginnning date:</label> <!-- TMPL_VAR 
name="startdate" -->
+       </p>
+       <p><label class="label100">Frequency (*):</label>
                <!--TMPL_IF name="periodicity1" -->
                                1/day
                <!-- /TMPL_IF -->
@@ -60,108 +213,156 @@
                                1/2 years
                <!-- /TMPL_IF -->
        </p>
-       <p><label>Arrives on:</label>
-               <!--TMPL_IF name="arrival1" -->
-                       Monday
+       <p><label class="label100">Number Pattern:</label>
+               <!-- TMPL_IF name="numberpattern1" -->
+                       Number
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival2" -->
-                               Tuesday
+               <!-- TMPL_IF name="numberpattern2" -->
+                       Volume, Number, Issue
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival3" -->
-                               Wednesday
+               <!-- TMPL_IF name="numberpattern3" -->
+                       Volume, Number
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival4" -->
-                               Thursday
+               <!-- TMPL_IF name="numberpattern4" -->
+                       Volume, Issue
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival5" -->
-                               Friday
+               <!-- TMPL_IF name="numberpattern5" -->
+                       Number, Issue
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival6" -->
-                               Saturday
+               <!-- TMPL_IF name="numberpattern6" -->
+                       Seasonal only
                <!-- /TMPL_IF -->
-               <!--TMPL_IF name="arrival7" -->
-                               Sunday
+               <!-- TMPL_IF name="numberpattern7" -->
+                       None of the above
+               <!-- /TMPL_IF -->
+       </p>
+       <table cellpadding="0" cellspacing="0">
+       <tr><td>&nbsp;</td>
+           <td align="right"><input type="text" name="xfield" 
style="border:0px solid #FFFFFF; text-align:center;"></td>
+       <!--TMPL_IF NAME="lastvalue2"-->
+           <td align="right"><input type="text" name="yfield" 
style="border:0px solid #FFFFFF; text-align:center;"></td>
+       <!--/TMPL_IF-->
+       <!--TMPL_IF NAME="lastvalue3"-->
+           <td align="right"><input type="text" name="zfield" 
style="border:0px solid #FFFFFF; text-align:center;"></td>
+       <!--/TMPL_IF-->
+       </tr>
+       <tr><td><p><label class="label100">Starting with:</label></p></td>
+           <td align="center"><!--TMPL_VAR NAME="lastvalue1"--></td>
+       <!--TMPL_IF NAME="lastvalue2"-->
+           <td align="center">&nbsp; 
+                       <!--TMPL_VAR NAME="lastvalue2"-->
+           </td>
+       <!--/TMPL_IF-->
+       <!--TMPL_IF NAME="lastvalue3"-->
+           <td align="center">&nbsp; 
+                       <!--TMPL_VAR NAME="lastvalue3"-->
+           </td>
+       <!--/TMPL_IF-->
+       </tr>
+       <tr><td><p><label class="label100">Rollover:</label></p></td>
+           <td align="center">&nbsp;</td>
+       <!--TMPL_IF NAME="whenmorethan2"-->
+           <td align="center">&nbsp; 
+                       <!--TMPL_VAR NAME="whenmorethan2"-->
+           </td>
+       <!--/TMPL_IF-->
+       <!--TMPL_IF NAME="whenmorethan3"-->
+           <td align="center">&nbsp; 
+                       <!--TMPL_VAR NAME="whenmorethan3"-->
+           </td>
+       <!--/TMPL_IF-->
+       </tr>
+       </table>
+       <!-- TMPL_IF NAME="irregularity" -->
+       <p><label class="label100">Irregularity:</label>
+               <div id="irreg"></div>
+       </p>
                <!-- /TMPL_IF -->
+       <p><label class="label100">Begins on:</label>
+               <!--TMPL_VAR name="startdate" -->
+       </p>
+       </form>
 </div>
-<div id="serials_subscription_detail_length">
+<div class="bloc25">
        <h2>Subscription length</h2>
-       <p><label>Number of issues</label><!-- TMPL_VAR name="numberlength" 
--></p>
-       <p><label>Number of weeks</label><!-- TMPL_VAR name="weeklength" --></p>
-       <p><label>Number of months</label><!-- TMPL_VAR name="monthlength" 
--></p>
+       <!-- TMPL_IF name="numberlength" --><p><label>Number of issues:</label> 
<!-- TMPL_VAR name="numberlength" --></p><!-- /TMPL_IF -->
+       <!-- TMPL_IF name="weeklength" --><p><label>Number of weeks:</label> 
<!-- TMPL_VAR name="weeklength" --></p><!-- /TMPL_IF -->
+       <!-- TMPL_IF name="monthlength" --><p><label class="label100">Number of 
months:</label> <!-- TMPL_VAR name="monthlength" --></p><!-- /TMPL_IF -->
 
 </div>
-<div id="serials_subscription_detail_calculation">
+<div class="bloc25">
        <h2>Numbering calculation</h2>
-       <p>
-               <p>Numbering formula: <!-- TMPL_VAR name="numberingmethod" 
--></p>
-               <table>
-                       <tr>
-                               <th>&nbsp;</th>
-                               
<th>&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;&nbsp;&nbsp;</th>
-                               
<th>&nbsp;&nbsp;&nbsp;&nbsp;Y&nbsp;&nbsp;&nbsp;&nbsp;</th>
-                               
<th>&nbsp;&nbsp;&nbsp;&nbsp;Z&nbsp;&nbsp;&nbsp;&nbsp;</th>
+       <p><label class="label100">Numbering formula:</label> <!-- TMPL_VAR 
name="numberingmethod" --></p>
+</div>
+<div class="bloc25" id="basetable">
+       <table cellpadding="0" cellspacing="0" border="0" class="collapse">
+               <tr>
+                       <th class="cell-header">&nbsp;</th>
+                       <th class="cell-header">X</th>
+                       <th class="cell-header">Y</th>
+                       <th class="cell-header">Z</th>
                        </tr>
                        <tr>
-                               <td>Add</td>
-                               <td>
+                               <td class="cell">Add</td>
+                               <td class="cell">
                                        <!-- TMPL_VAR name="add1" -->
                                </td>
-                               <td>
+                               <td class="cell">
                                        <!-- TMPL_VAR name="add2" -->
                                </td>
-                               <td>
+                               <td class="cell">
                                        <!-- TMPL_VAR name="add3" -->
                                </td>
                        </tr>
                        <tr>
-                               <td>once every</td>
-                               <td><!-- TMPL_VAR name="every1" --></td>
-                               <td><!-- TMPL_VAR name="every2" --></td>
-                               <td><!-- TMPL_VAR name="every3" --></td>
+                               <td class="cell">once every</td>
+                               <td class="cell"><!-- TMPL_VAR name="every1" 
--></td>
+                               <td class="cell"><!-- TMPL_VAR name="every2" 
--></td>
+                               <td class="cell"><!-- TMPL_VAR name="every3" 
--></td>
                        </tr>
                        <tr>
-                               <td>When more than</td>
-                               <td><!-- TMPL_VAR name="whenmorethan1" --> <!-- 
TMPL_IF name="innerloop1" --><br/>
+                               <td class="cell">When more than</td>
+                               <td class="cell"><!-- TMPL_VAR 
name="whenmorethan1" --> <!-- TMPL_IF name="innerloop1" --><br/>
                                        <i>(is <!-- TMPL_VAR name="innerloop1" 
-->)</i><!-- /TMPL_IF --></td>
-                               <td><!-- TMPL_VAR name="whenmorethan2" --> <!-- 
TMPL_IF name="innerloop2" --><br/>
+                               <td class="cell"><!-- TMPL_VAR 
name="whenmorethan2" --> <!-- TMPL_IF name="innerloop2" --><br/>
                                        <i>(is <!-- TMPL_VAR name="innerloop2" 
-->)</i><!-- /TMPL_IF --></td>
-                               <td><!-- TMPL_VAR name="whenmorethan3" --> <!-- 
TMPL_IF name="innerloop3" --><br/>
+                               <td class="cell"><!-- TMPL_VAR 
name="whenmorethan3" --> <!-- TMPL_IF name="innerloop3" --><br/>
                                        <i>(is <!-- TMPL_VAR name="innerloop3" 
-->)</i><!-- /TMPL_IF --></td>
                        </tr>
                        <tr>
-                               <td>Set back to</td>
-                               <td><!-- TMPL_VAR name="setto1" --></td>
-                               <td><!-- TMPL_VAR name="setto2" --></td>
-                               <td><!-- TMPL_VAR name="setto3" --></td>
+                               <td class="cell">Set back to</td>
+                               <td class="cell"><!-- TMPL_VAR name="setto1" 
--></td>
+                               <td class="cell"><!-- TMPL_VAR name="setto2" 
--></td>
+                               <td class="cell"><!-- TMPL_VAR name="setto3" 
--></td>
                        </tr>
                        <tr>
-                               <td>
+                               <td class="cell">
                                                Last value
                                </td>
-                               <td><!-- TMPL_VAR name="lastvalue1" --></td>
-                               <td><!-- TMPL_VAR name="lastvalue2" --></td>
-                               <td><!-- TMPL_VAR name="lastvalue3" --></td>
+                               <td class="cell"><!-- TMPL_VAR 
name="lastvalue1" --></td>
+                               <td class="cell"><!-- TMPL_VAR 
name="lastvalue2" --></td>
+                               <td class="cell"><!-- TMPL_VAR 
name="lastvalue3" --></td>
                        </tr>
                </table>
 </div>
-<div id="serials_subscription_detail_issue_list">
+</td><td>
+<div class="bloc25">
        <h2>Issues</h2>
-       <table class="small">
+       <table cellpadding="0" cellspacing="0" border="0" class="collapse">
        <tr>
-               <th>&nbsp;&nbsp;&nbsp;&nbsp;Issue 
number&nbsp;&nbsp;&nbsp;&nbsp;</th>
-               <th>&nbsp;&nbsp;&nbsp;&nbsp;Planned 
date&nbsp;&nbsp;&nbsp;&nbsp;</th>
-               <th>&nbsp;&nbsp;&nbsp;&nbsp;Status&nbsp;&nbsp;&nbsp;&nbsp;</th>
-               <th>&nbsp;&nbsp;&nbsp;&nbsp;Note&nbsp;&nbsp;&nbsp;&nbsp;</th>
+               <th class="cell-header">Issue number</th>
+               <th class="cell-header">Planned date</th>
+               <th class="cell-header">Status</th>
        </tr>
        <!-- TMPL_LOOP name="serialslist" -->
                <tr>
-                       <td>
+                       <td class="cell">
                                <!-- TMPL_VAR name="serialseq" -->
                        </td>
-                       <td>
+                       <td class="cell">
                                <!-- TMPL_VAR name="planneddate" -->
                        </td>
-                       <td>
+                       <td class="cell">
                                        <!--TMPL_IF name="status1" -->
                                                Waited
                                        <!-- /TMPL_IF -->
@@ -174,58 +375,23 @@
                                        <!--TMPL_IF name="status4" -->
                                                Missing
                                        <!-- /TMPL_IF -->
-                               </select>
-                       </td>
-                       <td>
-                               <!-- TMPL_VAR name="notes" -->
                        </td>
                </tr>
        <!-- /TMPL_LOOP -->
        </table>
 </div>
+</td></tr>
+</table>
 
-<div id="action">
-       <form action="subscription-add.pl">
-               <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR 
name="subscriptionid" -->" />
-               <input type="hidden" name="op" value="mod" />
-               <input type="submit" value="Modify subscription" />
-       </form>
-       <form action="serials-recieve.pl">
-               <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR 
name="subscriptionid" -->" />
-               <input type="submit" value="Recieve issues" />
-       </form>
-       <form action="serial-issues.pl">
-               <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
name="biblionumber" -->" />
-               <input type="submit" value="Issue history" />
-       </form>
-       <form action="/cgi-bin/koha/serials/serials-home.pl">
-               <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
name="biblionumber" -->" />
-               <input type="submit" value="Subscriptions" />
-       </form>
-<!-- TMPL_IF name="letter" -->
-       <form action="viewalerts.pl">
-               <input type="hidden" name="subscriptionid" value="<!-- TMPL_VAR 
name="subscriptionid" -->" />
-               <input type="submit" value="Alerted borrowers" />
-       </form>
-<!-- /TMPL_IF -->
-       <form action="/cgi-bin/koha/MARCdetail.pl">
-               <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR 
name="biblionumber" -->" />
-               <input type="submit" value="Back to biblio" />
-       </form>
-       <!-- TMPL_UNLESS name="totalissues" -->
-               <form action="javascript:confirm_deletion()">
-                       <input type="submit" value="delete" />
-               </form>
-       <!-- /TMPL_UNLESS -->
 </div>
-
-<script>
+<script type="text/javascript">
 function _(s) { return s } // dummy function for gettext
 function confirm_deletion() {
        var is_confirmed = confirm(_('Are you sure you want to delete this 
subscription?'));
        if (is_confirmed) {
-               window.location="subscription-detail.pl?subscriptionid=<!-- 
TMPL_VAR name="subscriptionid" -->&op=del";
+               window.location="alt_subscription-detail.pl?subscriptionid=<!-- 
TMPL_VAR name="subscriptionid" -->&op=del";
        }
 }
+window.onload = num_pattern();
 </script>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
\ No newline at end of file

Index: serials/acqui-search.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/acqui-search.pl,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -b -r1.4 -r1.4.2.1
--- serials/acqui-search.pl     27 Jul 2006 13:57:57 -0000      1.4
+++ serials/acqui-search.pl     6 Sep 2006 12:57:42 -0000       1.4.2.1
@@ -17,7 +17,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: acqui-search.pl,v 1.4 2006/07/27 13:57:57 toins Exp $
+# $Id: acqui-search.pl,v 1.4.2.1 2006/09/06 12:57:42 hdl Exp $
 
 use strict;
 use CGI;
@@ -77,8 +77,8 @@
 my @loop_currency = ();
 for (my $i=0;$i<$count;$i++){
        my %line;
-       $line{currency} = $rates->[$i]->{'currency'};
-       $line{rate} = $rates->[$i]->{'rate'};
+       $line{currency} = $rates[$i]->{'currency'};
+       $line{rate} = $rates[$i]->{'rate'};
        push @loop_currency, \%line;
 }
 $template->param(classlist => $classlist,

Index: serials/subscription-add.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-add.pl,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -b -r1.6 -r1.6.2.1
--- serials/subscription-add.pl 11 Aug 2006 16:33:53 -0000      1.6
+++ serials/subscription-add.pl 6 Sep 2006 12:57:42 -0000       1.6.2.1
@@ -1,48 +1,5 @@
 #!/usr/bin/perl
 
-# Copyright 2000-2003 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-# $Id: subscription-add.pl,v 1.6 2006/08/11 16:33:53 tipaul Exp $
-
-=head1 NAME
-
-subscription-add.pl
-
-=head1 DESCRIPTION
-
-this script add a subscription into the database.
-
-=head1 PARAMETERS
-
-=over 4
-
-=item op
-op use to know the operation to do on this template.
- * mod : to modify an existing subscription
- * addsubscription : to add a subscription
-
-Note that if op = mod or addsubscription there are a lot of other params.
-
-
-=back
-
-=cut
-
 
 use strict;
 use CGI;
@@ -50,24 +7,23 @@
 use C4::Auth;
 use C4::Date;
 use C4::Output;
-use C4::Serials;
-use C4::Bookfund;
+use C4::Acquisition;
 use C4::Interface::CGI::Output;
 use C4::Context;
 use HTML::Template;
-use C4::Letters;
-use C4::Members;
+use C4::Serials;
+use Date::Manip;
 
 my $query = new CGI;
 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,
+       $firstacquidate, $dow, $irregularity, $numberpattern, $numberlength, 
$weeklength, $monthlength, $sublength,
     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
     $numberingmethod, $status, $biblionumber,
-    $bibliotitle, $notes, $letter);
+       $bibliotitle, $callnumber, $notes, $hemisphere);
 
     my @budgets;
 my ($template, $loggedinuser, $cookie)
@@ -79,23 +35,71 @@
                 debug => 1,
                 });
 
+
+my $weekarrayjs='';
+my $count = 0;
+my ($year, $month, $day) = UnixDate("today", "%Y", "%m", "%d");
+my $firstday = Date_DayOfYear($month,$day,$year);
+my $wkno = Date_WeekOfYear($month,$day,$year,1); # week starting monday
+my $weekno = $wkno;
+for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
+        $count = $i;
+        if($wkno > 52){$year++; $wkno=1;}
+        if($count>365){$count=$i-365;}    
+        my ($y,$m,$d) = Date_NthDayOfYear($year,$count);
+        my $output = "$y-$m-$d";
+        $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
+        $wkno++;    
+}
+chop($weekarrayjs);
+# warn $weekarrayjs;
+
+my $sub_on;
+my @subscription_types = (
+            'issues', 'weeks', 'months'
+        ); 
+my @sub_type_data;
 if ($op eq 'mod') {
     my $subscriptionid = $query->param('subscriptionid');
     my $subs = &GetSubscription($subscriptionid);
     $auser = $subs->{'user'};
-    $librarian = $subs->{'librarian'};
+       $librarian => $subs->{'librarian'},
     $cost = $subs->{'cost'};
     $aqbooksellerid = $subs->{'aqbooksellerid'};
     $aqbooksellername = $subs->{'aqbooksellername'};
-    $bookfundid = $subs->{'bookfundid'};
-    $aqbudgetid = $subs->{'aqbudgetid'};
-    defined $aqbudgetid or $aqbudgetid='';
     $startdate = $subs->{'startdate'};
+       $firstacquidate = $subs->{'firstacquidate'};    
     $periodicity = $subs->{'periodicity'};
     $dow = $subs->{'dow'};
+        $irregularity = $subs->{'irregularity'};
+        $numberpattern = $subs->{'numberpattern'};
     $numberlength = $subs->{'numberlength'};
     $weeklength = $subs->{'weeklength'};
     $monthlength = $subs->{'monthlength'};
+
+        if($monthlength > 0){
+           $sublength = $monthlength;
+           $sub_on = $subscription_types[2];
+       } elsif ($weeklength>0){
+           $sublength = $weeklength;
+           $sub_on = $subscription_types[1];
+       } else {
+           $sublength = $numberlength;
+           $sub_on = $subscription_types[0];
+       }
+        
+
+        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 );
+        }
+    
     $add1 = $subs->{'add1'};
     $every1 = $subs->{'every1'};
     $whenmorethan1 = $subs->{'whenmorethan1'};
@@ -117,10 +121,10 @@
     $numberingmethod = $subs->{'numberingmethod'};
     $status = $subs->{status};
     $biblionumber = $subs->{'biblionumber'};
-    $bibliotitle = $subs->{'bibliotitle'},
+       $bibliotitle = $subs->{'bibliotitle'};
+        $callnumber = $subs->{'callnumber'};
     $notes = $subs->{'notes'};
-    $letter = $subs->{'letter'};
-    defined $letter or $letter='';
+        $hemisphere = $subs->{'hemisphere'};
     $template->param(
         $op => 1,
         user => $auser,
@@ -131,11 +135,13 @@
         aqbudgetid => $aqbudgetid,
         bookfundid => $bookfundid,
         startdate => format_date($startdate),
+               firstacquidate => format_date($firstacquidate),     
         periodicity => $periodicity,
         dow => $dow,
-        numberlength => $numberlength,
-        weeklength => $weeklength,
-        monthlength => $monthlength,
+               irregularity => $irregularity,
+               numberpattern => $numberpattern,
+               sublength => $sublength,
+               subtype => address@hidden,
         add1 => $add1,
         every1 => $every1,
         whenmorethan1 => $whenmorethan1,
@@ -158,31 +164,52 @@
         status => $status,
         biblionumber => $biblionumber,
         bibliotitle => $bibliotitle,
+               callnumber => $callnumber,
         notes => $notes,
-        letter => $letter,
         subscriptionid => $subscriptionid,
+               weekarrayjs => $weekarrayjs,
+               weekno => $weekno,
+               hemisphere => $hemisphere,
+               );
+
+       $template->param(
         "periodicity$periodicity" => 1,
         "dow$dow" => 1,
+                               "numberpattern$numberpattern" => 1,
         );
 }
 
-my @letterlist = GetLetterList('serial');
-for (my $i=0;$i<=$#letterlist;$i++) {
-    $letterlist[$i]->{'selected'} =1 if $letterlist[$i]->{'code'} eq $letter;
-}
-$template->param(letters => address@hidden);
-
 if ($op eq 'addsubscription') {
+        my @irregular = $query->param('irregular');
+        my $irregular_count = @irregular;
+        for(my $i =0;$i<$irregular_count;$i++){
+            $irregularity .=$irregular[$i]."|";
+        }
+        $irregularity =~ s/\|$//;
+
     my $auser = $query->param('user');
     my $aqbooksellerid = $query->param('aqbooksellerid');
     my $cost = $query->param('cost');
     my $aqbudgetid = $query->param('aqbudgetid');
     my $startdate = $query->param('startdate');
+       my $firstacquidate = $query->param('firstacquidate');    
     my $periodicity = $query->param('periodicity');
     my $dow = $query->param('dow');
-    my $numberlength = $query->param('numberlength');
-    my $weeklength = $query->param('weeklength');
-    my $monthlength = $query->param('monthlength');
+        # my $irregularity = $query->param('irregularity');
+       my $numberlength = 0;
+       my $weeklength = 0;
+       my $monthlength = 0;
+        my $numberpattern = $query->param('numbering_pattern');
+        my $sublength = $query->param('sublength');
+        my $subtype = $query->param('subtype');
+        if ($subtype eq 'months'){
+           $monthlength = $sublength;
+       } elsif ($subtype eq 'weeks'){
+           $weeklength = $sublength;
+       } else {
+           $numberlength = $sublength;
+       }
+
     my $add1 = $query->param('add1');
     my $every1 = $query->param('every1');
     my $whenmorethan1 = $query->param('whenmorethan1');
@@ -201,16 +228,33 @@
     my $numberingmethod = $query->param('numberingmethod');
     my $status = 1;
     my $biblionumber = $query->param('biblionumber');
+        my $callnumber = $query->param('callnumber');
     my $notes = $query->param('notes');
-    my $letter = $query->param('letter');
-    my $subscriptionid = 
NewSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
-                    
$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
+        my $hemisphere = $query->param('hemisphere') || 1;
+
+       my $subscriptionid = 
old_newsubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
+                                       
$startdate,$periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
                     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,
                     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,
                     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,
-                    $numberingmethod, $status, $notes, $letter
+                                       $numberingmethod, $status, $callnumber, 
$notes, $hemisphere
                 );
     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 );
+           if ( $sub_on eq $sub_type ) {
+            $row{'selected'} = ' selected';
+           } else {
+            $row{'selected'} = '';
+           }
+           push( @sub_type_data, \%row );
+        }    
+    $template->param(subtype => address@hidden,
+                weekarrayjs => $weekarrayjs,
+                weekno => $weekno,
+       );
     output_html_with_http_headers $query, $cookie, $template->output;
 }

Index: serials/subscription-bib-search.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-bib-search.pl,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- serials/subscription-bib-search.pl  13 Jul 2006 08:13:37 -0000      1.3
+++ serials/subscription-bib-search.pl  6 Sep 2006 12:57:42 -0000       1.3.2.1
@@ -56,7 +56,7 @@
 use C4::Context;
 use C4::Output;
 use C4::Interface::CGI::Output;
-use C4::SearchMarc;
+use C4::Search;
 
 my $query=new CGI;
 # my $type=$query->param('type');

Index: serials/subscription-detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-detail.pl,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -b -r1.3 -r1.3.2.1
--- serials/subscription-detail.pl      12 Jul 2006 16:41:35 -0000      1.3
+++ serials/subscription-detail.pl      6 Sep 2006 12:57:42 -0000       1.3.2.1
@@ -1,51 +1,5 @@
 #!/usr/bin/perl
 
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
-
-# $Id: subscription-detail.pl,v 1.3 2006/07/12 16:41:35 toins Exp $
-
-=head1 NAME
-
-subscription-details.pl
-
-=head1 DESCRIPTION
-
-this script display the detail of a subscription given on input arg.
-
-=head1 Parameters
-
-=over 4
-
-=item op
-op use to know the operation to do on this template.
- * modsubscription : to modify the subscription.
- * del : to delete this subscription.
-
-Note that if op = modsubscription there are a lot of other parameters.
-
-=item subscriptionid
-The subscription this script has to dislay
-
-=back
-
-=cut
-
-
 use strict;
 use CGI;
 use C4::Auth;
@@ -56,35 +10,53 @@
 use C4::Interface::CGI::Output;
 use C4::Context;
 use HTML::Template;
+use Date::Manip;
 
 my $query = new CGI;
-my $op = $query->param('op') || '';
+my $op = $query->param('op');
 my $dbh = C4::Context->dbh;
 my $sth;
 # my $id;
-my ($template, $loggedinuser, $cookie, $subs, $user, $sessionID, $flags);
+my ($template, $loggedinuser, $cookie, $subs);
 my ($subscriptionid,$auser,$librarian,$cost,$aqbooksellerid, 
$aqbooksellername,$aqbudgetid, $bookfundid, $startdate, $periodicity,
-    $dow, $numberlength, $weeklength, $monthlength,
+       $firstacquidate, $dow, $irregularity, $sublength, $subtype, 
$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, $bibliotitle, $notes,$letter);
+       $numberingmethod, $status, $biblionumber, $bibliotitle, $callnumber, 
$notes, $hemisphere);
 
 $subscriptionid = $query->param('subscriptionid');
 
 if ($op eq 'modsubscription') {
+    my @irregular = $query->param('irregular');
+    my $irregular_count = @irregular;
+    for(my $i =0;$i<$irregular_count;$i++){
+       $irregularity .=$irregular[$i]."|";
+    }
+    $irregularity =~ s/\|$//;
+
+    
     $auser = $query->param('user');
-    $librarian = $query->param('librarian');
+       $librarian => $query->param('librarian'),
     $cost = $query->param('cost');
     $aqbooksellerid = $query->param('aqbooksellerid');
     $biblionumber = $query->param('biblionumber');
     $aqbudgetid = $query->param('aqbudgetid');
     $startdate = format_date_in_iso($query->param('startdate'));
+       $firstacquidate = format_date_in_iso($query->param('firstacquidate'));  
  
     $periodicity = $query->param('periodicity');
     $dow = $query->param('dow');
-    $numberlength = $query->param('numberlength');
-    $weeklength = $query->param('weeklength');
-    $monthlength = $query->param('monthlength');
+        $sublength = $query->param('sublength');
+        $subtype = $query->param('subtype');
+
+        if($subtype eq 'months'){
+           $monthlength = $sublength;
+       } elsif ($subtype eq 'weeks'){
+           $weeklength = $sublength;
+       } else {
+           $numberlength = $sublength;
+       }
+        $numberpattern = $query->param('numbering_pattern');
     $add1 = $query->param('add1');
     $every1 = $query->param('every1');
     $whenmorethan1 = $query->param('whenmorethan1');
@@ -105,27 +77,29 @@
     $innerloop3 = $query->param('innerloop3');
     $numberingmethod = $query->param('numberingmethod');
     $status = 1;
+        $callnumber = $query->param('callnumber');
     $notes = $query->param('notes');
-    $letter = $query->param('letter');
+        $hemisphere = $query->param('hemisphere');
 
     &ModSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
-                    $periodicity,$dow,$numberlength,$weeklength,$monthlength,
+                                       
$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, $notes, $letter, 
$subscriptionid);
+                                       $numberingmethod, $status, 
$biblionumber, $callnumber, $notes, $hemisphere, $subscriptionid);
 }
 
 if ($op eq 'del') {
     &DelSubscription($subscriptionid);
-    print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; 
URL=../serials-home.pl\"></html>";
+       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; 
URL=serials-home.pl\"></html>";
     exit;
+
 }
-$subs = &GetSubscription($subscriptionid);
-# html'ize distributedto
-$subs->{distributedto}=~ s/\n/<br \/>/g;
-my ($totalissues,@serialslist) = GetSerials($subscriptionid);
+my $subs = &GetSubscription($subscriptionid);
+my ($routing, @routinglist) = getroutinglist($subscriptionid);
+my ($totalissues,@serialslist) = old_getserials($subscriptionid);
 $totalissues-- if $totalissues; # the -1 is to have 0 if this is a new 
subscription (only 1 issue)
+# the subscription must be deletable if there is NO issues for a reason or 
another (should not happend, but...)
 
 ($template, $loggedinuser, $cookie)
 = get_template_and_user({template_name => "serials/subscription-detail.tmpl",
@@ -136,9 +110,28 @@
                 debug => 1,
                 });
 
-($user, $cookie, $sessionID, $flags) = checkauth($query, 0, {catalogue => 1}, 
"intranet");
+my ($user, $cookie, $sessionID, $flags)
+       = checkauth($query, 0, {catalogue => 1}, "intranet");
+
+my $weekarrayjs='';
+my $count = 0;
+my ($year, $month, $day) = UnixDate("today", "%Y", "%m", "%d");
+my $firstday = Date_DayOfYear($month,$day,$year);
+my $wkno = Date_WeekOfYear($month,$day,$year,1); # week starting monday
+my $weekno = $wkno;
+for(my $i=$firstday;$i<($firstday+365);$i=$i+7){
+            $count = $i;
+            if($wkno > 52){$year++; $wkno=1;}
+            if($count>365){$count=$i-365;}
+            my ($y,$m,$d) = Date_NthDayOfYear($year,$count);
+            my $output = "$y-$m-$d";
+            $weekarrayjs .= "'Wk $wkno: ".format_date($output)."',";
+            $wkno++;
+    }
+chop($weekarrayjs);
 
 $template->param(
+        routing => $routing,
     user => $subs->{auser},
     librarian => $subs->{librarian},
     aqbooksellerid => $subs->{aqbooksellerid},
@@ -147,11 +140,14 @@
     aqbudgetid => $subs->{aqbudgetid},
     bookfundid => $subs->{bookfundid},
     startdate => format_date($subs->{startdate}),
+       firstacquidate => format_date($subs->{firstacquidate}),    
     periodicity => $subs->{periodicity},
     dow => $subs->{dow},
+        irregularity => $subs->{irregularity},
     numberlength => $subs->{numberlength},
     weeklength => $subs->{weeklength},
     monthlength => $subs->{monthlength},
+        numberpattern => $subs->{numberpattern},
     add1 => $subs->{add1},
     every1 => $subs->{every1},
     whenmorethan1 => $subs->{whenmorethan1},
@@ -170,19 +166,24 @@
     setto3 => $subs->{setto3},
     lastvalue3 => $subs->{lastvalue3},
     innerloop3 => $subs->{innerloop3},
+        weekarrayjs => $weekarrayjs,
     numberingmethod => $subs->{numberingmethod},
     status => $subs->{status},
     biblionumber => $subs->{biblionumber},
     bibliotitle => $subs->{bibliotitle},
+        callnumber => $subs->{callnumber},
     notes => $subs->{notes},
-    letter => $subs->{letter},
-    distributedto => $subs->{distributedto},
     subscriptionid => $subs->{subscriptionid},
     serialslist => address@hidden,
     totalissues => $totalissues,
+        hemisphere => $hemisphere,
+       );
+$template->param(
     "periodicity$subs->{periodicity}" => 1,
-    "arrival$subs->{dow}" => 1
-);
-
+                       "arrival$subs->{dow}" => 1,
+                        "numberpattern$subs->{numberpattern}" => 1,
+                       intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
+                       intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"), 
+                       );
 
 output_html_with_http_headers $query, $cookie, $template->output;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]