From faa394ecd4ef7eb1f4a6f2a043290f07bd58b729 Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 26 Aug 2009 13:18:50 +0200 Subject: [PATCH] (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). Signed-off-by: Henri-Damien LAURENT --- admin/biblio_framework.pl | 20 ++++++++++--------- .../en/modules/admin/biblio_framework.tmpl | 6 ++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/admin/biblio_framework.pl b/admin/biblio_framework.pl index 3837ca5464..77dc7971af 100755 --- a/admin/biblio_framework.pl +++ b/admin/biblio_framework.pl @@ -95,15 +95,17 @@ if ($op eq 'add_form') { # called by add_form, used to insert/modify data in DB } elsif ($op eq 'add_validate') { my $dbh = C4::Context->dbh; - if ($input->param('modif')) { - my $sth=$dbh->prepare("UPDATE biblio_framework SET frameworktext=? WHERE frameworkcode=?"); - $sth->execute($input->param('frameworktext'),$input->param('frameworkcode')); - $sth->finish; - } else { - my $sth=$dbh->prepare("INSERT into biblio_framework (frameworkcode,frameworktext) values (?,?)"); - $sth->execute($input->param('frameworkcode'),$input->param('frameworktext')); - $sth->finish; - } + 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')); + $sth->finish; + } else { + my $sth=$dbh->prepare("INSERT into biblio_framework (frameworkcode,frameworktext) values (?,?)"); + $sth->execute($input->param('frameworkcode'),$input->param('frameworktext')); + $sth->finish; + } + } print "Content-Type: text/html\n\n"; exit; # END $OP eq ADD_VALIDATE diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl index dc34b489ea..4935744816 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tmpl @@ -52,7 +52,9 @@ function Check(f) { alertString2 += "\n------------------------------------------------------------------------------------\n"; alertString2 += _alertString; alert(alertString2); + return false; } + return true; } //]]> @@ -93,7 +95,7 @@ function Check(f) {

Modify framework textAdd framework

-
" name="Aform" method="post"> + " name="Aform" method="post" onsubmit="return Check(this);">
    @@ -104,7 +106,7 @@ function Check(f) {
  1. " />
-
+
-- 2.39.5