Custom development requirements

From Kolmisoft Wiki
Jump to navigationJump to search
This page is under development!

About

These are the requirements in order your custom developed features would be integrated into main code base.

Legal requirements

In order we would add your custom developed features or bugfixes into our main code base - you must sign an agreement and send it us via email: b2bsales@kolmisoft.com. Agreement can be downloaded here.


Other requirements

  • The code must be working and must not generate any crashes.
  • The code must follow ruby styling defined here.
  • The code must follow best practices defined here.
  • The code must be well documented - every method must contain documentation what is does.
  • If you need to make some database changes - store the changes in /home/mor/custom_sql_changes.sql. Be sure that if the same SQL file is imported twice - it would not insert duplicate elements. You can check for SQL examples here:
/usr/src/mor/db/12/beta_data.sql

and

/usr/src/mor/db/12/beta_structure.sql

Kolmisoft does not provide any support regarding internal MOR DB structure. If it helps can you check old MOR 8 DB scheme.

  • The code (the whole directory /home/mor) must be compressed into archive:
tar czf mor_custom.tar.gz /home/mor
  • The code must come with documentation in Microsoft Word/OpenOffice ir PDF format what developed feature does.
  • All code and documentation has to be compresses into 1 archive, *.zip or *.tar.gz are preferred.
  • When you have your feature developed - create a ticket for it in our support system and attach your compressed archive with all information there as attachment.

Custom development branches

Kolmisoft does not provide SVN/Git branches for your development. Please consider using Git to version your changes locally.


Custom development tips

Updating MOR code

MOR usually receives updates for GUI every 1-2 weeks, usually on Monday.

In order to update your code during development - issue these commands (remember to backup your changes!):

svn update /home/mor

MOR GUI update usually needs changes in DB structure or data. Be sure to run DB update according to your MOR version.

For MOR X3 use this command:

/usr/src/mor/db/12/import_changes.sh


Assets

Starting from MOR X3 - Rails assets are used to serve static content faster. This benefit comes with greater complexity - each time you update GUI or add new assets yourself - you have to recompile assets using this script:

MOR X3:

/usr/src/mor/upgrade/12/assets_recompile.sh

Images

When you add static images, let's say icons - put them in this directory:

/home/mor/app/assets/images/

Dynamic images (those that can be upload by user from MOR GUI, for example company logo, calling cards image, etc..):

/home/mor/public/images/

JavaScript

If you include minified JavaScript files - be sure to include original HUMAN READABLE version of file in the same directory - someone will have to fix something one day.

All new JavaScript files must be put here:

/home/mor/vendor/assets/javascripts/

All new JavaScript files must be included in:

/home/mor/app/assets/javascripts/application.js

but 1 line upper than the last line.

CSS

New CSS files must be saved in:

/home/mor/vendor/assets/stylesheets

New CSS files must be included in:

/home/mor/app/assets/stylesheets/application.css


Permissions

Accountant/Reseller permissions

Accountant/Reseller permissions are checked at the beginning of controller code. You do not need to write additional code for this in each action.

Internal permissions system

  • Admin can use all actions without any additional permissions.

Additional righs (when adding new controllers/actions) for users are added by inserting addition records to DB tables:

roles - table of usertypes in MOR system.

rights - controller, action and description of this action.

role_rights - combination of "roles" and "rights" , which usertype can use that action.


SQL Example for adding additional permissions
INSERT INTO rights(controller, action, description) SELECT 'mor_action' FROM dual WHERE (SELECT COUNT(*) FROM rights WHERE controller = 'mor_controller' and action = 'mor_action') = 0;
INSERT INTO role_rights(permission, role_id, right_id) SELECT 0, (SELECT id FROM roles WHERE name = 'user'), (SELECT id FROM rights 
WHERE rights.controller = 'mor_controller' AND rights.action = 'mor_action' LIMIT 1) FROM dual WHERE (SELECT COUNT(*) FROM role_rights 
WHERE role_id = (SELECT id FROM roles WHERE name = 'user') AND right_id = (SELECT id FROM rights WHERE rights.controller = 'mor_controller' AND  rights.action = 'mor_action')) = 0;