diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 1cf5c591..24bcf3ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /Locanda_target /target +.idea/ + diff --git a/README.txt b/README.txt index cb939eb4..aff30fe2 100644 --- a/README.txt +++ b/README.txt @@ -40,4 +40,15 @@ Starting from v0.3 each resource of the system can be searched by using a simple HOUSED Starting from v0.4, you can set for each booking, at the check-in, each person housed in that room. -Have fun with Locanda! \ No newline at end of file +Have fun with Locanda! + +## How to run the application + +First of all you need to use JDK 1.7. I'm using Tomcat 7 as application server, you can download the *CORE* version [here](http://tomcat.apache.org/download-70.cgi). + +Now you need to import all libraries specified in pom.xml and run two maven commands: +* clean +* install + +The install command will create a new folder called Locanda_target in which you can find Locanda.war. Execute this war in your server and, if you had no error, you should see the web application running in your browser (http://localhost:8080/). + diff --git a/global.properties b/global.properties index 6d7a6b9b..8a5f816a 100644 --- a/global.properties +++ b/global.properties @@ -1,3 +1,2 @@ -resource.folder=${project.build.directory}/${project.name}_resources -solr.homeDir=${resource.folder}/solr -solr.configFile=${solr.homeDir}/solr.xml \ No newline at end of file +#solr.homeDir=${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources +#solr.configFile=${CATALINA_HOME}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr.xml diff --git a/h2.properties b/h2.properties index 33e7be74..a53508ba 100644 --- a/h2.properties +++ b/h2.properties @@ -6,4 +6,5 @@ db.name=locanda db.username=locanda db.password=locanda db.driverClassName=org.h2.Driver -db.url=jdbc:h2:${db.folder}/${db.name};DATABASE_TO_UPPER=FALSE \ No newline at end of file + +#db.url=jdbc:h2:${db.folder}/${db.name};DATABASE_TO_UPPER=FALSE diff --git a/locanda.iml b/locanda.iml new file mode 100644 index 00000000..a27d096b --- /dev/null +++ b/locanda.iml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + file://$MODULE_DIR$/webroot/WEB-INF/applicationContext-infrastructure.xml + file://$MODULE_DIR$/webroot/WEB-INF/dispatcher-servlet.xml + file://$MODULE_DIR$/webroot/WEB-INF/applicationContext.xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index b3cb0ae5..5492a39b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,464 +1,467 @@ - 4.0.0 - labos - locanda - 0.4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + labos + locanda + 0.4 - - ${project.build.directory}/${project.name}_resources - /opt/h2/databases - UTF-8 - + + ./${project.name}_resources + ${resource.folder}/databases + ${resource.folder}/solr + UTF-8 + - - - mysql - - - global.properties - mysql.properties - - - - - mysql - mysql-connector-java - 5.1.22 - runtime - - - - + + + mysql + + + global.properties + mysql.properties + + + + + mysql + mysql-connector-java + 5.1.22 + runtime + + + + - - src - ${basedir}/${project.name}_target - ${project.name} - - global.properties - h2.properties - - - - src - - **/*.java - - - - ${basedir}/solr - ${resource.folder}/solr - - - ${basedir}/h2 - ${db.folder} - - - - - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-war-plugin - 2.3 - - - - true - - - webroot/WEB-INF/web.xml - - - webroot - - **/*.class - - true - - - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.0 - - http://localhost:8080/manager/text - tomcat_server - /locanda - - - - + + src + ${basedir}/${project.name}_target + ${project.name} + + + h2.properties + + + + src + + **/*.java + + + + ${basedir}/solr + ${solr.folder} + + + ${basedir}/h2 + ${db.folder} + + + + + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + + + true + + + webroot/WEB-INF/web.xml + + + webroot + + **/*.class + + true + + + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.0 + + http://localhost:8080/manager/text + tomcat_server + /locanda + + + + - - - org.apache.struts - struts2-json-plugin - 2.3.8 - - - com.sun.jersey - jersey-client - 1.16 - - - com.sun.jersey - jersey-json - 1.16 - - - com.sun.jersey.contribs - jersey-multipart - 1.16 - - - com.sun.jersey - jersey-servlet - 1.16 - - - org.mybatis - mybatis-spring - 1.1.1 - - - spring-context - org.springframework - - - spring-core - org.springframework - - - spring-tx - org.springframework - - - spring-jdbc - org.springframework - - - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.bridge - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.css - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.dom - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.dom.svg - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.ext.awt - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.parser - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.pdf - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.svggen - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.transcoder - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.util - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.util.gui - 1.6.0 - - - org.eclipse.birt.runtime.3_7_1 - org.apache.batik.xml - 1.6.0 - - - org.eclipse.birt.runtime - org.eclipse.birt.runtime - 4.2.1a - - - org.apache.xerces - org.eclipse.birt.runtime.3_7_1 - - - org.mozilla.javascript - org.eclipse.birt.runtime.3_7_1 - - - - org.eclipse.datatools.enablement.oracle.dbdefinition - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.oracle - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.ibm.informix.dbdefinition - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.ibm.informix - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.ibm.db2.luw - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition - - org.eclipse.birt.runtime - - - - org.eclipse.datatools.enablement.msft.sqlserver - - org.eclipse.birt.runtime - - - org.apache.commons.logging - org.eclipse.birt.runtime - - - org.apache.commons.codec - org.eclipse.birt.runtime.3_7_1 - - - commons-lang - commons-lang - - - javax.xml.stream - org.eclipse.birt.runtime - - - - - org.slf4j - log4j-over-slf4j - 1.7.2 - - - org.eclipse.birt.runtime.3_7_1 - org.w3c.dom.smil - 1.0.0 - - - org.eclipse.birt.runtime.3_7_1 - org.w3c.dom.svg - 1.1.0 - - - org.eclipse.birt.runtime.3_7_1 - org.w3c.css.sac - 1.3.0 - - - commons-beanutils - commons-beanutils - 1.8.3 - - - commons-collections - commons-collections - 3.2.1 - - - commons-httpclient - commons-httpclient - 3.1 - - - commons-codec - commons-codec - - - - - javax.ws.rs - jsr311-api - 1.1.1 - - - net.sf.json-lib - json-lib - 2.4 - jdk15 - - - commons-lang - commons-lang - - - - - javax.transaction - jta - 1.1 - - - org.apache.tomcat - tomcat-catalina - 7.0.33 - provided - - - org.apache.tomcat - tomcat-jdbc - 7.0.33 - provided - - - - rhino - js - 1.7R2 - - - org.apache.struts - struts2-convention-plugin - 2.3.8 - - - org.springframework - spring-jdbc - 3.2.0.RELEASE - - - com.sun.jersey.contribs - jersey-spring - 1.16 - - - spring-aop - org.springframework - - - spring-beans - org.springframework - - - spring-context - org.springframework - - - spring-core - org.springframework - - - spring-web - org.springframework - - - - - org.springframework - spring-context - 3.2.0.RELEASE - - - org.apache.struts - struts2-spring-plugin - 2.3.8 - - - org.apache.geronimo.specs - geronimo-stax-api_1.0_spec - 1.0 - - - org.springframework - spring-web - 3.2.0.RELEASE - - - org.apache.solr - solr-core - 3.6.2 - - - servlet-api - javax.servlet - - - - - org.eclipse.birt.runtime.3_7_1 - org.apache.xerces - 2.9.0 - - - org.slf4j - slf4j-jdk14 - 1.7.3 - - - com.h2database - h2 - 1.3.171 - - - - Sardegna Ricerche - http://www.sardegnaricerche.it - - Locanda - http://locanda.sourceforge.net/ - Locanda is an innovative booking management system designed for any touristical structure such as hotels, bed and breakfasts, guesthouses, farmhouses. Featuring a user-friendly and dynamic web interface, Locanda allows a seamless management of all the resources an owner has to control: Bookings, Rooms, Room Types, Guests, Extras, Price Lists, Seasons, Conventions. It is a system developed by the Open Source Lab c/o Sardegna Ricerche, Sardinia, Italy. - Booking management system for hotels, bed&breakfasts, guesthouses - war + + + org.apache.struts + struts2-json-plugin + 2.3.15 + + + com.sun.jersey + jersey-client + 1.16 + + + com.sun.jersey + jersey-json + 1.16 + + + com.sun.jersey.contribs + jersey-multipart + 1.16 + + + com.sun.jersey + jersey-servlet + 1.16 + + + org.mybatis + mybatis-spring + 1.1.1 + + + spring-context + org.springframework + + + spring-core + org.springframework + + + spring-tx + org.springframework + + + spring-jdbc + org.springframework + + + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.bridge + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.css + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.dom + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.dom.svg + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.ext.awt + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.parser + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.pdf + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.svggen + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.transcoder + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.util + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.util.gui + 1.6.0 + + + org.eclipse.birt.runtime.3_7_1 + org.apache.batik.xml + 1.6.0 + + + org.eclipse.birt.runtime + org.eclipse.birt.runtime + 4.2.1a + + + org.apache.xerces + org.eclipse.birt.runtime.3_7_1 + + + org.mozilla.javascript + org.eclipse.birt.runtime.3_7_1 + + + + org.eclipse.datatools.enablement.oracle.dbdefinition + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.oracle + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.ibm.informix.dbdefinition + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.ibm.informix + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.ibm.db2.luw.dbdefinition + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.ibm.db2.luw + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.msft.sqlserver.dbdefinition + + org.eclipse.birt.runtime + + + + org.eclipse.datatools.enablement.msft.sqlserver + + org.eclipse.birt.runtime + + + org.apache.commons.logging + org.eclipse.birt.runtime + + + org.apache.commons.codec + org.eclipse.birt.runtime.3_7_1 + + + commons-lang + commons-lang + + + javax.xml.stream + org.eclipse.birt.runtime + + + + + org.slf4j + log4j-over-slf4j + 1.7.2 + + + org.eclipse.birt.runtime.3_7_1 + org.w3c.dom.smil + 1.0.0 + + + org.eclipse.birt.runtime.3_7_1 + org.w3c.dom.svg + 1.1.0 + + + org.eclipse.birt.runtime.3_7_1 + org.w3c.css.sac + 1.3.0 + + + commons-beanutils + commons-beanutils + 1.8.3 + + + commons-collections + commons-collections + 3.2.1 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-codec + commons-codec + + + + + javax.ws.rs + jsr311-api + 1.1.1 + + + net.sf.json-lib + json-lib + 2.4 + jdk15 + + + commons-lang + commons-lang + + + + + javax.transaction + jta + 1.1 + + + org.apache.tomcat + tomcat-catalina + 7.0.33 + provided + + + org.apache.tomcat + tomcat-jdbc + 7.0.33 + provided + + + + rhino + js + 1.7R2 + + + org.apache.struts + struts2-convention-plugin + 2.3.8 + + + org.springframework + spring-jdbc + 4.1.4.RELEASE + + + com.sun.jersey.contribs + jersey-spring + 1.16 + + + spring-aop + org.springframework + + + spring-beans + org.springframework + + + spring-context + org.springframework + + + spring-core + org.springframework + + + spring-web + org.springframework + + + + + org.springframework + spring-context + 4.1.0.RELEASE + + + org.apache.struts + struts2-spring-plugin + 2.3.8 + + + org.apache.geronimo.specs + geronimo-stax-api_1.0_spec + 1.0 + + + org.springframework + spring-web + 4.1.0.RELEASE + + + + org.apache.solr + solr-core + 3.6.2 + + + servlet-api + javax.servlet + + + + + + org.eclipse.birt.runtime.3_7_1 + org.apache.xerces + 2.9.0 + + + org.slf4j + slf4j-jdk14 + 1.7.3 + + + com.h2database + h2 + 1.3.171 + + + + Sardegna Ricerche + http://www.sardegnaricerche.it + + Locanda + http://locanda.sourceforge.net/ + Locanda is an innovative booking management system designed for any touristical structure such as hotels, bed and breakfasts, guesthouses, farmhouses. Featuring a user-friendly and dynamic web interface, Locanda allows a seamless management of all the resources an owner has to control: Bookings, Rooms, Room Types, Guests, Extras, Price Lists, Seasons, Conventions. It is a system developed by the Open Source Lab c/o Sardegna Ricerche, Sardinia, Italy. + Booking management system for hotels, bed&breakfasts, guesthouses + war diff --git a/solr/solr.xml b/solr/solr.xml index 3d76de1f..c2c8d97a 100644 --- a/solr/solr.xml +++ b/solr/solr.xml @@ -28,6 +28,8 @@ adminPath: RequestHandler path to manage cores. If 'null' (or absent), cores will not be manageable via request handler --> + + # GLOBALIZE diff --git a/src/action/AccountAction-createAccount-validation.xml b/src/action/AccountAction-createAccount-validation.xml index f827cfc6..959d9df6 100644 --- a/src/action/AccountAction-createAccount-validation.xml +++ b/src/action/AccountAction-createAccount-validation.xml @@ -14,9 +14,12 @@ In case of controversy the competent court is the Court of Cagliari (Italy). --> - - + + + + diff --git a/src/action/BookingAction.java b/src/action/BookingAction.java index f54c8303..d1c60521 100644 --- a/src/action/BookingAction.java +++ b/src/action/BookingAction.java @@ -20,20 +20,10 @@ import java.util.Date; import java.util.List; import java.util.Map; + +import model.*; import org.apache.commons.lang.time.DateUtils; -import model.Adjustment; -import model.CreditCard; -import model.ExtraItem; -import model.Booking; -import model.Extra; -import model.Guest; -import model.Housed; -import model.Payment; -import model.Room; -import model.RoomType; -import model.GroupLeader; -import model.UserAware; import model.internal.Message; import model.listini.Convention; import model.listini.Season; @@ -110,7 +100,7 @@ public class BookingAction extends ActionSupport implements SessionAware,UserAwa @Action( value="/updateBookingDates",results = { @Result(type ="json",name="success", params={ - "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" + "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService,groupLeaderService,housedService,creditCardService" }), @Result(type ="json",name="error", params={ "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" @@ -148,7 +138,7 @@ public String updateBookingDates() { @Actions({ @Action(value="/updateRoom",results = { @Result(type ="json",name="success", params={ - "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" + "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService,groupLeaderService,housedService,creditCardService" }), @Result(type ="json",name="error", params={ "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" @@ -207,7 +197,7 @@ private void updateRoom(Booking booking){ @Actions({ @Action(value="/updateNrGuests",results = { @Result(type ="json",name="success", params={ - "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" + "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService,groupLeaderService,housedService,creditCardService" }), @Result(type ="json",name="error", params={ "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" @@ -228,8 +218,13 @@ public String updateNrGuests() { this.updateMaxQuantityInBookedExtraItems(booking); this.updateQuantityInBookedExtraItems(booking); booking.updateExtraSubtotal(); - this.setBooking(booking); - + this.setBooking(booking); + + /* + booking.setaBooker(new Booker()); + booking.setGroupLeader(new Housed()); + booking.setaGroupLeader(new GroupLeader()); + */ this.getMessage().setResult(Message.SUCCESS); this.getMessage().setDescription(getText("calculatedPriceAction")); return "success"; @@ -238,7 +233,7 @@ public String updateNrGuests() { @Actions({ @Action(value="/updateExtras",results = { @Result(type ="json",name="success", params={ - "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" + "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService,groupLeaderService,housedService,creditCardService" }), @Result(type ="json",name="error", params={ "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" @@ -280,7 +275,7 @@ public String updateExtras() { @Actions({ @Action(value="/updateConvention",results = { @Result(type ="json",name="success", params={ - "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" + "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService,groupLeaderService,housedService,creditCardService" }), @Result(type ="json",name="error", params={ "excludeProperties","session,extraService,guestService,structureService,bookingService,roomService,conventionService,seasonService" @@ -399,6 +394,7 @@ public String saveUpdateBooking(){ Booking booking = null; Convention convention = null; CreditCard creditCard = null; + if(!this.checkBookingDates(this.getIdStructure())){ return ERROR; @@ -429,6 +425,15 @@ public String saveUpdateBooking(){ this.getMessage().setDescription(getText("bookingAddErrorNoBookerAction")); return ERROR; } + + // se c'è più di un ospite, la prenotaizone deve avere un capogruppo/capofamiglia + if(this.booking.getId() != null && + this.booking.getNrGuests() > 1 && + this.getGroupLeaderService().findGroupLeaderByIdBooking(this.booking.getId()) == null){ + this.getMessage().setResult(Message.ERROR); + this.getMessage().setDescription(getText("selectGroupLeader")); + return ERROR; + } booker.setId_structure(this.getIdStructure()); booking.setBooker(booker); diff --git a/src/action/RoomAction-saveUpdateRoom1-validation.xml b/src/action/RoomAction-saveUpdateRoom1-validation.xml index 498f9535..cc001303 100644 --- a/src/action/RoomAction-saveUpdateRoom1-validation.xml +++ b/src/action/RoomAction-saveUpdateRoom1-validation.xml @@ -14,8 +14,11 @@ In case of controversy the competent court is the Court of Cagliari (Italy). --> - + + + diff --git a/src/global_it.properties b/src/global_it.properties index cb28be35..fd4fee0e 100644 --- a/src/global_it.properties +++ b/src/global_it.properties @@ -69,9 +69,9 @@ bookingDeleteErrorAction = Errore: La prenotazione non \u00E8 stata cancellata bookingDeleteSuccessAction = Prenotazione eliminata con successo -bookingDeleteWithGroupLeaderErrorAction = Non puoi cancellare questo booking perchè ha un capogruppo associato +bookingDeleteWithGroupLeaderErrorAction = Non puoi cancellare questo booking perch� ha un capogruppo associato -bookingDeleteWithGroupLeaderNotHousedErrorAction = Non puoi cancellare questo booking perchè ha un capogruppo associato che non è alloggiato in nessun'altra prenotazione +bookingDeleteWithGroupLeaderNotHousedErrorAction = Non puoi cancellare questo booking perch� ha un capogruppo associato che non � alloggiato in nessun'altra prenotazione bookingDetails = Dettagli Prenotazione @@ -91,11 +91,11 @@ checkCanBeSingleOrLeader = L'ospite che stai cercando di alloggiare non possiede checkHousedInsert = Non puoi alloggiare un ospite prima della data di check-in -checkHousedDateIn = La data di check-in dell'alloggiato non può essere antecedente a quella del booking +checkHousedDateIn = La data di check-in dell'alloggiato non pu� essere antecedente a quella del booking -checkHousedDateOut = La data di check-out dell'alloggiato non può essere posteriore a quella del booking +checkHousedDateOut = La data di check-out dell'alloggiato non pu� essere posteriore a quella del booking -checkOverlappingHoused = L'ospite che stai cercando di alloggiare è già alloggiato in un'altra prenotazione attiva. Dovresti rimuoverlo prima da quella prenotazione se lo vuoi alloggiare in questa. +checkOverlappingHoused = L'ospite che stai cercando di alloggiare � gi� alloggiato in un'altra prenotazione attiva. Dovresti rimuoverlo prima da quella prenotazione se lo vuoi alloggiare in questa. cancel = Annulla @@ -311,7 +311,7 @@ home = Home homeWelcomeMessage = Gestionale per hotel, B&B ed agriturismi -housedDeleteIsGroupLeaderError = L'ospite che stai cercando di cancellare è capogruppo/capofamiglia nelle seguenti prenotazioni: +housedDeleteIsGroupLeaderError = L'ospite che stai cercando di cancellare � capogruppo/capofamiglia nelle seguenti prenotazioni: housedOptions = Opzioni Alloggiato @@ -325,7 +325,7 @@ identificationTypePlace = Luogo rilascio documento imageName = Nome immagine -imageDeleteError = Errore: l'immagine non è stata cancellata +imageDeleteError = Errore: l'immagine non � stata cancellata images = Immagini @@ -427,11 +427,11 @@ periodAddNew = Aggiungi nuovo periodo periodDelete = Elimina periodo -periodDeleteError = Errore: il periodo non può essere cancellato +periodDeleteError = Errore: il periodo non pu� essere cancellato periodOverlappedAction = Periodi sovrapposti -periodDatesError = Date invalide: la data di partenza deve essere più recente della data di arrivo o dovrebbe differenziarsi per l'anno +periodDatesError = Date invalide: la data di partenza deve essere pi� recente della data di arrivo o dovrebbe differenziarsi per l'anno periodSeasonError = Nel periodo selezionato non sono state configurate le stagioni @@ -477,11 +477,11 @@ roomDeleteErrorAction = Errore nell'eliminazione della camera roomDeleteSuccessAction = La camera \u00E8 stata eliminata con successo -roomDeleteWithBookingError = La camera che vuoi cancellare \u00E8 stata utilizzata in uno o più prenotazioni. Prova a cancellare le prenotazioni coinvolte. +roomDeleteWithBookingError = La camera che vuoi cancellare \u00E8 stata utilizzata in uno o pi� prenotazioni. Prova a cancellare le prenotazioni coinvolte. roomDetails = Dettagli Camera -roomFacilityDeleteError = Errore: la facility della camera non è stata cancellata +roomFacilityDeleteError = Errore: la facility della camera non � stata cancellata roomImageAddSuccessAction = Immagine della camera aggiunta con successo @@ -617,6 +617,8 @@ structureSettings = Configurazione Struttura structureSettingsUpdateSuccessAction = Configurazione della struttura aggiornata con successo +selectGroupLeader = Selezionare un capogruppo + submit = Invia subtotal = Subtotale @@ -785,7 +787,7 @@ CR = COSTA RICA CS = CECOSLOVACCHIA CU = CUBA CV = CAPO VERDE -CW = CURAÇAO +CW = CURA�AO CX = CHRISTMAS (ISOLA) CY = CIPRO CZ = CECA (REPUBBLICA) diff --git a/src/resources/ExportResource.java b/src/resources/ExportResource.java index bbc85855..7ab7f597 100644 --- a/src/resources/ExportResource.java +++ b/src/resources/ExportResource.java @@ -20,10 +20,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; -import model.Booking; -import model.GroupLeader; -import model.GuestQuesturaFormatter; -import model.Housed; +import model.*; import model.questura.HousedExport; import model.questura.HousedExportGroup; import model.questura.HousedType; @@ -36,13 +33,7 @@ import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import service.BookingService; -import service.ExportService; -import service.GroupLeaderService; -import service.HousedExportService; -import service.HousedService; -import service.TourismTypeService; -import service.TransportService; +import service.*; import utils.I18nUtils; @Path("/export/") @@ -63,6 +54,9 @@ public class ExportResource { private TourismTypeService tourismTypeService = null; @Autowired private TransportService transportService = null; + @Autowired + private RoomService roomService = null; + private static Logger logger = Logger.getLogger(Logger.class); @GET @@ -138,6 +132,7 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure List housedExportSingleList = null; Integer availableRooms; Integer availableBeds; + Integer roomsInStructure; exportDate = new Date(Long.parseLong(date)); @@ -153,6 +148,16 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure //CREO LA LISTA DEGLI HOUSED EXPORT Singoli housedExportSingleList = this.findHousedExportSingleList(housedExportList); + + //NUMERO TOTALE DI LETTI NELLA STRUTTURA + List roomsList = this.roomService.findRoomsByIdStructure(idStructure); + int totalNumberOfbeds = 0; + for(Room singleRoom : roomsList){ + totalNumberOfbeds += this.roomService.findRoomById(singleRoom.getId()).getRoomType().getMaxGuests(); + } + + //NUMERO TOTALE DI STANZE NELLA STRUTURA + roomsInStructure = roomsList.size(); availableRooms =this.getExportService().calculateAvailableNumberOfRoomsForStructureInDate(idStructure, exportDate); availableBeds = this.getExportService().calculateAvailableNumberOfBedsForStructureInDate(idStructure, exportDate); @@ -164,7 +169,7 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure guestQuesturaFormatterLeader.setModalita(each.getHousedExportLeader().getMode()); guestQuesturaFormatterLeader.setCamereOccupate(this.calculateNumberOfOccupiedRoomsForGroup(each)); guestQuesturaFormatterLeader.setCamereDisponibili(availableRooms); - guestQuesturaFormatterLeader.setLettiDisponibili(availableBeds); + guestQuesturaFormatterLeader.setLettiDisponibili(totalNumberOfbeds); guestQuesturaFormatterLeader.setNumGiorniPermanenza(this.calculateLengthOfStay(each.getHousedExportLeader())); guestQuesturaFormatterLeader.setDataFromHousedForQuestura(each.getHousedExportLeader().getHoused()); sb.append(guestQuesturaFormatterLeader.getRowQuestura(false)); @@ -194,7 +199,7 @@ public Response exportFileQuestura(@PathParam("idStructure") Integer idStructure guestQuesturaFormatter.setModalita(each.getMode()); guestQuesturaFormatter.setCamereOccupate(1); guestQuesturaFormatter.setCamereDisponibili(availableRooms); - guestQuesturaFormatter.setLettiDisponibili(availableBeds); + guestQuesturaFormatter.setLettiDisponibili(totalNumberOfbeds); guestQuesturaFormatter.setNumGiorniPermanenza(this.calculateLengthOfStay(each)); guestQuesturaFormatter.setDataFromHousedForQuestura(each.getHoused()); sb.append(guestQuesturaFormatter.getRowQuestura(false)); @@ -229,6 +234,8 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q List housedExportSingleList = null; Integer availableRooms; Integer availableBeds; + Integer roomsInStructure; + Integer bedsInRoom; logger.info("#####FORCE:" + force); exportDate = new Date(Long.parseLong(date)); @@ -246,18 +253,35 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q //CREO LA LISTA DEGLI HOUSED EXPORT Singoli housedExportSingleList = this.findHousedExportSingleList(housedExportList); - + + //NUMERO TOTALE DI LETTI NELLA STRUTTURA + List roomsList = this.roomService.findRoomsByIdStructure(idStructure); + int totalNumberOfbeds = 0; + for(Room singleRoom : roomsList){ + totalNumberOfbeds += this.roomService.findRoomById(singleRoom.getId()).getRoomType().getMaxGuests(); + } + + //NUMERO TOTALE DI STANZE NELLA STRUTURA + roomsInStructure = roomsList.size(); + + + /** + * AvailableRooms indica il numero di stanze disponibili quindi stanzeTotali - stanzeOccupate + * availableBeds indica il numero di letti disponibili quindi lettiTotali - lettiOccupati + * + * Ora non vengono utilizzate in seguiito alle modifiche richieste all'applicativo. + */ availableRooms =this.getExportService().calculateAvailableNumberOfRoomsForStructureInDate(idStructure, exportDate); availableBeds = this.getExportService().calculateAvailableNumberOfBedsForStructureInDate(idStructure, exportDate); sb = new StringBuilder(); - for(HousedExportGroup each : housedExportGroupList){ + for(HousedExportGroup each : housedExportGroupList){ GuestQuesturaFormatter guestQuesturaFormatterLeader = new GuestQuesturaFormatter(); guestQuesturaFormatterLeader.setModalita(each.getHousedExportLeader().getMode()); guestQuesturaFormatterLeader.setCamereOccupate(this.calculateNumberOfOccupiedRoomsForGroup(each)); - guestQuesturaFormatterLeader.setCamereDisponibili(availableRooms); - guestQuesturaFormatterLeader.setLettiDisponibili(availableBeds); + guestQuesturaFormatterLeader.setCamereDisponibili(roomsInStructure); + guestQuesturaFormatterLeader.setLettiDisponibili(totalNumberOfbeds); TourismType tourismType = this.getTourismTypeService().findById(each.getHousedExportLeader().getHoused().getId_tourismType()); Transport transport = this.getTransportService().findById(each.getHousedExportLeader().getHoused().getId_transport()); guestQuesturaFormatterLeader.setTipoTurismo(tourismType != null? I18nUtils.getProperty(tourismType.getName()) : ""); @@ -297,8 +321,8 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q each.getHoused().setHousedType(anHousedType); guestQuesturaFormatter.setModalita(each.getMode()); guestQuesturaFormatter.setCamereOccupate(1); - guestQuesturaFormatter.setCamereDisponibili(availableRooms); - guestQuesturaFormatter.setLettiDisponibili(availableBeds); + guestQuesturaFormatter.setCamereDisponibili(roomsInStructure); + guestQuesturaFormatter.setLettiDisponibili(totalNumberOfbeds); TourismType tourismTypeSingle = this.getTourismTypeService().findById(each.getHoused().getId_tourismType()); Transport transportSingle = this.getTransportService().findById(each.getHoused().getId_transport()); guestQuesturaFormatter.setTipoTurismo(tourismTypeSingle != null? I18nUtils.getProperty(tourismTypeSingle.getName()) : ""); @@ -306,6 +330,8 @@ public Response exportFileSired(@PathParam("idStructure") Integer idStructure,@Q Integer tourismTaxSingle = each.getHoused().getTouristTax() ? 1 : 0; guestQuesturaFormatter.setTassaSoggiorno(tourismTaxSingle); guestQuesturaFormatter.setDataFromHousedForRegione(each.getHoused()); + //guestQuesturaFormatter.setDataArrivo(booking.getDateIn()); + //guestQuesturaFormatter.setDataDiPartenza(booking.getDateOut()); sb.append(guestQuesturaFormatter.getRowRegione()); } diff --git a/src/resources/GroupLeaderResource.java b/src/resources/GroupLeaderResource.java index 3bdbd6e4..2924fcf5 100644 --- a/src/resources/GroupLeaderResource.java +++ b/src/resources/GroupLeaderResource.java @@ -61,6 +61,11 @@ public GroupLeader getGroupLeader(@PathParam("id_booking") Integer id_booking){ GroupLeader ret = null; ret = this.getGroupLeaderService().findGroupLeaderByIdBooking(id_booking); + + if(ret == null){ + ret = new GroupLeader(); + } + return ret; } diff --git a/src/struts/interceptor/UserAwareInterceptor.java b/src/struts/interceptor/UserAwareInterceptor.java index 42fe35a1..2a15bdad 100644 --- a/src/struts/interceptor/UserAwareInterceptor.java +++ b/src/struts/interceptor/UserAwareInterceptor.java @@ -49,7 +49,14 @@ public String intercept(ActionInvocation invocation) throws Exception { action.setIdStructure(user.getStructure().getId()); } } - return invocation.invoke(); + + String result = "success"; + try{ + result = invocation.invoke(); + } catch(Exception e){ + e.printStackTrace(); + } + return result; } } \ No newline at end of file diff --git a/src/utils/JsonDateDeserializer.java b/src/utils/JsonDateDeserializer.java index 1777ebcb..5717a7e8 100644 --- a/src/utils/JsonDateDeserializer.java +++ b/src/utils/JsonDateDeserializer.java @@ -1,9 +1,17 @@ package utils; import java.io.IOException; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; import org.apache.log4j.Logger; import org.codehaus.jackson.JsonParser; @@ -12,19 +20,24 @@ import org.codehaus.jackson.map.JsonDeserializer; public class JsonDateDeserializer extends JsonDeserializer { - private static Logger logger = Logger.getLogger(Logger.class); - @Override - public Date deserialize(JsonParser jsonparser, - DeserializationContext deserializationcontext) throws IOException, JsonProcessingException { - //SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); - String date = jsonparser.getText(); - logger.info("***** BIRTHDATE:*" + date); - return new Date(Long.valueOf(date)); + @Override + public Date deserialize(JsonParser jsonparser, DeserializationContext deserializationcontext) throws IOException, JsonProcessingException { + String param = jsonparser.getText(); - } - - + // The timestamp is generated by the client with a given timezone. + // The same timezone is used by the server (Locanda is packaged as a desktop app). + // We calculate the timezone offset and add it to the timestamp provided by the client. + long offset = TimeZone.getTimeZone(ZoneId.systemDefault()).getRawOffset(); + long timestamp = Long.valueOf(param); + Instant instant = Instant.ofEpochMilli(timestamp + offset); + + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); + + return date; + + } } diff --git a/webroot/META-INF/context.xml b/webroot/META-INF/context.xml index cd028c40..c3800721 100644 --- a/webroot/META-INF/context.xml +++ b/webroot/META-INF/context.xml @@ -47,6 +47,6 @@ username="${db.username}" password="${db.password}" driverClassName="${db.driverClassName}" - url="${db.url}" + url="jdbc:h2:${catalina.home}/webapps/Locanda/WEB-INF/classes/Locanda_resources/databases/${db.name};DATABASE_TO_UPPER=FALSE" /> \ No newline at end of file diff --git a/webroot/WEB-INF/applicationContext.xml b/webroot/WEB-INF/applicationContext.xml index 7bcc1aca..03fa185a 100644 --- a/webroot/WEB-INF/applicationContext.xml +++ b/webroot/WEB-INF/applicationContext.xml @@ -43,14 +43,18 @@ - - - + + + + - ${solr.homeDir} - ${solr.configFile} + + ${catalina.home}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr + + ${catalina.home}/webapps/Locanda/WEB-INF/classes/Locanda_resources/solr/solr.xml + @@ -104,23 +108,29 @@ - + - + + - - + + diff --git a/webroot/WEB-INF/jsp/createAccount-output.jsp b/webroot/WEB-INF/jsp/createAccount-output.jsp index a09d432b..2e1c45ab 100644 --- a/webroot/WEB-INF/jsp/createAccount-output.jsp +++ b/webroot/WEB-INF/jsp/createAccount-output.jsp @@ -27,7 +27,7 @@

:

Email:

- Password: + Password: locanda