From b02a764939a0443eea998408a7fdd8be2a825166 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Wed, 4 May 2016 13:31:01 +0100 Subject: [PATCH] Bug 16258 Add a syspref to govern EDIFACT functionality Adds an "Edifact" systempreference to govern whether edifact processing is enabled. In most places this is hidden if the current vendor does not appear in the edi vendors table. This preference hides the admin screens which define this and a couple of links. Also fixes an anomaly whereby the basketgroup screen was not making the same check on whether edi ordering should be enabled as the basket screen. Both now use the same logic. --- acqui/basketgroup.pl | 1 + installer/data/mysql/atomicupdate/bug_16258.pl | 15 +++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../prog/en/includes/acquisitions-menu.inc | 4 ++-- .../prog/en/modules/admin/admin-home.tt | 2 +- .../modules/admin/preferences/acquisitions.pref | 8 ++++++++ 6 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_16258.pl diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 2d4241e025..336a8fb4d2 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -52,6 +52,7 @@ use CGI qw ( -utf8 ); use File::Spec; use C4::Acquisition qw( GetOrders GetOrder get_rounded_price GetBasket GetBasketgroup GetBasketsByBasketgroup GetBasketgroups GetBasketsByBookseller ModBasket CloseBasketgroup GetBasketGroupAsCSV DelBasketgroup ReOpenBasketgroup ModBasketgroup NewBasket NewBasketgroup ); +use Koha::Database; use Koha::EDI qw( get_edifact_ean create_edi_order ); use Koha::Biblioitems; diff --git a/installer/data/mysql/atomicupdate/bug_16258.pl b/installer/data/mysql/atomicupdate/bug_16258.pl new file mode 100644 index 0000000000..521b1ef2cf --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_16258.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "16258", + description => "A preference to enabled/disable edifact", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('Edifact', '0', NULL, 'Enables edifact acquisitions functions', 'YesNo') + }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index dd83a00fd8..6843a5c3c9 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -186,6 +186,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DumpTemplateVarsIntranet', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.', 'YesNo'), ('DumpTemplateVarsOpac', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.', 'YesNo'), ('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'), +('Edifact','0','Enables edifact acquisitions functions','Enables use of Edifact electronic message exchange for acquisitions','YesNo'), ('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'), ('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL), ('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc index a83bc21d96..3dd4925171 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc @@ -6,7 +6,7 @@ [% IF ( CAN_user_acquisition_order_receive ) %]
  • Late orders
  • [% END %] [% IF ( suggestion && CAN_user_suggestions_suggestions_manage ) %]
  • Suggestions
  • [% END %]
  • Invoices
  • - [% IF CAN_user_acquisition_edi_manage %] + [% IF Koha.Preference("Edifact") && CAN_user_acquisition_edi_manage %]
  • EDIFACT messages
  • [% END %] @@ -34,7 +34,7 @@ [% IF ( CAN_user_acquisition_currencies_manage ) %]
  • Currencies
  • [% END %] - [% IF CAN_user_acquisition_edi_manage %] + [% IF Koha.Preference("Edifact") && CAN_user_acquisition_edi_manage %]
  • EDI accounts
  • Library EANs
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index afdae6c399..acf704c954 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -214,7 +214,7 @@
    Funds
    Define funds within your budgets
    [% END %] - [% IF ( CAN_user_acquisition_edi_manage ) %] + [% IF ( Koha.Preference("Edifact") && CAN_user_acquisition_edi_manage ) %]
    EDI accounts
    Manage vendor EDI accounts for import/export
    Library EANs
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref index 7d6a3c3bc4..4792ef0988 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref @@ -112,6 +112,14 @@ Acquisitions: - 'If you choose EmailAddressForSuggestions you have to enter a valid email address:' - pref: EmailAddressForSuggestions class: email + - + - pref: Edifact + default: no + choices: + yes: Enable + no: Disable + - Enable electronic ordering using EDIFACT format messages + Printing: - - Use the -- 2.20.1