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 Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
6638e9de8c
commit
4b6d8bb0b6
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue