Browse Source

Bug 19166: (follow-up) Reformat the new adjustments markup

This follow-up makes some changes to the way invoice adjustments are
displayed and added:

 - Move this section into a <fieldset> to set it off visually from the
   other sections of the page.
 - Take the "add adjustment" fields out of the table and display them in
   a standard way.
 - Hide the "add adjustment" fields by default, shown via "add an
   adjustment" link.
 - Add deletion confirmation to adjustment deletions.

To test, add, delete, and change invoice adjustments as instructed in
the original test plan.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Nick Clemens 6 years ago
parent
commit
5bd7acfbb0
  1. 4
      koha-tmpl/intranet-tmpl/prog/css/staff-global.css
  2. 262
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

4
koha-tmpl/intranet-tmpl/prog/css/staff-global.css

@ -93,6 +93,10 @@ h1,h2,h3,h4,h5,h6 {
margin : .3em 0;
}
hr {
clear:both;
}
p {
margin: .5em 0 .5em 0;
}

262
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

@ -76,125 +76,161 @@
</ol>
<input type="hidden" name="op" value="mod" />
<input type="hidden" name="invoiceid" value="[% invoiceid %]" />
</fieldset>
<fieldset class="action">
<input type="submit" value="Save" />
[% UNLESS orders_loop.size %]
<a href="invoice.pl?op=delete&invoiceid=[% invoiceid %]" id="delete">Delete</a>
[% END %]
<fieldset class="action">
<input type="submit" value="Save" />
[% UNLESS orders_loop.size %]
<a href="invoice.pl?op=delete&invoiceid=[% invoiceid %]" id="delete">Delete</a>
[% END %]
</fieldset>
</fieldset>
</form>
<form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
<input type="hidden" name="invoiceid" value="[% invoiceid %]" />
<table id="invoice_adj_table">
<tr>
<th>Id</th>
<th>Amount</th>
<th>Reason</th>
<th>Note</th>
<th>Fund</th>
<th>Encumber while invoice open</th>
<th>&nbsp</th>
</tr>
<hr />
<h3>Adjustments</h3>
<form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
<fieldset class="rows">
<input type="hidden" name="invoiceid" value="[% invoiceid %]" />
[% IF (adjustments.count > 0) %]
<tr><td colspan="7">Current adjustments</td></tr>
[% total_adj = 0 %]
[% FOREACH adjustment IN adjustments %]
[% total_adj = total_adj + adjustment.adjustment %]
<tr>
<td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id %]" />[% adjustment.adjustment_id %]</td>
<td><input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment | $Price %]" /></td>
<td>
[% reasons = AuthorisedValues.Get("ADJ_REASON") %]
[% IF reasons.0 %]
<select id="reason_[% adjustment.adjustment_id %]" name="reason">
<option value="">No reason</option>
[% FOREACH reason IN reasons %]
[% IF ( adjustment.reason == reason.authorised_value ) %]
<option selected="selected" value="[% reason.authorised_value %]">
[% ELSE %]
<option value="[% reason.authorised_value %]">
[% END %]
[% reason.lib %]
</option>
[% END %]
</select>
[% ELSE %]
<p title="Define values in authorised value category ADJ_REASON to enable">None</p>
<input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id %]" value="" />
<table id="invoice_adj_table">
<tr>
<th>Id</th>
<th>Amount</th>
<th>Reason</th>
<th>Note</th>
<th>Fund</th>
<th>Encumber while invoice open</th>
<th>&nbsp</th>
</tr>
[% total_adj = 0 %]
[% FOREACH adjustment IN adjustments %]
[% total_adj = total_adj + adjustment.adjustment %]
<tr>
<td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id %]" />[% adjustment.adjustment_id %]</td>
<td><input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment | $Price %]" /></td>
<td>
[% reasons = AuthorisedValues.Get("ADJ_REASON") %]
[% IF reasons.0 %]
<select id="reason_[% adjustment.adjustment_id %]" name="reason">
<option value="">No reason</option>
[% FOREACH reason IN reasons %]
[% IF ( adjustment.reason == reason.authorised_value ) %]
<option selected="selected" value="[% reason.authorised_value %]">
[% ELSE %]
<option value="[% reason.authorised_value %]">
[% END %]
[% reason.lib %]
</option>
[% END %]
</select>
[% ELSE %]
<p title="Define values in authorised value category ADJ_REASON to enable">None</p>
<input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id %]" value="" />
[% END %]
</td>
<td><input type="text" name="note" id="note_new" value="[% adjustment.note %]"/></td>
<td>
<select id="budget_id_[% adjustment.adjustment_id %]" name="budget_id">
<option value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
[% IF ( budget.budget_id == adjustment.budget_id ) %]
<option selected="selected" value="[% budget.budget_id %]">
[% ELSE %]
<option value="[% budget.budget_id %]">
[% END %]
[% budget.budget_name %]
</option>
[% END %]
</select>
</td>
[% IF adjustment.encumber_open %]
<td>
<input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment_id %]" checked/>
</td>
[% ELSE %]
<td>
<input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment_id %]" />
</td>
[% END %]
<td>
<a class="btn btn-default btn-xs delete_adjustment" href="/cgi-bin/koha/acqui/invoice.pl?op=del_adj&adjustment_id=[% adjustment.adjustment_id %]&invoiceid=[% invoiceid %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
[% END %]
</td>
<td><input type="text" name="note" id="note_new" value="[% adjustment.note %]"/></td>
<td>
<select id="budget_id_[% adjustment.adjustment_id %]" name="budget_id">
<option value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
[% IF ( budget.budget_id == adjustment.budget_id ) %]
<option selected="selected" value="[% budget.budget_id %]">
[% ELSE %]
<option value="[% budget.budget_id %]">
[% END %]
[% budget.budget_name %]
</option>
[% END %]
</select>
</td>
[% IF adjustment.encumber_open %]
<td>
<input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment_id %]" checked/>
</td>
[% ELSE %]
<td>
<input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id %]" value="[% adjustment.adjustment_id %]" />
</td>
[% END %]
<td>
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/acqui/invoice.pl?op=del_adj&adjustment_id=[% adjustment.adjustment_id %]&invoiceid=[% invoiceid %]"><i class="fa fa-trash"></i> Delete</a>
</td>
</tr>
</table>
[% END %]
[% END %]
<tr><td colspan="7">Add an adjustment</td></tr>
<td><input type="hidden" name="adjustment_id" value="new" />New</td>
<td><input type="text" name="adjustment" id="adjustment_new]" /></td>
<td>
[% reasons = AuthorisedValues.Get("ADJ_REASON") %]
[% IF reasons.0 %]
<select id="reason_[% adjustment.adjustment_id %]" name="reason">
<option value="">No reason</option>
[% FOREACH reason IN reasons %]
<option value="[% reason.authorised_value %]">
[% reason.lib %]
</option>
[% END %]
</select>
[% ELSE %]
<p title="Define values in authorised value category ADJ_REASON to enable">None</p>
[% END %]
</td>
<td><input type="text" name="note" id="note_new" value=""/></td>
<td>
<select id="budget_id_[% adjustment.adjustment_id %]" name="budget_id">
<option selected="selected" value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
<option value="[% budget.budget_id %]">
[% budget.budget_name %]
</option>
[% END %]
</select>
</td>
<td><input type="checkbox" name="encumber_open" id="encumber_new" value="new" /></td>
<td><input type="hidden" name="delete" value=""></td>
</tr>
</table>
<input type="hidden" name="op" value="mod_adj" />
<input type="submit" value="Update adjustments" />
</form>
<p>
<a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
</p>
<fieldset id="add_invoice_adjustment" style="display:none">
<h4>Add an adjustment</h4>
<input type="hidden" name="adjustment_id" value="new" />
<ol>
<li>
<label for="adjustment_new">Amount: </label>
<input type="text" name="adjustment" id="adjustment_new" />
</li>
[% reasons = AuthorisedValues.Get("ADJ_REASON") %]
[% IF reasons.0 %]
<li>
<label for="reason_[% adjustment.adjustment_id %]">Reason: </label>
<select id="reason_[% adjustment.adjustment_id %]" name="reason">
<option value="">No reason</option>
[% FOREACH reason IN reasons %]
<option value="[% reason.authorised_value %]">
[% reason.lib %]
</option>
[% END %]
</select>
</li>
[% ELSE %]
<li>
<span class="label">Reason: </span>
<span>None</span>
<div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
</li>
[% END %]
<li>
<label for="note_new">Note: </label>
<input type="text" name="note" id="note_new" value=""/>
</li>
<li>
<label for="budget_id_new">Fund: </label>
<select id="budget_id_new" name="budget_id">
<option selected="selected" value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
<option value="[% budget.budget_id %]">
[% budget.budget_name %]
</option>
[% END %]
</select>
</li>
<li>
<label for="encumber_new">Encumber while invoice open? </label>
<input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
<input type="hidden" name="delete" value="">
</li>
<li>
<span class="label">&nbsp;</span>
<a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="hidden" name="op" value="mod_adj" />
<input type="submit" value="Update adjustments" />
</fieldset>
</fieldset>
</form>
<p>
<a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
[% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]">Manage invoice files</a>[% END %]
</p>
<h2>Invoice details</h2>
<fieldset>
[% IF orders_loop.size %]
<label for="show_all_details">
<input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
@ -317,6 +353,7 @@
</tbody>
</table>
[% END %]
</fieldset>
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
@ -374,6 +411,13 @@
$("#show_all_details").prop('checked', false);
updateColumnsVisibility(false);
$(".toggle_invoice_adjustment").on("click", function(e){
e.preventDefault();
$("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
});
$("a.delete_adjustment").click(function(){
return ( confirm( _("Are you sure you want to delete this file ?") ) );
});
});
</script>
[% END %]

Loading…
Cancel
Save