Bug 20912: Rental Fees based on Time Period
[koha.git] / admin / auth_tag_structure.pl
index ddf163a..b66cbff 100755 (executable)
@@ -18,8 +18,7 @@
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-#use warnings; FIXME - Bug 2505
+use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Koha;
@@ -51,7 +50,7 @@ my ($template, $loggedinuser, $cookie)
                  query => $input,
                  type => "intranet",
                  authnotrequired => 0,
-                 flagsrequired => {parameters => 'parameters_remaining_permissions'},
+                 flagsrequired => {parameters => 'manage_marc_frameworks'},
                  debug => 1,
                  });
 
@@ -117,31 +116,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&amp;authtypecode=$authtypecode");
     exit;
@@ -160,10 +157,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&amp;authtypecode=$authtypecode");
     exit;
@@ -202,9 +197,6 @@ if ($op eq 'add_form') {
         $row_data{repeatable}       = $results->[$i]{'repeatable'};
         $row_data{mandatory}        = $results->[$i]{'mandatory'};
         $row_data{authorised_value} = $results->[$i]{'authorised_value'};
-        $row_data{subfield_link}    = "auth_subfields_structure.pl?tagfield=" . $results->[$i]{'tagfield'} . "&amp;authtypecode=" . $authtypecode;
-        $row_data{edit}             = "$script_name?op=add_form&amp;searchfield=" . $results->[$i]{'tagfield'} . "&amp;authtypecode=" . $authtypecode;
-        $row_data{delete}           = "$script_name?op=delete_confirm&amp;searchfield=" . $results->[$i]{'tagfield'} . "&amp;authtypecode=" . $authtypecode;
         push(@loop_data, \%row_data);
     }
     $template->param(loop => \@loop_data,