Bugzilla – Attachment 130065 Details for
Bug 29695
Centralize columns' descriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29695: Add new module Koha::Database::Columns
Bug-29695-Add-new-module-KohaDatabaseColumns.patch (text/plain), 14.08 KB, created by
Jonathan Druart
on 2022-02-02 09:47:43 UTC
(
hide
)
Description:
Bug 29695: Add new module Koha::Database::Columns
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-02-02 09:47:43 UTC
Size:
14.08 KB
patch
obsolete
>From 6857efa52cfcfe7ab969c40ad7bee751620e6eca Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 Dec 2021 17:27:37 +0100 >Subject: [PATCH] Bug 29695: Add new module Koha::Database::Columns > >This module will contain new strings and make them translatable using >Koha::I18N. > >We will need to improve this module to prevent the dozens of __ calls >each time we retrieve the column list. We could either use memcached or >add a method to only retrieve columns for a given table. >--- > Koha/Database/Columns.pm | 213 +++++++++++++++++++++++ > t/Koha/Database/Columns.t | 34 ++++ > t/Koha/I18N/po/xx_XX/LC_MESSAGES/Koha.mo | Bin 1370 -> 1385 bytes > 3 files changed, 247 insertions(+) > create mode 100644 Koha/Database/Columns.pm > create mode 100755 t/Koha/Database/Columns.t > >diff --git a/Koha/Database/Columns.pm b/Koha/Database/Columns.pm >new file mode 100644 >index 00000000000..9dda04311cc >--- /dev/null >+++ b/Koha/Database/Columns.pm >@@ -0,0 +1,213 @@ >+package Koha::Database::Columns; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+=head1 NAME >+ >+Koha::Database::Columns >+ >+=head1 SYNOPSIS >+ >+ use Koha::Database::Columns; >+ >+=head1 FUNCTIONS >+ >+=cut >+ >+use Modern::Perl; >+use Koha::I18N qw( __ ); >+ >+sub columns { >+ return { >+ borrowers => { >+ "borrowernumber" => __("Borrower number"), >+ "title" => __("Salutation"), >+ "surname" => __("Surname"), >+ "firstname" => __("First name"), >+ "dateofbirth" => __("Date of birth"), >+ "initials" => __("Initials"), >+ "othernames" => __("Other name"), >+ "sex" => __("Gender"), >+ "relationship" => __("Relationship"), >+ "streetnumber" => __("Street number"), >+ "streettype" => __("Street type"), >+ "address" => __("Address"), >+ "address2" => __("Address 2"), >+ "city" => __("City"), >+ "state" => __("State"), >+ "zipcode" => __("ZIP/Postal code"), >+ "country" => __("Country"), >+ "phone" => __("Primary phone"), >+ "phonepro" => __("Secondary phone"), >+ "mobile" => __("Other phone"), >+ "email" => __("Primary email"), >+ "emailpro" => __("Secondary email"), >+ "fax" => __("Fax"), >+ "B_streetnumber" => __("Alternate address: Street number"), >+ "B_streettype" => __("Alternate address: Street type"), >+ "B_address" => __("Alternate address: Address"), >+ "B_address2" => __("Alternate address: Address 2"), >+ "B_city" => __("Alternate address: City"), >+ "B_state" => __("Alternate address: State"), >+ "B_zipcode" => __("Alternate address: ZIP/Postal code"), >+ "B_country" => __("Alternate address: Country"), >+ "B_phone" => __("Alternate address: Phone"), >+ "B_email" => __("Alternate address: Email"), >+ "contactnote" => __("Alternate contact: Note"), >+ "altcontactfirstname" => __("Alternate contact: First name"), >+ "altcontactsurname" => __("Alternate contact: Surname"), >+ "altcontactaddress1" => __("Alternate contact: Address"), >+ "altcontactaddress2" => __("Alternate contact: Address 2"), >+ "altcontactaddress3" => __("Alternate contact: City"), >+ "contactname" => __("Alternate contact: Surname"), >+ "contactfirstname" => __("Alternate contact: First name"), >+ "contacttitle" => __("Alternate contact: Title"), >+ "altcontactstate" => __("Alternate contact: State"), >+ "altcontactzipcode" => __("Alternate contact: ZIP/Postal code"), >+ "altcontactcountry" => __("Alternate contact: Country"), >+ "altcontactphone" => __("Alternate contact: Phone"), >+ "cardnumber" => __("Card number"), >+ "branchcode" => __("Home library"), >+ "categorycode" => __("Patron category"), >+ "sort1" => __("Sort 1"), >+ "sort2" => __("Sort 2"), >+ "dateenrolled" => __("Registration date"), >+ "dateexpiry" => __("Expiry date"), >+ "opacnote" => __("OPAC note"), >+ "borrowernotes" => __("Circulation note"), >+ "userid" => __("Username"), >+ "password" => __("Password"), >+ "flags" => __("System permissions"), >+ "gonenoaddress" => __("Gone no address flag"), >+ "lost" => __("Lost card flag"), >+ "debarred" => __("Restricted [until] flag"), >+ "debarredcomment" => __("Comment"), >+ "smsalertnumber" => __("Mobile phone number"), >+ "privacy" => __("Privacy settings"), >+ "autorenew_checkouts" => __("Allow auto-renewals"), >+ }, >+ items => { >+ "itemnumber" => __("Item number (internal)"), >+ "biblionumber" => __("Biblio number (internal)"), >+ "biblioitemnumber" => __("Biblioitem number (internal)"), >+ "barcode" => __("Barcode"), >+ "dateaccessioned" => __("Date acquired"), >+ "booksellerid" => __("Source of acquisition"), >+ "homebranch" => __("Permanent library"), >+ "price" => __("Price"), >+ "replacementprice" => __("Replacement price"), >+ "replacementpricedate" => __("Price effective from"), >+ "datelastborrowed" => __("Date last checked out"), >+ "datelastseen" => __("Date last seen"), >+ "stack" => __("Shelving control number"), >+ "onloan" => __("Due date"), >+ "cn_source" => __("Source of classification / shelving scheme"), >+ "cn_sort" => __("Koha normalized classification for sorting"), >+ "notforloan" => __("Not for loan"), >+ "itemlost" => __("Lost status"), >+ "itemlost_on" => __("Lost on"), >+ "withdrawn" => __("Withdrawn status"), >+ "withdrawn_on" => __("Withdrawn on"), >+ "itemcallnumber" => __("Call number"), >+ "issues" => __("Total checkouts"), >+ "renewals" => __("Total renewals"), >+ "reserves" => __("Total holds"), >+ "restricted" => __("Use restrictions"), >+ "itemnotes" => __("Public note"), >+ "itemnotes_nonpublic" => __("Internal note"), >+ "holdingbranch" => __("Current library"), >+ "timestamp" => __("Timestamp"), >+ "location" => __("Shelving location"), >+ "permanent_location" => __("Permanent shelving location"), >+ "ccode" => __("Collection"), >+ "itype" => __("Koha itemtype"), >+ "stocknumber" => __("Inventory number"), >+ "damaged" => __("Damaged status"), >+ "damaged_on" => __("Damaged on"), >+ "materials" => __("Materials specified"), >+ "uri" => __("Uniform Resource Identifier"), >+ "more_subfields_xml" => __("Additional subfields (XML)"), >+ "enumchron" => __("Serial enumeraton/chronology"), >+ "copynumber" => __("Copy number"), >+ "new_status" => __("New status"), >+ }, >+ statistics => { >+ "datetime" => __("Statistics date and time"), >+ "branch" => __("Library"), >+ "value" => __("Value"), >+ "type" => __("Type"), >+ "other" => __(""), >+ "itemnumber" => __("Item number"), >+ "itemtype" => __("Itemtype"), >+ "borrowernumber" => __("Borrower number"), >+ }, >+ biblio => { >+ "frameworkcode" => __("Framework code"), >+ "author" => __("Author"), >+ "datecreated" => __("Creation date"), >+ "timestamp" => __("Modification date"), >+ }, >+ biblioitems => { >+ "biblioitemnumber" => __("Biblioitem number"), >+ "biblionumber" => __("Biblio number"), >+ "volume" => __("Volume number"), >+ "number" => __("Number"), >+ "classification" => __("Classification"), >+ "itemtype" => __("Biblio-level item type"), >+ "isbn" => __("ISBN"), >+ "issn" => __("ISSN"), >+ "dewey" => __("Dewey/classification"), >+ "subclass" => __("Sub classification"), >+ "publicationyear" => __("Publication date"), >+ "publishercode" => __("Publisher"), >+ "volumedate" => __("Volume date"), >+ "volumedesc" => __("Volume information"), >+ "timestamp" => __("Timestamp"), >+ "illus" => __("Illustrations"), >+ "pages" => __("Number of pages"), >+ "notes" => __("Notes"), >+ "size" => __("Size"), >+ "place" => __("Place of publication"), >+ "lccn" => __("LCCN"), >+ "agerestriction" => __("Age restriction"), >+ "url" => __("URL"), >+ "title" => __("Title"), >+ }, >+ subscription => { >+ "startdate" => __("Start date"), >+ "enddate" => __("End date"), >+ "periodicity" => __("Periodicity"), >+ "callnumber" => __("Call number"), >+ "location" => __("Location"), >+ "branchcode" => __("Library"), >+ }, >+ suggestions=> { >+ "author" => __("author"), >+ "copyrightdate" => __("copyrightdate"), >+ "isbn" => __("isbn"), >+ "publishercode" => __("publishercode"), >+ "collectiontitle" => __("collectiontitle"), >+ "place" => __("place"), >+ "quantity" => __("quantity"), >+ "itemtype" => __("itemtype"), >+ "branchcode" => __("branchcode"), >+ "patronreason" => __("patronreason"), >+ "note" => __("note"), >+ } >+ }; >+} >+ >+1; >diff --git a/t/Koha/Database/Columns.t b/t/Koha/Database/Columns.t >new file mode 100755 >index 00000000000..ff9191c678a >--- /dev/null >+++ b/t/Koha/Database/Columns.t >@@ -0,0 +1,34 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 1; >+use Test::MockModule; >+use FindBin qw($Bin); >+use Encode; >+ >+use Koha::Database::Columns; >+ >+my $koha_i18n = Test::MockModule->new('Koha::I18N'); >+$koha_i18n->mock('_base_directory', sub { "$Bin/../I18N/po" }); >+ >+my $c4_languages = Test::MockModule->new('C4::Languages'); >+$c4_languages->mock('getlanguage', sub { 'xx-XX' }); >+ >+my $columns = Koha::Database::Columns->columns; >+ >+is( $columns->{borrowers}->{opacnote}, decode_utf8('OPAC note â ⤠â') ); >diff --git a/t/Koha/I18N/po/xx_XX/LC_MESSAGES/Koha.mo b/t/Koha/I18N/po/xx_XX/LC_MESSAGES/Koha.mo >index 99be22f268b3e872ac10b2d2e3e538b1fd8293d6..ea84bd6c8c1b17cf6ba22abb335bc3eaffabe61f 100644 >GIT binary patch >delta 395 >zcmV;60d)S_3h4@e-Vy|r000004gdfE8~^|Si~s-t6951J`~Uy|00000NC5x<3;+NC >zNdW)=2><{9RsjG24*&oFU;zLC7XSbNZ~*`S9RL6Thyefq3;+NCrU3u|6#xJLvjG4A >z6#xJL$pHWW6#xJL-vIys8vp<R^#K3?761SM5dr`J3;+Os04M?g00aO405t*t09pY6 >z06GEy01yBG0F?s(02KfL0Hy-~03ZMW0K5YL0384T0Nn!s07U=*0Q&;~01^NI06_!* >z05|{u08|7305|{u0F49y02=@R0LBCW06zc#0OAAy04e|g03rnd01^NI08Iq|00;m8 >z0AK|G0097D000000000000000000L7000dD00000000O80000000062000UA000C4 >z000I6000XB000F5000R9000aC00093000gE0000;Wo&G3AbW0MZDoA`Pf$TaAZ~AT >pWwSj24FR)r0y+T|Pf$TaAZ~ATWgz05lpx}rq#)v$g|n;!t^sI=E;#@I > >delta 378 >zcmV-=0fqkQ3fc;P-Vy|r000004FCWD8~^|Sga7~l5dZ)H>;M1&00000FaZDn3;+NC >zF#!Mo4*&oFJ^=s#7XSbNP5}S_9RL6TW&r>I3;+NCgaH5m6#xJLkpTbz6#xJLrvU%} >z6#xJLy#W9K8vp<R(*Xbg761SM?*RY+3;+NC1_A&81ONbk022ZL0D}Pl02l%Q01yBG >z0GtB=03ZMW0IdT60384T0L}vd07U=*0PF(*01^NI05Svs05|{u07V1<05|{u0Dc4j >z02=@R0Jj7H06zc#0Mi5j04e|g022iO01^NI06ql(00;m808s@1009610000000000 >z01W^D00sa*00093000aC000UA00062000XB00000000R900000000C4000F5000L7 >z000O80000;Wo&G3AbW0MZDoD4UjYpPCR8m$a%Ew3X>V>VL}7GgIv_GIF*hwRG%YbO >YATcyLFf%JKGB7Z+X#za~v%CYX0a17;`Tzg` > >-- >2.25.1
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 29695
:
128522
|
128523
|
128524
|
128525
|
128526
|
128527
|
128528
|
128529
|
128559
|
128560
|
128561
|
128562
|
128563
|
128564
|
128565
|
130065
|
130066
|
130067
|
130068
|
130069
|
130070
|
130071
|
130107
|
130108
|
130109
|
130110
|
130111
|
130112
|
130113
|
131918
|
131919
|
131920
|
131921
|
131922
|
131923
|
131924
|
131925