Hello!
I solved this issue modifying the function change_login located in the lib/userslib.php file.
This is the output of the svn diff:
Index: lib/userslib.php =================================================================== --- lib/userslib.php (revision 62864) +++ lib/userslib.php (working copy) @@ -2697,27 +2697,48 @@ $this->query('update `tiki_object_relations` set `target_itemId`=? where target_type="user" and `target_itemId`=?', array($to, $from)); $this->query('update `tiki_freetagged_objects` set `user`=? where `user`=?', array($to, $from)); - $this->query( - 'update `tiki_tracker_item_fields`ttif' . - ' left join `tiki_tracker_fields` ttf on (ttif.`fieldId`=ttf.`fieldId`)' . - ' set `value`=? where ttif.`value`=? and ttf.`type`=?', - array($to, $from, 'u') - ); $this->query('update `tiki_tracker_items` set `createdBy`=? where `createdBy`=?', array($to, $from)); $this->query('update `tiki_tracker_items` set `lastModifBy`=? where `lastModifBy`=?', array($to, $from)); - $result = $this->query("select `fieldId`, `itemChoices` from `tiki_tracker_fields` where `type`='u'"); - + $result = $this->query("select ttif.`itemId`, ttf.`fieldId`, ttf.`itemChoices`, ttif.value from `tiki_tracker_fields` ttf + LEFT JOIN `tiki_tracker_item_fields` ttif + on (ttif.`fieldId`=ttf.`fieldId`) + where ttf.`type`='u'"); + $resFieldIdAnt = ""; while ($res = $result->fetchRow()) { - $this->query('update `tiki_tracker_item_fields` set `value`=? where `value`=? and `fieldId`=?', array($to, $from, $res['fieldId'])); - $u = ($res['itemChoices'] != '' ) ? unserialize($res['itemChoices']) : array(); + $values = explode(",", $res['value']); - if ($value = array_search($from, $u)) { - $u[$value] = $to; - $u = serialize($u); - $this->query('update `tiki_tracker_fields` set `itemChoices`=? where `fieldId`=?', array($u, $res['fieldId'])); + if(count($values)>1){//Check if is a list of comma separated values + + if ($v = array_search($from, $values)) { + $values[$v] = $to; + $fromAux = $res['value']; + $toAux = implode(",", $values); + $this->query('update `tiki_tracker_item_fields` set `value`=? where `value`=? and `fieldId`=? and `itemId`=? ', array($toAux, $fromAux, $res['fieldId'],$res['itemId'])); + } + + }else{//Is a unique value + + if($res['value'] == $from){ + $this->query('update `tiki_tracker_item_fields` set `value`=? where `value`=? and `fieldId`=? and `itemId`=? ', array($to, $from, $res['fieldId'],$res['itemId'])); + } + } + + //Avoiding make the same query many times. + if($resFieldIdAnt!=$res['fieldId']){ + + $u = ($res['itemChoices'] != '' ) ? unserialize($res['itemChoices']) : array(); + + if ($value = array_search($from, $u)) { + $u[$value] = $to; + $u = serialize($u); + $this->query('update `tiki_tracker_fields` set `itemChoices`=? where `fieldId`=?', array($u, $res['fieldId'])); + } + + } + $resFieldIdAnt = $res['fieldId']; } $cachelib->invalidate('userslist'); TikiLib::events()->trigger('tiki.user.update', array('type' => 'user', 'object' => $from));
I didn't did the commit yet because is my first commit and I want you to check it
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
The URL for the show.tikiwiki.org instance that demonstrates this bug is at: http://bsfez-11581-6326.show.tikiwiki.org. Note that if you get a popup asking for a username/password, please just enter "show" and "show". This is different from the initial login and password for a new Tiki which is "admin" and "admin".
For the install log, see http://bsfez-11581-6326.show.tikiwiki.org/info.txt
Note that if you see PHP errors or a Tiki claiming to be missing third party software, the instance creation is probably not finished. Please wait a couple minutes and reload.
Snapshots are database dumps of the configuration that developers can download for debugging. Once you have reproduced your bug on the show.tikiwiki.org instance, create a snapshot that can then be downloaded by developers for further investigation.
Snapshots can be accessed at: http://bsfez-11581-6326.show.tikiwiki.org/snapshots/. Note that if you get a popup asking for a username/password, please just enter "show" and "show".
Create new snapshotfilename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |