[Koha-patches] [PATCH 1/3] Adding and managing location in subscription

Galen Charlton galen.charlton at liblime.com
Wed May 27 16:57:22 CEST 2009


From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>

Signed-off-by: Galen Charlton <galen.charlton at liblime.com>
---
 C4/Serials.pm                                      |   17 +++++++++--------
 installer/data/mysql/kohastructure.sql             |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../prog/en/modules/serials/subscription-add.tmpl  |    4 ++++
 .../en/modules/serials/subscription-detail.tmpl    |    1 +
 kohaversion.pl                                     |    2 +-
 serials/subscription-add.pl                        |    8 +++++---
 7 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index 5dfd727..8928b95 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -1301,7 +1301,7 @@ sub ModSubscription {
         $numberingmethod, $status,       $biblionumber,   $callnumber,
         $notes,           $letter,       $hemisphere,     $manualhistory,
         $internalnotes,   $serialsadditems,$subscriptionid,
-        $staffdisplaycount,$opacdisplaycount
+        $staffdisplaycount,$opacdisplaycount, $location
     ) = @_;
 #     warn $irregularity;
     my $dbh   = C4::Context->dbh;
@@ -1311,7 +1311,7 @@ sub ModSubscription {
                         add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
                         add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
                         add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,staffdisplaycount = ?,opacdisplaycount = ?
+                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,staffdisplaycount = ?,opacdisplaycount = ?, location = ?
                     WHERE subscriptionid = ?";
      #warn "query :".$query;
     my $sth = $dbh->prepare($query);
@@ -1327,7 +1327,8 @@ sub ModSubscription {
         $numberingmethod, $status,       $biblionumber,   $callnumber,
         $notes,           $letter,       $hemisphere,     ($manualhistory?$manualhistory:0),
         $internalnotes,   $serialsadditems,
-        $staffdisplaycount, $opacdisplaycount, $subscriptionid
+        $staffdisplaycount, $opacdisplaycount, $location,
+        $subscriptionid
     );
     my $rows=$sth->rows;
     $sth->finish;
@@ -1346,7 +1347,7 @@ $subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbu
     $add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
     $add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
     $numberingmethod, $status, $notes, $serialsadditems,
-    $staffdisplaycount, $opacdisplaycount, $graceperiod);
+    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location);
 
 Create a new subscription with value given on input args.
 
@@ -1370,7 +1371,7 @@ sub NewSubscription {
         $notes,         $letter,       $firstacquidate,  $irregularity,
         $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
         $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
-        $graceperiod
+        $graceperiod, $location
     ) = @_;
     my $dbh = C4::Context->dbh;
 
@@ -1384,8 +1385,8 @@ sub NewSubscription {
             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
             numberingmethod, status, notes, letter,firstacquidate,irregularity,
             numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,
-            staffdisplaycount,opacdisplaycount,graceperiod)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+            staffdisplaycount,opacdisplaycount,graceperiod,location)
+        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
         |;
     my $sth = $dbh->prepare($query);
     $sth->execute(
@@ -1411,7 +1412,7 @@ sub NewSubscription {
         $hemisphere,                    $manualhistory,
         $internalnotes,                 $serialsadditems,
 		$staffdisplaycount,				$opacdisplaycount,
-        $graceperiod,
+        $graceperiod,                   $location,
     );
 
     #then create the 1st waited number
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index c17c4ba..af65299 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1892,6 +1892,7 @@ CREATE TABLE `subscription` (
   `distributedto` text,
   `internalnotes` longtext,
   `callnumber` text,
+  `location` varchar(80) NULL default '',
   `branchcode` varchar(10) NOT NULL default '',
   `hemisphere` tinyint(3) default 0,
   `lastbranch` varchar(10),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 09af52b..3300dec 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2437,6 +2437,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (Adding graceperiod column to subscription table)\n";
     SetVersion ($DBversion);
 }
+$DBversion = '3.01.00.015';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(q{ ALTER TABLE `subscription` ADD location varchar(80) NULL DEFAULT '' AFTER callnumber; });
+   print "Upgrade to $DBversion done (Adding location to subscription table)\n";
+    SetVersion ($DBversion);
+}
+
 
 =item DropAllForeignKeys($table)
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
index c2c4400..ccdc35e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
@@ -985,6 +985,10 @@ $(document).ready(function() {
             <!-- /TMPL_IF -->
         </li>
         <li>
+            <label for="location">Location:</label>
+            <input type="text" name="location" id="location" value="<!-- TMPL_VAR name="location" -->" size="30" />
+        </li>
+         <li>
             <label for="callnumber">Call Number:</label>
             <input type="text" name="callnumber" id="callnumber" value="<!-- TMPL_VAR name="callnumber" -->" size="20" />
         </li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
index 93e92cc..784b520 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
@@ -67,6 +67,7 @@ function popup(subscriptionid) {
             <li>Serial receipt does not create an item record.</li>
         <!-- /TMPL_IF -->
         <li><span class="label">Grace period:</span> <!-- TMPL_VAR name="graceperiod" -->&nbsp;</li>
+        <!-- TMPL_IF name="location" --><li><span class="label">Location:</span> <!-- TMPL_VAR name="location" -->&nbsp;</li><!-- /TMPL_IF -->
         <!-- TMPL_IF name="callnumber" --><li><span class="label">Call Number:</span> <!-- TMPL_VAR name="callnumber" -->&nbsp;</li><!-- /TMPL_IF -->
 		<!-- TMPL_IF NAME="staffdisplaycount" --><li><span class="label">Number of issues to display to staff</span>:&nbsp;<!-- TMPL_VAR NAME="staffdisplaycount" -->&nbsp;</li><!-- /TMPL_IF -->
 		<!-- TMPL_IF NAME="opacdisplaycount" --><li><span class="label">Number of issues to display to the public</span>:&nbsp;<!-- TMPL_VAR NAME="opacdisplaycount" -->&nbsp;</li><!-- /TMPL_IF -->
diff --git a/kohaversion.pl b/kohaversion.pl
index 6d838d3..7c3e8cf 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.034';
+    our $VERSION = '3.01.00.035';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl
index dba37ad..7ac663f 100755
--- a/serials/subscription-add.pl
+++ b/serials/subscription-add.pl
@@ -40,7 +40,7 @@ my ($subscriptionid,$auser,$branchcode,$librarian,$cost,$aqbooksellerid, $aqbook
 	$add2,$every2,$whenmorethan2,$setto2,$lastvalue2,$innerloop2,
 	$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
 	$numberingmethod, $status, $biblionumber, 
-	$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory,$serialsadditems);
+	$bibliotitle, $callnumber, $notes, $hemisphere, $letter, $manualhistory,$serialsadditems, $location);
 
 	my @budgets;
 my ($template, $loggedinuser, $cookie)
@@ -217,6 +217,7 @@ if ($op eq 'addsubscription') {
     my $serialsadditems = $query->param('serialsadditems');
 	my $staffdisplaycount = $query->param('staffdisplaycount');
 	my $opacdisplaycount = $query->param('opacdisplaycount');
+    my $location = $query->param('location');
 	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
 					$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
 					$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
@@ -224,7 +225,7 @@ if ($op eq 'addsubscription') {
 					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
 					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",", at irregularity),
                     $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
-                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod
+                    $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location
 				);
 
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
@@ -293,6 +294,7 @@ if ($op eq 'addsubscription') {
     my $history_only = $query->param('history_only');
 	my $staffdisplaycount = $query->param('staffdisplaycount');
 	my $opacdisplaycount = $query->param('opacdisplaycount');
+    my $location = $query->param('location');
 	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
     if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
         ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
@@ -314,7 +316,7 @@ if ($op eq 'addsubscription') {
             $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
             $numberingmethod, $status,       $biblionumber,   $callnumber,
             $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
-            $serialsadditems, $subscriptionid,$staffdisplaycount,$opacdisplaycount
+            $serialsadditems, $subscriptionid,$staffdisplaycount,$opacdisplaycount,$location
         );
     }
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
-- 
1.5.6.5



More information about the Koha-patches mailing list