View Issue Details

IDProjectCategoryView StatusLast Update
0006325mantisbtfilterspublic2019-09-26 09:12
ReporterMTW Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version1.0.0rc2 
Summary0006325: Added DATETIME data type, added Simple Text Search on custom fields
Description

Hi all,
I have done some customizations to mantis.

If anyone is interested, I have added the DATETIME data type and the Simple Text Search on custom fields.

It works great for me, but I'm a little noob of php so if you think that something is wrong.. let me know how to fix

If you like it... use it!

Byez
MTW

Additional Information

The DATETIME uses the $g_normal_date_format instead of $g_short_date_format both in input and in output (print)
on the right of the combo of hours and minutes I have printed the date format.
I thought it could be useful to avoid misunderstandings between m/d/y and d/m/y but I think you can delete it if you don't like it.

The Simple Text Search works on date/datetime fields as well, but for now I had to hardcode some MySQL specific SQL statement.. any idea to make it installation-independent is appreciated. :)

TagsNo tags attached.
Attached Files
mantis-1.0.0rc2.zip (36,969 bytes)
filter_api.zip (21,439 bytes)

Relationships

related to 0007183 acknowledged new search function on field and custom field 

Activities

fman

fman

2005-10-17 02:32

reporter   ~0011500

Good!.

It'seems to me that a litte part missing, the changes to:
$g_custom_field_type_enum_string

to something like: '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:datetime';

MTW

MTW

2005-10-17 03:30

reporter   ~0011501

You are right, i forgot to include my custom files. :)

In the meanwhile I have moved the define from constant_inc.php to custom_constant_inc.php

1) in your main mantis dir (not core) create a new file named custom_constant_inc.php and add following lines to it
<?php
define( 'CUSTOM_FIELD_TYPE_DATETIME', 9 );
?>

2) in config_inc.php add the new type to enum string
$g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:datetime';

if english is not your main language, in your main mantis dir (not core) create a new file named custom_strings_inc.php and add to it following lines with your local translation (in the example italian)
<?php
$s_custom_field_type_enum_string = "0:Stringa,1:Numerico,2:Virgola mobile,3:Valori prestabiliti,4:Email,5:Checkbox,6:Lista,7:Lista a scelta multipla,8:Data,9:Data e ora";
?>

look here for further information
http://forums.mantisbt.org/viewtopic.php?t=786

Byez
MTW

MTW

MTW

2006-02-21 05:35

reporter   ~0012201

My filter_api.php modified to enable simple text search on custom fields

Schroedi

Schroedi

2006-04-07 10:53

reporter   ~0012475

To prevent an mysqlerror when you disable 'filter_by_custom_fields' ($g_filter_by_custom_fields = OFF;)
replace:

MTW - 2005-09-29 - Search in Custom Fields

We need this to close our custom search clause

$t_textsearch_where_clause = $t_textsearch_where_clause . ")";
with:

MTW - 2005-09-29 - Search in Custom Fields

We need this to close our custom search clause

if ( ON == config_get( 'filter_by_custom_fields' ) ) {
$t_textsearch_where_clause = $t_textsearch_where_clause . ")";
}
in ./core/filter_api.php

MTW

MTW

2006-04-10 11:57

reporter   ~0012484

You are right Schroedi, thank you.
I have never disabled that config option and so I never realized that error.

HeikoNorderstedt

HeikoNorderstedt

2006-10-11 07:37

reporter   ~0013604

Hi MTW,

could You please upload your modified PHP files again.
A modification for the actual mantis version 1.05 would be great.

tmatijasevic

tmatijasevic

2008-11-21 18:26

reporter   ~0019978

I am trying to apply this to version 1.1.4 .. Filters show sutom feilds in my version BUT search box will not return a result if I search for anything in the custom feilds. I believe this is the solution for my problem BUT I I am having problems knowing where to begin because filter_api.php was changed so much in ver 1.14 and also because this zip file lacks commenting noting only what was changed/added. 3 things:

  1. Can someone provide a diff file?
  2. Does anyone have a version of this that has already been ported to 1.1.4?
  3. Does the author of this bug report/upgrade report want to make the changes to 1.14 and upload it so I can get a copy?

Any help would be appreciated. I too am a noob to php but have some limited skill.

Best,
Tom

tmatijasevic

tmatijasevic

2008-11-22 01:26

reporter   ~0019979

Ok - I figured this out.. I ported the custom feild search and special date/time changes made by MTW to version 1.1.4 filter_api.php... Also included the bug fix by SCHROEDI noted above. Special thanks to MTW for doing a hell of a job on this. The logic does not look that simple and it is impressive for a noob. I am posting 2 fields..

  1. Moded Version 1.1.4 filter_api.php which is more or less a replacement of the "# custom field filters" section from MTW;s earlier version pasted into version 1.1.4...

  2. I am including a diff file generated by ultraedit.

Hope this is usefull and ALSO urge developers of mantis to consider this for futre revisions. It s a little more overhead on the server but is not noticable. Load times are the same on my equipment. However, the functionality of being able to search custom feilds is a HUGE benefite to users of this system.

tmatijasevic

tmatijasevic

2008-11-22 01:35

reporter   ~0019980

Sorry guys - Mantis service is messing up right now.. I keep getting this error no matter what i try to attach.

APPLICATION ERROR #503
Invalid upload path. Directory either does not exist or not writable to webserver.

I WILL TRY AGAIN TOMMAROW

tmatijas

tmatijas

2008-11-25 18:16

reporter   ~0020052

I have uploaded verrsion 1.1.4 with MTWs custom search mod. Enjoy

jamesbond2011

jamesbond2011

2011-01-03 02:16

reporter   ~0027774

Anyone have any idea about adding simple text search on Custom Fields for MantisBT 1.2.4

Marnix

Marnix

2019-09-05 07:22

reporter   ~0062733

I have this functionality almost to work under 2.22.

Only when i submit a new ticket and i leave the hours en minutes field '0' (default) the custom_field is not saved at all in de DB.
The custom_field is only saved in de DB when i change the field to another time without an '0'. Only then it is saved in the DB.

The strange thing is, that this issue doesn't apply when i try to update/edit an existing ticket. Even when the field 'datetime' is empty in the first place, the functionality works perfectly.

see also topic: https://mantisbt.org/forums/viewtopic.php?f=4&amp;t=786

Any help is appreciated. Thx.

MPAA

MPAA

2019-09-26 09:12

reporter   ~0062914

datetime custom_field functionality ready in version 2.21.1

https://github.com/Maximus48p/datetime_customfield