Skip to content

Commit

Permalink
Merge branch 'bugfix/1687_satisfaction' into support/2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Mar 11, 2020
2 parents fe5b2df + cb37daf commit 5441fc6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
14 changes: 14 additions & 0 deletions inc/issue.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@ public function displaySimplified($options = []) {

if ($item instanceof Ticket) {
//Tickets without form associated or single ticket for an answer
$satisfaction = new TicketSatisfaction();
if ($satisfaction->getFromDB($options['id'])) {
// show survey form, if any
// @see Ticket::displayTabContentForItem()
$duration = Entity::getUsedConfig('inquest_duration', $item->fields['entities_id']);
$date2 = strtotime($satisfaction->fields['date_begin']);
if (($duration == 0)
|| (strtotime("now") - $date2) <= $duration*DAY_TIMESTAMP) {
$satisfaction->showForm($item);
} else {
echo "<p class='center b'>".__('Satisfaction survey expired')."</p>";
}
}

echo "<div class='timeline_box'>";
$rand = mt_rand();
$item->showTimelineForm($rand);
Expand Down
10 changes: 8 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ function plugin_init_formcreator() {
if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) {
if (plugin_formcreator_replaceHelpdesk()) {
if (!isset($_POST['update'])) {
Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket');
$decodedUrl = [];
$forceTab = '';
parse_str($_SERVER['QUERY_STRING'], $decodedUrl);
if (isset($decodedUrl['forcetab'])) {
Session::setActiveTab(Ticket::class, $decodedUrl['forcetab']);
}
Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket' . $forceTab);
}
}
}
Expand Down Expand Up @@ -302,7 +308,7 @@ function plugin_formcreator_decode($string) {

/**
* Tells if helpdesk replacement is enabled for the current user
*
*
* @return boolean|integer
*/
function plugin_formcreator_replaceHelpdesk() {
Expand Down

0 comments on commit 5441fc6

Please sign in to comment.