This is a(nother) vestige of Koha (2.2?).
This patch removes unused code related to the 'ethnicity'.
In detail:
There is no way to fill the ethnicity table.
There is no way to fill the borrowers.ethnicity and borrowers.ethnotes.
BUT if borrowers.ethnicity exists, the value is displayed on
members/moremember.pl (and only here).
Test plan:
Apply this patch and confirm there is no regression on
adding/updating/deleting patrons.
Note that you don't see the ethnicity value on the moremember.pl page even if a patron has it.
Signed-off-by: Nick Clemens <nick@quecheelibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
&checkuserpassword
&Check_Userid
&Generate_Userid
- &fixEthnicity
- ðnicitycategories
&fixup_cardnumber
&checkcardnumber
);
return $data;
} # sub getborrowercategory
-=head2 ethnicitycategories
-
- ($codes_arrayref, $labels_hashref) = ðnicitycategories();
-
-Looks up the different ethnic types in the database. Returns two
-elements: a reference-to-array, which lists the ethnicity codes, and a
-reference-to-hash, which maps the ethnicity codes to ethnicity
-descriptions.
-
-=cut
-
-#'
-
-sub ethnicitycategories {
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("Select code,name from ethnicity order by name");
- $sth->execute;
- my %labels;
- my @codes;
- while ( my $data = $sth->fetchrow_hashref ) {
- push @codes, $data->{'code'};
- $labels{ $data->{'code'} } = $data->{'name'};
- }
- return ( \@codes, \%labels );
-}
-
-=head2 fixEthnicity
-
- $ethn_name = &fixEthnicity($ethn_code);
-
-Takes an ethnicity code (e.g., "european" or "pi") and returns the
-corresponding descriptive name from the C<ethnicity> table in the
-Koha database ("European" or "Pacific Islander").
-
-=cut
-
-#'
-
-sub fixEthnicity {
- my $ethnicity = shift;
- return unless $ethnicity;
- my $dbh = C4::Context->dbh;
- my $sth = $dbh->prepare("Select name from ethnicity where code = ?");
- $sth->execute($ethnicity);
- my $data = $sth->fetchrow_hashref;
- return $data->{'name'};
-} # sub fixEthnicity
-
=head2 GetAge
$dateofbirth,$date = &GetAge($date);
[% CASE 'contactfirstname' %]<span>Contact: First name</span>
[% CASE 'contacttitle' %]<span>Contact: Title</span>
[% CASE 'relationship' %]<span>Contact: Relationship</span>
-[% CASE 'ethnicity' %]<span>Ethnicity</span>
-[% CASE 'ethnotes' %]<span>Ethnicity notes</span>
[% CASE 'sex' %]<span>Sex</span>
[% CASE 'altcontactfirstname' %]<span>Alternate contact: First name</span>
[% CASE 'altcontactsurname' %]<span>Alternate contact: Surname</span>
<li><span class="label">Initials: </span>[% initials %]</li>
<li><span class="label">Date of birth:</span>[% dateofbirth %]</li>
<li><span class="label">Gender:</span>[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]</li>[% END %]
- [% IF ( printethnicityline ) %]
- <li><span class="label">Ethnicity:</span>[% ethnicity %]</li>
- <li><span class="label">Ethnicity notes: </span>[% ethnotes %]</li>
- [% END %]
[% IF ( isguarantee ) %]
[% IF ( guaranteeloop ) %]
<li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %] </a></li>[% END %]</ul></li>
[% IF ( sex ) %]<li><span class="label">Gender:</span>
[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex %][% END %]
</li>[% END %][% END %]
- [% IF ( printethnicityline ) %]
- <li><span class="label">Ethnicity:</span>[% ethnicity %]</li>
- <li><span class="label">Ethnicity notes: </span>[% ethnotes %]</li>
- [% END %]
[% IF ( isguarantee ) %]
[% IF ( guaranteeloop ) %]
<li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber %]">[% guaranteeloo.name %] </a></li>[% END %]</ul></li>
my $step = $input->param('step') || 0;
my @errors;
my $default_city;
-# NOTE: Alert for ethnicity and ethnotes fields, they are invalid in all borrowers form
my $borrower_data;
my $NoUpdateLogin;
my $userenv = C4::Context->userenv;
}
##Now all the data to modify a member.
-my ($categories,$labels)=ethnicitycategories();
-
-my $ethnicitycategoriescount=$#{$categories};
-my $ethcatpopup;
-if ($ethnicitycategoriescount>=0) {
- $ethcatpopup = CGI::popup_menu(-name=>'ethnicity',
- -id => 'ethnicity',
- -tabindex=>'',
- -values=>$categories,
- -default=>$data{'ethnicity'},
- -labels=>$labels);
- $template->param(ethcatpopup => $ethcatpopup); # bad style, has to be fixed
-}
my @typeloop;
my $no_categories = 1;
my $no_add;
foreach (qw(C A S P I X)) {
my $action="WHERE category_type=?";
- ($categories,$labels)=GetborCatFromCatType($_,$action);
+ my ($categories,$labels)=GetborCatFromCatType($_,$action);
if(scalar(@$categories) > 0){ $no_categories = 0; }
my @categoryloop;
foreach my $cat (@$categories){
nodouble => $nodouble,
borrowernumber => $borrowernumber, #register number
guarantorid => ($borrower_data->{'guarantorid'} || $guarantorid),
- ethcatpopup => $ethcatpopup,
relshiploop => \@relshipdata,
city_loop => $city_arrayref,
borrotitlepopup => $borrotitlepopup,
}
}
-$data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} );
$data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex};
my $catcode;
$template->param( 'catcode' => $catcodes->[0]) if $cnt == 1;
}
-
-if ( $data->{'ethnicity'} || $data->{'ethnotes'} ) {
- $template->param( printethnicityline => 1 );
-}
my ( $count, $guarantees ) = GetGuarantees( $data->{'borrowernumber'} );
if ( $count ) {
$template->param( isguarantee => 1 );
my ( $today_year, $today_month, $today_day) = Today();
my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'};
-$borr->{'ethnicity'} = fixEthnicity( $borr->{'ethnicity'} );
-
my $debar = IsDebarred($borrowernumber);
my $userdebarred;
guarantorid => '123454321',
borrowernotes => 'borrowernotes',
relationship => 'myRelationship',
- ethnicity => undef,
- ethnotes => undef,
sex => 'M',
password => 'hfkurhfe976634èj!',
flags => '55555',
#borrower Accessor tests
subtest 'Accessor tests' => sub {
- plan tests => 67;
+ plan tests => 65;
is( $borrower->borrowernumber, '12345', 'borrowernumber accessor returns correct value' );
is( $borrower->cardnumber, '1234567890', 'cardnumber accessor returns correct value' );
is( $borrower->surname, 'mySurname', 'surname accessor returns correct value' );
is( $borrower->guarantorid, '123454321', 'guarantorid accessor returns correct value' );
is( $borrower->borrowernotes, 'borrowernotes', 'borrowernotes accessor returns correct value' );
is( $borrower->relationship, 'myRelationship', 'relationship accessor returns correct value' );
- is( $borrower->ethnicity, undef, 'ethnicity accessor returns correct value' );
- is( $borrower->ethnotes, undef, 'ethnotes accessor returns correct value' );
is( $borrower->sex, 'M', 'sex accessor returns correct value' );
is( $borrower->password, 'hfkurhfe976634èj!', 'password accessor returns correct value' );
is( $borrower->flags, '55555', 'flags accessor returns correct value' );
#borrower Set tests
subtest 'Set tests' => sub {
- plan tests => 67;
+ plan tests => 65;
$borrower->set(
{
guarantorid => '223454321',
borrowernotes => 'Sborrowernotes',
relationship => 'SmyRelationship',
- ethnicity => undef,
- ethnotes => undef,
sex => 'F',
password => 'zerzerzer#',
flags => '666666',
is( $borrower->guarantorid, '223454321', 'guarantorid field set ok' );
is( $borrower->borrowernotes, 'Sborrowernotes', 'borrowernotes field set ok' );
is( $borrower->relationship, 'SmyRelationship', 'relationship field set ok' );
- is( $borrower->ethnicity, undef, 'ethnicity field set ok' );
- is( $borrower->ethnotes, undef, 'ethnotes field set ok' );
is( $borrower->sex, 'F', 'sex field set ok' );
is( $borrower->password, 'zerzerzer#', 'password field set ok' );
is( $borrower->flags, '666666', 'flags field set ok' );
my $CHANGED_FIRSTNAME = "Marry Ann";
my $EMAIL = "Marie\@email.com";
my $EMAILPRO = "Marie\@work.com";
-my $ETHNICITY = "German";
my $PHONE = "555-12123";
# XXX should be randomised and checked against the database
$member->{firstname} = $CHANGED_FIRSTNAME;
$member->{email} = $EMAIL;
-$member->{ethnicity} = $ETHNICITY;
$member->{phone} = $PHONE;
$member->{emailpro} = $EMAILPRO;
ModMember(%$member);
my $changedmember=GetMemberDetails("",$CARDNUMBER);
ok ( $changedmember->{firstname} eq $CHANGED_FIRSTNAME &&
$changedmember->{email} eq $EMAIL &&
- $changedmember->{ethnicity} eq $ETHNICITY &&
$changedmember->{phone} eq $PHONE &&
$changedmember->{emailpro} eq $EMAILPRO
, "Member Changed")