diff --git a/src/main/java/info/bukova/isspst/data/TripRequirement.java b/src/main/java/info/bukova/isspst/data/TripRequirement.java index d10ab802..d40af017 100644 --- a/src/main/java/info/bukova/isspst/data/TripRequirement.java +++ b/src/main/java/info/bukova/isspst/data/TripRequirement.java @@ -1,16 +1,30 @@ package info.bukova.isspst.data; import info.bukova.isspst.storage.EntityWithAttachment; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; -import org.hibernate.search.annotations.*; -import javax.persistence.*; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.search.annotations.Analyze; +import org.hibernate.search.annotations.Field; +import org.hibernate.search.annotations.Index; +import org.hibernate.search.annotations.Indexed; +import org.hibernate.search.annotations.IndexedEmbedded; + @Entity @Table(name = "TRIPREQUIREMENT") @Indexed @@ -32,6 +46,11 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach @LazyCollection(LazyCollectionOption.TRUE) @JoinTable(name="TRIPREQUIREMENT_PASSANGER", joinColumns={@JoinColumn(name="TRIPREQUIREMENT_ID")}, inverseJoinColumns={@JoinColumn(name="USER_ID")}) private List passengers; + + @Column(name = "FOREIGN_PERSONS") + @Field(index = Index.YES, analyze = Analyze.YES) + private String foreignPersons; + @Embedded private Vehicle vehicle; @Column(name = "REQUIRE_DOWN_PAYMENT") @@ -99,6 +118,16 @@ public class TripRequirement extends RequirementBase implements EntityWithAttach this.passengers = passengers; } + public String getForeignPersons() + { + return foreignPersons; + } + + public void setForeignPersons(String foreignPersons) + { + this.foreignPersons = foreignPersons; + } + public Vehicle getVehicle() { return vehicle; } diff --git a/src/main/java/info/bukova/isspst/storage/DocumentFileStorageImpl.java b/src/main/java/info/bukova/isspst/storage/DocumentFileStorageImpl.java index aea5e78c..9edc1ab9 100644 --- a/src/main/java/info/bukova/isspst/storage/DocumentFileStorageImpl.java +++ b/src/main/java/info/bukova/isspst/storage/DocumentFileStorageImpl.java @@ -1,21 +1,28 @@ package info.bukova.isspst.storage; import info.bukova.isspst.dao.QueryDao; +import info.bukova.isspst.data.FileContent; import info.bukova.isspst.data.FileMetainfo; import info.bukova.isspst.services.fulltext.Extractor; import info.bukova.isspst.services.fulltext.ExtractorFactory; -import org.apache.commons.codec.binary.Hex; -import org.hibernate.Query; -import org.hibernate.SQLQuery; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Transactional; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.UUID; +import org.apache.commons.codec.binary.Hex; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + /** * @author Pepa Rokos * @@ -245,12 +252,17 @@ public class DocumentFileStorageImpl extends AbstractFileStorage i boolean fileExists = false; for (FileMetainfo info : infos) { - if (info.getContent().getPathInFilesystem().equals(f.getName())) { + FileContent fileContent = info.getContent(); + + if ((fileContent != null) && f.isFile() && fileContent.getPathInFilesystem().equals(f.getName())) + { fileExists = true; + break; } } - if (!fileExists && f.isFile()) { + if (!fileExists && f.isFile()) + { f.delete(); } } diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 95202f5f..fc15aa6b 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -15,7 +15,7 @@ RequirementsFormPurpose=Účel cesty RequirementsFormStartDateTime=Datum a čas odjezdu RequirementsFormEndTravel=Konec cesty RequirementsFormEndDate=Datum příjezdu -RequirementsFormPassengers=Spolucestující: +RequirementsFormPassengers=Spolucestující RequirementsFormVehicle=Dopravní prostředek: RequirementsGridNumberSerie=Číslo RequirementsGridReqDate=Datum požadavku @@ -393,3 +393,9 @@ Search=Hledat Pending = Nevyřízené Archive = Archiv Completed = Vyřízeno + +GenerateBillingForPassengers = Generovat vyúčtování pro spolucestující +Passenger = Pasažér +ChooseThePasseger = Vyberte pasažéra +TransportMode = Způsob dopravy +ForeignPersons = Cizí osoby diff --git a/src/main/webapp/app/uploadComponents.zul b/src/main/webapp/app/uploadComponents.zul index fafb5200..b8b6ec92 100644 --- a/src/main/webapp/app/uploadComponents.zul +++ b/src/main/webapp/app/uploadComponents.zul @@ -1,37 +1,54 @@ - - - - -