Bugzilla – Attachment 72406 Details for
Bug 20264
Syspref checkdigit is no longer in used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20264: Remove syspref checkdigit
Bug-20264-Remove-syspref-checkdigit.patch (text/plain), 7.02 KB, created by
Josef Moravec
on 2018-03-05 08:15:36 UTC
(
hide
)
Description:
Bug 20264: Remove syspref checkdigit
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-03-05 08:15:36 UTC
Size:
7.02 KB
patch
obsolete
>From d258db1acf721c626b02755f9113ae8ba1db9bc6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 21 Feb 2018 15:04:01 -0300 >Subject: [PATCH] Bug 20264: Remove syspref checkdigit >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >According to >http://irc.koha-community.org/koha/2013-06-26#i_1333289 >http://irc.koha-community.org/koha/2013-06-26#i_1333589 >and Hea data, this syspref is no longer in used and is always set to >false. > >Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Members.pm | 56 +++------------------- > C4/UsageStats.pm | 1 - > .../atomicupdate/bug_20264_remove_checkdigit.sql | 1 + > installer/data/mysql/sysprefs.sql | 1 - > .../prog/en/modules/admin/preferences/patrons.pref | 6 --- > t/db_dependent/UsageStats.t | 1 - > 6 files changed, 7 insertions(+), 59 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_20264_remove_checkdigit.sql > >diff --git a/C4/Members.pm b/C4/Members.pm >index 58f6e8a..6e9429b 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -534,9 +534,6 @@ mode, to avoid database corruption. > > =cut > >-use vars qw( @weightings ); >-my @weightings = ( 8, 4, 6, 3, 5, 2, 1 ); >- > sub fixup_cardnumber { > my ($cardnumber) = @_; > my $autonumber_members = C4::Context->boolean_preference('autoMemberNum') || 0; >@@ -545,56 +542,15 @@ sub fixup_cardnumber { > # automatically. Should be either "1" or something else. > # Defaults to "0", which is interpreted as "no". > >- # if ($cardnumber !~ /\S/ && $autonumber_members) { > ($autonumber_members) or return $cardnumber; >- my $checkdigit = C4::Context->preference('checkdigit'); > my $dbh = C4::Context->dbh; >- if ( $checkdigit and $checkdigit eq 'katipo' ) { >- >- # if checkdigit is selected, calculate katipo-style cardnumber. >- # otherwise, just use the max() >- # purpose: generate checksum'd member numbers. >- # We'll assume we just got the max value of digits 2-8 of member #'s >- # from the database and our job is to increment that by one, >- # determine the 1st and 9th digits and return the full string. >- my $sth = $dbh->prepare( >- "select max(substring(borrowers.cardnumber,2,7)) as new_num from borrowers" >- ); >- $sth->execute; >- my $data = $sth->fetchrow_hashref; >- $cardnumber = $data->{new_num}; >- if ( !$cardnumber ) { # If DB has no values, >- $cardnumber = 1000000; # start at 1000000 >- } else { >- $cardnumber += 1; >- } >- >- my $sum = 0; >- for ( my $i = 0 ; $i < 8 ; $i += 1 ) { >- # read weightings, left to right, 1 char at a time >- my $temp1 = $weightings[$i]; > >- # sequence left to right, 1 char at a time >- my $temp2 = substr( $cardnumber, $i, 1 ); >- >- # mult each char 1-7 by its corresponding weighting >- $sum += $temp1 * $temp2; >- } >- >- my $rem = ( $sum % 11 ); >- $rem = 'X' if $rem == 10; >- >- return "V$cardnumber$rem"; >- } else { >- >- my $sth = $dbh->prepare( >- 'SELECT MAX( CAST( cardnumber AS SIGNED ) ) FROM borrowers WHERE cardnumber REGEXP "^-?[0-9]+$"' >- ); >- $sth->execute; >- my ($result) = $sth->fetchrow; >- return $result + 1; >- } >- return $cardnumber; # just here as a fallback/reminder >+ my $sth = $dbh->prepare( >+ 'SELECT MAX( CAST( cardnumber AS SIGNED ) ) FROM borrowers WHERE cardnumber REGEXP "^-?[0-9]+$"' >+ ); >+ $sth->execute; >+ my ($result) = $sth->fetchrow; >+ return $result + 1; > } > > =head2 GetPendingIssues >diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm >index 678b845..18ae593 100644 >--- a/C4/UsageStats.pm >+++ b/C4/UsageStats.pm >@@ -291,7 +291,6 @@ sub BuildReport { > AutoEmailPrimaryAddress > autoMemberNum > BorrowerRenewalPeriodBase >- checkdigit > EnableBorrowerFiles > EnhancedMessagingPreferences > ExtendedPatronAttributes >diff --git a/installer/data/mysql/atomicupdate/bug_20264_remove_checkdigit.sql b/installer/data/mysql/atomicupdate/bug_20264_remove_checkdigit.sql >new file mode 100644 >index 0000000..529b339 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_20264_remove_checkdigit.sql >@@ -0,0 +1 @@ >+DELETE FROM systempreferences WHERE variable="checkdigit"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 76bb2cc..09b844c 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -102,7 +102,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('casServerUrl','https://localhost:8443/cas','','URL of the cas server','Free'), > ('CatalogModuleRelink','0',NULL,'If OFF the linker will never replace the authids that are set in the cataloging module.','YesNo'), > ('CataloguingLog','1',NULL,'If ON, log edit/create/delete actions on bibliographic data. WARNING: this feature is very resource consuming.','YesNo'), >-('checkdigit','none','none|katipo','If ON, enable checks on patron cardnumber: none or \"Katipo\" style checks','Choice'), > ('CheckPrevCheckout','hardno','hardyes|softyes|softno|hardno','By default, for every item checked out, should we warn if the patron has borrowed that item in the past?','Choice'), > ('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'), > ('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'), >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 fe4da67..f1af818 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 >@@ -55,12 +55,6 @@ Patrons: > hardno: "Do not" > - " check borrower checkout history to see if the current item has been checked out before." > - >- - pref: checkdigit >- choices: >- none: "Don't" >- katipo: Do >- - check and construct borrower card numbers in the Katipo style. This overrides <code>autoMemberNum</code> if on. >- - > - pref: EnhancedMessagingPreferences > choices: > yes: Allow >diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t >index 2b33165..f2770f7 100644 >--- a/t/db_dependent/UsageStats.t >+++ b/t/db_dependent/UsageStats.t >@@ -545,7 +545,6 @@ sub mocking_systempreferences_to_a_set_value { > AutoEmailPrimaryAddress > autoMemberNum > BorrowerRenewalPeriodBase >- checkdigit > EnableBorrowerFiles > EnhancedMessagingPreferences > ExtendedPatronAttributes >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20264
:
72048
|
72049
|
72289
|
72396
| 72406