[Koha-patches] [PATCH 1/2] Bug 12543 - Add userid as matchpoint for "Import patrons" tool
Nicole Engard
nengard at gmail.com
Mon Feb 9 18:44:56 CET 2015
Sorry all - not sure what the heck I did here. Obviously I did not
mean to submit this.
On Mon, Feb 9, 2015 at 11:43 AM, Nicole C. Engard
<nengard at bywatersolutions.com> wrote:
> From: Winona Salesky <wsalesky at gmail.com>
>
> The a patron's userid should be a matchpoint in the same manner as
> cardnumber. Though not enforced as a unique key by the database yet
> ( pending bug 1861 ), this field is effectively unique as uniqueness
> is enforced by Koha itself.
>
> Test Plan:
> 1) Apply this patch
> 2) Browse to tools/import_borrowers.pl
> 3) Download the starter CSV file
> 4) Edit the csv file to include 1 or more patrons
> * Make sure to leave the borrowernumber field empty
> * Make sure the userid field matches the patrons you wish to overwrite
> 5) From import_borrowers.pl, upload your file
> * Set "Field to use for record matching" to "Username"
> * Set "If matching record is already in the borrowers table" to "Overwrite the existing one with this"
> 6) Click "Import"
> 7) Verify the patrons in your file have been updated in Koha
>
> Signed-off-by: Frederic Demians <f.demians at tamil.fr>
>
> Do exactly what's announced. This may help.
>
> Signed-off-by: Jonathan Druart <jonathan.druart at biblibre.com>
> Signed-off-by: Tomas Cohen Arazi <tomascohen at gmail.com>
> ---
> .../prog/en/modules/tools/import_borrowers.tt | 1 +
> tools/import_borrowers.pl | 5 +++++
> 2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
> index d3bcf5c..f8d9303 100644
> --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
> +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt
> @@ -114,6 +114,7 @@
> <li class="radio">
> <select name="matchpoint" id="matchpoint">
> <option value="cardnumber">Cardnumber</option>
> + <option value="userid">Username</option>
> [% FOREACH matchpoint IN matchpoints %]
> <option value="[% matchpoint.code %]">[% matchpoint.description %]</option>
> [% END %]
> diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl
> index 3b557f0..bad2475 100755
> --- a/tools/import_borrowers.pl
> +++ b/tools/import_borrowers.pl
> @@ -229,6 +229,11 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
> if ($member) {
> $borrowernumber = $member->{'borrowernumber'};
> }
> + } elsif ( ($matchpoint eq 'userid') && ($borrower{'userid'}) ) {
> + $member = GetMember( 'userid' => $borrower{'userid'} );
> + if ($member) {
> + $borrowernumber = $member->{'borrowernumber'};
> + }
> } elsif ($extended) {
> if (defined($matchpoint_attr_type)) {
> foreach my $attr (@$patron_attributes) {
> --
> 1.7.2.3
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
More information about the Koha-patches
mailing list