Delete a User in Sugar CRM

If you have used SugarCRM, you probably have found out by now that there is no easy way to eradicate a user from your database (Check the SugarCRM forum).  I am not sure why this is not an option in the community, honestly, I have not seen the paid version so i do not know if the paid version provides such option.

I have created this stored procedure to help me out and hopefully it will help  somebody else:

1.   First,  you do not want to start deleting. You must first assigned any objects owned by the olduser to another user. To do that you must know the user id of both users (users table find the id column).  Just copy and paste and run the code below on MySQL to create the stored procedure. Then Call the stored procedure using the ids.

something like : Call DeleteReplaceUser (olduser, newuser)

2.   Once you have assigned all objects owned by the disgruntled employee (for example) to the other employee, you can now safely delete the user.

DELIMITER $$

CREATE DEFINER=`admin`@`` PROCEDURE `DeleteReplaceUser`(olduser varchar(20), newuser varchar(20))
BEGIN
-- assigned objects owned by old user to the new user
update accounts set assigned_user_id=newuser where assigned_user_id = olduser;
update address_book set assigned_user_id=newuser where assigned_user_id = olduser;
update bugs set assigned_user_id=newuser where assigned_user_id = olduser;
update calls set assigned_user_id=newuser where assigned_user_id = olduser;
update campaigns set assigned_user_id=newuser where assigned_user_id = olduser;
update cases set assigned_user_id=newuser where assigned_user_id = olduser;
update contacts set assigned_user_id=newuser where assigned_user_id = olduser;
update dashboards set assigned_user_id=newuser where assigned_user_id = olduser;
update emails set assigned_user_id=newuser where assigned_user_id = olduser;
update folders_subscriptions set assigned_user_id=newuser where assigned_user_id = olduser;
update import_maps set assigned_user_id=newuser where assigned_user_id = olduser;
update leads set assigned_user_id=newuser where assigned_user_id = olduser;
update meetings set assigned_user_id=newuser where assigned_user_id = olduser;
update opportunities set assigned_user_id=newuser where assigned_user_id = olduser;
update project set assigned_user_id=newuser where assigned_user_id = olduser;
update project_task set assigned_user_id=newuser where assigned_user_id = olduser;
update prospect_lists set assigned_user_id=newuser where assigned_user_id = olduser;
update prospects set assigned_user_id=newuser where assigned_user_id = olduser;
update saved_search set assigned_user_id=newuser where assigned_user_id = olduser;
update sugarfeed set assigned_user_id=newuser where assigned_user_id = olduser;
update tasks set assigned_user_id=newuser where assigned_user_id = olduser;
update user_preferences set assigned_user_id=newuser where assigned_user_id = olduser;
update users_last_import set assigned_user_id=newuser where assigned_user_id = olduser;

-- Now You are ready to delete the olduser
delete from users where id = olduser;

END$$

reference :

http://dev.mysql.com/tech-resources/articles/mysql-storedproc.html

http://www.sugarcrm.com/forums/showthread.php?t=4896


css and links

Here is the deal, no matter how often I do it,  I keep on  forgetting the right syntax for adding links in CSS.  Being a seasoned designer, it frustrates me sometimes that something that easy takes some of my precious time.

I know what you are saying: ” Google is a couple of clicks away”. You know what, you are right but I am kind of tired of all theses ADS  sites and sometimes they clog the web  making the information very difficult to find. Too much talking let’s go straight to the point:

Links In CSS

a:link
{
color: #FFF;
text-decoration: none;
background-color:  #ff00ff;
font-weight: normal;
}

a:visited
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

a:hover
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

a:active
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

Classes and links
class name : software
something  like  

All links within this  container:

a.software:link
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }
or

.software a:link
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }  

With html elements and div tags  the syntax looks something like:

p a:link
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

or Something like:

#software a:link
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

or Even better

#software p a:link
 {
 color: #FFF;
 text-decoration:  none;
 background-color: #ff00ff;
 font-weight: normal;
 }

If you want to learn CSS check the following site: w3schools

Iterate through a Sharepoint List

Programming is the Microsoft world is full of surprise. I have learned from experience that the easier its sounds the more difficult it may be. That is why I avoid anything that is too easy in the Microsoft world. The other day i wanted to just iterate through a custom list  using worflow and to my surprise there are no easy ways to do that (there are no “for” nor “while” loop..).  Note that I am only a seasoned sharepoint developer/designer who just wanted to get a little project out of the door.  After googling around I found the following article. Once I understood the concept I was able to get everything up and running.

Read the following from start to finish
http://office.microsoft.com/en-us/sharepointdesigner/HA102378301033.aspx

It is easy to dismiss this section below from the article for me it was the most important.

Whenever a lookup does not find matching data, it returns the string ?????. For example, if you define a workflow lookup to select the value of the Title field from the Tasks list where the Assigned To field equals "John", but there is no task assigned to "John", the lookup would return ?????. To resolve this, you can open the appropriate lookup and change the filter criteria so that the query returns a matching item.

Attach your workflow to the list that is most like a master list and that has more or less all the data that can be used in your workflow. This way you can use a lot more values from the current item in your lookups rather than creating complex lookups to get values from other lists.

Whenever a lookup encounters a variable that does not have data in it, it returns the string ****. To resolve this, open the workflow and make sure that the variable is set to a value (or initialized).

To clear the contents of a Define Workflow Lookup dialog box, click the Clear Lookup button in that dialog box

Taken from directly from  Microsoft.

Other Resources

http://www.sharepointdesignerworkflow.com/list

http://sharepointsolutions.blogspot.com/2008/05/looping-through-items-in-sharepoint.html

Add A New Hardrive Linux

Add A New Hardrive Linux (Redhat family)

You just purchased your new hard drive and now you are ready to add it to your Linux system. Here are the steps:

1.  Plug in the hard drive

2.  Make sure that the bios can see it (Attention vmware users, the bios may not display the new drive)

3.  Navigate to the /dev folder and locate your hard drive

4. IDE drive are hda(X ), scsi drive are sda(X) with X being a number

5. Create the partition using parted or fdisk.

6. Then Format the partition using mkfs

               mkfs -t ext3 /dev/sdb2

7. Then Mount the file System

                For  Example: mount -t ext3 /dev/sdb2 /ycsoftware.

8. Add an entry into fstab if necessary

9. Done.


Reference

http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/index.html

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/s1-filesystem-ext3-create.html

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-disk-storage.html