Bugzilla – Attachment 165525 Details for
Bug 18360
Allow deletion of cancelled order lines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18360: Allow to delete a cancelled order from open basket
Bug-18360-Allow-to-delete-a-cancelled-order-from-o.patch (text/plain), 5.49 KB, created by
Martin Renvoize (ashimema)
on 2024-04-25 11:37:19 UTC
(
hide
)
Description:
Bug 18360: Allow to delete a cancelled order from open basket
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-25 11:37:19 UTC
Size:
5.49 KB
patch
obsolete
>From e432f235f5f45e2a3f687406f43a521833e4b62f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 20 Feb 2024 12:52:43 +0000 >Subject: [PATCH] Bug 18360: Allow to delete a cancelled order from open basket > >Doing this under flag of order_manage and not on the higher level >of baskets. > >Starting here with a single order delete for cancelled lines. So >deleting an open order line requires cancelling it first. Can be >extended later if needed. > >Test plan: >Pick an open basket with cancelled lines. >Try to delete a few lines. >Test that you cannot do this on an closed basket. (Bonus: manipulate >URL with basketno, ordernumber and op=cud-delete-order.) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > acqui/basket.pl | 17 ++++++++++++- > .../prog/en/modules/acqui/basket.tt | 25 ++++++++++++++++++- > 2 files changed, 40 insertions(+), 2 deletions(-) > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 6401125d011..7f8aac76345 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -118,7 +118,22 @@ $template->param( skip_confirm_reopen => 1) if $confirm_pref eq '2'; > > my @messages; > >-if ( $op eq 'cud-delete_confirm' ) { >+if ( $op eq 'cud-delete-order' ) { >+ output_and_exit( $query, $cookie, $template, 'insufficient_permission' ) >+ unless $logged_in_patron->has_permission( { acquisition => 'order_manage' } ); >+ >+ # We only allow deleting cancelled line without biblionumber for now >+ my $ordernumber = $query->param('ordernumber'); >+ my $order = Koha::Acquisition::Orders->search( >+ { >+ biblionumber => undef, >+ ordernumber => $ordernumber, orderstatus => 'cancelled' >+ } >+ ); >+ $order->delete if $order; >+ $op = 'list'; >+ >+} elsif ( $op eq 'cud-delete_confirm' ) { > > output_and_exit( $query, $cookie, $template, 'insufficient_permission' ) > unless $logged_in_patron->has_permission( { acquisition => 'delete_baskets' } ); >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 fdadf42c668..a42c1e8e5f2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -778,6 +778,7 @@ > <th>GST %</th> > <th>GST</th> > <th>Fund</th> >+ <th>Delete order</th> > </tr> > </thead> > <tbody> >@@ -838,11 +839,19 @@ > <td class="number">[% order.total_tax_included | $Price %]</td> > <td class="number">[% order.tax_rate * 100 | html %]</td> > <td class="number">[% order.tax_value | $Price %]</td> >- <td>[% order.budget_name | html %] >+ <td>[% order.budget_name | html %]</td> >+ <td> >+ [% UNLESS closedate %]<a class="delete_order" href="#" data-ordernumber="[% order.ordernumber | html %]" data-biblionumber="[% order.biblionumber | html %]">Delete</a>[% END %] >+ </td> > </tr> > [% END # /FOREACH order %] > </tbody> > </table> <!-- /#cancelledorderst --> >+ <form id="delete_order_form" method="post"> >+ <input type="hidden" name="op" value="cud-delete-order"/> >+ <input type="hidden" name="ordernumber" value=""/> >+ <input type="hidden" name="basketno" value="[% basketno | html %]"/> >+ </form> > </div> <!-- /#cancelledorders --> > [% END # /IF (cancelledorders_loop) %] > <br /> >@@ -1107,6 +1116,20 @@ > window.location = "/cgi-bin/koha/acqui/basket.pl?op=edi_confirm&basketno=[% basketno | html %]"; > } > } >+ >+ $(document).ready(function() { >+ $(".delete_order").on('click', function(e) { >+ e.preventDefault(); >+ if( $(this).data('biblionumber') ) { >+ alert( _("Please delete the linked bibliographic record first.") ); >+ return false; >+ } else if( !confirm(_("Are you sure you want to delete this order line?")) ) { >+ return false; >+ } >+ $('#delete_order_form input[name="ordernumber"]').val( $(this).data('ordernumber') ); >+ $('#delete_order_form').submit(); >+ }); >+ }); > </script> > [% ELSE %] > <script> >-- >2.44.0
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 18360
:
162294
|
162484
|
165273
| 165525 |
165869