Bug 8435: DBRev 3.13.00.038
[koha.git] / admin / fieldmapping.pl
index bd3ca1b..1552010 100755 (executable)
@@ -12,9 +12,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;
@@ -31,7 +31,7 @@ my $framework = $query->param('framework') || "";
 my $field         = $query->param('fieldname');
 my $fieldcode     = $query->param('marcfield');
 my $subfieldcode  = $query->param('marcsubfield');
-my $op            = $query->param('op');
+my $op            = $query->param('op') || q{};
 my $id            = $query->param('id');
 
 my ($template, $loggedinuser, $cookie)
@@ -39,15 +39,22 @@ my ($template, $loggedinuser, $cookie)
                             query => $query,
                             type => "intranet",
                             authnotrequired => 0,
-                            flagsrequired => {parameters => 1},
+                 flagsrequired => {parameters => 'parameters_remaining_permissions'},
                             debug => 1,
                             });
 
 # get framework list
 my $frameworks = getframeworks();
 my @frameworkloop;
+my $selected;
+my $frameworktext;
 foreach my $thisframeworkcode (keys %$frameworks) {
-       my $selected = 1 if $thisframeworkcode eq $framework;
+        if ($thisframeworkcode eq $framework){
+                $selected = 1;
+                $frameworktext = $frameworks->{$thisframeworkcode}->{'frameworktext'};
+     } else {
+               $selected = 0;
+     }
        my %row =(value => $thisframeworkcode,
                                selected => $selected,
                                frameworktext => $frameworks->{$thisframeworkcode}->{'frameworktext'},
@@ -67,11 +74,11 @@ if($field and $fieldcode){
 }
 
 my $fieldloop = GetFieldMapping($framework);
-warn Data::Dumper::Dumper($fieldloop->[1]);
 
 $template->param( frameworkloop => \@frameworkloop, 
                   framework     => $framework,
+                  frameworktext => $frameworktext,
                   fields        => $fieldloop,
                 );
 
-output_html_with_http_headers $query, $cookie, $template->output;
\ No newline at end of file
+output_html_with_http_headers $query, $cookie, $template->output;