Skip to content

Commit

Permalink
Merge pull request #10295 from taslangraham/i6055-stable-3_3_0
Browse files Browse the repository at this point in the history
#6055 Bug fix: address missing category selection after failed submission form validation
  • Loading branch information
taslangraham authored Aug 14, 2024
2 parents fac232c + a56d3aa commit 43d7555
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion classes/submission/form/PKPSubmissionSubmitStep1Form.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ function fetch($request, $template = null, $display = false) {
}
$templateMgr->assign(array(
'assignedCategories' => $assignedCategories,
'categories' => $items,
'categoryOptions' => $items,
'categories' => (array) $request->getUserVar('categories'),
));

return parent::fetch($request, $template, $display);
Expand Down
8 changes: 4 additions & 4 deletions templates/submission/form/categories.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
*
* Include categories for submissions.
*}
{if $categories && is_array($categories) && count($categories)}
{if is_array($categoryOptions) && !empty($categoryOptions)}
{if $readOnly}
{fbvFormSection title="grid.category.categories" list=true}
{foreach from=$categories item="category" key="id"}
{foreach from=$categoryOptions item="category" key="id"}
{if in_array($id, $assignedCategories)}
<li>{$category->getLocalizedTitle()|escape}</li>
{/if}
{/foreach}
{/fbvFormSection}
{else}
{fbvFormSection list=true title="grid.category.categories"}
{foreach from=$categories item="category" key="id"}
{fbvElement type="checkbox" id="categories[]" value=$id checked=in_array($id, $assignedCategories) label=$category|escape translate=false}
{foreach from=$categoryOptions item="category" key="id"}
{fbvElement type="checkbox" id="categories[]" value=$id checked=in_array($id, $categories) label=$category|escape translate=false}
{/foreach}
{/fbvFormSection}
{/if}
Expand Down

0 comments on commit 43d7555

Please sign in to comment.