customization - iTop - Get caller's IP in tickets -


in itop, how possible save caller's ip address in tickets (user request , incident)

i tried modify datamodel.itop-tickets.xml in extension module. added field named 'ip' in <methods> section can not client's ip using $_server['remote_addr'] .

<methods>             <method id="dbinsertnoreload"  _delta="redefine">                 <static>false</static>                 <access>public</access>                 <type>overload-dbobject</type>                 <code><![cdata[ public function dbinsertnoreload() {       $omutex = new itopmutex('ticket_insert');       $omutex->lock();       $inextid = metamodel::getnextkey(get_class($this));       $sref = $this->maketicketref($inextid);       $this->set('ref', $sref);       $ikey = parent::dbinsertnoreload();       $omutex->unlock();       return $ikey;        $this->set('ip', $_server['remote_addr'] ); }     ]]></code>             </method>                        </methods> 

after lots of attempts found solution :) must redefine method of type lifecycleaction , i've redefined computeimpacteditems method in both inciudent , userrequest classes.

for make clear show 1 of them here:

<class id="incident">         <methods>                 <method id="computeimpacteditems"  _delta="redefine">                         <static>false</static>                         <access>public</access>                         <type>lifecycleaction</type>                         <code><![cdata[ public function computeimpacteditems()                             {                                 // method kept backward compatibility                                 // in case delta redefines it, may call                                 // updateimpacteditems directly                                 $this->updateimpacteditems();                                  // line added exstension saving caller's ip                                 $this->set('ip', $_server['remote_addr']);                             }]]></code>                 </method>         </methods>     </class> 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -