Skip to main content

Rental Connect

Connecting to the server

You can retrieve the password from OnePassword to ssh onto the production server but I would advise you add your ssh key once you have connected

ssh rentalconnect@secure.rentalconnect.co.za

The application is found /home/rentalconnect/application/current so once you have connected you should be able to cd application/current

Interacting with the rails console

Once you are in /home/rentalconnect/application/current you will be able to hop onto the rails console

rvm use 2.3.0@rentalconnect
bundle exec rails c production

Common queries and how to solve/fix them

I've gone through my chat history with Roger for the last 3 months and these are the queries I received - mostly password resets.

User password

https://www.youtube.com/watch?v=AyOH7c-1Tpc

Franchise Bank Details update

rentalconnect@ren002-truservcomm-jhb1-005:~/application/current$ bundle exec rails c production
Running via Spring preloader in process 15271
Loading production environment (Rails 4.2.7)
2.3.0 :001 > franchise = Franchise.first
=> #<Franchise id: 1, name: "Rental Connect Test", franchise_group_id: 1, created_at: "2012-07-09 14:28:02", updated_at: "2019-10-16 14:05:27", party_id: 2, contact_detail_id: nil, fidelity_fund_certificate_number: nil, active: false, prefix: "TEST", payment_reference: "test", subsidy_fee: 0.002, auto_commission: nil, auto_generate_landlord_commission_invoices: false, subscription_fee_in_cents: 10000, processing_fee_rate: 0.0055, monthly_subscription_subsidy: 0, payment_method: "debit order">
2.3.0 :002 > franchise = Franchise.where("name like '%Test%'").first
=> #<Franchise id: 1, name: "Rental Connect Test", franchise_group_id: 1, created_at: "2012-07-09 14:28:02", updated_at: "2019-10-16 14:05:27", party_id: 2, contact_detail_id: nil, fidelity_fund_certificate_number: nil, active: false, prefix: "TEST", payment_reference: "test", subsidy_fee: 0.002, auto_commission: nil, auto_generate_landlord_commission_invoices: false, subscription_fee_in_cents: 10000, processing_fee_rate: 0.0055, monthly_subscription_subsidy: 0, payment_method: "debit order">
2.3.0 :003 > bank_account = franchise.bank_account
=> #<BankAccount id: 4, account_holder: "RENTAL CONNECT PTY LTD", account_number: "4079188514", bank_name: "ABSA", branch_code: "632005", branch_name: nil, account_type: "CURRENT", created_at: "2012-07-09 14:28:02", updated_at: "2016-12-01 13:54:51", initials: "", verified_at: "2015-08-25 13:52:14", id_number: "", workflow_state: "verified", beneficiaryable_id: 1, beneficiaryable_type: "Franchise", primary: true, active: true, franchise_id: 1, beneficiary_type_id: 8, balance: nil>
2.3.0 :004 > bank_account.account_number = "123123123"
=> "123123123"
2.3.0 :005 > bank_account.save

Remove BackSlash from Accounting Entry

Sometimes a user might put a backslash into a description field and Latex does not know how to parse it correctly. We can either escape it by I prefer to just remove it. The query from Roger will usually go along these lines:

Roger: For Ballito, Can you remove the back slash in this lease statement: 2021-06-07 (Receipt) allocated to Invoice BAL001-4676 (Refuse Domestic , Electricity Domestic (OP: 36533 - 37993) Reading Date: 12/04/2021) Actual reading: 1460) https://secure.rentalconnect.co.za/#leases/39590/transactions Can you clear it from the invoice as well so the tenant statement can be downloaded too. https://secure.rentalconnect.co.za/#cashflow/invoices/504259/overview

First we need to find the accounting entry. The best thing would be to ask roger to monitor his network tab and ask him to click the accounting entry and see which one it is. Alternatively we find it ourselves

aes = AccountingEntry.where(accountable: Lease.find(39590))
aes.each {|x| puts "#{x.id} - #{x.description}"}
# will output the following
3266067 - (Receipt) allocated to Invoice BAL001-4570 (May Rent)
3320125 - (Receipt) allocated to Invoice BAL001-4707 (June Rent)
3340816 - (Receipt) allocated to Invoice BAL001-4676 (Refuse Domestic , Electricity Domestic (OP: 36533 - 37993) Reading Date: 12/04/2021\) Actual reading: 1460)
3340818 - (Receipt) allocated to Invoice BAL001-4677 (Water Charge (0 - 10KL), Water Charge (10 - 30KL), Water Losss )
# now we fetch that entry
ae = AccountingEntry.find(3340816)
# update the description
ae.description = ae.description.gsub("\\", "")
ae.save

Reverse an accounting entry

# find the entry
ae = AccountingEntry.find(123)
ae.reverse!

Reverse a reconciled receipt

This issue occured on something that took place in 2014 so I don't think you would need to do it but basically the user needed reverse an already reconciled receipt and the server threw an error. In nutshell the cost item did not exist(most likely old code never created it correctly). How to get around this.

# roger should give you an incoming_payment_id 
ip = IncomingPayment.find(1)
# select the payment_allocation we want to reverse
pa = ip.payment_allocations.select {|x| x.amount == 10000}
# instantiate a new object
rrr = ReverseReconciledReceipt.new(pa.id)
# the following methods on the object are private so I use the ruby (:send) method to invoke
rrr.send(:reverse_invoice_transaction)
rrr.send(:reverse_accounting_entries)
rrr.payment_allocation.incoming_payment.unreconcile!
rrr.payment_allocation.delete