Skip to content

Instantly share code, notes, and snippets.

View betobaz's full-sized avatar

Betobaz betobaz

  • Betobaz
  • Veracruz, Mexico
View GitHub Profile
@betobaz
betobaz / repair.php
Last active October 1, 2016 16:42
SugarCRM: 7.7.X: Quick Repair CLI
<?php
if(!defined('sugarEntry'))define('sugarEntry', true);
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
@betobaz
betobaz / custom__include__language__es_LA.lang.php
Last active August 4, 2016 12:49
SugarCRM: Sidecar: Multi select dependent from another multi select dependent fields
<?php
$app_list_strings['promocion_region_list']=array (
'Michoacana' => 'Michoacana',
'Jaliciense' => 'Jaliciense',
'Sinaloense' => 'Sinaloense',
'Sonorense' => 'Sonorense',
);
$app_list_strings['seg_geo_com_Michoacana_list']=array (
@betobaz
betobaz / dashlet-test.js
Last active August 2, 2016 11:15
SugarCRM:: Sidecar unit test
ddescribe("Dashlet dashlet", function () {
var viewName = 'dashlet',
view,
layout,
context,
layoutName = 'record',
moduleName = 'Opportunities',
model;
beforeEach(function () {
@betobaz
betobaz / metadata.php
Created March 13, 2014 18:14
fill_dropdown_custom
<?php
/*********************************************************************************
* By installing or using this file, you are confirming on behalf of the entity
* subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
* the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
* http://www.sugarcrm.com/master-subscription-agreement
*
* If Company is not bound by the MSA, then by installing or using this file
* you are agreeing unconditionally that Company will be bound by the MSA and
* certifying that you have authority to bind Company accordingly.
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
@betobaz
betobaz / custom_modules_Activities_ActivitiesLogicHookCustom.php
Created November 5, 2014 02:20
SugarCRM Notifications like facebook
<?php
class ActivitiesLogicHookCustom{
public function notifyActivity($bean, $event, $arguments){
if($bean->module_name == 'Activities'){
global $current_user;
$data = json_decode($bean->data);
$message = preg_replace('/(\@)\[\w+\:[a-f0-9-]{36}\:([\w ]+)\]/u', '$1$2', $data->value);
foreach($data->tags as $tag){
if($tag->module == 'Users'){
$notification = BeanFactory::newBean('Notifications');
var sys = require('util'),
rest = require('restler');
var baseurl = "<<instance URL>>/rest/v10"
// get oAuth token
var jsonData = {"grant_type":"password","username":"<<username>>","password":"<<password>>","client_id":"sugar"};
rest.postJson(baseurl+'/oauth2/token', jsonData).on('2XX', function(data) {
if ( data.error ) {
sys.puts("Error: " + data.error_message);
@betobaz
betobaz / logic_hook_notificador.php
Created June 12, 2013 17:03
Notifica por correo y consumiendo un api
<?php
class CasesLogicHook{
protected $urlApiNotifications = 'http://node.test.dev/api/notifications';
protected $notificaciones = array(
'Assigned' => array(
'id_template' => '26735934-183c-4f76-3e97-50984ae40813',
'message' => "El caso con número {case_number} ha sido asignado para su precesamiento.",
),
@betobaz
betobaz / day3x2.php
Last active December 18, 2015 09:59
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="style.css">
</head>
<body>
@betobaz
betobaz / PABSCases.php
Created June 7, 2013 17:24
SugarCRM CE logic hook para el envio de notificaciones
<?php
class AbproCases{
protected $urlApiNotifications = 'http://node.abpro.dev/api/notifications';
protected $notificaciones = array(
'Assigned' => array(
'id_template' => '26735934-183c-4f76-3e97-50984ae40813',
'message' => "El caso con número {case_number} ha sido asignado para su precesamiento.",
),