use Koha::Patron::Categories;
sub all {
- return Koha::Patron::Categories->search_limited;
+ my ( $self, $params ) = @_;
+ return Koha::Patron::Categories->search_limited($params);
}
sub GetName {
}
}
-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,
[% USE Koha %]
[% USE Borrowers %]
[% USE Branches %]
+[% USE Categories %]
[% USE AuthorisedValues %]
[% SET NorwegianPatronDBEnable = Koha.Preference( 'NorwegianPatronDBEnable' ) %]
<div id="toolbar" class="btn-toolbar">
[% 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 ) %]
</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>
--- /dev/null
+[% 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>
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 %]
[% END %]
});
</script>
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
[% 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();
}));
});
</script>
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script>
$(document).ready(function(){
[% 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");
</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' %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% INCLUDE 'datatables.inc' %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script type="text/javascript">
$(document).ready(function(){
[% 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() {
[% 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 %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script type="text/javascript">
$(document).ready(function(){
</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':''};
</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 -->
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script type="text/JavaScript">
[% 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() {
[% 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() {
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script type="text/javascript">
$(function() {
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script>
[% 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>
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
[% 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" ]],
});
});
</script>
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
</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">
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
<script type= "text/javascript">
$(document).ready(function() {
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript" id="js">
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% END %]
</div>
[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
[% Asset.js("js/members-menu.js") %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
</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>
[% 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',
}));
});
</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 %]
[% 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() {
[% 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() {
-/* 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) {
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();
$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;
}
}
-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);
);
}
- 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(),
}
}
-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,
);
}
-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,
);
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);
}
$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(
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(
}
}
-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(
$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 );
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' ) {
# 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(
# 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);
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;
}
}
-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';
}
);
}
-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,
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,
);
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,