Bugzilla – Attachment 162312 Details for
Bug 35067
Allow authorised value parent category so categories can be linked and shown together
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35067: [WIP]
Bug-35067-WIP.patch (text/plain), 5.67 KB, created by
Aleisha Amohia
on 2024-02-21 02:51:49 UTC
(
hide
)
Description:
Bug 35067: [WIP]
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2024-02-21 02:51:49 UTC
Size:
5.67 KB
patch
obsolete
>From d2f3d6a9a5f8292c6e437a4ba60e703bceb3cfba Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Wed, 21 Feb 2024 02:51:25 +0000 >Subject: [PATCH] Bug 35067: [WIP] > >--- > cataloguing/value_builder/multipleAV.pl | 95 +++++++++++++++++++ > .../cataloguing/value_builder/multipleAV.tt | 46 +++++++++ > 2 files changed, 141 insertions(+) > create mode 100755 cataloguing/value_builder/multipleAV.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/multipleAV.tt > >diff --git a/cataloguing/value_builder/multipleAV.pl b/cataloguing/value_builder/multipleAV.pl >new file mode 100755 >index 00000000000..17ff0b4cb65 >--- /dev/null >+++ b/cataloguing/value_builder/multipleAV.pl >@@ -0,0 +1,95 @@ >+#!/usr/bin/perl >+ >+# Copyright 2024 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# 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 CGI qw ( -utf8 ); >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+use Koha::AuthorisedValues; >+ >+=head1 DESCRIPTION >+ >+This plugin allows the cataloguer to choose one or more authorised value categories that should be available for selection in the dropdown for this subfield. >+ >+=cut >+ >+my $builder = sub { >+ my ( $params ) = @_; >+ my $res = qq{ >+ <script> >+ function Click$params->{id}(ev) { >+ ev.preventDefault(); >+ var code = document.getElementById(ev.data.id); >+ \$.ajax({ >+ url: '/cgi-bin/koha/cataloguing/plugin_launcher.pl', >+ type: 'POST', >+ data: { >+ 'plugin_name': 'multipleAV.pl', >+ 'code' : code.value, >+ }, >+ success: function(data){ >+ var field = document.getElementById(ev.data.id); >+ field.value = data; >+ return 1; >+ } >+ }); >+ } >+ </script> >+ }; >+ >+ return $res; >+}; >+ >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; >+ my $code = $input->param('code'); >+ >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { template_name => "cataloguing/value_builder/ajax.tt", >+ query => $input, >+ type => "intranet", >+ flagsrequired => { editcatalogue => '*' }, >+ } >+ ); >+ >+ # If a prefix is submited, we look for the highest stocknumber with this prefix, and return it incremented >+ $code =~ s/ *$//g; >+ if ( $code =~ m/^[a-zA-Z]+$/ ) { >+ my $av = Koha::AuthorisedValues->find({ >+ 'category' => 'INVENTORY', >+ 'authorised_value' => $code >+ }); >+ if ( $av ) { >+ $av->lib($av->lib + 1); >+ $av->store; >+ $template->param( return => $code . ' ' . sprintf( '%010s', ( $av->lib ) ), ); >+ } else { >+ $template->param( return => "There is no defined value for $code"); >+ } >+ # The user entered a custom value, we don't touch it, this could be handled in js >+ } else { >+ $template->param( return => $code, ); >+ } >+ >+ output_html_with_http_headers $input, $cookie, $template->output; >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/multipleAV.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/multipleAV.tt >new file mode 100644 >index 00000000000..c11ed17de09 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/multipleAV.tt >@@ -0,0 +1,46 @@ >+[% USE raw %] >+[% USE Koha %] >+[% PROCESS 'i18n.inc' %] >+[% SET footerjs = 1 %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>[% FILTER collapse %] >+ [% t("Multiple authorised values dropdown builder") | html %] › >+ [% t("Cataloging") | html %] › >+ [% t("Koha") | html %] >+[% END %]</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="cat_marc21_leader" class="cat value_builder"> >+ <form name="f_pop" onsubmit="report()" action=""> >+ <input type="hidden" name="plugin_name" value="multipleAV.pl" /> >+ <h1>Multiple authorised values dropdown builder</h1> >+ >+ <div class="page-section"> >+ </div> <!-- /.page-section --> >+ </form> >+ >+[% MACRO jsinclude BLOCK %] >+ <script> >+ function report() { >+ var doc = opener.document; >+ var field = doc.getElementById("[% index | html %]"); >+ field.value = >+ ' '+ >+ document.f_pop.f5.value + >+ document.f_pop.f6.value + >+ document.f_pop.f7.value + >+ document.f_pop.f8.value + >+ 'a'+ // MARC21 UNICODE flag - must be 'a' for Koha >+ '22 '+ >+ document.f_pop.f17.value + >+ document.f_pop.f18.value + >+ document.f_pop.f19.value + >+ '4500'; >+ self.close(); >+ return false; >+ } >+ </script> >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' popup_window=1 %] >-- >2.30.2
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 35067
:
162312
|
162326
|
162327
|
162328
|
162329
|
162355
|
162356
|
162357
|
162358
|
162702
|
162703
|
162704
|
162705
|
162706
|
162708