updated release notes for 3.14.0 beta
[koha.git] / admin / auth_subfields_structure.pl
index dd0d9d0..d9f10b4 100755 (executable)
 # 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; FIXME - Bug 2505
 use C4::Output;
 use C4::Auth;
 use CGI;
@@ -56,7 +57,7 @@ my ($template, $borrowernumber, $cookie) = get_template_and_user(
         query           => $input,
         type            => "intranet",
         authnotrequired => 0,
-        flagsrequired   => { parameters => 1 },
+        flagsrequired   => { parameters => 'parameters_remaining_permissions' },
         debug           => 1,
     }
 );
@@ -138,6 +139,7 @@ if ($op eq 'add_form') {
        while ($data =$sth->fetchrow_hashref) {
 
                my %row_data;  # get a fresh hash for the row data
+        $row_data{defaultvalue} = $data->{defaultvalue};
                $row_data{tab} = CGI::scrolling_list(-name=>'tab',
                                        -id=>"tab$i",
                                         -values =>
@@ -369,8 +371,8 @@ if ($op eq 'add_form') {
                $row_data{row} = $i;
                push(@loop_data, \%row_data);
        }
-       $template->param('use-heading-flags-p' => 1);
-       $template->param('heading-edit-subfields-p' => 1);
+       $template->param('use_heading_flags_p' => 1);
+       $template->param('heading_edit_subfields_p' => 1);
        $template->param(action => "Edit subfields",
                                                        tagfield => $tagfield,
                                                        tagfieldinput => "<input type=\"hidden\" name=\"tagfield\" value=\"$tagfield\" />",
@@ -385,10 +387,10 @@ if ($op eq 'add_form') {
        $template->param(tagfield => "$input->param('tagfield')");
 #      my $sth=$dbh->prepare("replace auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl)
 #                                                                      values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
-       my $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl)
-                                                                       values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
-       my $sth_update = $dbh->prepare("update auth_subfield_structure set authtypecode=?, tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, frameworkcode=?, value_builder=?, hidden=?, isurl=?
-                                                                       where authtypecode=? and tagfield=? and tagsubfield=?");
+    my $sth_insert = $dbh->prepare("insert into auth_subfield_structure (authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,frameworkcode,value_builder,hidden,isurl,defaultvalue)
+                                    values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+    my $sth_update = $dbh->prepare("update auth_subfield_structure set authtypecode=?, tagfield=?, tagsubfield=?, liblibrarian=?, libopac=?, repeatable=?, mandatory=?, kohafield=?, tab=?, seealso=?, authorised_value=?, frameworkcode=?, value_builder=?, hidden=?, isurl=?, defaultvalue=?
+                                    where authtypecode=? and tagfield=? and tagsubfield=?");
        my @tagsubfield = $input->param('tagsubfield');
        my @liblibrarian        = $input->param('liblibrarian');
        my @libopac             = $input->param('libopac');
@@ -403,6 +405,7 @@ if ($op eq 'add_form') {
        my $authtypecode        = $input->param('authtypecode');
        my @frameworkcodes      = $input->param('frameworkcode');
        my @value_builder       =$input->param('value_builder');
+    my @defaultvalue = $input->param('defaultvalue');
        for (my $i=0; $i<= $#tagsubfield ; $i++) {
                my $tagfield                    =$input->param('tagfield');
                my $tagsubfield         =$tagsubfield[$i];
@@ -417,6 +420,7 @@ if ($op eq 'add_form') {
                my $authorised_value            =$authorised_values[$i];
                my $frameworkcode               =$frameworkcodes[$i];
                my $value_builder=$value_builder[$i];
+        my $defaultvalue = $defaultvalue[$i];
                #my $hidden = $ohidden[$i].$ihidden[$i].$ehidden[$i]; #collate from 3 hiddens;
                my $hidden = $ohidden[$i]; #collate from 3 hiddens;
                my $isurl = $input->param("isurl$i")?1:0;
@@ -439,6 +443,7 @@ if ($op eq 'add_form') {
                                                $value_builder,
                                                $hidden,
                                                $isurl,
+                        $defaultvalue,
                                                (
                                                        $authtypecode,
                                                        $tagfield,
@@ -462,6 +467,7 @@ if ($op eq 'add_form') {
                                                $value_builder,
                                                $hidden,
                                                $isurl,
+                        $defaultvalue,
                                        );
                                }
                        }