Understanding units repetition loop and conditions in Docume

Discuss here how to configure hoteldruid and better use its features.

Moderator: marco

Post Reply
Martin Pusch
Posts: 7
Joined: Tue Jun 02, 2015 2:53 pm

Understanding units repetition loop and conditions in Docume

Post by Martin Pusch »

Hello,

I'd like to understand the good usage of the units repetition loop in the documents. I tried several possibilities, with simple loops, nested loops, documents in different situations…

Code: Select all

[r6]
Room: [occupied_unit] Name: [surname]
[/r6]
Has anybody an example for me?

Another question:

I've worked for the first time with "part under condition", with the possibility to compare and decide what to print. Example:

Code: Select all

[c short_stay="false"]
where "short_stay" is a custom variable. This works.
But then I tried to compare two variables, and I didn't find the correct syntax:

Code: Select all

[c ending_date="selection_ending_date"]
[c ending_date=[selection_ending_date]]
[c ending_date="[selection_ending_date]"]
Nothing worked. I found a way using a bunch of custom variables, but the condition thing would have been easier. Any proposition?

Martin
AndilgE
Posts: 29
Joined: Tue Jun 02, 2015 9:11 am
Location: Rua José Alexandre 107 - Flecheiras, 62690.000 Trairi-CE, Brasil

Re: Understanding units repetition loop and conditions in Do

Post by AndilgE »

+1 in the wait list for any further info about this. This will enable proper listing of all extra costs, eg. consumption at the bar, on the generated invoices.

On thing is clear, repetition loop will not work on multilingual base.

Brgs

AndilgE
marco
Posts: 1332
Joined: Tue Jul 05, 2005 6:00 pm
Location: Roma, Italia

Re: Understanding units repetition loop and conditions in Do

Post by marco »

Hello,
[r6] is to repeat all units (rooms) in the hotel, all variables beginning with unit_ are only defined inside this repetition. The variables you're using are for reservations, so you probably want them in a reservation loop (for example in a document selected from "current" reservations table). If you want the information ordered by rooms either order the reservations table by room (if you select the document from there) or you need to have firstly a loop of reservations that stores informations in arrays and then a loop of units to show the information (more complicated).

For now the condition can't be compared with another variable, only with a string. In multilingual only the tags for reservations repetition are forbidden (the whole document is repeated for each reservation) the other repetitions should work fine.

Regards,
Marco
Problems installing, configuring, upgrading?
Try the easiest way to use HotelDruid:
https://www.digitaldruid.net/hosted/index.php
AndilgE
Posts: 29
Joined: Tue Jun 02, 2015 9:11 am
Location: Rua José Alexandre 107 - Flecheiras, 62690.000 Trairi-CE, Brasil

Re: Understanding units repetition loop and conditions in Docume

Post by AndilgE »

Hi Marco,

Every now and then I search for further information about the repetitions and fall back to this topic. Can you please give an overview, not just a response to a question on a specific situation?

in php sources I find these repetitions
[r]
[r2]
[r3]
[r4]
[r5]
[r6]

Picking up bits and pieces in forum I managed to gather the following
[r2] is to repeat all the guests, use it with and the variables that end with "_guest"
[r3] is to repeat all the extra costs
[r6] is to repeat all units (rooms)

Please complete the missing ones.

Brgs,

Andi
ddam
Posts: 28
Joined: Tue Dec 19, 2017 1:37 pm

Re: Understanding units repetition loop and conditions in Docume

Post by ddam »

A more elaborate documentation woud be nice to have indeed !
In the meanwhile, according to this page (http://www.hoteldruid.com/wiki/doku.php?id=document), [r4] is a repetition of dates ([r4 array=“dates_array”][/r4])

I found an example by Marco:
To display a list of daily rates you can create custom variable [day] and a custom array [reservation_days(day)] of the variable day. Then add a condition to assign to that array the progressive values between first arrival and last departure, only when starting reservations repetitions. Insert this in the document text:

[r4 array="reservation_days"]
Day [reservation_days(day)]: [rate_price_of_array_day_p]<br>
[/r4]
Finally, looking at the "Limits of" menu of the Document modification page, we can see that:
[r] is a repetition of reservations
[r5] is a repetition of payments
Post Reply