[Koha-patches] [PATCH] Add Logging module 'SYSTEMPREFERENCE', log adds, mods & deletes.

Ryan Higgins rch at liblime.com
Mon Apr 7 05:09:24 CEST 2008


---
 admin/systempreferences.pl                         |   14 ++++++++++++--
 .../prog/en/modules/admin/systempreferences.tmpl   |    8 ++++++--
 .../prog/en/modules/tools/viewlog.tmpl             |    6 ++++--
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 6a1ed4d..37a30cf 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -47,6 +47,7 @@ use C4::Context;
 use C4::Koha;
 use C4::Languages qw(getTranslatedLanguages);
 use C4::ClassSource;
+use C4::Log;
 use C4::Output;
 use C4::Context;
 
@@ -333,8 +334,9 @@ sub StringSearch  {
 }
 
 my $input = new CGI;
-my $searchfield=$input->param('searchfield');
-my $offset=$input->param('offset');
+my $searchfield = $input->param('searchfield');
+my $Tvalue = $input->param('Tvalue');
+my $offset = $input->param('offset');
 my $script_name="/cgi-bin/koha/admin/systempreferences.pl";
 
 my ($template, $borrowernumber, $cookie)
@@ -400,12 +402,16 @@ if ($op eq 'update_and_reedit') {
             my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
             $sth->execute($value, $input->param('explanation'), $input->param('variable'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+			warn "logaction !! mod ";
+			logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value );
         }
     } else {
         unless (C4::Context->config('demo') eq 1) {
             my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation) values (?,?,?,?,?)");
             $sth->execute($input->param('variable'), $input->param('value'), $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+			warn "logaction !! add ";
+			logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $input->param('value') );
         }
     }
     $sth->finish;
@@ -538,12 +544,14 @@ if ($op eq 'add_form') {
             my $sth=$dbh->prepare("update systempreferences set value=?,explanation=?,type=?,options=? where variable=?");
             $sth->execute($value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'), $input->param('variable'));
             $sth->finish;
+			logaction('SYSTEMPREFERENCE','MODIFY',undef, $input->param('variable') . " | " . $value );
         }
     } else {
         unless (C4::Context->config('demo') eq 1) {
             my $sth=$dbh->prepare("insert into systempreferences (variable,value,explanation,type,options) values (?,?,?,?,?)");
             $sth->execute($input->param('variable'), $value, $input->param('explanation'), $input->param('preftype'), $input->param('prefoptions'));
             $sth->finish;
+			logaction('SYSTEMPREFERENCE','ADD',undef, $input->param('variable') . " | " . $value );
         }
     }
     $sth->finish;
@@ -568,6 +576,8 @@ if ($op eq 'add_form') {
     my $dbh = C4::Context->dbh;
     my $sth=$dbh->prepare("delete from systempreferences where variable=?");
     $sth->execute($searchfield);
+	my $logstring =  $searchfield . " | " . $Tvalue ;
+	logaction('SYSTEMPREFERENCE','DELETE',undef,$logstring);
     $sth->finish;
 
                                                     # END $OP eq DELETE_CONFIRMED
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tmpl
index a2150be..6279c97 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tmpl
@@ -194,8 +194,12 @@
         <tr><th>Value: </th><td>
         <!-- TMPL_VAR NAME="Tvalue" -->
         </td></tr></table>
-        <form class="inline" action="<!-- TMPL_VAR NAME="script_name" -->" method="post"><input type="hidden" name="op" value="delete_confirmed" /><input type="hidden" name="searchfield" value="<!-- TMPL_VAR NAME="searchfield" -->" />
-        <input type="submit"  value="Yes, Delete" /></form> <form class="inline" action="<!-- TMPL_VAR NAME="script_name" -->" method="post"><input type="submit" value="No, Do not Delete" /></form>
+        <form class="inline" action="<!-- TMPL_VAR NAME="script_name" -->" method="post">
+		<input type="hidden" name="op" value="delete_confirmed" />
+		<input type="hidden" name="searchfield" value="<!-- TMPL_VAR NAME="searchfield" -->" />
+		<input type="hidden" name="Tvalue" value="<!-- TMPL_VAR NAME="Tvalue" -->" />
+        <input type="submit"  value="Yes, Delete" /></form> 
+		<form class="inline" action="<!-- TMPL_VAR NAME="script_name" -->" method="post"><input type="submit" value="No, Do not Delete" /></form>
     
     
     <!-- /TMPL_IF -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
index 06ac666..c6e2325 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tmpl
@@ -20,10 +20,11 @@
 <form method="post" action="/cgi-bin/koha/tools/viewlog.pl">
 
 	    <!-- TMPL_IF NAME="do_it" --><input type="hidden" name="do_it" value="<!--TMPL_VAR NAME="do_it" -->" /><!-- /TMPL_IF -->
-	    <input type="hidden" name="module" value="<!--TMPL_VAR NAME="module" -->" />
+<!--	These are selects below.
+		<input type="hidden" name="module" value="<!--TMPL_VAR NAME="module" -->" />
 	    <input type="hidden" name="action" value="<!--TMPL_VAR NAME="action" -->" />
 	    <input type="hidden" name="object" value="<!--TMPL_VAR NAME="object" -->" />
-	    <input type="hidden" name="src" value="<!--TMPL_VAR NAME="src" -->" />
+-->	    <input type="hidden" name="src" value="<!--TMPL_VAR NAME="src" -->" />
 <fieldset>
     <legend>Additional parameters</legend>
         <p>
@@ -121,6 +122,7 @@
 				<option value="CIRCULATION">Circulation</option>
 				<option value="LETTER">Letter</option>
 				<option value="FINES">Fines</option>
+				<option value="SYSTEMPREFERENCE">System Prefs</option>
 			</select>
 	    </td>
 	    <td>
-- 
1.5.2.1




More information about the Koha-patches mailing list