Add Logging module 'SYSTEMPREFERENCE', log adds, mods & deletes.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Ryan Higgins 2008-04-06 22:09:24 -05:00 committed by Joshua Ferraro
parent d13007e5a6
commit 8d51042a29
3 changed files with 22 additions and 6 deletions

View file

@ -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

View file

@ -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 -->

View file

@ -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>