koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Acquisition.pm


From: Chris Cormack
Subject: [Koha-cvs] koha/C4 Acquisition.pm
Date: Wed, 07 Jun 2006 00:07:59 +0000

CVSROOT:        /sources/koha
Module name:    koha
Changes by:     Chris Cormack <rangi>   06/06/07 00:07:59

Modified files:
        C4             : Acquisition.pm 

Log message:
        Katipo merging work
        
        Fixes for the ordersearch

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Acquisition.pm?cvsroot=koha&r1=1.28&r2=1.29

Patches:
Index: Acquisition.pm
===================================================================
RCS file: /sources/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- Acquisition.pm      6 Jun 2006 23:18:12 -0000       1.28
+++ Acquisition.pm      7 Jun 2006 00:07:59 -0000       1.29
@@ -29,7 +29,7 @@
 use vars qw($VERSION @ISA @EXPORT);
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.28 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.29 $' =~ /\d+/g; shift(@v) . "." . join( 
"_", map { sprintf "%03d", $_ } @v ); };
 
 # used in reciveorder subroutine
 # to provide library specific handling
@@ -397,6 +397,17 @@
     $sth->execute( $quantrec, $invoiceno, $cost, $freight, $rrp, $biblio,
         $ordnum );
     $sth->finish;
+
+    # Allows libraries to change their bookfund during receiving orders
+    # allows them to adjust budgets
+    if ( C4::Context->preferene("LooseBudgets") ) {
+        my $sth = $dbh->prepare(
+"UPDATE aqorderbreakdown SET bookfundid=?                                      
                                                                   
+                           WHERE ordernumber=?"
+        );
+        $sth->execute( $bookfund, $ordnum );
+        $sth->finish;
+    }
 }
 
 =item updaterecorder
@@ -860,35 +871,53 @@
     my ( $search, $id, $biblio, $catview ) = @_;
     my $dbh         = C4::Context->dbh;
     my @data        = split( ' ', $search );
-    my @searchterms = ($id);
+    my @searchterms;
+    if ($id) {
+        @searchterms = ($id);
+    }
     map { push( @searchterms, "$_%", "% $_%" ) } @data;
     push( @searchterms, $search, $search, $biblio );
-    my $sth = $dbh->prepare(
-"Select biblio.*,biblioitems.*,aqorders.*,aqbasket.*,biblio.title from 
aqorders,biblioitems,biblio,aqbasket
-               where aqorders.biblioitemnumber = biblioitems.biblioitemnumber 
and
+    my $query;
+    if ($id) {
+        $query =
+          "SELECT *,biblio.title FROM aqorders,biblioitems,biblio,aqbasket
+  WHERE aqorders.biblioitemnumber = biblioitems.biblioitemnumber AND
                aqorders.basketno = aqbasket.basketno
-               and aqbasket.booksellerid = ?
-               and biblio.biblionumber=aqorders.biblionumber
-               and ((datecancellationprinted is NULL)
-               or (datecancellationprinted = '0000-00-00'))
-               and (("
+  AND aqbasket.booksellerid = ?
+  AND biblio.biblionumber=aqorders.biblionumber
+  AND ((datecancellationprinted is NULL)
+      OR (datecancellationprinted = '0000-00-00'))
+  AND (("
           . (
-            join( " and ",
+            join( " AND ",
                 map { "(biblio.title like ? or biblio.title like ?)" } @data )
           )
-          . ") or biblioitems.isbn=? or (aqorders.ordernumber=? and 
aqorders.biblionumber=?)) "
+          . ") OR biblioitems.isbn=? OR (aqorders.ordernumber=? AND 
aqorders.biblionumber=?)) ";
+
+    }
+    else {
+        $query =
+          "SELECT *,biblio.title FROM aqorders,biblioitems,biblio,aqbasket
+  WHERE aqorders.biblioitemnumber = biblioitems.biblioitemnumber AND
+  aqorders.basketno = aqbasket.basketno
+  AND biblio.biblionumber=aqorders.biblionumber
+  AND ((datecancellationprinted is NULL)
+      OR (datecancellationprinted = '0000-00-00'))
+  AND (aqorders.quantityreceived < aqorders.quantity OR 
aqorders.quantityreceived is NULL)
+  AND (("
           . (
-            ( $catview ne 'yes' )
-            ? " and (quantityreceived < quantity or quantityreceived is NULL)"
-            : ""
+            join( " AND ",
+                map { "(biblio.title like ? OR biblio.title like ?)" } @data )
           )
-          . " group by aqorders.ordernumber"
-    );
+          . ") or biblioitems.isbn=? OR (aqorders.ordernumber=? AND 
aqorders.biblionumber=?)) ";
+    }
+    $query .= " GROUP BY aqorders.ordernumber";
+    my $sth = $dbh->prepare($query);
     $sth->execute(@searchterms);
     my @results = ();
-    my $sth2    = $dbh->prepare("Select * from biblio where biblionumber=?");
+    my $sth2    = $dbh->prepare("SELECT * FROM biblio WHERE biblionumber=?");
     my $sth3    =
-      $dbh->prepare("Select * from aqorderbreakdown where ordernumber=?");
+      $dbh->prepare("SELECT * FROM aqorderbreakdown WHERE ordernumber=?");
     while ( my $data = $sth->fetchrow_hashref ) {
         $sth2->execute( $data->{'biblionumber'} );
         my $data2 = $sth2->fetchrow_hashref;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]