Koha/koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt
Magnus Enger 290341d8db Bug 11401: Add support for Norwegian national library card
This patch makes it possible to sync patron data between Koha and the
Norwegian national patron database, in both directions.

In order to use this, the following information is necessary:
- a username/password from the Norwegian national database of libraries
  ("Base Bibliotek"), available to all Norwegian libraries
- a special key in order to decrypt and encrypt PIN-codes/passwords,
  which is only available to Norwegian library system vendors
- a norwegian library vendor username/password

See http://www.lanekortet.no/ for more information (in Norwegian).

While this is of course an implementation of a specific synchronization scheme
for borrower data, attempts have been made to prepare the ground for other sync
schemes that might be implemented later. Especially the structure of the new
borrower_sync table might be reviewed with an eye to how it might fit other
schemes.

To test:

Since the password and cryptographic key needed to use this functionality
is only available to Norwegian library system vendors, only regression testing
can be done on the submitted code. Suggested things to check:

- Apply the patch and make sure the database update is done. This should add
  the new "borrower_sync" table and five new systmpreferences under the
  "Patrons" > "Norwegian patron database" category:
  - NorwegianPatronDBEnable
  - NorwegianPatronDBEndpoint
  - NorwegianPatronDBUsername
  - NorwegianPatronDBPassword
  - NorwegianPatronDBSearchNLAfterLocalHit
- Check that patrons can be created, edited and deleted as usual, when
  NorwegianPatronDBEnable is set to "Disable"
- Check that the new tests in t/NorwegianPatronDB.pm run ok, e.g. on a
  gitified setup:
  $ sudo koha-shell -c "PERL5LIB=/path/to/kohaclone prove -v t/NorwegianPatronDB.t" instancename
- Check that all the other tests still run ok
- Check that the POD in the new files itroduced by this patch looks ok:
  - Koha/NorwegianPatronDB.pm
  - members/nl-search.pl
  - misc/cronjobs/nl-sync-from-koha.pl
  - misc/cronjobs/nl-sync-to-koha.pl
  - t/NorwegianPatronDB.t

Sponsored-by: Oslo Public Library

Update 2014-09-18:
- Rebase on master
- Split out changes to Koha::Schema
- Incorporate new way of authenticating with NL

Update 2014-10-21:
- Rebase on master
- Use Module::Load to load Koha::NorwegianPatronDB in non-NL-specific
  scripts and modules
- Fix the version number of Digest::SHA
- Fix a missing semicolon in kohastructure.sql

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 09:42:23 -03:00

176 lines
10 KiB
Text

[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Search the Norwegian national patron database</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> &rsaquo; Search the Norwegian national patron database</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>Search the Norwegian national patron database</h1>
[% IF (error) %]
<div class="dialog alert">
[% IF ( error.nlenabled == 0 ) %]<p>You need to activate this function with the NorwegianPatronDBEnable system preference in order to use it.</p>[% END %]
[% IF ( error.endpoint == 0 ) %]<p>You need to specify an endpoint with the NorwegianPatronDBEndpoint system preference.</p>[% END %]
[% IF ( error.userpass == 0 ) %]<p>You need to fill in the NorwegianPatronDBUsername and NorwegianPatronDBPassword system preferences in order to use this function.</p>[% END %]
[% IF ( error == 'COULD_NOT_ADD_PATRON' ) %]<p>Could not add a new patron.</p>[% END %]
</div>
[% ELSE %]
[% SET nl_search_form_title='Search' %]
[% INCLUDE 'nl-search-form.tt' %]
[% END %]
[% IF ( local_result ) %]
<h3>Existing patrons</h3>
<ul>
[% FOREACH patron IN local_result %]
[%# Find the category_type %]
[% FOREACH category IN categories %]
[% IF category.categorycode == patron.categorycode %]
[% patron.category_type = category.category_type %]
[% END %]
[% END %]
<li>[% patron.firstname %] [% patron.surname %] [% patron.cardnumber %] |
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">Details</a> |
<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber %]&category_type=[% patron.category_type %]">Edit</a> |
<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% patron.borrowernumber %]">Check out</a>
</li>
[% END %]
</ul>
[% END %]
[% IF ( result ) %]
[% IF result.antall_poster_returnert == 0 %]
<div class="dialog alert">
<p>No results found in the Norwegian national patron database. Message: "[% result.melding %]"</p>
</div>
[% ELSE %]
<h3>Results from the Norwegian national patron database</h3>
<div class="yui-g">
<div class="yui-u first">
[% PROCESS patron_detail p=result.respons_poster.0 %]
</div>
[% IF ( result.respons_poster.1 ) %]
<div class="yui-u">
[% PROCESS patron_detail p=result.respons_poster.1 %]
</div>
[% END %]
</div>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'circ-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]
[% BLOCK patron_detail %]
<div class="rows">
<h4>[% p.navn | html_entity %]</h4>
<ol>
[% IF ( p.kjonn ) %]<li><span class="label">kjonn: </span>[% p.kjonn | html_entity %]</li>[% END %]
[% IF ( p.fdato ) %]<li><span class="label">fdato: </span>[% p.fdato | html_entity %]</li>[% END %]
[% IF ( p.lnr ) %]<li><span class="label">lnr: </span>[% p.lnr | html_entity %]</li>[% END %]
[% IF ( p.fnr_hash ) %]<li><span class="label">fnr_hash: </span>[% p.fnr_hash | html_entity %]</li>[% END %]
[% IF ( p.epost ) %]<li><span class="label">epost: </span>[% p.epost | html_entity %]</li>[% END %]
[% IF ( p.epost_sjekk ) %]<li><span class="label">epost_sjekk: </span>[% p.epost_sjekk | html_entity %]</li>[% END %]
[% IF ( p.tlf_mobil ) %]<li><span class="label">tlf_mobil: </span>[% p.tlf_mobil | html_entity %]</li>[% END %]
[% IF ( p.tlf_hjemme ) %]<li><span class="label">tlf_hjemme: </span>[% p.tlf_hjemme | html_entity %]</li>[% END %]
[% IF ( p.tlf_jobb ) %]<li><span class="label">tlf_jobb: </span>[% p.tlf_jobb | html_entity %]</li>[% END %]
[% IF ( p.p_adresse1 ) %]<li><span class="label">p_adresse1: </span>[% p.p_adresse1 | html_entity %]</li>[% END %]
[% IF ( p.p_adresse2 ) %]<li><span class="label">p_adresse2: </span>[% p.p_adresse2 | html_entity %]</li>[% END %]
[% IF ( p.p_postnr ) %]<li><span class="label">p_postnr: </span>[% p.p_postnr | html_entity %]</li>[% END %]
[% IF ( p.p_sted ) %]<li><span class="label">p_sted: </span>[% p.p_sted | html_entity %]</li>[% END %]
[% IF ( p.p_land ) %]<li><span class="label">p_land: </span>[% p.p_land | html_entity %]</li>[% END %]
[% IF ( p.p_sjekk ) %]<li><span class="label">p_sjekk: </span>[% p.p_sjekk | html_entity %]</li>[% END %]
[% IF ( p.m_adresse1 ) %]<li><span class="label">m_adresse1: </span>[% p.m_adresse1 | html_entity %]</li>[% END %]
[% IF ( p.m_adresse2 ) %]<li><span class="label">m_adresse2: </span>[% p.m_adresse2 | html_entity %]</li>[% END %]
[% IF ( p.m_postnr ) %]<li><span class="label">m_postnr: </span>[% p.m_postnr | html_entity %]</li>[% END %]
[% IF ( p.m_sted ) %]<li><span class="label">m_sted: </span>[% p.m_sted | html_entity %]</li>[% END %]
[% IF ( p.m_land ) %]<li><span class="label">m_land: </span>[% p.m_land | html_entity %]</li>[% END %]
[% IF ( p.m_sjek ) %]<li><span class="label">m_sjekk: </span>[% p.m_sjekk | html_entity %]</li>[% END %]
[% IF ( p.m_gyldig_til ) %]<li><span class="label">m_gyldig_til: </span>[% p.m_gyldig_til | html_entity %]</li>[% END %]
[% IF ( p.pin ) %]<li><span class="label">pin: </span>[% p.pin | html_entity %]</li>[% END %]
[% IF ( p.passord ) %]<li><span class="label">passsord: </span>[% p.passord | html_entity %]</li>[% END %]
[% IF ( p.feide ) %]<li><span class="label">feide: </span>[% p.feide | html_entity %]</li>[% END %]
[% IF ( p.folkeregsjekk_dato ) %]<li><span class="label">folkeregsjekk_dato: </span>[% p.folkeregsjekk_dato | html_entity %]</li>[% END %]
[% IF ( p.hjemmebibliotek ) %]<li><span class="label">hjemmebibliotek: </span>[% p.hjemmebibliotek | html_entity %]</li>[% END %]
[% IF ( p.opprettet ) %]<li><span class="label">opprettet: </span>[% p.opprettet | html_entity %]</li>[% END %]
[% IF ( p.opprettet_av ) %]<li><span class="label">opprettet_av: </span>[% p.opprettet_av | html_entity %]</li>[% END %]
[% IF ( p.sist_endret ) %]<li><span class="label">sist_endret: </span>[% p.sist_endret | html_entity %]</li>[% END %]
[% IF ( p.sist_endret_av ) %]<li><span class="label">sist_endret_av: </span>[% p.sist_endret_av | html_entity %]</li>[% END %]
[% IF ( p.gyldig_til ) %]<li><span class="label">gyldig_til: </span>[% p.gyldig_til | html_entity %]</li>[% END %]
[% IF ( p.prim_kontakt ) %]<li><span class="label">prim_kontakt: </span>[% p.prim_kontakt | html_entity %]</li>[% END %]
</ol>
<form action="nl-search.pl" method="POST">
<input type="hidden" name="op" value="save" />
<input type="hidden" name="navn" value="[% p.navn | html_entity %]" />
<input type="hidden" name="kjonn" value="[% p.kjonn | html_entity %]" />
<input type="hidden" name="fdato" value="[% p.fdato | html_entity %]" />
<input type="hidden" name="lnr" value="[% p.lnr | html_entity %]" />
<input type="hidden" name="fnr_hash" value="[% p.fnr_hash | html_entity %]" />
<input type="hidden" name="p_adresse1" value="[% p.p_adresse1 | html_entity %]" />
<input type="hidden" name="p_adresse2" value="[% p.p_adresse2 | html_entity %]" />
<input type="hidden" name="p_postnr" value="[% p.p_postnr | html_entity %]" />
<input type="hidden" name="p_sted" value="[% p.p_sted | html_entity %]" />
<input type="hidden" name="p_land" value="[% p.p_land | html_entity %]" />
<input type="hidden" name="p_sjekk" value="[% p.p_sjekk | html_entity %]" />
<input type="hidden" name="m_adresse1" value="[% p.m_adresse1 | html_entity %]" />
<input type="hidden" name="m_adresse2" value="[% p.m_adresse2 | html_entity %]" />
<input type="hidden" name="m_postnr" value="[% p.m_postnr | html_entity %]" />
<input type="hidden" name="m_sted" value="[% p.m_sted | html_entity %]" />
<input type="hidden" name="m_land" value="[% p.m_land | html_entity %]" />
<input type="hidden" name="m_sjekk" value="[% p.m_sjekk | html_entity %]" />
<input type="hidden" name="m_gyldig_til" value="[% p.m_gyldig_til | html_entity %]" />
<input type="hidden" name="pin" value="[% p.pin %]" />
<input type="hidden" name="passord" value="[% p.passord | html_entity %]" />
<input type="hidden" name="feide" value="[% p.feide | html_entity %]" />
<input type="hidden" name="folkeregsjekk_dato" value="[% p.folkeregsjekk_dato | html_entity %]" />
<input type="hidden" name="hjemmebibliotek" value="[% p.hjemmebibliotek | html_entity %]" />
<input type="hidden" name="opprettet" value="[% p.opprettet | html_entity %]" />
<input type="hidden" name="opprettet_av" value="[% p.opprettet_av | html_entity %]" />
<input type="hidden" name="sist_endret" value="[% p.sist_endret | html_entity %]" />
<input type="hidden" name="sist_endret_av" value="[% p.sist_endret_av | html_entity %]" />
<input type="hidden" name="gyldig_til" value="[% p.gyldig_til | html_entity %]" />
<input type="hidden" name="epost" value="[% p.epost | html_entity %]" />
<input type="hidden" name="epost_sjekk" value="[% p.epost_sjekk | html_entity %]" />
<input type="hidden" name="tlf_mobil" value="[% p.tlf_mobil | html_entity %]" />
<input type="hidden" name="tlf_hjemme" value="[% p.tlf_hjemme | html_entity %]" />
<input type="hidden" name="tlf_jobb" value="[% p.tlf_jobb | html_entity %]" />
<input type="hidden" name="prim_kontakt" value="[% p.prim_kontakt | html_entity %]" />
<input type="submit" value="Import this patron" />
as
<select name="categorycode">
[% FOREACH c IN categories %]
<option value="[% c.categorycode %]">[% c.description %]</option>
[% END %]
</select>
</form>
</div>
[% END %]