ericferon / glpi-statecheck

GLPI plugin for checking form fields, based on rules
GNU General Public License v2.0
4 stars 4 forks source link

Fields not highlighted GLPI v10.0.3 #18

Closed FeluxSLSH closed 1 year ago

FeluxSLSH commented 2 years ago

Hello! Please help, I want to make a check for the fields on the ticket form for certain fields, all the steps went through the guide, but the highlighting of the fields does not appear, only the notification "!! Highlighted fields are controlled !!". Tell me please, maybe I didn’t correctly specify the state table somewhere or defined the class incorrectly? image image image image image

ericferon commented 1 year ago

Hi, Indeed, I can repeat the problem. The current ticket implementation seems not to follow the same development principles as the other core's or plugin's entities. I will examine whether I can adapt my plugin, but I cannot commit to a solution in the short term. K.r,

ericferon commented 1 year ago

Hi, In fact, I cannot adapt my plugin, but you should adapt your "action" : if you put the value 5 instead of "Very high", it should work. This is due to the fact that tickets don't use usual dropdown tables, but a function getPriorityName (in file CommonITILObject.php), with the following mapping : public static function getPriorityName($value) {

    switch ($value) {
        case 6:
            return _x('priority', 'Major');

        case 5:
            return _x('priority', 'Very high');

        case 4:
            return _x('priority', 'High');

        case 3:
            return _x('priority', 'Medium');

        case 2:
            return _x('priority', 'Low');

        case 1:
            return _x('priority', 'Very low');

       // No standard one :
        case 0:
            return _x('priority', 'All');
        case -1:
            return _x('priority', 'At least very low');
        case -2:
            return _x('priority', 'At least low');
        case -3:
            return _x('priority', 'At least medium');
        case -4:
            return _x('priority', 'At least high');
        case -5:
            return _x('priority', 'At least very high');

        default:
           // Return $value if not define
            return $value;
    }
}

K.r,