@@ -, +, @@ use record values otherwise --- cataloguing/z3950_auth_search.pl | 50 +++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) --- a/cataloguing/z3950_auth_search.pl +++ a/cataloguing/z3950_auth_search.pl @@ -33,6 +33,7 @@ my $input = CGI->new; my $dbh = C4::Context->dbh; my $error = $input->param('error'); my $authid = $input->param('authid') || 0; +my $op = $input->param('op')||''; my $record = GetAuthority($authid); my $marc_flavour = C4::Context->preference('marcflavour'); @@ -44,34 +45,31 @@ my $authfields_mapping = { 'subject' => $marc_flavour eq 'MARC21' ? '150' : '250', }; -my $nameany = $input->param('nameany'); -my $authorany = $input->param('authorany'); -my $authorcorp = - $record - ? $record->subfield( $authfields_mapping->{'authorcorp'}, 'a' ) - : $input->param('authorcorp'); -my $authorpersonal = - $record - ? $record->subfield( $authfields_mapping->{'authorpersonal'}, 'a' ) - : $input->param('authorpersonal'); -my $authormeetingcon = - $record - ? $record->subfield( $authfields_mapping->{'authormeetingcon'}, 'a' ) - : $input->param('authormeetingcon'); +my $nameany = $input->param('nameany'); +my $authorany = $input->param('authorany'); +my $title = $input->param('title'); +my $authorpersonal = $input->param('authorpersonal'); +my $authormeetingcon = $input->param('authormeetingcon'); +my $uniformtitle = $input->param('uniformtitle'); +my $subject = $input->param('subject'); +my $authorcorp = $input->param('authorcorp'); +my $subjectsubdiv = $input->param('subjectsubdiv'); +my $srchany = $input->param('srchany'); -my $title = $input->param('title'); -my $uniformtitle = - $record - ? $record->subfield( $authfields_mapping->{'uniformtitle'}, 'a' ) - : $input->param('uniformtitle'); -my $subject = - $record - ? $record->subfield( $authfields_mapping->{'subject'}, 'a' ) - : $input->param('subject'); +# If replacing an existing record we want to initially populate the form with record info, +# however, we want to use entered inputs when searching +if ( $record && $op ne 'do_search' ) { + $authorcorp ||= + $record->subfield( $authfields_mapping->{'authorcorp'}, 'a' ); + $authorpersonal ||= + $record->subfield( $authfields_mapping->{'authorpersonal'}, 'a' ); + $authormeetingcon ||= + $record->subfield( $authfields_mapping->{'authormeetingcon'}, 'a' ); + $uniformtitle ||= + $record->subfield( $authfields_mapping->{'uniformtitle'}, 'a' ); + $subject ||= $record->subfield( $authfields_mapping->{'subject'}, 'a' ); +} -my $subjectsubdiv = $input->param('subjectsubdiv'); -my $srchany = $input->param('srchany'); -my $op = $input->param('op')||''; my $page = $input->param('current_page') || 1; my $index =$input->param('index'); $page = $input->param('goto_page') if $input->param('changepage_goto'); --