Bugzilla – Attachment 115618 Details for
Bug 27486
Rename system preference delimiter to CSVDelimiter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27486: Rename system preference delimiter to CSVDelimiter
Bug-27486-Rename-system-preference-delimiter-to-CS.patch (text/plain), 18.70 KB, created by
Mazen Khallaf
on 2021-01-21 20:26:54 UTC
(
hide
)
Description:
Bug 27486: Rename system preference delimiter to CSVDelimiter
Filename:
MIME Type:
Creator:
Mazen Khallaf
Created:
2021-01-21 20:26:54 UTC
Size:
18.70 KB
patch
obsolete
>From 498d90468620923d7856708336f84f82714f5e9c Mon Sep 17 00:00:00 2001 >From: Mazen Khallaf <mazen.i.khallaf@gamil.com> >Date: Thu, 21 Jan 2021 01:40:50 +0000 >Subject: [PATCH] Bug 27486: Rename system preference delimiter to CSVDelimiter > >Test Plan: > >1. Go to Administration >2. Go to System Preferences >3. Find 'delimiter' (note the name) >4. Apply patch >5. Repeat step 1 and 2 >6. Find 'CSVDelimiter' (note the name) >--- > C4/Reports.pm | 2 +- > .../bug_27486-replace-delimiter-with-CSVDelimiter.perl | 8 ++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 2 +- > .../prog/en/includes/catalogue/itemsearch_item.csv.inc | 2 +- > .../intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt | 2 +- > .../prog/en/includes/csv_headers/acqui/basketgroup.tt | 2 +- > .../prog/en/includes/csv_headers/acqui/lateorders.tt | 2 +- > .../prog/en/includes/csv_headers/catalogue/itemsearch.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt | 2 +- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt | 2 +- > .../intranet-tmpl/prog/en/modules/admin/preferences/admin.pref | 2 +- > misc/cronjobs/fines.pl | 2 +- > misc/cronjobs/overdue_notices.pl | 4 ++-- > misc/export_borrowers.pl | 4 ++-- > reports/bor_issues_top.pl | 2 +- > reports/cash_register_stats.pl | 2 +- > reports/guided_reports.pl | 2 +- > reports/orders_by_fund.pl | 2 +- > t/db_dependent/Acquisition/GetBasketAsCSV.t | 2 +- > tools/viewlog.pl | 2 +- > 22 files changed, 31 insertions(+), 23 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_27486-replace-delimiter-with-CSVDelimiter.perl > >diff --git a/C4/Reports.pm b/C4/Reports.pm >index a0aa718fea..3300844617 100644 >--- a/C4/Reports.pm >+++ b/C4/Reports.pm >@@ -56,7 +56,7 @@ sub GetDelimiterChoices { > my $sth = $dbh->prepare(" > SELECT options, value > FROM systempreferences >- WHERE variable = 'delimiter' >+ WHERE variable = 'CSVDelimiter' > "); > > $sth->execute(); >diff --git a/installer/data/mysql/atomicupdate/bug_27486-replace-delimiter-with-CSVDelimiter.perl b/installer/data/mysql/atomicupdate/bug_27486-replace-delimiter-with-CSVDelimiter.perl >new file mode 100644 >index 0000000000..7d40c66866 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_27486-replace-delimiter-with-CSVDelimiter.perl >@@ -0,0 +1,8 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ # you can use $dbh here like: >+ $dbh->do(q{UPDATE systempreferences set variable="CSVDelimiter" WHERE variable="delimiter"}); >+ >+ # Always end with this (adjust the bug info) >+ NewVersion( $DBversion, 27486, "Renaming 'delimiter' syspref to 'CSVDelimiter'"); >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 7f0afaa594..7880fefbfa 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -162,7 +162,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('DefaultToLoggedInLibraryCircRules', '0', NULL , 'If enabled, circ rules editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), > ('DefaultToLoggedInLibraryNoticesSlips', '0', NULL , 'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), > ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), >-('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), >+('CSVDelimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), > ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding staff interface XSLT option must be on','Choice'), > ('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'), > ('displayFacetCount','0',NULL,NULL,'YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >index 57602e0ac2..739c145cb5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalogue/itemsearch_item.csv.inc >@@ -5,7 +5,7 @@ > [%- USE AuthorisedValues -%] > [%- SET biblio = item.biblio -%] > [%- SET biblioitem = item.biblioitem -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > "[% biblio.title | replace('"', '""') | $raw %] [% IF ( Koha.Preference( 'marcflavour' ) == 'UNIMARC' && biblio.author ) %]by [% END %][% biblio.author | replace('"', '""') | $raw %]" > [%- delimiter | $raw -%] > "[% (biblioitem.publicationyear || biblio.copyrightdate) | replace('"', '""') | $raw %]" >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt >index 517dab9f30..75d246c26e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basket.tt >@@ -1,4 +1,4 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > > [%- BLOCK -%]Contract name[% delimiter | html %]Order number[% delimiter | html %]Entry date[% delimiter | html %]ISBN[% delimiter | html %]Author[% delimiter | html %]Title[% delimiter | html %]Publication year[% delimiter | html %]Publisher[% delimiter | html %]Collection title[% delimiter | html %]Note for vendor[% delimiter | html %]Quantity[% delimiter | html %]RRP[% delimiter | html %]Delivery place[% delimiter | html %]Billing place[%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt >index 43221a65a7..63cc1ceb14 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/basketgroup.tt >@@ -1,4 +1,4 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > > [%- BLOCK -%]Account number[% delimiter | html %]Basket name[% delimiter | html %]Order number[% delimiter | html %]Author[% delimiter | html %]Title[% delimiter | html %]Publisher[% delimiter | html %]Publication year[% delimiter | html %]Collection title[% delimiter | html %]ISBN[% delimiter | html %]Quantity[% delimiter | html %]RRP tax included[% delimiter | html %]RRP tax excluded[% delimiter | html %]Discount[% delimiter | html %]Estimated cost tax included[% delimiter | html %]Estimated cost tax excluded[% delimiter | html %]Note for vendor[% delimiter | html %]Entry date[% delimiter | html %]Bookseller name[% delimiter | html %]Bookseller physical address[% delimiter | html %]Bookseller postal address[% delimiter | html %]Contract number[% delimiter | html %]Contract name[% delimiter | html %]Basket group delivery place[% delimiter | html %]Basket group billing place[% delimiter | html %]Basket delivery place[% delimiter | html %]Basket billing place[%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt >index f15f54586e..5bda385df0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/acqui/lateorders.tt >@@ -1,4 +1,4 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference('CSVDelimiter') || ',' -%] > > [%- BLOCK -%]ORDER DATE[%- delimiter | html -%]ESTIMATED DELIVERY DATE[%- delimiter | html -%]VENDOR[%- delimiter | html -%]INFORMATION[%- delimiter | html -%]TOTAL COST[%- delimiter | html -%]BASKET[%- delimiter | html -%]CLAIMS COUNT[%- delimiter | html -%]CLAIMED DATE[%- delimiter | html -%]INTERNAL NOTE[%- delimiter | html -%]VENDOR NOTE[%- delimiter | html -%]ISBN[%- END -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >index c36cfa6005..eccba14468 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/csv_headers/catalogue/itemsearch.tt >@@ -1,6 +1,6 @@ > [%- USE raw -%] > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference('CSVDelimiter') || ',' -%] > [%- BLOCK -%] > "Title" > [%- delimiter | $raw -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc >index c6b1ce0297..0d4eabaa24 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/delimiter_text.inc >@@ -1,4 +1,4 @@ >-[% SWITCH Koha.Preference('delimiter') %] >+[% SWITCH Koha.Preference('CSVDelimiter') %] > [% CASE '#' %]<span>Pound (#) separated text (.csv)</span> > [% CASE ',' %]<span>Comma separated text (.csv)</span> > [% CASE '/' %]<span>Slash separated text (.csv)</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt >index e37637e6c9..ebc67b91c9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basket.tt >@@ -1,5 +1,5 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > > [%- INCLUDE csv_headers/acqui/basket.tt -%] > [%- INCLUDE empty_line.inc -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt >index fe4d77c406..c005cd67c0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/basketgroup.tt >@@ -1,5 +1,5 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > > [%- USE Price -%] > [%- INCLUDE csv_headers/acqui/basketgroup.tt -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >index 95200db6f2..7bef44ee43 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/csv/lateorders.tt >@@ -1,5 +1,5 @@ > [%- USE Koha -%] >-[%- SET delimiter = Koha.Preference( 'delimiter' ) || ',' -%] >+[%- SET delimiter = Koha.Preference( 'CSVDelimiter' ) || ',' -%] > > [%- USE KohaDates -%] > [%- INCLUDE csv_headers/acqui/lateorders.tt -%] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index c5532ca5e4..d5b33f0cb5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -43,7 +43,7 @@ Administration: > no: "Yes" > - > - "Default separator for columns in an exported CSV file: " >- - pref: delimiter >+ - pref: CSVDelimiter > default: "," > choices: > ';': semicolons >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 717c0d5fa2..f74c4b9e88 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -99,7 +99,7 @@ my @other_fields = qw(days_overdue fine); > my $libname = C4::Context->preference('LibraryName'); > my $control = C4::Context->preference('CircControl'); > my $mode = C4::Context->preference('finesMode'); >-my $delim = "\t"; # ? C4::Context->preference('delimiter') || "\t"; >+my $delim = "\t"; # ? C4::Context->preference('CSVDelimiter') || "\t"; > > my $today = dt_from_string(); > my $filename; >diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl >index 7b50f254c6..bf1a370a11 100755 >--- a/misc/cronjobs/overdue_notices.pl >+++ b/misc/cronjobs/overdue_notices.pl >@@ -412,7 +412,7 @@ binmode( STDOUT, ':encoding(UTF-8)' ); > our $csv; # the Text::CSV_XS object > our $csv_fh; # the filehandle to the CSV file. > if ( defined $csvfilename ) { >- my $sep_char = C4::Context->preference('delimiter') || ';'; >+ my $sep_char = C4::Context->preference('CSVDelimiter') || ';'; > $sep_char = "\t" if ($sep_char eq 'tabulation'); > $csv = Text::CSV_XS->new( { binary => 1 , sep_char => $sep_char } ); > if ( $csvfilename eq '' ) { >@@ -826,7 +826,7 @@ END_SQL > # Generate the content of the csv with headers > my $content; > if ( defined $csvfilename ) { >- my $delimiter = C4::Context->preference('delimiter') || ';'; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ';'; > $content = join($delimiter, qw(title name surname address1 address2 zipcode city country email itemcount itemsinfo due_date issue_date)) . "\n"; > } > else { >diff --git a/misc/export_borrowers.pl b/misc/export_borrowers.pl >index 4733c3cbc1..27292189e9 100755 >--- a/misc/export_borrowers.pl >+++ b/misc/export_borrowers.pl >@@ -48,7 +48,7 @@ $0 -h > -s, --separator=CHAR This character will be used to separate fields. > Some characters like | or ; will need to be escaped > in the parameter setting, like -s=\\| or -s=\\; >- If no separator is specified, the delimiter pref >+ If no separator is specified, the CSVDelimiter pref > will be used (or a comma, if the pref is empty) > -H, --show-header Print field names on first row > -w, --where=CONDITION Condition to filter borrowers to export >@@ -91,7 +91,7 @@ my $sth = $dbh->prepare($query); > $sth->execute; > > unless ( $separator ) { >- $separator = C4::Context->preference('delimiter') || ','; >+ $separator = C4::Context->preference('CSVDelimiter') || ','; > $separator = "\t" if ($separator eq 'tabulation'); > } > >diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl >index d88d701a8f..90b6b49db8 100755 >--- a/reports/bor_issues_top.pl >+++ b/reports/bor_issues_top.pl >@@ -61,7 +61,7 @@ my ($template, $borrowernumber, $cookie) > flagsrequired => {reports => '*'}, > debug => 1, > }); >-our $sep = $input->param("sep") || C4::Context->preference('delimiter') || ','; >+our $sep = $input->param("sep") || C4::Context->preference('CSVDelimiter') || ','; > $sep = "\t" if ($sep eq 'tabulation'); > $template->param(do_it => $do_it, > ); >diff --git a/reports/cash_register_stats.pl b/reports/cash_register_stats.pl >index 8e8f46ce72..e0a01f4636 100755 >--- a/reports/cash_register_stats.pl >+++ b/reports/cash_register_stats.pl >@@ -157,7 +157,7 @@ if ($do_it) { > my $format = 'csv'; > my $reportname = $input->param('basename'); > my $reportfilename = $reportname ? "$reportname.$format" : "reportresults.$format" ; >- my $delimiter = C4::Context->preference('delimiter') || ','; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ','; > my @rows; > foreach my $row (@loopresult) { > my @rowValues; >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index aab868ed19..20abc890fd 100755 >--- a/reports/guided_reports.pl >+++ b/reports/guided_reports.pl >@@ -904,7 +904,7 @@ elsif ($phase eq 'Export'){ > $content .= join("\t", map { $_ // '' } @$row) . "\n"; > } > } else { >- my $delimiter = C4::Context->preference('delimiter') || ','; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ','; > if ( $format eq 'csv' ) { > $delimiter = "\t" if $delimiter eq 'tabulation'; > $type = 'application/csv'; >diff --git a/reports/orders_by_fund.pl b/reports/orders_by_fund.pl >index d5fa1070f5..6ffe018c9a 100755 >--- a/reports/orders_by_fund.pl >+++ b/reports/orders_by_fund.pl >@@ -209,7 +209,7 @@ else { > $template->param( budgetsloop => \@{$budgetloop}, > outputFormatloop => \@outputFormats, > delimiterloop => \@CSVdelimiters, >- delimiterPreference => C4::Context->preference('delimiter') >+ delimiterPreference => C4::Context->preference('CSVDelimiter') > ); > } > >diff --git a/t/db_dependent/Acquisition/GetBasketAsCSV.t b/t/db_dependent/Acquisition/GetBasketAsCSV.t >index 4dd5e6a2e3..5b9b648c0e 100755 >--- a/t/db_dependent/Acquisition/GetBasketAsCSV.t >+++ b/t/db_dependent/Acquisition/GetBasketAsCSV.t >@@ -74,7 +74,7 @@ is($basket_csv1, 'autor,title,quantity > ', 'CSV should be generated with user profile'); > > # Use default template >-t::lib::Mocks::mock_preference('delimiter', ','); >+t::lib::Mocks::mock_preference('CSVDelimiter', ','); > my $basket_csv2 = C4::Acquisition::GetBasketAsCSV($basketno, $query); > is($basket_csv2, 'Contract name,Order number,Entry date,ISBN,Author,Title,Publication year,Publisher,Collection title,Note for vendor,Quantity,RRP,Delivery place,Billing place > "",' . $order->ordernumber . ',2016-01-02,,"King, Stephen","Test Record",,"","","",3,,"","" >diff --git a/tools/viewlog.pl b/tools/viewlog.pl >index dec1259019..b58dcbacac 100755 >--- a/tools/viewlog.pl >+++ b/tools/viewlog.pl >@@ -216,7 +216,7 @@ if ($do_it) { > > # Printing to a csv file > my $content = q{}; >- my $delimiter = C4::Context->preference('delimiter') || ','; >+ my $delimiter = C4::Context->preference('CSVDelimiter') || ','; > if (@data) { > my $csv = Text::CSV::Encoded->new( { encoding_out => 'utf8', sep_char => $delimiter } ); > $csv or die "Text::CSV::Encoded->new FAILED: " . Text::CSV::Encoded->error_diag(); >-- >2.11.0
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 27486
:
115485
|
115618
|
115742
|
115996
|
115997
|
116009
|
116140