From 1e2ff18e95b149b3c2b9cccf14ba98aeb059fc88 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 8 Jul 2008 09:28:55 -0500 Subject: [PATCH] More changes to update-child process. Many scripts missing necessary data for checking how to process an update-child request. Also cleaning up update-child.tmpl for formatting. Minor text change (translation problem?) Signed-off-by: Joshua Ferraro --- circ/circulation.pl | 7 ++++ .../prog/en/includes/circ-toolbar.inc | 20 ++++++++++- .../prog/en/includes/members-toolbar.inc | 9 ++--- .../prog/en/modules/members/update-child.tmpl | 36 ++++++++++++------- members/boraccount.pl | 7 ++++ members/mancredit.pl | 8 +++++ members/maninvoice.pl | 7 ++++ members/member-flags.pl | 7 ++++ members/member-password.pl | 7 ++++ members/messaging.pl | 9 +++++ members/pay.pl | 7 ++++ members/readingrec.pl | 7 ++++ 12 files changed, 112 insertions(+), 19 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 9708d09c10..61babaad47 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -634,6 +634,13 @@ foreach $flag ( sort keys %$flags ) { my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0; my @temp = split( /\$/, $amountold ); + if ( $borrower->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + my $CGIorganisations; my $member_of_institution; if ( C4::Context->preference("memberofinstitution") ) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index 38a31339e4..ebd1f7613b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -12,6 +12,14 @@ function confirm_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=&catcode=&catcode_multi='; + } +} + function confirm_reregistration() { var is_confirmed = window.confirm('Are you sure you want to renew this patron\'s registration?'); var borrowernumbervalue1 = $("#borrowernumber").attr("value"); @@ -20,6 +28,15 @@ function confirm_reregistration() { } } +function update_child() { + var borrowernumbervalue= $("#borrowernumber").attr("value"); + + window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes'); + + confirm_updatechild(); + +} + // prepare DOM for YUI Toolbar $(document).ready(function() { @@ -50,7 +67,8 @@ function confirm_reregistration() { , disabled: true , disabled: true}, - { text: _("Delete"), disabled: true, onclick: { fn: confirm_deletion } } + { text: _("Delete"), disabled: true, onclick: { fn: confirm_deletion } }, + { text: _("Update Child to Adult Patron") , onclick: { fn: update_child }, disabled: true} ]; new YAHOO.widget.Button({ 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 2121ee0353..b4cbd03668 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -4,10 +4,8 @@ function confirm_deletion() { var is_confirmed = window.confirm('Are you sure you want to delete this patron? This cannot be undone.'); - var borrowernumbervalue=document.form.borrowernumber.value; - if (is_confirmed) { - window.location='/cgi-bin/koha/members/deletemem.pl?member='+borrowernumbervalue+''; + window.location='/cgi-bin/koha/members/deletemem.pl?member='; } } function confirm_updatechild() { @@ -20,13 +18,12 @@ function confirm_updatechild() { function confirm_reregistration() { var is_confirmed = window.confirm('Are you sure you want to renew this patron\'s registration?'); - var borrowernumbervalue1=document.form.borrowernumber.value; if (is_confirmed) { - window.location='/cgi-bin/koha/members/moremember.pl?reregistration=y&borrowernumber='+borrowernumbervalue1+''; + if (is_confirmed) { + window.location='/cgi-bin/koha/members/moremember.pl?reregistration=y&borrowernumber='; } } function update_child() { - var borrowernumbervalue=document.form.borrowernumber.value; window.open('update-child.pl?op=multi&borrowernumber=','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tmpl index 4367975fdd..5cc059a1fa 100755 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/update-child.tmpl @@ -1,15 +1,25 @@ Koha › Choose Adult category - + -
+
@@ -25,22 +35,24 @@ window.close(); -

Choose Adult category

+

Choose Adult category

+
+
- - - + + + - +
CODEDESC CodeDescription
-" /> +" name="catcode" value="" />
@@ -49,12 +61,12 @@ window.close(); " /> " /> " /> - - - +
Cancel
+
+ + diff --git a/members/boraccount.pl b/members/boraccount.pl index 1cfb5ef218..8d94adbfa6 100755 --- a/members/boraccount.pl +++ b/members/boraccount.pl @@ -46,6 +46,13 @@ my $borrowernumber=$input->param('borrowernumber'); #get borrower details my $data=GetMember($borrowernumber,'borrowernumber'); +if ( $data->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; +} + #get account details my ($total,$accts,$numaccts)=GetMemberAccountRecords($borrowernumber); my $totalcredit; diff --git a/members/mancredit.pl b/members/mancredit.pl index 4832455fc4..847e528227 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -53,6 +53,14 @@ if ($add){ flagsrequired => {borrowers => 1}, debug => 1, }); + + if ( $data->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' ); my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); $template->param( picture => 1 ) if $picture; diff --git a/members/maninvoice.pl b/members/maninvoice.pl index 17442354ed..6e3f22513b 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -71,6 +71,13 @@ if ($add){ flagsrequired => {borrowers => 1}, debug => 1, }); + + if ( $data->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); diff --git a/members/member-flags.pl b/members/member-flags.pl index 4f45033ee7..64de60a16c 100755 --- a/members/member-flags.pl +++ b/members/member-flags.pl @@ -153,6 +153,13 @@ if ($input->param('newflags')) { push @loop, \%row; } + if ( $bor->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); $template->param( picture => 1 ) if $picture; diff --git a/members/member-password.pl b/members/member-password.pl index 0ee5337cbc..e538711eb4 100755 --- a/members/member-password.pl +++ b/members/member-password.pl @@ -76,6 +76,13 @@ if ( $newpassword && ! $errormsg ) { $defaultnewpassword.=substr($chars, int(rand(length($chars))),1); } + if ( $bor->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); $template->param( picture => 1 ) if $picture; diff --git a/members/messaging.pl b/members/messaging.pl index b37a066de2..81821e5a8d 100755 --- a/members/messaging.pl +++ b/members/messaging.pl @@ -124,6 +124,15 @@ PREF: foreach my $option ( @$messaging_options ) { $option->{'digest'} = 'CHECKED' if $pref->{'wants_digest'}; } + if ( $borrower->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; + } + +my ($picture, $dberror) = GetPatronImage($borrower->{'cardnumber'}); +$template->param( picture => 1 ) if $picture; # get some recent messages sent to this borrower for display: my $message_queue = C4::Letters::GetQueuedMessages( { borrowernumber => $query->param('borrowernumber') } ); diff --git a/members/pay.pl b/members/pay.pl index e0de50a548..c968797a63 100755 --- a/members/pay.pl +++ b/members/pay.pl @@ -131,6 +131,13 @@ if ( $check == 0 ) { }; } +if ( $data->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; +} + $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); $template->param( picture => 1 ) if $picture; diff --git a/members/readingrec.pl b/members/readingrec.pl index 611078bc6a..2809129e21 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -77,6 +77,13 @@ for (my $i=0;$i<$count;$i++){ push(@loop_reading,\%line); } +if ( $data->{'category_type'} eq 'C') { + my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); + my $cnt = scalar(@$catcodes); + $template->param( 'CATCODE_MULTI' => 1) if $cnt > 1; + $template->param( 'catcode' => $catcodes->[0]) if $cnt == 1; +} + $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); if (! $limit){ $limit = 'full'; -- 2.39.5