Bugzilla – Attachment 40132 Details for
Bug 12395
Save order line's creator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12395: Save order line's creator
Bug-12395-Save-order-lines-creator.patch (text/plain), 10.36 KB, created by
Alex Arnaud
on 2015-06-15 10:06:26 UTC
(
hide
)
Description:
Bug 12395: Save order line's creator
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2015-06-15 10:06:26 UTC
Size:
10.36 KB
patch
obsolete
>From f710239ac8b8773774dce4d7740abbfba5516cb7 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Mon, 9 Jun 2014 16:15:17 +0200 >Subject: [PATCH] Bug 12395: Save order line's creator > >New MySQL column: aqorders.createdby > >Creator's name is displayed on order's receive pages (acqui/orderreceive.pl >and acqui/parcel.pl) > >On acqui/orderreceive.pl it replace the name of basket's creator >On acqui/parcel.pl, to avoid adding more data in the table of pending >orders, it is shown in a popup like MARC and Card views > >Test plan: >1/ Run updatedatabase.pl >2/ Create a new order and go to the receipt page (acqui/parcel.pl) >3/ Click on "Order" link in column "More" (previously "View record") >4/ A javascript popup should appear with your name in it. Close the >popup. >5/ Click on "Receive" link >6/ Your name should appear in front of "Created by" label, to the right >of the page. > >Patch updated with use of atomic update. >--- > Koha/Acquisition/Order.pm | 7 ++++ > acqui/orderreceive.pl | 6 +-- > acqui/showorder.pl | 44 ++++++++++++++++++++ > .../Bug-12395-add-column-aqorders.created_by.sql | 2 + > installer/data/mysql/kohastructure.sql | 1 + > .../prog/en/modules/acqui/orderreceive.tt | 14 ++++++- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 8 +++- > .../prog/en/modules/acqui/showorder.tt | 38 +++++++++++++++++ > 8 files changed, 113 insertions(+), 7 deletions(-) > create mode 100755 acqui/showorder.pl > create mode 100644 installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index 15b9867..df5d315 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -32,6 +32,13 @@ sub insert { > unless $self->{$key}; > } > >+ if (not defined $self->{created_by}) { >+ my $userenv = C4::Context->userenv; >+ if ($userenv) { >+ $self->{created_by} = $userenv->{number}; >+ } >+ } >+ > $self->{quantityreceived} ||= 0; > $self->{entrydate} ||= > output_pref( { dt => dt_from_string, dateformat => 'iso' } ); >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 96a6a02..6ccb74c 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -191,8 +191,7 @@ if ( $bookseller->{listincgst} ) { > > my $suggestion = GetSuggestionInfoFromBiblionumber($order->{biblionumber}); > >-my $authorisedby = $order->{authorisedby}; >-my $member = GetMember( borrowernumber => $authorisedby ); >+my $creator = GetMember( borrowernumber => $order->{created_by} ); > > my $budget = GetBudget( $order->{budget_id} ); > >@@ -217,8 +216,7 @@ $template->param( > quantityreceived => $order->{'quantityreceived'}, > rrp => sprintf( "%.2f", $rrp ), > ecost => sprintf( "%.2f", $ecost ), >- memberfirstname => $member->{firstname} || "", >- membersurname => $member->{surname} || "", >+ creator => $creator, > invoiceid => $invoice->{invoiceid}, > invoice => $invoice->{invoicenumber}, > datereceived => $datereceived->output(), >diff --git a/acqui/showorder.pl b/acqui/showorder.pl >new file mode 100755 >index 0000000..2c92ea0 >--- /dev/null >+++ b/acqui/showorder.pl >@@ -0,0 +1,44 @@ >+#!/usr/bin/perl >+ >+# 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 3 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 Modern::Perl; >+use CGI; >+ >+use C4::Auth; >+use C4::Acquisition; >+use C4::Members; >+use C4::Output; >+ >+my $cgi = new CGI; >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => "acqui/showorder.tt", >+ query => $cgi, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { acquisition => '*' }, >+}); >+ >+my $ordernumber = $cgi->param('ordernumber'); >+my $order = GetOrder($ordernumber); >+my $creator = GetMember(borrowernumber => $order->{created_by}); >+ >+$template->param( >+ order => $order, >+ creator => $creator, >+); >+ >+output_html_with_http_headers $cgi, $cookie, $template->output; >diff --git a/installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql b/installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql >new file mode 100644 >index 0000000..4d2a0fb >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug-12395-add-column-aqorders.created_by.sql >@@ -0,0 +1,2 @@ >+ALTER TABLE aqorders ADD COLUMN created_by int(11) NULL DEFAULT NULL AFTER quantityreceived; >+UPDATE aqorders, aqbasket SET aqorders.created_by = aqbasket.authorisedby WHERE aqorders.basketno = aqbasket.basketno; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index cd83f99..4f99511 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3052,6 +3052,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items > `freight` decimal(28,6) default NULL, -- shipping costs (not used) > `unitprice` decimal(28,6) default NULL, -- the actual cost entered when receiving this line item > `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far >+ `created_by` int(11) NULL DEFAULT NULL, -- the borrowernumber of order line's creator > `datecancellationprinted` date default NULL, -- the date the line item was deleted > `cancellationreason` text default NULL, -- reason of cancellation > `order_internalnote` mediumtext, -- notes related to this order line, made for staff >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 833f0e6..121d046 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -279,7 +279,19 @@ > [% END %] > </select></li> > <li><label> </label><span>(Current: [% budget_period_description %] - [% bookfund %])</span></li> >- <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li> >+ <li> >+ <label for="creator">Created by: </label> >+ <span> >+ [% IF (creator && creator.firstname && creator.surname) %] >+ [% IF creator.firstname %] >+ [% creator.firstname %] >+ [% END %] >+ [% creator.surname %] >+ [% ELSE %] >+ No name >+ [% END %] >+ </span> >+ </li> > <li><label for="quantity_to_receive">Quantity to receive: </label><span class="label"> > [% IF ( edit and not subscriptionid) %] > <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" /> >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 a244f5f..9700964 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -231,7 +231,7 @@ > <th>Basket group</th> > <th>Order line</th> > <th>Summary</th> >- <th>View record</th> >+ <th>More</th> > <th>Quantity</th> > <th>Unit cost</th> > <th>Order cost</th> >@@ -274,7 +274,11 @@ > [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=vendor">Add vendor note</a>] > [% END %] > </td> >- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> >+ <td> >+ <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% loop_order.ordernumber %]" title="Order" rel="gb_page_center[600,500]">Order</a><br> >+ <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a><br> >+ <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a> >+ </td> > <td>[% loop_order.quantity %]</td> > <td>[% loop_order.ecost | $Price %]</td> > <td>[% loop_order.total | $Price %]</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt >new file mode 100644 >index 0000000..b872b20 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/showorder.tt >@@ -0,0 +1,38 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<style> >+ td { >+ padding: 0 1em; >+ } >+ td:first-child { >+ font-weight: bold; >+ text-align: right; >+ } >+</style> >+</head> >+<body> >+ [% IF order %] >+ <table> >+ <tbody> >+ <tr> >+ <td>Creation date</td> >+ <td>[% order.entrydate %]</td> >+ </tr> >+ <tr> >+ <td>Creator</td> >+ <td>[% creator.firstname %] [% creator.surname %]</td> >+ </tr> >+ <tr> >+ <td>Claims count</td> >+ <td>[% order.claims_count %]</td> >+ </tr> >+ <tr> >+ <td>Last claim date</td> >+ <td>[% order.claimed_date %]</td> >+ </tr> >+ </tbody> >+ </table> >+ [% ELSE %] >+ No order found. >+ [% END %] >+</body> >+</html> >-- >1.7.10.4
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 12395
:
28754
|
28943
|
30128
|
30129
|
31409
|
31410
|
31411
|
33837
|
33838
|
33839
|
35769
|
35770
|
35771
|
35772
|
35779
|
35780
|
35781
|
35782
|
35864
|
36063
|
36075
|
36076
|
36077
|
36078
|
36079
|
36080
|
40132
|
40133
|
40134
|
40135
|
40136
|
40137
|
40138
|
40139
|
40161
|
43951
|
45387
|
58745
|
58746
|
58747
|
58748
|
58749
|
58750
|
61383
|
61384
|
71344
|
71345
|
71346
|
71347
|
71348
|
71349
|
72720
|
72721
|
72722
|
72723
|
72724
|
72725
|
74207
|
74208
|
74209
|
74210
|
74211
|
74212
|
74276
|
74277
|
74278
|
74279
|
74280
|
74281
|
74282
|
75900
|
75901
|
75902
|
75903
|
75904
|
75905
|
75906
|
75907
|
76074
|
76075
|
76076
|
76077
|
76078
|
76079
|
76080
|
76081
|
76082
|
76083
|
76084
|
76085
|
76086
|
76087
|
76088
|
76089