Coding Tutorial: How to package a custom implementation as an installable extension.
Collapse
X
-
Hi shalmaxb ,
Actually you can use your old (pre Espo 7) or the new (Espo 7) module structure and the system will recognize it.
You can have the pre Espo 7 structure like this:
application/Espo/Modules/{MyModule}/(back end folders like Controllers, Services,Resources, etc)
client/modules/{my-module}/(front end folders like libs, res. src, etc)
For an example of this structure you can check the Chats extension (which I believe you have) folder structure https://payhip.com/b/tq62X
Or you can have the Espo 7 way like this:
custom/Espo/Modules/{MyModule}/(back end folders)
client/custom/modules/{my-module}/(front end folders)
For an example of this structure you can check the List Plus extension (that I believe that you also have) folder structure https://payhip.com/b/ZGQMH
yuri stated that the "old" way would continue working maybe indefinitely so perhaps it is not necessary to alter the old structure but for new extensions I would recommend using the new way just in case there is another major code refactoring and the "old" way is no longer available -
Meanwhile I found the error. It is caused by a wrong path for the js-file. In a former post the file should be here:
files/client/modules/recalculate-formula/src/unrestricted-recalculate-formula-handler.js
but it works only, if the path looks like this:
files/client/modules/formula-refresh/src/unrestricted-recalculate-formula-handler.js
Here is the extension ready to use: formula-refresh-for-espocrm-1.0.0.zip
Be aware, that this is not my extension, it was made by the tutorial and files from telecastg in this thread.Attached FilesLast edited by shalmaxb; 07-26-2021, 05:09 PM.Leave a comment:
-
I get this error in Browser console:
Code:loader.js:421 Uncaught Error: Could not load file 'client/modules/formula-refresh/src/unrestricted-recalculate-formula-handler.js?r=1627310483' at Object.error (loader.js:421) at j (jquery-2.1.4.min.js:2) at Object.fireWith [as rejectWith] (jquery-2.1.4.min.js:2) at x (jquery-2.1.4.min.js:4) at XMLHttpRequest.<anonymous> (jquery-2.1.4.min.js:4) error @ loader.js:421
Leave a comment:
-
Hello,
Yes, that code is still necessary to be added to the clientDefs of each entity where you want to display the "Recalculate" button. The only change is the reference to the custom handler
from:
Code:"data": { "handler": "custom:basic-recalculate-formula-handler" },
Code:"data": { "handler": "formula-refresh:unrestricted-recalculate-formula-handler" },
Leave a comment:
-
Hi, I have been using the customization itself (in the custom`s folder) quite a while now and it works as desired.
Today I tried to built this as an extension as described here. Unfortunately I did not have success. The button does not appear, no error in the log file or in the app itself.
I see, that in the files, when implemeted in folder custom, there you will have to append this code:
Code:{ ... "menu": { "detail": { "buttons": [ "__APPEND__", { "label": "Recalculate Formula", "name": "recalculateFormula", "action": "recalculate", "style": "default", "acl": "read", "aclScope": "Basic", "data": { "handler": "custom:basic-recalculate-formula-handler" }, "initFunction": "initRecalculate" } ] } }, ... }
Leave a comment:
-
telecastg sure, of course.
I'm using for that wsl on my computer. I'm using windows 10 with WSL, so it's not rocket science
I believe you should have packages like php, git, node.
If you have everything, just:
1. Open CLI (i love Microsoft terminal )
2. Fetch espo template: git clone https://github.com/espocrm/ext-template.git (ss: https://i.imgur.com/orZpSWj.png)
3. Move to the directory (ss: https://i.imgur.com/0PQsN4i.png)
4. Initiate php script: php init.php (ss: https://i.imgur.com/ITSA0UU.png) and provide basic information
5. Run npm install command
That's all. Now you can remove .git directory and init.php file because everything is ready.
This init.php script will prepare all folders which you need to work on your extension.
After that you can open your edit, for me it's visual studio code, so i have to enter "code -n ." to open vscode in that directory.
I've also tried to use everything manually, but it's simpler. I can upgrade version with one command, i can build a package also with one command.
I can prepare temporary instance with one command thanks to which i have EspoCRM instance for specific extension.
There is also one command to move all changes from Custom to Extension. Unfortunatelly it can't merge changes, so after you move everything from Custom, and you'll change something from GUI(for example you'll create new field) it can't merge changes from custom with already existing module.
And of course if you're git-guy, working with github in vscode is a blessingLeave a comment:
Leave a comment: