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> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
8255c8edcf
commit
81431ee28a
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 ) %]
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
@ -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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
|
|
|
|||
|
|
@ -116,9 +116,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");
|
||||
|
|
|
|||
|
|
@ -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' %]
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
|
|
|
|||
|
|
@ -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(){
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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(){
|
||||
|
|
|
|||
|
|
@ -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':''};
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
<script type="text/JavaScript">
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -1169,6 +1169,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() {
|
||||
|
|
|
|||
|
|
@ -187,6 +187,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -828,6 +828,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>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
</div>
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
[% Asset.js("js/members-menu.js") %]
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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' ) {
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue