Instructions for Sugar CRM

Instructions for Sugar CRM


Table of Contents:


A. Starting Sugar CRM
B. Inserting a Custom Field
C. How to Import
D. Adding Custom Fields to the Search Form
E. Edit the SubPanels on Detail Pages
F. Adding a JavaScript Calendar to a Date Field
G. Quick Changes
-> Add a Value to a Drop-Down List
-> Map a Probability to a Sales Stage
-> Making a Read-Only Field Not Read-Only
-> Change Date Format from YYYY-MM-DD to MM/DD/YYYY
-> Change the Name of a Variable
H. Troubleshooting and FAQs
I. Unsolved Changes

A. Starting Sugar CRM:

1. Open up a terminal to execute shell commands (terminal is located on bottom
left, near the L button).
Type:
/cd Opt
The terminal will print out the following:
root:/opt#
Then Type:
lampp/lampp start
The terminal will print out the following:
Starting XAMPP for Linux 1.4.14...
XAMPP: Starting Apache with SSL (and PHP4)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.

2. Open up Firefox (shortcut located on the desktop, top right).
Go to:
http://localhost/sugarsuite
Sugar CRM is now started and ready to go.

B. Inserting a new custom field:
There are at least 6 files you will need to edit in order to have a custom
field work. These files can be found in /opt/lampp/htdocs/sugarsuite/modules/modulename,
and it is easiest if you right-click on one of the PHP files, choose "Advanced Text
Editor", and then open the rest of the files so you can view them all at once.

1. ModuleName.php (ex: Accounts.php, Opportunities.php, etc.)
There are three places you need to put in the new info, search for lines
that are like these:
var $variablename;
And type in:
var $yourvariable;

Now find a line that either looks like
,"variablename"
or
'variablename',
And, following whichever syntax it uses, type in your variable.
,"yourvariable"
or
'yourvariable',

Finally, find the list_fields array and add in your variable to it. It looks
like this:
var $list_fields = Array(
Here is what you would enter:
'someothervariable', 'yourvariable'
ModuleName.php is now done.

2. language/en_us.lang.php controls the labels for your module.
To make a new label for your variable, go to the end of the array:
);
Before that line, type in:
'LBL_YOURVARIABLE' => 'Variable:',
An example of this is:
'LBL_NAME' => 'Name:',
Which is used to designate the name of the account, opportunity, etc.

3. EditView.php
First, you must assign the variable to mean something, and to focus it
on the variable's name.:
$xtpl->assign("VARIABLENAME", $focus->variablename);
On a new line, do this with your own variable.
$xtpl->assign("YOURVARIABLE", $focus->yourvariable);
Note that the first part of the assign is in all-quotes, and that the
$focus-> is in lowercase letters.
If your variable is a drop-down list ("picklist"), you have to do another
assign, for the options:
$xtpl->assign("YOURVARIABLE_OPTIONS", get_select_options_with_id($app_list_strings['yourvariable_dom'], $focus->yourvariable));
yourvariable_dom is defined in sugarsuite/includes/language/en_us.lang.php
file, but I will specify more about that later in step 7.

4. EditView.html
There are two areas to worry about for EditView.html: DataLabels and
DataFields. These are two classes for the columns in the table which
displays the information.
DataLabel columns:
<td class="dataLabel"><slot>{MOD.LBL_YOURVARIABLE}</slot></td>
The MOD denotes that this label is from the current module, and
LBL_YOURVARIABLE is the label you designated in step 2.
DataField columns:
<td class="dataField"><slot><input type='text' name='yourvariable' tabindex='1' size='25' value='{YOURVARIABLE}'></slot></td>
The <slot></slot> tags let Sugar know that this is a valid place
for information to be. You can also add in maxlength='#' to control
how many characters a user can enter.
Also available are drop-down lists, which should follow this format:
<td class="dataField"><slot><select name='yourvariable' tabindex='1'>{YOURVARIABLE_OPTIONS}</select></slot></td>
The {YOURVARIABLE_OPTIONS} was assigned in EditView.php, so we don't
have to worry about setting the options each time your variable
comes up.
Now your Edit page should work.

5. DetailView.php
As with EditView.php, you must assign and focus your variable.
$xtpl->assign("YOURVARIABLE", $focus->yourvariable);
However, if your variable is a drop-down list, you do not need to do a
special assign for it. It uses the same format as above.

6. DetailView.html
Also similar to EditView.html, there are two areas that are affected:
tabDetailViewDL and tabDetailViewDF (DL=DataLabel, DF=DataField).
tabDetailViewDL columns:
<td class="tabDetailViewDL"><slot>{MOD.LBL_YOURVARIABLE}</slot></td>
The MOD denotes that this label is from the current module, and
LBL_YOURVARIABLE is the label you designated in step 2.
tabDetailViewDF columns:
<td class="tabDetailViewDF"><slot>{YOURVARIABLE}</slot></td>
This is much simpler than EditView.html's DataField slot, since
all that is needed is for Sugar to print out your variable's
value, and not have a place for you to type/select it.
Your Detail page should now reflect the new data you enter from the
Edit page.

7. sugarsuite/include/language/en_us.lang.php
=>This file should be editted only if you wish to create a custom drop-down
list.
To create your own drop-down list, find a space after any array,
which is designated by an end parenthesis and comma:
),
Now, define the name of your drop-down list, like so:
'yourvariable_dom' =>
After doing that, you define the values in your drop-down list:
array(
'Option 1' => 'Option 1',
'Option 2' => 'Option 2',
To end your array, repeat the same end parenthesis and comma:
),
Altogether, it should look something like this:
'yourvariable_dom' =>
array(
'Option 1' => 'Option 1',
'Option 2' => 'Option 2',
'Option 3' => 'Option 3',
),
Be sure not to use any single quotes (') in your options, because
it will break the drop-down list (and possibly other drop-down
lists).
A blank option can be created at the top of an array by doing the
following:
'' => '',
This is useful for drop-downs that are not required.

8. Putting the field into MySQL:
This is the most important step; if not done, your field will not show up
and you will get a MySQL error when trying to save/edit.
Go to http://localhost/phpmyadmin.
Select "sugarcrm (61)" from the drop-down list in the left-hand
column.
Choose the module you wish to add to from the list of tables.
Scroll to the bottom of the structure, but above the SQL query
box. You will see the following field:
Add ___ field(s) () At End of Table () At Beginning of Table () After [picklist] [GO]
Choose 1 field, at the end of the table (unless you want to put
the new field in between already existing fields). Hit "Go".
In the field textbox, type yourvariable. Choose "VARCHAR", and set
the field max length. If your variable is a date, you may wish to
choose "date" as the type.
Now your custom field is in the database and ready!

9. Making your custom field importable:
Go to sugarsuite/modules/Import/ImportModule.php, where "Module" is the
module that yourvariable is located.
Under the "var $importable_fields = Array(" array, enter
yourvariable so that it may be importable.
Go to sugarsuite/modules/Import/language/en_us.lang.php
Add your label to the array for your module.
You don't need to worry about having a custom field exportable, since Sugar
will dump the whole database table on export.

If you need to remove a field, just do these steps backwards. However, certain Sugar
pre-defined fields should not be removed, because they will cause errors (account_id,
etc.). It should be noted that using the WYSIWYG custom field editor (under Admin panel)
will cause Sugar to have errors and fail in the long run.


C. Importing a file:

1. Open warboard/file in Excel and save as a comma delimited file (.CSV). If you're
using the Linux box, right-click on the warboard, choose "Open With-> OpenOffice.org
1.1.4 Calc". Continue as you would in Excel.

2. Open Sugar CRM, go to the module you want to import to, and choose "Import" from
the right-hand menu.
- Choose 'Custom Comma Delimited File' and then click 'Next'.
- Click 'browse' and find the .csv file you just created. Click 'Next'.
- Map the fields to your columns. Now, this may seem slightly confusing,
but it isn't. The names of the variables should correspond with the
columns in your file. Make sure that none of the variables are used more
than once, and that each of the required variables are used.
3. Click 'Import now'.
4. Review the list to make sure that all of your file was imported (Sugar will print
out successful, unsuccessful, and other problems with your file).
5. If you're unsatisfied with the import, click the 'Undo Last Import' button. If you
are satisfied with the import, you don't need to click anything else.


D. Adding Custom Fields to the Search Form:
Now that you have a custom field and can import it, you'll probably want to be able to
search for it.

1. Open modules/YourModule/SearchForm.html
- If you want your variable to show up on the Basic Search, edit lines 29-51
(this number may grow depending on how many variables are added to Basic
Search, but is defined by <!-- BEGIN: main --> and <!-- END: main -->).
<td class="dataLabel" noWrap><slot>{MOD.LBL_YOURVARIABLE}</slot>
<slot><input type=text size="20" name="yourvariable" class=dataField value="{YOURVARIABLE}" /></slot></td>
Add that in wherever you want your field to show up. Do the same for the
Advanced Search section, denoted by <!-- BEGIN: advanced --> and
<!-- END: advanced -->.

=>Note that the variable must be defined in the fields_list array in
modules/YourModule/YourModule.php for it to be included in the search without problems.


E. Edit the SubPanels on Detail Pages:
For these instructions, I will use the Activities Module (which encompasses Calls, Notes,
Meetings, and Tasks) as an example. To edit a SubPanel for, say, Opportunities, if is for
an Activity, the SubPanelView.php/.html file that must be changed is the one for
Activities, since the Opportunities page links to that file, not its own.

1. modules/Activities/SubPanelView.php
To add a new button (such as "Create Completed Task"), scroll down to either
the Open Activities section or History section, depending on where you want to
change. I have added in comments to show the beginning and end of the Open
Activities and History sections. Find the code that looks like this:
$button .= "<input title='".$current_module_strings['LBL_NEW_TASK_BUTTON_TITLE']."' accessKey='".$current_module_strings['LBL_NEW_TASK_BUTTON_KEY']."'class='button' οnclick=/"this.form.action.value='EditView';this.form.module.value='Tasks'/" type='submit' name='button' value='".$current_module_strings['LBL_NEW_TASK_BUTTON_LABEL']."'>/n";
Put in yourvariable, and define what you want the button to do in the onclick
function. If you want to simply create a new task, then EditView and Tasks are
the correct values to have in the form.action.value and form.module.value. You
may change the Action and Module value accordingly.

2. modules/Activities/language/en_us.lang.php
You must define the BUTTON_TITLE, BUTTON_KEY, and BUTTON_LABEL values in here.
BUTTON_TITLE should be the Alt text, BUTTON_KEY should be a letter not already
used by Sugar to create a shortcut to the button, and BUTTON_LABEL should be the
text that shows up on the button.

You can also change the categories that show up underneath each category, such as Account
Name and Assigned User.

1. modules/Activities/SubPanelView.html
I will use the Open Activities section for example purposes. To add in or take
out a category that you do not need, find it first in the header section (before
<!-- BEGIN: row -->):
<!-- BEGIN: open_activity -->
<table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView">
<tr height="20" class="listViewThS1">
<td scope="col"width="2%" class="listViewThS1"><img src="include/images/blank.gif" widht="1" height="1" alt=""></td>
<td scope="col" width="6%" class="listViewThS1">{MOD.LBL_LIST_CLOSE}</td>
<td scope="col" width="30%" class="listViewThS1">{MOD.LBL_LIST_SUBJECT}</td>
<td scope="col" width="15%" class="listViewThS1">{MOD.LBL_LIST_STATUS}</td>
<td scope="col" width="10%" class="listViewThS1">{MOD.LBL_LIST_CONTACT}</td>
<td scope="col" width="22%" class="listViewThS1">{MOD.LBL_LIST_RELATED_TO}</td>
<td scope="col" width="10%" class="listViewThS1">{MOD.LBL_LIST_DUE_DATE}</td>
<td scope="col" width="5%" class="listViewThS1"><img src="include/images/blank.gif" widht="1" height="1" alt=""></td>
</tr>
Taken out whichever category you do not need, and add in the variable of one you
do need, like this:
<td scope="col" width="15%" class="listViewThS1">{MOD.LBL_LIST_YOURVARIABLE}</td>
Make sure that the width percentages do not add up to more than 100%.
Next, find the variable that you entered your new variable after, and add in
yours:
<!-- BEGIN: row -->
<tr height="20" οnmοuseοver="setPointer(this, '{ACTIVITY.ID}', 'over', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');" οnmοuseοut="setPointer(this, '{ACTIVITY.ID}', 'out', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');" οnmοusedοwn="setPointer(this, '{ACTIVITY.ID}', 'click', '{BG_COLOR}', '{BG_HILITE}', '{BG_CLICK}');">
<td nowrap valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1">{ACTIVITY_MODULE_PNG}</td>
<td nowrap valign=TOP align='center' bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1">{ACTIVITY.SET_COMPLETE}</td>
<td scope='row' valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1"><a href="{URL_PREFIX}index.php?action=DetailView&module={ACTIVITY.MODULE}&record={ACTIVITY.ID}{RETURN_URL}" class="listViewTdLinkS1">{ACTIVITY.NAME}</a></td>
<td nowrap valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1">{ACTIVITY.TYPE} {ACTIVITY.STATUS}</td>
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1"><a href="{URL_PREFIX}index.php?action=DetailView&module=Contacts&record={ACTIVITY.CONTACT_ID}{RETURN_URL}" class="listViewTdLinkS1">{ACTIVITY.CONTACT_NAME}</a></td>
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1"><a href="{URL_PREFIX}index.php?action=DetailView&module={ACTIVITY.PARENT_MODULE}&record={ACTIVITY.PARENT_ID}{RETURN_URL}" class="listViewTdLinkS1">{ACTIVITY.PARENT_NAME}</a></td>
<td nowrap valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1">{ACTIVITY.DATE}</td>
<td nowrap align="center" valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1"><a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module={ACTIVITY.MODULE}&record={ACTIVITY.ID}{RETURN_URL}">{EDIT_INLINE_PNG}</a>&nbsp;<a class="listViewTdToolsS1" href="{URL_PREFIX}index.php?action=EditView&module={ACTIVITY.MODULE}&record={ACTIVITY.ID}{RETURN_URL}">{APP.LNK_EDIT}</a>&nbsp;&nbsp;<a class="listViewTdToolsS1" οnclick="return confirm('Are you sure you want to delete this activity?')" href="{URL_PREFIX}index.php?action=Delete&module={ACTIVITY.MODULE}&record={ACTIVITY.ID}{RETURN_URL}">{DELETE_INLINE_PNG}</a>&nbsp;<a class="listViewTdToolsS1" οnclick="return confirm('Are you sure you want to delete this activity?')" href="{URL_PREFIX}index.php?action=Delete&module={ACTIVITY.MODULE}&record={ACTIVITY.ID}{RETURN_URL}">{APP.LNK_DELETE}</a></td>
</tr>
If you have taken out a row, also make sure to remove its column.
<td valign=TOP bgcolor="{BG_COLOR}" class="{ROW_COLOR}S1"><a href="{URL_PREFIX}index.php?action=DetailView&module=Accounts&record={ACTIVITY.YOURVARIABLE}{RETURN_URL}" class="listViewTdLinkS1">{ACTIVITY.YOURVARIABLE}</a></td>
Be sure to focus your variable to the correct Module and Page.


F. Adding a JavaScript Calendar to a Date Field:

1. modules/YourModule/EditView.php
Add in these assigns:
$xtpl->assign("CALENDAR_LANG", "en");$xtpl->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
$xtpl->assign("TIME_MERIDIEM", $timedate->AMPMMenu('', $focus->time_due));
$xtpl->assign("TIME_FORMAT", '('. $timedate->get_user_time_format().')');
$xtpl->assign("USER_DATEFORMAT", '('. $timedate->get_user_date_format().')');
$xtpl->assign("CALENDAR_DATEFORMAT", $timedate->get_cal_date_format());

2. modules/YourModule/EditView.html
Paste the following where you want your date field to show up:
<td class="dataField"><slot><input name='yourvariable' id='yourvariable_field' type="text" tabindex='9' size='11' maxlength='10' value="{YOURVARIABLE}"> <img src="themes/{THEME}/images/jscalendar.gif" alt="{APP.LBL_ENTER_DATE}" id="yourvariable_trigger" align="absmiddle"> <span class="dateFormat">{USER_DATEFORMAT}</span></slot></td>
Go to the bottom of the document, before {JAVASCRIPT} and after </form>,
and paste this:
<script type="text/javascript">
Calendar.setup ({
inputField : "yourvariable_field", ifFormat : "{CALENDAR_DATEFORMAT}", showsTime : false, button : "yourvariable_trigger", singleClick : true, step : 1
});
</script>


G. Quick Changes:
The following mini-tutorials will show how to make a quick change to something that's
already existing.

1. Add a value to a drop-down list:
- Go to include/language/en_us.lang.php.
- Find the array that defines the drop-down list that you wish to add to.
- Add your new value in: "Your Value" => "Your Value",
- Save and close.

2. Map a probability to a sales stage:
- Open modules/opportunities/OpportunitiesFormBase.php, find $focus->save
and use this:
if($_REQUEST['sales_stage']=="yoursalesstage"){
mysql_query("UPDATE opportunities SET probability='xx'");
}

3. Making a read only field not read only:
- Open the EditView.html file that has the field that is readonly.
- Find the field, and remove the {READONLY} variable, or 'readonly'.

4. Change the date format from YYYY-MM-DD to MM/DD/YYYY:
- Under My Account, click on 'Edit'.
- Change your date format to whichever one you like.
- You can also change your time format to military or 12-hour time.

5. Changing the name of a variable:
- Open modules/YourModule/language/en_us.lang.php
- Find the variable that needs its label changed.
- Change to 'MOD.LBL_YOURVARIABLE' => 'New Name',


H. Troubleshooting and FAQs:

1. My individual pipeline is not showing any of my opportunities.
- Go to "Edit" (upper right-hand corner of the pipeline) and change
the dates that are displayed. Opportunities being out of the date
range often cause this problem. Also try refreshing the graph.

2. I cannot view a task/opportunity/account/etc.
- If you've searched in that module recently, try hitting the "clear" button,
since Sugar may think you're still searching for the previous term.
- If you haven't searched recently, make sure that the item you're trying
to view is assigned to you; Certain users cannot see other users' items,
and certain ones can.

3. The first opportunity that I imported was not inserted into the database.
- Make sure "Has Header" is not checked when importing, because it will strip
the first line from the CSV file.

4. The "Top Opportunities" section of my homepage is out of order, showing
opportunities that are worth less than others.
- This is a former bug caused by a mis-code: The code was ordering
opportunities by the number of digits in the amount. The amount is
originally entered in either Yen (? or USD ($), and since there are
approximately 108?to $1, Sugar was reading this as two more digits. The
bug was fixed, so this shouldn't happen again.

5. How do I change the conversion rate of ?to USD?
- Go to the Admin panel (logged in under the admin account), and go to the
currency page (link in the "System" table). To edit ? click on it, then
press 'Save' when you are done.
- You can also create a new currency or conversion rate here.



I. Unsolved Changes:

1. Selecting a Project from the Opportunity page:
What is known:
- Problem probably lies in the Project module, under any of these
files: SubPanelView.php, Popup.php, Popup_picker.html
- If you copy Popup.php from another module, Projects has errors with
includes/listview/ListView.php
What is not known:
- Why it won't select a Project and close the window, even though
that function is clearly defined in Popup.php.
- What the missing link is, and/or how to make the errors from
includes/listview/ListView.php go away.

2. On "Create Completed Task" button, set date and time to today's date and noon:
The probable reason for this not working is that in order for a variable
to be set to a certain value, it must be a drop-down list or "hidden".

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值