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 / collection_filter.js
Created September 25, 2015 16:45
SugarCRM:Sidecar:Collection fetch with filter
// Nombre del modulos a consultar
var moduleName = "T01_Telefonos";
// Filtros que se desean aplicar
var filters = [
// Se va a filtrar por la relacion que tiene el modulo con cuentas
{t01_telefonos_accountsaccounts_ida: "eff78d90-03c1-dbd0-fe8e-55f060047d98"}
];
// Se crea un collecion del modulo, el cual se va a llenar cuando el api nos de respuesta
var telCollection = App.data.createBeanCollection(moduleName);
// Se realiza la peticion
@betobaz
betobaz / custom__modules__Accounts__clients__base__views__record__record.js
Created September 14, 2015 16:08
SugarCRM: Sidecar: save new bean with id
({
events:{
'click .button': '_createMeeting',
},
_createMeeting: function(){
var meeting = app.data.createBean('Meetings');
meeting.set({
// Create its UUID
id: app.utils.generateUUID(),
name: 'Test',
@betobaz
betobaz / custom__modules__Accounts__clients__base__views__record__record.js
Created September 11, 2015 18:45
SugarCRM: Sidecar: Open create-actions layout in a drawer on demand
({
events:{
'click button': '_handlerClick',
},
_handlerClick: function(evt, el){
var modelPrefil = app.data.createBean("Accounts");
modelPrefil.set({
name: "Account name",
assigned_user_name: 1
});
@betobaz
betobaz / custom__modules__<module>__clients__base__views__record__record.js
Created September 11, 2015 18:22
SugarCRM: Sidecar: Set readonly to field
({
initialize: function(){
this._super("initialize", arguments);
var field = this.getField('field_name');
field.setMode('readonly');
field.setMode('edit');
field.setMode('detail');
}
})
@betobaz
betobaz / README.md
Last active September 26, 2023 10:14
SugarCRM:: Filter default:: Add another fields to quick_search

#Extending quick search to default filter to search by custom field#

This customization allows to user to search by another field aside name field

@betobaz
betobaz / trigger-preview.js
Created July 14, 2015 00:01
SugarCRM::Sidecar::Show model in preview
({
showPreview: function(moduleName, modelId){
var bean = App.data.createBean(moduleName, {id:modelId});
bean.fetch();
App.events.trigger('preview:render', bean);
}
})
({
getRecordsRecursive: function(moduleName, filters, offset, collectionBuffer, callback){
var self = this;
if(offset > -1){
var collection = App.data.createBeanCollection(moduleName);
var req = collection.fetch({"filter": filters, "offset": offset});
req.xhr.success(function(data){
if(data.records){
collectionBuffer.add(data.records);
self.getRecordsRecursive(moduleName, filters, data.offset, collectionBuffer, callback);
@betobaz
betobaz / README.md
Last active August 29, 2015 14:24
SugarCRM :: create-actions :: dashlet :: add drawer close callback

test

@betobaz
betobaz / custom__clients__base__views__list-bottom__list-bottom.js
Last active August 29, 2015 14:23
SugarCRM::Sidecar::list-bottom::Remove loading message
/*
* 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.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
*/
@betobaz
betobaz / custom_clients_base_views_map-dashlet_map-dashlet.js
Last active December 19, 2022 02:07
SugarCRM::Sidecar::Load Google Maps Api Async
({
plugins: ['Dashlet'],
initialize: function (options) {
var self = this;
this._super('initialize', [options]);
// Escuchador que se detona cuando se ha detectado que el api de
self.context.on('google:maps:api:load', _.bind(self._googleMapsApiLoadHandler, self));
// Se define la función callback que se va a ejecutar cuando google maps api ya esta disponible
window.mapsApiCallback = function(){
console.log('hola mundo, maps api cargado');