@@ -, +, @@ --- C4/Breeding.pm | 4 ++- authorities/authorities.pl | 23 ++++++++++++++ cataloguing/z3950_auth_search.pl | 3 ++ .../prog/en/includes/authorities-toolbar.inc | 8 ++++- .../prog/en/modules/authorities/authorities.tt | 31 ++++++++++++++++++++ .../en/modules/cataloguing/z3950_auth_search.tt | 30 ++++++++++++------- 6 files changed, 86 insertions(+), 13 deletions(-) --- a/C4/Breeding.pm +++ a/C4/Breeding.pm @@ -520,6 +520,7 @@ sub Z3950SearchAuth { my $subject= $pars->{subject}; my $subjectsubdiv= $pars->{subjectsubdiv}; my $srchany= $pars->{srchany}; + my $authid= $pars->{authid}; my $show_next = 0; my $total_pages = 0; @@ -672,11 +673,12 @@ sub Z3950SearchAuth { $row_data{server} = $servername[$k]; $row_data{breedingid} = $breedingid; $row_data{heading} = $heading; + $row_data{authid} = $authid; $row_data{heading_code} = $heading_authtype_code; push( @breeding_loop, \%row_data ); } else { - push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1}); + push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'authid'=>-1}); } } } #if $numresults --- a/authorities/authorities.pl +++ a/authorities/authorities.pl @@ -323,6 +323,27 @@ sub CreateKey { return int(rand(1000000)); } +=item GetMandatoryFieldZ3950 + + This function return an hashref which containts all mandatory field + to search with z3950 server. + +=cut + +sub GetMandatoryFieldZ3950($){ + my $authtypecode = shift; + + #Tags guessed (see GuessAuthTypeCode from AuthoritiesMarc.pm) + + return { + '100'.'a' => 'authorpersonal', + '110'.'a' => 'authorcorp', + '111'.'a' => 'authormeetingcon', + '130'.'a' => 'uniformtitle', + '150'.'a' => 'topic', + }; +} + sub build_tabs { my ( $template, $record, $dbh, $encoding,$input ) = @_; @@ -562,6 +583,8 @@ my ($template, $loggedinuser, $cookie) $template->param(nonav => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,); $tagslib = GetTagsLabels(1,$authtypecode); +$mandatory_z3950 = GetMandatoryFieldZ3950($authtypecode); + my $record=-1; my $encoding=""; if (($authid) && !($breedingid)){ --- a/cataloguing/z3950_auth_search.pl +++ a/cataloguing/z3950_auth_search.pl @@ -29,6 +29,7 @@ use C4::Koha; my $input = new CGI; my $dbh = C4::Context->dbh; my $error = $input->param('error'); +my $authid = $input->param('authid') || 0; my $nameany = $input->param('nameany'); my $authorany = $input->param('authorany'); my $authorcorp = $input->param('authorcorp'); @@ -61,6 +62,7 @@ $template->param( subject => $subject, subjectsubdiv => $subjectsubdiv, srchany => $srchany, + authid => $authid, ); if ( $op ne "do_search" ) { @@ -97,6 +99,7 @@ my $pars= { subject => $subject, subjectsubdiv => $subjectsubdiv, srchany => $srchany, + authid => $authid, }; Z3950SearchAuth($pars, $template); output_html_with_http_headers $input, $cookie, $template->output; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc @@ -7,7 +7,13 @@ }); $("#z3950submit").click(function(){ - window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes'); + [% IF ( authid ) %] + if (confirm(_("Please note that this Z39.50 search could replace the current record."))){ + window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); + } + [% ELSE %] + window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); + [% END %] return false; }); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -17,9 +17,37 @@ $("#f").submit(); } }); + $("#z3950submit").click(function(){ + if (confirm(_("Please note that this Z39.50 search could replace the current record."))){ + var strQuery = GetZ3950Terms(); + if(strQuery){ + window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); + } + } + return false; + }); }); /** + * check if z3950 mandatories are set or not + */ +function GetZ3950Terms(){ + var strQuery="&authtypecode="+document.forms['f'].authtypecode.value; + var mandatories = new Array(); + var mandatories_label = new Array(); + [% FOREACH BIG_LOO IN BIG_LOOP %][% FOREACH innerloo IN BIG_LOO.innerloop %][% FOREACH subfield_loo IN innerloo.subfield_loop %][% IF ( subfield_loo.z3950_mandatory ) %]mandatories.push("[% subfield_loo.id %]"); + mandatories_label.push("[% subfield_loo.z3950_mandatory %]");[% END %][% END %][% END %][% END %] + + for(var i=0,len=mandatories.length; i
Save
+
+ Z39.50 search +
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt @@ -7,8 +7,8 @@ [% INCLUDE 'datatables.inc' %]