Sugarcrm custom selection button

Source: Internet
Author: User

1. the content to be written in editview Code 
///////////////////////////////////////
///
/// Setup parent popup
/// Account popup
$ Popup_request_data = array (
'Call _ back_function' => 'set _ return ',
'Form _ name' => 'editview ',
'Field _ to_name_array '=> array (
'Id' => 'status _ C ',
'Name' => 'status _ c_name ',
),
);

$ JSON = new JSON (json_loose_type );
$ Encoded_popup_request_data = $ JSON-> encode ($ popup_request_data );
$ Xtpl-> assign ('encoded _ popup_request_data ', $ encoded_popup_request_data );


Require_once ('include/quicksearchdefaults. php ');
$ Sqs_objects = array ('parent _ name' => $ qsparent,
'Assigned _ user_name '=> $ qsuser,
'Team _ name' => $ qsteam );
$ Quicksearch_js = $ qsscripts;
$ Quicksearch_js. =' < Script Type = "Text/JavaScript" Language = "JavaScript" > Sqs_objects = ' . $ JSON-> encode ($ sqs_objects ). ' </ Script > ';
// $ Quicksearch_js. =' < Script Type = "Text/JavaScript" Language = "JavaScript" SRC = "Include/JavaScript/change_region _ '. $ current_language.'. js" > </ Script > ';

$ Xtpl-> assign ("parent_id", $ focus-> status_c );
$ Xtpl-> assign ("parent_name", $ focus-> status_c_name );

If (isset ($ _ request ['status _ C']) $ xtpl-> assign ("parent_id", $ _ request ['status _ C']);
If (isset ($ _ request ['status _ c_name ']) $ xtpl-> assign ("parent_name ", urldecode ($ _ request ['status _ c_name ']);

Require_once ('include/JavaScript. php ');
$ JavaScript = new JavaScript ();
$ JavaScript-> setformname ('editview ');
$ JavaScript-> setsugarbean ($ focus );
$ JavaScript-> addallfields ('');
$ JavaScript-> addtovalidatebinarydependency ('parent _ name', 'alpha', $ app_strings ['err _ sqs_no_match_field ']. $ mod_strings ['lbl _ member_of '], 'false', '', 'parent _ id ');

Ii. display problems in listview
In the bw_messagesend.php file, the create_list_query method is used to create a query statement.
Update idea: Add a left join to the query statement and associate the ID in the database with the table to be queried.
Solution: some code in the create_list_query Method
$ Query = "select
Users. user_name assigned_user_name,
Bw_messagesends .*
";

If ($ custom_join) {$ query. = ", bw_messagesends_cstm.sendtime_c";} // the fields in the CSTM table to be displayed in the listview // $ custom_join ['select'] Before update; // The variable is ', bw_messagesends_cstm. *'

$ Query. = ", accounts. Name status_c"; // The added field alias status_c must have the same name as the one in the CSTM table.

$ Query. = "from bw_messagesends ";
$ Query. = "left join users on bw_messagesends.assigned_user_id = users. ID ";
If ($ custom_join) {$ query. = $ custom_join ['join'];}

$ Query. = "left join accounts on bw_messagesends_c0000.status_c = accounts. ID"; // left join

$ Where_auto = '1 = 1 ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.