You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2016-01-20 18:23:09

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Satisfaction Survey - Make Mandatory comments if select < 3 stars

Hi Guys,

Someone of you knows one way to make mandatory the field "Comments" in the Satisfaction Survey window, when the requester select 3 Stars or less ?

This information is very important for us improvement the quality of service that we provide.

Best Regards

Offline

#2 2016-01-20 19:13:12

diegofd77
Member
Registered: 2015-12-30
Posts: 11

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

Find the column in the database, and set it to NOT NULL.

Good Luck

Offline

#3 2016-01-20 20:07:22

LaDenrée
HELPER
Registered: 2012-11-19
Posts: 6,167

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

Hi,
glpi version ?

use webservices for satisfaction survey then use a html form  to level  and comments, validate with a script before submit to glpi.


Trouver la panne avant de réparer...
GLPI10.0.10 (ubuntu 22.04 PHP8.1  Mariadb10.6 ) plugins : comportements 2.7.2 reports 1.16.0 formcreator 2.13.8, datainjection 2.13.4 fields 1.21.6

Offline

#4 2016-02-01 10:44:50

keenan36
Member
Registered: 2016-02-01
Posts: 11
Website

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

i'm gonna try, hope it work.


distributor takagi water heater di Indonesia.

Offline

#5 2016-02-01 17:04:48

willianmgrocha
Member
From: Brazil
Registered: 2014-10-22
Posts: 75

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

LaDenrée wrote:

Hi,
glpi version ?

use webservices for satisfaction survey then use a html form  to level  and comments, validate with a script before submit to glpi.

Hi

I would like to you if you had some example or template of how can I do it?

When do you talk "Webservices" it is the GLPI Plugin?

Best Regards

Willian rocha
willianmgrocha@gmail.com

Offline

#6 2016-02-05 11:02:49

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

You can directly define mandatory field only if star<3 in GLPI.
You must write your own code in a plugin or with webservices to do that.


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#7 2016-05-06 11:26:15

shuttlesworth
Member
Registered: 2012-04-05
Posts: 5

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

Hi there,

Has anyone successfully defined the Comments field as mandatory?
Also, where do I modify the message sent out in the Satisfaction email?
Looking forward to hear from all the experts here.

Thanks.

Offline

#8 2018-03-21 15:29:46

datarit
Member
Registered: 2018-03-21
Posts: 1

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

Hi there,
I've customized GLPi to make the Comment field mandatory when the stars selected are less than 3.
For this, I edited the file: /glpi/inc/ticketsatisfaction.class.php and I added the code below.

  echo  "<script type='text/javascript'>\n";
            echo "$(function() {";
            echo "$('#stars').rateit({value: ".$this->fields["satisfaction"].",
                                      min : 0,
                                      max : 5,
                                      step: 1,
                                      backingfld: '#satisfaction_data',
                                      ispreset: true,
                                      resetable: false});";



        echo "$('form[name=form]').submit(function(){
                   var satisfaction = $('#satisfaction_data').val();
           var comment =  $('#comment_data').val();
                   

                   if(satisfaction < 1){
                  alert('Selecione uma nota para o chamado');
                      return false;
                   }
           else if(satisfaction < 3 && (comment = '' || comment.trim().length < 5)){
                  alert('Justifique sua nota');
                      return false;
                   }

                  });";
            echo "});";
        echo "</script>";

Offline

#9 2018-03-21 15:54:42

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 15,278

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

Ce n'est pas la bonne méthode de changer directement le code source.
Il faut mieux écrire un plugin qui surchargera le comportement


CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6  - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

#10 2021-10-01 13:45:25

usuest
Member
Registered: 2021-07-28
Posts: 2

Re: Satisfaction Survey - Make Mandatory comments if select < 3 stars

datarit wrote:

Hi there,
I've customized GLPi to make the Comment field mandatory when the stars selected are less than 3.
For this, I edited the file: /glpi/inc/ticketsatisfaction.class.php and I added the code below.

Hi, based on your code, I wrote a version for 9.5.5
in the file /glpi/inc/ticketsatisfaction.class.php after line 141 paste:

echo "$('form[name=form]').submit(function(){
var satisfaction = $('#satisfaction_data').val();
var comment =  $('textarea[name=comment]').val();
if(satisfaction <= 4 && comment.trim().length < 20) {
if(comment.trim().length == ''){
alert('Here message about more or equal 4 stars and please write comment. \\n This is the next line of text if needed.','".__('Error')."');}
else{
alert('Here message about more or equal 4 stars and minimum characters in comment. \\n This is the next line of text if needed.','".__('Error')."');}
return false;}
});";

PS: or replace var comment =  $('#comment_data').val(); in you code by $('textarea[name=comment]').val();

Offline

Board footer

Powered by FluxBB