Skip to content

Commit

Permalink
Merge branch 'support/2.13.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Sep 5, 2022
2 parents dc95c73 + 52e3536 commit aee2be0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function plugin_formcreator_hook_update_ticket(CommonDBTM $item) {
// No issue linked to the ticket,
// then find the form answer linked to the ticket
$formAnswer = new PluginFormcreatorFormAnswer();
if ($formAnswer->getFromDbByTicket($id)) {
if (!$formAnswer->getFromDbByTicket($id)) {
// Should not happen as one and only one form answer shall be linked to a ticket
// If several formanswer found, the previous getFromDBByCrit() logs an error
return;
Expand Down
13 changes: 13 additions & 0 deletions inc/abstractitiltarget.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,19 @@ public function prepareInputForUpdate($input) {
Session::addMessageAfterRedirect(__('The description cannot be empty!', 'formcreator'), false, ERROR);
return [];
}

if (Plugin::isPluginActive('tag')) {
if (isset($input['_tag_questions'])) {
$input['tag_questions'] = (!empty($input['_tag_questions']))
? implode(',', $input['_tag_questions'])
: '';
}
if (isset($input['_tag_specifics'])) {
$input['tag_specifics'] = (!empty($input['_tag_specifics']))
? implode(',', $input['_tag_specifics'])
: '';
}
}
}

if (isset($input['_skip_create_actors']) && $input['_skip_create_actors']) {
Expand Down
4 changes: 2 additions & 2 deletions inc/form.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ protected function showSearchBar() : void {

protected function showMyLastForms() : void {
$limit = 5;
$formanswerUrl = PluginFormcreatorFormAnswer::getSearchURL();
$rawKeyBase = 'ITEM_' . PluginFormcreatorFormAnswer::class;
echo '<div id="plugin_formcreator_last_req_forms" class="card">';
echo '<div class="card-title">'.sprintf(__('My %1$d last forms (requester)', 'formcreator'), $limit).'</div>';
$criteria = [
Expand Down Expand Up @@ -869,7 +871,6 @@ protected function showMyLastForms() : void {
echo '<div class="card-body">';
echo '<ul class="list-group">';
foreach ($search['data']['rows'] as $formAnswer) {
$rawKeyBase = 'ITEM_' . PluginFormcreatorFormAnswer::class;
switch ($formAnswer['raw']["${rawKeyBase}_8"]) {
case PluginFormcreatorFormAnswer::STATUS_WAITING:
$status = CommonITILObject::WAITING;
Expand All @@ -892,7 +893,6 @@ protected function showMyLastForms() : void {
echo '</ul>';
echo '<div class="text-center card-footer">';
$criteria = Toolbox::append_params($criteria, '&amp;');
$formanswerUrl = PluginFormcreatorFormAnswer::getSearchURL();
echo '<a href="' . $formanswerUrl . '?' . $criteria . '">';
echo __('All my forms (requester)', 'formcreator');
echo '</a>';
Expand Down
13 changes: 0 additions & 13 deletions inc/targetchange.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,19 +579,6 @@ public function prepareInputForUpdate($input) {
break;
}
}

if (Plugin::isPluginActive('tag')) {
if (isset($input['_tag_questions'])) {
$input['tag_questions'] = (!empty($input['_tag_questions']))
? implode(',', $input['_tag_questions'])
: '';
}
if (isset($input['_tag_specifics'])) {
$input['tag_specifics'] = (!empty($input['_tag_specifics']))
? implode(',', $input['_tag_specifics'])
: '';
}
}
}

return parent::prepareInputForUpdate($input);
Expand Down
14 changes: 0 additions & 14 deletions inc/targetticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,20 +682,6 @@ public function prepareInputForUpdate($input) {
$input['contract_question'] = '0';
}
}

$plugin = new Plugin();
if (Plugin::isPluginActive('tag')) {
if (isset($input['_tag_questions'])) {
$input['tag_questions'] = (!empty($input['_tag_questions']))
? implode(',', $input['_tag_questions'])
: '';
}
if (isset($input['_tag_specifics'])) {
$input['tag_specifics'] = (!empty($input['_tag_specifics']))
? implode(',', $input['_tag_specifics'])
: '';
}
}
}

if (isset($input['_linktype']) && isset($input['_link_itemtype'])) {
Expand Down

0 comments on commit aee2be0

Please sign in to comment.