How to edit the Jomres core code and still upgrade
From Jomres v4 manual
Jomres uses a plugin system to allow discreet sections of code to run at different points. These plugins are termed minicomponents because they were originally installed using the Joomla Component installer. Nowadays they are installed via the Jomres Plugin Manager.
The plugin system is designed to allow users to create duplicates of a given script (eg j05000bookingobject.class.php) and put them in another folder to be run in place of the core minicomponent (these are the files in /jomres/core-minicomponents, where else?)
I could waffle on for ages about minicomponents and how they've evolved but it's always better to learn from a practical example.
Let's say for example you've modified the calcTax method in the booking engine (dobooking.class.php). What you can do is copy the j05000bookingobject.class.php file from the public_html/jomres/libraries/jomres/classes/ directory into the remote_plugins folder and a directory of it's own, for example called 'custom_code', giving you a directory structure public_html/jomres/remote_plugins/custom_code.
In the j05000bookingobject.class.php you can see the following.
class booking extends jomres_booking { }
We can edit the public_html/jomres/remote_plugins/custom_code/j05000bookingobject.class.php and override the standard Jomres engine's calcTax() method like so:
class booking extends jomres_booking { /** # * Calculates room &/or VAT # */ function calcTax() { $this->setErrorLog("calcTax:: Started"); $totalTax=0.00; $totalBooking=$this->getRoomtotal(); $extrasTotal=$this->getExtrasTotal(); if ($this->cfg_roomTaxYesNo=="1") { $fixedRateAllDays=0; $percentageToAdd=0; $roomTaxFixedRate =$this->cfg_roomTaxFixed; $roomTaxPercentageRate =$this->cfg_roomTaxPercentage; if ($roomTaxPercentageRate!=0) { $percentageToAdd=($totalBooking/100)*$roomTaxPercentageRate; } if ($roomTaxFixedRate!=0) $fixedRateAllDays=$roomTaxFixedRate*$this->stayDays; $totalTax=$fixedRateAllDays+$percentageToAdd; } if ($this->cfg_euroTaxYesNo=="1") { $percentageToAdd=0; if ($this->cfg_euroTaxPercentage!=0) { $percentageToAdd=($totalBooking+$extrasTotal) *($this->cfg_euroTaxPercentage/100); } $totalTax=$percentageToAdd; } $this->tax=$totalTax; $this->setErrorLog("calcTax:: Ended"); } }
Finally you want to tell Jomres to use this plugin instead of the default j05000bookingobject.class.php. Because you've put Jomres into the remote_plugins/custom_code folder (it can be named anything, 'custom_code' isn't mandatory) Jomres will find it when it rebuilds the registry, so rebuild the registry by running the Rebuild Registry feature in the administrator area of Jomres, or just delete jomres/temp/registry.php.
Editing other minicomponents is even easier. Let's say you want to modify the dashboard minicomponent to output some new code. Again, copy the minicomponent (in this case j00013dashboard.class.php into the custom_code folder and edit it to do whatever you want. Rebuild the registry and you're done.
The remote_plugins folder isn't touched by Jomres during an upgrade (migrations are special cases and are treated differently, read any news articles about them) so the customised code will not be overwritten however be aware that your code may not be making full use of any new functionality in the Jomres core.

