[SOLVED] Date changes to current date when editing asset

Moderator: crythias

Locked
jschlueter
Znuny newbie
Posts: 88
Joined: 16 May 2012, 18:50
Znuny Version: 4.0.4
Real Name: Justin Schlueter
Company: Kimberly Area School District

[SOLVED] Date changes to current date when editing asset

Post by jschlueter »

I did a mass import with certain dates to when they were purchased. It imported fine, however when I go into the asset it changes the purchase date to the current date. It looks like this only happens on the ones that I did a mass import on. Any thoughts on how to fix this so it doesn't change all of our purchase dates? Thanks
Last edited by jschlueter on 15 Jan 2013, 20:45, edited 1 time in total.
jschlueter
Znuny newbie
Posts: 88
Joined: 16 May 2012, 18:50
Znuny Version: 4.0.4
Real Name: Justin Schlueter
Company: Kimberly Area School District

Re: Date changes to current date when editing asset

Post by jschlueter »

I just saw that the format I had it in was "m/dd/yyyy" and when in the CMDB it shows the date at "mm/dd/yyyy." However when I did an import again with the format of "mm/dd/yyyy" it still didnt work.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Date changes to current date when editing asset

Post by crythias »

API timestamps the entries. You may consider commenting the timestamp (or adding an if clause) in the code on import.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jschlueter
Znuny newbie
Posts: 88
Joined: 16 May 2012, 18:50
Znuny Version: 4.0.4
Real Name: Justin Schlueter
Company: Kimberly Area School District

Re: Date changes to current date when editing asset

Post by jschlueter »

Thanks for your reply...however, where would i go to make that comment? Thanks
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Date changes to current date when editing asset

Post by crythias »

It depends what interface you're using to do the import. (What's the Action/Subaction or the API or screen, or ...)
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
jschlueter
Znuny newbie
Posts: 88
Joined: 16 May 2012, 18:50
Znuny Version: 4.0.4
Real Name: Justin Schlueter
Company: Kimberly Area School District

Re: Date changes to current date when editing asset

Post by jschlueter »

When doing the Imports I am just going to the Admin button and then to Import/Export and then I created a Hardware Inventory area and thats how I import our devices in bulk.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Date changes to current date when editing asset

Post by crythias »

I don't have enough information about the ITSM module that you're using to import (it's not my specialty).

Basically, the concept is that the .pm for the module (see the URI in the address bar for more explicit information) would contain something like ...

Code: Select all

	    return if !$Self->{DBObject}->Do(
	        SQL => 'INSERT INTO imexport_template '
	            . '(imexport_object, imexport_format, name, valid_id, comments, '
	            . 'create_time, create_by, change_time, change_by) VALUES '
	            . '(?, ?, ?, ?, ?, current_timestamp, ?, current_timestamp, ?)',
	        Bind => [
	            \$Param{Object}, \$Param{Format}, \$Param{Name}, \$Param{ValidID},
	            \$Param{Comment}, \$Param{UserID}, \$Param{UserID},
	        ],
	    );
And so ... there should be a replacement of current_timestamp with a ? and a bind param relating to the date from the import. (No, I don't know how to do that for this instance) or you could try direct to database as it's likely the same concept. (No guarantees. Backup database ... this is just based upon cursory inspection and while it might work, it may not, and I am still basing this off of incomplete data.)

I hesitate to answer these things because I don't really know the answer for ITSM/ITIL and your systems are unique to you. Whatever you try should be in a test environment that won't break production. If it works, great, but if it doesn't, you're relying on information from someone who primarily provides support on the interface side of non ITSM/ITIL OTRS. What's presented here is a sample of what the code *is* and why the code timestamps now/today.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
Sophy978
Znuny newbie
Posts: 83
Joined: 06 Jul 2012, 22:01
Znuny Version: 3.1.5
Real Name: Sophy

Re: Date changes to current date when editing asset

Post by Sophy978 »

jschlueter wrote:When doing the Imports I am just going to the Admin button and then to Import/Export and then I created a Hardware Inventory area and thats how I import our devices in bulk.
Hi I am having the exact same problems with my data import. Did you get a resolution to your issue? If so, could you please share? Thanks. :)
jschlueter
Znuny newbie
Posts: 88
Joined: 16 May 2012, 18:50
Znuny Version: 4.0.4
Real Name: Justin Schlueter
Company: Kimberly Area School District

[SOLVED] Date changes to current date when editing asset

Post by jschlueter »

Figured out what the problem with this was. When I was exporting assets to a csv, excel was automatically change the date format. So then when I put a date in the csv, the format that I thought it should be because it exported that way it didn't work. I opened the export in Notepad and found that when it exports the format is "yyyy-mm-dd". Once I changed it to that then the dates stay when editing the asset for the first time.
Locked