•  
      request #6635 Updating an artifact without status causes error
    Infos
    #6635
    Laurent Delaigue (ldelaigue)
    2021-07-24 12:33
    2014-04-04 17:06
    7678
    Details
    Updating an artifact without status causes error
    I try to update an artifact which has no status.
    I'm using Tuleap 6.12

    This causes an error here:
    PHP Fatal error: Call to a member function getId() on a non-object in /usr/share/codendi/plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List.class.php on line 643

    Here is the JSON sent:
    {
    "values":[
    {"field_id":1172,"value":"20"},
    {"field_id":1179,"bind_value_ids":[]}, // <--- This is the line that causes the problem. If removed, the update is successful
    {"field_id":1183,"links":[{"id":137},{"id":133},{"id":136}]},
    {"field_id":1173,"value":"Sprint 1"},
    {"field_id":1174,"value":"2014-04-04T00:00:00+02:00"},
    {"field_id":1177,"value":"10"}
    ]
    }

    API
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Yannis ROSSETTO (rossettoy)
    Declined
    2021-07-24
    Attachments
    References
    References list is empty

    Follow-ups

    User avatar

    The patch has been abandoned, I will close this issue.


    • Status changed from Under implementation to Declined
    • Close date set to 2021-07-24
    User avatar
    Nice catch. I reproduce the fatal error.

    I will be able now to fix it.

    • Status changed from Waiting for information to Under implementation
    User avatar
    Yannis, I did the same test as you and got the same result.

    Then I submitted the equivalent of:
    Request 3
    =========
    PUT /v1/artifacts/2279

    Request body
    ------------
    {
    "values": [
    {"field_id":6272,"value":"Sprint 02 REST v2"},
    {"field_id":6278,"bind_value_ids":[1060]}
    ]
    }

    (where 1060 is a valid ID for the status combo-box)

    And I received a 500 Internal Error.

    User avatar
    So I did these two HTTP requests:

    Request 1
    =========
    POST /v1/artifacts

    Request body
    -----------------
    {
    "tracker": {"id": 530},
    "values": [ {"field_id":6272,"value":"Sprint 02 REST"} ]
    }

    Response Body
    --------------------
    {
    "id": 2279,
    "uri": "artifacts/2279",
    "tracker": { "id": 530, "uri": "trackers/530" }
    }

    Request 2
    =========
    PUT /v1/artifacts/2279

    Request body
    ------------
    {
    "values": [
    {"field_id":6272,"value":"Sprint 02 REST v2"},
    {"field_id":6278,"bind_value_ids":[]}
    ]
    }

    Response code
    -------------
    200 OK

    So all seems OK.
    User avatar
    last edited by: Laurent Delaigue (ldelaigue) 2014-04-11 14:19
    I understand what you say Yannis, what I mean is that it's impossible to not have a status via the website, whereas it's unfortunately possible via the connector (a bug on our side, we need to analyse this with you to understand exactly how to manage combo-boxes). So you cannot produce this issue with tickets created via the website.
    Alos, this is just what I believe to understand about the issue at the moment, so maybe I'm wrong...

    Anyway, I'm looking forward to getting the results of your test.

    By the way, you need to create the artifact via REST, AND update it via REST also! The issue does not exist if you use the website (according to my tests)
    User avatar
    The creation process is not different if we use REST routes or the web UI.
    So the fact that the artifact is created with REST should not have side effects.

    But I will test it:

    * Create a sprint through REST without status
    * Update this artifact
    User avatar
    Hi Yannis,

    I think you cannot produce the problem by creating a ticket via the website.
    The problem seems to occur because the connector allows users to create a ticket without a status (status is not set to New automatically, contrary to the website).
    The Tuleap server allows such a creation, without setting the status to New either.
    And then, it's impossible to update the ticket via REST, but it is possible via the website.

    Is there a way to export a ticket so that I can provide you a ticket which exposes this problem?
    User avatar
    Hello Laurent.

    Still no issue on my side with your tracker ...

    Do you face this issue only on this tracker ?
    User avatar
    Hello Laurent,

    On my side, I'm not able to reproduce this bug.
    Can you provide me you tracker structure ?

    • Status changed from New to Waiting for information
    • Assigned to changed from None to Yannis ROSSETTO (rossettoy)
    User avatar
    Actually, it's more serious than I thought:
    I can't update the status value of the artifact, it also fails if I send
    {"values":[
    {"field_id":1172,"value":"20"},
    {"field_id":1179,"bind_value_ids":[1060]}, // <- this is the status
    ...
    ]
    }