modules/TaxRates/TaxRate.php
\TaxRate
SugarBean is the base class for all business objects in Sugar. It implements the primary functionality needed for manipulating business objects: create, retrieve, update, delete. It allows for searching and retrieving list of records.
It allows for retrieving related objects (e.g. contacts related to a specific account).
In the current implementation, there can only be one bean per folder. Naming convention has the bean name be the same as the module and folder name. All bean names should be singular (e.g. Contact). The primary table name for a bean should be plural (e.g. contacts).
- Parent(s)
- \SugarBean
Properties
BOOL
$disable_row_level_security= 'false'
Pro Only -- When all data of a specifiy module is publically available, row level security can be turned off. This should only be used for modules that do not need row level security.
-- default falseInherited from: \SugarBean::$$disable_row_level_securityBOOL
$disable_vardefs= 'false'
Disble vardefs. This should be set to true only for beans that do not have varders. Tracker is an example
-- default falseInherited from: \SugarBean::$$disable_vardefsBOOL
$duplicates_found= 'false'
When running a query on related items using the method: retrieve_by_string_fields this value will be set to true if more than one item matches the search criteria.
Inherited from: \SugarBean::$$duplicates_found
$in_import= 'false'
Set to true in <modules>/Import/views/view.step4.php if a module is being imported
Inherited from: \SugarBean::$$in_import
$in_workflow= 'false'
Set to true if the bean is being dealt with in a workflow
Inherited from: \SugarBean::$$in_workflow
$listview_inner_join= 'array()'
Used to pass inner join string to ListView Data.
Inherited from: \SugarBean::$$listview_inner_joinString
$new_assigned_user_name= ''
holds the full name of the user that an item is assigned to. Only used if notifications are turned on and going to be sent out.
Inherited from: \SugarBean::$$new_assigned_user_nameBOOL
$new_with_id= 'false'
When createing a bean, you can specify a value in the id column as long as that value is unique. During save, if the system finds an id, it assumes it is an update. Setting new_with_id to true will make sure the system performs an insert instead of an update.
-- default falseInherited from: \SugarBean::$$new_with_idBOOL
$process_save_dates= 'true'
Whether to process date/time fields for storage in the database in GMT
Inherited from: \SugarBean::$$process_save_datesArray
$processed_dates_times= 'array()'
An array of booleans. This array is cleared out when data is loaded.
of booleansInherited from: \SugarBean::$$processed_dates_timesBOOL
$save_from_post= 'true'
This signals to the bean that it is being saved in a mass mode.
Inherited from: \SugarBean::$$save_from_post\unknown_type
$set_created_by= 'true'
This allows for seed data to be created without using the current uesr to set the id.
Inherited from: \SugarBean::$$set_created_by
$special_notification= 'false'
Set to true in the child beans if the module use the special notification template
Inherited from: \SugarBean::$$special_notification
$tracker_visibility= 'true'
By default it will be true but if any module is to be kept non visible to tracker, then its value needs to be overriden in that particular module to false.
Inherited from: \SugarBean::$$tracker_visibility
$ungreedy_count= 'false'
Set this to true if you query contains a sub-select and bean is converting both select statements into count queries.
Inherited from: \SugarBean::$$ungreedy_countBOOL
$update_date_entered= 'false'
Setting this to true allows for updates to overwrite the date_entered
Inherited from: \SugarBean::$$update_date_enteredBOOL
$update_date_modified= 'true'
Should the date modified column of the bean be updated during save? This is used for admin level functionality that should not be updating the date modified. This is only used by sync to allow for updates to be replicated in a way that will not cause them to be replicated back.
Inherited from: \SugarBean::$$update_date_modifiedBOOL
$update_modified_by= 'true'
Should the modified by column of the bean be updated during save? This is used for admin level functionality that should not be updating the modified by column. This is only used by sync to allow for updates to be replicated in a way that will not cause them to be replicated back.
Inherited from: \SugarBean::$$update_modified_byMethods
ACLAccess(
\$view $view, \$is_owner $is_owner
=
'not_set'
)
:
void
Check whether the user has access to a particular view for the current bean/module
Inherited from: \SugarBean::ACLAccess()SugarBean(
)
:
void
Constructor for the bean, it performs following tasks:
Inherited from: \SugarBean::SugarBean()__clone(
)
:
void
Handle the following when a SugarBean object is cloned
Inherited from: \SugarBean::__clone()_get_num_rows_in_query(
string $query, boolean $is_count_query
=
false
)
:
int
Returns the number of rows that the given SQL query should produce
Inherited from: \SugarBean::_get_num_rows_in_query()add_address_streets(
string $street_field
)
:
void
Combined the contents of street field 2 thru 4 into the main field
Inherited from: \SugarBean::add_address_streets()add_list_count_joins(
string $query, string $where
)
:
void
Add any required joins to the list count query. The joins are required if there is a field in the $where clause that needs to be joined.
Inherited from: \SugarBean::add_list_count_joins()add_team_security_where_clause(
$query, $table_alias
=
'', $join_type
=
'INNER', $force_admin
=
false, $join_teams
=
false
)
:
void
Add a join to the query to enforce the data returned will only be for teams to which this user has membership
Inherited from: \SugarBean::add_team_security_where_clause()afterImportSave(
)
:
void
Called during the import process after a bean save, to handle any needed post-save logic when importing a record
Inherited from: \SugarBean::afterImportSave()assign_display_fields(
$currentModule
)
:
void
beforeImportSave(
)
:
void
Called during the import process before a bean save, to handle any needed pre-save logic when importing a record
Inherited from: \SugarBean::beforeImportSave()build_generic_where_clause(
$the_query_string
)
:
void
builds a generic search based on the query string using or do not include any $this-> because this is called on without having the class instantiated
build_related_in(
string $query
)
:
void
Constructs an comma separated list of ids from passed query results.
Inherited from: \SugarBean::build_related_in()build_related_list(
string $query, object $template, int $row_offset
=
0, int $limit
=
-1
)
:
array
This function is used to execute the query and create an array template objects from the resulting ids from the query.
Inherited from: \SugarBean::build_related_list()build_related_list2(
string $query, object $template, array $field_list
)
:
array
Optionally copies values from fetched row into the bean.
Inherited from: \SugarBean::build_related_list2()build_related_list_where(
string $query, object $template, $where
=
'', $in
=
'', $order_by, $limit
=
'', $row_offset
=
0
)
:
void
This function is used to execute the query and create an array template objects from the resulting ids from the query.
Inherited from: \SugarBean::build_related_list_where()call_custom_logic(
$event, $arguments
=
null
)
:
void
Trigger custom logic for this module that is defined for the provided hook The custom logic file is located under custom/modules/[CURRENT_MODULE]/logic_hooks.php.
Inherited from: \SugarBean::call_custom_logic()call_relationship_handler(
$target_base
=
"module_dir", $return_handler
=
false
)
:
void
call_vardef_handler(
$meta_array_type
=
null
)
:
void
check_date_relationships_load(
)
:
\this
This function retrieves a record of the appropriate type from the DB.
Inherited from: \SugarBean::check_date_relationships_load()cleanBean(
)
:
void
Cleans char, varchar, text, etc. fields of XSS type materials
Inherited from: \SugarBean::cleanBean()convertField(
$fieldvalue, $fieldDef
)
:
string
Converts the field value based on the provided fieldDef
Inherited from: \SugarBean::convertField()convertRow(
array $row
)
:
array
Convert row data from DB format to internal format Mostly useful for dates/times
Inherited from: \SugarBean::convertRow()createRelationshipMeta(
string $key, object $db, string $tablename, array $dictionary, string $module_dir, boolean $iscustom
=
false
)
:
void
Populates the relationship meta for a module.
Inherited from: \SugarBean::createRelationshipMeta()create_audit_table(
)
:
void
If auditing is enabled, create the audit table.
Inherited from: \SugarBean::create_audit_table()create_export_query(
string $order_by, string $where
)
:
string
Returns the query used for the export functionality for a module. Override this method if you wish to have a custom query to pull this data together instead
Inherited from: \SugarBean::create_export_query()create_index(
$query
)
:
void
This is a helper function that is used to quickly created indexes when creating tables.
Inherited from: \SugarBean::create_index()create_list_count_query(
string $query
)
:
string
Changes the select expression of the given query to be 'count(*)' so you can get the number of items the query will return. This is used to populate the upper limit on ListViews.
Inherited from: \SugarBean::create_list_count_query()create_new_list_query(
string $order_by, string $where, array $filter
=
array(), array $params
=
array(), int $show_deleted
=
0, string $join_type
=
'', boolean $return_array
=
false, object $parentbean
=
null, boolean $singleSelect
=
false, $ifListForExport
=
false
)
:
String
Return the list query used by the list views and export button. Next generation of create_new_list_query function.
Inherited from: \SugarBean::create_new_list_query()create_notification_email(
string $notify_user
)
:
void
This function handles create the email notifications email.
Inherited from: \SugarBean::create_notification_email()create_qualified_order_by(
string $order_by, string $qualify
)
:
\prefixed
Ensure that fields within order by clauses are properly qualified with their tablename. This qualification is a requirement for sql server support.
Inherited from: \SugarBean::create_qualified_order_by()create_tables(
)
:
void
Creates tables for the module implementing the class.
Inherited from: \SugarBean::create_tables()decrypt_after_retrieve(
STRING $value
)
:
string
Decode and decrypt a base 64 encoded string with field type 'encrypt' in this bean using Blowfish.
Inherited from: \SugarBean::decrypt_after_retrieve()delete_linked(
string $id
)
:
void
Iterates through all the relationships and deletes all records for reach relationship.
Inherited from: \SugarBean::delete_linked()drop_tables(
)
:
void
Delete the primary table for the module implementing the class.
Inherited from: \SugarBean::drop_tables()encrpyt_before_save(
STRING $value
)
:
string
Encrpyt and base64 encode an 'encrypt' field type in the bean using Blowfish. The default system key is stored in cache/Blowfish/{keytype}
Inherited from: \SugarBean::encrpyt_before_save()fill_in_additional_detail_fields(
)
:
void
This is designed to be overridden and add specific fields to each record.
fill_in_additional_list_fields(
)
:
void
This is designed to be overridden and add specific fields to each record.
fill_in_additional_parent_fields(
)
:
void
This is desgined to be overridden or called from extending bean. This method will fill in any parent_name fields.
Inherited from: \SugarBean::fill_in_additional_parent_fields()fill_in_link_field(
$linkFieldName, $def
)
:
void
fill_in_relationship_fields(
)
:
void
Fill in fields where type = relate
Inherited from: \SugarBean::fill_in_relationship_fields()fixUpFormatting(
)
:
void
Function corrects any bad formatting done by 3rd party/custom code
Inherited from: \SugarBean::fixUpFormatting()format_all_fields(
)
:
void
This functions adds formatting to all number fields before presenting them to user interface.
Inherited from: \SugarBean::format_all_fields()fromArray(
Array $arr
)
:
void
Converts an array into an acl mapping name value pairs into files
Inherited from: \SugarBean::fromArray()getACLCategory(
)
:
string
Returns the ACL category for this module; defaults to the SugarBean::$acl_category if defined otherwise it is SugarBean::$module_dir
Inherited from: \SugarBean::getACLCategory()getAuditEnabledFieldDefinitions(
)
:
\an
Returns a list of fields with their definitions that have the audited property set to true.
Inherited from: \SugarBean::getAuditEnabledFieldDefinitions()getFieldDefinition(
string $name
)
:
Array
Returns field definition for the requested field name.
Inherited from: \SugarBean::getFieldDefinition()getFieldDefinitions(
)
:
Array
Returns field definitions for the implementing module.
Inherited from: \SugarBean::getFieldDefinitions()getIndices(
)
:
Array
Returns index definitions for the implementing module.
Inherited from: \SugarBean::getIndices()getObjectName(
)
:
\nothing
Returns the object name. If object_name is not set, table_name is returned.
Inherited from: \SugarBean::getObjectName()getOwnerWhere(
\GUID $user_id
)
:
STRING
Gets there where statement for checking if a user is an owner
Inherited from: \SugarBean::getOwnerWhere()getPrimaryFieldDefinition(
)
:
Array
Returnss definition for the id field name.
Inherited from: \SugarBean::getPrimaryFieldDefinition()getRealKeyFromCustomFieldAssignedKey(
$name
)
:
void
getRelatedFields(
$module, $id, $fields, $return_array
=
false
)
:
void
get_full_list(
string $order_by
=
"", string $where
=
"", $check_dates
=
false, int $show_deleted
=
0
)
:
void
Returns a full (ie non-paged) list of the current object type.
Inherited from: \SugarBean::get_full_list()get_import_required_fields(
)
:
array
Returns an array of fields that are required for import
Inherited from: \SugarBean::get_import_required_fields()get_importable_fields(
)
:
array
Returns an array of fields that are able to be Imported into i.e. 'importable' not set to 'false'
Inherited from: \SugarBean::get_importable_fields()get_linked_beans(
string $field_name, $bean_name, array $sort_array
=
array(), int $begin_index
=
0, int $end_index
=
-1, int $deleted
=
0, $optional_where
=
""
)
:
void
get_linked_fields(
)
:
array
Returns an array of fields that are of type link.
Inherited from: \SugarBean::get_linked_fields()get_list_view_array(
)
:
void
Assigns all of the values into the template for the list view
Inherited from: \SugarBean::get_list_view_array()get_list_view_data(
)
:
void
Override this function to set values in the array used to render list view data.
get_notification_recipients(
)
:
void
Determines which users receive a notification
Inherited from: \SugarBean::get_notification_recipients()get_related_fields(
)
:
array
Returns an array of fields that are of type relate.
Inherited from: \SugarBean::get_related_fields()get_related_list(
object $child_seed, string $related_field_name, string $order_by
=
"", string $where
=
"", $row_offset
=
0, $limit
=
-1, $max
=
-1, $show_deleted
=
0
)
:
array
get_summary_text(
)
:
string
Returns the summary text that should show up in the recent history list for this object.
get_union_related_list(
\SugarBean $parentbean, string $order_by
=
"", string $sort_order
=
'', string $where
=
"", $row_offset
=
0, $limit
=
-1, $max
=
-1, $show_deleted
=
0, $subpanel_def
)
:
void
Constructs a query to fetch data for supanels and list views
Inherited from: \SugarBean::get_union_related_list()get_where(
array $fields_array, boolean $deleted
=
true
)
:
string
Construct where clause from a list of name-value pairs.
Inherited from: \SugarBean::get_where()has_been_modified_since(
\date $date, string $modified_user_id
)
:
void
Performs a check if the record has been modified since the specified date
Inherited from: \SugarBean::has_been_modified_since()has_calc_field_with_link(
string $linkName
=
""
)
:
bool
Tests if the current module has a calculated field with a link.
Inherited from: \SugarBean::has_calc_field_with_link()isOwner(
\GUID $user_id
)
:
boolean
Returns true of false if the user_id passed is the owner
Inherited from: \SugarBean::isOwner()is_AuditEnabled(
)
:
boolean
Return true if auditing is enabled for this object You would set the audit flag in the implemting module's vardef file.
Inherited from: \SugarBean::is_AuditEnabled()list_view_parse_additional_sections(
$list_form
)
:
void
Let implementing classes to fill in row specific columns of a list view form
Inherited from: \SugarBean::list_view_parse_additional_sections()listviewACLHelper(
)
:
ARRAY
Used in order to manage ListView links and if they should links or not based on the ACL permissions of the user
Inherited from: \SugarBean::listviewACLHelper()loadFromRow(
array $arr
)
:
\nothing
Loads a row of data into instance of a bean. The data is passed as an array to this function
Inherited from: \SugarBean::loadFromRow()load_relationship(
string $rel_name
)
:
\nothing.
Loads the request relationship. This method should be called before performing any operations on the related data.
Inherited from: \SugarBean::load_relationship()mark_deleted(
$id
)
:
void
This function should be overridden in each module. It marks an item as deleted.
Inherited from: \SugarBean::mark_deleted()mark_relationships_deleted(
int $id
)
:
void
This function deletes relationships to this object. It should be overridden to handle the relationships of the specific object.
mark_undeleted(
$id
)
:
void
Restores data deleted by call to mark_deleted() function.
Inherited from: \SugarBean::mark_undeleted()parse_additional_headers(
$list_form, $xTemplateSection
)
:
void
populateDefaultValues(
$force
=
false
)
:
void
populateRelatedBean(
\SugarBean $newbean
)
:
void
Called from ImportFieldSanitize::relate(), when creating a new bean in a related module. Will copies fields over from the current bean into the related. Designed to be overriden in child classes.
Inherited from: \SugarBean::populateRelatedBean()preprocess_fields_on_save(
)
:
void
This function processes the fields before save.
Inherited from: \SugarBean::preprocess_fields_on_save()process_detail_query(
string $query, int $row_offset, int $limit
=
-1, int $max_per_page
=
-1, string $where
=
'', int $offset
=
0
)
:
array
Applies pagination window to select queries used by detail view, executes the query and returns fetched data.
Inherited from: \SugarBean::process_detail_query()process_list_query(
string $query, int $row_offset, int $limit
=
-1, int $max_per_page
=
-1, string $where
=
''
)
:
array
Processes the list query and return fetched row.
Inherited from: \SugarBean::process_list_query()process_order_by(
string $order_by, \SugarBean $submodule
=
null
)
:
string
Prefixes column names with this bean's table name.
Inherited from: \SugarBean::process_order_by()process_special_fields(
)
:
void
This method is called during an import before inserting a bean Define an associative array called $special_fields the keys are user defined, and don't directly map to the bean's fields the value is the method name within that bean that will do extra processing for that field. example: 'full_name'=>'get_names_from_full_name'
Inherited from: \SugarBean::process_special_fields()process_union_list_query(
object $parent_bean, string $query, int $row_offset, int $limit
=
-1, int $max_per_page
=
-1, string $where
=
'', array $subpanel_def, string $query_row_count
=
'', $secondary_queries
=
array()
)
:
array
Applies pagination window to union queries used by list view and subpanels, executes the query and returns fetched data.
Inherited from: \SugarBean::process_union_list_query()process_workflow_alerts(
)
:
void
Any alerts that have been placed into the session, be sure to process them.
Inherited from: \SugarBean::process_workflow_alerts()removeRelationshipMeta(
string $key, string $db, string $tablename, string $dictionary, string $module_dir
)
:
\Nothing
retrieve(
string $id
=
-1, boolean $encode
=
true, boolean $deleted
=
true
)
:
void
Function fetches a single row of data given the primary key value.
Inherited from: \SugarBean::retrieve()retrieve_by_string_fields(
array $fields_array, boolean $encode
=
true, boolean $deleted
=
true
)
:
object
Constructs a select query and fetch 1 row using this query, and then process the row
Inherited from: \SugarBean::retrieve_by_string_fields()retrieve_parent_fields(
array $type_info
)
:
void
Returns parent record data for objects that store relationship information
Inherited from: \SugarBean::retrieve_parent_fields()retrieve_relationships(
$table, $values, $select_id
)
:
void
save(
boolean $check_notify
=
FALSE
)
:
void
Implements a generic insert and update logic for any SugarBean This method only works for subclasses that implement the same variable names.
Inherited from: \SugarBean::save()save_relationship_changes(
boolean $is_update
)
:
void
This function is a good location to save changes that have been made to a relationship.
send_assignment_notifications(
string $notify_user, string $admin
)
:
void
Handles sending out email notifications when items are first assigned to users
Inherited from: \SugarBean::send_assignment_notifications()setDefaultTeam(
)
:
void
Set the given module's default team in SuagrCRM Professional
Inherited from: \SugarBean::setDefaultTeam()set_relationship(
$table, $relate_values, $check_duplicates
=
true, $do_update
=
false, $data_values
=
null
)
:
void
setupCustomFields(
string $module_name, boolean $clean_load
=
true
)
:
void
Loads the definition of custom fields defined for the module.
Inherited from: \SugarBean::setupCustomFields()unPopulateDefaultValues(
)
:
void
Basically undoes the effects of SugarBean::populateDefaultValues(); this method is best called right after object initialization.
Inherited from: \SugarBean::unPopulateDefaultValues()unformat_all_fields(
)
:
void
Removes formatting from values posted from the user interface.
Inherited from: \SugarBean::unformat_all_fields()updateCalculatedFields(
)
:
void
Retrieves and executes the CF dependencies for this bean
Inherited from: \SugarBean::updateCalculatedFields()updateDependentFieldForListView(
$listview_def_main
=
''
)
:
void
updateRelatedCalcFields(
$linkName
=
""
)
:
void