Bugzilla – Attachment 107138 Details for
Bug 24157
Additional acquisitions permissions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24157: New permission - merge_invoices
Bug-24157-New-permission---mergeinvoices.patch (text/plain), 11.01 KB, created by
Jonathan Druart
on 2020-07-21 09:13:42 UTC
(
hide
)
Description:
Bug 24157: New permission - merge_invoices
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-07-21 09:13:42 UTC
Size:
11.01 KB
patch
obsolete
>From 8d8459823c21b19781ba92d451287f03ff9a1c84 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 21 Jul 2020 11:03:07 +0200 >Subject: [PATCH] Bug 24157: New permission - merge_invoices > >Add a new permission to merge invoices > >Test plan: >- Remove the new permission "merge_invoices" for a given patron, >use it to log in into Koha >- Create 2 invoices, try to merge them >=> There is no way to merge it >- Add the permission >=> Now you can merge the invoices > >Sponsored-by: Galway-Mayo Institute of Technology >--- > acqui/invoice.pl | 4 + > .../data/mysql/atomicupdate/bug_24157.perl | 7 +- > installer/data/mysql/userpermissions.sql | 1 + > .../prog/en/includes/permissions.inc | 5 ++ > .../prog/en/modules/acqui/invoices.tt | 84 ++++++++++--------- > 5 files changed, 61 insertions(+), 40 deletions(-) > >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >index a65b6d8939..00f5ff2bb0 100755 >--- a/acqui/invoice.pl >+++ b/acqui/invoice.pl >@@ -103,6 +103,10 @@ elsif ( $op && $op eq 'mod' ) { > } elsif ($input->param('close')) { > CloseInvoice($invoiceid); > } elsif ($input->param('merge')) { >+ >+ output_and_exit( $input, $cookie, $template, 'insufficient_permission' ) >+ unless $logged_in_patron->has_permission( { acquisition => 'merge_invoices' } ); >+ > my @sources = $input->multi_param('merge'); > MergeInvoices($invoiceid, \@sources); > defined($invoice_files) && $invoice_files->MergeFileRecIds(@sources); >diff --git a/installer/data/mysql/atomicupdate/bug_24157.perl b/installer/data/mysql/atomicupdate/bug_24157.perl >index e7908dd179..7a7bad0327 100644 >--- a/installer/data/mysql/atomicupdate/bug_24157.perl >+++ b/installer/data/mysql/atomicupdate/bug_24157.perl >@@ -20,6 +20,11 @@ if( CheckVersion( $DBversion ) ) { > (11, 'delete_invoices', 'Delete invoices') > |); > >+ $dbh->do(q| >+ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES >+ (11, 'merge_invoices', 'Merge invoices') >+ |); >+ > SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 24157: Add new permissions reopen_closed_invoices, edit_invoices, delete_invoices, delete_baskets)\n"; >+ print "Upgrade to $DBversion done (Bug 24157: Add new permissions reopen_closed_invoices, edit_invoices, delete_invoices, merge_invoices, delete_baskets)\n"; > } >diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql >index 636b24532c..0224a56a79 100644 >--- a/installer/data/mysql/userpermissions.sql >+++ b/installer/data/mysql/userpermissions.sql >@@ -68,6 +68,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > (11, 'reopen_closed_invoices', 'Reopen closed invoices'), > (11, 'edit_invoices', 'Edit invoices'), > (11, 'delete_invoices', 'Delete invoices'), >+ (11, 'merge_invoices', 'Merge invoices'), > (11, 'delete_baskets', 'Delete baskets'), > (12, 'suggestions_manage', 'Manage purchase suggestions'), > (13, 'edit_news', 'Write news for the OPAC and staff interfaces'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index 42dd9ca4f5..79b6560193 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -705,6 +705,11 @@ > Delete invoices > </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'merge_invoices' -%] >+ <span class="sub_permission merge_invoices_subpermission"> >+ Merge invoices >+ </span> >+ <span class="permissioncode">([% name | html %])</span> > [%- CASE 'delete_baskets' -%] > <span class="sub_permission delete_baskets_subpermission"> > Delete baskets >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >index 06d97452f2..57aeb2749b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >@@ -30,7 +30,9 @@ > <table id="resultst"> > <thead> > <tr> >- <th> </th> >+ [% IF CAN_user_acquisition_merge_invoices %] >+ <th> </th> >+ [% END %] > <th> </th> > <th>Invoice no.</th> > <th>Vendor</th> >@@ -45,7 +47,9 @@ > <tbody> > [% FOREACH invoice IN invoices %] > <tr data-invoiceid="[% invoice.invoiceid | html %]" data-booksellerid="[% invoice.booksellerid | html %]" data-shipmentdate="[% invoice.shipmentdate | $KohaDates %]" data-billingdate="[% invoice.billingdate | $KohaDates %]" data-shipmentcost="[% invoice.shipmentcost | html %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid | html %]" data-closedate="[% invoice.closedate | $KohaDates %]"> >- <td>[% invoice.is_linked_to_subscriptions | html %]</td> >+ [% IF CAN_user_acquisition_merge_invoices %] >+ <td>[% invoice.is_linked_to_subscriptions | html %]</td> >+ [% END %] > <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid | html %]" /></td> > <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]">[% invoice.invoicenumber | html %]</a></td> > <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid | uri %]">[% invoice.suppliername | html %]</a></td> >@@ -101,46 +105,48 @@ > [% END %] > </tbody> > </table> >- <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a> >- <div id="merge_invoices"> >- <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post"> >- <fieldset class="rows"> >- <ol> >- <li><h2>Merge invoices</h2></li> >- <li><table id="merge_table"> >- <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead> >- <tbody> >- </tbody> >- </table></li> >- <li><label for="merge_invoicenumber" class="required">Invoice number:</label> >- <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" /> >- <span class="required">Required</span> >- </li> >- <li><label for="merge_shipmentdate">Shipment date:</label> >- <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li> >+ [% IF CAN_user_acquisition_merge_invoices %] >+ <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a> >+ <div id="merge_invoices"> >+ <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post"> >+ <fieldset class="rows"> >+ <ol> >+ <li><h2>Merge invoices</h2></li> >+ <li><table id="merge_table"> >+ <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead> >+ <tbody> >+ </tbody> >+ </table></li> >+ <li><label for="merge_invoicenumber" class="required">Invoice number:</label> >+ <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" /> >+ <span class="required">Required</span> >+ </li> >+ <li><label for="merge_shipmentdate">Shipment date:</label> >+ <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li> > >- <li><label for="merge_billingdate">Billing date:</label> >- <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li> >+ <li><label for="merge_billingdate">Billing date:</label> >+ <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li> > >- <li><label for="merge_shipmentcost">Shipment cost:</label> >- <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li> >- <li><label for="merge_shipment_budgetid">Fund:</label> >- <select id="merge_shipment_budgetid" name="shipment_budget_id"> >- <option value="">No fund</option> >- [% FOREACH budget IN budgets_loop %] >- <option value="[% budget.budget_id | html %]">[% budget.budget_name | html %] >- </option> >- [% END %] >- </select></li> >+ <li><label for="merge_shipmentcost">Shipment cost:</label> >+ <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li> >+ <li><label for="merge_shipment_budgetid">Fund:</label> >+ <select id="merge_shipment_budgetid" name="shipment_budget_id"> >+ <option value="">No fund</option> >+ [% FOREACH budget IN budgets_loop %] >+ <option value="[% budget.budget_id | html %]">[% budget.budget_name | html %] >+ </option> >+ [% END %] >+ </select></li> > >- <li><span class="label">Status:</span> <span id="merge_status"></span></li> >- <li><input type="submit" value="Merge" /></li> >- </ol> >- <input type="hidden" name="op" value="mod" /> >- <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" /> >- </fieldset> >- </form> >- </div> >+ <li><span class="label">Status:</span> <span id="merge_status"></span></li> >+ <li><input type="submit" value="Merge" /></li> >+ </ol> >+ <input type="hidden" name="op" value="mod" /> >+ <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" /> >+ </fieldset> >+ </form> >+ </div> >+ [% END %] > [% ELSE %] > <p>Sorry, but there are no results for your search.</p> > <p>Search was: >-- >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 24157
:
96274
|
96275
|
96276
|
96277
|
96278
|
98651
|
98652
|
98653
|
98654
|
98655
|
100283
|
100284
|
100285
|
100286
|
100287
|
100288
|
107132
|
107133
|
107134
|
107135
|
107136
|
107137
|
107138
|
107139
|
107309
|
107346
|
107347
|
107348
|
107349
|
107350
|
107351
|
107352
|
107353
|
107354