Skip to content

Commit 5441fc6

Browse files
committed
Merge branch 'bugfix/1687_satisfaction' into support/2.9.0
2 parents fe5b2df + cb37daf commit 5441fc6

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

inc/issue.class.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,20 @@ public function displaySimplified($options = []) {
231231

232232
if ($item instanceof Ticket) {
233233
//Tickets without form associated or single ticket for an answer
234+
$satisfaction = new TicketSatisfaction();
235+
if ($satisfaction->getFromDB($options['id'])) {
236+
// show survey form, if any
237+
// @see Ticket::displayTabContentForItem()
238+
$duration = Entity::getUsedConfig('inquest_duration', $item->fields['entities_id']);
239+
$date2 = strtotime($satisfaction->fields['date_begin']);
240+
if (($duration == 0)
241+
|| (strtotime("now") - $date2) <= $duration*DAY_TIMESTAMP) {
242+
$satisfaction->showForm($item);
243+
} else {
244+
echo "<p class='center b'>".__('Satisfaction survey expired')."</p>";
245+
}
246+
}
247+
234248
echo "<div class='timeline_box'>";
235249
$rand = mt_rand();
236250
$item->showTimelineForm($rand);

setup.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,13 @@ function plugin_init_formcreator() {
174174
if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) {
175175
if (plugin_formcreator_replaceHelpdesk()) {
176176
if (!isset($_POST['update'])) {
177-
Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket');
177+
$decodedUrl = [];
178+
$forceTab = '';
179+
parse_str($_SERVER['QUERY_STRING'], $decodedUrl);
180+
if (isset($decodedUrl['forcetab'])) {
181+
Session::setActiveTab(Ticket::class, $decodedUrl['forcetab']);
182+
}
183+
Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket' . $forceTab);
178184
}
179185
}
180186
}
@@ -302,7 +308,7 @@ function plugin_formcreator_decode($string) {
302308

303309
/**
304310
* Tells if helpdesk replacement is enabled for the current user
305-
*
311+
*
306312
* @return boolean|integer
307313
*/
308314
function plugin_formcreator_replaceHelpdesk() {

0 commit comments

Comments
 (0)