glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
4.24k stars 1.29k forks source link

itilcategories_id missing from ticket input #9754

Closed kabassanov closed 2 years ago

kabassanov commented 3 years ago

Code of Conduct

Is there an existing issue for this?

Version

9.5.6

Bug description

I'm splitting #9698.

It appears that itilcategories_id is not set in input array for ticket modification. As I explained in #9698 , it seems to be correctly set while changing ticket status from dropdown, but not from massive actions or followups

Relevant log output

Change ticket status to close from ticket table. Category is there:

 input=Array
(
    [date] => 2021-10-21 17:46:01
    [users_id_recipient] => 7753
    [time_to_own] =>
    [time_to_resolve] =>
    [internal_time_to_own] =>
    [internal_time_to_resolve] =>
    [type] => 2
    [itilcategories_id] => 84
    [status] => 6
    [requesttypes_id] => 2
    [urgency] => 3
    [impact] => 3
    [locations_id] => 0
    [priority] => 3
    [_itil_requester] => Array
        (
            [_type] => 0
        )

    [_itil_observer] => Array
        (
            [_type] => 0
        )

    [_itil_assign] => Array
        (
            [_type] => 0
        )

    [name] => [gf-test] Test 21/1
    [content] => <div class=\"WordSection1\"><p class=\"MsoNormal\">Test</p><p class=\"MsoNormal\"> </p><t
able class=\"MsoTableGrid\" style=\"border-collapse: collapse; border: none; border-spacing: 0px;\" border=\"0\" cellpadding=\"0\"><t
body><tr><td style=\"width: 132px; padding: 0cm 5.4pt 0cm 5.4pt;\" rowspan=\"5\" valign=\"top\"><p class=\"MsoNormal\"&gt
;<span style=\"font-size: 16.0pt;\"> </span></p><p class=\"MsoNormal\"> </p><p><a href=\"https://hot
line-new.xxxx.fr/glpi/front/document.send.php?docid=8676&tickets_id=5586\" target=\"_blank\" rel=\"noopener\"><img src=\"https://
hotline-new.xxxx.fr/glpi/front/document.send.php?docid=8676&tickets_id=5586\" alt=\"121d4674-878a205d-5f560abaaaae30.04445720\" width=\
"236\" /></a></p></td><td style=\"width: 472px; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\"><p class=\"Mso
Normal\"><strong><span style=\"font-size: 14.0pt;\">Konstantin KABASSANOV</span></strong></p></td>&l
t;/tr><tr><td style=\"width: 472px; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\"><p class=\"MsoNormal\">XXXX/CNRS/SO
RBONNE UNIVERSITE</p></td></tr><tr><td style=\"width: 472px; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\">&
lt;p class=\"MsoNormal\">4, place Jussieu, BC 169, office 2600-4-10, 75252 Paris Cedex 05, France</p></td></tr><tr&
gt;<td style=\"width: 472px; padding: 0cm 5.4pt 0cm 5.4pt;\" valign=\"top\"><p class=\"MsoNormal\">Phone: +33 (0) 1 44 27 71 26
   E-mail (altern.): konstantin@kabassanov.com</p></td></tr><tr><td style=\"width: 472px; padding: 0cm 5.4pt 0cm
 5.4pt;\" valign=\"top\"><p class=\"MsoNormal\"> </p></td></tr></tbody></table><p class=\"MsoNorm
al\"> </p><p class=\"MsoNormal\"> </p></div><p>Document joint incorrect : smime.p7s (application/pkcs7-sig
nature)</p>
    [_link] => Array
        (
            [link] => 1
            [tickets_id_1] => 5586
            [tickets_id_2] => 0
        )

    [_plugin_fields_type] => dom
    [_plugin_fields_subtype] =>
    [crditutiliserfield] =>
    [nombredecommandefield] =>
    [update] => Sauvegarder
    [_read_date_mod] => 2021-10-22 11:06:09
    [id] => 5586
    [_glpi_csrf_token] => 18da6bdeffa9e0786ee229ff5d445dab1e8df4616c395035fbc91abe002b2b85
    [_no_history] =>
    [itilcategories_id_code] =>
    [_date_creation_calendars_id] => Array
        (
            [0] => 1
        )

    [_users_id_assign] => Array
        (
            [0] => 7753
        )

    [_groups_id_assign] => Array
        (
            [0] => 4772
            [1] => 4828
        )

    [_users_id_requester] => Array
        (
            [0] => 7753
        )

    [_locations_id_of_requester] => 0
    [users_default_groups] => 0
    [_no_rule_matches] => 1
    [_rule_process] =>
    [_groups_id_of_requester] => Array
        (
            [379] => 379
            [3544] => 3544
            [354] => 354
            [353] => 353
            [4828] => 4828
            [3576] => 3576
            [362] => 362
            [4767] => 4767
            [4766] => 4766
            [4768] => 4768
            [4772] => 4772
            [4769] => 4769
            [4770] => 4770
            [4771] => 4771            
            [4765] => 4765
            [376] => 376
            [349] => 349
            [350] => 350
            [3536] => 3536
        )

    [itilcategories_id_cn] => 84
)

Missing:

 input=Array
(
    [status] => 6
    [id] => 5586
    [_disablenotif] => 1
    [_no_history] =>
    [_date_creation_calendars_id] => Array
        (
            [0] => 1
        )

    [_users_id_assign] => Array
        (
            [0] => 7753
        )

    [_groups_id_assign] => Array
        (
            [0] => 4772
            [1] => 4828
        )

    [_users_id_requester] => Array
        (
            [0] => 7753
        )

    [_locations_id_of_requester] => 0
    [users_default_groups] => 0
    [_no_rule_matches] => 1
    [_rule_process] =>
    [_groups_id_of_requester] => Array
        (
            [379] => 379
            [3544] => 3544
            [354] => 354
            [353] => 353
            [4828] => 4828
            [3576] => 3576
            [362] => 362
            [4767] => 4767
            [4766] => 4766
            [4768] => 4768
            [4772] => 4772
            [4769] => 4769
            [4770] => 4770
            [4771] => 4771
            [4765] => 4765
            [376] => 376
            [349] => 349
            [350] => 350
            [3536] => 3536
        )

    [itilcategories_id] =>
)

Page URL

No response

Steps To reproduce

No response

Your GLPI setup information

No response

Anything else?

No response

kabassanov commented 3 years ago

Category also disappears during mailcollector ticket import. At the beggining the field is present in the input/output array (passing from 0 to the correct value according to a rule), but after an assignment "type = 2", categories fields [itilcategories_id] => ... and [itilcategories_id_cn] simply disappear.

github-actions[bot] commented 2 years ago

There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days.

If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue. If it is related to a new feature, please open a topic to discuss with community about this enhancement on suggestion website.

You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.

kabassanov commented 2 years ago

Didn't see anything to correct this. So for me, the issue is still present.

cedric-anne commented 2 years ago

Hi,

As discussed in #10553 , in rules, $input only contains values that were passed in input. So in massive actions context, or followup creation context, it is normal that many values are missing, and changing this may lead to many unwanted side effects.

The fact that some values that are always present even if no input related to them is actually passed is, IMHO, due to a bad design.

I am pretty sure that the behaviour you are searching for will not be available with a simple fix and will only be available after a huge refactoring of the business rules system, so I tend to close this issue and add a wontfix tag. @orthagh @trasher, what do you think about this ?

Regards

kabassanov commented 2 years ago

Hi cedric-anne,

This issue seems to be solved by https://github.com/glpi-project/glpi/pull/10075. I have to make some additional tests, but I'm pretty sure it is what I need in my case.

kabassanov commented 2 years ago

Sorry, as you pointed out in your previous message, it could not work like this, simply because massive action "input" does not contain itilcategories_id...