Bugzilla – Attachment 111248 Details for
Bug 23376
Cleanup order receive page code
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23376: Move AcqCreateItem logic to template
Bug-23376-Move-AcqCreateItem-logic-to-template.patch (text/plain), 8.05 KB, created by
Martin Renvoize (ashimema)
on 2020-10-05 15:48:43 UTC
(
hide
)
Description:
Bug 23376: Move AcqCreateItem logic to template
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-05 15:48:43 UTC
Size:
8.05 KB
patch
obsolete
>From 918c9c9f43bf872c56495ab5b74dffa2a107d656 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 29 Jul 2019 20:05:42 +0000 >Subject: [PATCH] Bug 23376: Move AcqCreateItem logic to template > >Signed-off-by: Agustin Moyano <agustinmoyano@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > acqui/orderreceive.pl | 42 ++----------------- > .../prog/en/modules/acqui/orderreceive.tt | 21 +++++----- > 2 files changed, 14 insertions(+), 49 deletions(-) > >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 7702b34fcd..49b923134e 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -118,42 +118,6 @@ unless($acq_fw) { > $template->param('NoACQframework' => 1); > } > >-my $AcqCreateItem = $basket->effective_create_items; >-if ($AcqCreateItem eq 'receiving') { >- $template->param( >- AcqCreateItemReceiving => 1, >- UniqueItemFields => C4::Context->preference('UniqueItemFields'), >- ); >-} elsif ($AcqCreateItem eq 'ordering') { >- my $fw = ($acq_fw) ? 'ACQ' : ''; >- my $items = $order->items; >- $template->param(items => $items); >-} >- >-$order->quantityreceived = '' if $order->quantityreceived == 0; >- >-my $unitprice = $order->unitprice; >-my ( $rrp, $ecost ); >-if ( $bookseller->invoiceincgst ) { >- $rrp = $order->rrp_tax_included; >- $ecost = $order->ecost_tax_included; >- unless ( $unitprice != 0 and defined $unitprice) { >- $unitprice = $order->ecost_tax_included; >- } >-} else { >- $rrp = $order->rrp_tax_excluded; >- $ecost = $order->ecost_tax_excluded; >- unless ( $unitprice != 0 and defined $unitprice) { >- $unitprice = $order->ecost_tax_excluded; >- } >-} >- >-my $tax_rate; >-if( defined $order->tax_rate_on_receiving ) { >- $tax_rate = $order->tax_rate_on_receiving + 0.0; >-} else { >- $tax_rate = $order->tax_rate_on_ordering + 0.0; >-} > > my $creator = Koha::Patrons->find( $order->created_by ); > >@@ -188,7 +152,6 @@ if ( $order->subscriptionid ) { > } > > $template->param( >- AcqCreateItem => $AcqCreateItem, > count => 1, > order => $order, > freight => $freight, >@@ -197,8 +160,6 @@ $template->param( > currencies => scalar $currencies->search({ rate => { '!=' => 1 } }), > invoiceincgst => $bookseller->invoiceincgst, > bookfund => $budget->{budget_name}, >- rrp => $rrp, >- ecost => $ecost, > creator => $creator, > invoiceid => $invoice->{invoiceid}, > invoice => $invoice->{invoicenumber}, >@@ -225,6 +186,9 @@ foreach my $period (@$periods) { > my @funds; > foreach my $r ( @{$budget_hierarchy} ) { > next unless ( CanUserUseBudget( $patron, $r, $userflags ) ); >+ if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) { >+ next; >+ } > push @funds, > { > b_id => $r->{budget_id}, >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 899b595e91..da0c20f666 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -19,6 +19,7 @@ > > <div class="main container-fluid"> > <div class="row"> >+ [% AcqCreateItem = order.basket.effective_create_items %] > <div class="col-sm-10 col-sm-push-2"> > <main> > >@@ -141,7 +142,7 @@ > </tbody> > </table> > </fieldset> >- [% ELSIF (AcqCreateItemReceiving) %] >+ [% ELSIF (AcqCreateItem == 'receiving') %] > <div id="items_list" style="display:none"> > <p><strong>Items list</strong></p> > <div style="width:100%;overflow:auto;"> >@@ -184,7 +185,7 @@ > </fieldset> > [% END %] > [% ELSIF (AcqCreateItem == 'ordering') %] >- [% IF (items.count) %] >+ [% IF (order.items.size) %] > <h5>Items</h5> > <div style="width:100%;overflow:auto"> > <table> >@@ -208,7 +209,7 @@ > </tr> > </thead> > <tbody> >- [% FOREACH item IN items %] >+ [% FOREACH item IN order.items %] > <tr id="item_[% item.itemnumber | html %]"> > <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td> > <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td> >@@ -277,7 +278,7 @@ > [% IF order.subscriptionid %] > <input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantity | html %]" /> > <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> >- [% ELSIF AcqCreateItemReceiving %] >+ [% ELSIF AcqCreateItem == 'receiving' %] > <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" /> > [% ELSE %] > [% IF ( order.quantityreceived ) %] >@@ -285,7 +286,7 @@ > <input type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived | html %]" /> > <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% order.quantityreceived | html %]" /> > [% ELSE %] >- [% IF ( items ) %] >+ [% IF ( order.items.count ) %] > <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% order.quantityreceived + 1 | html %]" /> > [% ELSE %] > <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived + 1 | html %]" /> >@@ -300,7 +301,7 @@ > <p class="error">Warning, you have entered more items than expected. > Items will not be created.</p> > </div> >- [% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItemReceiving) %] >+ [% END %][%# IF (order.subscriptionid) ELSIF (AcqCreateItem == 'receiving' ) %] > </li> > > [% IF ( gst_values ) %] >@@ -391,7 +392,7 @@ > [% Asset.js("js/cataloging.js") | $raw %] > <script> > function Check(form) { >- [% IF (AcqCreateItemReceiving) %] >+ [% IF (AcqCreateItem == 'receiving') %] > var total_errors = CheckMandatorySubfields(form); > if (total_errors != 0) { > var alertString = _("Form not submitted because of the following problem(s)"); >@@ -401,7 +402,7 @@ > return false; > } > >- if(check_additem('[% UniqueItemFields | html %]') == false){ >+ if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ > alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); > return false; > }; >@@ -419,7 +420,7 @@ > $(lastitemblock).remove(); > } > >- if(check_additem('[% UniqueItemFields | html %]') == false){ >+ if(check_additem('[% Koha.Preference("UniqueItemFields") | html %]') == false){ > alert(_("Duplicate values detected. Please correct the errors and resubmit.") ); > if(tobedeleted) { > $(lastitemblock).appendTo("#outeritemblock"); >@@ -478,7 +479,7 @@ > [% END %] > > $(document).ready(function() { >- [% IF (AcqCreateItemReceiving) %] >+ [% IF (AcqCreateItem == 'receiving') %] > cloneItemBlock(0, '[% UniqueItemFields | html %]'); > [% ELSIF (AcqCreateItem == 'ordering') && not order.subscriptionid %] > $("input[name='items_to_receive']").change(function() { >-- >2.20.1
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 23376
:
91774
|
91857
|
91858
|
110692
|
110693
|
110694
|
111247
| 111248 |
111249
|
111250
|
111378
|
111750
|
131857