Menu

How to reset ItopCounter?

Keerati
2023-01-06
2023-02-06
  • Keerati

    Keerati - 2023-01-06

    Hi,

    I have used iTop 3.0

    I have a custom ticket number as INC2022000001 or CHG2022000002 Then I want to change the year 2023 and reset the ticket number to INC2023000001.

    I'm trying to find information in this discussion.
    https://sourceforge.net/p/itop/discussion/customizing-itop/thread/4e074a9a/?limit=25#c5dc/c126/24fc

    Does anyone know how to reset ItopCounter?
    or does anyone else have a better way? Please advise us.

    Thank you.

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2023-01-06

    I believe you could manually alter the value in the key_value_store database table. Not 100% sure though, definitely make sure you don't start with a lower ID number than what was set as this may result in duplicate IDs!

     

    Last edit: Jeffrey Bostoen 2023-01-06
  • Pierre Goiffon

    Pierre Goiffon - 2023-02-06

    Hello,
    Indeed to have an incremental counter per year you'll have to change the way the counter is incremented. In the default datamodel (considering the reference values you gave, you already made some modifications) it is done in Ticket::DBInsertNoReload. The easiest way to do would be to pass the class + the year to \ItopCounter::IncClass

     
  • Pierre Goiffon

    Pierre Goiffon - 2023-02-06

    The easiest way to do would be to pass the class + the year to \ItopCounter::IncClass

    Sorry I answered too quickly
    Looking at the code the class is indeed used in the callback set in \ItopCounter::IncClass
    So you'll have to write your own implementation, maybe a children of ItopCounter and just an override of \ItopCounter::IncClass ?

     

    Last edit: Pierre Goiffon 2023-09-04

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.