Skip to content

Instantly share code, notes, and snippets.

@maranemil
maranemil / gist:5a7547aee3d2ef79d1c4
Last active August 29, 2015 14:20
Tidbit Benchmark Tool Howto
Tidbit 2.0 - data generation tool for the SugarCRM application ( Benchmark Tool )
Tidbit is a tool to create massive amounts of data for a SugarCRM instance.
Source Git:
https://github.com/sugarcrm/Tidbit
Installation:
https://github.com/sugarcrm/Tidbit/blob/master/README
@maranemil
maranemil / gist:0adfcd96747629899013
Created April 27, 2015 07:26
Xampp 1.8.2 Ubuntu APC XDEBUG settings php.ini
;[xdebug]
;zend_extension=/usr/lib/php5/20121212/xdebug.so
;zend_extension=/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so
;xdebug.auto_trace = 0
;xdebug.default_enable = 1
;xdebug.idekey = "PHPSTORM"
;xdebug.extended_info=1
;xdebug.show_local_vars=1
;xdebug.remote_log=/home/user/xdebug-log.txt
@maranemil
maranemil / gist:f585135deebdb841510b
Created April 24, 2015 08:40
Open a pdf in a new tab
// http://stackoverflow.com/questions/12730581/use-this-php-code-to-open-a-pdf-in-a-new-tab
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
header('Accept-Ranges: bytes');
@readfile($file);
exit();
@maranemil
maranemil / gist:983b97ba313aa221041a
Created April 21, 2015 08:00
Set some crons in crontab for SugarCRM
sudo /opt/lampp/xampp stop
crontab -e
crontab -l
crontab: usage error: unrecognized option
usage: crontab [-u user] file
crontab [ -u user ] [ -i ] { -e | -l | -r }
(default operation is replace, per 1003.2)
-e (edit user's crontab)
@maranemil
maranemil / gist:210423541f812030723d
Created April 21, 2015 07:59
PHP Error Log Settings in php scripts
ini_set('error_reporting', E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
ini_set('log_errors', 1);
//ini_set("error_log", "/path/to/php-error.log");
ini_set('html_errors',FALSE);
error_log( "Hello log errors!" ); // write some hallo in log
@maranemil
maranemil / gist:b5df6ab5ee3f3d6921a9
Last active August 29, 2015 14:19
SugarCRM7 Filter fields definitions
//clients/base/filters/operators/operators.php
//clients/base/api/FilterApi.php
//clients/base/layouts/filter/filter.js
//clients/base/layouts/filterpanel/filterpanel.js
$viewdefs['base']['filter']['operators'] = array(
'multienum' => array(
'$contains' => 'LBL_OPERATOR_CONTAINS', // is any of
'$not_contains' => 'LBL_OPERATOR_NOT_CONTAINS',
),
@maranemil
maranemil / gist:f8920962ae9ee9b0d8ce
Created April 16, 2015 05:16
SugarCRM7 Add DropDown List - Populate list with ajax
// by EvilPeri
//custom/modules/<your module>/clients/base/fields/enum/enum.js
({
extendsFrom: 'EnumField',
_render: function(){
if(this.name == 'your field name here'){
if(_.isEmpty(this.items)){
this.setItems();
return;
@maranemil
maranemil / gist:606dfccd61f4e49cdb3a
Created April 16, 2015 03:17
SugarCRM7 Add Colors in Views
// http://laurenthinoul.com/how-to-add-a-record-color-to-a-listview-in-sugarcrm/
({
extendsFrom: 'RecordlistView',
initialize: function (options) {
app.view.invokeParent(this, {type: 'view', name: 'recordlist', method: 'initialize', args: [options]});
this.collection.on('data:sync:complete', function () {
this.renderColors();
}, this);
},
@maranemil
maranemil / gist:2d1b8aa8dc12f54cb46c
Last active August 29, 2015 14:19
SugarCRM7 Override DropDownList on Record.js or Create.js
//custom/modules/Accounts/clients/base/views/create-actions/create-actions.js
({
// CustomCreate-actions View (base)
extendsFrom: 'CreateActionsView',
events: {
'change input[name=industry]':'OverrideAccountType'
},
initialize: function (options) {
this._super('initialize', [options]);
@maranemil
maranemil / gist:afe14558fb66d2290bdd
Last active August 29, 2015 14:18
Read Collections and Parent Infos in SugarCRM7
Read parent info in subpanel-list.js:
var ctx = this.context.parent, parentModelId = ctx.get("modelId"), parentModule = ctx.get("module");
if(parentModule == 'Accounts'){
// do some action here
var parentBean = app.data.createBean(parentModule, {id:parentModelId}), request = parentBean.fetch();
request.xhr.done(function(){
//get the field you need to verify