Bug 12227: Remove the demo functionality
This is a legacy mode that did not really work. Test plan: Play with frameworks and sysprefs and confirm the changes (add/del/update) are taken into account. Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
76f277930f
commit
5359488528
14
C4/Auth.pm
14
C4/Auth.pm
|
|
@ -1887,15 +1887,6 @@ sub checkpw_internal {
|
|||
return 1, $cardnumber, $userid;
|
||||
}
|
||||
}
|
||||
if ( $userid && $userid eq 'demo'
|
||||
&& "$password" eq 'demo'
|
||||
&& C4::Context->config('demo') )
|
||||
{
|
||||
|
||||
# DEMO => the demo user is allowed to do everything (if demo set to 1 in koha.conf
|
||||
# some features won't be effective : modify systempref, modify MARC structure,
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2052,11 +2043,6 @@ sub haspermission {
|
|||
# Super User Account from /etc/koha.conf
|
||||
$flags->{'superlibrarian'} = 1;
|
||||
}
|
||||
elsif ( $userid eq 'demo' && C4::Context->config('demo') ) {
|
||||
|
||||
# Demo user that can do "anything" (demo=1 in /etc/koha.conf)
|
||||
$flags->{'superlibrarian'} = 1;
|
||||
}
|
||||
|
||||
return $flags if $flags->{superlibrarian};
|
||||
|
||||
|
|
|
|||
|
|
@ -419,16 +419,6 @@ sub checkpw {
|
|||
);
|
||||
return 2;
|
||||
}
|
||||
if ( $userid
|
||||
&& $userid eq 'demo'
|
||||
&& "$password" eq 'demo'
|
||||
&& C4::Context->config('demo') )
|
||||
{
|
||||
|
||||
# DEMO => the demo user is allowed to do everything (if demo set to 1 in koha.conf
|
||||
# some features won't be effective : modify systempref, modify MARC structure,
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,6 @@ if ($op eq 'add_form') {
|
|||
my $hidden = $ohidden[$i]; #collate from 3 hiddens;
|
||||
my $isurl = $input->param("isurl$i")?1:0;
|
||||
if ($liblibrarian) {
|
||||
unless (C4::Context->config('demo') or C4::Context->config('demo') eq 1) {
|
||||
if (auth_subfield_structure_exists($authtypecode, $tagfield, $tagsubfield)) {
|
||||
$sth_update->execute(
|
||||
$authtypecode,
|
||||
|
|
@ -269,7 +268,6 @@ if ($op eq 'add_form') {
|
|||
$defaultvalue,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print $input->redirect("/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode");
|
||||
|
|
@ -293,10 +291,8 @@ if ($op eq 'add_form') {
|
|||
################## DELETE_CONFIRMED ##################################
|
||||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||
} elsif ($op eq 'delete_confirmed') {
|
||||
unless (C4::Context->config('demo') or C4::Context->config('demo') eq 1) {
|
||||
my $sth=$dbh->prepare("delete from auth_subfield_structure where tagfield=? and tagsubfield=? and authtypecode=?");
|
||||
$sth->execute($tagfield,$tagsubfield,$authtypecode);
|
||||
}
|
||||
my $sth=$dbh->prepare("delete from auth_subfield_structure where tagfield=? and tagsubfield=? and authtypecode=?");
|
||||
$sth->execute($tagfield,$tagsubfield,$authtypecode);
|
||||
print $input->redirect("/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode");
|
||||
exit;
|
||||
# END $OP eq DELETE_CONFIRMED
|
||||
|
|
|
|||
|
|
@ -117,31 +117,29 @@ if ($op eq 'add_form') {
|
|||
my $repeatable = $input->param('repeatable') ? 1 : 0;
|
||||
my $mandatory = $input->param('mandatory') ? 1 : 0;
|
||||
my $authorised_value = $input->param('authorised_value');
|
||||
unless (C4::Context->config('demo') eq 1) {
|
||||
if ($input->param('modif')) {
|
||||
$sth=$dbh->prepare("UPDATE auth_tag_structure SET tagfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, authorised_value=? WHERE authtypecode=? AND tagfield=?");
|
||||
$sth->execute(
|
||||
$tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$tagfield,
|
||||
);
|
||||
} else {
|
||||
$sth=$dbh->prepare("INSERT INTO auth_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,authtypecode) VALUES (?,?,?,?,?,?,?)");
|
||||
$sth->execute(
|
||||
$tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$authtypecode
|
||||
);
|
||||
}
|
||||
if ($input->param('modif')) {
|
||||
$sth=$dbh->prepare("UPDATE auth_tag_structure SET tagfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, authorised_value=? WHERE authtypecode=? AND tagfield=?");
|
||||
$sth->execute(
|
||||
$tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$tagfield,
|
||||
);
|
||||
} else {
|
||||
$sth=$dbh->prepare("INSERT INTO auth_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,authtypecode) VALUES (?,?,?,?,?,?,?)");
|
||||
$sth->execute(
|
||||
$tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$authtypecode
|
||||
);
|
||||
}
|
||||
print $input->redirect("/cgi-bin/koha/admin/auth_tag_structure.pl?searchfield=$tagfield&authtypecode=$authtypecode");
|
||||
exit;
|
||||
|
|
@ -160,10 +158,8 @@ if ($op eq 'add_form') {
|
|||
################## DELETE_CONFIRMED ##################################
|
||||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||
} elsif ($op eq 'delete_confirmed') {
|
||||
unless (C4::Context->config('demo') eq 1) {
|
||||
$dbh->do(q|delete from auth_tag_structure where tagfield=? and authtypecode=?|, undef, $searchfield, $authtypecode);
|
||||
$dbh->do(q|delete from auth_subfield_structure where tagfield=? and authtypecode=?|, undef, $searchfield, $authtypecode);
|
||||
}
|
||||
$dbh->do(q|delete from auth_tag_structure where tagfield=? and authtypecode=?|, undef, $searchfield, $authtypecode);
|
||||
$dbh->do(q|delete from auth_subfield_structure where tagfield=? and authtypecode=?|, undef, $searchfield, $authtypecode);
|
||||
my $tagfield = $input->param('tagfield');
|
||||
print $input->redirect("/cgi-bin/koha/admin/auth_tag_structure.pl?searchfield=$tagfield&authtypecode=$authtypecode");
|
||||
exit;
|
||||
|
|
|
|||
|
|
@ -281,61 +281,58 @@ elsif ( $op eq 'add_validate' ) {
|
|||
my $maxlength = $maxlength[$i] ? $maxlength[$i] : 9999;
|
||||
|
||||
if (defined($liblibrarian) && $liblibrarian ne "") {
|
||||
my $is_demo = C4::Context->config('demo') || '';
|
||||
if ( $is_demo ne '1' ) {
|
||||
if (marc_subfield_structure_exists($tagfield, $tagsubfield, $frameworkcode)) {
|
||||
$sth_update->execute(
|
||||
if (marc_subfield_structure_exists($tagfield, $tagsubfield, $frameworkcode)) {
|
||||
$sth_update->execute(
|
||||
$tagfield,
|
||||
$tagsubfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$kohafield,
|
||||
$tab,
|
||||
$seealso,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$value_builder,
|
||||
$hidden,
|
||||
$isurl,
|
||||
$frameworkcode,
|
||||
$link,
|
||||
$defaultvalue,
|
||||
$maxlength,
|
||||
(
|
||||
$tagfield,
|
||||
$tagsubfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$kohafield,
|
||||
$tab,
|
||||
$seealso,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$value_builder,
|
||||
$hidden,
|
||||
$isurl,
|
||||
$frameworkcode,
|
||||
$link,
|
||||
$defaultvalue,
|
||||
$maxlength,
|
||||
(
|
||||
$tagfield,
|
||||
$tagsubfield,
|
||||
$frameworkcode,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
if( $frameworkcode ne q{} ) {
|
||||
# BZ 19096: Overwrite kohafield from Default when adding a new record
|
||||
my $rec = Koha::MarcSubfieldStructures->find( q{}, $tagfield, $tagsubfield );
|
||||
$kohafield = $rec->kohafield if $rec;
|
||||
}
|
||||
$sth_insert->execute(
|
||||
$tagfield,
|
||||
$tagsubfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$kohafield,
|
||||
$tab,
|
||||
$seealso,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$value_builder,
|
||||
$hidden,
|
||||
$isurl,
|
||||
$frameworkcode,
|
||||
$link,
|
||||
$defaultvalue,
|
||||
$maxlength,
|
||||
);
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if( $frameworkcode ne q{} ) {
|
||||
# BZ 19096: Overwrite kohafield from Default when adding a new record
|
||||
my $rec = Koha::MarcSubfieldStructures->find( q{}, $tagfield, $tagsubfield );
|
||||
$kohafield = $rec->kohafield if $rec;
|
||||
}
|
||||
$sth_insert->execute(
|
||||
$tagfield,
|
||||
$tagsubfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$kohafield,
|
||||
$tab,
|
||||
$seealso,
|
||||
$authorised_value,
|
||||
$authtypecode,
|
||||
$value_builder,
|
||||
$hidden,
|
||||
$isurl,
|
||||
$frameworkcode,
|
||||
$link,
|
||||
$defaultvalue,
|
||||
$maxlength,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -378,15 +375,12 @@ elsif ( $op eq 'delete_confirm' ) {
|
|||
}
|
||||
elsif ( $op eq 'delete_confirmed' ) {
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $is_demo = C4::Context->config('demo') || '';
|
||||
if ( $is_demo ne '1' ) {
|
||||
my $sth =
|
||||
$dbh->prepare(
|
||||
my $sth =
|
||||
$dbh->prepare(
|
||||
"delete from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?"
|
||||
);
|
||||
$sth->execute( $tagfield, $tagsubfield, $frameworkcode );
|
||||
$sth->finish;
|
||||
}
|
||||
);
|
||||
$sth->execute( $tagfield, $tagsubfield, $frameworkcode );
|
||||
$sth->finish;
|
||||
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
|
||||
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
|
||||
$cache->clear_from_cache("default_value_for_mod_marc-");
|
||||
|
|
|
|||
|
|
@ -121,37 +121,35 @@ if ($op eq 'add_form') {
|
|||
my $repeatable = $input->param('repeatable') ? 1 : 0;
|
||||
my $mandatory = $input->param('mandatory') ? 1 : 0;
|
||||
my $authorised_value = $input->param('authorised_value');
|
||||
unless (C4::Context->config('demo')) {
|
||||
if ($input->param('modif')) {
|
||||
$sth = $dbh->prepare(
|
||||
"UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
|
||||
);
|
||||
$sth->execute( $liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$frameworkcode,
|
||||
$tagfield
|
||||
);
|
||||
} else {
|
||||
$sth = $dbh->prepare(
|
||||
"INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"
|
||||
);
|
||||
$sth->execute($tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$frameworkcode
|
||||
);
|
||||
}
|
||||
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
|
||||
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
|
||||
$cache->clear_from_cache("default_value_for_mod_marc-");
|
||||
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
|
||||
if ($input->param('modif')) {
|
||||
$sth = $dbh->prepare(
|
||||
"UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
|
||||
);
|
||||
$sth->execute( $liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$frameworkcode,
|
||||
$tagfield
|
||||
);
|
||||
} else {
|
||||
$sth = $dbh->prepare(
|
||||
"INSERT INTO marc_tag_structure (tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value,frameworkcode) values (?,?,?,?,?,?,?)"
|
||||
);
|
||||
$sth->execute($tagfield,
|
||||
$liblibrarian,
|
||||
$libopac,
|
||||
$repeatable,
|
||||
$mandatory,
|
||||
$authorised_value,
|
||||
$frameworkcode
|
||||
);
|
||||
}
|
||||
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
|
||||
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
|
||||
$cache->clear_from_cache("default_value_for_mod_marc-");
|
||||
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
|
||||
print $input->redirect("/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$tagfield&frameworkcode=$frameworkcode");
|
||||
exit;
|
||||
# END $OP eq ADD_VALIDATE
|
||||
|
|
@ -170,16 +168,14 @@ if ($op eq 'add_form') {
|
|||
################## DELETE_CONFIRMED ##################################
|
||||
# called by delete_confirm, used to effectively confirm deletion of data in DB
|
||||
} elsif ($op eq 'delete_confirmed') {
|
||||
unless (C4::Context->config('demo')) {
|
||||
my $sth1 = $dbh->prepare("DELETE FROM marc_tag_structure WHERE tagfield=? AND frameworkcode=?");
|
||||
my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
|
||||
$sth1->execute($searchfield, $frameworkcode);
|
||||
$sth2->execute($searchfield, $frameworkcode);
|
||||
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
|
||||
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
|
||||
$cache->clear_from_cache("default_value_for_mod_marc-");
|
||||
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
|
||||
}
|
||||
my $sth1 = $dbh->prepare("DELETE FROM marc_tag_structure WHERE tagfield=? AND frameworkcode=?");
|
||||
my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
|
||||
$sth1->execute($searchfield, $frameworkcode);
|
||||
$sth2->execute($searchfield, $frameworkcode);
|
||||
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
|
||||
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
|
||||
$cache->clear_from_cache("default_value_for_mod_marc-");
|
||||
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
|
||||
$template->param(
|
||||
searchfield => $searchfield,
|
||||
frameworkcode => $frameworkcode,
|
||||
|
|
|
|||
|
|
@ -314,16 +314,14 @@ $tab ||= 'acquisitions'; # Ideally this should be "local-use" but preferences.pl
|
|||
my $highlighted;
|
||||
|
||||
if ( $op eq 'save' ) {
|
||||
unless ( C4::Context->config( 'demo' ) ) {
|
||||
foreach my $param ( $input->param() ) {
|
||||
my ( $pref ) = ( $param =~ /pref_(.*)/ );
|
||||
foreach my $param ( $input->param() ) {
|
||||
my ( $pref ) = ( $param =~ /pref_(.*)/ );
|
||||
|
||||
next if ( !defined( $pref ) );
|
||||
next if ( !defined( $pref ) );
|
||||
|
||||
my $value = join( ',', $input->param( $param ) );
|
||||
my $value = join( ',', $input->param( $param ) );
|
||||
|
||||
C4::Context->set_preference( $pref, $value );
|
||||
}
|
||||
C4::Context->set_preference( $pref, $value );
|
||||
}
|
||||
|
||||
print $input->redirect( '/cgi-bin/koha/admin/preferences.pl?tab=' . $tab );
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ if ( $op eq 'update_and_reedit' ) {
|
|||
}
|
||||
}
|
||||
my $variable = $input->param('variable');
|
||||
C4::Context->set_preference($variable, $value) unless C4::Context->config('demo');
|
||||
C4::Context->set_preference($variable, $value);
|
||||
}
|
||||
|
||||
################## ADD_FORM ##################################
|
||||
|
|
@ -335,8 +335,7 @@ if ( $op eq 'add_form' ) {
|
|||
$value = encode_base64($value);
|
||||
}
|
||||
|
||||
C4::Context->set_preference( $variable, $value, $expl, $type, $options )
|
||||
unless C4::Context->config('demo');
|
||||
C4::Context->set_preference( $variable, $value, $expl, $type, $options );
|
||||
print $input->redirect("/cgi-bin/koha/admin/systempreferences.pl?tab=");
|
||||
exit;
|
||||
################## DELETE_CONFIRM ##################################
|
||||
|
|
|
|||
Loading…
Reference in New Issue