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

Henri-Damien LAURENT laurenthdl at alinto.com
Fri Nov 17 11:53:04 CET 2006


CVSROOT:	/cvsroot/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Henri-Damien LAURENT <hdl>	06/11/17 10:53:04

Modified files:
	C4             : Serials.pm 
	koha-tmpl/intranet-tmpl/prog/en/includes: menu-serials.inc 
	koha-tmpl/intranet-tmpl/prog/en/serials: serials-collection.tmpl 
	                                         subscription-add.tmpl 
	                                         subscription-detail.tmpl 
	serials        : subscription-add.pl subscription-detail.pl 
	updater        : updatedatabase 

Log message:
	Changing
	- subscription detail : 
		adding manual history (in subscription table)
		addind subscription summary.
	- menu-serials.inc deleting old link
	- adapting serials-collection.pl
	
	TODO List :
	- Some values are hard coded in subscription-detail
	- subscription-detail.pl relies on subscription-add for edition BUT subscription-add transmits back data to subscription-detail in order to save data back into database. This is a bit odd enough and should not occur.
	- Some more tests on numberlength which doesnot seem to be kept.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Serials.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.6&r2=1.5.2.7
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/includes/menu-serials.inc?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.3&r2=1.3.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.1&r2=1.1.2.2
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.2.5&r2=1.3.2.6
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.2.5&r2=1.3.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-add.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.6.2.5&r2=1.6.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/serials/subscription-detail.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.4&r2=1.3.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/updater/updatedatabase?cvsroot=koha&only_with_tag=rel_3_0&r1=1.157.2.20&r2=1.157.2.21

Patches:
Index: C4/Serials.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Serials.pm,v
retrieving revision 1.5.2.6
retrieving revision 1.5.2.7
diff -u -b -r1.5.2.6 -r1.5.2.7
--- C4/Serials.pm	15 Nov 2006 15:15:50 -0000	1.5.2.6
+++ C4/Serials.pm	17 Nov 2006 10:53:03 -0000	1.5.2.7
@@ -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.2.6 2006/11/15 15:15:50 hdl Exp $
+# $Id: Serials.pm,v 1.5.2.7 2006/11/17 10:53:03 hdl Exp $
 
 use strict;
 use C4::Date;
@@ -32,7 +32,7 @@
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.5.2.6 $' =~ /\d+/g;
+$VERSION = do { my @v = '$Revision: 1.5.2.7 $' =~ /\d+/g;
         shift(@v) . "." . join("_", map {sprintf "%03d", $_ } @v); };
 
 
@@ -869,6 +869,7 @@
     $missinglist =~ s/^,//g;
     $opacnote =~ s/^,//g;
     $sth->execute($histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote,$subscriptionid);
+    return $sth->rows;
 }
 
 =head2 ModSerialStatus
@@ -892,27 +893,34 @@
     $sth->execute($serialid);
     my ($subscriptionid,$oldstatus) = $sth->fetchrow;
     # change status & update subscriptionhistory
+    my $val;
     if ($status eq 6){
         DelIssue($serialseq, $subscriptionid)
     } else {
         my $query = "UPDATE serial SET serialseq=?,publisheddate=?,planneddate=?,status=?,notes=? WHERE  serialid = ?";
         $sth = $dbh->prepare($query);
         $sth->execute($serialseq,$publisheddate,$planneddate,$status,$notes,$serialid);
+        my $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
+        $sth = $dbh->prepare($query);
+        $sth->execute($subscriptionid);
+        my $val=$sth->fetchrow_hashref;
+        unless ($val->{manualhistory}){
         my $query = "SELECT missinglist,recievedlist FROM   subscriptionhistory WHERE  subscriptionid=?";
         $sth = $dbh->prepare($query);
         $sth->execute($subscriptionid);
         my ($missinglist,$recievedlist) = $sth->fetchrow;
         if ($status eq 2) {
-#             warn "receivedlist : $recievedlist serialseq :$serialseq, ".index("$recievedlist","$serialseq");
+  #             warn "receivedlist : $recievedlist serialseq :$serialseq, ".index("$recievedlist","$serialseq");
             $recievedlist .= ",$serialseq" unless (index("$recievedlist","$serialseq")>=0);
         }
-        warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq");
+  #         warn "missinglist : $missinglist serialseq :$serialseq, ".index("$missinglist","$serialseq");
         $missinglist .= ",$serialseq" if ($status eq 4 and not index("$missinglist","$serialseq")>=0) ;
         $missinglist .= ",not issued $serialseq" if ($status eq 5 and index("$missinglist","$serialseq")>=0);
         my $query = "UPDATE subscriptionhistory SET recievedlist=?, missinglist=? WHERE  subscriptionid=?";
         $sth=$dbh->prepare($query);
         $sth->execute($recievedlist,$missinglist,$subscriptionid);
     }
+    }
     # create new waited entry if needed (ie : was a "waited" and has changed)
     if ($oldstatus eq 1 && $status ne 1) {
         my $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
@@ -950,7 +958,7 @@
                     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
                     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
                     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere, $subscriptionid) = @_;
+                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere,$manualhistory, $subscriptionid) = @_;
     my $dbh = C4::Context->dbh;
     my $query = "UPDATE subscription
                     SET librarian=?, branchcode=?,aqbooksellerid=?,cost=?,aqbudgetid=?,startdate=?,
@@ -958,7 +966,7 @@
                         add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
                         add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
                         add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?
+                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?
                     WHERE subscriptionid = ?";
     my $sth=$dbh->prepare($query);
     $sth->execute($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
@@ -966,7 +974,7 @@
                     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
                     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
                     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere, $subscriptionid);
+                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere,$manualhistory, $subscriptionid);
     $sth->finish;
 }
 
@@ -997,7 +1005,8 @@
         $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
         $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
         $numberingmethod, $status, $notes, $letter,
-        $firstacquidate,$irregularity,$numberpattern, $callnumber, $hemisphere
+        $firstacquidate,$irregularity,$numberpattern, $callnumber, $hemisphere,
+        $manualhistory
         ) = @_;
     my $dbh = C4::Context->dbh;
 #save subscription (insert into database)
@@ -1009,8 +1018,8 @@
             add2,every2,whenmorethan2,setto2,lastvalue2,innerloop2,
             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
             numberingmethod, status, notes, letter,firstacquidate,irregularity,
-            numberpattern, callnumber, hemisphere)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+            numberpattern, callnumber, hemisphere,manualhistory)
+        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
         |;
     my $sth=$dbh->prepare($query);
     $sth->execute(
@@ -1020,7 +1029,7 @@
         $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
         $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
         $numberingmethod, "$status", $notes, $letter,$firstacquidate,$irregularity,
-        $numberpattern, $callnumber, $hemisphere);
+        $numberpattern, $callnumber, $hemisphere,$manualhistory);
 
 #then create the 1st waited number
     my $subscriptionid = $dbh->{'mysql_insertid'};
@@ -1408,9 +1417,15 @@
         WHERE       serialseq= ?
         AND         subscriptionid= ?
     |;
-    my $sth = $dbh->prepare($query);
-    $sth->execute($serialseq,$subscriptionid);
+    my $mainsth = $dbh->prepare($query);
+    $mainsth->execute($serialseq,$subscriptionid);
+    
     #Delete element from subscription history
+    my $query = "SELECT * FROM   subscription WHERE  subscriptionid = ?";
+    my $sth = $dbh->prepare($query);
+    $sth->execute($subscriptionid);
+    my $val=$sth->fetchrow_hashref;
+    unless ($val->{manualhistory}){
     my $query = qq|
         SELECT * FROM subscriptionhistory
         WHERE       subscriptionid= ?
@@ -1423,6 +1438,8 @@
     my $strsth = "UPDATE subscriptionhistory SET ".join(",",map{join("=",$_,$dbh->quote($data->{$_}))} keys %$data)." WHERE subscriptionid=?";
     $sth=$dbh->prepare($strsth);
     $sth->execute($subscriptionid);
+    }
+    return $mainsth->rows;
 }
 
 =head2 GetMissingIssues

Index: koha-tmpl/intranet-tmpl/prog/en/includes/menu-serials.inc
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/includes/menu-serials.inc,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -b -r1.3.2.3 -r1.3.2.4
--- koha-tmpl/intranet-tmpl/prog/en/includes/menu-serials.inc	2 Nov 2006 10:38:38 -0000	1.3.2.3
+++ koha-tmpl/intranet-tmpl/prog/en/includes/menu-serials.inc	17 Nov 2006 10:53:03 -0000	1.3.2.4
@@ -1,6 +1,5 @@
 <div id="submenu">
         <a href="/cgi-bin/koha/serials/serials-home.pl">home</a>
-        <a href="/cgi-bin/koha/serials/serial-issues.pl">Serials issues</a>
         <a href="/cgi-bin/koha/serials/lateissues.pl">Late issue</a>
         <a href="/cgi-bin/koha/serials/claims.pl">Claims</a>
         <a href="/cgi-bin/koha/serials/subscription-add.pl">Add a subscription</a>

Index: koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/koha-tmpl/intranet-tmpl/prog/en/serials/Attic/serials-collection.tmpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -b -r1.1.2.1 -r1.1.2.2
--- koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl	13 Nov 2006 09:33:20 -0000	1.1.2.1
+++ koha-tmpl/intranet-tmpl/prog/en/serials/serials-collection.tmpl	17 Nov 2006 10:53:03 -0000	1.1.2.2
@@ -1,4 +1,5 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_VAR NAME="LibraryName" --> Catalog -- Serials
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+<!-- TMPL_VAR NAME="LibraryName" --> Catalog -- Serials
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!--TMPL_INCLUDE NAME="menus.inc" -->
 <!--TMPL_INCLUDE NAME="menu-serials.inc" -->
@@ -55,7 +56,7 @@
             <a  class="tabsubs" href="javascript:showlayer(<!-- TMPL_VAR NAME="year" -->)"><!-- TMPL_VAR NAME="year" --></a>
         <!-- /TMPL_IF -->
     <!-- /TMPL_LOOP -->
-    <a class="tabsubs" href="serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->&selectview=small">Compact view</a>
+<!--    <a class="tabsubs" href="serial-issues.pl?biblionumber=<!-- TMPL_VAR name="biblionumber" -->&selectview=small">Compact view</a>-->
     </div>
 
 <form name="edition" action="serials-edit.pl">

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.2.5
retrieving revision 1.3.2.6
diff -u -b -r1.3.2.5 -r1.3.2.6
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl	15 Nov 2006 15:15:50 -0000	1.3.2.5
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-add.tmpl	17 Nov 2006 10:53:03 -0000	1.3.2.6
@@ -697,6 +697,10 @@
             </td>
         </tr>
         <tr>
+            <td><label>Notes</label></td>
+            <td><textarea name="notes" cols="30" rows="2"><!-- TMPL_VAR name="notes" --></textarea></td>
+        </tr>
+        <tr>
             <td><b>Warning:</b></td>
             <td>
                 <ul>
@@ -739,7 +743,7 @@
         <tr>
             <td><label">Frequency: (*)</label></td>
             <td>
-                <select name="periodicity" size="1">
+                <select name="periodicity" size="1" onchange="javascript:if (this.value==1){document.getElementsByName('manualhist')[0].checked=true}">
                 <option value="" selected>-- please choose --</option>
                 <option value="">Unknown</option>
 
@@ -801,6 +805,7 @@
                     <option value="11">1/2 years</option>
                 <!-- /TMPL_IF -->
                 </select>
+                Manual History :<input type="checkbox" name="manualhist" value="0" />
             </td>
         </tr>
         <tr>
@@ -959,6 +964,35 @@
         </div>
         </td></tr>
     </table>
+<!--TMPL_IF Name="history"-->
+    <h2>History</h2>
+    <table border="0" cellspacing="5" cellpadding="0">
+		<tr>
+          <td><label>Starting date:</label></td>
+          <td><input type="text" name="histstartdate" value="<!-- TMPL_VAR name="histstartdate" -->"> (the date of the 1st subscription)</td>
+        </tr>
+		<tr>
+          <td><label>Ending date:</label></td>
+          <td><input type="text" name="enddate" value="<!-- TMPL_VAR name="enddate" -->">(if empty : subscription still active)</td>
+        </tr>
+        <tr>
+            <td><label>Recieved issues</label></td>
+            <td><textarea name="recievedlist" cols="60" rows="5"><!-- TMPL_VAR name="recievedlist" --></textarea></td>
+        </tr>
+        <tr>
+            <td><label>Missing issues</label></td>
+            <td><textarea name="missinglist" cols="60" rows="2"><!-- TMPL_VAR name="missinglist" --></textarea></td>
+        </tr>
+        <tr>
+            <td><label>Opac's notes</label></td>
+            <td><textarea name="opacnote" cols="60" rows="5"><!-- TMPL_VAR name="opacnote" --></textarea></td>
+        </tr>
+        <tr>
+            <td><label>Librarian notes</label></td>
+            <td><textarea name="librariannote" cols="60" rows="2"><!-- TMPL_VAR name="librariannote" --></textarea></td>
+        </tr>
+    </table>
+<!--/TMPL_IF-->
 <!-- TMPL_IF name="mod" -->
     <input type="button" value="Save subscription" onclick="Check(this.form)" accesskey="w" class="button">
 <!-- TMPL_ELSE -->

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.2.5
retrieving revision 1.3.2.6
diff -u -b -r1.3.2.5 -r1.3.2.6
--- koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl	15 Nov 2006 15:15:50 -0000	1.3.2.5
+++ koha-tmpl/intranet-tmpl/prog/en/serials/subscription-detail.tmpl	17 Nov 2006 10:53:03 -0000	1.3.2.6
@@ -11,56 +11,56 @@
 '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';
-    }
-}
+// 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){
@@ -201,6 +201,7 @@
                 <!--TMPL_IF name="periodicity11" -->
                         1/2 years
                 <!-- /TMPL_IF -->
+              Manual history : <input type="checkbox" <!--TMPL_IF Name="manualhistory"-->checked<!--/TMPL_IF--> disabled>
             </p>
             <p><label>Number Pattern:</label>
                 <!-- TMPL_IF name="numberpattern1" -->
@@ -360,10 +361,22 @@
         </tr>
     <!-- /TMPL_LOOP -->
     </table>
+	<h3>Subscription summary</h3>
+      <table>
+        <tr>
+          <td><label>Start Date :</label></td>
+          <td> <!-- TMPL_VAR name="histstartdate" --> </td>
+        </tr>
+        <tr>
+          <td><label>End Date :</label></td>
+          <td> <!-- TMPL_VAR name="enddate" --></td>
+        </tr>
+		<tr><td><label>Recieved issues</label></td><td><!-- TMPL_VAR name="recievedlist" --></td></tr>
+		<tr><td><label>Missing issues</label></td><td><!-- TMPL_VAR name="missinglist" --></td></tr>
+		<tr><td><label>Librarian's note</label></td><td><!-- TMPL_VAR name="librariannote" --></td></tr>
+		<tr><td><label>Opac's note</label></td><td><!-- TMPL_VAR name="opacnote" --></td></tr>
+      </table>
 </fieldset>
-</td></tr>
-</table>
-
 </div>
 <script type="text/javascript">
 function _(s) { return s } // dummy function for gettext
@@ -373,6 +386,6 @@
         window.location="subscription-detail.pl?subscriptionid=<!-- TMPL_VAR name="subscriptionid" -->&op=del";
     }
 }
-window.onload = num_pattern();
+// window.onload = num_pattern();
 </script>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

Index: serials/subscription-add.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-add.pl,v
retrieving revision 1.6.2.5
retrieving revision 1.6.2.6
diff -u -b -r1.6.2.5 -r1.6.2.6
--- serials/subscription-add.pl	15 Nov 2006 15:15:50 -0000	1.6.2.5
+++ serials/subscription-add.pl	17 Nov 2006 10:53:03 -0000	1.6.2.6
@@ -38,7 +38,7 @@
 	$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
 	$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
 	$numberingmethod, $status, $biblionumber, 
-	$bibliotitle, $callnumber, $notes, $hemisphere, $letter);
+	$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory);
 
 	my @budgets;
 my ($template, $loggedinuser, $cookie)
@@ -78,20 +78,11 @@
     my $subscriptionid = $query->param('subscriptionid');
 #     warn "irregularity :$irregularity numberpattern : $numberpattern, callnumber :$callnumber, firstacquidate :$firstacquidate";
     my $subs = &GetSubscription($subscriptionid);
-    $auser = $subs->{'user'};
-    $librarian => $subs->{'librarian'},
-    $cost = $subs->{'cost'};
-    $aqbooksellerid = $subs->{'aqbooksellerid'};
-    $aqbooksellername = $subs->{'aqbooksellername'};
-    $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'};
+    $subs->{'startdate'}=format_date($subs->{'startdate'});
+    $subs->{'firstacquidate'}=format_date($subs->{'firstacquidate'});
+    $subs->{'histstartdate'}=format_date($subs->{'histstartdate'});
+    $subs->{'enddate'}=format_date($subs->{enddate});
+    $subs->{'letter'}='' unless($subs->{'letter'});
 
     if($monthlength > 0){
         $sublength = $monthlength;
@@ -113,84 +104,17 @@
         }
         push( @sub_type_data, \%row );
     }
-    $add1 = $subs->{'add1'};
-    $every1 = $subs->{'every1'};
-    $whenmorethan1 = $subs->{'whenmorethan1'};
-    $setto1 = $subs->{'setto1'};
-    $lastvalue1 = $subs->{'lastvalue1'};
-    $innerloop1 = $subs->{'innerloop1'};
-    $add2 = $subs->{'add2'};
-    $every2 = $subs->{'every2'};
-    $whenmorethan2 = $subs->{'whenmorethan2'};
-    $setto2 = $subs->{'setto2'};
-    $lastvalue2 = $subs->{'lastvalue2'};
-    $innerloop2 = $subs->{'innerloop2'};
-    $add3 = $subs->{'add3'};
-    $every3 = $subs->{'every3'};
-    $whenmorethan3 = $subs->{'whenmorethan3'};
-    $setto3 = $subs->{'setto3'};
-    $lastvalue3 = $subs->{'lastvalue3'};
-    $innerloop3 = $subs->{'innerloop3'};
-    $numberingmethod = $subs->{'numberingmethod'};
-    $status = $subs->{status};
-    $biblionumber = $subs->{'biblionumber'};
-    $bibliotitle = $subs->{'bibliotitle'};
-    $callnumber = $subs->{'callnumber'};
-    $notes = $subs->{'notes'};
-    $hemisphere = $subs->{'hemisphere'};
-	$letter = $subs->{'letter'};
-	defined $letter or $letter='';
+
+    $template->param($subs);
     $template->param(
             $op => 1,
-            user => $auser,
-            librarian => $librarian,
-            aqbooksellerid => $aqbooksellerid,
-            aqbooksellername => $aqbooksellername,
-            cost => $cost,
-            aqbudgetid => $aqbudgetid,
-            bookfundid => $bookfundid,
-            startdate => format_date($startdate),
-            firstacquidate => format_date($firstacquidate),	    
-            periodicity => $periodicity,
-            dow => $dow,
-            irregularity => $irregularity,
-            numberpattern => $numberpattern,
-            sublength => $sublength,
             subtype => \@sub_type_data,
-            add1 => $add1,
-            every1 => $every1,
-            whenmorethan1 => $whenmorethan1,
-            setto1 => $setto1,
-            lastvalue1 => $lastvalue1,
-            innerloop1 => $innerloop1,
-            add2 => $add2,
-            every2 => $every2,
-            whenmorethan2 => $whenmorethan2,
-            setto2 => $setto2,
-            lastvalue2 => $lastvalue2,
-            innerloop2 => $innerloop2,
-            add3 => $add3,
-            every3 => $every3,
-            whenmorethan3 => $whenmorethan3,
-            setto3 => $setto3,
-            lastvalue3 => $lastvalue3,
-            innerloop3 => $innerloop3,
-            numberingmethod => $numberingmethod,
-            status => $status,
-            biblionumber => $biblionumber,
-            bibliotitle => $bibliotitle,
-            callnumber => $callnumber,
-            notes => $notes,
-            subscriptionid => $subscriptionid,
-            weekarrayjs => $weekarrayjs,
-            weekno => $weekno,
-            hemisphere => $hemisphere,
-            letter => $letter,
+            history => ($subs->{recievedlist}||$subs->{missinglist}||$subs->{opacnote}||$subs->{librariannote})
             );
     $template->param(
-                "periodicity$periodicity" => 1,
-                "dow$dow" => 1,
-                            "numberpattern$numberpattern" => 1,
+                "periodicity".$subs->{'periodicity'} => 1,
+                "dow".$subs->{'periodicity'} => 1,
+                "numberpattern".$subs->{'periodicity'} => 1,
                 );
 }
 
@@ -273,6 +197,7 @@
     my $hemisphere = $query->param('hemisphere') || 1;
 	my $letter = $query->param('letter');
     ### BugFIX : hdl doesnot know what innerloops or letter stand for but it seems necessary. So he adds them.
+    my $manualhistory = $query->param('manualhist');
     my ($innerloop1,$innerloop2,$innerloop3);
 	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
 					$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
@@ -280,8 +205,9 @@
 					$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
 					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
 					$numberingmethod, $status, $notes,$letter,$firstacquidate,$irregularity,
-                    $numberpattern, $callnumber, $hemisphere
+                    $numberpattern, $callnumber, $hemisphere,$manualhistory
 				);
+
 	print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
 } else {
 

Index: serials/subscription-detail.pl
===================================================================
RCS file: /cvsroot/koha/koha/serials/subscription-detail.pl,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -u -b -r1.3.2.4 -r1.3.2.5
--- serials/subscription-detail.pl	15 Nov 2006 15:15:50 -0000	1.3.2.4
+++ serials/subscription-detail.pl	17 Nov 2006 10:53:03 -0000	1.3.2.5
@@ -23,7 +23,7 @@
     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-    $numberingmethod, $status, $biblionumber, $bibliotitle, $callnumber, $notes, $hemisphere,$letter);
+    $numberingmethod, $status, $biblionumber, $bibliotitle, $callnumber, $notes, $hemisphere,$letter,$manualhistory,$histstartdate,$enddate,$missinglist,$recievedlist,$opacnote,$librariannote);
 
 $subscriptionid = $query->param('subscriptionid');
 
@@ -80,12 +80,22 @@
     $notes = $query->param('notes');
     $hemisphere = $query->param('hemisphere');
     $letter = $query->param('letter');
+    $manualhistory = $query->param('manualhist');
+    $enddate = $query->param('enddate');
+    $histstartdate = format_date_in_iso($query->param('histstartdate'));
+    $recievedlist = $query->param('recievedlist');
+    $missinglist = $query->param('missinglist');
+    $opacnote = $query->param('opacnote');
+    $librariannote = $query->param('librariannote');
+    
     &ModSubscription($auser,$aqbooksellerid,$cost,$aqbudgetid,$startdate,
                     $periodicity,$firstacquidate,$dow,$irregularity,$numberpattern,$numberlength,$weeklength,$monthlength,
                     $add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
                     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
                     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
-                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere, $subscriptionid);
+                    $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere,$manualhistory,$subscriptionid);
+    ModSubscriptionHistory ($subscriptionid,$histstartdate,$enddate,$recievedlist,$missinglist,$opacnote,$librariannote);
+
 }
 
 if ($op eq 'del') {
@@ -128,6 +138,11 @@
             $wkno++;
     }
 chop($weekarrayjs);
+# use Data::Dumper;
+# warn Dumper($subs);
+
+# COMMENT hdl : IMHO, we should think about passing more and more data hash to template->param rather than duplicating code a new coding Guideline ?
+# $template->param($subs);
 
 $template->param(
     routing => $routing,
@@ -175,6 +190,13 @@
     notes => $subs->{notes},
     subscriptionid => $subs->{subscriptionid},
     letter => $subs->{letter},
+    manualhist => $subs->{manualhistory},
+    histstartdate => "".format_date($subs->{histstartdate}),
+    enddate => "".format_date($subs->{enddate}),
+    recievedlist => "".$subs->{recievedlist},
+    missinglist => "".$subs->{missinglist},
+    opacnote => "".$subs->{opacnote},
+    librariannote => "".$subs->{librariannote},
     serialslist => \@serialslist,
     totalissues => $totalissues,
     hemisphere => $hemisphere,

Index: updater/updatedatabase
===================================================================
RCS file: /cvsroot/koha/koha/updater/updatedatabase,v
retrieving revision 1.157.2.20
retrieving revision 1.157.2.21
diff -u -b -r1.157.2.20 -r1.157.2.21
--- updater/updatedatabase	15 Nov 2006 15:15:50 -0000	1.157.2.20
+++ updater/updatedatabase	17 Nov 2006 10:53:04 -0000	1.157.2.21
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.157.2.20 2006/11/15 15:15:50 hdl Exp $
+# $Id: updatedatabase,v 1.157.2.21 2006/11/17 10:53:04 hdl Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -210,7 +210,7 @@
 );
 
 my %requirefields = (
-	subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text NULL', 'firstacquidate'=>'date NOT NULL','irregularity'=>'TINYINT(3) NULL default 0','numberpattern'=>'TINYINT(3) NULL default 0', 'callnumber'=>'text NULL', 'hemisphere' =>'TINYINT(3) NULL default 0', 'issuesatonce'=>'TINYINT(3) NOT NULL default 1',  'branchcode' =>'varchar(12) NOT NULL default \'\''},
+	subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text NULL', 'firstacquidate'=>'date NOT NULL','irregularity'=>'TINYINT(3) NULL default 0','numberpattern'=>'TINYINT(3) NULL default 0', 'callnumber'=>'text NULL', 'hemisphere' =>'TINYINT(3) NULL default 0', 'issuesatonce'=>'TINYINT(3) NOT NULL default 1',  'branchcode' =>'varchar(12) NOT NULL default \'\'', 'manualhistory'=>'TINYINT(1) NOT NULL default 0'},
 	itemtypes => { 'imageurl' => 'char(200) NULL'},
 	aqbookfund => { 'branchcode' => 'varchar(4) NULL'},
 	aqbudget => { 'branchcode' => 'varchar(4) NULL'},
@@ -1936,6 +1936,19 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.157.2.21  2006/11/17 10:53:04  hdl
+# Changing
+# - subscription detail :
+# 	adding manual history (in subscription table)
+# 	addind subscription summary.
+# - menu-serials.inc deleting old link
+# - adapting serials-collection.pl
+#
+# TODO List :
+# - Some values are hard coded in subscription-detail
+# - subscription-detail.pl relies on subscription-add for edition BUT subscription-add transmits back data to subscription-detail in order to save data back into database. This is a bit odd enough and should not occur.
+# - Some more tests on numberlength which doesnot seem to be kept.
+#
 # Revision 1.157.2.20  2006/11/15 15:15:50  hdl
 # Final First Version for New Facility for subscription management.
 #





More information about the Koha-cvs mailing list