|
Lines 2-12
Link Here
|
| 2 |
[% USE Branches %] |
2 |
[% USE Branches %] |
| 3 |
[% USE Price %] |
3 |
[% USE Price %] |
| 4 |
[% SET footerjs = 1 %] |
4 |
[% SET footerjs = 1 %] |
|
|
5 |
[% USE Koha %] |
| 5 |
[% INCLUDE 'doc-head-open.inc' %] |
6 |
[% INCLUDE 'doc-head-open.inc' %] |
| 6 |
<title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title> |
7 |
<title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title> |
| 7 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> |
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" /> |
| 8 |
<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable_[% KOHA_VERSION %].css" rel="stylesheet" type="text/css" /> |
9 |
<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable_[% KOHA_VERSION %].css" rel="stylesheet" type="text/css" /> |
| 9 |
[% INCLUDE 'doc-head-close.inc' %] |
10 |
[% INCLUDE 'doc-head-close.inc' %] |
|
|
11 |
|
| 12 |
<script type="text/javascript"> |
| 13 |
//<![CDATA[ |
| 14 |
var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n"; |
| 15 |
var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n"; |
| 16 |
var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n"; |
| 17 |
//]]> |
| 18 |
</script> |
| 19 |
|
| 20 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script> |
| 21 |
[% IF op == 'add_form' %] |
| 22 |
[% INCLUDE 'prices.inc' %] |
| 23 |
<script type="text/javascript"> |
| 24 |
//<![CDATA[ |
| 25 |
|
| 26 |
function userPopup() { |
| 27 |
window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add", |
| 28 |
'PatronPopup', |
| 29 |
'width=740,height=450,location=yes,toolbar=no,' |
| 30 |
+ 'scrollbars=yes,resize=yes' |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
function ownerPopup() { |
| 35 |
window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select", |
| 36 |
'PatronPopup', |
| 37 |
'width=740,height=450,location=yes,toolbar=no,' |
| 38 |
+ 'scrollbars=yes,resize=yes' |
| 39 |
); |
| 40 |
} |
| 41 |
|
| 42 |
function select_user(borrowernumber, borrower) { |
| 43 |
ownerRemove(); |
| 44 |
var borrowername = borrower.firstname + ' ' + borrower.surname |
| 45 |
if (borrowernumber) { |
| 46 |
var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl' |
| 47 |
+ '?borrowernumber=' + borrowernumber + '">' |
| 48 |
+ borrowername + '</a>'; |
| 49 |
$('#budget_owner_name').html(ownerlink); |
| 50 |
$('#budget_owner_id').val(borrowernumber); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
function ownerRemove() { |
| 55 |
$('#budget_owner_name').empty(); |
| 56 |
$('#budget_owner_id').val(''); |
| 57 |
} |
| 58 |
|
| 59 |
function add_user(borrowernumber, borrowername) { |
| 60 |
var ids = $("#budget_users_id").val().split(':'); |
| 61 |
if(borrowernumber && ids.indexOf(borrowernumber) == -1) { |
| 62 |
var li = '<li id="user_' + borrowernumber + '">' |
| 63 |
+ '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' |
| 64 |
+ borrowernumber + '">' + borrowername + '</a> ' |
| 65 |
+ ' • <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> ' |
| 66 |
+ '</li>'; |
| 67 |
$("#budget_users").prepend(li); |
| 68 |
ids.push(borrowernumber); |
| 69 |
$("#budget_users_id").val(ids.join(':')); |
| 70 |
} else { |
| 71 |
return -1; |
| 72 |
} |
| 73 |
return 0; |
| 74 |
} |
| 75 |
|
| 76 |
function del_user(borrowernumber) { |
| 77 |
var ids = $("#budget_users_id").val().split(':'); |
| 78 |
if (borrowernumber) { |
| 79 |
var idx = ids.indexOf(borrowernumber+''); |
| 80 |
if (idx != -1) { |
| 81 |
ids.splice(idx, 1); |
| 82 |
$("#budget_users_id").val(ids.join(':')); |
| 83 |
$("li#user_" + borrowernumber).remove(); |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
function Check(f) { |
| 89 |
var ok=1; |
| 90 |
var _alertString=""; |
| 91 |
var alertString2; |
| 92 |
|
| 93 |
if (!(isNotNull(f.budget_code,1))) { |
| 94 |
_alertString += _("- Budget code cannot be blank") + "\n"; |
| 95 |
} |
| 96 |
|
| 97 |
if (!(isNotNull(f.budget_name,1))) { |
| 98 |
_alertString += _("- Budget name cannot be blank") + "\n"; |
| 99 |
} |
| 100 |
|
| 101 |
if (!(isNotNull(f.budget_amount,1))) { |
| 102 |
_alertString += _("- Budget amount cannot be blank") + "\n"; |
| 103 |
} |
| 104 |
|
| 105 |
var budgetId; |
| 106 |
if (typeof(f.budget_id ) != "undefined") { |
| 107 |
budgetId = f.budget_id.value |
| 108 |
} |
| 109 |
|
| 110 |
var newBudgetParent; |
| 111 |
|
| 112 |
// hack to test if selected parent_id in scrolling-list... |
| 113 |
// if value == 'undef' its got a selected_parent :/ |
| 114 |
if(f.budget_parent_id){ |
| 115 |
var chkAdd = f.budget_parent_id.value ; |
| 116 |
if ( typeof(chkAdd ) != "undefined") { |
| 117 |
newBudgetParent = f.budget_parent_id.value |
| 118 |
} else { |
| 119 |
newBudgetParent = f.budget_parent_id.item(0).value |
| 120 |
} |
| 121 |
|
| 122 |
if (budgetId > 0) { ; //its a mod ... |
| 123 |
// if parent == curent-budget, fail... |
| 124 |
if ( newBudgetParent == budgetId ) { |
| 125 |
_alertString += _("- Budget parent is current budget") + "\n"; |
| 126 |
} |
| 127 |
|
| 128 |
else if (newBudgetParent) { |
| 129 |
var result = checkBudgetParent( budgetId , newBudgetParent ); |
| 130 |
if (result) { |
| 131 |
_alertString += result; |
| 132 |
} |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
// else do lookup |
| 138 |
var budgetTotal = Math.abs(f.budget_amount.value); |
| 139 |
var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value) |
| 140 |
if (result) { |
| 141 |
_alertString += result; |
| 142 |
} |
| 143 |
|
| 144 |
if (_alertString.length==0) { |
| 145 |
document.Aform.submit(); |
| 146 |
} else { |
| 147 |
alertString2 = _("Form not submitted because of the following problem(s)"); |
| 148 |
alertString2 += "\n------------------------------------------------------------------------------------\n\n"; |
| 149 |
alertString2 += _alertString; |
| 150 |
alert(alertString2); |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
$(document).ready(function(){ |
| 156 |
$('#budget_expend').on('change', function(){CheckAmount(this)}); |
| 157 |
$('#budget_amount').on('change', function(){CheckAmount(this)}); |
| 158 |
function CheckAmount(f){ |
| 159 |
var ok=1; |
| 160 |
var _alertString=""; |
| 161 |
var alertString2; |
| 162 |
if (!(isPrice(f.value))) { |
| 163 |
_alertString += "\n- " + _("Amount must be a valid number, or empty"); |
| 164 |
}else{ |
| 165 |
f.value=Price_from_string(f.value); |
| 166 |
|
| 167 |
} |
| 168 |
if (_alertString.length==0) { |
| 169 |
return true; |
| 170 |
} else { |
| 171 |
alertString2 = _("Form not submitted because of the following problem(s)"); |
| 172 |
alertString2 += "\n------------------------------------------------------------------------------------\n"; |
| 173 |
alertString2 += _alertString; |
| 174 |
alert(alertString2); |
| 175 |
return false; |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
$("#remove_owner").on("click",function(e){ |
| 180 |
e.preventDefault(); |
| 181 |
ownerRemove(); |
| 182 |
}); |
| 183 |
$("#edit_owner").on("click",function(e){ |
| 184 |
e.preventDefault(); |
| 185 |
ownerPopup(); |
| 186 |
}); |
| 187 |
$("body").on("click",".del_user",function(e){ |
| 188 |
e.preventDefault(); |
| 189 |
var borrowernumber = $(this).data("borrowernumber"); |
| 190 |
del_user(borrowernumber); |
| 191 |
}); |
| 192 |
$("#add_user_button").on("click",function(e){ |
| 193 |
e.preventDefault(); |
| 194 |
userPopup(); |
| 195 |
}); |
| 196 |
$("#edit_fund").on("submit",function(e){ |
| 197 |
e.preventDefault(); |
| 198 |
Check(this); |
| 199 |
}); |
| 200 |
}); |
| 201 |
//]]> |
| 202 |
</script> |
| 203 |
[% ELSIF op == 'list' %] |
| 204 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
| 205 |
[% INCLUDE 'datatables.inc' %] |
| 206 |
<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" /> |
| 207 |
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script> |
| 208 |
|
| 209 |
<script type="text/javascript"> |
| 210 |
//<![CDATA[ |
| 211 |
// |
| 212 |
$(document).ready(function() { |
| 213 |
|
| 214 |
|
| 215 |
var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 216 |
"fnDrawCallback": function ( oSettings ) { |
| 217 |
if ( oSettings.aiDisplay.length == 0 ) |
| 218 |
{ |
| 219 |
return; |
| 220 |
} |
| 221 |
|
| 222 |
var nTrs = $('#budgeth tbody tr'); |
| 223 |
var iColspan = nTrs[0].getElementsByTagName('td').length; |
| 224 |
var sLastGroup = ""; |
| 225 |
for ( var i=0 ; i<nTrs.length ; i++ ) |
| 226 |
{ |
| 227 |
var iDisplayIndex = oSettings._iDisplayStart + i; |
| 228 |
var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; |
| 229 |
if ( sGroup != sLastGroup ) |
| 230 |
{ |
| 231 |
var nGroup = document.createElement( 'tr' ); |
| 232 |
var nCell = document.createElement( 'td' ); |
| 233 |
nCell.colSpan = iColspan; |
| 234 |
nCell.className = "group"; |
| 235 |
nCell.innerHTML = sGroup; |
| 236 |
nGroup.appendChild( nCell ); |
| 237 |
nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); |
| 238 |
sLastGroup = sGroup; |
| 239 |
} |
| 240 |
} |
| 241 |
}, |
| 242 |
"footerCallback": function ( row, data, start, end, display ) { |
| 243 |
var api = this.api(), data; |
| 244 |
footer_column_sum( api, [ 4, 6, 8, 10 ], 2 ); |
| 245 |
}, |
| 246 |
"aoColumnDefs": [ |
| 247 |
{ "bVisible": false, "aTargets": [ 0, 1 ] }, |
| 248 |
{ "bSortable": false, "aTargets": ["_all"] } |
| 249 |
], |
| 250 |
'dom': '<"top pager"ilpf>tr<"bottom pager"ip>', |
| 251 |
'bSort': true, |
| 252 |
'aaSortingFixed': [[ 1, 'asc' ]], |
| 253 |
'bPaginate': false, |
| 254 |
"bAutoWidth": false |
| 255 |
})); |
| 256 |
|
| 257 |
$(oTable).treetable({ |
| 258 |
expandable: true |
| 259 |
}); |
| 260 |
$(oTable).treetable('expandAll'); |
| 261 |
$("#expand_all").click(function(e){ |
| 262 |
e.preventDefault(); |
| 263 |
$(oTable).treetable('expandAll'); |
| 264 |
}); |
| 265 |
$("#collapse_all").click(function(e){ |
| 266 |
e.preventDefault(); |
| 267 |
$(oTable).treetable('collapseAll'); |
| 268 |
}); |
| 269 |
|
| 270 |
[% UNLESS budget_period_id %] |
| 271 |
$("#hide_inactive").click(function(e){ |
| 272 |
e.preventDefault(); |
| 273 |
oTable.fnFilter( 1, 0 ); // Show only active=1 |
| 274 |
}); |
| 275 |
$("#show_inactive").click(function(e){ |
| 276 |
e.preventDefault(); |
| 277 |
oTable.fnFilter( '', 0 ); |
| 278 |
}); |
| 279 |
$("#hide_inactive").click(); |
| 280 |
[% END %] |
| 281 |
oTable.fnAddFilters("filter", 750); |
| 282 |
|
| 283 |
$("#filterbutton").click(function() { |
| 284 |
$("#fundfilters").slideToggle(0); |
| 285 |
}); |
| 286 |
|
| 287 |
$(".deletefund-disabled").tooltip().on("click", function(e){ |
| 288 |
e.preventDefault(); |
| 289 |
alert(_("This fund has children. It cannot be deleted.")); |
| 290 |
}); |
| 291 |
}); |
| 292 |
//]]> |
| 293 |
</script> |
| 294 |
[% END %] |
| 295 |
|
| 10 |
</head> |
296 |
</head> |
| 11 |
|
297 |
|
| 12 |
<body id="admin_aqbudgets" class="admin"> |
298 |
<body id="admin_aqbudgets" class="admin"> |
|
Lines 232-249
Link Here
|
| 232 |
<li> |
518 |
<li> |
| 233 |
<label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label> |
519 |
<label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label> |
| 234 |
<input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" /> |
520 |
<input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" /> |
|
|
521 |
[% INCLUDE 'price-conversion-message.inc' %] |
| 235 |
</li> |
522 |
</li> |
| 236 |
|
523 |
|
| 237 |
<li> |
524 |
<li> |
| 238 |
<label for="budget_encumb">Warning at (%): </label> |
525 |
<label for="budget_encumb">Warning at (%): </label> |
| 239 |
<input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" /> |
526 |
<input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" /> |
| 240 |
<span class="hint">0 to disable</span> |
527 |
<span class="hint">0 to disable</span> |
| 241 |
</li> |
528 |
</li> |
| 242 |
|
529 |
|
| 243 |
<li> |
530 |
<li> |
| 244 |
<label for="budget_expend">Warning at (amount): </label> |
531 |
<label for="budget_expend">Warning at (amount): </label> |
| 245 |
<input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" /> |
532 |
<input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" /> |
| 246 |
<span class="hint">0 to disable</span> |
533 |
|
|
|
534 |
<span class="hint">0 to disable.</span> |
| 535 |
[% INCLUDE 'price-conversion-message.inc' %] |
| 536 |
|
| 247 |
</li> |
537 |
</li> |
| 248 |
|
538 |
|
| 249 |
<li> |
539 |
<li> |