Menu

Make attachment mandatory on ticket resolution

2018-11-26
2024-09-02
  • mouna mhiri

    mouna mhiri - 2018-11-26

    Hello,

    I want to make it mandatory for my users to link at least one attachment to a ticket on resolution.

    What are the steps to do it ?

    Thank you
    Best regards

     
  • Vincent @ Combodo

    To my knowledge that's not possible/easy
    Maybe adding some PHP code on the method DoCheckToWrite() to control that at least one attachment was added.
    An other option is to add a AttributeFile to the Ticket class and make it mandatory at resolution time.

     
  • mouna mhiri

    mouna mhiri - 2018-11-30

    Hello Vdumas,
    Thanks for your help, I tried by updating DoCkeckToWrite() and it works.

     
  • Merey Omirbek

    Merey Omirbek - 2024-08-29

    Can you help me, how did it work for you, I can’t do the same?

     
  • Merey Omirbek

    Merey Omirbek - 2024-08-29

    Thank you. But I have version 3.0, I wrote the code but it doesn't seem to work

    $status = $this->Get('status');
    $item_id = $this->Get('id');
    if ($status == 'registered') {
    $oqlObject = new DBObjectSet(DBObjectSearch::FromOQL("SELECT Attachment WHERE item_id = $item_id"), array(), array());
    if($attachment = $oqlObject->Fetch())
    {
    $this->m_aCheckIssues[] = Dict::S('Class:Ticket/Error:NoManager');
    return;
    } else{
    $this->m_aCheckIssues[] = Dict::S('Class:Ticket/Error:Error8');
    return;
    }
    }

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-08-29

    So registered is a custom state you added?

     
  • Merey Omirbek

    Merey Omirbek - 2024-09-02

    thanks, I found the solution
    $oqlObject = new DBObjectSet(DBObjectSearch::FromOQL("SELECT Attachment WHERE item_id = $item_id"), array(), array());
    $attachment = $oqlObject->Fetch();
    if(!$attachment)

     
  • Vincent @ Combodo

    You should also set a condition on the item_class, otherwise your test might be pretty false, item_id is only unique within a given class...

     
    👍
    1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.