koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha acqui/acquire.pl acqui/finishreceive.pl ac... [rel_2_2]


From: paul poulain
Subject: [Koha-cvs] koha acqui/acquire.pl acqui/finishreceive.pl ac... [rel_2_2]
Date: Tue, 25 Jul 2006 12:27:56 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_2_2
Changes by:     paul poulain <tipaul>   06/07/25 12:27:55

Modified files:
        acqui          : acquire.pl finishreceive.pl receive.pl 
        C4             : Acquisition.pm 
        koha-tmpl/intranet-tmpl/default/en/acqui: acquire.tmpl 
                                                  recieve.tmpl 

Log message:
        bugfixing for acquisitions :
        In parcels management, the "primary key" is parcel code + datereceived. 
the datereceived was sometimes lost during navigation, causing problems. this 
fix solves the problem
        
        + in Acquisitions.pm, rewritting of a SQL query to LEFT JOIN instead of 
WHERE

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/acquire.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.18.2.5&r2=1.18.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/finishreceive.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.17&r2=1.17.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/acqui/receive.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.13.2.5&r2=1.13.2.6
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Acquisition.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.9.2.17&r2=1.9.2.18
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.15&r2=1.15.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/default/en/acqui/recieve.tmpl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.12.2.3&r2=1.12.2.4

Patches:
Index: acqui/acquire.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/Attic/acquire.pl,v
retrieving revision 1.18.2.5
retrieving revision 1.18.2.6
diff -u -b -r1.18.2.5 -r1.18.2.6
--- acqui/acquire.pl    20 Jun 2006 16:21:42 -0000      1.18.2.5
+++ acqui/acquire.pl    25 Jul 2006 12:27:55 -0000      1.18.2.6
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: acquire.pl,v 1.18.2.5 2006/06/20 16:21:42 oleonard Exp $
+# $Id: acquire.pl,v 1.18.2.6 2006/07/25 12:27:55 tipaul Exp $
 
 #script to recieve orders
 #written by address@hidden 24/2/2000
@@ -41,6 +41,7 @@
 
 my $search=$input->param('recieve');
 my $invoice=$input->param('invoice');
+my $datereceived=$input->param('datereceived');
 my $freight=$input->param('freight');
 my $biblio=$input->param('biblio');
 my $catview=$input->param('catview');
@@ -140,7 +141,7 @@
                supplierid => $results[0]->{'booksellerid'},
                freight => $freight,
                gst => $gst,
-               catview => ($catview ne 'yes'?1:0),
+               catview => ($catview eq 'yes'?1:0),
                name => $booksellers[0]->{'name'},
                date => format_date($date),
                title => $results[0]->{'title'},
@@ -158,6 +159,7 @@
                ecost => $results[0]->{'ecost'},
                unitprice => $results[0]->{'unitprice'},
                invoice => $invoice,
+        datereceived => $datereceived,
                notes => $results[0]->{'notes'},
                intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
@@ -174,6 +176,7 @@
                $line{ordernumber} = $results[$i]->{'ordernumber'};
                $line{biblionumber} = $results[$i]->{'biblionumber'};
                $line{invoice} = $invoice;
+        $line{datereceived} = $datereceived;
                $line{freight} = $freight;
                $line{gst} = $gst;
                $line{title} = $results[$i]->{'title'};
@@ -186,6 +189,7 @@
                                                name => 
$booksellers[0]->{'name'},
                                                supplierid => $supplierid,
                                                invoice => $invoice,
+                        datereceived => $datereceived,
                intranetcolorstylesheet => 
C4::Context->preference("intranetcolorstylesheet"),
                intranetstylesheet => 
C4::Context->preference("intranetstylesheet"),
                IntranetNav => C4::Context->preference("IntranetNav"),

Index: acqui/finishreceive.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/finishreceive.pl,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -b -r1.17 -r1.17.2.1
--- acqui/finishreceive.pl      14 Sep 2004 12:35:55 -0000      1.17
+++ acqui/finishreceive.pl      25 Jul 2006 12:27:55 -0000      1.17.2.1
@@ -38,6 +38,7 @@
 my $quantity=$input->param('quantity');
 my $cost=$input->param('cost');
 my $invoiceno=$input->param('invoice');
+my $datereceived=$input->param('datereceived');
 my $replacement=$input->param('rrp');
 my $gst=$input->param('gst');
 my $freight=$input->param('freight');
@@ -50,7 +51,7 @@
 
 if ($quantity != 0) {
        # save the quantity recieved.
-       
receiveorder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$freight,$replacement);
+    $datereceived = 
receiveorder($biblionumber,$ordnum,$quantrec,$user,$cost,$invoiceno,$datereceived,$freight,$replacement);
        # create items if the user has entered barcodes
        my $barcode=$input->param('barcode');
        my @barcodes=split(/\,| |\|/,$barcode);
@@ -62,7 +63,7 @@
                                        homebranch       => $branch,
                                        loan             => 0 },
                                @barcodes);
-       print 
$input->redirect("/cgi-bin/koha/acqui/receive.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst");
+    print 
$input->redirect("/cgi-bin/koha/acqui/receive.pl?invoice=$invoiceno&supplierid=$supplierid&freight=$freight&gst=$gst&datereceived=$datereceived");
 } else {
        print $input->header;
        delorder($biblionumber,$ordnum);

Index: acqui/receive.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/Attic/receive.pl,v
retrieving revision 1.13.2.5
retrieving revision 1.13.2.6
diff -u -b -r1.13.2.5 -r1.13.2.6
--- acqui/receive.pl    4 Apr 2006 13:32:53 -0000       1.13.2.5
+++ acqui/receive.pl    25 Jul 2006 12:27:55 -0000      1.13.2.6
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: receive.pl,v 1.13.2.5 2006/04/04 13:32:53 tipaul Exp $
+# $Id: receive.pl,v 1.13.2.6 2006/07/25 12:27:55 tipaul Exp $
 
 #script to recieve orders
 #written by address@hidden 24/2/2000
@@ -36,7 +36,7 @@
 my $input=new CGI;
 my $supplierid=$input->param('supplierid');
 my ($count,@booksellers)=bookseller($supplierid);
-my $invoice=$input->param('code') || '';
+my $invoice=$input->param('code') || $input->param('invoice') || '';
 my $freight=$input->param('freight');
 my $gst=$input->param('gst');
 my $date=$input->param('datereceived');
@@ -122,7 +122,7 @@
 $tototal=$tototal+$freight;
 
 $template->param(invoice => $invoice,
-                                               date => $date,
+                                               datereceived => $date,
                                                name => 
$booksellers[0]->{'name'},
                                                supplierid => $supplierid,
                                                gst => $gst,

Index: C4/Acquisition.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisition.pm,v
retrieving revision 1.9.2.17
retrieving revision 1.9.2.18
diff -u -b -r1.9.2.17 -r1.9.2.18
--- C4/Acquisition.pm   15 Jun 2006 09:54:46 -0000      1.9.2.17
+++ C4/Acquisition.pm   25 Jul 2006 12:27:55 -0000      1.9.2.18
@@ -24,6 +24,7 @@
 use MARC::Record;
 use C4::Suggestions;
 # use C4::Biblio;
+use Date::Calc qw(:all);
 
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -317,17 +318,23 @@
 =cut
 #'
 sub receiveorder {
-       my 
($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$freight,$rrp)address@hidden;
+       my 
($biblio,$ordnum,$quantrec,$user,$cost,$invoiceno,$datereceived,$freight,$rrp)address@hidden;
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("update aqorders set 
quantityreceived=?,datereceived=now(),booksellerinvoicenumber=?,
+    unless ($datereceived) {
+        # if datereceived is not set, calculate today date
+        my ($year,$month,$day) = Today();
+        $datereceived = "$year-$month-$day";
+    }
+       my $sth=$dbh->prepare("update aqorders set 
quantityreceived=?,datereceived=?,booksellerinvoicenumber=?,
                                                                                
        unitprice=?,freight=?,rrp=?
                                                        where biblionumber=? 
and ordernumber=?");
        my $suggestionid = findsuggestion_from_biblionumber($dbh,$biblio);
        if ($suggestionid) {
                changestatus($suggestionid,'AVAILABLE','',$biblio);
        }
-       $sth->execute($quantrec,$invoiceno,$cost,$freight,$rrp,$biblio,$ordnum);
+       
$sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblio,$ordnum);
        $sth->finish;
+    return $datereceived;
 }
 
 =item updaterecorder
@@ -660,7 +667,6 @@
                $strsth .= " AND borrowers.branchcode like 
\'".C4::Context->userenv->{branch}."\'" if 
(C4::Context->preference("IndependantBranches") && 
C4::Context->userenv->{flags}!=1);
                $strsth .= " ORDER BY latesince,basketno,borrowers.branchcode, 
supplier";
        }
-       warn "C4::Acquisition : getlateorders SQL:".$strsth;
        my $sth = $dbh->prepare($strsth);
        $sth->execute;
        my @results;
@@ -740,11 +746,11 @@
        my @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
-               aqorders.basketno = aqbasket.basketno
-               and aqbasket.booksellerid = ?
-               and biblio.biblionumber=aqorders.biblionumber
+    my $sth=$dbh->prepare("SELECT 
biblio.*,biblioitems.*,aqorders.*,aqbasket.*,biblio.title from aqorders
+        LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno
+        LEFT JOIN biblioitems ON aqorders.biblioitemnumber = 
biblioitems.biblioitemnumber
+        LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber
+               where aqbasket.booksellerid = ?
                and ((datecancellationprinted is NULL)
                or (datecancellationprinted = '0000-00-00'))
                and (("
@@ -799,7 +805,6 @@
                        }
                }
                $query .=" order by booksellerid";
-               warn "query histearch: ".$query;
                my $sth = $dbh->prepare($query);
                $sth->execute;
                my $cnt=1;
@@ -1075,7 +1080,6 @@
                my $strsth ="Select * from branches ";
                $strsth.= " WHERE branchcode = 
".$dbh->quote(C4::Context->userenv->{branch});
                $strsth.= " order by branchname";
-               warn "C4::Acquisition->branches : ".$strsth;
                $sth=$dbh->prepare($strsth);
        } else {
        $sth = $dbh->prepare("Select * from branches order by branchname");

Index: koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -b -r1.15 -r1.15.2.1
--- koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl       2 Dec 2004 
16:40:12 -0000       1.15
+++ koha-tmpl/intranet-tmpl/default/en/acqui/acquire.tmpl       25 Jul 2006 
12:27:55 -0000      1.15.2.1
@@ -75,6 +75,7 @@
                                <label class="label100">Invoice Number</label>
                                        <!-- TMPL_VAR NAME="invoice" -->
                                        <input type="hidden" name="invoice" 
value="<!-- TMPL_VAR NAME="invoice" -->">
+                <input type="hidden" name="datereceived" value="<!-- TMPL_VAR 
NAME="datereceived" -->">
                        </p>
                        <p>
                                <label class="label100">Notes</label>

Index: koha-tmpl/intranet-tmpl/default/en/acqui/recieve.tmpl
===================================================================
RCS file: 
/cvsroot/koha/koha/koha-tmpl/intranet-tmpl/default/en/acqui/recieve.tmpl,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -u -b -r1.12.2.3 -r1.12.2.4
--- koha-tmpl/intranet-tmpl/default/en/acqui/recieve.tmpl       4 Apr 2006 
13:56:45 -0000       1.12.2.3
+++ koha-tmpl/intranet-tmpl/default/en/acqui/recieve.tmpl       25 Jul 2006 
12:27:55 -0000      1.12.2.4
@@ -7,8 +7,7 @@
        
        <div id="bloc25">
                Invoice: <!-- TMPL_VAR NAME="invoice" --><br>
-               Received By: <!-- TMPL_VAR NAME="user" --><br>
-               <!-- TMPL_VAR NAME="date" -->
+        <!-- TMPL_VAR name="datereceived"-->
        </div>
        
        <div id="bloc25">
@@ -30,7 +29,7 @@
                <!-- TMPL_LOOP NAME="loop_received" -->
                        <tr bgcolor="<!-- TMPL_VAR NAME="color" -->">
                                <td class="number"><!-- TMPL_VAR 
NAME="basketno" --></td>
-                               <td><a href="acquire.pl?recieve=<!-- TMPL_VAR 
NAME="ordernumber" -->&amp;biblio=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR 
NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- 
TMPL_VAR NAME="supplierid" -->&catview=yes"><!-- TMPL_VAR NAME="title" 
--></a></td>
+                               <td><a href="acquire.pl?recieve=<!-- TMPL_VAR 
NAME="ordernumber" -->&amp;biblio=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR 
NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- 
TMPL_VAR NAME="supplierid" -->&catview=yes&datereceived=<!-- TMPL_VAR 
name="datereceived" -->"><!-- TMPL_VAR NAME="title" --></a></td>
                                <td><!-- TMPL_VAR NAME="ecost" --></td>
                                <td><!-- TMPL_VAR NAME="quantity" --></td>
                                <td></td>
@@ -88,7 +87,7 @@
                        <tr bgcolor="<!-- TMPL_VAR NAME="color" -->">
                                <td class="number"><!-- TMPL_VAR 
NAME="basketno" --></td>
                                <td><!-- TMPL_VAR NAME="title" --></td>
-                               <td><a href="acquire.pl?recieve=<!-- TMPL_VAR 
NAME="ordernumber" -->&amp;biblio=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR 
NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- 
TMPL_VAR NAME="supplierid" -->" class="button acquisition">Recieve</td>
+                <td><a href="acquire.pl?recieve=<!-- TMPL_VAR 
NAME="ordernumber" -->&amp;biblio=<!-- TMPL_VAR NAME="biblionumber" 
-->&amp;invoice=<!-- TMPL_VAR NAME="invoice" -->&amp;gst=<!-- TMPL_VAR 
NAME="gst" -->&amp;freight=<!-- TMPL_VAR NAME="freight" -->&amp;supplierid=<!-- 
TMPL_VAR NAME="supplierid" -->&amp;datereceived=<!-- TMPL_VAR 
name="datereceived"-->&catview=yes" class="button acquisition">Recieve</td>
                        </tr>
                <!-- /TMPL_LOOP -->
        </table>




reply via email to

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