Fix for bug 436, thanks to Pierre
authorrangi <rangi>
Thu, 16 Oct 2003 20:36:25 +0000 (20:36 +0000)
committerrangi <rangi>
Thu, 16 Oct 2003 20:36:25 +0000 (20:36 +0000)
circ/circulation.pl
koha-tmpl/intranet-tmpl/default/en/circ/circulation.tmpl

index 320dbf0..0a898a9 100755 (executable)
@@ -296,6 +296,7 @@ $template->param(
                author => $iteminformation->{'author'},
                firstname => $borrower->{'firstname'},
                surname => $borrower->{'surname'},
+               categorycode => $borrower->{'categorycode'},
                question => $question,
                barcode => $barcode,
                questionnumber => $questionnumber,
@@ -308,11 +309,8 @@ $template->param(
                message => $message,
                CGIselectborrower => $CGIselectborrower,
 
-               patrontable => $patrontable,
-               flaginfotable => $flaginfotable,
-               CHARGES => $flags->{'CHARGES'},
                amountold => $amountold,
-               todayissues => \@realtodayissues, 
+               todayissues => \@realtodayissues,
                previssues => \@realprevissues
        );
 
@@ -366,61 +364,74 @@ sub patrontable {
     my ($borrower) = @_;
     my $flags = $borrower->{'flags'};
     my $flaginfotable='';
-    my $flaginfotext='';
+    my $flaginfotext;
+    #my $flaginfotext='';
     my $flag;
     my $color='';
     foreach $flag (sort keys %$flags) {
+       warn $flag;
+       my @itemswaiting='';
        ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
        $flags->{$flag}->{'message'}=~s/\n/<br>/g;
        if ($flags->{$flag}->{'noissues'}) {
-           if ($flag eq 'CHARGES') {
-               $flaginfotext.="<tr><td valign=top><font color=red>$flag</font></td><td bgcolor=$color><b>$flags->{$flag}->{'message'}</b> <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
-           } else {
-               $flaginfotext.="<tr><td valign=top><font color=red>$flag</font></td><td bgcolor=$color>$flags->{$flag}->{'message'}</td></tr>\n";
-           }
+               $template->param(
+                       noissues => 'true',
+                       color => $color,
+                        );
+               if ($flag eq 'CHARGES') {
+                       $template->param(
+                               charges => 'true',
+                               chargesmsg => $flags->{'CHARGES'}->{'message'}
+                                );
+               }
        } else {
-           if ($flag eq 'CHARGES') {
-               $flaginfotext.="<tr><td valign=top>$flag</td><td> $flags->{$flag}->{'message'} <a href=/cgi-bin/koha/pay.pl?bornum=$borrower->{'borrowernumber'} onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>\n";
-           } elsif ($flag eq 'WAITING') {
-               my $itemswaiting='';
-               my $items=$flags->{$flag}->{'itemlist'};
-               foreach my $item (@$items) {
-                   my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-                   $itemswaiting.="<a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$iteminformation->{'barcode'}</a> $iteminformation->{'title'} ($branches->{$iteminformation->{'holdingbranch'}}->{'branchname'})<br>\n";
+                if ($flag eq 'CHARGES') {
+                       $template->param(
+                               charges => 'true',
+                               chargesmsg => $flags->{'CHARGES'}->{'message'}
+                        );
                }
-               $flaginfotext.="<tr><td valign=top>$flag</td><td>$itemswaiting</td></tr>\n";
-           } elsif ($flag eq 'ODUES') {
-               my $items=$flags->{$flag}->{'itemlist'};
-               my $itemswaiting="<table border=1 cellspacing=0 cellpadding=2>\n";
-               my $currentcolor=$color;
-               {
-                   my $color=$currentcolor;
-                   foreach my $item (@$items) {
-                       ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
+               if ($flag eq 'WAITING') {
+                       my $items=$flags->{$flag}->{'itemlist'};
+                       foreach my $item (@$items) {
                        my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
-                       $itemswaiting.="<tr><td><font color=red>$iteminformation->{'date_due'}</font></td><td bgcolor=$color><a href=/cgi-bin/koha/detail.pl?bib=$iteminformation->{'biblionumber'}&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\">$iteminformation->{'barcode'}</a></td><td>$iteminformation->{'title'}</td></tr>\n";
-                   }
+                       $iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
+                       push @itemswaiting, $iteminformation;
+                       }
+                       $template->param(
+                               waiting => 'true',
+                               waitingmsg => $flags->{'WAITING'}->{'message'},
+                               itemswaiting => \@itemswaiting,
+                                );
                }
-               $itemswaiting.="</table>\n";
-               if ($query->param('module') ne 'returns'){
-                 $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}, See below</td></tr>\n";
-               } else {
-                 $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}</td></tr>\n";
+               if ($flag eq 'ODUES') {
+                       $template->param(
+                               odues => 'true',
+                               oduesmsg => $flags->{'ODUES'}->{'message'}
+                                );
+
+                       my $items=$flags->{$flag}->{'itemlist'};
+                       my $currentcolor=$color;
+                       {
+                       my $color=$currentcolor;
+                       foreach my $item (@$items) {
+                               ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
+                               my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
+                               push @itemswaiting, $iteminformation;
+                       }
+                       }
+                       if ($query->param('module') ne 'returns'){
+                               $template->param( nonreturns => 'true' );
+                       }
+               }
+               if ($flag eq 'NOTES') {
+                       $template->param(
+                               notes => 'true',
+                               notesmsg => $flags->{'NOTES'}->{'message'}
+                                );
                }
-           } else {
-               $flaginfotext.="<tr><td valign=top>$flag</td><td>$flags->{$flag}->{'message'}</td></tr>\n";
-           }
        }
     }
-    ($flaginfotext) && ($flaginfotext="<tr><td  colspan=2><b>Flags</b></td></tr>$flaginfotext\n");
-    $flaginfotext.="</table>";
-    my $patrontable= << "EOF";
-<br><p>
-    <table border=1 cellpadding=5 cellspacing=0 align=right>
-    <tr><td colspan=2><font color=black><b>Patron Information</b></font></td></tr>
-    <tr><td colspan=2>
-    <a href=/cgi-bin/koha/moremember.pl?bornum=$borrower->{'borrowernumber'} onClick="openWindow(this,'Member', 480, 640)">$borrower->{'cardnumber'}</a> $borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'}<br>$borrower->{'streetaddress'} $borrower->{'city'} Cat: $borrower->{'categorycode'} </td></tr>
-EOF
     return($patrontable, $flaginfotext);
 }
 
index fbaa562..170a765 100644 (file)
      </TMPL_IF>
 </TMPL_IF>
 <TMPL_IF name="borrowernumber">
-        
-       <TMPL_VAR name="patrontable">
-       <TMPL_VAR name="flaginfotable">
-</TMPL_IF>
-
-<TMPL_IF name="borrowernumber">
+<table border="1" width="100%">
+<tr>
+<td>
 <form method=post action=/cgi-bin/koha/circ/circulation.pl>
 <table border=1 cellpadding=5>
        <tr>
        </tr>
 </table>
 </form>
+</td>
+<td>
+<table border=1 cellpadding=5 cellspacing=0 align=right>
+    <tr><td colspan=2><font color=black><b>Patron information</b></font></td></tr>
+    <tr><td colspan=2>
+    <a href="/cgi-bin/koha/moremember.pl?bornum=<TMPL_VAR name="borrowernumber">" onClick="openWindow(this,'Member', 480, 640)">
+               <TMPL_VAR name="firstname"> <TMPL_VAR name="surname">
+    </a> <br> Catégorie: <TMPL_VAR name="categorycode">
+    </td></tr>
+<TMPL_IF name="noissues">
+       <TMPL_IF name="charges">
+               <tr><td valign=top><font color=red>CHARGES</font></td><td bgcolor=<TMPL_VAR name=color>><a href=/cgi-bin/koha/pay.pl?bornum=<TMPL_VAR name="borrowernumber"> onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>
+       <TMPL_ELSE>
+               <tr><td valign=top><font color=red><TMPL_VAR name="flag"></font></td><td bgcolor=<TMPL_VAR name="color"><TMPL_VAR name="message"></td></tr>
+       </TMPL_IF>
+<TMPL_ELSE>
+               <TMPL_IF name="charges">
+                       <tr><td valign=top>CHARGES</td><td><a href=/cgi-bin/koha/pay.pl?bornum=<TMPL_VAR name="borrowernumber"> onClick=\"openWindow(this, 'Payment', 480,640)\">Payment</a></td></tr>
+               </TMPL_IF>
+               <TMPL_IF name="waiting">
+                       <tr>
+                       <td valign=top>WAITING</td>
+                       <td>
+                       <TMPL_LOOP name="itemswaiting">
+                               <a href=/cgi-bin/koha/detail.pl?bib=<TMPL_VAR name="biblionumber">&type=intra onClick=\"openWindow(this, 'Item', 480, 640)\"><TMPL_VAR name="barcode">}</a><TMPL_VAR name="title"> (<TMPL_VAR name="branchname">)<br>
+                       </TMPL_LOOP>
+                       </td>
+                       </tr>
+               </TMPL_IF>
+                       <TMPL_IF name="odues">
+                               <TMPL_IF name="nonreturns">
+                                       <tr><td valign=top>ODUES</td><td>Yes, See below</td></tr>
+                               </TMPL_IF>
+                       </TMPL_IF>
+                       <TMPL_IF name="notes">
+                                       <tr><td valign=top>NOTES</td><td><TMPL_VAR name="notesmsg"></td></tr>
+                       </TMPL_IF>
 </TMPL_IF>
+</table>
+</TMPL_IF>
+</table>
 <p clear=all><br><br>
 <TMPL_IF name="todayissues">
 <table border=1 cellpadding=5 cellspacing=0 width=80%>