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 <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2008-07-08 09:28:55 -05:00 committed by Joshua Ferraro
parent 52c933c413
commit 1e2ff18e95
12 changed files with 112 additions and 19 deletions

View File

@ -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") ) {

View File

@ -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=<!-- TMPL_VAR NAME="borrowernumber" -->&catcode=<!-- TMPL_VAR NAME="catcode" -->&catcode_multi=<!-- TMPL_VAR NAME="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");
<!-- TMPL_IF NAME="CATCODE_MULTI" -->
window.open('/cgi-bin/koha/members/update-child.pl?op=multi&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
<!-- TMPL_ELSE -->
confirm_updatechild();
<!-- /TMPL_IF -->
}
// prepare DOM for YUI Toolbar
$(document).ready(function() {
@ -50,7 +67,8 @@ function confirm_reregistration() {
<!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->, disabled: true<!-- /TMPL_UNLESS-->
<!-- TMPL_ELSE --><!-- /TMPL_IF -->
<!-- TMPL_ELSE -->, disabled: true<!-- /TMPL_IF-->},
{ text: _("Delete"), <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->disabled: true, <!-- /TMPL_UNLESS --><!-- /TMPL_IF --> onclick: { fn: confirm_deletion } }
{ text: _("Delete"), <!-- TMPL_IF NAME="StaffMember" --><!-- TMPL_UNLESS NAME="CAN_user_staffaccess" -->disabled: true, <!-- /TMPL_UNLESS --><!-- /TMPL_IF --> onclick: { fn: confirm_deletion } },
{ text: _("Update Child to Adult Patron") , onclick: { fn: update_child }<!-- TMPL_UNLESS NAME="is_child" -->, disabled: true<!-- /TMPL_UNLESS -->}
];
new YAHOO.widget.Button({

View File

@ -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=<!-- TMPL_VAR NAME="borrowernumber" -->';
}
}
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=<!-- TMPL_VAR NAME="borrowernumber" -->';
}
}
function update_child() {
var borrowernumbervalue=document.form.borrowernumber.value;
<!-- TMPL_IF NAME="CATCODE_MULTI" -->
window.open('update-child.pl?op=multi&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->','UpdateChild','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
<!-- TMPL_ELSE -->

View File

@ -1,15 +1,25 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
<title>Koha &rsaquo; Choose Adult category</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<style type="text/css">
#custom-doc { width:29em;*width:28.3em;min-width:377px; margin:auto; text-align:left; }
</style>
</head>
<body>
<div id="doc" class="yui-t7">
<div id="custom-doc" class="yui-t7">
<div id="bd">
<!--TMPL_IF NAME="CONFIRM" -->
<script language="javascript" 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=<!-- TMPL_VAR NAME="borrowernumber" -->&catcode=<!-- TMPL_VAR NAME="catcode" -->&catcode_multi=<!-- TMPL_VAR NAME="CATCODE_MULTI" -->';
}
}
confirm_updatechild(<!-- TMPL_VAR NAME="borrowernumber" -->);
</script>
<!-- /TMPL_IF -->
@ -25,22 +35,24 @@ window.close();
<!--TMPL_IF NAME="MULTI" -->
<h1> Choose Adult category </h1>
<h3> Choose Adult category </h3>
<!--TMPL_IF NAME="CAT_LOOP" -->
<form method="post" action="update-child.pl">
<fieldset>
<table>
<tr>
<th> </th>
<th>CODE</th>
<th>DESC</th>
<th>&nbsp;</th>
<th>Code</th>
<th>Description</th>
</tr>
<!-- TMPL_LOOP NAME="CAT_LOOP" -->
<tr>
<td>
<input type="radio" id="catcode" name="catcode" value="<!-- TMPL_VAR NAME="catcode" -->" />
<input type="radio" id="catcode<!-- TMPL_VAR NAME="catcode" -->" name="catcode" value="<!-- TMPL_VAR NAME="catcode" -->" />
<td><!-- TMPL_VAR NAME="catcode" --></td>
<td><b><!-- TMPL_VAR NAME="catdesc" --></b></td>
<td><label for="catcode<!-- TMPL_VAR NAME="catcode" -->"><strong><!-- TMPL_VAR NAME="catdesc" --></strong></label></td>
</tr>
<!-- /TMPL_LOOP -->
</table>
@ -49,12 +61,12 @@ window.close();
<input type="hidden" name="catcode" value="<!-- TMPL_VAR NAME="catcode" -->" />
<input type="hidden" name="cattype" value="<!-- TMPL_VAR NAME="cattype" -->" />
<input type="hidden" name="catcode_multi" value="<!-- TMPL_VAR NAME="CATCODE_MULTI" -->" />
<input class="submit" type="submit" value="Submit"/>
<script language="javascript" type="text/javascript">
</script>
<fieldset class="action"><input class="submit" type="submit" value="Submit" /> <a href="#" class="cancel close">Cancel</a></fieldset>
<!--/TMPL_IF-->
</fieldset>
</form>
<!-- /TMPL_IF -->

View File

@ -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;

View File

@ -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;

View File

@ -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'});

View File

@ -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;

View File

@ -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;

View File

@ -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') } );

View File

@ -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;

View File

@ -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';