Logic

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

Moderator: marco

Post Reply
adam
Posts: 14
Joined: Fri Sep 02, 2005 2:34 pm

Logic

Post by adam »

Hi Marco

I have been playing around with a few things in the availabilty template :oops: and messed something up... Do you think you could explain to me the logic the script uses to see if there is availablty within the hotel?

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

Post by marco »

Hi Adam,

the core function that checks availability is liberasettimane in the file liberasettimane.php. "Libera settimane" means "to free weeks", as originally php-residence was only for weekly periods, so each time you see "settimane" you can consider that as referring to "days". Liberasettimane works recursively (it calls itself) until it frees an apartment, but I think you are more interested in how it is used in the availability template.

If you open the file modello_disponibilita.php, in the includes/templates directory, after some checking of the passed variables the fuction tab_a_var is called, its role is to transer the reservatins data from the database table to some variables, these variables are passed later to liberasettimane. The requested apartments (you can have multiple requests) are stored in $app_richiesti. If there are some assignment rules 1 ($num_app_agenzia != 0) before the first attempt of liberasettimane some fake reservations are inserted in the periods corresponding to those rules.
Then if there were no rules 1 or it was not possible to free the requested apartments, liberasettimane is called (again or for the first time). If the requested apartments have been freed $fatto_libera will be set to "SI".

That's more or less how it works, hope it was sufficiently clear.

Marco
adam
Posts: 14
Joined: Fri Sep 02, 2005 2:34 pm

Post by adam »

Hi Marco

That should be enough info... Thanks!
Are you planning to release a new version soon? If so what can we expect to change?

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

Post by marco »

The new version is available today, it's not a major release, I will discuss the changelog in a new thread.

Marco
Post Reply