From fe5014bd3bc920dd3a2ef7458549c428b09ab021 Mon Sep 17 00:00:00 2001 From: Colin Campbell <colin.campbell@ptfs-europe.com> 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 | 4 ++++ 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, 21 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/addedifactsyspref.sql diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 85422cb..b6725fb 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -232,6 +232,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 ) %] <li><a href="/cgi-bin/koha/admin/currency.pl">Currencies</a></li> [% END %] + [% IF Koha.Preference("Edifact") %] [% IF CAN_user_acquisition_edi_manage %] <li><a href="/cgi-bin/koha/acqui/edifactmsgs.pl">Edifact Messages</a></li> [% END %] + [% END %] </ul> 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) { <div class="btn-group"><a href="[% script_name %]?op=reopen&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]&mode=singlebg" class="btn btn-small" id="reopenbutton"><i class="fa fa-download"></i> Reopen this basket group</a></div> <div class="btn-group"><a href="[% script_name %]?op=export&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="exportbutton"><i class="fa fa-download"></i> Export this basket group as CSV</a></div> <div class="btn-group"><a href="[% script_name %]?op=print&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="printbutton"><i class="fa fa-download"></i> Print this basket group in PDF</a></div> + [% IF ediaccount %] <div class="btn-group"><a href="[% script_name %]?op=ediprint&basketgroupid=[% basketgroupid %]&booksellerid=[% booksellerid %]" class="btn btn-small" id="printbutton"><i class="fa fa-download"></i> Generate edifact order</a></div> + [% END %] </div> [% 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 @@ <dt><a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a></dt> <dd>Define funds within your budgets</dd> + [% IF Koha.Preference("Edifact") %] <dt><a href="/cgi-bin/koha/admin/edi_accounts.pl">EDI accounts</a></dt> <dd>Manage vendor EDI accounts for import/export</dd> <dt><a href="/cgi-bin/koha/admin/edi_ean_accounts.pl">Library EANs</a></dt> <dd>Manage library EDI EANs</dd> + [% END %] </dl> <h3>Additional parameters</h3> 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