[Koha-patches] [PATCH] added back itemtypes.replacement_price

Galen Charlton galen.charlton at liblime.com
Tue Jun 23 02:37:28 CEST 2009


---
 admin/itemtypes.pl                                 |    7 +++++--
 installer/data/mysql/kohastructure.sql             |    1 +
 .../data/mysql/updatedatabase_replacement_price.pl |    8 ++++++++
 .../prog/en/modules/admin/itemtypes.tmpl           |    5 +++++
 4 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100755 installer/data/mysql/updatedatabase_replacement_price.pl

diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl
index 62d853e..acac4cb 100755
--- a/admin/itemtypes.pl
+++ b/admin/itemtypes.pl
@@ -141,6 +141,7 @@ elsif ( $op eq 'add_validate' ) {
             SET    description = ?
                  , renewalsallowed = ?
                  , rentalcharge = ?
+		 , replacement_price = ?
                  , notforloan = ?
                  , imageurl = ?
                  , summary = ?
@@ -151,6 +152,7 @@ elsif ( $op eq 'add_validate' ) {
             $input->param('description'),
             $input->param('renewalsallowed'),
             $input->param('rentalcharge'),
+            $input->param('replacement_price'),
             ( $input->param('notforloan') ? 1 : 0 ),
             (
                 $input->param('image') eq 'removeImage' ? '' : (
@@ -166,8 +168,8 @@ elsif ( $op eq 'add_validate' ) {
     else {    # add a new itemtype & not modif an old
         my $query = "
             INSERT INTO itemtypes
-                (itemtype,description,renewalsallowed,rentalcharge,notforloan, imageurl,summary)
-            VALUES (?,?,?,?,?,?,?);
+                (itemtype,description,renewalsallowed,replacement_price,rentalcharge,notforloan, imageurl,summary)
+            VALUES (?,?,?,?,?,?,?,?);
             ";
         my $sth = $dbh->prepare($query);
 		my $image = $input->param('image');
@@ -176,6 +178,7 @@ elsif ( $op eq 'add_validate' ) {
             $input->param('itemtype'),
             $input->param('description'),
 	    $renewalsallowed,
+            $input->param('replacement_price'),
             $input->param('rentalcharge'),
             $input->param('notforloan') ? 1 : 0,
             $image eq 'removeImage' ?           ''                 :
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index bcafeab..a06976b 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -1293,6 +1293,7 @@ CREATE TABLE `itemtypes` (
   `description` mediumtext,
   `renewalsallowed` smallint(6) default NULL,
   `rentalcharge` double(16,4) default NULL,
+  `replacement_price` decimal(8,2) default '0.00',
   `notforloan` smallint(6) default NULL,
   `imageurl` varchar(200) default NULL,
   `summary` text,
diff --git a/installer/data/mysql/updatedatabase_replacement_price.pl b/installer/data/mysql/updatedatabase_replacement_price.pl
new file mode 100755
index 0000000..7c8ec50
--- /dev/null
+++ b/installer/data/mysql/updatedatabase_replacement_price.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use C4::Context;
+
+C4::Context->dbh->do("ALTER TABLE itemtypes ADD replacement_price DECIMAL(8,2) DEFAULT '0.00' AFTER rentalcharge");
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl
index 49b9eb5..b727a6b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/itemtypes.tmpl
@@ -223,6 +223,11 @@ Item Types Administration
             <!-- /TMPL_IF -->
           <span class="hint">(if checked, no item of this type can be issued. If not checked, every item of this type can be issued unless notforloan is set for a specific item)</span>
       </li>
+         <label for="renewalsallowed">Default Renewals: </label>
+                <input type="text" id="renewalsallowed" name="renewalsallowed" size="3" maxlength="3" value="<!-- TMPL_VAR NAME="renewalsallowed" -->" />
+         <span class="hint">Number of times this itemtype may be renewed.  This value can be overridden by specific circulation policies.</span>
+       </li>
+     <li>
       <li>
           <label for="rentalcharge">Default Rental charge: </label>
 		  <input type="text" id="rentalcharge" name="rentalcharge" size="6" value="<!-- TMPL_VAR name="rentalcharge" -->" />
-- 
1.5.6.5




More information about the Koha-patches mailing list