Skip to content

Instantly share code, notes, and snippets.

Avatar

Enrico Simonetti esimonetti

View GitHub Profile
@esimonetti
esimonetti / TeamSecurity.php
Created Mar 5, 2014
Remove Team Security filtering in SugarCRM 7 - (location: custom/data/visibility/TeamSecurity.php and remember to run a quick repair!) - Code for blog post http://enricosimonetti.com/can-i-remove-team-security-from-sugarcrm/
View TeamSecurity.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
class TeamSecurity extends SugarVisibility
{
public function addVisibilityFrom(&$query)
{
return $query;
}
@esimonetti
esimonetti / record.js
Last active Feb 9, 2016
Execute custom code after loading a SugarCRM case with high priority on the record view (custom/modules/Cases/clients/base/views/record/record.js) - Gist created for: https://community.sugarcrm.com/sugarcrm/topics/excute_javascript_once_page_is_fully_loaded_in_sugar_7
View record.js
({
extendsFrom: 'RecordView',
initialize: function(options)
{
this._super('initialize', [options]);
},
_render: function()
{
@esimonetti
esimonetti / composer.json
Created Jun 14, 2014
Retrieve count of New Cases from a SugarCRM v7 system and format output as: {"open_cases":"XXX"}
View composer.json
{
"require": {
"spinegar/sugar7wrapper": "dev-master"
},
"minimum-stability": "dev"
}
@esimonetti
esimonetti / sugar-cases.ino
Created Jun 14, 2014
Arduino code to retrieve response from a SugarCRM v7 proxy site, and output 5 LEDs and beep a buzzer (parse output of https://gist.github.com/esimonetti/5d2ea71a90283bbd9c11)
View sugar-cases.ino
#include <EtherCard.h>
int output_pin = 7;
int output_time_on = 500;
static byte mac_address[] = {0x42,0x42,0x42,0x42,0x42,0x42};
const char url_crm_proxy[] PROGMEM = "your-sugarcrm-proxy-url.com";
const char uri_crm_proxy[] PROGMEM = "/";
byte Ethernet::buffer[700];
static byte current_session;
@esimonetti
esimonetti / inboundEmailsLogic.php
Last active Jun 2, 2016
SugarCRM - Inbound Email Case Creation - Custom Record Assignment and Case reopening - custom/modules/Emails/inboundEmailsLogic.php
View inboundEmailsLogic.php
<?php
// Enrico Simonetti
// 11/09/2014
// Tested on SugarCRM 6.5.17
// Create standard Inbound Email to Case functionality, using by default an empty team ($inbound_cases_team) for round robin assignment
// Then define the custom assignment rules
/*
Logic hook entries will look something like this... if entered manually
@esimonetti
esimonetti / motor-with-mosfet-three-speed.ino
Created Mar 4, 2015
Control a DC motor speed with Arduino and a MOSFET - Three speeds
View motor-with-mosfet-three-speed.ino
const int motorpin = 5;
const int divider = 3;
int motor_speed = 0;
void setup()
{
Serial.begin(57600);
pinMode(motorpin, OUTPUT);
}
@esimonetti
esimonetti / motor-with-mosfet-increasing-speed.ino
Created Mar 4, 2015
Control a DC motor speed with Arduino and a MOSFET - Increasing speed
View motor-with-mosfet-increasing-speed.ino
const int motorpin = 5;
int motor_speed = 0;
void setup()
{
Serial.begin(57600);
pinMode(motorpin, OUTPUT);
}
void loop()
@esimonetti
esimonetti / errors.php
Last active Jan 30, 2016
PHP driven error messages in Sugar v7 - Works for sidecar and BWC modules
View errors.php
// Assuming that $b is a valid bean instance...
// Assuming we are editing the record...
// On SugarApiException($app_strings[$error_app_label], null, null, 422, 'my_error_code_sample');
// "my_error_code_sample" is displayed on the output as "error"
// $app_strings[$error_app_label] is displayed on the output as "error_message"
$error_app_label = 'LBL_MY_ERROR_MESSAGE';
if(!empty($b->module_name) && isModuleBWC($b->module_name))
{
@esimonetti
esimonetti / CustomPersonFilterApi.php
Last active Aug 29, 2015
Modify Users REST API to retrieve all Users/Employees. The system normally allows retrieve of records with status or employee_status='Active' and with portal_only='0'
View CustomPersonFilterApi.php
<?php
//
// Enrico Simonetti
//
//
// Description:
// Modify Users REST API to retrieve all Users/Employees
// The system normally allows retrieve of records with status or employee_status='Active' and with portal_only='0'
//
@esimonetti
esimonetti / arduino_temperature_driven_fan.ino
Last active Dec 14, 2017
Arduino Temperature Driven Fan - Driving a two speeds fan with an Arduino, based on the environment temperature
View arduino_temperature_driven_fan.ino
#include <EEPROM.h>
#include <EasyButton.h>
#include <LiquidCrystal.h>
#include <dht.h>
// board led
const int board_led = 13;
// eeprom value
byte eeprom_value;
You can’t perform that action at this time.