Bug 8907 - Last updated date does not appear on currency edit form
[koha.git] / admin / marctagstructure.pl
index a9ae892..fd8d7c2 100755 (executable)
@@ -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',
@@ -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&amp;searchfield="      .$results[$i]->{'mts_tagfield'}."&amp;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 (?,?,?,?,?,?,?)");