Showing posts with label SugarCRM. Show all posts
Showing posts with label SugarCRM. Show all posts

Thursday, January 31, 2019

SugarCRM: Assignment Email Template Custom

(Anhgolden's Blog) - Để điều chỉnh Email Template - Assignment Notification.

Copy
./include/language/en_us.notify_template.html

To
./custome/include/language/en_us.notify_template.html


Read More »

Friday, October 20, 2017

SugarCRM: Reset HomePage

(Anhgolden's Blog) - Mặc định Default HomePage của SugarCRM bao gồm các Dashlets sau:
a) Discover SugarCRM
b) SugarCRM News
c) Các Dashlets mặc định (Calls, Cases, Meetings, Opportunities, Accounts, Leads)

Để thay đổi Layout hoặc Disable "Discover SugarCRM" và "SugarCRM News" thì sửa file:
\modules\Home\index.php (line 98)

Để sửa đổi hoặc sắp xếp các Dashlets mặc định, thì sửa file:
\custome\modules\Home\dashlets.php
Read More »

Friday, August 18, 2017

SugarCRM: Additional Details in ListView Custom

(Anhgolden's Blog) - Chỉnh sửa Additional Details Box in ListView

Khi ta click vào biểu tượng [i] bên phải ngoài cùng của dòng dữ liệu trong ListView, Additional Details box sẽ mở ra - xem như Quick View thông tin.

Để mở rộng phạm vi của Quick View này, ta chỉnh sửa file:

Edit: [crm]\custom\modules\[module_name]\metadata\additionalDetails.php
Read More »

Thursday, December 11, 2014

SugarCRM: How to make Account Name not required in Cases Module?

(Anhgolden's Blog) -

Tạo 1 file tại custom/Extension/modules/Cases/Ext/Vardefs/[filename].php

Với nội dung như sau:

$dictionary['Case']['fields']['account_name']['required'] = false;

Sau đó Admin >> Repair >> "Quick Repair and Rebuild".
Read More »

Thursday, June 6, 2013

SugarCRM: Global Search for custom module and field

(Anhgolden's Blog)-Để SugarCRM Search hay Global Search của SugarCRM có thể tìm thấy thông tin trên 1 filed mới hoặc module mới, xin chia sẻ cách thực hiện như sau:

Bạn nên tìm hiểu thêm ở bài viết này http://developers.sugarcrm.com/wordpress/2011/03/30/new-in-sugar-6-2-global-search-custom-modules/ và cùng trải nghiệm ví dụ thực tế của tôi.

Tôi có 1 nhu cầu bổ sung thêm 1 field có tên đặt là "Contact_ID" trong module Contact.

B1: Vào Admin - Studio - Chọn Module Contacts - Add new field
Lưu ý: kết quả Field name là "contact_id_c"

B2: Điều chỉnh layout theo nhu cầu. Bổ sung field "Contact_ID" vào Edit View, Details View và List View

B3: Create or edit file custom/Extension/modules/YOUR_CUSTOM_MODULE/Ext/Vardefs/vardefs.php and add the unified_search attributes to the fields you wish to run global search on:
<?php
$dictionary['YOUR_CUSTOM_MODULE']['unified_search'] = true;
$dictionary['YOUR_CUSTOM_MODULE']['unified_search_default_enabled'] = true;
$dictionary['YOUR_CUSTOM_MODULE']['fields']['NAME_OF_FIELD_TO_SEARCH']['unified_search'] = true;
?>
Cụ thể:
<?php
$dictionary['Contact']['unified_search'] = true;
$dictionary['Contact']['unified_search_default_enabled'] = true;
$dictionary['Contact']['fields']['contact_id_c']['unified_search'] = true;
?>
Lưu ý: 'Contact' không có 's'.

B4: Create or edit the file custom/modules/YOUR_CUSTOM_MODULE/metadata/SearchFields.php. If you are creating this file, you may simply copy the modules/YOUR_CUSTOM_MODULE/metadata/SearchFields.php file into the custom/modules/YOUR_CUSTOM_MODULE/metadata directory. Add your field to the search definitions:
‘NAME_OF_FIELD_TO_SEARCH’ => array( ‘query_type’=>’default’)
$searchFields['Contacts'] =
 array (
  'first_name' => array( 'query_type'=>'default'),
  'last_name'=> array('query_type'=>'default'),
  'contact_id_c'=> array('query_type'=>'default'),
B5: Repair and Rebuild 
Read More »

Thursday, March 21, 2013

SugarCRM: Lỗi IMAP Permission Denied Error

(Anhgolden's Blog)- Khi khai báo email trong SugarCRM, mặc dù Server đã hỗ trợ đầy đủ các Module cho email imap, smtp... và kiểm tra username/password của email hoàn toàn chính xác, tuy nhiên vẫn không thể sử dụng được email. Báo lỗi:
Can't connect to {email server}: Permission denied
Please check your settings and try again.
Sau khi tìm hiểu, nguyên nhân là do SELinux đang ở chế độ Enable. Cách khắc phục như sau:
Edit file /etc/selinux/config. Nội dung trong file có dạng như sau:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
Hãy sửa SELINUX=permissive hoặc SELINUX=disabled

Reboot hoặc Restart service.
Read More »

Tuesday, December 25, 2012

SugarCRM: Stock and Inventory Module

(Anhgolden's Blog)-Ngoài những Module cần thiết cho nhu cầu kinh doanh như: Product (Quản lý hàng hóa, sản phầm), Invoice (Quản lý hóa đơn), Quote (Báo giá). Tôi còn có nhu cầu quản lý xuất - nhập - tồn hàng hóa.

Tôi xin chia sẻ cách thức tôi tạo 1 Module đơn giản quản lý xuất - nhập - tồn như sau:

Bước 1: Tạo mới 1 Module - Inventory Module
Trong đó, bao gồm các trường như:
- Ngày nhập xuất
- Hàng hóa: Được link đến module Product (Tôi chọn type là Relate to Product Module)
- Số lượng
- Diễn giải

Bước 2: Tạo 1 trigger trên SQL
Để khi có 1 sự kiện nhập hoặc xuất trên Inventory Module sẽ tính Tồn kho (Stock) và ghi vào bảng Product (tôi dùng cột Part_number để hiển thị Stock).

CREATE TRIGGER `insert_stock` AFTER INSERT
ON `aos_inventory` FOR EACH ROW
BEGIN
        SET @ton = new.Quantity;
        SET @ma_hang = new.aos_products_id_c;
        UPDATE aos_products
        SET part_number = IFNULL(part_number, 0) + IFNULL(@ton, 0)
        WHERE id = @ma_hang;
END;
Ngoài ra, có thể tạo thêm 1 Trigger để điều chỉnh Stock khi có chỉnh sửa số lượng Inventory.
CREATE TRIGGER `update_stock` AFTER UPDATE ON `aos_inventory`
 FOR EACH ROW BEGIN
SET @old = old.Quantity;
SET @new = new.Quantity;   SET @ma_hang = new.aos_products_id_c;
  UPDATE aos_products
  SET part_number = IFNULL(part_number, 0) + IFNULL(@new-@old, 0)
  WHERE id = @ma_hang;
END;
Read More »

Wednesday, October 10, 2012

SugarCRM: Customize text field size

(Anhgolden's Blog)-Để thay đổi kích cỡ của 1 trường nhập thông tin (Customize text field size) trong SugarCRM, xin chia sẻ cách làm như sau:

1. Mở file 
custom/modules/[Ten-module]/metadata/editviewdefs.php

2. Tìm và sửa:
Ví dụ:

array (
'name' => 'comments_c',
'label' => 'LBL_COMMENTS',
'displayParams'=>array('rows'=>20, 'cols'=>80),
),

Hoặc

'displayParams'=>array('size'=>20,),

Read More »

Thursday, October 4, 2012

SugarCRM: Edit header and footer

(Anhgolden's Blog)-Để sửa đổi phần "header" và "footer" trong SugarCRM, tôi xin chia sẻ cách thực hiện như sau:

1. Sửa Header:
Tìm và sửa file /include/globalControlLinks.php

2. Sửa Footer:
Tìm và sửa file /themes/[theme_name]/tpls/footer.tpl

Read More »

Monday, September 3, 2012

SugarCRM: Strict Standards Error on install

(Anhgolden's Blog)-Trong trường hợp install SugarCRM trên Xampp, gặp lỗi:

"Strict Standards: Declaration of SugarEmailAddress::save() should be compatible with that of SugarBean::save() in /opt/lampp/htdocs/crm/include/SugarEmailAddress/SugarEmailAddress.php on line 888
..."

Hướng khắc phục:

Thay đổi giá trị trong php.ini
error_reporting = E_ALL | E_STRICT thành error_reporting = OFF
Read More »

Thursday, July 26, 2012

SugarCRM: Vietnamese language pack

(Anhgolden's Blog)-Tiếp theo bài viết chia sẻ cách Việt hóa cho SugarCRM. Tôi xin chia sẻ thêm cách tạo 1 file cài đặt (SugarCRM Vietnamese language pack) và sử dụng Module Loader để Upload bộ ngôn ngữ tiếng Việt cho SugarCRM.

Bước 1: Việt hóa các file en_us.lang.php thành các file vn_vn.lang.php và các cây thư mục:
include\language\vn_vn.lang.php
modules\[tên module]\language\vn_vn.lang.php

Bước 2: Tạo 1 file manifest.php đặt cùng với thư mục include và modules ở trên.
Nội dung như sau:

<?php
$manifest = array( 
 'name' => 'Vietnamese language pack',
        'description' => 'Visit: <a href="http://www.anhgolden.com" target="_blank">http://www.anhgolden.com</a>',
 'type' => 'langpack',
 'is_uninstallable' => 'Yes',
 'version' => '6.2.0',
 'acceptable_sugar_flavors' => array ( 0 => "CE", 1 => "PRO", 2 => "CORP", 3 => "ENT", 4 => "ULT"),
 'author' => 'Anhgolden',
 'acceptable_sugar_versions' => array ( "exact_matches" => array (), "regex_matches" => array ( 0 => "6.*.[0-9][a-z]?" ), ),
 'published_date' => '23-07-2012',
);

$installdefs = array(
 'id'=> 'vn_vn',
 'image_dir'=>'<basepath>/images',
 'copy' => array(
 array('from'=> '<basepath>/include','to'=> 'include',),
 array('from'=> '<basepath>/modules','to'=> 'modules'))
);
?>

Bước 3: Tạo 1 file nén *.zip bao gồm file manifest.php và các thư mục đã Việt hóa (include, modules...)

Đến đây ta đã hoàn thành việc tạo 1 file SugarCRM Vietnamese language pack.

Với cách làm này, ta có thể áp dụng để tạo các file SugarCRM Module Upload khác.
Lưu ý: Một số trường hợp báo lỗi, thường liên quan đến Permission của file và thư mục. Bạn cần phải kiểm tra và set lại quyền cho phép chép lên thư mực của SugarCRM.

Đối với việc Việt hóa các Module bổ sung thêm khác, ta làm tương tự và điều chỉnh lại file minifest như sau:
<?php
$manifest = array( 
 'name' => 'AOS Module - Vietnamese language pack',
    'description' => 'www.anhgolden.com',
 'type' => 'module',
 'is_uninstallable' => 'Yes',
 'version' => '6.2.*',
 'acceptable_sugar_flavors' => array ( 0 => "CE", 1 => "PRO", 2 => "CORP", 3 => "ENT", 4 => "ULT"),
 'author' => 'Anhgolden',
 'acceptable_sugar_versions' => array ( "exact_matches" => array (), "regex_matches" => array ( 0 => "6.*.[0-9][a-z]?" ), ),
 'published_date' => '05-10-2012',
);

$installdefs =array(
        'id' => 'package_1341607504',
        'copy' => array(
            0 => array(
                'from' => '<basepath>/modules',
                'to' => 'modules',
            ),
        ),
);
?>

Xin chia sẻ file SugarCRM Vietnamese Language Package:
[Download] - Update 2012-10-05
Read More »

Tuesday, July 24, 2012

SugarCRM: Việt hóa

(Anhgolden's Blog)-Xin chia sẻ cách thực hiện Việt hóa cho SugarCRM.

Bước 1: Sửa file config.php

Tìm:
  array (
    'en_us' => 'English (US)',
  ),

Bổ sung:
  array (
    'en_us' => 'English (US)',
    'vn_vn' => 'Tiếng Việt (VN)',
  ),

Nếu muốn mặc định hiển thị Ngôn ngữ Tiếng Việt

Tìm: 'default_language' => 'en_us',
Điều chỉnh:  'default_language' => 'vn_vn',


Bước 2: Việt hóa

Copy các file en_us.lang thành file vn_vn.lang, sau đó Việt hóa.
Cụ thể các file sau:
- include\language\en_us.lang --> vn_vn.lang
- modules\[tên module]\language\en_us.lang --> vn_vn.lang


Download SugarCRM Vietnamese language pack tại bài viết: http://www.anhgolden.com/2012/07/sugarcrm-vietnamese-language-pack.html
Read More »

Thursday, June 14, 2012

SugarCRM: Bổ sung Google Map vào CRM

(Anhgolden's Blog)-Nhu cầu hiển thị Google Map dựa trên địa chỉ của khách hàng trên CRM là rất cần thiết đối với Doanh nghiệp giao nhận hoặc cần tiếp xúc trực tiếp tại địa chỉ khách hàng...

Xin chia sẻ cách thực hiện như sau:

Cơ bản sẽ tạo 1 field mới theo kiểu iframe và sử dụng google map apps, dựa vào tham số địa chỉ (address) để hiển thị Map.

Read More »

Monday, April 16, 2012

SugarCRM: WYSIWYG / HTML Editor TinyMCE

(Anhgolden's Blog)-SugarCRM sử dụng bộ công cụ soạn thảo HTML (WYSIWYG / HTML editor) là TinyMCE và chỉ áp dụng cho box soạn thảo email (Email compose hoặc Email template).

Nay để sử dụng HTML editor cho các text box khác, xin chia sẻ cách triển khai như sau:

1. Sử dụng Module WYSIWYG Editor Mudule (xem chi tiết tại đây).
2. Bổ sung thêm Upload Images Add-in cho TinyMCE:
Mặc định TinyMCE không có sẵn Icon Upload Images. Do đó để sử dụng tính năng bổ sung Upload Images cho TinyMCE, ta có thể dùng 1 Add-in của 3rd Party (xem chi tiết tại đây).

Read More »

SugarCRM: Login and logout tracking

(Anhgolden's Blog)-Một nhu cầu khá quan trọng trong việc quản trị các thành viên sử dụng CRM đó là xem lịch sử đăng nhập và đăng xuất.

Xin chia sẻ Module: Login logout tracker (xem chi tiết tại đây). Module ghi nhận bao gồm: username, địa chỉ IP, thời gian và trạng thái login và logout.
Read More »

Friday, April 6, 2012

SugarCRM: Remove SugarNews Iframe in administration

(Anhgolden's Blog)-Mặc định trong mục Administration, phía trên cùng luôn có mục SugarNews iframe. Nếu muốn bỏ đi mục này, ta thực hiện như sau:

Tìm file và thực hiện: 

/modules/Administration/index.php

$sugar_smarty->assign('MY_FRAME',"Xoa iFraime o day");
Read More »

Monday, April 2, 2012

SugarCRM: Edit Sugar Default Dashlets

(Anhgolden's Blog)-Mặc định Sugar Dashlet trên trang chính gồm có những modules sau: My Calls, My Open Cases, My Accounts...
Để thay đổi thứ tự hoặc bổ sung/loại bỏ modules trên trang chính này, ta điều chỉnh file:
/custom/modules/Home/dashlets.php

Ngoài ra, để loại bỏ 2 mudules: Sugar News và Sugar Iframe, ta rename hoặc xóa 2 thư mục sau:
/modules/Home/Dashlets/iFrameDashlet
/modules/Home/Dashlets/SugarNewsDashlet
Read More »

Monday, December 26, 2011

SugarCRM: Add Items to the Shortcut Menu (Bổ sung Link cho Menu)

(Anhgolden's Blog)-Một số trường hợp khi Upgrade hoặc Install New Module trong SugarCRM thì Menu bị mất link đến một số module. Để khắc phục trường hợp này, ta thực hiện như sau:

Tạo file custom/modules/MODULE_NAME/Ext/Menus/menu.ext.php với nội dung như sau:

Ví dụ:
<?php

if(ACLController::checkAccess(‘Leads’, ‘edit’, true))$module_menu[]=Array(“index.php?module=Leads&action=EditView&return_module=Opportunities&return_action=ListView”, “New From Canvass Form”,”CreateNotes”, ‘Leads’);

?>
$module_menu[]=Array($url,$menu_title,$image_icon,$module)

Với:

$url – đường dẫn đến Module
$menu_title – tên hiển thị trên Menu, có thể sử dụng dưới dạng $mod_strings['LNK_NEW_FROM_CANVASS_FORM']
$image_icon – đường dẫn đến Icon
$module – tên Module (optional)
Read More »

Friday, December 23, 2011

SugarCRM: WYSIWYG/HTML Editor

(Anhgolden's Blog)-Sưu tầm: Để thay đổi các textarea chỉ cho phép nhập text đơn thuần, ta có thể sử dụng thêm WYSIWYG/HTML Editor Module (xem chi tiết thêm ở đây: http://www.sugarforge.org/projects/wysiwyg/).

Tuy nhiên, để đơn giản có thể làm như sau: tạo 2 files
custom/include/SugarFields/Fields/Text/SugarFieldText.php
defaultConfig['cleanup_on_startup']=true;
        $tiny->buttonConfigs['default']['buttonConfig'] = "bold,italic,underline,strikethrough,bullist,numlist,forecolor,backcolor,link,unlink,help,code";
        $tiny->buttonConfigs['default']['buttonConfig2'] = "formatselect,fontselect,fontsizeselect";
        $tiny->buttonConfigs['default']['buttonConfig3'] = "";
        $tiny->defaultConfig['height'] = ($vardef['rows'] * 30);
  $ed = $tiny->getInstance($vardef['name']);
        $displayParams['ed'] = $ed;

        parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass);
    }


    function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex){
        $vardef['value'] = $this->getVardefValue($vardef);
        $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
        return $this->fetch($this->findTemplate('DetailView'));
    }

    function getVardefValue($vardef){
        if(empty($vardef['value'])){
            if(!empty($vardef['default']))
                return from_html($vardef['default']);
            elseif(!empty($vardef['default_value']))
                return from_html($vardef['default_value']);
        } else {
            return from_html($vardef['value']);
        }
    }
}
custom/include/SugarFields/Fields/Text/EditView.tpl
{literal}<script language="Javascript" type="text/javascript">
if(typeof(tinyMCE) == 'undefined')
  document.write("<scr"+"ipt type=\"text/javascript\" src=\"include/javascript/tiny_mce/tiny_mce.js\"></scr"+"ipt>");
</script>{/literal}
{if empty({{sugarvar key='value' string=true}})}
{assign var="value" value={{sugarvar key='default_value' string=true}} }
{else}
{assign var="value" value={{sugarvar key='value' string=true}} }
{/if} 
{{if $displayParams.maxlength}}
{literal} 
{{$tiny}}
{/literal}<textarea cols="{{$displayParams.cols|default:60}}" id="{{sugarvar key='name'}}" maxlength="{{$displayParams.maxlength}}" name="{{sugarvar key='name'}}" rows="{{$displayParams.rows|default:4}}" tabindex="{{$tabindex}}" title="{{$vardef.help}}" {{$displayparams.field}}="">{$value}</textarea>
{{else}}
{literal} 
{{$tiny}}
{/literal}<textarea cols="{{$displayParams.cols|default:80}}" id="{{sugarvar key='name'}}" name="{{sugarvar key='name'}}" rows="{{$displayParams.rows|default:4}}" tabindex="{{$tabindex}}" title="{{$vardef.help}}" {{$displayparams.field}}="">{$value}</textarea>
{{/if}}


{literal}
<script language="Javascript" type="text/javascript">
  tinyMCE.execCommand('mceAddControl',false,"{/literal}{{sugarvar key='name'}}{literal}");
  
</script>
{/literal}

Ngoài ra, có thể tạo thêm 1 file
custom/include/SugarFields/Fields/Text/DetailView.tpl
{{sugarvar key='value|htmlparser'}}
{{if !empty($displayParams.enableConnectors)}}
{{sugarvar_connector view='DetailView'}} 
{{/if}}


Sau khi thực hiện xong vào Admin - "Repair and Rebuild Module" để cập nhật.
Read More »

Monday, December 19, 2011

SugarCRM: Date Range Searching - Tìm kiếm theo thời gian

(Anhgolden's Blog)-Trước đây ta chỉ có thể tìm kiếm dữ liệu trong ListView theo 1 ngày cụ thể, thì nay từ phiên bản SugarCE 6.2 đã bổ sung tính năng mới cho phép tìm kiếm theo thời gian (xem hình 1).

Lưu ý: Trong trường hợp không sử dụng được tính năng này thì chọn lại Enable Range Search trong Studio - Module (hình 2)
Read More »