Bugzilla – Attachment 77103 Details for
Bug 20226
Get rid of CATCODE_MULTI param decision in patron perl scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20226: Centralize update child code (CATCODE_MULTI)
Bug-20226-Centralize-update-child-code-CATCODEMULT.patch (text/plain), 46.93 KB, created by
Owen Leonard
on 2018-07-19 12:32:18 UTC
(
hide
)
Description:
Bug 20226: Centralize update child code (CATCODE_MULTI)
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-07-19 12:32:18 UTC
Size:
46.93 KB
patch
obsolete
>From ffa31ea9aebde4c493418f951a26b59f007b17fe Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Jul 2018 16:21:13 -0300 >Subject: [PATCH] Bug 20226: Centralize update child code (CATCODE_MULTI) > >Code and variables to deal with the update child feature are not >centralized but copied/pasted in several scripts. Which leads to issues >obsviously (bug 20805 for instance). > >Moreover the strings used by the templates are also in several template >files (or .inc) > >To deal with that this patch introduces the idea to create 1 .inc file >per .js file >Here we have members-menu.inc for members-menu.js > >Test plan: >- Remove all your adult categories (categories.category_type='A') >- Create a patron with a child category >- Try to update to adult category >=> The entry does no longer appears! (This is a change in the behaviour) >- Create one adult category >- Update to adult category >=> There is a JS confirmation message, if you accept the patron will >be updated to the adult category >- Create (at least) another adult category >- Create another child >- Update to adult category >=> No more confirmation message but a popup to select the adult category >- Pick one >=> The patron has been updated to the adult category > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > Koha/Template/Plugin/Categories.pm | 3 ++- > circ/circulation.pl | 6 ------ > .../prog/en/includes/members-toolbar.inc | 11 ++++++---- > .../prog/en/includes/patron-search.inc | 11 ---------- > .../prog/en/includes/str/members-menu.inc | 24 +++++++++++++++++++++ > .../prog/en/modules/circ/circulation.tt | 10 +-------- > .../en/modules/circ/circulation_batch_checkouts.tt | 11 +--------- > .../prog/en/modules/members/apikeys.tt | 1 + > .../prog/en/modules/members/boraccount.tt | 2 +- > .../prog/en/modules/members/deletemem.tt | 12 +---------- > .../prog/en/modules/members/discharge.tt | 1 + > .../prog/en/modules/members/discharges.tt | 1 + > .../intranet-tmpl/prog/en/modules/members/files.tt | 1 + > .../prog/en/modules/members/holdshistory.tt | 1 + > .../prog/en/modules/members/housebound.tt | 11 +--------- > .../prog/en/modules/members/mancredit.tt | 1 + > .../prog/en/modules/members/maninvoice.tt | 1 + > .../prog/en/modules/members/member-flags.tt | 1 + > .../prog/en/modules/members/member-password.tt | 1 + > .../prog/en/modules/members/member.tt | 1 + > .../prog/en/modules/members/memberentrygen.tt | 1 + > .../prog/en/modules/members/members-update.tt | 1 + > .../prog/en/modules/members/merge-patrons.tt | 1 + > .../prog/en/modules/members/moremember.tt | 1 + > .../prog/en/modules/members/nl-search.tt | 1 + > .../prog/en/modules/members/notices.tt | 11 +--------- > .../intranet-tmpl/prog/en/modules/members/pay.tt | 1 + > .../prog/en/modules/members/paycollect.tt | 1 + > .../en/modules/members/purchase-suggestions.tt | 1 + > .../prog/en/modules/members/readingrec.tt | 1 + > .../prog/en/modules/members/routing-lists.tt | 1 + > .../prog/en/modules/members/statistics.tt | 1 + > .../prog/en/modules/members/update-child.tt | 25 +--------------------- > .../prog/en/modules/tools/import_borrowers.tt | 1 + > .../prog/en/modules/tools/picture-upload.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 6 +++--- > members/boraccount.pl | 6 ------ > members/deletemem.pl | 6 ------ > members/files.pl | 6 ------ > members/holdshistory.pl | 6 ------ > members/housebound.pl | 6 ------ > members/mancredit.pl | 5 ----- > members/maninvoice.pl | 6 ------ > members/member-flags.pl | 6 ------ > members/member-password.pl | 6 ------ > members/moremember.pl | 6 ------ > members/notices.pl | 6 ------ > members/pay.pl | 6 ------ > members/paycollect.pl | 5 ----- > members/printinvoice.pl | 6 ------ > members/readingrec.pl | 6 ------ > members/statistics.pl | 6 ------ > members/update-child.pl | 21 +++++++++++++----- > 53 files changed, 82 insertions(+), 199 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc > >diff --git a/Koha/Template/Plugin/Categories.pm b/Koha/Template/Plugin/Categories.pm >index 2a7ae53..9716500 100644 >--- a/Koha/Template/Plugin/Categories.pm >+++ b/Koha/Template/Plugin/Categories.pm >@@ -23,7 +23,8 @@ use base qw( Template::Plugin ); > use Koha::Patron::Categories; > > sub all { >- return Koha::Patron::Categories->search_limited; >+ my ( $self, $params ) = @_; >+ return Koha::Patron::Categories->search_limited($params); > } > > sub GetName { >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 1617584..5c858f7 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -537,12 +537,6 @@ if ( $patron ) { > } > } > >-if ( $patron && $patron->is_child) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > my $messages = Koha::Patron::Messages->search( > { > 'me.borrowernumber' => $borrowernumber, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index 1897af7..67f4ce0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -2,6 +2,7 @@ > [% USE Koha %] > [% USE Borrowers %] > [% USE Branches %] >+[% USE Categories %] > [% USE AuthorisedValues %] > [% SET NorwegianPatronDBEnable = Koha.Preference( 'NorwegianPatronDBEnable' ) %] > <div id="toolbar" class="btn-toolbar"> >@@ -81,10 +82,12 @@ > [% ELSE %] > <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="You are not authorized to delete patrons" id="deletepatron" href="#">Delete</a></li> > [% END %] >- [% IF ( patron.is_child ) %] >- <li><a id="updatechild" href="#">Update child to adult patron</a></li> >- [% ELSE %] >- <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Patron is an adult" id="updatechild" href="#">Update child to adult patron</a></li> >+ [% IF Categories.scalar.all(category_type => 'A').count > 0 %] >+ [% IF patron.is_child %] >+ <li><a id="updatechild" href="#">Update child to adult patron</a></li> >+ [% ELSE %] >+ <li class="disabled"><a data-toggle="tooltip" data-placement="left" title="Patron is an adult" id="updatechild" href="#">Update child to adult patron</a></li> >+ [% END %] > [% END %] > [% IF Koha.Preference('intranetreadinghistory') %] > [%IF ( privacy == 2 ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index 84e67a3..71dfeee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -156,14 +156,3 @@ > </div><!-- /header_search --> > </div><!-- /gradient --> > <!-- End Patrons Resident Search Box --> >- >-<script type="text/javascript"> >- var advsearch = "[% advsearch %]"; >- var destination = "[% destination %]"; >- var catcode = "[% catcode %]"; >- var dateformat = "[% Koha.Preference('dateformat') %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var borrowernumber = "[% patron.borrowernumber %]"; >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc >new file mode 100644 >index 0000000..bd86309 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/str/members-menu.inc >@@ -0,0 +1,24 @@ >+[% USE scalar %] >+[% USE Koha %] >+[% USE Categories %] >+ >+<script type="text/javascript"> >+ var advsearch = "[% advsearch %]"; >+ var destination = "[% destination %]"; >+ >+ var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >+ >+ var dateformat = "[% Koha.Preference('dateformat') %]"; >+ var NorwegianPatronDBEnable = "[% Koha.Preference('NorwegianPatronDBEnable') %]"; >+ >+ var borrowernumber; >+ var number_of_adult_categories = 0; >+ [% IF patron %] >+ borrowernumber = "[% patron.borrowernumber %]"; >+ [% IF patron.is_child %] >+ [% SET adult_categories = Categories.scalar.all(category_type => 'A') %] >+ [% SET number_of_adult_categories = adult_categories.count %] >+ number_of_adult_categories = [% number_of_adult_categories %] >+ [% END %] >+ [% END %] >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index a6e6ba0..136602c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1003,15 +1003,6 @@ No patron matched <span class="ex">[% message | html %]</span> > var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); > var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); > >- /* Set some variables needed in members-menu.js */ >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- > columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) %] > > [% IF borrowernumber and patron %] >@@ -1104,6 +1095,7 @@ No patron matched <span class="ex">[% message | html %]</span> > [% END %] > }); > </script> >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >index 44ad27b..7bfcd00 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >@@ -295,16 +295,6 @@ > [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") %] > <script type="text/javascript"> > >- /* Set some variables needed in members-menu.js */ >- var borrowernumber = "[% patron.borrowernumber %]"; >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- > $(document).ready(function() { > if($('#barcodelist').length) { > $('#barcodelist').focus(); >@@ -322,6 +312,7 @@ > })); > }); > </script> >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >index 418c7d1..e615ba0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/apikeys.tt >@@ -100,6 +100,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script> > $(document).ready(function(){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >index a7f508d..b5a5051 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt >@@ -112,9 +112,9 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> >- var dateformat = "[% Koha.Preference('dateformat') %]"; > $(document).ready(function() { > var txtActivefilter = _("Filter paid transactions"); > var txtInactivefilter = _("Show all transactions"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >index a37cd5c..4ef44d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/deletemem.tt >@@ -63,18 +63,8 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] >- <script> >- /* Set some variables needed in members-menu.js */ >- var borrowernumber = "[% patron.borrowernumber %]"; >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- </script> > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt >index f4a725b..f2a51ba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharge.tt >@@ -74,6 +74,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt >index f4456ae..5c27c04 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/discharges.tt >@@ -51,6 +51,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > > [% INCLUDE 'datatables.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt >index a046fb3..0cdffa4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/files.tt >@@ -86,6 +86,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function(){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >index 4586436..744be40 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >@@ -119,6 +119,7 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript" id="js"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt >index e28d35c..be76788 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/housebound.tt >@@ -429,22 +429,13 @@ > [% INCLUDE 'calendar.inc' %] > <script type="text/javascript"> > >- /* Set some variables needed in members-menu.js */ >- var borrowernumber = "[% patron.borrowernumber %]"; >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- > $(document).ready(function() { > $("a.delete").click(function(){ > return confirm(_("Are you sure you want to delete this delivery?")); > }); > }); > </script> >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt >index 9aca8b5..68e36a1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt >@@ -60,6 +60,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function(){ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt >index 2e139f7..30fb7d1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt >@@ -73,6 +73,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > var type_fees = {'L':'','F':'','A':'','N':'','M':''}; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt >index 4d40e0a..804e24b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-flags.tt >@@ -86,6 +86,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% Asset.js("lib/jquery/plugins/jquery.treeview.pack.js") %] > <!-- set up tree --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt >index 250ed4e..976e529 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-password.tt >@@ -91,6 +91,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/JavaScript"> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index fb62cb9..7644d2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -235,6 +235,7 @@ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 3635360..abbe6ba 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1166,6 +1166,7 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") %] > [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >index 1276f0c..26667e2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >@@ -187,6 +187,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >index 264d1c6..60faffc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/merge-patrons.tt >@@ -135,6 +135,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > > <script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index cac919f..6a37aab 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -768,6 +768,7 @@ > [% Asset.js("js/pages/circulation.js") %] > [% Asset.js("js/checkouts.js") %] > [% Asset.js("js/holds.js") %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% Asset.js("js/messaging-preference-form.js") %] > <script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt >index 915515a..6107d34 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt >@@ -79,6 +79,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >index 7053532..19a2f40 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt >@@ -93,16 +93,6 @@ > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > >- /* Set some variables needed in members-menu.js */ >- var borrowernumber = "[% patron.borrowernumber %]"; >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- > $(document).ready(function() { > $("#noticestable").dataTable($.extend(true, {}, dataTablesDefaults, { > "aaSorting": [[ 3, "desc" ]], >@@ -126,6 +116,7 @@ > }); > }); > </script> >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >index c234c23..ec72e85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt >@@ -138,6 +138,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %] > <script type= "text/javascript"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >index a00afb2..91fd550 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt >@@ -233,6 +233,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type= "text/javascript"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt >index 6794bc0..7ae264d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt >@@ -101,6 +101,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >index 36f5281..e3b0861 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt >@@ -119,6 +119,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript" id="js"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt >index 0a629ea..c4163ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt >@@ -88,6 +88,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt >index 14742eb..016b873 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/statistics.tt >@@ -90,6 +90,7 @@ > </div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt >index d5cd974..e30a977 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tt >@@ -38,9 +38,7 @@ > </table> > <input type="hidden" name="op" value="update" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >- <input type="hidden" name="catcode" value="[% catcode %]" /> > <input type="hidden" name="cattype" value="[% cattype %]" /> >- <input type="hidden" name="catcode_multi" value="[% CATCODE_MULTI %]" /> > <fieldset class="action"> > <input class="submit" type="submit" value="Submit" /> > <a href="#" class="cancel close">Cancel</a> >@@ -55,16 +53,6 @@ > [% INCLUDE 'datatables.inc' %] > <script type="text/javascript"> > >- /* Set some variables needed in members-menu.js */ >- var advsearch = "[% advsearch %]"; >- var dateformat = "[% dateformat %]"; >- var CAN_user_borrowers = "[% CAN_user_borrowers %]"; >- var CAN_user_borrowers_edit_borrowers = "[% CAN_user_borrowers_edit_borrowers %]"; >- var NorwegianPatronDBEnable = "[% NorwegianPatronDBEnable %]"; >- var CATCODE_MULTI = "[% CATCODE_MULTI %]"; >- var catcode = "[% catcode %]"; >- var destination = "[% destination %]"; >- > $(document).ready(function() { > $("#catst").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', >@@ -76,24 +64,13 @@ > })); > }); > </script> >- [% IF ( CONFIRM ) %] >- <script type="text/javascript"> >- function confirm_updatechild() { >- var is_confirmed = window.confirm('Are you sure you want to update this child to an Adult category? This cannot be undone.'); >- if (is_confirmed) { >- window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=[% borrowernumber %]&catcode=[% catcode %]&catcode_multi=[% CATCODE_MULTI %]'; >- } >- } >- >- confirm_updatechild([% borrowernumber %]); >- </script> >- [% END %] > [% IF ( SUCCESS ) %] > <script type="text/javascript"> > self.opener.location.href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber %]'; > window.close(); > </script> > [% END %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index f2b5c3c..119b01b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -291,6 +291,7 @@ you can supply dates in ISO format (e.g., '2010-10-28'). > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'calendar.inc' %] > [% Asset.js("js/tools-menu.js") %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >index 87151c7..d0a69b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/picture-upload.tt >@@ -142,6 +142,7 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/tools-menu.js") %] >+ [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") %] > <script type="text/javascript"> > $(document).ready(function() { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >index 8fdb538..4a3f4f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >@@ -1,4 +1,4 @@ >-/* global borrowernumber advsearch dateformat _ CAN_user_borrowers_edit_borrowers NorwegianPatronDBEnable CATCODE_MULTI catcode destination */ >+/* global borrowernumber advsearch dateformat _ CAN_user_borrowers_edit_borrowers NorwegianPatronDBEnable number_of_adult_categories destination */ > > $(document).ready(function(){ > $("#filteraction_off, #filteraction_on").on('click', function(e) { >@@ -123,12 +123,12 @@ function confirm_both_deletion() { > function confirm_updatechild() { > var is_confirmed = window.confirm(_("Are you sure you want to update this child to an Adult category? This cannot be undone.")); > if (is_confirmed) { >- window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=' + borrowernumber + '&catcode=' + catcode + '&catcode_multi=' + CATCODE_MULTI; >+ window.location='/cgi-bin/koha/members/update-child.pl?op=update&borrowernumber=' + borrowernumber; > } > } > > function update_child() { >- if( CATCODE_MULTI ){ >+ if( number_of_adult_categories > 1 ){ > window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=' + borrowernumber,'UpdateChild','width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes'); > } else { > confirm_updatechild(); >diff --git a/members/boraccount.pl b/members/boraccount.pl >index f95a268..582264a 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -69,12 +69,6 @@ elsif ( $action eq 'void' ) { > $payment->void(); > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > #get account details > my $total = $patron->account->balance; > >diff --git a/members/deletemem.pl b/members/deletemem.pl >index bc0c924..c010f0f 100755 >--- a/members/deletemem.pl >+++ b/members/deletemem.pl >@@ -101,12 +101,6 @@ if (C4::Context->preference("IndependentBranches")) { > } > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > my $op = $input->param('op') || 'delete_confirm'; > my $dbh = C4::Context->dbh; > my $is_guarantor = $dbh->selectrow_array("SELECT COUNT(*) FROM borrowers WHERE guarantorid=?", undef, $member); >diff --git a/members/files.pl b/members/files.pl >index 2e38c0d..46c3694 100755 >--- a/members/files.pl >+++ b/members/files.pl >@@ -115,12 +115,6 @@ else { > ); > } > >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- > $template->param( > files => Koha::Patron::Files->new( borrowernumber => $borrowernumber ) > ->GetFilesInfo(), >diff --git a/members/holdshistory.pl b/members/holdshistory.pl >index 1983a35..c17535b 100755 >--- a/members/holdshistory.pl >+++ b/members/holdshistory.pl >@@ -74,12 +74,6 @@ if ( $borrowernumber eq C4::Context->preference('AnonymousPatron') ){ > } > } > >-if ( $patron->is_child) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > $template->param( > holdshistoryview => 1, > patron => $patron, >diff --git a/members/housebound.pl b/members/housebound.pl >index 69bdc1a..574bacd 100755 >--- a/members/housebound.pl >+++ b/members/housebound.pl >@@ -166,12 +166,6 @@ if ( C4::Context->preference('ExtendedPatronAttributes') and $patron ) { > ); > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > $template->param( > housebound_profile => $houseboundprofile, > visit => $houseboundvisit, >diff --git a/members/mancredit.pl b/members/mancredit.pl >index f1d388d..8fdef1e 100755 >--- a/members/mancredit.pl >+++ b/members/mancredit.pl >@@ -99,11 +99,6 @@ if ($add){ > ); > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } > > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index f210a85..a1be118 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -114,12 +114,6 @@ if ($add){ > } > $template->param( invoice_types_loop => \@invoice_types ); > >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); > $template->param( >diff --git a/members/member-flags.pl b/members/member-flags.pl >index c527ff0..40ea583 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -182,12 +182,6 @@ if ($input->param('newflags')) { > push @loop, \%row; > } > >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); > $template->param( >diff --git a/members/member-password.pl b/members/member-password.pl >index 115f804..37a114b 100755 >--- a/members/member-password.pl >+++ b/members/member-password.pl >@@ -95,12 +95,6 @@ if ( $newpassword and not @errors) { > } > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > if ( C4::Context->preference('ExtendedPatronAttributes') ) { > my $attributes = GetBorrowerAttributes( $bor->{'borrowernumber'} ); > $template->param( >diff --git a/members/moremember.pl b/members/moremember.pl >index dbe9896..711cbbf 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -165,12 +165,6 @@ if ( $patron->is_debarred ) { > > $data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex}; > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > my @relatives; > if ( my $guarantor = $patron->guarantor ) { > $template->param( guarantor => $guarantor ); >diff --git a/members/notices.pl b/members/notices.pl >index 765b402..ac6748c 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -51,12 +51,6 @@ my ($template, $loggedinuser, $cookie)= get_template_and_user({template_name => > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > # Allow resending of messages in Notices tab > my $op = $input->param('op') || q{}; > if ( $op eq 'resend_notice' ) { >diff --git a/members/pay.pl b/members/pay.pl >index 2f967b3..b2216aa 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -234,12 +234,6 @@ sub borrower_add_additional_fields { > # some borrower info is not returned in the standard call despite being assumed > # in a number of templates. It should not be the business of this script but in lieu of > # a revised api here it is ... >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $extendedattributes = GetBorrowerAttributes($patron->borrowernumber); > $template->param( >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 0c547fe..a15267f 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -206,11 +206,6 @@ sub borrower_add_additional_fields { > # some borrower info is not returned in the standard call despite being assumed > # in a number of templates. It should not be the business of this script but in lieu of > # a revised api here it is ... >- if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } > > if (C4::Context->preference('ExtendedPatronAttributes')) { > my $extendedattributes = GetBorrowerAttributes($patron->borrowernumber); >diff --git a/members/printinvoice.pl b/members/printinvoice.pl >index 5988325..a6d92f7 100755 >--- a/members/printinvoice.pl >+++ b/members/printinvoice.pl >@@ -53,12 +53,6 @@ my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in" > my $patron = Koha::Patrons->find( $borrowernumber ); > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > #get account details > my $total = $patron->account->balance; > my $accountline = Koha::Account::Lines->find($accountlines_id)->unblessed; >diff --git a/members/readingrec.pl b/members/readingrec.pl >index 015c56c..4ce115e 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -92,12 +92,6 @@ if ( $op eq 'export_barcodes' ) { > } > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > if (! $limit){ > $limit = 'full'; > } >diff --git a/members/statistics.pl b/members/statistics.pl >index 0b02e03..e63d221 100755 >--- a/members/statistics.pl >+++ b/members/statistics.pl >@@ -85,12 +85,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >-if ( $patron->is_child ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >-} >- > $template->param( > patron => $patron, > statisticsview => 1, >diff --git a/members/update-child.pl b/members/update-child.pl >index 77f73f6..b0aff0d 100755 >--- a/members/update-child.pl >+++ b/members/update-child.pl >@@ -53,18 +53,16 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > my $borrowernumber = $input->param('borrowernumber'); > my $catcode = $input->param('catcode'); > my $cattype = $input->param('cattype'); >-my $catcode_multi = $input->param('catcode_multi'); > my $op = $input->param('op'); > > my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in"; > >+my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); > if ( $op eq 'multi' ) { > # FIXME - what are the possible upgrade paths? C -> A , C -> S ... > # currently just allowing C -> A >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); > $template->param( > MULTI => 1, >- CATCODE_MULTI => 1, > borrowernumber => $borrowernumber, > patron_categories => $patron_categories, > ); >@@ -75,11 +73,24 @@ elsif ( $op eq 'update' ) { > my $patron = Koha::Patrons->find( $borrowernumber ); > output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); > >+ my $adult_category; >+ if ( $patron_categories->count == 1 ) { >+ $adult_category = $patron_categories->next; >+ } else { >+ $adult_category = $patron_categories->search({'me.categorycode' => $catcode })->next; >+ } >+ >+ # Just in case someone is trying something bad >+ # But we should not hit that with a normal use of the interface >+ die "You are doing something wrong updating this child" unless $adult_category; >+ > $patron->guarantorid(undef); >- $patron->categorycode($catcode); >+ $patron->categorycode($adult_category->categorycode); > $patron->store; > >- if ( $catcode_multi ) { >+ # FIXME We should not need that >+ # We could redirect with a friendly message >+ if ( $patron_categories->count > 1 ) { > $template->param( > SUCCESS => 1, > borrowernumber => $borrowernumber, >-- >2.1.4
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 20226
:
77062
|
77103
|
77359