Merge remote-tracking branch 'kc/new/enh/bug_6716' into kcmaster
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 13 Sep 2011 02:34:01 +0000 (14:34 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 13 Sep 2011 02:34:01 +0000 (14:34 +1200)
34 files changed:
C4/Accounts.pm
debian/scripts/koha-upgrade-to-3.4
docs/history.txt
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/about.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketgroup.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt
koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt
koha-tmpl/intranet-tmpl/prog/en/modules/help/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/reports/borrowers_stats.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/catalogue_out.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/dictionary.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt
koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serial-issues-full.tt
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt
koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt
koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt
koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc
koha-tmpl/opac-tmpl/prog/en/includes/doc-head-open.inc
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tt
members/pay.pl
members/paycollect.pl [new file with mode: 0755]

index eea142c..2352e9e 100644 (file)
@@ -38,7 +38,9 @@ BEGIN {
                &getnextacctno &reconcileaccount &getcharges &ModNote &getcredits
                &getrefunds &chargelostitem
                &ReversePayment
-       ); # removed &fixaccounts
+        makepartialpayment
+        recordpayment_selectaccts
+       );
 }
 
 =head1 NAME
@@ -369,7 +371,6 @@ sub manualinvoice {
     my $dbh      = C4::Context->dbh;
     my $notifyid = 0;
     my $insert;
-    $itemnum =~ s/ //g;
     my $accountno  = getnextacctno($borrowernumber);
     my $amountleft = $amount;
 
@@ -413,12 +414,12 @@ sub manualinvoice {
         $notifyid = 1;
     }
 
-    if ( $itemnum ne '' ) {
-        $desc .= " " . $itemnum;
+    if ( $itemnum ) {
+        $desc .= ' ' . $itemnum;
         my $sth = $dbh->prepare(
-            "INSERT INTO  accountlines
+            'INSERT INTO  accountlines
                         (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, itemnumber,notify_id, note, manager_id)
-        VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)");
+        VALUES (?, ?, now(), ?,?, ?,?,?,?,?,?)');
      $sth->execute($borrowernumber, $accountno, $amount, $desc, $type, $amountleft, $itemnum,$notifyid, $note, $manager_id) || return $sth->errstr;
   } else {
     my $sth=$dbh->prepare("INSERT INTO  accountlines
@@ -686,6 +687,106 @@ sub ReversePayment {
   }
 }
 
+=head2 recordpayment_selectaccts
+
+  recordpayment_selectaccts($borrowernumber, $payment,$accts);
+
+Record payment by a patron. C<$borrowernumber> is the patron's
+borrower number. C<$payment> is a floating-point number, giving the
+amount that was paid. C<$accts> is an array ref to a list of
+accountnos which the payment can be recorded against
+
+Amounts owed are paid off oldest first. That is, if the patron has a
+$1 fine from Feb. 1, another $1 fine from Mar. 1, and makes a payment
+of $1.50, then the oldest fine will be paid off in full, and $0.50
+will be credited to the next one.
+
+=cut
+
+sub recordpayment_selectaccts {
+    my ( $borrowernumber, $amount, $accts ) = @_;
+
+    my $dbh        = C4::Context->dbh;
+    my $newamtos   = 0;
+    my $accdata    = q{};
+    my $branch     = C4::Context->userenv->{branch};
+    my $amountleft = $amount;
+    my $sql = 'SELECT * FROM accountlines WHERE (borrowernumber = ?) ' .
+    'AND (amountoutstanding<>0) ';
+    if (@{$accts} ) {
+        $sql .= ' AND accountno IN ( ' .  join ',', @{$accts};
+        $sql .= ' ) ';
+    }
+    $sql .= ' ORDER BY date';
+    # begin transaction
+    my $nextaccntno = getnextacctno($borrowernumber);
+
+    # get lines with outstanding amounts to offset
+    my $rows = $dbh->selectall_arrayref($sql, { Slice => {} }, $borrowernumber);
+
+    # offset transactions
+    my $sth     = $dbh->prepare('UPDATE accountlines SET amountoutstanding= ? ' .
+        'WHERE (borrowernumber = ?) AND (accountno=?)');
+    for my $accdata ( @{$rows} ) {
+        if ($amountleft == 0) {
+            last;
+        }
+        if ( $accdata->{amountoutstanding} < $amountleft ) {
+            $newamtos = 0;
+            $amountleft -= $accdata->{amountoutstanding};
+        }
+        else {
+            $newamtos   = $accdata->{amountoutstanding} - $amountleft;
+            $amountleft = 0;
+        }
+        my $thisacct = $accdata->{accountno};
+        $sth->execute( $newamtos, $borrowernumber, $thisacct );
+    }
+
+    # create new line
+    $sql = 'INSERT INTO accountlines ' .
+    '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding) ' .
+    q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?)|;
+    $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft );
+    UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno );
+    return;
+}
+
+# makepayment needs to be fixed to handle partials till then this separate subroutine
+# fills in
+sub makepartialpayment {
+    my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
+    if (!$amount || $amount < 0) {
+        return;
+    }
+    my $dbh = C4::Context->dbh;
+
+    my $nextaccntno = getnextacctno($borrowernumber);
+    my $newamtos    = 0;
+
+    my $data = $dbh->selectrow_hashref(
+        'SELECT * FROM accountlines WHERE  borrowernumber=? AND accountno=?',undef,$borrowernumber,$accountno);
+    my $new_outstanding = $data->{amountoutstanding} - $amount;
+
+    my $update = 'UPDATE  accountlines SET amountoutstanding = ?  WHERE   borrowernumber = ? '
+    . ' AND   accountno = ?';
+    $dbh->do( $update, undef, $new_outstanding, $borrowernumber, $accountno);
+
+    # create new line
+    my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, '
+    .  'description, accounttype, amountoutstanding) '
+    . ' VALUES (?, ?, now(), ?, ?, ?, 0)';
+
+    $dbh->do(  $insert, undef, $borrowernumber, $nextaccntno, $amount,
+        "Payment, thanks - $user", 'Pay');
+
+    UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno );
+
+    return;
+}
+
+
+
 END { }    # module clean-up code here (global destructor)
 
 1;
index 45650c1..190d841 100755 (executable)
@@ -37,7 +37,7 @@ Koha will be upgraded for the following instances: $TO_UPGRADE
 This may take some time to run. Go make a coffee.
 EOH
 
-for name in "$TO_UPGRADE"
+for name in $TO_UPGRADE
 do
     echo "Upgrading $name..."
     sudo -u "$name-koha" -H \
index 3fc061a..849fcf7 100644 (file)
@@ -571,4 +571,5 @@ August 26 2011  Ward van Wanrooij becomes the 150th developer to have a patch pu
 August 27 2011  Ulrich Kleiber becomes the 151st developer to have a patch pushed
 September 1 2011 Maxime Pelletier becomes the 152nd developer to have a patch pushed
 September 2 2011 Steven Callender becomes the 153rd developer to have a patch pushed
-September 6 2011 Brett Wilkins becomes the 154th developer to have a patch pushed
\ No newline at end of file
+September 6 2011 Brett Wilkins becomes the 154th developer to have a patch pushed
+September 11 2011 Meenakshi.R becomes the 155th developer to have a patch pushed
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt
new file mode 100644 (file)
index 0000000..39be1be
--- /dev/null
@@ -0,0 +1,73 @@
+[%# duplicates circ-menu.inc but assumes all borrower attributes are in a borrower variable rather than
+in the global namespace %]
+[% IF borrower %]
+<div class="patroninfo"><h5>[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])</h5>
+<!--[if IE 6]>
+<style type="tex/css">img { width: expression(this.width > 140 ? 140: true);
+}</style>
+<![endif]-->
+<ul>
+[% IF ( patronimages ) %]
+[% IF borrower.has_picture %]
+<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=[% borrower.cardnumber %]" id="patronimage" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="max-width : 140px; margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC; width:auto !important; width:130px;" /></li>
+[% ELSE %]
+<li><img src="/intranet-tmpl/prog/img/patron-blank.png" alt="[% borrower.firstname %] [% borrower.surname %] ([% borrower.cardnumber %])" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
+[% END %]
+[% END %]
+    <li>[% IF borrower.address %]
+            [% borrower.address %]
+    [% ELSE %]
+            <span class="empty">No address stored.</span>
+    [% END %]</li>
+    [% IF borrower.address2 %]
+        <li>[% borrower.address2 %]</li>
+    [% END %]<li>
+    [% IF borrower.city %]
+            [% borrower.city %][% IF borrower.state %], [% borrower.state %][% END %]
+           [% borrower.zipcode %][% IF ( borrower.country ) %], [% borrower.country %][% END %]
+    [% ELSE %]
+        <span class="empty">No city stored.</span>
+    [% END %]</li>
+    <li>[% IF borrower.phone %]
+        [% borrower.phone %]
+    [% ELSE %]
+        [% IF borrower.mobile %]
+            [% borrower.mobile %]
+        [% ELSE %]
+            [% IF borrower.phonepro %]
+                [% borrower.phonepro %]
+            [% ELSE %]
+                <span class="empty">No phone stored.</span>
+            [% END %]
+        [% END %]
+    [% END %]</li>
+    [% IF borrower.email %]
+        <li class="email"> <a href="mailto:[% borrower.email %]" title="[% borrower.email %]">[% borrower.email %]</a></li>
+    [% ELSE %]
+        [% IF borrower.emailpro %]
+            <li class="email"> <a href="mailto:[% borrower.emailpro %]" title="[% borrower.emailpro %]">[% borrower.emailpro %]</a></li>
+        [% ELSE %]
+            <li> <span class="empty">No email stored.</span>    </li>
+        [% END %]
+    [% END %]
+    <li>Category: [% borrower.description %] ([% borrower.categorycode %])</li>
+    <li>Home Library: [% IF ( borrower.branchname ) %][% borrower.branchname %][% ELSE %][% borrower.branch %][% END %]</li>
+</ul></div>
+<div id="menu">
+<ul>
+       [% IF ( circview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrower.borrowernumber %]">Check Out</a></li>
+       [% IF ( CAN_user_borrowers ) %]
+       [% IF ( detailview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrower.borrowernumber %]">Details</a></li>
+       [% END %]
+        [% IF ( CAN_user_updatecharges ) %]
+       [% IF ( finesview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Fines</a></li>
+       [% END %]
+       [% IF ( intranetreadinghistory ) %][% IF ( readingrecordview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/readingrec.pl?borrowernumber=[% borrower.borrowernumber %]">Circulation History</a></li>[% END %]
+       [% IF ( CAN_user_parameters ) %][% IF ( logview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/tools/viewlog.pl?do_it=1&amp;modules=MEMBERS&amp;modules=circulation&amp;object=[% borrower.borrowernumber %]&amp;src=circ">Modification Log</a></li>[% END %]
+    [% IF ( EnhancedMessagingPreferences ) %]
+    [% IF ( messagingview ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/messaging.pl?borrowernumber=[% borrower.borrowernumber %]">Messaging</a></li>
+    [% END %]
+    [% IF ( sentnotices ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/notices.pl?borrowernumber=[% borrower.borrowernumber %]">Notices</a></li>
+</ul></div>
+[% END %]
+
index 320432d..b8593e3 100644 (file)
                <li>Julian Maurice</li>
                 <li>Brig C. McCoy</li>
                 <li>Dorian Meid (German translation)</li>
+               <li>Meenakshi. R</li>
                 <li>Matthias Meusburger</li>
                <li>Sophie Meynieux</li>
                 <li>Alan Millar</li>
index ba12d7b..98eb90a 100644 (file)
@@ -222,14 +222,16 @@ function submitForm(form) {
                                                <h3><label for="billingplace">Billing Place:</label></h3>
                                                <select name="billingplace" id="billingplace">
                                                        [% FOREACH billingplaceloo IN billingplaceloop %]
-                                                       <option value="[% billingplaceloo.value %]" [% IF ( billingplaceloo.selected ) %]selected[% END %]>[% billingplaceloo.branchname %]</option>
+                                [% IF ( billingplaceloo.selected ) %]<option value="[% billingplaceloo.value %]" selected="selected">[% billingplaceloo.branchname %]</option>
+                                [% ELSE %]<option value="[% billingplaceloo.value %]">[% billingplaceloo.branchname %]</option>[% END%]
                                                        [% END %]
                                                </select>
                                                <h3><label for="deliveryplace">Delivery Place:</label></h3>
                                                <select name="deliveryplace" id="deliveryplace">
                                                        <option value="">--</option>
                                                        [% FOREACH deliveryplaceloo IN deliveryplaceloop %]
-                                                       <option value="[% deliveryplaceloo.value %]" [% IF ( deliveryplaceloo.selected ) %]selected[% END %]>[% deliveryplaceloo.branchname %]</option>
+                                [% IF ( deliveryplaceloo.selected ) %]<option value="[% deliveryplaceloo.value %]" selected="selected">[% deliveryplaceloo.branchname %]</option>
+                                [% ELSE %]<option value="[% deliveryplaceloo.value %]">[% deliveryplaceloo.branchname %]</option>[% END %]
                                                        [% END %]
                                                </select>
                         <p>or</p>
@@ -272,8 +274,10 @@ function submitForm(form) {
        <div class="yui-g"> 
                <div id="bgtabs" class="yui-navset">
                    <ul class="yui-nav">
-                       <li[% UNLESS ( closed ) %] class="selected"[% END %]><a href="#opened"><em>Opened</em></a></li>
-                       <li[% IF ( closed ) %] class="selected"[% END %]><a href="#closed"><em>Closed</em></a></li>
+                [% UNLESS ( closed ) %]<li class="selected"><a href="#opened"><em>Opened</em></a></li>
+                [% ELSE%]<li><a href="#opened"><em>Opened</em></a></li>[% END %]
+                [% IF ( closed ) %]<li class="selected"><a href="#closed"><em>Closed</em></a></li>
+                [% ELSE %]<li><a href="#closed"><em>Closed</em></a></li>[% END %]
                    </ul>            
                    <div class="yui-content">
                        <div id="opened">
index 5af5862..1e64e1f 100644 (file)
@@ -38,7 +38,8 @@
             <th>&nbsp;</th>
         </tr>
     [% FOREACH lateorder IN lateorders %]
-        <tr[% UNLESS ( loop.odd ) %] class="highlight"[% END %]> 
+        [% UNLESS ( loop.odd ) %]<tr class="highlight">
+        [% ELSE %]<tr>[% END %]
             <td>
                 [% lateorder.orderdate %]
                 ([% lateorder.latesince %] days)
                <select id="supplierid" size="1" tabindex="" name="supplierid">
                        <option value=""/>
                        [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
-                       <option value="[% SUPPLIER_LOO.id %]"[% IF ( SUPPLIER_LOO.selected ) %] selected="selected"[% END %]>[% SUPPLIER_LOO.name %]</option>
+                [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id %]" selected="selected">[% SUPPLIER_LOO.name %]</option>
+                [% ELSE %]<option value="[% SUPPLIER_LOO.id %]">[% SUPPLIER_LOO.name %]</option>[% END %]
                [% END %]
                </select>
 </ol>
index 13a411c..001bf0d 100644 (file)
@@ -89,18 +89,16 @@ if (f.company.value == "") {
             <li><label for="list_currency">List prices are</label>
                     <select name="list_currency" id="list_currency">
                     [% FOREACH loop_currenc IN loop_currency %]
-                        <option value="[% loop_currenc.currency %]"
-                            [% IF ( loop_currenc.listprice ) %]selected="1"[% END %]>
-                            [% loop_currenc.currency %]</option>
+                        [% IF ( loop_currenc.listprice ) %]<option value="[% loop_currenc.currency %]" selected="1">[% loop_currenc.currency %]</option>
+                        [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
                     [% END %]
                     </select>
             </li>
             <li><label for="invoice_currency">Invoice prices are</label>
                     <select name="invoice_currency" id="invoice_currency">
                     [% FOREACH loop_currenc IN loop_currency %]
-                        <option value="[% loop_currenc.currency %]"
-                            [% IF ( loop_currenc.invoiceprice ) %]selected="1"[% END %]>
-                            [% loop_currenc.currency %]</option>
+                        [% IF ( loop_currenc.invoiceprice ) %]<option value="[% loop_currenc.currency %]" selected="1">[% loop_currenc.currency %]</option>
+                        [% ELSE %]<option value="[% loop_currenc.currency %]">[% loop_currenc.currency %]</option>[% END %]
                     [% END %]
                     </select>
             </li>
index 69fb69c..5009bff 100644 (file)
@@ -674,8 +674,8 @@ function searchauthority() {
                 <div name="line" class="subfield_line" style="[% subfield_loo.visibility %];" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %]">
                 
                     [% UNLESS ( subfield_loo.advancedMARCEditor ) %]
-                    <label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
-                            [% IF ( subfield_loo.fixedfield ) %] style="display:none;" [% END %] class="labelsubfield" >
+                        [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield" >
+                        [% ELSE %] <label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield" >[% END %]
                     [% END %] 
                     
                     [% UNLESS ( subfield_loo.hide_marc ) %]
index e1f84b8..7a1039d 100644 (file)
@@ -318,18 +318,28 @@ YAHOO.util.Event.onContentReady("searchheader", function () {
                         <label for="scan-index">Indexed in:</label>
                         <select name="idx" id="scan-index">
                             <option value="">Any Word</option>
-                            <option [% IF (ms_anycommaphr) %] selected="selected" [% END %] value="any,phr">Any Phrase</option>
-                            <option [% IF ( ms_ti ) %] selected="selected" [% END %] value="ti">Title</option>
-                            <option [% IF (ms_ticommaphr) %] selected="selected" [% END %] value="ti,phr">Title Phrase</option>
-                            <option [% IF (ms_aucommaphr) %] selected="selected" [% END %] value="au,phr">Author</option>
-                            <option [% IF ( ms_su ) %] selected="selected" [% END %] value="su">Subject</option>
-                            <option [% IF (ms_sucommaphr) %] selected="selected" [% END %] value="su,phr">Subject Phrase</option>
-                            <option [% IF ( ms_se ) %] selected="selected" [% END %] value="se">Series</option>
-                            <option [% IF ( ms_pb ) %] selected="selected" [% END %] value="pb">Publisher</option>
-                            <option [% IF ( ms_nt ) %] selected="selected" [% END %] value="nt">Notes</option>
-                            <option [% IF ( ms_se ) %] selected="selected" [% END %] value="se">Series Title</option>
-                            <option [% IF ( ms_sn ) %] selected="selected" [% END %] value="sn">ISBN</option>
-                            <option [% IF ( ms_ss ) %] selected="selected" [% END %] value="ss">ISSN</option>
+                            [% IF ( ms_anycommaphr) %]<option selected="selected" value="any,phr">Any Phrase</option>
+                            [% ELSE %]<option value="any,phr">Any Phrase</option>[% END %]
+                            [% IF ( ms_ti ) %]<option selected="selected" value="ti">Title</option>
+                            [% ELSE %]<option value="ti">Title</option>[% END %]
+                            [% IF ( ms_ticommaphr ) %]<option selected="selected" value="ti,phr">Title Phrase</option>
+                            [% ELSE %]<option value="ti,phr">Title Phrase</option>[% END %]
+                            [% IF ( ms_aucommaphr ) %]<option selected="selected" value="au,phr">Author</option>
+                            [% ELSE %]<option value"au,phr">Author</option>[% END %]
+                            [% IF ( ms_su ) %]<option selected="selected" value="su">Subject</option>
+                            [% ELSE %]<option value="su">Subject</option>[% END %]
+                            [% IF ( ms_sucommaphr ) %]<option selected="selected" value="su,phr">Subject Phrase</option>
+                            [% ELSE %]<option value="su,phr">Subject Phrase</option>[% END %]
+                            [% IF ( ms_se ) %]<option selected="selected" value="se">Series</option>
+                            [% ELSE %]<option value="su">Series</option>[% END %]
+                            [% IF ( ms_pb ) %]<option selected="selected" value="pb">Publisher</option>
+                            [% ELSE %]<option value="pb">Publisher</option>[% END %]
+                            [% IF ( ms_nt ) %]<option selected="selected" value="nt">Notes</option>
+                            [% ELSE %]<option value="nt">Notes</option>[% END %]
+                            [% IF ( ms_sn ) %]<option selected="selected" value="sn">ISBN</option>
+                            [% ELSE %]<option value="sn">ISBN</option>[% END %]
+                            [% IF ( ms_ss ) %]<option selected="selected" value="ss">ISSN</option>
+                            [% ELSE %]<option value="ss">ISSN</option>[% END %]
                         </select>
                         <input type="hidden" name="scan" value="1" />
                     </td>
index 37e6212..a69a1f4 100644 (file)
@@ -858,6 +858,8 @@ function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
             
                 [% UNLESS advancedMARCEditor %]
                     <label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" [% IF ( subfield_loo.fixedfield ) %] style="display:none;" [% END %] class="labelsubfield">
+                    [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield">
+                    [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">[% END %]
                 [% END %] 
                 
                 [% UNLESS hide_marc %]
index 750498e..a57da61 100644 (file)
                 <td> <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.id %]" title="MARC" rel="gb_page_center[600,500]">Card</a>
                                </td>
                 <td>
-                       <a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]" [% UNLESS ( CAN_user_editcatalogue_edit_catalogue ) %] class="disabled" onclick="return false;"[% END %]>Add biblio</a>
+                    [% UNLESS ( CAN_user_editcatalogue_edit_catalogue ) %]<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]" class="disabled" onclick="return false;">Add biblio</a>
+                    [% ELSE %]<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id %]">Add biblio</a>[% END %]
                 </td>
             </tr>
             [% END %]
index a04e75c..00296dd 100644 (file)
                                [% FOREACH resul IN result %]
                                [% IF ( resul.title ) %]
                                <tr>
-                                    <td[% IF ( resul.even ) %] class="hilighted"[% END %]>
+                                    [% IF ( resul.even ) %]<td class="hilighted">
+                                    [% ELSE %]<td>[% END %]
                                                             [% IF ( resul.MARC_ON ) %]
                                                                     <a_class="transparent resultlist" href="/cgi-bin/koha/MARCdetail.pl?biblionumber=[% resul.biblionumber |url %]">[% resul.title |html %]</a>
                                                             [% ELSE %]
                                                     [% IF ( resul.size ) %] ; [% resul.size %][% END %]
                                             </p>
                                        </td>
-                                       <td align="center" [% IF ( resul.even ) %] class="hilighted"[% END %]>
+                    [% IF ( resul.even ) %]<td align="center" class="hilighted">
+                    [% ELSE %]<td align="center">[% END %]
                                                [% resul.totitem %]
                                        </td>
-                                       <td [% IF ( resul.even ) %]class="hilighted"[% END %]>
+                    [% IF ( resul.even ) %]<td class="hilighted">
+                    [% ELSE %]<td>[% END %]
                                                [% resul.CN %]
                                        </td>
                                        <td>
index 2f5ed82..3e8dfba 100644 (file)
     <li><label>Patron flags:</label>
         <select name="borflag" size="1" id="borflag">
             <option value="">None</option>
-            <option value="gonenoaddress"[% IF ( borflag_gonenoaddress ) %] selected="selected"[% END %]>Address in question</option>
-            <option value="debarred"[% IF ( borflag_debarred ) %] selected="selected"[% END %]>Restricted</option>
-            <option value="lost"[% IF ( borflag_lost ) %] selected="selected"[% END %]>Lost Card</option>
+            [% IF ( borflag_gonenoaddress ) %]<option value="gonenoaddress" selected="selected">Address in question</option>
+            [% ELSE %]<option value="gonenoaddress">Address in question</option>[% END %]
+            [% IF ( borflag_debarred ) %]<option value="debarred" selected="selected">Restricted</option>
+            [% ELSE %]<option value="debarred">Restricted</option>[% END %]
+            [% IF ( borflag_lost ) %]<option value="lost" selected="selected">Lost Card</option>
+            [% ELSE %]<option value="lost">Lost Card</option>[% END %]
         </select>
     </li>
        [% FOREACH patron_attr_filter_loo IN patron_attr_filter_loop %]
     </option>
 [% END %]
        [% FOREACH patron_attr_order_loo IN patron_attr_order_loop %]
-           <option value="[% patron_attr_order_loo.value |html %]"[% IF ( patron_attr_order_loo.selected ) %] selected="selected"[% END %]>[% patron_attr_order_loo.label %]</option>
+        [% IF ( patron_attr_order_loo.selected ) %]<option value="[% patron_attr_order_loo.value |html %]" selected="selected">[% patron_attr_order_loo.label %]</option>
+        [% ELSE %]<option value="[% patron_attr_order_loo.value |html %]">[% patron_attr_order_loo.label %]</option>[% END %]
        [% END %]
 </select></li>
 
index f8eabfa..e0dbfd0 100644 (file)
@@ -1,18 +1,51 @@
 [% INCLUDE 'help-top.inc' %]
 
-<h1>Pay/Reverse Fines</h1>
+<h1>Pay and Writeoff Fines</h1>
 
-<p>Each line item can be paid in full (or written off) using the 'Pay Fines' tab.</p>
+<p>Each line item can be paid in full, partially paid, or written off.</p>
 
+<h4>Pay a fine in full</h4>
 <ul>
-       <li>Choose the payment type (Unpaid, Paid, Writeoff) from the pull down menu</li>
-       <li>Click 'Make Payment'</li>
-       <li>A line item will be added to the account information showing the fee paid in full (or written off)</li>
-       <li>If you accidentally mark and item as paid, you can reverse that line item by clicking 'Reverse' to the right of the line
+       <li>Click "Pay" next to the fine you want to pay in full</li>
+       <li>The full amount of the fine will be populated for you in the "Collect From Patron" box</li>
+       <li>Click "Confirm" </li>
+       <li>The fine will be removed from outstanding fines, and displayed as fully paid.</li>
+</ul>
+
+<h4>Pay a partial fine</h4>
+<ul>
+       <li>Click "Pay" next to the fine you want to partially pay</li>
+       <li>Enter the amount you are collecting from the patron in the "Collect From Patron" box</li>
+       <li>Click "Confirm" </li>
+       <li>The fine will be updated to show the original Amount, and the current Amount Outstanding</li>
+</ul>
+
+<h4>Writeoff a single fine</h4>
+<ul>
+       <li>Click "Writeoff" next to the fine you wish to writeoff.</li>
+       <li>The fine will be removed from outstanding fines, and displayed as fully paid.</li>
+</ul>
+
+<h4>Pay an amount towards all fines</h4>
 <ul>
-       <li>Once clicked a new line item will be added to the account, showing the payment as reversed</li>
+       <li>Click the "Pay Amount" button</li>
+       <li>Enter the amount you are collecting from the patron in "Collect from Patron." The sum of all fines is shown in "Total Amount Outstanding"</li>
+       <li>Click "Confirm"</li>
+       <li>The fine totals will be updated with the payment applied to oldest fines first.</li>
 </ul>
-</li>
+
+<h4>Writeoff All fines</h4>
+<ul>
+        <li>Click the "Writeoff All" button</li>
+        <li>All fines will be removed from outstanding fines, and displayed as written off.</li>
+</ul> 
+
+<h4>Pay Selected fines</h4>
+<ul>
+       <li>Check the selection boxes next to the fines you wish to pay, click "Pay Selected"</li>
+       <li>Enter an amount to pay towards the fines.</li>
+       <li>Click "Confirm"</li>
+       <li>The fine totals will be updated with the payment applied to the oldest selected fines first.</li>
 </ul>
 
-[% INCLUDE 'help-bottom.inc' %]
\ No newline at end of file
+[% INCLUDE 'help-bottom.inc' %]
index ddc3d41..6dfd8f9 100644 (file)
@@ -1,12 +1,12 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% firstname %] [% surname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% firstname %] [% surname %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% borrower.firstname %] [% borrower.surname %]</div>
 
 <div id="doc3" class="yui-t2">
    
 <!-- The manual invoice and credit buttons -->
 <div class="toptabs">
 <ul class="ui-tabs-nav">
-       <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Account</a></li>
-       <li class="ui-tabs-selected"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a></li>
-       <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrowernumber %]" >Create Manual Invoice</a></li>
-       <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrowernumber %]" >Create Manual Credit</a></li>
+       <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
+       <li class="ui-tabs-selected"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
+       <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Invoice</a></li>
+       <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Credit</a></li>
 </ul>
 <div class="tabs-container">
 
-[% IF ( allfile ) %]<form action="/cgi-bin/koha/members/pay.pl" method="post">
-       <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
+[% IF ( accounts ) %]
+    <form action="/cgi-bin/koha/members/pay.pl" method="post">
+       <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
 
 <table>
 <tr>
        <th>Fines &amp; Charges</th>
+    <th>Sel</th>
        <th>Description</th>
-    <th>Note</th>
        <th>Account Type</th>
        <th>Notify id</th>
        <th>Level</th>
        <th>Amount</th>
        <th>Amount Outstanding</th>
 </tr>
-       
-[% FOREACH allfil IN allfile %]
-       [% FOREACH loop_pa IN allfil.loop_pay %]
+
+[% FOREACH account_grp IN accounts %]
+    [% FOREACH line IN account_grp.accountlines %]
 <tr>
-       <td>
-       [% IF ( loop_pa.net_balance ) %]
-       <select name="payfine[% loop_pa.i %]">
-       <option value="no">Unpaid</option>
-       <option value="yes">Paid</option>
-       <option value="wo">Writeoff</option>
-       </select>
-       [% END %]
-       <input type="hidden" name="itemnumber[% loop_pa.i %]" value="[% loop_pa.itemnumber %]" />
-       <input type="hidden" name="accounttype[% loop_pa.i %]" value="[% loop_pa.accounttype %]" />
-       <input type="hidden" name="amount[% loop_pa.i %]" value="[% loop_pa.amount %]" />
-       <input type="hidden" name="out[% loop_pa.i %]" value="[% loop_pa.amountoutstanding %]" />
-       <input type="hidden" name="borrowernumber[% loop_pa.i %]" value="[% loop_pa.borrowernumber %]" />
-       <input type="hidden" name="accountno[% loop_pa.i %]" value="[% loop_pa.accountno %]" />
-       <input type="hidden" name="notify_id[% loop_pa.i %]" value="[% loop_pa.notify_id %]" />
-       <input type="hidden" name="notify_level[% loop_pa.i %]" value="[% loop_pa.notify_level %]" />
-       <input type="hidden" name="totals[% loop_pa.i %]" value="[% loop_pa.totals %]" />
-       </td>
-       <td>[% loop_pa.description %] [% loop_pa.title |html %]</td>
     <td>
-        [% IF ( loop_pa.net_balance ) %]
-            <input type="text" name="note[% loop_pa.i %]" value="[% loop_pa.note %]" />
-        [% ELSE %]
-            [% loop_pa.note %]
-        [% END %]
+    [% IF ( line.amountoutstanding > 0 ) %]
+        <input type="submit" name="pay_indiv_[% line.accountno %]" value="Pay" />
+        <input type="submit" name="wo_indiv_[% line.accountno %]" value="Writeoff" />
+    [% END %]
+    <input type="hidden" name="itemnumber[% line.accountno %]" value="[% line.itemnumber %]" />
+    <input type="hidden" name="description[% line.accountno %]" value="[% line.description %]" />
+    <input type="hidden" name="accounttype[% line.accountno %]" value="[% line.accounttype %]" />
+    <input type="hidden" name="amount[% line.accountno %]" value="[% line.amount %]" />
+    <input type="hidden" name="amountoutstanding[% line.accountno %]" value="[% line.amountoutstanding %]" />
+    <input type="hidden" name="borrowernumber[% line.accountno %]" value="[% line.borrowernumber %]" />
+    <input type="hidden" name="accountno[% line.accountno %]" value="[% line.accountno %]" />
+    <input type="hidden" name="notify_id[% line.accountno %]" value="[% line.notify_id %]" />
+    <input type="hidden" name="notify_level[% line.accountno %]" value="[% line.notify_level %]" />
+    <input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
+    </td>
+    <td>
+    [% IF ( line.amountoutstanding > 0 ) %]
+        <input type="checkbox" checked="checked" name="incl_par_[% line.accountno %]" />
+    [% END %]
     </td>
-       <td>[% loop_pa.accounttype %]</td>
-       <td>[% loop_pa.notify_id %]</td>
-       <td>[% loop_pa.notify_level %]</td>
-       <td class="debit">[% loop_pa.amount %]</td>
-       <td class="debit">[% loop_pa.amountoutstanding %]</td>
+    <td>[% line.description %] [% line.title |html_entity %]</td>
+    <td>[% line.accounttype %]</td>
+    <td>[% line.notify_id %]</td>
+    <td>[% line.notify_level %]</td>
+    <td class="debit">[% line.amount | format('%.2f') %]</td>
+    <td class="debit">[% line.amountoutstanding | format('%.2f') %]</td>
 </tr>
 [% END %]
-[% IF ( allfil.total ) %]
+[% IF ( account_grp.total ) %]
 <tr>
 
-       <td colspan="7">Sub Total</td>
-       <td>[% allfil.total %]</td>
+    <td class="total" colspan="7">Sub Total:</td>
+    <td>[% account_grp.total | format('%.2f') %]</td>
 </tr>
 [% END %]
 [% END %]
 <tr>
-       <td colspan="7">Total Due</td>
-       <td>[% total %]</td>
+    <td class="total" colspan="7">Total Due:</td>
+    <td>[% total | format('%.2f') %]</td>
 </tr>
 </table>
-<fieldset class="action"><input type="submit" name="submit"  value="Make Payment" class="submit" /> <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrowernumber %]">Cancel</a></fieldset></form>[% ELSE %]<p>[% firstname %] [% surname %] has no outstanding fines.</p>[% END %]
+<fieldset class="action">
+<input type="submit" name="paycollect"  value="Pay Amount" class="submit" />
+<input type="submit" name="woall"  value="Writeoff All" class="submit" />
+<input type="submit" name="payselected"  value="Pay Selected" class="submit" />
+<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
+</fieldset>
+</form>
+[% ELSE %]
+    <p>[% borrower.firstname %] [% borrower.surname %] has no outstanding fines.</p>
+[% END %]
 </div></div>
 
 </div>
 </div>
 
 <div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
+[% INCLUDE 'circ-menu.tt' %]
 </div>
 </div>
 [% INCLUDE 'intranet-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
new file mode 100644 (file)
index 0000000..08ee909
--- /dev/null
@@ -0,0 +1,227 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Koha &rsaquo; Patrons &rsaquo; Collect Fine Payment for  [% borrower.firstname %] [% borrower.surname %]</title>
+[% INCLUDE 'doc-head-close.inc' %]
+<script type= "text/javascript">
+//<![CDATA[
+function moneyFormat(textObj) {
+    var newValue = textObj.value;
+    var decAmount = "";
+    var dolAmount = "";
+    var decFlag   = false;
+    var aChar     = "";
+
+    for(i=0; i < newValue.length; i++) {
+        aChar = newValue.substring(i, i+1);
+        if (aChar >= "0" && aChar <= "9") {
+            if(decFlag) {
+                decAmount = "" + decAmount + aChar;
+            }
+            else {
+                dolAmount = "" + dolAmount + aChar;
+            }
+        }
+        if (aChar == ".") {
+            if (decFlag) {
+                dolAmount = "";
+                break;
+            }
+            decFlag = true;
+        }
+    }
+
+    if (dolAmount == "") {
+        dolAmount = "0";
+    }
+// Strip leading 0s
+    if (dolAmount.length > 1) {
+        while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
+            dolAmount = dolAmount.substring(1,dolAmount.length);
+        }
+    }
+    if (decAmount.length > 2) {
+        decAmount = decAmount.substring(0,2);
+    }
+// Pad right side
+    if (decAmount.length == 1) {
+       decAmount = decAmount + "0";
+    }
+    if (decAmount.length == 0) {
+       decAmount = decAmount + "00";
+    }
+
+    textObj.value = dolAmount + "." + decAmount;
+}
+//]]>
+</script>
+</head>
+<body>
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'patron-search.inc' %]
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; Pay Fines for [% borrower.firstname %] [% borrower.surname %]</div>
+
+<div id="doc3" class="yui-t2">
+
+<div id="bd">
+<div id="yui-main">
+<div class="yui-b">
+[% INCLUDE 'members-toolbar.inc' %]
+
+
+<!-- The manual invoice and credit buttons -->
+<div class="toptabs">
+<ul class="ui-tabs-nav">
+    <li>
+    <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a>
+    </li>
+    <li class="ui-tabs-selected">
+    <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a>
+    </li>
+    <li>
+    <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Invoice</a>
+    </li>
+    <li>
+    <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create Manual Credit</a>
+    </li>
+</ul>
+<div class="tabs-container">
+[% IF ( error ) %]
+    <div id="error_message" class="dialog alert">
+    [% error %]
+    </div>
+[% END %]
+
+[% IF ( pay_individual ) %]
+    <form name="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
+    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
+    <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
+    <input type="hidden" name="description" id="description" value="[% description %]" />
+    <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
+    <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
+    <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
+    <input type="hidden" name="amount" id="amount" value="[% amount %]" />
+    <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
+    <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
+    <input type="hidden" name="title" id="title" value="[% title %]" />
+    <table>
+    <tr>
+        <th>Description</th>
+        <th>Account Type</th>
+        <th>Notify id</th>
+        <th>Level</th>
+        <th>Amount</th>
+        <th>Amount Outstanding</th>
+    </tr>
+    <tr>
+        <td>
+            [% description %] [% title  %]
+        </td>
+        <td>[% accounttype %]</td>
+        <td>[% notify_id %]</td>
+        <td>[% notify_level %]</td>
+        <td class="debit">[% amount | format('%.2f') %]</td>
+        <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
+    </tr>
+    <tr>
+        <td>Total Amount Payable : </td>
+        <td>[% amountoutstanding | format('%.2f') %]</td>
+        <td colspan="4"></td>
+    </tr>
+    <tr><td colspan="6"> </td></tr>
+    <tr>
+        <td>Collect From Patron: </td>
+        <td>
+            <!-- default to paying all -->
+        <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/>
+        </td>
+    </tr>
+    <tr><td colspan="6"></td></tr>
+    <tr>
+        <td colspan="6">
+        <input type="submit" name="submitbutton" value="Confirm" />
+        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
+        </td>
+    </tr>
+
+    </table>
+    </form>
+[% ELSIF ( writeoff_individual ) %]
+    <form name="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
+    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
+    <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
+    <input type="hidden" name="description" id="description" value="[% description %]" />
+    <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
+    <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
+    <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
+    <input type="hidden" name="amount" id="amount" value="[% amount %]" />
+    <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
+    <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
+    <input type="hidden" name="title" id="title" value="[% title %]" />
+    <table>
+    <tr>
+        <th>Description</th>
+        <th>Account Type</th>
+        <th>Notify id</th>
+        <th>Level</th>
+        <th>Amount</th>
+        <th>Amount Outstanding</th>
+    </tr>
+    <tr>
+        <td>[% description %] [% title %]</td>
+        <td>[% accounttype %]</td>
+        <td>[% notify_id %]</td>
+        <td>[% notify_level %]</td>
+        <td class="debit">[% amount | format('%.2f') %]</td>
+        <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
+    </tr>
+    <tr><td colspan="6"> </td></tr>
+    <tr><td colspan="6"><strong>Writeoff This Charge?</strong></td></tr>
+    <tr><td> </td></tr>
+    <tr>
+        <td colspan="6">
+        <input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Confirm" />
+        <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
+        </td>
+    </tr>
+
+    </table>
+    </form>
+[% ELSE %]
+
+    <form name="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
+    <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
+    <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
+    <input type="hidden" name="total" id="total" value="[% total %]" />
+
+    <table>
+    <tr>
+        <td>Total Amount Outstanding : </td>
+        <td class="debit">[% total | format('%.2f') %]</td>
+    </tr>
+    <tr><td colspan="2"> </td></tr>
+    <tr>
+        <td>Collect From Patron: </td>
+        <td>
+        <!-- default to paying all -->
+        <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
+        </td>
+    </tr>
+    <tr><td></td></tr>
+    <tr>
+        <td colspan="2">
+        <input type="submit" name="submitbutton" value="Confirm" />
+        <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
+        </td>
+    </tr>
+    </table>
+    </form>
+[% END %]
+</div></div>
+</div>
+</div>
+
+<div class="yui-b">
+[% INCLUDE 'circ-menu.tt' %]
+</div>
+</div>
+[% INCLUDE 'intranet-bottom.inc' %]
+
index 78f927b..4d3bba2 100644 (file)
@@ -40,7 +40,8 @@
                                <th>TOTAL</th>
                        </tr>
                                [% FOREACH loopro IN mainloo.looprow %]
-                                       <tr[% UNLESS ( loop.odd ) %] class="highlight"[% END %]>
+                    [% UNLESS ( loop.odd ) %]<tr class="highlight">
+                    [% ELSE %]<tr>[% END %]
                                                <td>[% IF ( loopro.rowtitle_display ) %][% loopro.rowtitle_display %][% ELSE %][% loopro.rowtitle %][% END %]
                                                </td>
                                                [% FOREACH loopcel IN loopro.loopcell %]
                                </tr>
                        [% END %]
                        [% IF ( SORT2_LOOP ) %]
-                               <tr[% UNLESS ( SORT1_LOOP ) %] class="highlight"[% END %]>
+                [% UNLESS ( SORT1_LOOP ) %]<tr class="highlight">
+                [% ELSE %]<tr>[% END %]
                                <td>Sort2</td>
                                <td><input type="radio" name="Line" value="sort2" /></td>
                                <td><input type="radio" name="Column" value="sort2" /></td>
index 404892d..48ad8a3 100644 (file)
@@ -65,7 +65,8 @@
                        </tr>
                                [% IF ( looptable.looprow ) %]
                                [% FOREACH loopro IN looptable.looprow %]
-                                       <tr[% UNLESS ( loop.odd ) %] class="highlight"[% END %]>
+                    [% UNLESS ( loop.odd ) %]<tr class="highlight">
+                    [% ELSE %]<tr>[% END %]
                                                <td>[% loop.count %]</td>
                                                <td>[% DEFAULT loopro.itemcallnumber="No Call Number" %]</td>
                                                <td>[% DEFAULT loopro.barcode="No Barcode" %]</td>
index f6d48ba..e11b598 100644 (file)
@@ -2,12 +2,19 @@
 <title>Koha &rsaquo; Reports &rsaquo; Guided Reports &rsaquo; Dictionary</title>
 [% INCLUDE 'doc-head-close.inc' %]
 [% INCLUDE 'calendar.inc' %]
+<style type="text/css">fieldset.rows table { clear: none; margin: 0;}</style>
 </head>
 <body>
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'circ-search.inc' %]
 
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a>  &rsaquo; <strong> Dictionary </strong></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; <a href="/cgi-bin/koha/reports/guided_reports.pl">Guided Reports Wizard</a> 
+[% IF ( new_dictionary ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Name the new definition</strong>
+[% ELSIF ( step_2 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 2: Choose the area </strong> 
+[% ELSIF ( step_3 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 3: Choose columns </strong> 
+[% ELSIF ( step_4 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 4: Specify a value </strong> 
+[% ELSIF ( step_5 ) %] &rsaquo; <a href="/cgi-bin/koha/reports/dictionary.pl">Dictionary</a> &rsaquo; <strong>Step 5: Confirm definition</strong> 
+[% ELSE %]<strong> Dictionary </strong>[% END %]</div>
 
 <div id="doc3" class="yui-t2">
 
 [% END %]
 
 [% IF ( new_dictionary ) %]
+<h3>Add New Definition</h3>
 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
-
-<div class="toptabs">
-<ul class="ui-tabs-nav">
-       <li class="ui-tabs-selected"><span class="a">Step 1: Name</span></li>
-       <li><span class="a">Step 2: Area</span></li>
-       <li><span class="a">Step 3: Columns</span></li>
-       <li><span class="a">Step 4: Values</span></li>
-</ul>
-<div class="tabs-container">
-<fieldset class="rows"><legend>Add New Definition</legend><ol>
+<fieldset class="rows"><legend>Step 1 of 5: Name the new definition</legend><ol>
 <li>
 <label for="definition_name">Definition Name:</label>
 <input type="text" id="definition_name" name="definition_name" />
                                                                                                                                                                                                                                          
 <fieldset class="action"><input type="hidden" name="phase" value="New Term step 2" />
 <input name="submit" value="Next" type="submit" /></fieldset>
-</div>
-</div>
 </form>
 [% END %]
 
 [% IF ( step_2 ) %]
-<div class="toptabs">
-<ul class="ui-tabs-nav">
-       <li><span class="a">Step 1: Name</span></li>
-       <li class="ui-tabs-selected"><span class="a">Step 2: Area</span></li>
-       <li><span class="a">Step 3: Columns</span></li>
-       <li><span class="a">Step 4: Values</span></li>
-</ul>
-<div class="tabs-container">
+<h3>Add New Definition</h3>
 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
 <fieldset class="rows">
-<legend>Add New Definition</legend>
+<legend>Step 2 of 5: Choose the area</legend>
 <ol><li><input type="hidden" name="phase" value="New Term step 3" />
 <input type="hidden" name="definition_name" value="[% definition_name %]" />
 <input type="hidden" name="definition_description" value="[% definition_description %]" />
 </fieldset>                                                                            
 <fieldset class="action"><input name="submit" value="Next" type="submit" /></fieldset>
 </form>
-</div>
-</div>
 [% END %]
 
 [% IF ( step_3 ) %]
-<h1>Add New Definition</h1>
-<div class="toptabs">
-<ul class="ui-tabs-nav">
-       <li><span class="a">Step 1: Name</span></li>
-       <li><span class="a">Step 2: Area</span></li>
-       <li class="ui-tabs-selected"><span class="a">Step 3: Columns</span></li>
-       <li><span class="a">Step 4: Values</span></li>
-</ul>
-<div class="tabs-container">
+<h3>Add New Definition</h3>
 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
+<fieldset class="rows">
+<legend>Step 3 of 5: Choose columns</legend>
 <input type="hidden" name="area" value="[% area %]" />
 <input type="hidden" name="definition_name" value="[% definition_name %]" />
 <input type="hidden" name="definition_description" value="[% definition_description %]" />
 
-<table style="border: 0;"><tr><td><select id="availableColumns" name="oldcolumns2" size="25" style="width:200px;height:300px;">    
-[% FOREACH column IN columns %]                              
-[% IF ( column.table ) %]                                                                                                      
+<table style="border: 0;margin:1em;"><tr>
+<td style="border: 0;"><select id="availableColumns" name="oldcolumns2" size="25" style="width:200px;height:300px;">    
+[% FOREACH column IN columns %]
+[% IF ( column.table ) %]
 [% IF ( loop.first ) %]                              
 [% ELSE %]               
 </optgroup>        
 </optgroup>
 </select></td>
 
-<td><input type="button" name="Add" value="Add" class="button"  style="width : 6em; margin-bottom : .5em;" onclick="addColumn()" /><br /><input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width : 6em;"  onclick="delColumn()" />  </td>
+<td style="border: 0;"><input type="button" name="Add" value="Add" class="button"  style="width : 6em; margin-bottom : .5em;" onclick="addColumn()" /><br /><input type="button" name="delete" value="&lt;&lt; Delete" class="button" style="width : 6em;"  onclick="delColumn()" />  </td>
+
+<td style="border: 0;"><select id="selectedColumns" name="columns" size="25" style="width:200px;height:300px;"></select>     </td>   </tr></table>     
 
-<td><select id="selectedColumns" name="columns" size="25" style="width:200px;height:300px;"></select>     </td>   </tr></table>     
-         
-                                                                            
 <input type="hidden" name="phase" value="New Term step 4" />
-<input type="submit" name="submit" value="Next" />  
-</form>    
-</div>
-</div>
+</fieldset>
+<fieldset class="action"><input type="submit" name="submit" value="Next" /></fieldset>
+</form>
 [% END %]
 
 [% IF ( step_4 ) %]
-<h1>Add New Definition</h1>
-<div class="toptabs">
-<ul class="ui-tabs-nav">
-       <li><span class="a">Step 1: Name</span></li>
-       <li><span class="a">Step 2: Area</span></li>
-       <li><span class="a">Step 3: Columns</span></li>
-       <li class="ui-tabs-selected"><span class="a">Step 4: Values</span></li>
-</ul>
-<div class="tabs-container">
+<h3>Add New Definition</h3>
 <form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
+<fieldset class="rows">
+<legend>Step 4 of 5: Specify a value</legend>
 <input type="hidden" name="area" value="[% area %]" />
 <input type="hidden" name="definition_name" value="[% definition_name %]" />
 <input type="hidden" name="definition_description" value="[% definition_description %]" />
 
 [% FOREACH column IN columns %]
 <input type="hidden" name="criteria_column" value="[% column.name %]" />
-[% column.name %]
+<ol><li><span class="label">Column: </span> [% column.name %]</li>
 [% IF ( column.distinct ) %]
-<select name="[% column.name %]_value"> 
-[% FOREACH value IN column.values %]           
-<option value="[% value.availablevalues %]">[% value.availablevalues %]</option>      
-[% END %]   
-</select>
+       <li><label for="[% column.name %]_value">Choose: </label> <select id="[% column.name %]_value" name="[% column.name %]_value"> 
+               [% FOREACH value IN column.values %]
+                       <option value="[% value.availablevalues %]">[% value.availablevalues %]</option>
+               [% END %]
+       </select></li>
 [% END %]
 [% IF ( column.date ) %]
-<table>
-<tr valign="top">
-<td><input type="radio" name="[% column.name %]_all" value="all" />All dates</td>
-<td>OR</td>
-<td><input type="radio" name="dates" value="range" />Date range<br />
-<table>
-<tr>
-<td>Start of date range</td>
-<td><input type="text" size="10" id="[% column.name %]_start_value" name="[% column.name %]_start_value" value="" />      
-<img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom1" style="cursor: pointer;"  />    
-<script type="text/javascript">                            
-Calendar.setup({             
-inputField     : "[% column.name %]_start_value",    
-ifFormat       : "[% DHTMLcalendar_dateformat %]",
-button         : "buttonfrom1",                            
-align          : "Tl"                  
-});
-</script>
-<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
-</td>
-</tr>
-<tr>
-<td>End of date range</td>
-<td>
-<input type="text" size="10" id="[% column.name %]_end_value" name="[% column.name %]_end_value" value="" />      
-<img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom2" style="cursor: pointer;"  />
-<script type="text/javascript">                            
-Calendar.setup({             
-inputField     : "[% column.name %]_end_value",    
-ifFormat       : "[% DHTMLcalendar_dateformat %]",
-button         : "buttonfrom2",
-align          : "Tl"                  
-});
-</script>
-<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
-</td>
-</tr>
-</table></td>
-</tr>
-</table>
+       <li><span class="label">Choose: </span><table>
+       <tr valign="top">
+       <td><input type="radio" name="[% column.name %]_all" value="all" />All dates</td>
+       <td>OR</td>
+       <td><input type="radio" name="dates" value="range" />Date range<br />
+       <table>
+       <tr>
+       <td>Start of date range</td>
+       <td><input type="text" size="10" id="[% column.name %]_start_value" name="[% column.name %]_start_value" value="" />      
+       <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom1" style="cursor: pointer;"  />
+       <script type="text/javascript">
+       Calendar.setup({
+       inputField     : "[% column.name %]_start_value",
+       ifFormat       : "[% DHTMLcalendar_dateformat %]",
+       button         : "buttonfrom1",
+       align          : "Tl"
+       });
+       </script>
+       <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+       </td>
+       </tr>
+       <tr>
+       <td>End of date range</td>
+       <td>
+       <input type="text" size="10" id="[% column.name %]_end_value" name="[% column.name %]_end_value" value="" />      
+       <img src="[% themelang %]/lib/calendar/cal.gif" id="buttonfrom2" style="cursor: pointer;"  />
+       <script type="text/javascript">
+       Calendar.setup({
+       inputField     : "[% column.name %]_end_value",
+       ifFormat       : "[% DHTMLcalendar_dateformat %]",
+       button         : "buttonfrom2",
+       align          : "Tl"
+       });
+       </script>
+       <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+       </td>
+       </tr>
+       </table></td>
+       </tr>
+</table></li>
 [% END %]
 [% IF ( column.text ) %]
-<p>Search string matches <input type="text" size="13" name="[% column.name %]_value" /></p>
+       <li><label for="[% column.name %]_value">Search string matches: </label> <input type="text" size="13" name="[% column.name %]_value" /></li>
 [% END %]
 
 [% END %]
+</ol>
 <input type="hidden" name="phase" value="New Term step 5" />
-<input type="submit" name="submit" value="Next" />            
+</fieldset>
+<fieldset class="action">
+<input type="submit" name="submit" value="Next" />
+</fieldset>
 </form>
-</div>
-</div>
 [% END %]
 
 [% IF ( step_5 ) %]
-<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">      
+<form action="/cgi-bin/koha/reports/dictionary.pl" method="post">
 <input type="hidden" name="area" value="[% area %]" />    
 <input type="hidden" name="definition_name" value="[% definition_name %]" />           
 <input type="hidden" name="definition_description" value="[% definition_description %]" />
 <input type="hidden" name="columnstring" value="[% columnstring %]" />
 
-<h3>Confirm Definition</h3>
+<h3>Add New Definition</h3>
 
-<fieldset class="rows"><ol><li>
+<fieldset class="rows">
+<legend>Step 5 of 5: Confirm details</legend>
+<ol><li>
 <span class="label">Name:</span>
 [% definition_name %]
 </li>
@@ -274,9 +253,9 @@ align          : "Tl"
 <li>
 <span class="label">Area:</span>
 [% areaname %]
-</li></ol>
-
-<ol><li>
+</li>
+<li>
+<span class="label">Data:</span>
 <table>
 <tr>
 <th>Columns</th>
index 0449c84..487f9a2 100644 (file)
@@ -540,7 +540,10 @@ canned reports and writing custom SQL reports.</p>
 <fieldset class="rows">
 <legend>Create Report From SQL</legend>
 <ol>
-    <li><label for="reportname">Report Name:</label> <input type="text" id="reportname" name="reportname" [% IF ( reportname ) %] value="[% reportname %]"[% END %] /> </li>
+    <li><label for="reportname">Report Name:</label> 
+        [% IF ( reportname ) %]<input type="text" id="reportname" name="reportname" value="[% reportname %]" />
+        [% ELSE %]<input type="text" id="reportname" name="reportname" />[% END %] 
+    </li>
     <li><label for="notes">Notes:</label> <textarea id="notes" name="notes" cols="50" rows="2">[% notes %]</textarea></li>
     <li><label for="types">Type:</label>
         <select id="types" name="types">
index 88e6936..410ba47 100644 (file)
@@ -44,7 +44,8 @@
             <th><label for="barcode">Barcode: </label></td>
             <td><input type="text" id="barcode" name="barcode" /></td>
             <td>
-              <input type="checkbox" name="removeItem" [% IF ( removeChecked ) %]checked[% END %] >
+              [% IF ( removeChecked ) %]<input type="checkbox" name="removeItem" checked="checked" />
+              [% ELSE %]<input type="checkbox" name="removeItem" />[% END %]
               <label for="removeItem">Remove Item from Collection</label>
             </td>
           </tr>
index a330423..7a50b4f 100644 (file)
@@ -89,7 +89,8 @@
                 <label for="title">Title: </label>
               </td>
               <td>
-               <input type="text" name="title" [% IF ( editColTitle ) %] value="[% editColTitle %]" [% END %] />
+                [% IF ( editColTitle ) %]<input type="text" name="title" value="[% editColTitle %]" />
+                [% ELSE %]<input type="text" name="title" />[% END %]
               </td>
             </tr>
         
@@ -98,7 +99,8 @@
                 <label for="description">Description: </label>
               </td>
               <td>
-                <input type="text" size="50" name="description" [% IF ( editColDescription ) %] value="[% editColDescription %]" [% END %] />
+                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[ editColDescription %]" />
+                [% ELSE %]<input type="text" size="50" name="description" />[% END %]
               </td>
             </tr>
 
index 134c790..cddf760 100644 (file)
@@ -43,7 +43,8 @@ function active(numlayer)
        <a class=" button serial" href="serial-issues.pl?biblionumber=[% biblionumber %]&amp;selectview=small">Compact view</a>
        </p>
        [% FOREACH year IN years %]
-       <div name="[% year.year %]" id="[% year.year %]" style="position:absolute; visibility:hidden; margin-top:0px; border:4px;" [% IF ( year.first ) %]style="visibility:visible"[% END %]>
+    [% IF ( year.first ) %]<div name="[% year.year %]" id="[% year.year %]" style="position:absolute; visibility:visible margin-top:0px; border:4px;" >
+    [% ELSE %]<div name="[% year.year %]" id="[% year.year %]" style="position:absolute; visibility:hidden; margin-top:0px; border:4px;">[% END %]
                <table>
                        <tr>
                                <th>Information
index d5d1615..f21e72d 100644 (file)
@@ -1108,7 +1108,8 @@ $(document).ready(function() {
         <li>
            <label for="acqui_date"> First issue publication date:</label>
                 [% UNLESS ( modify ) %]<img src="[% themelang %]/lib/calendar/cal.gif" id="acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />[% END %]
-                <input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" [% IF ( modify ) %]disabled="disabled"[% END %] style="border-width: 0px;"  />
+                [% IF ( modify ) %]<input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" disabled="disabled" style="border-width: 0px;"  />
+                [% ELSE %]<input type="text" name="firstacquidate" value="[% firstacquidate %]"  size="13" maxlength="10" id="acqui_date" style="border-width: 0px;"  />[% END %]
         </li>
            [% IF ( modify ) %]<li><label for="next_acqui_date"> Next issue publication date:</label>
                 <img src="[% themelang %]/lib/calendar/cal.gif" id="next_acqui_button" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
index 38d784f..24baefe 100644 (file)
@@ -130,10 +130,14 @@ $(document).ready(function() { calcNewsuggTotal(); });
     <fieldset class="rows"> <legend>Suggestion management</legend>
        <ol>
             [% IF ( suggestionid ) %]<li><label for="status">Status:</label><select id="STATUS" name="STATUS"><option value="">No Status</option>
-                <option value="ASKED"[% IF ( statusselected_ASKED ) %] selected="selected"[% END %]>Asked</option>
-                <option value="ACCEPTED"[% IF ( statusselected_ACCEPTED ) %] selected="selected"[% END %]>Accepted</option>
-                <option value="CHECKED"[% IF ( statusselected_CHECKED ) %] selected="selected"[% END %]>Checked</option>
-                <option value="REJECTED"[% IF ( statusselected_REJECTED ) %] selected="selected"[% END %]>Rejected</option>
+                [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Asked</option> 
+                [% ELSE %]<option value="ASKED">Asked</option>[% END %]
+                [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
+                [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
+                [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
+                [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
+                [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
+                [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
             </select></li>[% END %]
         <li><table>
             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
@@ -273,10 +277,14 @@ $(document).ready(function() { calcNewsuggTotal(); });
         <div id="status[% suggestion.suggestiontype %]">
        <label for="STATUS[% suggestion.suggestiontype %]">Mark selected as: </label><select name="STATUS" id="STATUS[% suggestion.suggestiontype %]">
        <option value=""> -- Choose a status --</option>
-       <option value="ASKED"[% IF ( suggestion.statusselected_ASKED ) %] selected="selected"[% END %]>Asked</option>
-       <option value="ACCEPTED"[% IF ( suggestion.statusselected_ACCEPTED ) %] selected="selected"[% END %]>Accepted</option>
-       <option value="CHECKED"[% IF ( suggestion.statusselected_CHECKED ) %] selected="selected"[% END %]>Checked</option>
-       <option value="REJECTED"[% IF ( suggestion.statusselected_REJECTED ) %] selected="selected"[% END %]>Rejected</option>
+    [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Asked</option> 
+    [% ELSE %]<option value="ASKED">Asked</option>[% END %]
+    [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
+    [ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
+    [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
+    [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
+    [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
+    [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
        </select>
     <label for="reason[% suggestion.suggestiontype %]">with this reason:</label>                 <select id="reason[% suggestion.suggestiontype %]" name="reason[% suggestion.suggestiontype %]">
                     <option value=""> -- Choose a reason -- </option>
@@ -328,12 +336,17 @@ $(document).ready(function() { calcNewsuggTotal(); });
                     <li><label for="collectiontitle"> Collection Title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle %]" /></li><li><input type="submit" value="Go" /></li></ol>
                 </fieldset>
                                 <fieldset class="brief"><h4 class="collapse"><a href="#">Suggestion information</a></h4>
-                    <ol><li><label for="status"> Status:</label><select name="STATUS" id="STATUS"><option value="">Any</option>
-                       <option value="ASKED"[% IF ( statusselected_ASKED ) %] selected="selected"[% END %]>Asked</option>
-                                               <option value="ACCEPTED"[% IF ( statusselected_ACCEPTED ) %] selected="selected"[% END %]>Accepted</option>
-                                               <option value="CHECKED"[% IF ( statusselected_CHECKED ) %] selected="selected"[% END %]>Checked</option>
-                                               <option value="REJECTED"[% IF ( statusselected_REJECTED ) %] selected="selected"[% END %]>Rejected</option>
-                                                          </select></li>
+                    <ol>
+                      <li><label for="status"> Status:</label><select name="STATUS" id="STATUS"><option value="">Any</option>
+                        [% IF (statusselected_ASKED ) %]<option value="ASKED" selected="selected">Asked</option> 
+                        [% ELSE %]<option value="ASKED">Asked</option>[% END %]
+                        [% IF (statusselected_ACCEPTED ) %]<option value="ACCEPTED" selected="selected">Accepted</option>
+                        [% ELSE %]<option value="ACCEPTED">Accepted</option>[% END %]
+                        [% IF (statusselected_CHECKED ) %]<option value="CHECKED" selected="selected">Checked</option>
+                        [% ELSE %]<option value="CHECKED">Checked</option>[% END %]
+                        [% IF ( statusselected_REJECTED ) %]<option value="REJECTED" selected="selected">Rejected</option>
+                        [% ELSE %]<option value="REJECTED">Rejected</option>[% END %]
+                      </select></li>
                     <li><label for="suggestedby"> Suggested By:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code %]" selected="selected">[% suggestedby_loo.desc %]</option>[% ELSE %]<option value="[% suggestedby_loo.code %]">[% suggestedby_loo.desc %]</option>[% END %][% END %]
                                                                      </select></li>
index 7cf3df6..5dfe91a 100644 (file)
@@ -209,7 +209,8 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
        <tr>
            <td class="count">[% offset + loop.count %]
            </td>
-           <td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" [% IF ( approved == 0 ) %] class="pending"[% END %] /></span>
+        [% IF ( approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
+        [% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %]
            </td>
            [% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
                [% ELSIF ( tagloo.approved == 1 ) %]<td class="green"><img alt="OK" src="/intranet-tmpl/prog/img/approve.gif" />
@@ -304,11 +305,16 @@ td input,td input[type="submit"] { font-size: 85%; padding: 1px; }
        <ol>
            <li><label for="tag">Term</label> <input type="text" name="tag" id="tag" value="[% filter_tag %]" />
            </li>
-           <li><label for="approved">Status</label> <select name="approved" id="approved">
-                       <option [% IF ( filter_approved_all ) %]selected="selected" [% END %]value="all">all</option>
-                       <option [% IF ( filter_approved_ok ) %]selected="selected" [% END %]value="1">approved</option>
-                       <option [% IF ( filter_approved_pending ) %]selected="selected" [% END %]value="0">pending</option>
-                       <option [% IF ( filter_approved_rej ) %]selected="selected" [% END %]value="-1">rejected</option>
+           <li><label for="approved">Status</label> 
+            <select name="approved" id="approved">
+            [% IF ( filter_approved_all ) %]<option selected="selected" value="all">all</option>
+            [% ELSE %]<option value="all">all</option>[% END %]
+            [% IF ( filter_approved_ok ) %]<option selected="selected" value="1">approved</option>
+            [% ELSE %]<option value="1">approved</option>[% END %]
+            [% IF ( filter_approved_pending ) %]<option selected="selected" value="0">pending</option>
+            [% ELSE %]<option value="0">pending</option>[% END %]
+            [% IF ( filter_approved_rej ) %]<option selected="selected" value="-1">rejected</option>
+            [% ELSE %]<option value="-1">rejected</option>[% END %]
                        </select>
            </li>
            <li><label for="approver">Reviewer</label> <input type="text" name="approver" id="approver" value="[% filter_approver %]" />
index 083d0b9..c05a83b 100644 (file)
 </script>
 <script type="text/javascript" language="javascript" src="[% themelang %]/js/amazonimages.js"></script>          [% END %]
 
-<script type="text/javascript" language="javascript"
-[% IF ( opacbookbag ) %]src="[% themelang %]/js/basket.js">[% ELSIF ( virtualshelves ) %]src="[% themelang %]/js/basket.js">[% ELSE %]>var readCookie;[% END %]</script>
+[% IF ( opacbookbag ) %]<script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js">
+[% ELSIF ( virtualshelves ) %]<script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js">
+[% ELSE %]<script type="text/javascript" language="javascript"> var readCookie;[% END %]
+</script>
+
 <script type="text/javascript" language="javascript">
        //<![CDATA[
     [% IF ( opacbookbag ) %]var MSG_BASKET_EMPTY = _("Your cart is currently empty");
@@ -74,8 +77,9 @@
          });[% END %]
        [% IF ( opacuserjs ) %][% opacuserjs %][% END %]
        //]]>
-</script><script type="text/javascript" language="javascript"
-[% IF ( opacbookbag ) %]src="[% themelang %]/js/basket.js">[% ELSIF ( virtualshelves ) %]src="[% themelang %]/js/basket.js">[% ELSE %]>var readCookie;[% END %]</script>
+[% IF ( opacbookbag ) %]</script><script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js">
+[% ELSIF ( virtualshelves ) %]</script><script type="text/javascript" language="javascript" src="[% themelang %]/js/basket.js">
+[% ELSE %]</script><script type="text/javascript" language="javascript">var readCookie;[% END %]</script>
 [% IF ( opacuserlogin ) %][% IF ( TagsEnabled ) %]<script type="text/javascript" language="javascript" src="[% themelang %]/js/tags.js"></script>[% END %][% ELSE %][% END %]
 [% IF ( GoogleJackets ) %]
 <script type="text/javascript" language="javascript" src="[% themelang %]/js/google-jackets.js"></script>
index 48ec21d..1aea582 100644 (file)
@@ -1,5 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html lang="[% lang %]" xml:lang="[% lang %]" [% IF ( bidi ) %]dir="[% bidi %]"[% END %] xmlns="http://www.w3.org/1999/xhtml">
+[% IF ( bidi ) %]<html lang="[% lang %]" xml:lang="[% lang %]" dir="[% bidi %]" xmlns="http://www.w3.org/1999/xhtml">[% ELSE %]<html lang="[% lang %]" xml:lang="[% lang %]" xmlns="http://www.w3.org/1999/xhtml">[% END %]
 <head>
 <title>
index 0f532d8..2510a7f 100644 (file)
@@ -80,7 +80,8 @@
       <select name="limit" id="masthead_search" class="left" style="max-width:10em;width:10em;">
          <option value="">All Libraries</option>
          [% FOREACH BranchesLoo IN BranchesLoop %]
-            <option [% IF ( BranchesLoo.selected ) %]SELECTED[% END %] value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
+            [% IF ( BranchesLoo.selected ) %]<option select="selected" value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>
+            [% ELSE %]<option value="branch:[% BranchesLoo.value %]">[% BranchesLoo.branchname %]</option>[% END %]
          [% END %]
       </select>
    [% ELSE %]
index 61b7515..3e8586d 100644 (file)
@@ -322,9 +322,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 <div id="bibliodescriptions" class="toptabs">
 
 <ul>   
-<li[% IF ( defaulttab == 'holdings' ) %] class="ui-tabs-selected"[% END %]><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#holdings">Holdings
-    ( [% count %] )</a>
-   </li>
+[% IF ( defaulttab == 'holdings' ) %]<li class="ui-tabs-selected">
+[% ELSE %]<li>[% END %]
+       <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#holdings">Holdings ( [% count %] )</a></li>
  <li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#descriptions">Title Notes</a></li>
 [% IF ( SYNDETICS_TOC ) %]
  <li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#toc">TOC</a></li>
@@ -350,7 +350,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 <li> <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#LTFLTagBrowse">Tag Browser</a></li>
 [% END %]
 [% END %]
-[% IF ( subscriptionsnumber ) %]<li[% IF ( defaulttab == 'subscriptions' ) %] class="ui-tabs-selected"[% END %]>
+[% IF ( subscriptionsnumber ) %]
+       [% IF ( defaulttab == 'subscriptions' ) %]<li class="ui-tabs-selected">
+       [% ELSE %]<li>[% END %]
             <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#subscriptions">Subscriptions</a>
     </li>[% END %]
 [% IF ( reviewson ) %]
@@ -366,7 +368,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
     [% IF ( Babeltheque ) %]<li><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#babeltheque">Babelthèque</a></li>[% END %]
 
     [% IF ( serialcollection ) %]
-    <li[% IF ( defaulttab == 'serialcollection' ) %] class="ui-tabs-selected"[% END %]><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#serialcollection">Serial Collection</a></li>
+               [% IF ( defaulttab == 'serialcollection' ) %]<li class="ui-tabs-selected">
+               [% ELSE %]<li>[% END %]
+               <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]#serialcollection">Serial Collection</a></li>
     [% END %]
 </ul>
 
index ddb6dfa..67b5ba8 100644 (file)
@@ -132,7 +132,8 @@ $(document).ready(function() {
 <input type="button" value="Return Item" name="confirm" class="return" onclick="this.form.op.value='returnbook';this.form.submit();"  />
 [% END %]
 [% END %]
-<input type="button" value="Renew Item" [% UNLESS ( renew ) %] name="confirm"[% END %] class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
+[% UNLESS ( renew ) %]<input type="button" value="Renew Item" name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
+[% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
 <input type="button" value="Cancel" class="cancel" onclick="this.form.op.value='';this.form.submit();return true;"  />
 </form>
 </div>
@@ -219,7 +220,8 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
           <span>No renewals allowed</span>
           [% END %]
         [% ELSE %]
-        <input type="button" value="Renew Item" [% UNLESS ( ISSUE.renew ) %] name="confirm"[% END %] class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
+            [% UNLESS ( ISSUE.renew ) %]<input type="button" value="Renew Item"  name="confirm" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />
+            [% ELSE %]<input type="button" value="Renew Item" class="renew" onclick="this.form.confirmed.value='1';this.form.submit();" />[% END %]
         [% END %]
     </form>
        </td>
index 4ecdcc9..555cfd9 100755 (executable)
@@ -2,6 +2,7 @@
 
 # Copyright 2000-2002 Katipo Communications
 # Copyright 2010 BibLibre
+# Copyright 2010,2011 PTFS-Europe Ltd
 #
 # This file is part of Koha.
 #
@@ -18,7 +19,6 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-
 =head1 pay.pl
 
  written 11/1/2000 by chris@katipo.oc.nz
@@ -38,196 +38,243 @@ use C4::Accounts;
 use C4::Stats;
 use C4::Koha;
 use C4::Overdues;
-use C4::Branch; # GetBranches
+use C4::Branch;
 
-my $input = new CGI;
+my $input = CGI->new;
 
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
-    {
-        template_name   => "members/pay.tmpl",
+    {   template_name   => 'members/pay.tmpl',
         query           => $input,
-        type            => "intranet",
+        type            => 'intranet',
         authnotrequired => 0,
         flagsrequired   => { borrowers => 1, updatecharges => 1 },
         debug           => 1,
     }
 );
 
+my $writeoff_sth;
+my $add_writeoff_sth;
+
+my @names = $input->param;
+
 my $borrowernumber = $input->param('borrowernumber');
-if ( $borrowernumber eq '' ) {
+if ( !$borrowernumber ) {
     $borrowernumber = $input->param('borrowernumber0');
 }
 
 # get borrower details
-my $data = GetMember( borrowernumber => $borrowernumber );
+my $borrower = GetMember( borrowernumber => $borrowernumber );
 my $user = $input->remote_user;
+$user ||= q{};
 
-# get account details
 my $branches = GetBranches();
-my $branch   = GetBranch( $input, $branches );
+my $branch = GetBranch( $input, $branches );
 
-my @names = $input->param;
-my %inp;
-my $check = 0;
-for ( my $i = 0 ; $i < @names ; $i++ ) {
-    my $temp = $input->param( $names[$i] );
-    if ( $temp eq 'wo' ) {
-        $inp{ $names[$i] } = $temp;
-        $check = 1;
-    }
-    if ( $temp eq 'yes' ) {
-
-# FIXME : using array +4, +5, +6 is dirty. Should use arrays for each accountline
-        my $amount         = $input->param( $names[ $i + 4 ] );
-        my $borrowernumber = $input->param( $names[ $i + 5 ] );
-        my $accountno      = $input->param( $names[ $i + 6 ] );
-        makepayment( $borrowernumber, $accountno, $amount, $user, $branch );
-        $check = 2;
-    }
-    if ( $temp eq 'no'||$temp eq 'yes'||$temp eq 'wo') {
-        my $borrowernumber = $input->param( $names[ $i + 5 ] );
-        my $accountno      = $input->param( $names[ $i + 6 ] );
-        my $note     = $input->param( $names[ $i + 10 ] );
-        ModNote( $borrowernumber, $accountno, $note );
-    }
+my $writeoff_item = $input->param('confirm_writeoff');
+my $paycollect    = $input->param('paycollect');
+if ($paycollect) {
+    print $input->redirect(
+        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber");
+}
+my $payselected = $input->param('payselected');
+if ($payselected) {
+    payselected(@names);
 }
 
-my $total = $input->param('total') || '';
-if ( $check == 0 ) {
-    if ( $total ne '' ) {
-        recordpayment( $borrowernumber, $total );
+my $writeoff_all = $input->param('woall');    # writeoff all fines
+if ($writeoff_all) {
+    writeoff_all(@names);
+} elsif ($writeoff_item) {
+    my $accountno    = $input->param('accountno');
+    my $itemno       = $input->param('itemnumber');
+    my $account_type = $input->param('accounttype');
+    my $amount       = $input->param('amount');
+    writeoff( $accountno, $itemno, $account_type, $amount );
+}
+
+for (@names) {
+    if (/^pay_indiv_(\d+)$/) {
+        my $line_no = $1;
+        redirect_to_paycollect( 'pay_individual', $line_no );
+    } elsif (/^wo_indiv_(\d+)$/) {
+        my $line_no = $1;
+        redirect_to_paycollect( 'writeoff_individual', $line_no );
     }
+}
 
-    my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
-
-    my @allfile;
-    my @notify = NumberNotifyId($borrowernumber);
-
-    my $numberofnotify = scalar(@notify);
-    for ( my $j = 0 ; $j < scalar(@notify) ; $j++ ) {
-        my @loop_pay;
-        my ( $total , $accts, $numaccts) =
-          GetBorNotifyAcctRecord( $borrowernumber, $notify[$j] );
-        for ( my $i = 0 ; $i < $numaccts ; $i++ ) {
-            my %line;
-            if ( $accts->[$i]{'amountoutstanding'} != 0 ) {
-                $accts->[$i]{'amount'}            += 0.00;
-                $accts->[$i]{'amountoutstanding'} += 0.00;
-                $line{i}           = $j . "" . $i;
-                $line{itemnumber}  = $accts->[$i]{'itemnumber'};
-                $line{accounttype} = $accts->[$i]{'accounttype'};
-                $line{amount}      = sprintf( "%.2f", $accts->[$i]{'amount'} );
-                $line{amountoutstanding} =
-                  sprintf( "%.2f", $accts->[$i]{'amountoutstanding'} );
-                $line{borrowernumber} = $borrowernumber;
-                $line{accountno}      = $accts->[$i]{'accountno'};
-                $line{description}    = $accts->[$i]{'description'};
-                $line{note}           = $accts->[$i]{'note'};
-                $line{title}          = $accts->[$i]{'title'};
-                $line{notify_id}      = $accts->[$i]{'notify_id'};
-                $line{notify_level}   = $accts->[$i]{'notify_level'};
-                $line{net_balance} = 1 if($accts->[$i]{'amountoutstanding'} > 0); # you can't pay a credit.
-                push( @loop_pay, \%line );
-            }
-        }
+add_accounts_to_template();
 
-        my $totalnotify = AmountNotify( $notify[$j], $borrowernumber );
-        ( $totalnotify = '0' ) if ( $totalnotify =~ /^0.00/ );
-        push @allfile,
-          {
-            'loop_pay' => \@loop_pay,
-            'notify'   => $notify[$j],
-            'total'    =>  sprintf( "%.2f",$totalnotify),
-                       
-          };
-    }
-       
-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;
+output_html_with_http_headers $input, $cookie, $template->output;
+
+sub writeoff {
+    my ( $accountnum, $itemnum, $accounttype, $amount ) = @_;
+
+    # if no item is attached to fine, make sure to store it as a NULL
+    $itemnum ||= undef;
+    get_writeoff_sth();
+    $writeoff_sth->execute( $accountnum, $borrowernumber );
+
+    my $acct = getnextacctno($borrowernumber);
+    $add_writeoff_sth->execute( $borrowernumber, $acct, $itemnum, $amount );
+
+    UpdateStats( $branch, 'writeoff', $amount, q{}, q{}, q{}, $borrowernumber );
+
+    return;
 }
-       
-$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
-my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'});
-$template->param( picture => 1 ) if $picture;
-       
+
+sub add_accounts_to_template {
+
+    my ( $total, undef, undef ) = GetMemberAccountRecords($borrowernumber);
+    my $accounts = [];
+    my @notify   = NumberNotifyId($borrowernumber);
+
+    my $notify_groups = [];
+    for my $notify_id (@notify) {
+        my ( $acct_total, $accountlines, undef ) =
+          GetBorNotifyAcctRecord( $borrowernumber, $notify_id );
+        if ( @{$accountlines} ) {
+            my $totalnotify = AmountNotify( $notify_id, $borrowernumber );
+            push @{$accounts},
+              { accountlines => $accountlines,
+                notify       => $notify_id,
+                total        => $totalnotify,
+              };
+        }
+    }
+    borrower_add_additional_fields($borrower);
     $template->param(
-        allfile        => \@allfile,
-        firstname      => $data->{'firstname'},
-        surname        => $data->{'surname'},
-        borrowernumber => $borrowernumber,
-       cardnumber => $data->{'cardnumber'},
-       categorycode => $data->{'categorycode'},
-       category_type => $data->{'category_type'},
-       categoryname  => $data->{'description'},
-       address => $data->{'address'},
-       address2 => $data->{'address2'},
-       city => $data->{'city'},
-    state => $data->{'state'},
-       zipcode => $data->{'zipcode'},
-       country => $data->{'country'},
-       phone => $data->{'phone'},
-       email => $data->{'email'},
-       branchcode => $data->{'branchcode'},
-       branchname => GetBranchName($data->{'branchcode'}),
-       is_child        => ($data->{'category_type'} eq 'C'),
-        total          => sprintf( "%.2f", $total )
+        accounts => $accounts,
+        borrower => $borrower,
+        total    => $total,
     );
-    output_html_with_http_headers $input, $cookie, $template->output;
+    return;
 
 }
-else {
-
-    my %inp;
-    my @name = $input->param;
-    for ( my $i = 0 ; $i < @name ; $i++ ) {
-        my $test = $input->param( $name[$i] );
-        if ( $test eq 'wo' ) {
-            my $temp = $name[$i];
-            $temp =~ s/payfine//;
-            $inp{ $name[$i] } = $temp;
-        }
+
+sub get_for_redirect {
+    my ( $name, $name_in, $money ) = @_;
+    my $s     = q{&} . $name . q{=};
+    my $value = $input->param($name_in);
+    if ( !defined $value ) {
+        $value = ( $money == 1 ) ? 0 : q{};
+    }
+    if ($money) {
+        $s .= sprintf '%.2f', $value;
+    } else {
+        $s .= $value;
     }
-    my $borrowernumber;
-    while ( my ( $key, $value ) = each %inp ) {
-
-        my $accounttype = $input->param("accounttype$value");
-        $borrowernumber = $input->param("borrowernumber$value");
-        my $itemno    = $input->param("itemnumber$value");
-        my $amount    = $input->param("amount$value");
-        my $accountno = $input->param("accountno$value");
-        writeoff( $borrowernumber, $accountno, $itemno, $accounttype, $amount );
+    return $s;
+}
+
+sub redirect_to_paycollect {
+    my ( $action, $line_no ) = @_;
+    my $redirect =
+      "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber";
+    $redirect .= q{&};
+    $redirect .= "$action=1";
+    $redirect .= get_for_redirect( 'accounttype', "accounttype$line_no", 0 );
+    $redirect .= get_for_redirect( 'amount', "amount$line_no", 1 );
+    $redirect .=
+      get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
+    $redirect .= get_for_redirect( 'accountno',    "accountno$line_no",    0 );
+    $redirect .= get_for_redirect( 'description',  "description$line_no",  0 );
+    $redirect .= get_for_redirect( 'title',        "title$line_no",        0 );
+    $redirect .= get_for_redirect( 'itemnumber',   "itemnumber$line_no",   0 );
+    $redirect .= get_for_redirect( 'notify_id',    "notify_id$line_no",    0 );
+    $redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 );
+    $redirect .= '&remote_user=';
+    $redirect .= $user;
+    return print $input->redirect($redirect);
+}
+
+sub writeoff_all {
+    my @params = @_;
+    my @wo_lines = grep { /^accountno\d+$/ } @params;
+    for (@wo_lines) {
+        if (/(\d+)/) {
+            my $value       = $1;
+            my $accounttype = $input->param("accounttype$value");
+
+            #    my $borrowernum    = $input->param("borrowernumber$value");
+            my $itemno    = $input->param("itemnumber$value");
+            my $amount    = $input->param("amount$value");
+            my $accountno = $input->param("accountno$value");
+            writeoff( $accountno, $itemno, $accounttype, $amount );
+        }
     }
+
     $borrowernumber = $input->param('borrowernumber');
     print $input->redirect(
         "/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
+    return;
 }
 
-sub writeoff {
-    my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount ) = @_;
-    my $user = $input->remote_user;
-    my $dbh  = C4::Context->dbh;
-    undef $itemnum unless $itemnum; # if no item is attached to fine, make sure to store it as a NULL
-    my $sth =
-      $dbh->prepare(
-"Update accountlines set amountoutstanding=0 where accountno=? and borrowernumber=?"
-      );
-    $sth->execute( $accountnum, $borrowernumber );
-    $sth->finish;
-    $sth = $dbh->prepare("select max(accountno) from accountlines");
-    $sth->execute;
-    my $account = $sth->fetchrow_hashref;
-    $sth->finish;
-    $account->{'max(accountno)'}++;
-    $sth = $dbh->prepare(
-"insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
-                                               values (?,?,?,now(),?,'Writeoff','W')"
-    );
-    $sth->execute( $borrowernumber, $account->{'max(accountno)'},
-        $itemnum, $amount );
-    $sth->finish;
-    UpdateStats( $branch, 'writeoff', $amount, '', '', '',
-        $borrowernumber );
+sub borrower_add_additional_fields {
+    my $b_ref = shift;
+
+# 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 ( $b_ref->{category_type} eq 'C' ) {
+        my ( $catcodes, $labels ) =
+          GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+        if ( @{$catcodes} ) {
+            if ( @{$catcodes} > 1 ) {
+                $b_ref->{CATCODE_MULTI} = 1;
+            } elsif ( @{$catcodes} == 1 ) {
+                $b_ref->{catcode} = $catcodes->[0];
+            }
+        }
+    } elsif ( $b_ref->{category_type} eq 'A' ) {
+        $b_ref->{adultborrower} = 1;
+    }
+    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} );
+    if ($picture) {
+        $b_ref->{has_picture} = 1;
+    }
+
+    $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} );
+    return;
+}
+
+sub payselected {
+    my @params = @_;
+    my $amt    = 0;
+    my @lines_to_pay;
+    foreach (@params) {
+        if (/^incl_par_(\d+)$/) {
+            my $index = $1;
+            push @lines_to_pay, $input->param("accountno$index");
+            $amt += $input->param("amountoutstanding$index");
+        }
+    }
+    $amt = '&amt=' . $amt;
+    my $sel = '&selected=' . join ',', @lines_to_pay;
+    my $redirect =
+        "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber"
+      . $amt
+      . $sel;
+
+    print $input->redirect($redirect);
+    return;
+}
+
+sub get_writeoff_sth {
+
+    # lets prepare these statement handles only once
+    if ($writeoff_sth) {
+        return;
+    } else {
+        my $dbh = C4::Context->dbh;
+
+        # Do we need to validate accounttype
+        my $sql = 'Update accountlines set amountoutstanding=0 '
+          . 'WHERE accountno=? and borrowernumber=?';
+        $writeoff_sth = $dbh->prepare($sql);
+        my $insert =
+q{insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)}
+          . q{values (?,?,?,now(),?,'Writeoff','W')};
+        $add_writeoff_sth = $dbh->prepare($insert);
+    }
+    return;
 }
diff --git a/members/paycollect.pl b/members/paycollect.pl
new file mode 100755 (executable)
index 0000000..cbddc05
--- /dev/null
@@ -0,0 +1,171 @@
+#!/usr/bin/perl
+# Copyright 2009,2010 PTFS Inc.
+# Copyright 2011 PTFS-Europe Ltd
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+use C4::Context;
+use C4::Auth;
+use C4::Output;
+use CGI;
+use C4::Members;
+use C4::Accounts;
+use C4::Koha;
+use C4::Branch;
+
+my $input = CGI->new();
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {   template_name   => 'members/paycollect.tmpl',
+        query           => $input,
+        type            => 'intranet',
+        authnotrequired => 0,
+        flagsrequired   => { borrowers => 1, updatecharges => 1 },
+        debug           => 1,
+    }
+);
+
+# get borrower details
+my $borrowernumber = $input->param('borrowernumber');
+my $borrower       = GetMember( borrowernumber => $borrowernumber );
+my $user           = $input->remote_user;
+
+# get account details
+my $branch = GetBranch( $input, GetBranches() );
+
+my ( $total_due, $accts, $numaccts ) = GetMemberAccountRecords($borrowernumber);
+my $total_paid = $input->param('paid');
+
+my $individual   = $input->param('pay_individual');
+my $writeoff     = $input->param('writeoff_individual');
+my $select_lines = $input->param('selected');
+my $select       = $input->param('selected_accts');
+my $accountno;
+
+if ( $individual || $writeoff ) {
+    if ($individual) {
+        $template->param( pay_individual => 1 );
+    } elsif ($writeoff) {
+        $template->param( writeoff_individual => 1 );
+    }
+    my $accounttype       = $input->param('accounttype');
+    my $amount            = $input->param('amount');
+    my $amountoutstanding = $input->param('amountoutstanding');
+    $accountno = $input->param('accountno');
+    my $description  = $input->param('description');
+    my $title        = $input->param('title');
+    my $notify_id    = $input->param('notify_id');
+    my $notify_level = $input->param('notify_level');
+    $total_due = $amountoutstanding;
+    $template->param(
+        accounttype       => $accounttype,
+        accountno         => $accountno,
+        amount            => $amount,
+        amountoutstanding => $amountoutstanding,
+        title             => $title,
+        description       => $description,
+        notify_id         => $notify_id,
+        notify_level      => $notify_level,
+    );
+} elsif ($select_lines) {
+    $total_due = $input->param('amt');
+    $template->param(
+        selected_accts => $select_lines,
+        amt            => $total_due
+    );
+}
+
+if ( $total_paid and $total_paid ne '0.00' ) {
+    if ( $total_paid < 0 or $total_paid > $total_due ) {
+        $template->param(
+            error => sprintf( 'You must pay a value less than or equal to %f.2',
+                $total_due )
+        );
+    } else {
+        if ($individual) {
+            if ( $total_paid == $total_due ) {
+                makepayment( $borrowernumber, $accountno, $total_paid, $user,
+                    $branch );
+            } else {
+                makepartialpayment( $borrowernumber, $accountno, $total_paid,
+                    $user, $branch );
+            }
+            print $input->redirect(
+                "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber");
+        } else {
+            if ($select) {
+                if ( $select =~ /^([\d,]*).*/ ) {
+                    $select = $1;    # ensure passing no junk
+                }
+                my @acc = split /,/, $select;
+                recordpayment_selectaccts( $borrowernumber, $total_paid,
+                    \@acc );
+            } else {
+                recordpayment( $borrowernumber, $total_paid );
+            }
+
+# recordpayment does not return success or failure so lets redisplay the boraccount
+
+            print $input->redirect(
+"/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"
+            );
+        }
+    }
+} else {
+    $total_paid = '0.00';    #TODO not right with pay_individual
+}
+
+borrower_add_additional_fields($borrower);
+
+$template->param(
+
+ #borrowenumber  => $borrower->{borrowernumber}, # some templates require global
+    borrowenumber => $borrowernumber,    # some templates require global
+    borrower      => $borrower,
+    total         => $total_due
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;
+
+sub borrower_add_additional_fields {
+    my $b_ref = shift;
+
+# 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 ( $b_ref->{category_type} eq 'C' ) {
+        my ( $catcodes, $labels ) =
+          GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
+        if ( @{$catcodes} ) {
+            if ( @{$catcodes} > 1 ) {
+                $b_ref->{CATCODE_MULTI} = 1;
+            } elsif ( @{$catcodes} == 1 ) {
+                $b_ref->{catcode} = $catcodes->[0];
+            }
+        }
+    } elsif ( $b_ref->{category_type} eq 'A' ) {
+        $b_ref->{adultborrower} = 1;
+    }
+    my ( $picture, $dberror ) = GetPatronImage( $b_ref->{cardnumber} );
+    if ($picture) {
+        $b_ref->{has_picture} = 1;
+    }
+
+    $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} );
+    return;
+}