(bug #3553) do not allow users to create code-less frameworks
This patch, disallow the users to create frameworks without frameworkcode. It adds some javascripts checks, and some perls checks(for non-javascript users).
This commit is contained in:
parent
8262082fa2
commit
ded4fc407e
|
|
@ -74,13 +74,16 @@ if ($op eq 'add_form') {
|
|||
################## ADD_VALIDATE ##################################
|
||||
# called by add_form, used to insert/modify data in DB
|
||||
} elsif ($op eq 'add_validate') {
|
||||
if ($input->param('modif')) {
|
||||
my $sth=$dbh->prepare("UPDATE biblio_framework SET frameworktext=? WHERE frameworkcode=?");
|
||||
$sth->execute($input->param('frameworktext'),$input->param('frameworkcode'));
|
||||
} else {
|
||||
my $sth=$dbh->prepare("INSERT into biblio_framework (frameworkcode,frameworktext) values (?,?)");
|
||||
$sth->execute($input->param('frameworkcode'),$input->param('frameworktext'));
|
||||
}
|
||||
my $dbh = C4::Context->dbh;
|
||||
if($input->param('frameworktext') and $input->param('frameworkcode')){
|
||||
if ($input->param('modif')) {
|
||||
my $sth=$dbh->prepare("UPDATE biblio_framework SET frameworktext=? WHERE frameworkcode=?");
|
||||
$sth->execute($input->param('frameworktext'),$input->param('frameworkcode'));
|
||||
} else {
|
||||
my $sth=$dbh->prepare("INSERT into biblio_framework (frameworkcode,frameworktext) values (?,?)");
|
||||
$sth->execute($input->param('frameworkcode'),$input->param('frameworktext'));
|
||||
}
|
||||
}
|
||||
print $input->redirect($script_name); # FIXME: unnecessary redirect
|
||||
exit;
|
||||
# END $OP eq ADD_VALIDATE
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ function Check(f) {
|
|||
alertString2 += "\n------------------------------------------------------------------------------------\n";
|
||||
alertString2 += _alertString;
|
||||
alert(alertString2);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
@ -74,7 +76,7 @@ $(document).ready(function() {
|
|||
|
||||
<!-- TMPL_IF NAME="add_form" -->
|
||||
<h1><!-- TMPL_IF NAME="frameworkcode" -->Modify framework text<!-- TMPL_ELSE -->Add framework<!-- /TMPL_IF --></h1>
|
||||
<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post">
|
||||
<form action="<!-- TMPL_VAR NAME="script_name" -->" name="Aform" method="post" onsubmit="return Check(this);">
|
||||
<input type="hidden" name="op" value="add_validate" />
|
||||
<fieldset class="rows">
|
||||
<ol>
|
||||
|
|
@ -87,7 +89,7 @@ $(document).ready(function() {
|
|||
<!-- /TMPL_IF -->
|
||||
<li><label for="description">Description</label>
|
||||
<input type="text" name="frameworktext" id="description" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="frameworktext" ESCAPE="HTML" -->" /></li></ol></fieldset>
|
||||
<fieldset class="action"> <input type="submit" value="Submit" class="submit" onclick="Check(this.form)" /></fieldset>
|
||||
<fieldset class="action"> <input type="submit" value="Submit" class="submit" /></fieldset>
|
||||
</form>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue