fea7b9b4d4
The reason the budget_period_id was not defined was because in two cases it was not passed! This patch adds those missing parameters. And as a result, cuts out the attempt to default the authcat to '' unless the budget_period_id is defined. Additionally, the start and end months don't seem to be passed, so rather than have it blow up, checking them forces the else case logic. budget_period_id is the budget id. If you have two budgets, you can craft a URL to work with budget_period_id matching those two ids. Anything else should trigger the new error which was modified to reflect more of what the problem is. Follow the test plan in comment #6. Feel free to also to attempt crafting URLs and triggering errors. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Well, works and does not explode any more No errors To trigger the new message simply put /cgi-bin/koha/admin/aqplan.pl on your staff page, an intriguing 'Planning for by Asort1' appears :) Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
329 lines
12 KiB
Text
329 lines
12 KiB
Text
[% USE Price %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration › Budgets › Funds › Planning for [% budget_period_description %] by [% authcat %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
|
|
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
function Check(f) {
|
|
var ok=1;
|
|
var _alertString="";
|
|
var alertString2;
|
|
var arr = document.getElementsByName('est_total')
|
|
|
|
for ( var i=0, len=arr.length; i<len; ++i ){
|
|
var tot = arr[i].innerHTML;
|
|
|
|
if (tot == 'NaN') {
|
|
_alertString += "\n- " + _("One or more cell values is non-numeric");
|
|
}
|
|
}
|
|
|
|
if (_alertString.length==0) {
|
|
|
|
var op = document.createElement('input');
|
|
op.setAttribute("type","hidden");
|
|
op.setAttribute("name","op");
|
|
op.setAttribute("value","save"); //ohh the pain...
|
|
|
|
document.Aform.appendChild(op);
|
|
document.Aform.submit()
|
|
|
|
} else {
|
|
alertString2 = _("Form not submitted because of the following problem(s)");
|
|
alertString2 += "\n------------------------------------------------------------------------------------\n";
|
|
alertString2 += _alertString;
|
|
alert(alertString2);
|
|
}
|
|
}
|
|
$(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).attr("checked")){
|
|
showColumn(num);
|
|
} else {
|
|
hideColumn(num);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
//]]>
|
|
</script>
|
|
<style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style>
|
|
</head>
|
|
<body id="admin_aqplan" class="admin">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'budgets-admin-search.inc' %]
|
|
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
|
|
<a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
|
|
<a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> ›
|
|
<a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]">Planning</a> ›
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
[% INCLUDE 'budgets-admin-toolbar.inc' %]
|
|
|
|
<form method="post" id="Aform" name="Aform" action="/cgi-bin/koha/admin/aqplan.pl">
|
|
<h3>Planning for [% budget_period_description %] by [% authcat %]</h3>
|
|
<input type="hidden" name="authcat" value="[% authcat %]" />
|
|
<!-- Budget Lines -->
|
|
|
|
[% IF ( budget_lines ) %]
|
|
|
|
[% IF ( currency ) %]<p><b>Currency = [% currency %]</b>.
|
|
[% IF ( show_actual ) %]
|
|
<b>Each cell contain both actual and estimated values.</b>
|
|
[% ELSE %]
|
|
<b>Cells contain estimated values only.</b>
|
|
[% END %]
|
|
</p>[% ELSE %]<div class="dialog alert"><h3>No active currency is defined</h3><p>Please <a href="/cgi-bin/koha/admin/currency.pl">specify an active currency</a>.</p></div>
|
|
[% IF ( show_actual ) %]
|
|
<p><b>Each cell contain both actual and estimated values.</b></p>
|
|
[% ELSE %]
|
|
<p><b>Cells contain estimated values only.</b></p>
|
|
[% END %]
|
|
[% 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 %]">[% authvals_ro.code %]</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 %]" class="[% authvals_ro.colnum %]">
|
|
[% ELSE %]
|
|
<th id="col[% authvals_ro.code %]" style="display:none;" class="[% authvals_ro.colnum %]">
|
|
[% END %]
|
|
|
|
[% authvals_ro.code %]</th>
|
|
[% END %]
|
|
|
|
<th class="remaining">Fund remaining</th><th> </th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH budget_line IN budget_lines %]
|
|
<tr>
|
|
[% IF ( budget_line.budget_lock ) %]
|
|
<td class="locked" title="Fund locked">
|
|
[% ELSE %]
|
|
<td>
|
|
[% END %]
|
|
<a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget_line.budget_id %]&budget_period_id=[% budget_period_id %]">[% budget_line.budget_name %]</a></td>
|
|
<td><span id="[% budget_line.budget_amount %]">[% 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 %]">[% budget_line.budget_amount %]</div></td>
|
|
|
|
[% FOREACH line IN budget_line.lines %]
|
|
[% IF ( line.display ) %]
|
|
<td class="[% line.colnum %]">
|
|
[% ELSE %]
|
|
<td style="display:none;" class="[% line.colnum %]">
|
|
[% END %]
|
|
<table class="invis">
|
|
<tr>
|
|
[% IF show_actual %]
|
|
<td >[% line.actual_amount %]</td>
|
|
[% END %]
|
|
<td>
|
|
|
|
[% IF ( line.budget_lock ) %]
|
|
[% line.estimated_amount %]
|
|
<input type="hidden" style="text-align: right;" name="[% line.cell_name %]" value="[% line.estimated_amount %]" />
|
|
[% ELSE %]
|
|
<input type="text" style="text-align: right; width:90%; " size="6" name="[% line.cell_name %]" value="[% line.estimated_amount %]" id="budget_[% line.budget_id %][% line.colnum %]" class="plan_entry_[% line.budget_id %]" onchange="calcTotalRow(this);" />
|
|
[% 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 %]
|
|
</td>
|
|
[% END %]
|
|
|
|
[% IF ( budget_line.est_negative ) %]
|
|
<td style="color: red;" id="budget_est_[% budget_line.budget_id %]">
|
|
[% ELSIF ( budget_line.est_positive ) %]
|
|
<td style="color: green;" id="budget_est_[% budget_line.budget_id %]">
|
|
[% ELSE %]
|
|
<td id="budget_est_[% budget_line.budget_id %]">
|
|
[% END %]
|
|
[% budget_line.budget_est_remain | $Price %]
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
|
|
<td>
|
|
[% UNLESS ( budget_line.budget_lock ) %]
|
|
<input type="button" onclick="autoFillRow('[% budget_line.budget_id %]')" value="Auto-fill row"/>
|
|
[% 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 %]" />
|
|
[% IF ( budget_period_locked ) %]
|
|
<!-- <input STYLE="background: gray;" type="submit" value="Save" disabled="disabled"/> -->
|
|
[% ELSE %]
|
|
<fieldset class="action"><input type="button" onclick="Check(this.form)" value="Save"/></fieldset>
|
|
[% END %]
|
|
|
|
|
|
<div id="hide_div">
|
|
[% FOREACH authvals_ro IN authvals_row %]
|
|
|
|
[% UNLESS ( authvals_ro.display ) %]
|
|
<input type="hidden" value="[% authvals_ro.code %]" name="hide_cols"/>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
|
|
|
|
</form>
|
|
|
|
[% ELSIF not budget_period_id %]
|
|
<div class="dialog alert">That budget is not defined. You should select a defined budget to continue.</div>
|
|
[% ELSE %]
|
|
<div class="dialog message">No funds to display for this search criteria</div>
|
|
[% END %]
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
|
|
<form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
|
|
<fieldset class="brief">
|
|
<h4>Filter</h4>
|
|
[% BLOCK planning_types %]
|
|
[% SWITCH type %]
|
|
[% CASE 'MONTHS' %]<span>by months</span>
|
|
[% CASE 'ITEMTYPES' %]<span>by item types</span>
|
|
[% CASE 'BRANCHES' %]<span>by libraries</span>
|
|
[% END %]
|
|
[% END %]
|
|
<ol>
|
|
<li>
|
|
<label for="authcat"> Select planning type:</label>
|
|
<select name="authcat" id="authcat" size="1">
|
|
[% FOREACH value IN authcat_dropbox.values %]
|
|
[% IF ( value == authcat_dropbox.default ) %]
|
|
<option value="[% value %]" selected="selected">[% PROCESS planning_types type=value %]</option>
|
|
[% ELSE %]
|
|
<option value="[% value %]">[% 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 class="action">
|
|
<input type="submit" name="option_submit" value="Submit" />
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
|
|
</fieldset>
|
|
</fieldset>
|
|
</form>
|
|
[% IF ( budget_lines ) %]
|
|
<form method="post" 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" size="1">
|
|
[% FOREACH value IN CGIextChoice %]
|
|
<option value="[% value %]">[% value %]</option>
|
|
[% END %]
|
|
</select>
|
|
<select name="sep" id="sep" size="1">
|
|
[% FOREACH value IN CGIsepChoice %]
|
|
<option value="[% value %]">[% value %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
<fieldset class="action"> <input type="submit" value="Submit"/>
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
|
|
<input type="hidden" name="report_name" value="[% report_name %]" />
|
|
<input type="hidden" name="output" value="file" /></fieldset>
|
|
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
|
|
<input type="hidden" name="authcat" value="[% authcat %]" />
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'acquisitions-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|