Bugzilla – Attachment 8961 Details for
Bug 5349
Moving an order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Order line transfers
0001-Bug-5349-Order-line-transfers.patch (text/plain), 9.34 KB, created by
Julian Maurice
on 2012-04-06 15:00:22 UTC
(
hide
)
Description:
Order line transfers
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-04-06 15:00:22 UTC
Size:
9.34 KB
patch
obsolete
>From d481f6a2c8670a743aae896b5b1a7d8ba48d3a6f Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 6 Apr 2012 16:57:12 +0200 >Subject: [PATCH] Bug 5349: Order line transfers > >On basket.pl and parcel.pl there is a 'Transfer' link which allow you to >transfer order lines from a basket to another. >The link lead to a new page which allow you to search for a bookseller, >then display this bookseller's baskets. Then you can pickup a basket and >the transfer will be done. >This add a message in new column aqorders.internalnotes which is >displayed in basket.pl >--- > C4/Acquisition.pm | 73 +++++++++++++++++++- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 +++ > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 6 ++ > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 9 ++- > 5 files changed, 95 insertions(+), 4 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index bebc3a8..2d2c536 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -55,7 +55,7 @@ BEGIN { > &GetOrderNumber &GetLateOrders &GetOrderFromItemnumber > &SearchOrder &GetHistory &GetRecentAcqui > &ModReceiveOrder &ModOrderBiblioitemNumber >- &GetCancelledOrders >+ &GetCancelledOrders &TransferOrder > > &NewOrderItem &ModOrderItem > >@@ -1295,6 +1295,77 @@ sub DelOrder { > > } > >+=head3 TransferOrder >+ >+ my $newordernumber = TransferOrder($ordernumber, $basketno); >+ >+Transfer an order line to a basket. >+Mark $ordernumber as cancelled with an internal note 'Cancelled and transfered >+to BOOKSELLER on DATE' and create new order with internal note >+'Transfered from BOOKSELLER on DATE'. >+Move all attached items to the new order. >+Received orders cannot be transfered. >+Return the ordernumber of created order. >+ >+=cut >+ >+sub TransferOrder { >+ my ($ordernumber, $basketno) = @_; >+ >+ return unless $ordernumber or $basketno; >+ >+ my $order = GetOrder( $ordernumber ); >+ return if $order->{datereceived}; >+ >+ my $today = C4::Dates->new()->output("iso"); >+ my $query = qq{ >+ SELECT aqbooksellers.name >+ FROM aqorders >+ LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno >+ LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id >+ WHERE aqorders.ordernumber = ? >+ }; >+ my $dbh = C4::Context->dbh; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($ordernumber); >+ my ($booksellerfromname) = $sth->fetchrow_array; >+ >+ $query = qq{ >+ SELECT aqbooksellers.name >+ FROM aqbasket >+ LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id >+ WHERE aqbasket.basketno = ? >+ }; >+ $sth = $dbh->prepare($query); >+ $sth->execute($basketno); >+ my ($booksellertoname) = $sth->fetchrow_array; >+ >+ $query = qq{ >+ UPDATE aqorders >+ SET datecancellationprinted = CAST(NOW() AS date), >+ internalnotes = ? >+ WHERE ordernumber = ? >+ }; >+ $sth = $dbh->prepare($query); >+ $sth->execute("Cancelled and transfered to $booksellertoname on $today", $ordernumber); >+ >+ delete $order->{'ordernumber'}; >+ $order->{'basketno'} = $basketno; >+ $order->{'internalnotes'} = "Transfered from $booksellerfromname on $today"; >+ my $newordernumber; >+ (undef, $newordernumber) = NewOrder($order); >+ >+ $query = qq{ >+ UPDATE aqorders_items >+ SET ordernumber = ? >+ WHERE ordernumber = ? >+ }; >+ $sth = $dbh->prepare($query); >+ $sth->execute($newordernumber, $ordernumber); >+ >+ return $newordernumber; >+} >+ > =head2 FUNCTIONS ABOUT PARCELS > > =cut >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4912e19..950259e 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2722,6 +2722,7 @@ CREATE TABLE `aqorders` ( > `cancelledby` varchar(10) default NULL, > `datecancellationprinted` date default NULL, > `notes` mediumtext, >+ internalnotes mediumtext DEFAULT NULL, > `supplierreference` mediumtext, > `purchaseordernumber` mediumtext, > `subscription` tinyint(1) default NULL, >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 503c8ee..d564aa6 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5146,6 +5146,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do(qq{ >+ ALTER TABLE aqorders >+ ADD COLUMN internalnotes MEDIUMTEXT DEFAULT NULL AFTER notes >+ }); >+ print "Upgrade to $DBversion done (Add internalnotes field in aqorders table)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >index 0cf7ff6..c660197 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -297,6 +297,7 @@ > [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Add note</a>] > [% END %] > </p> >+ <p>[% books_loo.internalnotes %]</p> > </td> > <td class="number">[% books_loo.rrp %]</td> > <td class="number">[% books_loo.ecost %]</td> >@@ -307,6 +308,10 @@ > [% UNLESS ( closedate ) %] > <td> > <a href="neworderempty.pl?ordernumber=[% books_loo.ordernumber %]&booksellerid=[% booksellerid %]&basketno=[% basketno %]">Modify</a> >+ [% UNLESS (books_loo.order_received) %] >+ <br /> >+ <a href="/cgi-bin/koha/acqui/transferorder.pl?ordernumber=[% books_loo.ordernumber %]&referrer=[% "/cgi-bin/koha/acqui/basket.pl?basketno=$basketno" | uri %]">Transfer</a> >+ [% END %] > </td> > <td> > [% IF ( books_loo.left_holds_on_order ) %] >@@ -378,6 +383,7 @@ > [% IF ( order.publicationyear ) %], [% order.publicationyear %][% END %] > [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %] > </p> >+ <p>[% order.internalnotes %]</p> > </td> > <td><p>[% order.rrp %]</p></td> > <td><p>[% order.ecost %]</p></td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index a5d3e1a..265c99e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -106,9 +106,10 @@ > + '<td>' + order.ecost + '</td>' > + '<td>' + order.ordertotal + '</td>' > + '<td>' >- + '<a href="orderreceive.pl?ordernumber=' + order.ordernumber + '&datereceived=[% invoicedatereceived %]&invoice=[% invoice %]&gst=' + gst + '&freight=' + order.freight + '&booksellerid=[% booksellerid %]">Receive</a> /' >- + '<a href="parcel.pl?type=intra&ordernumber=' + order.ordernumber + '&biblionumber=' + order.biblionumber + '&action=cancelorder&booksellerid=[% booksellerid %]&datereceived=[% invoicedatereceived %]&invoice=[% invoice %]" onclick="return confirm(\'' + _('Are you sure you want to cancel this order?') + '\');">Cancel</a>' >- + '</td></tr>').appendTo("table#pendingt"); >+ + '<a href="orderreceive.pl?ordernumber=' + order.ordernumber + '&datereceived=[% invoicedatereceived %]&invoice=[% invoice %]&gst=' + gst + '&freight=' + order.freight + '&booksellerid=[% booksellerid %]">Receive</a>' >+ + '<br />' >+ + '<a href="/cgi-bin/koha/acqui/transferorder.pl?ordernumber=[% loop_order.ordernumber %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?booksellerid=$booksellerid&datereceived=$invoicedatereceived&invoice=$invoice" | uri %]">Transfer</a>' >+ + '</td><td></td></tr>').appendTo("table#pendingt"); > } > > // If nothing has been found, we tell the user so >@@ -259,6 +260,8 @@ > <td>[% loop_order.ordertotal %]</td> > <td> > <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&datereceived=[% loop_order.invoicedatereceived %]&invoice=[% loop_order.invoice %]&gst=[% loop_order.gst %]&freight=[% loop_order.freight %]&booksellerid=[% loop_order.booksellerid %]">Receive</a> >+ <br /> >+ <a href="/cgi-bin/koha/acqui/transferorder.pl?ordernumber=[% loop_order.ordernumber %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?booksellerid=$booksellerid&datereceived=$invoicedatereceived&invoice=$invoice" | uri %]">Transfer</a> > > </td> > <td> >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5349
:
8961
|
8962
|
9909
|
10032
|
10190
|
10375
|
10376
|
10441
|
10462
|
10463
|
10636
|
11117
|
11118
|
11385
|
11386
|
12236
|
12237
|
12238
|
12420
|
12421
|
12422
|
12462
|
12463
|
12464
|
14441
|
14442
|
14443
|
16499
|
16500
|
16501
|
18931
|
18933
|
18934
|
18935
|
19332
|
19333
|
19336
|
19917
|
19918
|
19919
|
19920
|
19921
|
19922
|
20476
|
20477
|
20478
|
20479
|
20480
|
20481
|
20691
|
20692
|
20693
|
20694
|
20695
|
20696