From 029b0f2815e301b1d9ada6dc7352aa9dbe0e078f Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Mon, 29 Apr 2019 16:03:23 -0500 Subject: [PATCH] issue: Queue Sort Title No Validation Error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses an issue reported on the Forum where adding a new Sort Option for Queues without a title fails without error. This is due to the queue-sorting template that uses a new instance of the `QueueSortDataConfigForm` form from a new instance of `QueueSort` rather than the existing form with existing POST data/errors when a POST is submitted. This updates the queue-sorting template to use the already available `$data_form` form instance. This also adds an if statement to set the `$data_form` if one doesn’t exist (this only applies to new modals without a POST). --- include/ajax.admin.php | 3 +++ include/staff/templates/queue-sorting.tmpl.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ajax.admin.php b/include/ajax.admin.php index 1047b8395..4b31278e0 100644 --- a/include/ajax.admin.php +++ b/include/ajax.admin.php @@ -237,6 +237,9 @@ class AdminAjaxAPI extends AjaxController { } } + if (!$data_form) + $data_form = $sort->getDataConfigForm(); + include STAFFINC_DIR . 'templates/queue-sorting-add.tmpl.php'; } diff --git a/include/staff/templates/queue-sorting.tmpl.php b/include/staff/templates/queue-sorting.tmpl.php index 2640e43ac..7f84926b4 100644 --- a/include/staff/templates/queue-sorting.tmpl.php +++ b/include/staff/templates/queue-sorting.tmpl.php @@ -1,4 +1,4 @@ -<?php echo $sort->getDataConfigForm()->asTable(); ?> +<?php echo $data_form->asTable(); ?> <table class="table"> <tbody class="sortable-rows"> -- GitLab