author Víctor Martínez Romanos <>
Thu, 07 May 2015 12:11:39 +0200
changeset 26684 2311966afd7b
parent 21973 7844d93d8b2b
child 32768 8a37ee35c54f
permissions -rw-r--r--
Fixed bug 29809: Impossible to create several calendars for the same organization

Two pieces of code were affected by this bug: EntityPersistenceEventObserver in charge of checking overlap in manual inserts/updates (or any java process) in c_period table
C_YEARPERIODS: db function associated to the create periods process inside the Fiscal Calendar | Year tab. It also verifies the periods don't overlap other periods.

The fix consists in checking that there is no date overlap per calendar. Before this fix the calendar wasn't taken into account, so it was not possible to define several calendars for the same organization with the same periods.
<?xml version="1.0" encoding="UTF-8" ?>
 * The contents of this file are subject to the Openbravo Public License 
 * Version 1.1 (the "License"), being the Mozilla Public License 
 * version 1.1  with a permitted attribution clause ; you may not use 
 * this file except in compliance with the License. 
 * You may obtain a copy of the License at  
 * Software distributed under the License is distributed on an 
 * "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or 
 * implied. See the License for the specific language governing rights 
 * and  limitations under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
 * All portions are Copyright (C) 2005-2014 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s): Openbravo S.L.U.
List of targets:

init: creates the needed folders.
clean: removes all the created files and folders.
sqlc: generates java files from xsql's files.
compileSqlc: compile the java files generated from xsql's files.
compile: compile the java files of the project.
build.jar: generates the jar file in the lib folder.
build: compile the project, including the xsql's files and generates the jar and doc.
doc: generates the api for the project.
<project name="openbravo-wad" default="compile" basedir=".">
  <property name="build.wad" value="${basedir}/build/classes" />
  <property name="" value="${basedir}/docs" />
  <property name="build.wad.sqlc" value="${basedir}/build/javasqlc" />
  <property name="build.wad.src" value="${basedir}/src" />
  <property name="main.dir" value="${basedir}/.." />

  <path id="wad.class.path">
    <pathelement path="../src-core/build/classes" />
    <fileset dir="${base.lib}">
      <include name="**/*.jar" />

  <target name="init">
    <mkdir dir="${build.wad}" />
    <mkdir dir="${}" />
    <mkdir dir="${build.wad.sqlc}" />

  <target name="clean">
    <delete dir="${build.wad}" failonerror="false" includeemptydirs="true" />
    <delete dir="${build.wad.sqlc}" failonerror="false" includeemptydirs="true" />
    <delete dir="${}" failonerror="false" includeemptydirs="true" />
    <delete failonerror="false" file="${build.wad.lib}/openbravo-wad.jar" />

  <target name="sqlc" depends="init">
    <java classname="" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="'${base.config}'/ .xsql ./src/org '${build.wad.sqlc}' null false" />
      <classpath refid="wad.class.path" />
        <propertyref name="" />
  	<java classname="" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="'${base.config}'/ .xsql '${base.modules}' '${build.wad.sqlc}'/src */src-wad false" />
  	  <classpath refid="wad.class.path" />
         <propertyref name="" />

  <target name="compileSqlc" depends="sqlc">
    <javac srcdir="${build.wad.sqlc}/src" includes="**/*.java" destdir="${build.wad}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" includeantruntime="false">
      <classpath refid="wad.class.path" />

  <path id="my-src-wad-dirs">
    <pathelement path="src" />
    <dirset dir="../modules">
      <include name="*/src-wad" />

  <target name="compile" depends="compileSqlc">
    <javac destdir="${build.wad}" deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" fork="true" includeantruntime="false">
      <src refid="my-src-wad-dirs" />
      <classpath refid="wad.class.path" />

    <copy todir="${build.wad}" encoding="UTF-8">
      <fileset dir="${build.wad.src}" includes="**/*xml" />
      <fileset dir="${build.wad.src}" includes="**/*html" />
    <copy todir="${build.wad}" encoding="UTF-8">
      <fileset dir="${base.modules}">
          <include name="*/src-wad/**/*" />
          <exclude name="*/src-wad/**/*.java" />
          <exclude name="*/src-wad/**/*.xsql" />
      <mapper type="regexp" from="(.*\${file.separator}src-wad)(.*)" to="\2" />

  <target name="build.jar">
    <jar destfile="${build.wad.lib}/openbravo-wad.jar">
      <fileset dir="${build.wad}" />
        <attribute name="Built-By" value="Openbravo S.L.U." />
        <!--section name="common/class1.class">
        <attribute name="Sealed" value="false"/>

  <target name="build" depends="compile, build.jar">

  <target name="doc" depends="init" description="Generate api">
    <javadoc packagenames="org.openbravo.*" sourcepath="${build.wad.sqlc}/src:${build.wad.src}" destdir="${}" author="true" version="true" use="true" docencoding="UTF-8" encoding="UTF-8" failonerror="false" windowtitle="${}">
      <classpath refid="wad.class.path" />