Skip to content

Commit e15f454

Browse files
committed
Merge remote-tracking branch 'origin/support/2.13.0' into support/2.14.0
2 parents 67ded1f + 0972714 commit e15f454

6 files changed

Lines changed: 36 additions & 8 deletions

File tree

inc/category.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public static function getCategoryTree(): array {
160160
'icon',
161161
'icon_color',
162162
'background_color',
163+
'comment',
163164
"$categoryFk as parent",
164165
'level',
165166
new QueryExpression(

inc/common.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,14 +785,14 @@ public static function hookRedefineMenu($menus) {
785785
$iterator = $DB->request($criteria);
786786
$hasReminder = $iterator->count() > 0;
787787

788-
if (Reminder::canView() && $hasReminder) {
788+
if (Reminder::canView() && $hasReminder) {
789789
$newMenu['reminders'] = [
790790
'default' => Plugin::getWebDir('formcreator', false) . '/front/wizardreminders.php',
791791
'title' => __('Consult reminders', 'formcreator'),
792792
'icon' => 'fa fa-sticky-note',
793793
];
794794
}
795-
795+
796796
$rssFeedTable = RSSFeed::getTable();
797797
$criteria = [
798798
'SELECT' => "$rssFeedTable.*",

inc/formanswer.class.php

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
use Glpi\Application\View\TemplateRenderer;
3333
use Glpi\Toolbox\Sanitizer;
3434
use GlpiPlugin\Formcreator\Field\DropdownField;
35+
use Glpi\Application\ErrorHandler;
3536

3637
if (!defined('GLPI_ROOT')) {
3738
die("Sorry. You can't access this file directly");
@@ -845,7 +846,7 @@ function plugin_formcreator_checkComment(field) {
845846
* @return array the modified $input array
846847
*/
847848
public function prepareInputForAdd($input) {
848-
global $DB;
849+
global $DB, $GLPI;
849850

850851
// A requester submits his answers to a form
851852
if (!isset($input['plugin_formcreator_forms_id'])) {
@@ -868,8 +869,15 @@ public function prepareInputForAdd($input) {
868869
}
869870
}
870871

871-
if (!$this->validateFormAnswer($input)) {
872-
// Validation of answers failed
872+
try {
873+
if (!$this->validateFormAnswer($input)) {
874+
// Validation of answers failed
875+
return false;
876+
}
877+
} catch (Exception $e) {
878+
// A fatal error caught during validation of answers
879+
$GLPI->getErrorHandler()->handleException($e, false);
880+
Session::addMessageAfterRedirect(__('An internal error occured when verifying your answers. Please report it to your administrator.', 'formcreator'), false, ERROR);
873881
return false;
874882
}
875883
if (!$this->validateCaptcha($input)) {
@@ -881,7 +889,14 @@ public function prepareInputForAdd($input) {
881889
return false;
882890
}
883891

884-
$input['name'] = $DB->escape($this->parseTags($form->fields['formanswer_name']));
892+
try {
893+
$input['name'] = $DB->escape($this->parseTags($form->fields['formanswer_name']));
894+
} catch (Exception $e) {
895+
// A fatal error caught during parsing of tags
896+
$GLPI->getErrorHandler()->handleException($e, false);
897+
Session::addMessageAfterRedirect(__('An internal error occured when verifying your answers. Please report it to your administrator.', 'formcreator'), false, ERROR);
898+
return false;
899+
}
885900

886901
$input = $this->setValidator($input, $form);
887902

inc/knowbase.class.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public static function getCategoryTree() {
129129
'SELECT' => [
130130
KnowbaseItemCategory::getTableField('id'),
131131
KnowbaseItemCategory::getTableField('name'),
132+
KnowbaseItemCategory::getTableField('comment'),
132133
KnowbaseItemCategory::getTableField($cat_fk),
133134
$items_subquery,
134135
],

inc/notificationtargetformanswer.class.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public function addDataForTemplate($event, $options = []) {
7171
$this->data['##formcreator.validation_link##'] = $link;
7272
$this->data['##formcreator.request_id##'] = $this->obj->fields['id'];
7373

74+
$this->data['##lang.formcreator.form_id##'] = __('Form ID', 'formcreator');
75+
$this->data['##lang.formcreator.form_name##'] = __('Form name', 'formcreator');
76+
$this->data['##lang.formcreator.form_requester##'] = __('Requester', 'formcreator');
77+
$this->data['##lang.formcreator.form_validator##'] = __('Validator', 'formcreator');
78+
$this->data['##lang.formcreator.form_creation_date##'] = __('Creation date', 'formcreator');
79+
$this->data['##lang.formcreator.form_full_answers##'] = __('Full form answers', 'formcreator');
80+
$this->data['##lang.formcreator.validation_comment##'] = __('Validation comment', 'formcreator');
81+
$this->data['##lang.formcreator.validation_link##'] = __('Validation link', 'formcreator');
82+
$this->data['##lang.formcreator.request_id##'] = __('Request ID', 'formcreator');
83+
7484
$this->getTags();
7585
foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
7686
if (!isset($this->data[$tag])) {

js/scripts.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ function buildKbCategoryList(tree) {
347347
if (tree.id != 0) {
348348
html += '<a href="#" data-parent-category-id="' + tree.parent +'"'
349349
+ ' data-category-id="' + tree.id + '"'
350-
+ ' onclick="plugin_formcreator.updateKbitemsView(this)">'
350+
+ ' onclick="plugin_formcreator.updateKbitemsView(this)"'
351+
+ ' title="' + tree.comment + '">'
351352
+ tree.name
352353
+ '</a>';
353354
}
@@ -382,7 +383,7 @@ function buildCategoryList(tree) {
382383
+ ' data-category-id="' + tree.id + '"'
383384
+ ' onclick="plugin_formcreator.updateWizardFormsView(this)"'
384385
+ ' style="background-color: ' + tree.background_color + '"'
385-
+ ' title="' + tree.name + '">'
386+
+ ' title="' + tree.comment + '">'
386387
+ icon
387388
+ tree.name
388389
+ '</a>';

0 commit comments

Comments
 (0)