How to create logic hook in sugarcrm when we create a module through module builder - sugarcrm

I create a module Acquisitions through module builder and now want to make some calculations for some fields.i have no clue how to create a logic hook and where to create this logic hook. please tell me the full path and procedure for this.

I have this very problem. Unfortunately it's not possible because when you you deploy the package in Module Builder, the custom folder gets overwritten and that's exactly where the logic_hook file needs to be.
Even the fact that there is a parameter called "logic_hooks" for that manifest.php install_def, it still doesn't seem to work when the logic_hook you want to add is part of package you are deploying (Yes, that's very annoying).
I posted about this on the sugar forum, you can see more details #: http://www.sugarcrm.com/forums/f6/module-builder-deploy-deletes-my-logic_hook-php-76402/

See question 4196257 for using logic hooks.

You can create a logic hook under Custom folder so it will be safe upgrade
/custom/modules//logic_hooks.php
For understanding the logic hook you can follow this link
Logic hook
I hope this Will help you

1­Custom/modules/\logic_hooks.php
logic_hooks.php
Descriptions­
1­ ­: Array Index
/Leads/logichooks_class.php ­­:Logic hooks Class File path
ogic_hooks_class­:Logic_hooks Class Name
before_save_method­­:Logic Hooks class Method Name
Logichooks_class.php
id."' ";
}
?>

Related

Generating Swift files from templates

My goal is to create (find if exist) a tool which can produce swift files from templates.
For example, let’s say I need to create new ViewController with UITableView. It should be based on MVVM architecture with dependency injection. Let’s name this View “PersonsList”.
So, for this task I need to produce:
PersonListViewController
PersonListViewModel
PersonListViewModelProtocol
PersonCell
VM for cell and protocol for VM
Lots of files.
I want to say to my tool something like that
create tableview-template Person
and as a result get generated files. Files should contain empty implementation of each classes.
How should I do that? I am thinking about simple console app but I don’t know which language I should use. Maybe there is a better idea? Maybe there is a ready tool? Any help? :)
You could manually create the templates yourself and then write a short script (in Python / bash / swift etc) that goes through and replaces keywords with arguments you've passed in.

Does register my custom cluster selection strategy need to compile source code?

I see the doc2.1.x describe the custom cluster selection strategy as follows:
that Register the implementation as a service. You can do this by creating a new file under META-INF/service. Use the filename com.orientechnologies.orient.core.metadata.schema.clusterselection.OClusterSelectionStrategy. For its contents, code your class with the full package.
Does it mean I must modify source code project, compile and publish?
Yes, you must modify the source code project and compile.
I have followed the docs http://orientdb.com/docs/2.1/Cluster-Selection.html#custom-cluster-selection-strategies
and it works.

Add Models and Controllers to Orchard

Does anybody know how to create his own models and controllers in Orchard-based projects? I have an empty project and a pack of screenshots for pages, but I don't know with what to begin. If it is possible, please show an example.
Thanks.
You should start off at the documentation page. There is an 'Extending Orchard' section which walks you through how to create a module, with data access, content parts, and content fields.
Use the command line to generate the module using the code generation module
Documentation here
Then install the Code Generation Extensions from Piotr and follow the instructions on his blog. http://www.szmyd.com.pl/blog/generating-orchard-content-parts-via-command-line
Module adds an Orchard command-line command “codegen part”. It’s
syntax is as follows:
codegen part [/Properties:]
For example:
codegen part Modules.Shop ProductPart /Properties: Name:string,
Price:int
Properties is an optional parameter, so if you’d like to create an
empty part you can just write
codegen part Modules.Shop ProductPart
The command creates a handler, driver, model, record, display and
editor shapes and updates the Placement.info file with default
Content:before placement for your part shape. If you provide
/Properties parameter, the model, record and editor shapes will be
filled with appropriate code accordingly.

How can I set boilerplate information for the files generated by catalyst.pl?

When I use catalyst.pl to auto-generate my application, the AUTHOR section of the POD includes only my name like this.
Kiffin Gish,,,
What are the missing fields and how can I use them? Is it possible to use another boilerplate for the PODs?
It's using the GECOS field from your line in the passwd file (courtesy of getpwuid). You can change the author name that shows up by setting the AUTHOR environment variable, although this doesn't seem documented. As for overriding the entire thing: not so much, unless you want to write your own catalyst.pl that uses a custom subclass of Catalyst::Helper, or submit the patch to -Runtime to let everyone do that.:)

Zend-Framework: how we do this without module?

Sorry this is a pretty long question, but i want to have some disucssions here.
i am new to zend and try to avoid using modules as I think the view aspect of zend is pretty flexible and module will add extra directory and confusion. However i am wondering one thing. The app i am building is pretty big it actually has the modules concept in the app.
I know if using module, things can be more organised, where you can put modules in its own directory and have seperate view and controller etc.
however i decided to simulate module directory in the form of
--lang/module(in fact the controller)/controller(that's the action)/action(that's the child-action)/other-params/--
how we go about and do this kind of simulation
The initial idea i have is add another route to the application take the 4th param as the child-action. e.g
class some_controller extend extends Zend_Controller_Action{
public function someAction{
switch (child-action) {
case 'child-action1':
....... excute some action
break;
case 'child-action2':
....... excute some action
break;....
}
}
something like that. Does that make sense or if there's any other approach? and with this approach how we integrate Zend_ACL as how to add the 'fake child action' as a resource?
Thank you.
Perhaps you could set up your routes like so:
/:controller/:action/:child-action
See here for more info on setting up routes.
Then in your action methods:
$childAction = $this->getParam('child-action');
// convert $childAction to camelCase.
if(method_exists($this, $childAction))
{
// Check ACL
$this->$childAction();
}
Do not name child actions with the Action postfix as that would allow the actions to be called directly. You could maybe postfix them with something like 'fooChild' but not 'fooChildAction' as they would then map to 'foo-child'.
I think this is making it plenty more complicated then just working with the module directory structure...
Which once set-up, is not that complicated at all, it's just a logical separation of classes...
It would make more sense to add a route ;)
have :module/:controller/:action/ -> admin/posts/add
and :module/posts/add/:action -> admin/posts/add/concept that would link to PostsAddController::ConceptAction();
better than switch statement i guess ;) But you can use it to... case "sth": $this->_forward('my-action','my-controller');