diff --git a/admin/manage_categories.php b/admin/manage_categories.php index c67591be..7629a902 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -477,6 +477,7 @@ echo mfh_get_hidden_fields_for_language(array( 'geco', 'cpric', 'no_manager', + 'e_udel', )); require_once(HESK_PATH . 'inc/footer.inc.php'); diff --git a/internal-api/js/manage-categories.js b/internal-api/js/manage-categories.js index e91836fb..6e614f31 100644 --- a/internal-api/js/manage-categories.js +++ b/internal-api/js/manage-categories.js @@ -122,7 +122,8 @@ function loadTable() { if (this.manager === null) { $template.find('[data-property="manager"]').text(mfhLang.text('no_manager')); } else { - $template.find('[data-property="manager"]').text(users[this.manager].name); + var managerName = users[this.manager] === undefined ? mfhLang.text('e_udel') : users[this.manager].name; + $template.find('[data-property="manager"]').text(managerName); } if (this.id === 1) { @@ -190,7 +191,7 @@ function bindEditModal() { colorpickerOptions = { format: 'hex' }; - if (foregroundColor != '' && foregroundColor !== 'AUTO') { + if (foregroundColor !== '' && foregroundColor !== 'AUTO') { colorpickerOptions.color = foregroundColor; } @@ -246,16 +247,18 @@ function bindCreateModal() { } function bindModalCancelCallback() { - $('.cancel-callback').click(function() { - var $editCategoryModal = $('#category-modal'); - - $editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end(); - $editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end(); - $editCategoryModal.find('input[name="display-border"][value="1"]').prop('checked'); - $editCategoryModal.find('input[name="display-border"][value="0"]').prop('checked'); - $editCategoryModal.find('input[name="autoassign"][value="1"]').prop('checked'); - $editCategoryModal.find('input[name="autoassign"][value="0"]').prop('checked'); - }); + $('.cancel-callback').click(resetModal); +} + +function resetModal() { + var $editCategoryModal = $('#category-modal'); + + $editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end(); + $editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end(); + $editCategoryModal.find('input[name="display-border"][value="1"]').prop('checked'); + $editCategoryModal.find('input[name="display-border"][value="0"]').prop('checked'); + $editCategoryModal.find('input[name="autoassign"][value="1"]').prop('checked'); + $editCategoryModal.find('input[name="autoassign"][value="0"]').prop('checked'); } function bindFormSubmit() { @@ -310,6 +313,7 @@ function bindFormSubmit() { format = mfhLang.html('category_updated'); mfhAlert.success(format.replace('%s', data.name)); } + resetModal(); $modal.modal('hide'); loadTable(); },