How can i override create_export_query function on the Calls module - sugarcrm

I like to add columns accounts.name and assigned_username to the exporting CSV on the Calls module. I can do that by editing the function create_export_query on the modules/Calls/Call.php
But I want this to be done on upgrade safe manner. I am using SugarCRM Pro 6.2 version
Thanks in advance

To my knowledge, it is currently not possible to "override"/extend any sugarBean classes. Currently SugarCRM only facilitates upgrade-safe customizing to vardefs, languages, shortcuts, layouts, web services, and controllers+controller methods.
Metadata customizing: documentation
Web Services: documentation
Controller customizing: documentation
I'd properly make a custom module, which mimicks or extends the call module's export function in order to make it upgrade safe. (documentation)

Related

Aurelia - How to do composite applications that can be loaded at runtime

What I'm trying to do in Aurelia, is something like Prism is doing in WPF- Composite applications.
So lets say I have a "shell" application that defines the main application layout, then i have modules that I can plugin at run-time. Those modules can be an Aurelia application per se or Aurelia plugin (don't know what to use - need recommendation).
When loaded, the module needs to add it's menu items to the main application menu to expose it's features.
This is a mockup of the application:
Each module can have multiple menu items and can be pretty complex.
I'm using latest Typescript, Aurelia-CLI to create the application, and I'm using the built-in bundler : Aurelia's new built-in bundler.
So What I don't know is:
Those modules/features - what must they be? (Maybe Aurelia Plugins, or another Aurelia application?)
How to load those modules/features at run-time? (like deploy it in some plugins folder and tell the main shell application to load them)
How to modify the main menu and add new menu items from the loaded module?
Please help
Aurelia supports ultra dynamic applications. Also, there have been other community members who have had similar requirements and was able to resolve it. So I think the scenario is possible.
It seems the sub-application can just be a route.How/where to load the route should be determined based on the application URL
Those modules doesn't need to do anything specific, they can just be a normal, plain JS/TS class with lifecycle methods to handle activation/deactivation. I guess that main shell and all sub-applications need to share a common URL, you cannot have more than one router.
There could be a singleton/central store for new route to register information about loaded features, or it can be loaded upfront by a configuration file/metadata file or a database fetch.
Here is a similar question from another community member that I think can help you see how to glue things to https://discourse.aurelia.io/t/dynamicaly-load-routes/1906

OpenAPI (aka Swagger) in Azure Functions V2

I'm creating a V2 Function App and want to use Swagger/Open API for docs, however it is not yet supported in the Azure Portal for V2 Functions.
Any suggestions on how I can use Swagger with V2 Functions in VSTS to create the docs on each build?
TL;DR - Use the NuGet package to render Open API document and Swagger UI through Azure Functions.
UPDATE (2021-06-04)
Microsoft recently announced the OpenAPI support on Azure Functions during the //Build event.
The Aliencube extension has now been archived and no longer supported. Please use this official extension.
As of today, it's in preview. Although it's in preview, it has more features than the Aliencube one.
Acknowledgement 2: I am still maintaining the official one.
Microsoft hasn’t officially started supporting Open API (or Swagger) yet. But there is a community-driven NuGet package currently available:
Nuget > Aliencube.AzureFunctions.Extensions.OpenApi
And here’s the blog post for it:
Introducing Swagger UI on Azure Functions
Basically its usage is similar to Swashbuckle — using decorators. And it supports both Azure Functions V1 and V2.
Acknowledgement 1: I am the owner of the NuGet package.
For anyone looking into this, Microsoft still hasn't added Open API support for Azure Functions +v2 and there hasn't been any major movement toward it.
I faced this same issue recently and I found a pretty good solution.
If you aren't aware yet, check this out: https://github.com/RicoSuter/NSwag
NSwag is a toolchain that integrates with .NET to produce the Open API documentation and UI, but also generates the respective API clients for you.
I've used this tool for the past 2 years when working with Angular and .NET apps, it saves a lot of time and seamlessly integrates with my whole development workflow.
For Azure Functions +v2, a contributor created a generator that in less than 10 lines of code, allow us to expose the Swagger endpoint for an Azure Function class:
https://github.com/Jusas/NSwag.AzureFunctionsV2
Now, if you design HTTP-Triggered Functions using DI, grouping related operations under the same class and leveraging model binding, you might not even need to apply any custom decorator, it just works!
Here's an example of how one real API would look like:
(ignore the base class. It is part of a personal pattern I follow, unrelated to Swagger)
And this is how it looks like using a swagger UI:
There is official library Azure Functions OpenAPI Extension. It is still in preview, but looks great.
Can you drop your V2 Function to run on v1 of the runtime by starting over with a blank function app first?
The MSDN documents for Create an OpenAPI definition for a function (with a date of 11/2018 interestingly enough) example states:
By default, the function app you create uses version 2.x of the
runtime. You must set the runtime version back to 1.x before you
create your function.
But one can't just move the setting to 1:
To pin your function app to the version 1.x runtime, choose ~1 under
Runtime version. This switch is disabled when you have functions in
your app.
Which implies one must create the Function app, publish/create it, set it to V1 and then put in a function before adding a function app.

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.

How can I extend/configure other plone addons preferences Configlets?

I have a third-party addon installed and now I have to extend this Configlet with a boolean Field, how can I do this?
Further I have to use results of a function from this addon?
Thanks in advance.
You can either try
1) Override form via a custom layer registered by your add-on and create new Form class, extending the orignal, which has the same name, but is registered against this layer. Thus, the form class will come from your add-on when your add-on and it's browserlayer is installed.
http://collective-docs.readthedocs.org/en/latest/views/layers.html
Layers are view-specific, so it is the view you are trying to override. Depending on the orignal c.simplesocial architecture it is not sure what kind of view - form relationship is in place.
2) monkey-patch the orignal form class
http://collective-docs.readthedocs.org/en/latest/misc/monkeypatch.html

Programmatically configure ActiveRecordFacility for multiple databases

I'm trying to build a small application (ASP.NET MVC) that uses the plugin architecture. Along with Castle ActiveRecord Integration Facility. And I wish to let each plugin configure its own ActiveRecord behaviors. Like database connection string, proxy, etc..
However, I couldn't find a way to set multiple configurations without the use of web.config. The idea is to make this programmatically.
My goal is for each plugin in this system, if it defines its own ActiveRecord settings, the main application can set up next to ActiveRecordFacility these behaviors.
has someone do something like that?
P.S.: sorry, bad grammar...google translate...;P
You can set up the ActiveRecord configuration programmatically using InPlaceConfigurationSource (lots of examples around), then after initializing ActiveRecord (in your own code), call the ActiveRecordFacility with the skipARInitialization flag. e.g.:
container.AddFacility("ar", new ActiveRecordFacility(true));
This tells the facility not to try to initialize ActiveRecord, so it picks up the existing configuration.
Ok...the example in Lostechies works great. (link text)
Mauricio, thanks for the tip!