[Koha-patches] [PATCH] Bug fix 2414 Adding a new field after search fails

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Tue Jul 29 11:19:50 CEST 2008


Adding edit field For edition of an existing field rather than using searchfield parameter.
---
 admin/marctagstructure.pl |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl
index 2759a03..b780a92 100755
--- a/admin/marctagstructure.pl
+++ b/admin/marctagstructure.pl
@@ -38,6 +38,7 @@ my $searchfield=$input->param('searchfield');
 $searchfield=0 unless $searchfield;
 $searchfield=~ s/\,//g;
 my $last_searchfield=$input->param('searchfield');
+my $editfield=$input->param('edit');
 
 my $offset=$input->param('offset') || 0;
 my $op = $input->param('op') || '';
@@ -102,7 +103,7 @@ $template->param(script_name => $script_name,
 if ($op eq 'add_form') {
 	#---- if primkey exists, it's a modify action, so read values to modify...
 	my $data;
-	if ($searchfield) {
+	if ($editfield) {
 		$sth=$dbh->prepare("select tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?");
 		$sth->execute($searchfield,$frameworkcode);
 		$data=$sth->fetchrow_hashref;
@@ -125,7 +126,7 @@ if ($op eq 'add_form') {
 			);
 
   $template->param(searchfield => $searchfield) if ($searchfield);
-	if ($searchfield) {
+	if ($editfield) {
 		$template->param(action => "Modify tag");
 		$template->param('heading-modify-tag-p' => 1);
 	} else {
@@ -278,7 +279,7 @@ if ($op eq 'add_form') {
 			$row_data{mandatory} = $results[$i]->{'mts_mandatory'};
 			$row_data{authorised_value} = $results[$i]->{'mts_authorised_value'};
 			$row_data{subfield_link} ="marc_subfields_structure.pl?op=add_form&tagfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
-			$row_data{edit} = "$script_name?op=add_form&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
+			$row_data{edit} = "$script_name?op=add_form&&edit=".$results[$i]->{'mts_tagfield'}."searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
 			$row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results[$i]->{'mts_tagfield'}."&frameworkcode=".$frameworkcode;
 			$row_data{toggle} = $toggle;
 			$j=$i;
@@ -328,7 +329,7 @@ if ($op eq 'add_form') {
 			$row_data{mandatory} = $results->[$i]{'mandatory'};
 			$row_data{authorised_value} = $results->[$i]{'authorised_value'};
 			$row_data{subfield_link} ="marc_subfields_structure.pl?tagfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
-			$row_data{edit} = "$script_name?op=add_form&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
+			$row_data{edit} = "$script_name?op=add_form&edit=".$results->[$i]{'tagfield'}."&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
 			$row_data{delete} = "$script_name?op=delete_confirm&searchfield=".$results->[$i]{'tagfield'}."&frameworkcode=".$frameworkcode;
 			$row_data{toggle} = $toggle;
 			push(@loop_data, \%row_data);
-- 
1.5.4.3




More information about the Koha-patches mailing list