Not possible to delete user

7 years 9 months ago #7 by SniperPike
I tried to do it manualy as you explained, but it didnt work out. Even tried to delete everything (Every issue, every project etc) but still, could'nt delete any users.

If you got some code, that could fix it, I'll appriciate it. I cant code myself, but I could probably find someone who can insert the code the right place.

I'll try to install the component again, without demo-content, and see if its useable. Otherwise, I hope you update the component soon, it really is what I need :)

Sincerely,
Martin

Please Log in or Create an account to join the conversation.

7 years 9 months ago - 7 years 9 months ago #8 by SniperPike
Doublepost, but couldnt delete.....


Sincerely,
Martin

Please Log in or Create an account to join the conversation.

7 years 9 months ago #9 by chrisc
Replied by chrisc on topic Not possible to delete user
If you deleted the issues, and then still couldn't delete the users it sounds like the 'deleted issues' were still present in the 'trash'. Depending upon which 'delete options' you chose would determine whether they are 'removed' or placed in the 'trash. If the issues were present in the trash that would certainly explain why the foreign key reference was still objecting. You would need to empty the issue trash to get rid of them permanently.

I will look out the change I made It's been a while (several months) since I last looked at that code so it may take a short while.

Certainly uninstalling and re-installing will clear out all the database tables etc, and put you back on a 'clean' component basis.

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

7 years 9 months ago #10 by SniperPike
YES, that worked :)

It was because the deleted issues, stil was in the trash bin. Emtpy the trash solved it. Now I can delete the users again. Looking forward to play further tonight.

Thx

sincerely,
Martin

Please Log in or Create an account to join the conversation.

7 years 9 months ago - 7 years 9 months ago #11 by chrisc
Replied by chrisc on topic Not possible to delete user
Thank you for confirming. I have looked at the code change required and it is all in one file.

Given that you now know how to work around the problem, you may or may not be interested in the fix below.

You would need to change the file admin/components/com_issuetracker/models/itpeople.php.

After line 16 add the following to load the helper routines.
if (! class_exists('IssueTrackerHelper')) {
    require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_issuetracker'.DS.'helpers'.DS.'issuetracker.php');
}

Then we need to modify the delete method which now require changes after the new line no 319. Change lines 320 to 343 to the following:
                  // Also add check for default assignee on project table!
                  // Two updates peformed to avoid changing both fields at once when only one should be changed!
                  // Build query strings first
                  $query   = 'UPDATE `#__it_issues` SET assigned_to_person_id = '.$def_assignee;
                  $query  .= ' WHERE assigned_to_person_id in (';
                  
                  $query1  = 'UPDATE `#__it_issues` SET identified_by_person_id = '.$deluser;
                  $query1 .= ' WHERE identified_by_person_id in (';

                  foreach($pks as $pk) {
                     // Assigneee is a user_id so convert from the id given.
                     $pkuid = IssueTrackerHelper::get_ituser_id($pk);
                     $query  .= $pkuid . ',';
                     
                     $query1 .= $pk . ',';
                  }

                  $query  = substr($query,  0, -1) . ')' ;
                  $query1 = substr($query1, 0, -1) . ')' ;
                  
                  // Now Update any assigned issues
                  $this->_db->setQuery( $query );
                  // print("Query: $query<p>");

                  $res = $this->_db->execute();
                  if ($res) {
                     $affectedRows = $this->_db->getAffectedRows($res);
                     $app->enqueueMessage(JText::sprintf('COM_ISSUETRACKER_DELETE_MODE_ROWS_REASSIGNED_MSG', $affectedRows));
                     // echo $affectedRows.' Rows Affected';
                  } else {
                     $app->enqueueMessage(JText::_('COM_ISSUETRACKER_DELETE_MODE_REASSIGNED_MSG'));
                  }
                  
                  // Now Update any identified issues
                  $this->_db->setQuery( $query1 );
                  // print("Query: $query1<p>");

                  $res = $this->_db->execute();
                  if ($res) {
                     $affectedRows = $this->_db->getAffectedRows($res);
                     $app->enqueueMessage(JText::sprintf('COM_ISSUETRACKER_DELETE_MODE_ROWS_REASSIGNED_MSG', $affectedRows));
                     // echo $affectedRows.' Rows Affected';
                  } else {
                     $app->enqueueMessage(JText::_('COM_ISSUETRACKER_DELETE_MODE_REASSIGNED_MSG'));
                  }
                 
                  // Now delete the users themselves
                  // Iterate the items to delete each one.
                  foreach ($pks as $pk) {
                     if (!$row->delete( $pk )) {
                        $this->setError( $row->getError() );
                        return false;
                     }
                  }

This will resolve the problem but ideally the last displayed message about 'issues reassigned' should read 'issues re-identified' should also be changed. This is handled in the release but would require a new language string to be specified which I have omitted in the above code change for simplicity.

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

7 years 9 months ago #12 by SniperPike
Cool work, I'll try it out.. Just reinstalled.

Althought I've found out how to delete, when removing the issues, it is not a usable solution.

I need to keep the issues, even if I delete the user.

Sincerely,
Martin

Please Log in or Create an account to join the conversation.

Time to create page: 0.188 seconds
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries