e21419b733
Because of the bug 36192 CSRF protection, we intend not to have forms that POST without a param named 'op' with a value starting with 'cud-'. Because of bug 37728, a few were missed, including the 'Filters' form that lets you switch between planning budgets by month or by itemtype or by library, and the 'Export' form that lets you save your planning as a .csv file. Neither one has any need to POST, they can just be the GET they naturally are. Alas, the default data won't let you exercise everything, so there's a lot of setup before the actual testing. Test plan: 1. Patrons - search for Acevedo - More-> Set permissions - check Acquisitions management and Save 2. Administration - Authorized values - Asort1 - New authorized value for Asort1 - value Q1, description First Quarter, then repeat for Q2, Q3, Q4 3. Administration - Budgets - New budget - give it a start date of today, end date of a year from today, a description, a total amount of 100000.00, for Statistic 1 done on choose Asort1 4. Click the name of your new budget - New-> New fund for (name) - give it the code my, name My money, amount 75000.00 and Submit 5. New-> New fund for (name) - give it the code his, name Henry's money, amount 25000.00, and click Select owner, find Henry and Select, then Submit 6. Acquisitions - click Search on an empty search box to find the only vendor - New-> Basket - Give it a name and Save 7. Add to basket - From an existing record (search for something like Perl) click any bib record - Add order - set the required item type and click Add item 8. Scroll down to the Accounting details form, change Fund to My money, and enter 20.00 for the Vendor price and click Save. You just made that fund "active" in the eyes of the Filter form, by spending some of it. 9. Finally set up. Administration - Budgets - click the name of your budget 10. Planning-> Plan by months 11. In the upper left Filter box, check Show my funds only and Submit - you should see Henry's money disappear 12. Uncheck Show my funds only and check Show active funds only and Submit - you should see Henry's money disappear 13. Check Show actual/estimated values and Submit, you should see text for the actual (only in this month, since that's all you spent) and wee little shrunken text boxes for the planning numbers 14. Uncheck all the boxes and change the dropdown from by months to by Asort1 (either one of it, there being two is bug 34159) and Submit, you should have four columns for Q1 - Q4 and only for My money, since Henry doesn't use Asort1 15. Click the Auto-fill row button, and Save 16. In the Export form (which isn't much of a form, since you only have a choice for the filename) click Submit 17. You should have downloaded a .csv file, and if you open it it should have the info from your current planning form. 18. Apply patch, restart_all 19. Repeat steps 9-17, getting the same results you did without the patch Sponsored-by: Chetco Community Public Library Signed-off-by: Sukhmandeep Benipal <sukhmandeep.benipal@inLibro.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
348 lines
16 KiB
Text
348 lines
16 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Price %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
[% PROCESS 'budget_planning.inc' %]
|
|
<title>[% FILTER collapse %]
|
|
[% PROCESS planning plan=authcat %] ›
|
|
[% t("Funds") | html %] ›
|
|
[% t("Budgets") | html %] ›
|
|
[% t("Administration") | html %] ›
|
|
[% t("Koha") | html %]
|
|
[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<style>td.locked { background-image: url('[% interface | html %]/[% theme | html %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; } .plan_entry { text-align: right; width:90%; }</style>
|
|
</head>
|
|
|
|
<body id="admin_aqplan" class="admin">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'budgets-admin-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">Funds</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
[% PROCESS planning plan=authcat %]
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-10 order-md-2 order-sm-1">
|
|
<main>
|
|
[% INCLUDE 'messages.inc' %]
|
|
|
|
[% INCLUDE 'budgets-admin-toolbar.inc' %]
|
|
|
|
<form method="post" id="Aform" name="Aform" action="/cgi-bin/koha/admin/aqplan.pl">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<h1>[% PROCESS planning plan=authcat %]</h1>
|
|
<input type="hidden" name="authcat" value="[% authcat | html %]" />
|
|
<!-- Budget Lines -->
|
|
|
|
<div class="page-section">
|
|
|
|
[% IF ( budget_lines ) %]
|
|
|
|
[% INCLUDE 'budgets-active-currency.inc' %]
|
|
[% IF ( show_actual ) %]
|
|
<p><strong>Each cell contain both actual and estimated values.</strong></p>
|
|
[% ELSE %]
|
|
<p><strong>Cells contain estimated values only.</strong></p>
|
|
[% END %]
|
|
|
|
<p id="selections">
|
|
<strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span>
|
|
[% FOREACH authvals_ro IN authvals_row %]
|
|
<span class="selected"><label><input type="checkbox" checked="checked" id="col[% authvals_ro.colnum | html %]">[% authvals_ro.code | html %]</label></span>
|
|
[% END %]
|
|
</p>
|
|
<table id="plan">
|
|
<thead>
|
|
<tr>
|
|
<th>Fund name</th>
|
|
<th>Fund total</th>
|
|
[% FOREACH authvals_ro IN authvals_row %]
|
|
[% IF ( authvals_ro.display ) %]
|
|
<th id="col[% authvals_ro.code | html %]" class="[% authvals_ro.colnum | html %]">
|
|
[% ELSE %]
|
|
<th id="col[% authvals_ro.code | html %]" style="display:none;" class="[% authvals_ro.colnum | html %]">
|
|
[% END %]
|
|
[% authvals_ro.code | html %]</th>
|
|
[% END %]
|
|
<th class="remaining">Fund remaining</th>
|
|
<th class="noExport">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH budget_line IN budget_lines %]
|
|
<tr id="[% budget_line.budget_id | html %]">
|
|
[% IF ( budget_line.budget_lock ) %]
|
|
<td class="locked">
|
|
<a data-bs-toggle="tooltip" title="Budget locked" href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget_line.budget_id | uri %]&budget_period_id=[% budget_period_id | uri %]">[% budget_line.budget_name | html %]</a>
|
|
</td>
|
|
[% ELSE %]
|
|
<td>
|
|
<a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget_line.budget_id | uri %]&budget_period_id=[% budget_period_id | uri %]">[% budget_line.budget_name | html %]</a>
|
|
</td>
|
|
[% END %]
|
|
<td><span id="[% budget_line.budget_amount | html %]">[% budget_line.budget_amount | $Price %] </span>
|
|
<!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
|
|
<div style="display:none;" id="budget_tot_[% budget_line.budget_id | html %]">[% budget_line.budget_amount | html %]</div></td>
|
|
|
|
[% FOREACH line IN budget_line.lines %]
|
|
[% IF ( line.display ) %]
|
|
<td class="[% line.colnum | html %]">
|
|
[% ELSE %]
|
|
<td style="display:none;" class="[% line.colnum | html %]">
|
|
[% END %]
|
|
<table class="invis">
|
|
<tr>
|
|
[% IF show_actual %]
|
|
<td >[% line.actual_amount | html %]</td>
|
|
[% END %]
|
|
<td>
|
|
|
|
[% IF ( line.budget_lock ) %]
|
|
[% line.estimated_amount | html %]
|
|
<input type="hidden" style="text-align: right;" name="[% line.cell_name | html %]" value="[% line.estimated_amount | html %]" />
|
|
[% ELSE %]
|
|
<input type="text" size="6" name="[% line.cell_name | html %]" value="[% line.estimated_amount | html %]" id="budget_[% line.budget_id | html %][% line.colnum | html %]" class="plan_entry plan_entry_[% line.budget_id | html %]" />
|
|
[% END %]
|
|
|
|
</td></tr>
|
|
</table>
|
|
</td>
|
|
[% END %]
|
|
|
|
<td>
|
|
<table class="invis">
|
|
<tr>
|
|
[% IF show_actual %]
|
|
[% IF ( budget_line.act_negative ) %]
|
|
<td style="color: red;">
|
|
[% ELSIF ( budget_line.act_positive ) %]
|
|
<td style="color: green;">
|
|
[% ELSE %]
|
|
<td>
|
|
[% END %]
|
|
[% budget_line.budget_act_remain | html %]
|
|
</td>
|
|
[% END %]
|
|
|
|
[% IF ( budget_line.est_negative ) %]
|
|
<td style="color: red;" id="budget_est_[% budget_line.budget_id | html %]">
|
|
[% ELSIF ( budget_line.est_positive ) %]
|
|
<td style="color: green;" id="budget_est_[% budget_line.budget_id | html %]">
|
|
[% ELSE %]
|
|
<td id="budget_est_[% budget_line.budget_id | html %]">
|
|
[% END %]
|
|
[% budget_line.budget_est_remain | $Price %]
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
|
|
<td class="actions">
|
|
[% UNLESS ( budget_line.budget_lock ) %]
|
|
<input type="button" class="auto_fill_row btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Auto-fill row"/>
|
|
<input type="button" class="clear_fields btn btn-default btn-xs" data-budget-id="[% budget_line.budget_id | html %]" value="Clear">
|
|
[% ELSE %]
|
|
<div style="color:red;">not owned</div>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
|
|
[% IF ( budget_period_locked ) %]
|
|
<!-- <input STYLE="background: gray;" type="submit" value="Save" disabled="disabled"/> -->
|
|
[% ELSE %]
|
|
<input type="hidden" name="op" value="cud-save" />
|
|
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /></fieldset>
|
|
[% END %]
|
|
|
|
</div> <!-- /.page-section -->
|
|
|
|
<div id="hide_div">
|
|
[% FOREACH authvals_ro IN authvals_row %]
|
|
|
|
[% UNLESS ( authvals_ro.display ) %]
|
|
<input type="hidden" value="[% authvals_ro.code | html %]" name="hide_cols"/>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
[% ELSIF not budget_period_id %]
|
|
<div class="alert alert-warning">That budget does not exist! Please select a budget to continue.</div>
|
|
[% ELSE %]
|
|
<div class="alert alert-info">No funds to display for this search criteria</div>
|
|
[% END %]
|
|
|
|
|
|
|
|
</main>
|
|
</div> <!-- /.col-md-10.order-md-2 -->
|
|
|
|
<div class="col-md-2 order-sm-2 order-md-1">
|
|
<aside>
|
|
|
|
<form method="get" action="/cgi-bin/koha/admin/aqplan.pl">
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
|
|
<fieldset class="brief">
|
|
<h4>Filter</h4>
|
|
[% BLOCK planning_types %]
|
|
[% SWITCH type %]
|
|
[% CASE 'MONTHS' %][% tp("Budget planning", "by months") | html %]
|
|
[% CASE 'ITEMTYPES' %][% tp("Budget planning", "by item types") | html %]
|
|
[% CASE 'BRANCHES' %][% tp("Budget planning", "by libraries") | html %]
|
|
[% CASE %][% tpx("Budget planning", "by {type}", {type = type}) | html %]
|
|
[% END %]
|
|
[% END %]
|
|
<ol>
|
|
<li>
|
|
<label for="authcat"> Select planning type:</label>
|
|
<select name="authcat" id="authcat">
|
|
[% FOREACH value IN authcat_dropbox.values %]
|
|
[% IF ( value == authcat_dropbox.default ) %]
|
|
<option value="[% value | html %]" selected="selected">[% PROCESS planning_types type=value %]</option>
|
|
[% ELSE %]
|
|
<option value="[% value | html %]">[% PROCESS planning_types type=value %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li class="radio">
|
|
[% IF ( show_mine ) %]
|
|
<input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="show_mine" name="show_mine" value="1" />
|
|
[% END %]
|
|
<label for="show_mine">Show my funds only</label>
|
|
</li>
|
|
|
|
<li class="radio">
|
|
[% IF ( show_active ) %]
|
|
<input type="checkbox" id="show_active" name="show_active" value="1" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="show_active" name="show_active" value="1" />
|
|
[% END %]
|
|
<label for="show_active">Show active funds only</label>
|
|
</li>
|
|
|
|
|
|
<li class="radio">
|
|
[% IF ( show_actual ) %]
|
|
<input type="checkbox" id="show_actual" name="show_actual" value="1" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="show_actual" name="show_actual" value="1" />
|
|
[% END %]
|
|
<label for="show_actual">Show actual/estimated values</label>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" name="option_submit" class="btn btn-primary" value="Submit" />
|
|
</fieldset>
|
|
</form>
|
|
[% IF ( budget_lines ) %]
|
|
<form method="get" action="/cgi-bin/koha/admin/aqplan.pl">
|
|
<fieldset class="brief">
|
|
<h4>Export</h4>
|
|
<ol>
|
|
<li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /></li>
|
|
<li><label class="inline" for="MIME">Into an application</label>
|
|
<select name="MIME" id="MIME">
|
|
[% FOREACH value IN CGIextChoice %]
|
|
<option value="[% value | html %]">[% value | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
<select name="sep" id="sep">
|
|
[% FOREACH value IN CGIsepChoice %]
|
|
<option value="[% value | html %]">[% value | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
|
|
<input type="hidden" name="authcat" value="[% authcat | html %]" />
|
|
</fieldset>
|
|
<fieldset class="action"> <input type="submit" class="btn btn-primary" value="Submit" />
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
|
|
<input type="hidden" name="report_name" value="[% report_name | html %]" />
|
|
<input type="hidden" name="output" value="file" /></fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'acquisitions-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-md-2.order-md-1 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/acq.js") | $raw %]
|
|
<script>
|
|
jQuery.validator.addClassRules({ plan_entry: { pnumber: true } }); // require that input be a number in fields with the class 'plan_entry'
|
|
jQuery.validator.addMethod("pnumber", $.validator.methods.number, _("Please enter a valid number.") );
|
|
var zero_formatted = "[% 0 | $Price on_editing => 1 %]";
|
|
$(document).ready(function() {
|
|
$("#selections input").on("change",function(e){
|
|
var num = $(this).attr("id");
|
|
if(num == 'showall'){
|
|
showAllColumns();
|
|
e.stopPropagation();
|
|
} else if(num == 'hideall'){
|
|
hideAllColumns();
|
|
e.stopPropagation();
|
|
} else {
|
|
if($(this).prop("checked")){
|
|
showColumn(num);
|
|
} else {
|
|
hideColumn(num);
|
|
}
|
|
}
|
|
});
|
|
$(".plan_entry").on("change",function(){
|
|
calcTotalRow( this );
|
|
});
|
|
$("#Aform").validate();
|
|
$(".auto_fill_row").on("click",function(){
|
|
var budget_id = $(this).data("budget-id");
|
|
autoFillRow( budget_id );
|
|
});
|
|
$(".clear_fields").on("click",function(){
|
|
var budget_id = $(this).data("budget-id");
|
|
var edit_row = $("#"+budget_id);
|
|
$(edit_row).find("input").each(function(){
|
|
var type = $(this).attr("type");
|
|
if (type != "button" && type != "submit" ) {
|
|
$(this).val(zero_formatted);
|
|
$(this).prop('disabled', false);
|
|
}
|
|
});
|
|
$("#budget_est_"+budget_id).text($("#budget_tot_"+budget_id).prev().text());
|
|
$("#budget_est_"+budget_id).css("color","green");
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|