X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Fmarctagstructure.pl;h=0326b93b2c5b8bf81d738f7eb525dc824a2e2b6d;hb=527debf69225c5e464aeec8c4d304f1d31bf07eb;hp=a9ae89269b060275461589f391f503b171375b1c;hpb=eee07ae861c08381acbf281bcaf5bf32d0e02564;p=koha_fer diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index a9ae89269b..0326b93b2c 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -14,9 +14,9 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -52,7 +52,7 @@ my ($template, $loggedinuser, $cookie) query => $input, type => "intranet", authnotrequired => 0, - flagsrequired => {parameters => 1}, + flagsrequired => {parameters => 'parameters_remaining_permissions'}, debug => 1, }); @@ -118,12 +118,12 @@ if ($op eq 'add_form') { if ($searchfield) { $template->param(searchfield => $searchfield); $template->param(action => "Modify tag"); - $template->param('heading-modify-tag-p' => 1); + $template->param('heading_modify_tag_p' => 1); } else { $template->param(action => "Add tag"); - $template->param('heading-add-tag-p' => 1); + $template->param('heading_add_tag_p' => 1); } - $template->param('use-heading-flags-p' => 1); + $template->param('use_heading_flags_p' => 1); $template->param(liblibrarian => $data->{'liblibrarian'}, libopac => $data->{'libopac'}, repeatable => CGI::checkbox(-name=>'repeatable', @@ -149,7 +149,7 @@ 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') == 1) { + 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=?" @@ -194,7 +194,7 @@ 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') == 1) { + 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); @@ -255,7 +255,7 @@ if ($op eq 'add_form') { my @loop_data = (); my $j=1; my $i=$offset; - while ($i < ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt)) { + while ( $i < $cnt ) { my %row_data; # get a fresh hash for the row data $row_data{tagfield} = $results[$i]->{'mts_tagfield'}; $row_data{liblibrarian} = $results[$i]->{'mts_liblibrarian'}; @@ -267,7 +267,7 @@ if ($op eq 'add_form') { $row_data{delete} = "$script_name?op=delete_confirm&searchfield=" .$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode; $j=$i; my @internal_loop = (); - while (($results[$i]->{'tagfield'}==$results[$j]->{'tagfield'}) and ($j< ($offset+$pagesize<$cnt?$offset+$pagesize:$cnt))) { + while ( ( $j < $cnt ) and ( $results[$i]->{'tagfield'} == $results[$j]->{'tagfield'} ) ) { my %subfield_data; $subfield_data{tagsubfield} = $results[$j]->{'tagsubfield'}; $subfield_data{liblibrarian} = $results[$j]->{'liblibrarian'}; @@ -294,7 +294,7 @@ if ($op eq 'add_form') { my ($count,$results)=StringSearch($searchfield,$frameworkcode); $cnt = $count; my @loop_data = (); - for (my $i=$offset; $i < ($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){ + for ( my $i = $offset ; $i < $count ; $i++ ) { my %row_data; # get a fresh hash for the row data $row_data{tagfield} = $results->[$i]{'tagfield'}; $row_data{liblibrarian} = $results->[$i]{'liblibrarian'}; @@ -348,6 +348,7 @@ sub StringSearch { # sub duplicate_framework { my ($newframeworkcode,$oldframeworkcode) = @_; + my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where frameworkcode=?"); $sth->execute($oldframeworkcode); my $sth_insert = $dbh->prepare("insert into marc_tag_structure (tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value, frameworkcode) values (?,?,?,?,?,?,?)");