From 33e6e540d6fc5ad9a64782672d601e51407689a1 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 | 5 +++++ installer/data/mysql/atomicupdate/addedifactsyspref.sql | 2 ++ installer/data/mysql/sysprefs.sql | 2 ++ koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt | 2 ++ .../prog/en/modules/admin/preferences/acquisitions.pref | 7 +++++++ 7 files changed, 22 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/addedifactsyspref.sql diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 85422cb..f8fb544 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -55,6 +55,7 @@ use C4::Acquisition qw/CloseBasketgroup ReOpenBasketgroup GetOrders GetBasketsBy use C4::Branch qw/GetBranches/; use C4::Members qw/GetMember/; use Koha::EDI qw/create_edi_order get_edifact_ean/; +use Koha::Database; use Koha::Acquisition::Bookseller; @@ -232,6 +233,10 @@ my $op = $input->param('op') || 'display'; # - display : display the list of all basketgroups for a vendor my $booksellerid = $input->param('booksellerid'); $template->param(booksellerid => $booksellerid); +my $schema = Koha::Database->new()->schema(); +my $rs = $schema->resultset('VendorEdiAccount')->search( + { vendor_id => $booksellerid, } ); +$template->param( ediaccount => ($rs->count > 0)); if ( $op eq "add" ) { # diff --git a/installer/data/mysql/atomicupdate/addedifactsyspref.sql b/installer/data/mysql/atomicupdate/addedifactsyspref.sql new file mode 100644 index 0000000..f07d45b --- /dev/null +++ b/installer/data/mysql/atomicupdate/addedifactsyspref.sql @@ -0,0 +1,2 @@ +INSERT IGNORE INTO systempreferences VALUES( 'Edifact', '0', 'Enable Edifact Electronic Ordering', 'Enables use of Edifact electronic ordering', 'YesNo'); + diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index d95754d..3e2e09b 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -132,6 +132,8 @@ 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','Enable Edifact Electronic Ordering','Enables use of Edifact electronic ordering','YesNo'), + ('EDIInvoicesShippingBudget',NULL,NULL,'The budget code used to allocate shipping charges to when processing EDI Invoice messages','free'), ('emailLibrarianWhenHoldIsPlaced','0',NULL,'If ON, emails the librarian whenever a hold is placed','YesNo'), ('EnableAdvancedCatalogingEditor','0','','Enable the Rancor advanced cataloging editor','YesNo'), 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 c33d6d4..110aaa4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc @@ -9,7 +9,9 @@ [% IF ( CAN_user_parameters ) %]
  • Currencies
  • [% END %] + [% IF Koha.Preference("Edifact") %] [% IF CAN_user_acquisition_edi_manage %]
  • Edifact Messages
  • [% END %] + [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt index e4f7b75..c580537 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt @@ -144,7 +144,9 @@ function submitForm(form) {
    Reopen this basket group
    Export this basket group as CSV
    Print this basket group in PDF
    + [% IF ediaccount %]
    Generate edifact order
    + [% END %] [% END %] [% IF (name && closedbg) %] 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 bd951bc..6f26471 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 @@ -98,10 +98,12 @@
    Funds
    Define funds within your budgets
    + [% IF Koha.Preference("Edifact") %]
    EDI accounts
    Manage vendor EDI accounts for import/export
    Library EANs
    Manage library EDI EANs
    + [% END %]

    Additional parameters

    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 0c924b4..5c930c8 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 @@ -67,6 +67,13 @@ Acquisitions: yes: Send no: Don't send - blind copy (BCC) to logged in user when sending serial or acquisitions claims notices. + - + - pref: Edifact + default: no + choices: + yes: Enable + no: Disable + - Enable electronic ordering using EDIFACT format messages Printing: - -- 2.5.5