From 82b198dba763e9a25d091c7100ba3b5f3fd73db5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Feb 2014 16:34:01 +0100 Subject: [PATCH] Bug 11751: Institution related code is unused and obsolete Test plan: Looking at the code and using grep, git grep, etc. verify this patch does not remove something in use. --- C4/Members.pm | 47 -------------------- circ/circulation.pl | 22 --------- installer/data/mysql/sysprefs.sql | 1 - installer/data/mysql/updatedatabase.pl | 9 ++++ .../prog/en/modules/admin/preferences/patrons.pref | 6 --- members/memberentry.pl | 29 ------------ 6 files changed, 9 insertions(+), 105 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 29eda68..183b5ae 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -62,7 +62,6 @@ BEGIN { &GetPendingIssues &GetAllIssues - &get_institutions &getzipnamecity &getidcity @@ -124,7 +123,6 @@ BEGIN { push @EXPORT, qw( &AddMember &AddMember_Opac - &add_member_orgs &MoveMemberToDeleted &ExtendMemberSubscriptionTo ); @@ -1670,51 +1668,6 @@ sub GetAge{ return $age; } # sub get_age -=head2 get_institutions - - $insitutions = get_institutions(); - -Just returns a list of all the borrowers of type I, borrownumber and name - -=cut - -#' -sub get_institutions { - my $dbh = C4::Context->dbh(); - my $sth = - $dbh->prepare( -"SELECT borrowernumber,surname FROM borrowers WHERE categorycode=? ORDER BY surname" - ); - $sth->execute('I'); - my %orgs; - while ( my $data = $sth->fetchrow_hashref() ) { - $orgs{ $data->{'borrowernumber'} } = $data; - } - return ( \%orgs ); - -} # sub get_institutions - -=head2 add_member_orgs - - add_member_orgs($borrowernumber,$borrowernumbers); - -Takes a borrowernumber and a list of other borrowernumbers and inserts them into the borrowers_to_borrowers table - -=cut - -#' -sub add_member_orgs { - my ( $borrowernumber, $otherborrowers ) = @_; - my $dbh = C4::Context->dbh(); - my $query = - "INSERT INTO borrowers_to_borrowers (borrower1,borrower2) VALUES (?,?)"; - my $sth = $dbh->prepare($query); - foreach my $otherborrowernumber (@$otherborrowers) { - $sth->execute( $borrowernumber, $otherborrowernumber ); - } - -} # sub add_member_orgs - =head2 GetCities $cityarrayref = GetCities(); diff --git a/circ/circulation.pl b/circ/circulation.pl index 7d214ea..ee83704 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -133,7 +133,6 @@ my $stickyduedate = $query->param('stickyduedate') || $session->param('stickydu my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate'); my $issueconfirmed = $query->param('issueconfirmed'); my $cancelreserve = $query->param('cancelreserve'); -my $organisation = $query->param('organisations'); my $print = $query->param('print') || q{}; my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice my $charges = $query->param('charges') || q{}; @@ -658,25 +657,6 @@ if ( $borrower->{'category_type'} eq 'C') { $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; } -my $CGIorganisations; -my $member_of_institution; -if ( C4::Context->preference("memberofinstitution") ) { - my $organisations = get_institutions(); - my @orgs; - my %org_labels; - foreach my $organisation ( keys %$organisations ) { - push @orgs, $organisation; - $org_labels{$organisation} = $organisations->{$organisation}->{'surname'}; - } - $member_of_institution = 1; - $CGIorganisations = CGI::popup_menu( - -id => 'organisations', - -name => 'organisations', - -labels => \%org_labels, - -values => \@orgs, - ); -} - my $lib_messages_loop = GetMessages( $borrowernumber, 'L', $branch ); if($lib_messages_loop){ $template->param(flagged => 1 ); } @@ -747,8 +727,6 @@ $template->param( relprevissues => \@relprevissues, displayrelissues => $displayrelissues, inprocess => $inprocess, - memberofinstution => $member_of_institution, - CGIorganisations => $CGIorganisations, is_child => ($borrower->{'category_type'} eq 'C'), circview => 1, soundon => C4::Context->preference("SoundOn"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 1668d37..0cd0ca4 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -181,7 +181,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'), ('maxRecordsForFacets','20',NULL,NULL,'Integer'), ('maxreserves','50','','Define maximum number of holds a patron can place','Integer'), -('memberofinstitution','0',NULL,'If ON, patrons can be linked to institutions','YesNo'), ('minPasswordLength','3',NULL,'Specify the minimum length of a patron/staff password','free'), ('NewItemsDefaultLocation','','','If set, all new items will have a location of the given Location Code ( Authorized Value type LOC )',''), ('noissuescharge','5','','Define maximum amount withstanding before check outs are blocked','Integer'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f043d0b..07f40d1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7953,6 +7953,15 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if (CheckVersion($DBversion)) { + $dbh->do(q| + DELETE FROM systempreferences WHERE variable="memberofinstitution" + |); + print "Upgrade to $DBversion done (Bug XXXXX: Remove memberofinstitytion system preference)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 74d14af..41d6392 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -80,12 +80,6 @@ Patrons: - '[% local_currency %].' - Empty value means no limit. Single item caps are specified in the circulation rules matrix. - - - pref: memberofinstitution - choices: - yes: Do - no: "Don't" - - allow patrons to be linked to institutions (which must be set up as Institution patrons). - - - Login passwords for staff and patrons must be at least - pref: minPasswordLength class: integer diff --git a/members/memberentry.pl b/members/memberentry.pl index 3d68e49..827b5b4 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -401,11 +401,6 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){ } } - if ($data{'organisations'}){ - # need to add the members organisations - my @orgs=split(/\|/,$data{'organisations'}); - add_member_orgs($borrowernumber,\@orgs); - } if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) { C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes); } @@ -629,28 +624,6 @@ if($no_categories){ $template->param(no_categories => 1); } $template->param(no_add => $no_add); -my $CGIorganisations; -my $member_of_institution; -if (C4::Context->preference("memberofinstitution")){ - my $organisations=get_institutions(); - my @orgs; - my %org_labels; - foreach my $organisation (keys %$organisations) { - push @orgs,$organisation; - $org_labels{$organisation}=$organisations->{$organisation}->{'surname'}; - } - $member_of_institution=1; - - $CGIorganisations = CGI::scrolling_list( -id => 'organisations', - -name => 'organisations', - -labels => \%org_labels, - -values => \@orgs, - -size => 5, - -multiple => 'true' - - ); -} - # -------------------------------------------------------------------------------------------------------- my $CGIsort = buildCGIsort("Bsort1","sort1",$data{'sort1'}); @@ -739,8 +712,6 @@ $template->param( category_type =>$category_type, modify => $modify, nok => $nok,#flag to konw if an error - memberofinstution => $member_of_institution, - CGIorganisations => $CGIorganisations, NoUpdateLogin => $NoUpdateLogin ); -- 1.7.10.4