Forum


Where is each property's information stored in the DB?

More
2 weeks 6 days ago #47656 by Paulo
Hello:

Where does Jomres store each property's information in the database? As far as I know, there are two tables, "jomres_propertys" and "jomres_settings". Is there any other one that I might have missed?

The reason I am asking is because I'm trying to implement this: www.jomres.net/forum/How-do-I/26138-canc...-to-accounting-rules ; in other words, a way so that Jomres can create and store "negative" invoices. Jomres internally associates each invoice with a reservation and a property, so I have to create a dummy property just to hold those new invoices.
I added it by hand to "jomres_propertys" with a special property_uid 99, and modified the code to take that into account (I'm working on a single hotel system, so there's no problem there), but now I also need to add all the other data associated with each property (name, address, contact info, etc.), so that they show up on the invoice.

Please Log in or Create an account to join the conversation.

More
2 weeks 6 days ago #47657 by Vince Wooll

Please Log in or Create an account to join the conversation.

More
2 weeks 6 days ago #47660 by Paulo
Uhhh... it doesn't answer my question. If what you mean is that I shouldn't be mucking with the DB directly, since the data in it is encrypted, I should say that we are using version 9.8.27, where the DB data isn't encrypted, and we had to modify it so heavily that upgrading would be a major effort.

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago #47661 by Vince Wooll
Sorry, I misread your question (the pressures of time, no excuse).

What happens when you use this class to create the invoice?

github.com/WoollyinWalesIT/jomres/blob/m...al_invoice.class.php

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
2 weeks 5 days ago #47662 by Paulo
I am using that class to create the new invoice. What I'm doing, roughly, is:

1) Load the current contract's details:
$current_contract_details = jomres_singleton_abstract::getInstance('basic_contract_details');
$current_contract_details->gather_data($this->contract_uid, MY CURRENT HOTEL'S ID);
$contrato = $current_contract_details->contract[$this->contract_uid]['contractdeets'];

2) Insert a new contract into "jomres_contracts" using SQL, using the data loaded above.

3) Create a new invoice:
//This is the SQL query that inserts the dummy contract mentioned above.
        $cancelled_contract_uid = doInsertSql($query, '');

        jr_import('jrportal_invoice');
        $invoice = new jrportal_invoice();
        $invoice_data = array();
		$invoice_data[ 'cms_user_id' ] = 0;
		$invoice_data[ 'subscription' ] = false;
		$invoice_data['currencycode'] = $contrato['currency_code'];
		$invoice_data['status'] = 1; //mark it as paid
		$invoice->contract_id = $cancelled_contract_uid;
		$invoice->property_uid = 99;

		$line_items=array();
		$line_items[] = array('tax_code_id' => (int) $mrConfig[ 'accommodation_tax_code' ],
											'name' => 'Factura de abono',
											'description' => 'Abono de la factura cancelada nº ' . $facturaaanular,
											'init_price' => (-1 * $total),
											'init_qty' => 1,
											'init_discount' => 0,
											);
              $invoice->create_new_invoice($invoice_data, $line_items);
 

Everything works fine. The only problem is that, when viewing this new negative invoice, the hotel's data doesn't get loaded.

I added by hand the new property with the ID 99 in "jomres_propertys"; then, yesterday I also dumped all the data in "jomres_settings" related to the current property and inserted it again, using 99 as the property_uid, but it still doesn't work.

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #47664 by Vince Wooll

Paulo wrote:
Everything works fine. The only problem is that, when viewing this new negative invoice, the hotel's data doesn't get loaded.

I added by hand the new property with the ID 99 in "jomres_propertys"; then, yesterday I also dumped all the data in "jomres_settings" related to the current property and inserted it again, using 99 as the property_uid, but it still doesn't work.


If you use the class to create the invoice, you should find a new row in the sellers_pii table for that invoice. That's where the property data is pulled from.

See L257 here

github.com/WoollyinWalesIT/jomres/blob/m...al_invoice.class.php

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #47669 by Paulo
I don't see that anywhere in my code. I should mention, I'm still using 9.8.27.

Please Log in or Create an account to join the conversation.

More
2 weeks 4 days ago #47670 by Vince Wooll
No, you wont, the new code arrived a few months later.

In that case you'll need to use this class

github.com/WoollyinWalesIT/jomres/blob/d...ty_details.class.php

an example of how this is used is

$current_property_details = jomres_singleton_abstract::getInstance('basic_property_details');
$current_property_details->gather_data($property_uid);

then dump $current_property_details to find all that lovely juicy information.

Oh, and it's always wise to update the Core. Your version is nearly 3 years old.

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

More
2 weeks 3 days ago - 2 weeks 3 days ago #47673 by Paulo
Okay, I finally found out what was going on. It turns out that I had localised the information of the hotel (name, address, etc.), so Jomres was trying to load it from the "jomres_custom_text" table, and since I hadn't added those strings for the new dummy property I had added... nothing was showing up.


Nevermind, it wasn't that either :silly:

As for upgrading, I take your point, but my installation has been so customised that I don't know if I could do it without breaking half a dozen things...
Last edit: 2 weeks 3 days ago by Paulo.

Please Log in or Create an account to join the conversation.

More
2 weeks 2 days ago #47674 by Vince Wooll
Read this about customising, please

www.jomres.net/manual/developers-guide-2/52-customising-jomres

including the articles in that category.

Follow me on twitter
Do not send me PMs, if you need to contact me use the ticket system.
Read this before you customise Jomres files

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum

ABOUT US

vince picDeveloped and maintained by Vince Wooll, Jomres was initially conceived in early 2005 as a Mambo based solution to a client’s hotel management needs. While it wasn't originally expected to be an online booking system it quickly morphed into one as users requested more and more features.

As the number of feature requests grew Vince knew that he would need to dedicate more time to the project and in July 2005 Jomres was formally released as a commercial project. Since then, Jomres has become one of Mambo’s, and now Joomla’s, longest running projects. It has survived various versions of Mambo, then Joomla 1.0, 1.5, 1.6, 1.7, 2.5 and 3.

Aladar joined the project in 2010 after using Jomres for his own projects. He was active on the forum, helping other members of the community and eventually Vince invited him to join the team. Between 2010 and 2018 he was an integral part of the project and made many significant contributions.

Whilst not formally part of the Jomres project, Rodrigo Rocco and Vince have become firm friends. Rod is a freelancer who specialises in doing custom work for Jomres users and developing custom plugins for the system that take advantage of it's modular design. He has built many useful extensions including his fabulous Valentina Template Override Package.

Jomres and the Jomres Logo is trademarked and can't be used without written consent from the owner.

www.jomres.net is not affiliated with or endorsed by the Joomla! Project, Open Source Matters or the WordPress project. The Joomla! & WordPress names and logos are used under a limited license granted by Open Source Matters and the WordPress Projects.

© Copyright 2005 - 2018 Woollyinwales IT.