Skip to content

Instantly share code, notes, and snippets.

View betobaz's full-sized avatar

Betobaz betobaz

  • Betobaz
  • Veracruz, Mexico
View GitHub Profile
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@esimonetti
esimonetti / SugarACLLock.php
Last active November 30, 2023 03:52
SugarCRM v7 - Conditional record locking through ACL's customisation - Reach out for SugarCRM consulting: https://www.naonis.tech/services/sugar-crm.html
<?php
//
// Enrico Simonetti
// enricosimonetti.com
//
// 2016-05-08 on Sugar 7.7.0.0
// file: custom/data/acl/SugarACLLock.php
//
// ACL to lock record in certain conditions. Always allow admin users and specific user ids
@jmertic
jmertic / gist:6294266
Created August 21, 2013 13:10
Silent install a package on an instance from the command line in SugarCRM with this script
#!/usr/bin/env php
<?php
function usage()
{
print("usage: -i /path/to/instance -p /path/to/expanded/module -z /path/to/zipfile\n");
exit(1);
}
$opts = getopt('i:p:z:');
@sadekbaroudi
sadekbaroudi / createAndUpdateACLRoles.php
Created June 12, 2015 23:57
SugarCRM 7 - ACL Role create / update deployment script
<?php
define('sugarEntry', true);
require_once('include/entryPoint.php');
require_once('modules/ACLRoles/ACLRole.php');
require_once('modules/ACLActions/actiondefs.php');
// metadata for creates or updates, see all possibilities for 'def' in modules/ACLActions/actiondefs.php
$acl = array(
// Create new role
@elchele
elchele / record.js
Created May 20, 2015 03:58
Custom record view controller for setting entire record to read-only conditionally
({
/* Author: Angel Magaña -- cheleguanaco@cheleguanaco.com
* File: ./custom/modules/Opportunities/clients/base/views/record/record.js
*
* Set all fields to read-only conditionally
*/
extendsFrom: 'RecordView',
_renderHtml: function(){
@mmarum-sugarcrm
mmarum-sugarcrm / custom_clients_base_layouts_record_record.php
Last active January 30, 2018 23:21
Adding a new view to base Record layout in Sugar 7
<?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
@patpawlowski
patpawlowski / getdbbackup.php
Last active November 10, 2017 17:33
PHP Script to read a Sugar CRM configuration file, backup the database, and then gzip the backup
#! /usr/bin/env php
<?php
if(!isset($argv[1])){
die("Usage: php getdbbackup.php <path to config.php file>\nExample: php getdbbackup.php ../config.php");
}
require $argv[1];
print_r($sugar_config['dbconfig']);
$db_host_name = $sugar_config['dbconfig']['db_host_name'];
$db_user_name = $sugar_config['dbconfig']['db_user_name'];
@Kobedinho
Kobedinho / custom_readonly_fields_logic.php
Last active January 12, 2017 19:51
read only fields with dependencies, put the following code in: /custom/Extension/modules/<module>/Ext/Dependencies/custom_readonly_fields_logic.php
<?php
// Documentation.- http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Architecture/Sugar_Logic/Dependency_Actions/
$dependencies['Meetings']['readonly_fields'] = array(
'hooks' => array("edit"), // values : "edit", "view", "save" and "all"
'trigger' => 'equal($status,"Held")', //Optional, the trigger for the dependency. Defaults to 'true'.
'triggerFields' => array('status'), // The list of fields to watch for change events. When changed, the trigger expressions will be recalculated.
'onload' => true, // Whether or not to trigger the dependencies when the page is loaded.
//Actions is a list of actions to fire when the trigger is true
// You could list multiple fields here each in their own array under 'actions'
'actions' => array(
@jmertic
jmertic / gist:5847575
Last active May 10, 2016 12:48
Sample Node.js script using Restler for connecting to the new RESTful SugarCRM REST API in 6.7 and later.
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);
@mmarum-sugarcrm
mmarum-sugarcrm / case-count-by-status.js
Last active March 3, 2016 04:27
Case Count by Status example dashlet controller
/**
* Case Count by Status example dashlet controller
*
* Controller logic watches the current collection on display and updates the
* dashlet automatically whenever the current collection changes.
*
* This is a simple example of a dashlet for List Views in Sugar 7.x.
*
**/
({