Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8173093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:00:44+00:00 2026-06-06T22:00:44+00:00

I am working on customizing an installation of the Mantis bugtracker, version 1.2.8, to

  • 0

I am working on customizing an installation of the Mantis bugtracker, version 1.2.8, to include a dynamic custom enum field on the bug report page. I was able to figure out how to setup the dynamic enum and created the corresponding function to generate its possible values. Here is what I have so far:

Manage -> Manage Custom Fields -> “Legacy Job Number”

Name: “Legacy Job Number”
Type: Enumeration
Possible Values: =legacy_job_number
Default Value: 0
Read and Write access: viewer
Min. Length: 1
Max. Length: 0
Add to Filter: checked
Display When Creating Jobs: checked
Display When Updating Jobs: checked

custom_functions_inc.php

function custom_function_override_enum_legacy_job_number() {
    $t_project_name = project_get_name( helper_get_current_project() );
    $t_job_time_code = htmlentities(trim(substr(date('U'), 6, 9)));
    $t_project_description = project_get_field( helper_get_current_project(), 'description', '' );

    $t_project_description = "$t_project_description";
    $t_job_code = $t_project_description . "2012" . $t_job_time_code; 
    $t_possible_values_array = array("", "$t_job_code");

    $t_possible_values = implode( '|', $t_possible_values_array );

    return $t_possible_values;
}

The problem that I am having is that every time I try to submit a new job or update an existing job with the “legacy job number” field attached as-is, I get Application Error #1303, ‘Invalid value for field “Legacy Job Number”.’

I have tracked the problem down to the timestamp value generated by $t_job_time_code = htmlentities(trim(substr(date(‘U’), 6, 9))); — if I remove it, the bug report submits fine. (As you can see, I’m just hard-coding the date in $t_job_code, which is not ideal, but works.)

What I ultimately want to do is postpend a four-digit number to the “legacy job number” string that is 99.99% likely to be unique, as it will be used to identify a specific bug. I thought that using a timestamp would work well for this since it constantly increments, but apparently Mantis does not like that. I have tried a number of variations on this and really don’t want to use a random number generated by rand() or mt_rand() since that could still result in duplicates.

Can anyone help to explain (1) why this is happening, and (2) what I might try to fix it?

Many thanks for your consideration and help.

Best,
Peter

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:00:47+00:00Added an answer on June 6, 2026 at 10:00 pm

    After completing additional analysis, I have a solid theory about what is causing the problem. I found that I was able to use date(“Y”) and date(“m”) to generate a string of the form

    201207

    When submitting a bug report with this string included, to my surprise it worked fine. The last hurdle was the unique number on the end of the “job code”. I found that if I used date(‘U’), 6, 9 to generate the last three numbers, submitting the bug report failed every time, likely because the last digit changes every second.

    If, however, I use date(‘U’), 4, 3 and submit the bug report, it works. By my rough calculations, the last digit in this string — 0000001000 in the context of the entire UNIX timestamp — changes slightly more than every 16 minutes. As I mentioned initially, I needed some way to generate a unique number. I believe that my first method wasn’t working because when the bug report page was initially loaded, one “job code” was created. Let’s say it was “ADM2012447”. But because the Unix timestamp is continually incremented, submitting the bug report resulted in a different 3 digit number being submitted with the bug report, something which Mantis did not like.

    Again, this is just a solid theory, not a confirmed fact. Please correct me if I am mistaken.

    As a final word on my solution, I realize that if two or more bug reports are submitted in any given 16ish minute window, they are likely to have identical job code numbers. If this does happen, it will likely be pretty isolated based on system use, and even if it’s not, Mantis’s own unique bug numbering system will allow for easy differentiation.

    Thank you to all those who read and considered this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on customizing a couple of open source projects in ways that are
I am working on customizing a closed source client application. It has a tree
I am working on customizing my tabbar background image and i resolved this for
I am working on customizing the layout of OFC2 so it can be properly
I'm working on a wordpress site, customizing the menu. I'm no php whiz, and
I am working on customizing TFS workitem template for quite a while. But I
I have been working with customizing the formatter in Eclipse to suit my style
I'm working on customizing a SharePoint document library called Quality Documents so that when
I am working on customizing the layout of a Silverlight Toolkit Chart. I have
I am currently working on a website which includes using Datatables. After customizing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.