Merge remote-tracking branch 'origin/new/bug_6964'
authorPaul Poulain <paul.poulain@biblibre.com>
Fri, 3 Feb 2012 08:19:04 +0000 (09:19 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 3 Feb 2012 08:19:04 +0000 (09:19 +0100)
C4/Biblio.pm
C4/Circulation.pm
C4/Items.pm
acqui/z3950_search.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
members/paycollect.pl

index 631e891..98e4f5b 100644 (file)
@@ -1048,7 +1048,6 @@ sub GetMarcFromKohaField {
     if ( my $mf = $relations->{$frameworkcode}->{$kohafield} ) {
         return @$mf;
     }
-    warn qq{No marc tags for framework "$frameworkcode" field $kohafield};
     return (0, undef);
 }
 
index 0b5068c..2bf5d51 100644 (file)
@@ -1866,10 +1866,11 @@ sub _FixAccountForLostAndReturned {
     my $item_id        = @_ ? shift : $itemnumber;  # Send the barcode if you want that logged in the description
     my $dbh = C4::Context->dbh;
     # check for charge made for lost book
-    my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE (itemnumber = ?) AND (accounttype='L' OR accounttype='Rep') ORDER BY date DESC");
+    my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE itemnumber = ? AND accounttype IN ('L', 'Rep', 'W') ORDER BY date DESC, accountno DESC");
     $sth->execute($itemnumber);
     my $data = $sth->fetchrow_hashref;
     $data or return;    # bail if there is nothing to do
+    $data->{accounttype} eq 'W' and return;    # Written off
 
     # writeoff this amount
     my $offset;
index eb1c51c..04cb417 100644 (file)
@@ -1629,7 +1629,7 @@ sub GetHiddenItemnumbers {
     my @resultitems;
 
     my $yaml = C4::Context->preference('OpacHiddenItems');
-    $yaml = "$yaml\n"; # YAML is anal on ending \n. Surplus does not hurt
+    $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt
     my $hidingrules;
     eval {
         $hidingrules = YAML::Load($yaml);
index 47dbe52..80503e0 100755 (executable)
@@ -134,8 +134,17 @@ if ( $op ne "do_search" ) {
 }
 else {
     my @id = $input->param('id');
+
+    if ( not defined @id ) {
+        # empty server list -> report and exit
+        $template->param( emptyserverlist => 1 );
+        output_html_with_http_headers $input, $cookie, $template->output;
+        exit;
+    }
+
     my @oConnection;
     my @oResult;
+    my @errconn;
     my $s = 0;
     my $query;
     my $nterms;
@@ -164,7 +173,7 @@ else {
         $query .= " \@attr 1=21 \"$subject\" ";
         $nterms++;
     }
-       if ($lccn) {    
+    if ($lccn) {
         $query .= " \@attr 1=9 $lccn ";
         $nterms++;
     }
@@ -186,7 +195,6 @@ warn "query ".$query  if $DEBUG;
         $sth->execute($servid);
         while ( $server = $sth->fetchrow_hashref ) {
             warn "serverinfo ".join(':',%$server) if $DEBUG;
-            my $noconnection = 0;
             my $option1      = new ZOOM::Options();
             $option1->option( 'async' => 1 );
             $option1->option( 'elementSetName', 'F' );
@@ -237,9 +245,10 @@ sub displayresults {
         my ( $error, $errmsg, $addinfo, $diagset ) =
           $oConnection[$k]->error_x();
         if ($error) {
-            warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n"
-              if $DEBUG;
-
+            if ($error =~ m/^(10000|10007)$/ ) {
+                push(@errconn, {'server' => $serverhost[$k]});
+            }
+            $DEBUG and warn "$k $serverhost[$k] error $query: $errmsg ($error) $addinfo\n";
         }
         else {
             my $numresults = $oResult[$k]->size();
@@ -280,13 +289,6 @@ sub displayresults {
                           )
                           = ImportBreeding( $marcdata, 2, $serverhost[$k], $encoding[$k], $random, 'z3950' );
                         my %row_data;
-                        if ( $i % 2 ) {
-                            $toggle = 1;
-                        }
-                        else {
-                            $toggle = 0;
-                        }
-                        $row_data{toggle}       = $toggle;
                         $row_data{server}       = $servername[$k];
                         $row_data{isbn}         = $oldbiblio->{isbn};
                         $row_data{lccn}         = $oldbiblio->{lccn};
@@ -295,9 +297,9 @@ sub displayresults {
                         $row_data{breedingid}   = $breedingid;
                         $row_data{biblionumber} = $biblionumber;
                         push( @breeding_loop, \%row_data );
-                           
+
                     } else {
-                        push(@breeding_loop,{'toggle'=>($i % 2)?1:0,'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
+                        push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'biblionumber'=>-1});
                     } # $rec
                 }    # upto 5 results
             }    #$numresults
@@ -308,10 +310,11 @@ sub displayresults {
         breeding_loop => \@breeding_loop,
         server        => $servername[$k],
         numberpending => $numberpending,
+        errconn       => \@errconn
     );
     output_html_with_http_headers $input, $cookie, $template->output if $numberpending == 0;
 
-    #          print  $template->output  if $firstresult !=1;
+    #   print  $template->output  if $firstresult !=1;
     $firstresult++;
 }
 displayresults();
index 66dbc6e..1f2ad60 100644 (file)
@@ -120,7 +120,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
 
         </p>
     [% END %]
-    <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel close" href="#">Cancel</a></fieldset>
+    <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a></fieldset>
     </div>
     </form>
 
@@ -155,6 +155,13 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color :
     [% END %]</tbody>
 </table>
     [% ELSE %]
+        [% IF ( emptyserverlist ) %]
+            You didn't select any Z39.50 target.
+        [% ELSE %]
+            [% FOREACH errcon IN errconn %]
+                Connection failed to [% errcon.server %]
+            [% END %]
+        [% END %]
         <p>Nothing found. <a href="javascript: history.back()">Try another search</a>.</p>
     [% END %]
 
index 6dfd8f9..cf40c77 100644 (file)
@@ -6,6 +6,14 @@
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
 
+<script type=text/javascript>
+
+function confirmWriteoffAll() {
+    return confirm(_("Are you sure you want to writeoff all fines?"));
+}
+
+</script>
+
 <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">
@@ -88,8 +96,8 @@
 </table>
 <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" />
+<input type="submit" name="woall"  value="Writeoff All" class="submit" onclick="return confirmWriteoffAll()" />
+<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>
index 08ee909..0682aea 100644 (file)
@@ -94,6 +94,7 @@ function moneyFormat(textObj) {
     <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="itemnumber" id="itemnumber" value="[% itemnumber %]" />
     <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 %]" />
@@ -148,6 +149,7 @@ function moneyFormat(textObj) {
     <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="itemnumber" id="itemnumber" value="[% itemnumber %]" />
     <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 %]" />
index 441c720..7dfb622 100755 (executable)
@@ -67,6 +67,7 @@ if ( $individual || $writeoff ) {
     my $amount            = $input->param('amount');
     my $amountoutstanding = $input->param('amountoutstanding');
     $accountno = $input->param('accountno');
+    my $itemnumber  = $input->param('itemnumber');
     my $description  = $input->param('description');
     my $title        = $input->param('title');
     my $notify_id    = $input->param('notify_id');
@@ -78,6 +79,7 @@ if ( $individual || $writeoff ) {
         amount            => $amount,
         amountoutstanding => $amountoutstanding,
         title             => $title,
+        itemnumber        => $itemnumber,
         description       => $description,
         notify_id         => $notify_id,
         notify_level      => $notify_level,