Lines 614-620
canned reports and writing custom SQL reports.</p>
Link Here
|
614 |
[% END %] |
614 |
[% END %] |
615 |
|
615 |
|
616 |
[% IF ( save ) %] |
616 |
[% IF ( save ) %] |
617 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated"> |
617 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form"> |
618 |
<input type="hidden" name="sql" value="[% sql | html %]" /> |
618 |
<input type="hidden" name="sql" value="[% sql | html %]" /> |
619 |
<input type="hidden" name="type" value="[% type | html %]" /> |
619 |
<input type="hidden" name="type" value="[% type | html %]" /> |
620 |
<input type="hidden" name="area" value="[% area | html %]" /> |
620 |
<input type="hidden" name="area" value="[% area | html %]" /> |
Lines 893-899
canned reports and writing custom SQL reports.</p>
Link Here
|
893 |
[% END %] |
893 |
[% END %] |
894 |
|
894 |
|
895 |
[% IF ( create ) %] |
895 |
[% IF ( create ) %] |
896 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated"> |
896 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form"> |
897 |
<fieldset class="rows"> |
897 |
<fieldset class="rows"> |
898 |
<legend>Create report from SQL</legend> |
898 |
<legend>Create report from SQL</legend> |
899 |
<ol> |
899 |
<ol> |
Lines 970-976
canned reports and writing custom SQL reports.</p>
Link Here
|
970 |
[% END %] |
970 |
[% END %] |
971 |
|
971 |
|
972 |
[% IF ( editsql ) %] |
972 |
[% IF ( editsql ) %] |
973 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" class="validated"> |
973 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post" id="sql_report_form"> |
974 |
<input type="hidden" name="phase" value="Update SQL" /> |
974 |
<input type="hidden" name="phase" value="Update SQL" /> |
975 |
<input type="hidden" name="id" value="[% id | html %]"/> |
975 |
<input type="hidden" name="id" value="[% id | html %]"/> |
976 |
<fieldset class="rows"> |
976 |
<fieldset class="rows"> |
Lines 1131-1136
canned reports and writing custom SQL reports.</p>
Link Here
|
1131 |
mode: "text/x-sql", |
1131 |
mode: "text/x-sql", |
1132 |
lineWrapping: true |
1132 |
lineWrapping: true |
1133 |
}); |
1133 |
}); |
|
|
1134 |
|
1135 |
// https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 |
1136 |
function clearValidation( formElement ){ |
1137 |
// formElement should be a jQuery object |
1138 |
var validator = formElement.validate(); |
1139 |
// Iterate through named elements inside of the form, and mark them as error free |
1140 |
$('[name]',formElement).each(function(){ |
1141 |
validator.successList.push(this);//mark as error free |
1142 |
validator.showErrors();//remove error messages if present |
1143 |
}); |
1144 |
validator.resetForm();//remove error class on name elements and clear history |
1145 |
validator.reset();//remove all error and success data |
1146 |
} |
1147 |
|
1134 |
[% END %] |
1148 |
[% END %] |
1135 |
|
1149 |
|
1136 |
[% IF ( showsql ) %] |
1150 |
[% IF ( showsql ) %] |
Lines 1466-1476
canned reports and writing custom SQL reports.</p>
Link Here
|
1466 |
}); |
1480 |
}); |
1467 |
|
1481 |
|
1468 |
[% IF (create || editsql || save) %] |
1482 |
[% IF (create || editsql || save) %] |
|
|
1483 |
|
1484 |
var validated_form = $("#sql_report_form").validate({ |
1485 |
reportname: "required", |
1486 |
group_input: { |
1487 |
required: { |
1488 |
depends: function(element) { |
1489 |
return $("#create_group").prop("checked") && $("#groupdesc_input").val() != ''; |
1490 |
} |
1491 |
} |
1492 |
}, |
1493 |
groupdesc_input: { |
1494 |
required: { |
1495 |
depends: function(element) { |
1496 |
return $("#create_group").prop("checked") && $("#group_input").val() != ''; |
1497 |
} |
1498 |
} |
1499 |
} |
1500 |
}); |
1501 |
|
1469 |
$("#select_group").change(function() { |
1502 |
$("#select_group").change(function() { |
1470 |
if($(this).prop('checked')) { |
1503 |
if($(this).prop('checked')) { |
1471 |
$("#group_input").prop('disabled', true); |
1504 |
$("#group_input").attr("class","").prop('disabled', true).prop("required", false); |
1472 |
$("#groupdesc_input").prop('disabled', true); |
1505 |
$("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false); |
1473 |
$("#group_select").prop('disabled', false); |
1506 |
$("#group_select").prop('disabled', false); |
|
|
1507 |
clearValidation( $("#sql_report_form") ); |
1474 |
if ($("#group_select").val().length > 0) { |
1508 |
if ($("#group_select").val().length > 0) { |
1475 |
$("#select_subgroup").prop('checked', true); |
1509 |
$("#select_subgroup").prop('checked', true); |
1476 |
$("#select_subgroup").change(); |
1510 |
$("#select_subgroup").change(); |
Lines 1482-1511
canned reports and writing custom SQL reports.</p>
Link Here
|
1482 |
}); |
1516 |
}); |
1483 |
$("#create_group").change(function() { |
1517 |
$("#create_group").change(function() { |
1484 |
if($(this).prop('checked')) { |
1518 |
if($(this).prop('checked')) { |
1485 |
$("#group_input").prop('disabled', false); |
1519 |
$("#group_input").prop('disabled', false).prop("required", true ); |
1486 |
$("#groupdesc_input").prop('disabled', false); |
1520 |
$("#groupdesc_input").prop('disabled', false).prop("required", true ); |
1487 |
$("#group_select").prop('disabled', true); |
1521 |
$("#group_select").prop('disabled', true); |
1488 |
$("#create_subgroup").prop('checked', true).change(); |
1522 |
// $("#create_subgroup").prop('checked', true).change(); |
1489 |
$("#subgroup_select").hide(); |
1523 |
$("#subgroup_select").hide(); |
1490 |
$("#subgroup input[type='radio']").hide(); |
1524 |
$("#subgroup input[type='radio']").hide(); |
1491 |
$("#subgroup label[for]").hide(); |
1525 |
$("#subgroup label[for]").hide(); |
1492 |
$("#subgroup_input").show(); |
1526 |
$("#subgroup_input").prop("required", false ).prop("disabled", false).show(); |
1493 |
$("#subgroupdesc_input").show(); |
1527 |
$("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show(); |
1494 |
$("#subgroup").show(); |
1528 |
$("#subgroup").show(); |
|
|
1529 |
// Add validation rules for fields which were previously hidden |
1530 |
$("#subgroup_input").rules("add", { |
1531 |
required: { |
1532 |
depends: function(element) { |
1533 |
return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != ''; |
1534 |
} |
1535 |
} |
1536 |
}); |
1537 |
$("#subgroupdesc_input").rules("add", { |
1538 |
required: { |
1539 |
depends: function(element) { |
1540 |
return $("#create_group").prop("checked") && $("#subgroup_input").val() != ''; |
1541 |
} |
1542 |
} |
1543 |
}); |
1495 |
} |
1544 |
} |
1496 |
}); |
1545 |
}); |
1497 |
$("#select_subgroup").change(function() { |
1546 |
$("#select_subgroup").change(function() { |
1498 |
if($(this).prop('checked')) { |
1547 |
if($(this).prop('checked')) { |
1499 |
$("#subgroup_select").prop('disabled', false); |
1548 |
$("#subgroup_select").prop('disabled', false); |
1500 |
$("#subgroup_input").prop('disabled', true); |
1549 |
$("#subgroup_input").prop('disabled', true).prop("required", false ); |
1501 |
$("#subgroupdesc_input").prop('disabled', true); |
1550 |
$("#subgroupdesc_input").prop('disabled', true).prop("required", false ); |
|
|
1551 |
clearValidation( $("#sql_report_form") ); |
1502 |
} |
1552 |
} |
1503 |
}); |
1553 |
}); |
1504 |
$("#create_subgroup").change(function() { |
1554 |
$("#create_subgroup").change(function() { |
1505 |
if($(this).prop('checked')) { |
1555 |
if($(this).prop('checked')) { |
1506 |
$("#subgroup_input").prop('disabled', false); |
1556 |
$("#subgroup_input").prop('disabled', false).prop("required", true ); |
1507 |
$("#subgroupdesc_input").prop('disabled', false); |
1557 |
$("#subgroupdesc_input").prop('disabled', false).prop("required", true ); |
1508 |
$("#subgroup_select").prop('disabled', true); |
1558 |
$("#subgroup_select").val("").prop('disabled', true); |
1509 |
} |
1559 |
} |
1510 |
}); |
1560 |
}); |
1511 |
$("#select_group").change(); |
1561 |
$("#select_group").change(); |
1512 |
- |
|
|