Bug 22800: (bug 22550 follow-up) Do not raw filter when not necessary (OPAC suggestions)
This is a follow-up for bug 22550, we do not need to use the $raw
filter.
Test plan:
Same as bug 22550:
Test plan:
Test plan:
1. OPAC->login->your purchase suggestions->New purchase suggestion
2. Click button "Submit your suggestion" directly without filling in any field.
Empty suggestion record was added succeffully.
3. Apply the patch.
4. Click button "Submit your suggestion" directly without filling in any field.
The required fields should be labeled in red.
(you can change the mandatory fields by preference
'OPACSuggestionMandatoryFields')
Signed-off-by: Bin Wen <bin.wen@inlibro.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit b9bff787ca)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
2f489e78bb
commit
c3cedab96a
|
|
@ -339,9 +339,9 @@
|
|||
return true;
|
||||
});
|
||||
[% END %]
|
||||
[% IF ( op_add && mandatoryfields ) %]
|
||||
[% IF ( op_add && mandatoryfields.size ) %]
|
||||
{
|
||||
var FldsRequired = [[% mandatoryfields | $raw %]];
|
||||
var FldsRequired = ['[% mandatoryfields.join("','") | html %]'];
|
||||
for (var i = 0; i < FldsRequired.length; i++) {
|
||||
var rq_input = $('#' + FldsRequired[i]);
|
||||
if (rq_input.length != 1) continue;
|
||||
|
|
|
|||
|
|
@ -208,11 +208,11 @@ if ( C4::Context->preference("AllowPurchaseSuggestionBranchChoice") ) {
|
|||
$template->param( branchcode => $branchcode );
|
||||
}
|
||||
|
||||
my $mandatoryfields = '';
|
||||
my @mandatoryfields;
|
||||
{
|
||||
last unless ($op eq 'add');
|
||||
my $fldsreq_sp = C4::Context->preference("OPACSuggestionMandatoryFields") || 'title';
|
||||
$mandatoryfields = join(', ', (map { '"'.$_.'"'; } sort split(/\s*\,\s*/, $fldsreq_sp)));
|
||||
@mandatoryfields = sort split(/\s*\,\s*/, $fldsreq_sp);
|
||||
}
|
||||
|
||||
$template->param(
|
||||
|
|
@ -224,7 +224,7 @@ $template->param(
|
|||
messages => \@messages,
|
||||
suggestionsview => 1,
|
||||
suggested_by_anyone => $suggested_by_anyone,
|
||||
mandatoryfields => $mandatoryfields,
|
||||
mandatoryfields => \@mandatoryfields,
|
||||
patrons_pending_suggestions_count => $patrons_pending_suggestions_count,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue