dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17912
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7324: CCEM work in progress
------------------------------------------------------------
revno: 7324
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-18 14:45:09 +0530
message:
CCEM work in progress
added:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_Attribute.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryType_AttributeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryType_AttributeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType_Attribute.hbm.xml
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogDetails.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java
local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java 2012-05-17 07:33:28 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java 2012-06-18 09:15:09 +0000
@@ -34,15 +34,27 @@
private List<InventoryTypeAttribute> inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>();
+ private List<Boolean> display = new ArrayList<Boolean>();
+
+ private Set<InventoryType_Attribute> inventoryType_Attributes;
+
+
/**
* All DataSets associated with this InventoryType.
*/
private Set<DataSet> dataSets = new HashSet<DataSet>();
-
+
+
+
private DataEntryForm dataEntryForm;
-
+ /*
+ * True if this InventoryTypeAttribute is for display in list
+ */
+ //private boolean display = false;
+
+
// -------------------------------------------------------------------------
// Contructors
// -------------------------------------------------------------------------
@@ -178,5 +190,26 @@
{
this.dataSets = dataSets;
}
+ /*
+ public boolean isDisplay()
+ {
+ return display;
+ }
+ public void setDisplay( boolean display )
+ {
+ this.display = display;
+ }
+ */
+
+ public Set<InventoryType_Attribute> getInventoryType_Attributes()
+ {
+ return inventoryType_Attributes;
+ }
+ public void setInventoryType_Attributes( Set<InventoryType_Attribute> inventoryType_Attributes )
+ {
+ this.inventoryType_Attributes = inventoryType_Attributes;
+ }
+
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java 2012-05-16 07:06:15 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryTypeAttribute.java 2012-06-18 09:15:09 +0000
@@ -35,7 +35,10 @@
private boolean mandatory;
- private boolean display;
+ /*
+ * True if this InventoryTypeAttribute is for display in list
+ */
+ private boolean display = false;
private Integer noChars;
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_Attribute.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_Attribute.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_Attribute.java 2012-06-18 09:15:09 +0000
@@ -0,0 +1,145 @@
+package org.hisp.dhis.coldchain.inventory;
+
+import java.io.Serializable;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version InventoryType_Attribute.java Jun 14, 2012 1:27:37 PM
+ */
+public class InventoryType_Attribute implements Serializable
+{
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+ private static final long serialVersionUID = -5670110591005778814L;
+
+
+ /**
+ * Part of composite key
+ */
+ private InventoryType inventoryType;
+
+ /**
+ * Part of composite key
+ */
+ private InventoryTypeAttribute inventoryTypeAttribute;
+
+ private boolean display = false;
+
+ private Integer sortOrder;
+
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ //Default Constructors
+
+ public InventoryType_Attribute()
+ {
+
+ }
+
+
+ public InventoryType_Attribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display )
+ {
+ this.inventoryType = inventoryType;
+ this.inventoryTypeAttribute = inventoryTypeAttribute;
+ this.display = display;
+ }
+
+ public InventoryType_Attribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display, Integer sortOrder)
+ {
+ this.inventoryType = inventoryType;
+ this.inventoryTypeAttribute = inventoryTypeAttribute;
+ this.display = display;
+ this.sortOrder = sortOrder;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode, equals and toString
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ return inventoryType.hashCode() + inventoryTypeAttribute.hashCode();
+ }
+
+ @Override
+ public boolean equals( Object object )
+ {
+
+ if ( object == null )
+ {
+ return false;
+ }
+
+ if ( getClass() != object.getClass() )
+ {
+ return false;
+ }
+
+ final InventoryType_Attribute other = ( InventoryType_Attribute ) object;
+
+ return inventoryTypeAttribute.getId() == other.getInventoryTypeAttribute().getId()
+ && inventoryType.getId() == other.getInventoryType().getId();
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+
+ public void setInventoryType( InventoryType inventoryType )
+ {
+ this.inventoryType = inventoryType;
+ }
+
+
+ public InventoryTypeAttribute getInventoryTypeAttribute()
+ {
+ return inventoryTypeAttribute;
+ }
+
+
+ public void setInventoryTypeAttribute( InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ this.inventoryTypeAttribute = inventoryTypeAttribute;
+ }
+
+
+ public boolean isDisplay()
+ {
+ return display;
+ }
+
+
+ public void setDisplay( boolean display )
+ {
+ this.display = display;
+ }
+
+
+ public Integer getSortOrder()
+ {
+ return sortOrder;
+ }
+
+
+ public void setSortOrder( Integer sortOrder )
+ {
+ this.sortOrder = sortOrder;
+ }
+
+
+
+
+}
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeService.java 2012-06-18 09:15:09 +0000
@@ -0,0 +1,33 @@
+package org.hisp.dhis.coldchain.inventory;
+
+import java.util.Collection;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version InventoryType_AttributeService.java Jun 14, 2012 2:30:47 PM
+ */
+public interface InventoryType_AttributeService
+{
+ String ID = InventoryType_AttributeService.class.getName();
+
+ void addInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ void updateInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ void deleteInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ InventoryType_Attribute getInventoryTypeAttribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute );
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributes();
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributesByInventoryType( InventoryType inventoryType );
+
+ Collection<InventoryTypeAttribute> getListInventoryTypeAttribute( InventoryType inventoryType );
+
+ InventoryType_Attribute getInventoryTypeAttributeForDisplay( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display);
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributeForDisplay( InventoryType inventoryType, boolean display );
+
+
+}
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType_AttributeStore.java 2012-06-18 09:15:09 +0000
@@ -0,0 +1,35 @@
+package org.hisp.dhis.coldchain.inventory;
+
+import java.util.Collection;
+
+import org.hisp.dhis.common.GenericStore;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version InventoryType_AttributeStore.java Jun 14, 2012 2:43:57 PM
+ */
+//public interface InventoryType_AttributeStore extends GenericStore<InventoryType_Attribute>
+public interface InventoryType_AttributeStore
+{
+ String ID = InventoryType_AttributeStore.class.getName();
+
+ void addInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ void updateInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ void deleteInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute );
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributes();
+
+ InventoryType_Attribute getInventoryTypeAttribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute );
+
+ InventoryType_Attribute getInventoryTypeAttributeForDisplay( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display);
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributeForDisplay( InventoryType inventoryType, boolean display );
+
+ Collection<InventoryType_Attribute> getAllInventoryTypeAttributesByInventoryType( InventoryType inventoryType );
+
+ Collection<InventoryTypeAttribute> getListInventoryTypeAttribute( InventoryType inventoryType );
+
+}
=== added file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryType_AttributeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryType_AttributeService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultInventoryType_AttributeService.java 2012-06-18 09:15:09 +0000
@@ -0,0 +1,94 @@
+package org.hisp.dhis.coldchain.inventory;
+
+import java.util.Collection;
+
+import org.springframework.transaction.annotation.Transactional;
+
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version DefaultInventoryType_AttributeService.java Jun 14, 2012 3:19:02 PM
+ */
+
+public class DefaultInventoryType_AttributeService implements InventoryType_AttributeService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private InventoryType_AttributeStore inventoryType_AttributeStore;
+
+ public void setInventoryType_AttributeStore( InventoryType_AttributeStore inventoryType_AttributeStore )
+ {
+ this.inventoryType_AttributeStore = inventoryType_AttributeStore;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Implementation methods
+ // -------------------------------------------------------------------------
+ @Transactional
+ @Override
+ public void addInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ inventoryType_AttributeStore.addInventoryType_Attribute( inventoryType_Attribute );
+ }
+
+ @Transactional
+ @Override
+ public void deleteInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ inventoryType_AttributeStore.deleteInventoryType_Attribute( inventoryType_Attribute );
+ }
+
+ @Transactional
+ @Override
+ public void updateInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ inventoryType_AttributeStore.updateInventoryType_Attribute( inventoryType_Attribute );
+ }
+
+ @Transactional
+ @Override
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributes()
+ {
+ return inventoryType_AttributeStore.getAllInventoryTypeAttributes();
+ }
+
+ @Transactional
+ @Override
+ public InventoryType_Attribute getInventoryTypeAttribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ return inventoryType_AttributeStore.getInventoryTypeAttribute( inventoryType, inventoryTypeAttribute );
+ }
+
+ @Transactional
+ @Override
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributesByInventoryType( InventoryType inventoryType )
+ {
+ return inventoryType_AttributeStore.getAllInventoryTypeAttributesByInventoryType( inventoryType );
+ }
+
+ @Transactional
+ @Override
+ public Collection<InventoryTypeAttribute> getListInventoryTypeAttribute( InventoryType inventoryType )
+ {
+ return inventoryType_AttributeStore.getListInventoryTypeAttribute( inventoryType );
+ }
+
+ @Transactional
+ @Override
+ public InventoryType_Attribute getInventoryTypeAttributeForDisplay( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display)
+ {
+ return inventoryType_AttributeStore.getInventoryTypeAttributeForDisplay( inventoryType, inventoryTypeAttribute, display );
+ }
+
+ @Transactional
+ @Override
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributeForDisplay( InventoryType inventoryType, boolean display )
+ {
+ return inventoryType_AttributeStore.getAllInventoryTypeAttributeForDisplay( inventoryType, display );
+ }
+
+}
=== added file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryType_AttributeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryType_AttributeStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateInventoryType_AttributeStore.java 2012-06-18 09:15:09 +0000
@@ -0,0 +1,155 @@
+package org.hisp.dhis.coldchain.inventory.hibernate;
+
+import java.util.Collection;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryType_Attribute;
+import org.hisp.dhis.coldchain.inventory.InventoryType_AttributeStore;
+
+/**
+ * @author Mithilesh Kumar Thakur
+ *
+ * @version HibernateInventoryType_AttributeStore.java Jun 14, 2012 2:50:04 PM
+ */
+
+//public class HibernateInventoryType_AttributeStore extends HibernateGenericStore<InventoryType_Attribute> implements InventoryType_AttributeStore
+public class HibernateInventoryType_AttributeStore implements InventoryType_AttributeStore
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // InventoryType_Attribute
+ // -------------------------------------------------------------------------
+
+ //add
+
+ @Override
+ public void addInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.save( inventoryType_Attribute );
+ }
+
+ //update
+ @Override
+ public void updateInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.update( inventoryType_Attribute );
+ }
+
+ //delete
+ @Override
+ public void deleteInventoryType_Attribute( InventoryType_Attribute inventoryType_Attribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ session.delete( inventoryType_Attribute );
+ }
+
+ // get all
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributes()
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return session.createCriteria( InventoryType_Attribute.class ).list();
+ }
+
+ @Override
+ public InventoryType_Attribute getInventoryTypeAttribute( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType_Attribute.class );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ criteria.add( Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) );
+
+ return (InventoryType_Attribute) criteria.uniqueResult();
+
+ //return (InventoryType_Attribute) getCriteria( Restrictions.eq( "inventoryType", inventoryType ),Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) ).uniqueResult();
+ }
+
+ @Override
+ public InventoryType_Attribute getInventoryTypeAttributeForDisplay( InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, boolean display)
+ {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType_Attribute.class );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ criteria.add( Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) );
+ criteria.add( Restrictions.eq( "display", display ) );
+
+ return (InventoryType_Attribute) criteria.uniqueResult();
+
+ //return (InventoryType_Attribute) getCriteria( Restrictions.eq( "inventoryType", inventoryType ), Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ), Restrictions.eq( "display", display ) ).uniqueResult();
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributesByInventoryType( InventoryType inventoryType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType_Attribute.class );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ return criteria.list();
+
+ //return getCriteria( Restrictions.eq( "inventoryType", inventoryType ) ).list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<InventoryType_Attribute> getAllInventoryTypeAttributeForDisplay( InventoryType inventoryType, boolean display )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType_Attribute.class );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ criteria.add( Restrictions.eq( "display", display ) );
+ return criteria.list();
+
+ //return getCriteria( Restrictions.eq( "inventoryType", inventoryType ), Restrictions.eq( "display", display ) ).list();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<InventoryTypeAttribute> getListInventoryTypeAttribute( InventoryType inventoryType )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( InventoryType_Attribute.class );
+
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ criteria.setProjection( Projections.property( "inventoryTypeAttribute" ) );
+ return criteria.list();
+
+ /*
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria( getClazz() );
+ criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
+ criteria.setProjection( Projections.property( "inventoryTypeAttribute" ) );
+ return criteria.list();
+ */
+ }
+}
+
+
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-06-14 05:58:42 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-06-18 09:15:09 +0000
@@ -188,6 +188,28 @@
class="org.hisp.dhis.coldchain.catalog.DefaultCatalogDataEntryService">
<property name="catalogTypeAttributeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService"/>
</bean>
+
+ <!-- for Display -->
+
+ <bean id="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService"
+ class="org.hisp.dhis.coldchain.inventory.DefaultInventoryType_AttributeService">
+ <property name="inventoryType_AttributeStore"
+ ref="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeStore" />
+ </bean>
+ <!--
+ <bean id="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeStore"
+ class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateInventoryType_AttributeStore">
+ <property name="clazz" value="org.hisp.dhis.coldchain.inventory.InventoryType_Attribute"/>
+ <property name="sessionFactory" ref="sessionFactory"/>
+ <property name="cacheable" value="true" />
+ </bean>
+ -->
+
+ <bean id="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeStore"
+ class="org.hisp.dhis.coldchain.inventory.hibernate.HibernateInventoryType_AttributeStore">
+ <property name="sessionFactory" ref="sessionFactory"/>
+ </bean>
+
<!-- CCEM Report Manager -->
<bean id="org.hisp.dhis.coldchain.reports.CCEMReportManager"
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml 2012-05-17 07:33:28 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml 2012-06-18 09:15:09 +0000
@@ -25,7 +25,13 @@
<many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid"
foreign-key="inventorytype_datasets_datasetid" />
</set>
+
+ <set name="inventoryType_Attributes" order-by="sort_order" >
+ <key column="inventorytypeid" foreign-key="fk_inventorytype_inventoryType_Attributes_inventorytypeid" />
+ <one-to-many class="org.hisp.dhis.coldchain.inventory.InventoryType_Attribute" />
+ </set>
+
<!--
<set name="inventoryTypeAttributes" table="inventorytype_attributes">
=== added file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType_Attribute.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType_Attribute.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType_Attribute.hbm.xml 2012-06-18 09:15:09 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.coldchain.inventory.InventoryType_Attribute" table="inventorytype_attribute_display">
+
+ <composite-id>
+ <key-many-to-one name="inventoryType" class="org.hisp.dhis.coldchain.inventory.InventoryType" column="inventorytypeid"
+ foreign-key="fk_inventorytype_attribute_display_inventorytypeid" />
+ <key-many-to-one name="inventoryTypeAttribute" class="org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute" column="inventorytypeattributeid"
+ foreign-key="fk_fk_inventorytype_attribute_display_inventorytypeattributeid" />
+ </composite-id>
+
+ <property name="display" column="display" not-null="true" />
+
+ <property name="sortOrder" column="sort_order" />
+
+ </class>
+</hibernate-mapping>
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java 2012-05-04 09:05:30 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java 2012-06-18 09:15:09 +0000
@@ -100,32 +100,34 @@
catalog = catalogService.getCatalog( id );
- catalogType = catalog.getCatalogType();
-
- //catalogTypeAttributes = catalogType.getCatalogTypeAttributes();
-
-
- catalogTypeAttributes = new ArrayList<CatalogTypeAttribute> ( catalogType.getCatalogTypeAttributes());
- Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
-
-
- List<CatalogDataValue> catalogDataValues = new ArrayList<CatalogDataValue>( catalogDataValueService.getAllCatalogDataValuesByCatalog( catalogService.getCatalog( id )) );
-
-
- for( CatalogDataValue catalogDataValue : catalogDataValues )
+ if ( catalog != null )
{
- if ( CatalogTypeAttribute.TYPE_COMBO.equalsIgnoreCase( catalogDataValue.getCatalogTypeAttribute().getValueType() ) )
- {
- catalogTypeAttributeValueMap.put( catalogDataValue.getCatalogTypeAttribute().getId(), catalogDataValue.getCatalogTypeAttributeOption().getName() );
- }
-
- else
- {
- catalogTypeAttributeValueMap.put( catalogDataValue.getCatalogTypeAttribute().getId(), catalogDataValue.getValue() );
+ catalogType = catalog.getCatalogType();
+
+ //catalogTypeAttributes = catalogType.getCatalogTypeAttributes();
+
+
+ catalogTypeAttributes = new ArrayList<CatalogTypeAttribute> ( catalogType.getCatalogTypeAttributes());
+ Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
+
+
+ List<CatalogDataValue> catalogDataValues = new ArrayList<CatalogDataValue>( catalogDataValueService.getAllCatalogDataValuesByCatalog( catalogService.getCatalog( id )) );
+
+
+ for( CatalogDataValue catalogDataValue : catalogDataValues )
+ {
+ if ( CatalogTypeAttribute.TYPE_COMBO.equalsIgnoreCase( catalogDataValue.getCatalogTypeAttribute().getValueType() ) )
+ {
+ catalogTypeAttributeValueMap.put( catalogDataValue.getCatalogTypeAttribute().getId(), catalogDataValue.getCatalogTypeAttributeOption().getName() );
+ }
+
+ else
+ {
+ catalogTypeAttributeValueMap.put( catalogDataValue.getCatalogTypeAttribute().getId(), catalogDataValue.getValue() );
+ }
}
}
-
-
+
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java 2012-05-15 10:33:46 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java 2012-06-18 09:15:09 +0000
@@ -82,6 +82,18 @@
{
return catalogs;
}
+
+ private int equipmentInstanceCatalogId;
+
+ public int getEquipmentInstanceCatalogId()
+ {
+ return equipmentInstanceCatalogId;
+ }
+
+
+
+
+
// -------------------------------------------------------------------------
// Action Implementation
@@ -89,6 +101,16 @@
public String execute() throws Exception
{
equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+ //System.out.println( equipmentInstance.getCatalog().getId() + "-----" + equipmentInstance.getCatalog().getName() );
+
+ if ( equipmentInstance.getCatalog() != null )
+ {
+ equipmentInstanceCatalogId = equipmentInstance.getCatalog().getId();
+ }
+ else
+ {
+ equipmentInstanceCatalogId = 0;
+ }
inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( equipmentInstance.getInventoryType().getInventoryTypeAttributes() );
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java 2012-05-16 07:06:15 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java 2012-06-18 09:15:09 +0000
@@ -1,21 +1,21 @@
package org.hisp.dhis.coldchain.equipment.action;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.hisp.dhis.coldchain.inventory.Equipment;
-import org.hisp.dhis.coldchain.inventory.EquipmentService;
import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.EquipmentService;
import org.hisp.dhis.coldchain.inventory.InventoryType;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
-import org.hisp.dhis.coldchain.inventory.comparator.InventoryTypeAttributeMandatoryComparator;
+import org.hisp.dhis.coldchain.inventory.InventoryType_Attribute;
+import org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.paging.ActionPagingSupport;
@@ -59,7 +59,14 @@
{
this.equipmentService = equipmentService;
}
-
+
+ private InventoryType_AttributeService inventoryType_AttributeService;
+
+ public void setInventoryType_AttributeService( InventoryType_AttributeService inventoryType_AttributeService )
+ {
+ this.inventoryType_AttributeService = inventoryType_AttributeService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -131,14 +138,23 @@
{
return equipmentDetailsMap;
}
-
+
+ /*
public List<InventoryTypeAttribute> inventoryTypeAttributeList;
public List<InventoryTypeAttribute> getInventoryTypeAttributeList()
{
return inventoryTypeAttributeList;
}
-
+ */
+
+ public List<InventoryType_Attribute> inventoryTypeAttributeList;
+
+ public List<InventoryType_Attribute> getInventoryTypeAttributeList()
+ {
+ return inventoryTypeAttributeList;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -174,8 +190,10 @@
{
//InventoryTypeAttribute tempInventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( Integer.parseInt( inventoryTypeAttributeId ) );
- inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryTypeService.getAllInventoryTypeAttributesForDisplay( inventoryType ));
+ //inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryTypeService.getAllInventoryTypeAttributesForDisplay( inventoryType ));
+ inventoryTypeAttributeList = new ArrayList<InventoryType_Attribute>( inventoryType_AttributeService.getAllInventoryTypeAttributeForDisplay( inventoryType, true ) );
+
/*
List<InventoryTypeAttribute> tempinventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() ) ;
@@ -197,12 +215,16 @@
if( inventoryTypeAttributeList == null || inventoryTypeAttributeList.size() == 0 )
{
- inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
- Collections.sort( inventoryTypeAttributeList, new InventoryTypeAttributeMandatoryComparator() );
+ //inventoryTypeAttributeList = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+
+ inventoryTypeAttributeList = new ArrayList<InventoryType_Attribute>( inventoryType_AttributeService.getAllInventoryTypeAttributesByInventoryType( inventoryType ) );
+
+ //Collections.sort( inventoryTypeAttributeList, new InventoryTypeAttributeMandatoryComparator() );
if( inventoryTypeAttributeList != null && inventoryTypeAttributeList.size() > 3 )
{
int count = 1;
- Iterator<InventoryTypeAttribute> iterator = inventoryTypeAttributeList.iterator();
+ //Iterator<InventoryTypeAttribute> iterator = inventoryTypeAttributeList.iterator();
+ Iterator<InventoryType_Attribute> iterator = inventoryTypeAttributeList.iterator();
while( iterator.hasNext() )
{
iterator.next();
@@ -218,17 +240,18 @@
for( EquipmentInstance equipmentInstance : equipmentInstanceList )
{
- for( InventoryTypeAttribute inventoryTypeAttribute1 : inventoryTypeAttributeList )
+ for( InventoryType_Attribute inventoryTypeAttribute1 : inventoryTypeAttributeList )
{
- Equipment equipmentDetails = equipmentService.getEquipment( equipmentInstance, inventoryTypeAttribute1 );
+ Equipment equipmentDetails = equipmentService.getEquipment( equipmentInstance, inventoryTypeAttribute1.getInventoryTypeAttribute() );
if( equipmentDetails != null && equipmentDetails.getValue() != null )
{
- equipmentDetailsMap.put( equipmentInstance.getId()+":"+inventoryTypeAttribute1.getId(), equipmentDetails.getValue() );
+ equipmentDetailsMap.put( equipmentInstance.getId()+":"+inventoryTypeAttribute1.getInventoryTypeAttribute().getId(), equipmentDetails.getValue() );
}
}
}
}
+
private void listAllEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
{
total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType );
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java 2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/AddInventoryTypeAction.java 2012-06-18 09:15:09 +0000
@@ -8,6 +8,8 @@
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType_Attribute;
+import org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService;
import com.opensymphony.xwork2.Action;
@@ -36,6 +38,12 @@
this.inventoryTypeAttributeService = inventoryTypeAttributeService;
}
+ private InventoryType_AttributeService inventoryType_AttributeService;
+
+ public void setInventoryType_AttributeService( InventoryType_AttributeService inventoryType_AttributeService )
+ {
+ this.inventoryType_AttributeService = inventoryType_AttributeService;
+ }
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -67,12 +75,28 @@
this.tracking = tracking;
}
+ /*
private List<Integer> selectedInventoryTypeAttributeList = new ArrayList<Integer>();
public void setSelectedInventoryTypeAttributeList( List<Integer> selectedInventoryTypeAttributeList )
{
this.selectedInventoryTypeAttributeList = selectedInventoryTypeAttributeList;
}
+ */
+
+ private List<Integer> selectedInventoryTypeAttributeValidator = new ArrayList<Integer>();
+
+ public void setSelectedInventoryTypeAttributeValidator( List<Integer> selectedInventoryTypeAttributeValidator )
+ {
+ this.selectedInventoryTypeAttributeValidator = selectedInventoryTypeAttributeValidator;
+ }
+
+ private List<Boolean> display = new ArrayList<Boolean>();
+
+ public void setDisplay( List<Boolean> display )
+ {
+ this.display = display;
+ }
// -------------------------------------------------------------------------
@@ -95,20 +119,16 @@
List<InventoryTypeAttribute> inventoryTypeSet = new ArrayList<InventoryTypeAttribute>();
- if ( selectedInventoryTypeAttributeList != null && selectedInventoryTypeAttributeList.size() > 0 )
+ if ( selectedInventoryTypeAttributeValidator != null && selectedInventoryTypeAttributeValidator.size() > 0 )
{
- for ( int i = 0; i < this.selectedInventoryTypeAttributeList.size(); i++ )
+ for ( int i = 0; i < this.selectedInventoryTypeAttributeValidator.size(); i++ )
{
- InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) );
- /*
- System.out.println( "ID---" + inventoryTypeAttribute.getId() );
- System.out.println( "Name---" + inventoryTypeAttribute.getName());
- System.out.println( "ValueType---" + inventoryTypeAttribute.getValueType() );
- */
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeValidator.get( i ) );
+
inventoryTypeSet.add( inventoryTypeAttribute );
- //inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) ) );
+ //inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) ) );
}
/*
for( Integer inventoryTypeAttId : selectedInventoryTypeAttributeList )
@@ -122,6 +142,27 @@
inventoryTypeService.addInventoryType( inventoryType );
+
+ if ( selectedInventoryTypeAttributeValidator != null && selectedInventoryTypeAttributeValidator.size() > 0 )
+ {
+ for ( int i = 0; i < this.selectedInventoryTypeAttributeValidator.size(); i++ )
+ {
+
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeValidator.get( i ) );
+
+ InventoryType_Attribute inventoryType_Attribute = new InventoryType_Attribute( inventoryType, inventoryTypeAttribute, this.display.get( i ), new Integer( i ) );
+
+ /*
+ System.out.println( "ID---" + inventoryType_Attribute.getInventoryTypeAttribute().getId() );
+ System.out.println( "Name---" + inventoryType_Attribute.getInventoryTypeAttribute().getName());
+ System.out.println( "ValueType---" + inventoryType_Attribute.getInventoryTypeAttribute().getValueType() );
+ System.out.println( "Sort Order---" + inventoryType_Attribute.getSortOrder() );
+ System.out.println( "Display---" + inventoryType_Attribute.isDisplay());
+ */
+ inventoryType_AttributeService.addInventoryType_Attribute( inventoryType_Attribute );
+ }
+ }
+
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java 2012-05-01 06:15:42 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowUpdateInventoryTypeAction.java 2012-06-18 09:15:09 +0000
@@ -9,6 +9,7 @@
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType_Attribute;
import com.opensymphony.xwork2.Action;
@@ -61,13 +62,20 @@
return availInventoryTypeAttributes;
}
+ private List<InventoryType_Attribute> selInventoryTypeAttributes;
+
+ public List<InventoryType_Attribute> getSelInventoryTypeAttributes()
+ {
+ return selInventoryTypeAttributes;
+ }
+ /*
private List<InventoryTypeAttribute> selInventoryTypeAttributes;
public List<InventoryTypeAttribute> getSelInventoryTypeAttributes()
{
return selInventoryTypeAttributes;
}
-
+ */
private List<CatalogType> catalogTypes;
public List<CatalogType> getCatalogTypes()
@@ -86,10 +94,23 @@
availInventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryTypeAttributeService.getAllInventoryTypeAttributes() );
+ selInventoryTypeAttributes = new ArrayList<InventoryType_Attribute>( inventoryType.getInventoryType_Attributes() );
+ /*
+ for( InventoryType_Attribute inventoryType_Attribute : selInventoryTypeAttributes )
+ {
+ System.out.println( "ID---" + inventoryType_Attribute.getInventoryTypeAttribute().getId() );
+ System.out.println( "Name---" + inventoryType_Attribute.getInventoryTypeAttribute().getName());
+ System.out.println( "ValueType---" + inventoryType_Attribute.getInventoryTypeAttribute().getValueType() );
+ System.out.println( "Sort Order---" + inventoryType_Attribute.getSortOrder() );
+ System.out.println( "Display---" + inventoryType_Attribute.isDisplay());
+ }
+ */
+
+ /*
selInventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
availInventoryTypeAttributes.removeAll( selInventoryTypeAttributes );
-
+ */
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 2012-05-17 07:33:28 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 2012-06-18 09:15:09 +0000
@@ -1,13 +1,17 @@
package org.hisp.dhis.coldchain.inventory.action;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
import org.hisp.dhis.coldchain.inventory.InventoryType;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.coldchain.inventory.InventoryType_Attribute;
+import org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService;
import com.opensymphony.xwork2.Action;
@@ -36,7 +40,15 @@
{
this.inventoryTypeAttributeService = inventoryTypeAttributeService;
}
-
+
+ private InventoryType_AttributeService inventoryType_AttributeService;
+
+ public void setInventoryType_AttributeService( InventoryType_AttributeService inventoryType_AttributeService )
+ {
+ this.inventoryType_AttributeService = inventoryType_AttributeService;
+ }
+
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -74,15 +86,29 @@
{
this.tracking = tracking;
}
-
+ /*
private List<Integer> selectedInventoryTypeAttributeList;
public void setSelectedInventoryTypeAttributeList( List<Integer> selectedInventoryTypeAttributeList )
{
this.selectedInventoryTypeAttributeList = selectedInventoryTypeAttributeList;
}
-
-
+ */
+
+ private List<Integer> selectedInventoryTypeAttributeValidator = new ArrayList<Integer>();
+
+ public void setSelectedInventoryTypeAttributeValidator( List<Integer> selectedInventoryTypeAttributeValidator )
+ {
+ this.selectedInventoryTypeAttributeValidator = selectedInventoryTypeAttributeValidator;
+ }
+
+ private List<Boolean> display = new ArrayList<Boolean>();
+
+ public void setDisplay( List<Boolean> display )
+ {
+ this.display = display;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -108,12 +134,12 @@
List<InventoryTypeAttribute> inventoryTypeList = new ArrayList<InventoryTypeAttribute>( );
- if ( selectedInventoryTypeAttributeList != null && selectedInventoryTypeAttributeList.size() > 0 )
+ if ( selectedInventoryTypeAttributeValidator != null && selectedInventoryTypeAttributeValidator.size() > 0 )
{
- for ( int i = 0; i < this.selectedInventoryTypeAttributeList.size(); i++ )
+ for ( int i = 0; i < this.selectedInventoryTypeAttributeValidator.size(); i++ )
{
- InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) );
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeValidator.get( i ) );
/*
System.out.println( "ID---" + inventoryTypeAttribute.getId() );
System.out.println( "Name---" + inventoryTypeAttribute.getName());
@@ -130,9 +156,47 @@
}
*/
}
+
inventoryType.setInventoryTypeAttributes( inventoryTypeList );
inventoryTypeService.updateInventoryType( inventoryType );
+ // for InventoryType_Attribute
+
+ Set<InventoryType_Attribute> inventoryType_Attributes = new HashSet<InventoryType_Attribute>( inventoryType.getInventoryType_Attributes());
+
+ for ( int i = 0; i < this.selectedInventoryTypeAttributeValidator.size(); i++ )
+ {
+ InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeValidator.get( i ) );
+
+
+
+ InventoryType_Attribute inventoryType_Attribute = inventoryType_AttributeService.getInventoryTypeAttribute( inventoryType, inventoryTypeAttribute );
+
+
+ if ( inventoryType_Attribute == null )
+ {
+
+ inventoryType_Attribute = new InventoryType_Attribute( inventoryType, inventoryTypeAttribute, this.display.get( i ), new Integer( i ) );
+ inventoryType_AttributeService.addInventoryType_Attribute( inventoryType_Attribute );
+ }
+ else
+ {
+ inventoryType_Attribute.setDisplay( this.display.get( i ) );
+
+ inventoryType_Attribute.setSortOrder( new Integer( i ) );
+
+
+ inventoryType_AttributeService.updateInventoryType_Attribute( inventoryType_Attribute );
+
+ inventoryType_Attributes.remove( inventoryType_Attribute );
+ }
+ }
+
+ for ( InventoryType_Attribute inventoryType_AttributeDelete : inventoryType_Attributes )
+ {
+ inventoryType_AttributeService.deleteInventoryType_Attribute( inventoryType_AttributeDelete );
+ }
+
return SUCCESS;
}
}
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-06-14 05:58:42 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-06-18 09:15:09 +0000
@@ -376,17 +376,20 @@
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
<property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
</bean>
+
<bean id="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAction"
class="org.hisp.dhis.coldchain.inventory.action.ValidateInventoryTypeAction"
scope="prototype">
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
</bean>
+
<bean id="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAction"
class="org.hisp.dhis.coldchain.inventory.action.AddInventoryTypeAction"
scope="prototype">
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
<property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="inventoryType_AttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService" />
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAction"
class="org.hisp.dhis.coldchain.inventory.action.ShowUpdateInventoryTypeAction"
@@ -401,6 +404,7 @@
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
<property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+ <property name="inventoryType_AttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService" />
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction"
class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction"
@@ -458,6 +462,7 @@
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
<property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
<property name="equipmentService" ref="org.hisp.dhis.coldchain.inventory.EquipmentService" />
+ <property name="inventoryType_AttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryType_AttributeService" />
</bean>
<bean id="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
class="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm 2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addInventoryTypeForm.vm 2012-06-18 09:15:09 +0000
@@ -53,34 +53,68 @@
<br/>
<table id="inventoryTypeMembersArea">
- <col style="width: 450px"/>
- <col/>
- <col style="width: 450px"/>
+
<thead>
<tr>
<th>$i18n.getString( "available_inventorytype_attributes" )</th>
<th>$i18n.getString( "filter" )</th>
- <th>$i18n.getString( "selected_inventorytype_attributes" )</th>
+ <th>$i18n.getString( "selected_inventorytype_attributes" )
+ <select id="selectedInventoryTypeAttributeValidator" name='selectedInventoryTypeAttributeValidator' multiple="multiple" class="hidden" ></select>
+ <select id="display" name='display' multiple="multiple" class="hidden"></select>
+ </th>
</tr>
</thead>
<tbody>
<tr>
<td>
- <select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select>
+ <select size="15" id="availableInventoryTypeAttributeList" name='availableInventoryTypeAttributeList' multiple="multiple" ondblclick="selectInventoryTypeAttributes()"></select>
+ <!--<select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select>-->
</td>
+
+
+ <td style="text-align:center">
+ <input type="button" value=">" class='filterButton' onclick="selectInventoryTypeAttributes();"/><br/>
+ <input type="button" value="<" class='filterButton' onclick="unSelectInventoryTypeAttributes();"/><br/>
+ <input type="button" value=">>" class='filterButton' onclick="selectAllInventoryTypeAttributes();"/><br/>
+ <input type="button" value="<<" class='filterButton' onclick="unSelectAllInventoryTypeAttributes();"/>
+ </td>
+ <!--
<td>
<input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableInventoryTypeAttributeList' );"/><br/>
<input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedInventoryTypeAttributeList' );"/><br/>
<input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableInventoryTypeAttributeList' );"/><br/>
<input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedInventoryTypeAttributeList' );"/>
- </td>
+ </td>
+ -->
+ <td>
+ <div class="inventoryTypeAttributeDiv">
+ <table>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "dataelement" )</th>
+ <th width="20px">$i18n.getString( "display" )</th>
+ </thead>
+ <tbody id="selectedInventoryTypeAttributeList"></tbody>
+ </table>
+ </div>
+ </td>
+
+ <!--
<td>
<select id="selectedInventoryTypeAttributeList" name="selectedInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%" ondblclick="moveSelectedById( 'selectedInventoryTypeAttributeList', 'availableInventoryTypeAttributeList' )"></select>
</td>
+ -->
+ <!--
<td>
<a href="javascript:moveUpSelectedOption( 'selectedInventoryTypeAttributeList' )"><img src="../images/move_up.png"/></a><br/><br/>
<a href="javascript:moveDownSelectedOption( 'selectedInventoryTypeAttributeList' )"><img src="../images/move_down.png"/></a><br/><br/>
- </td>
+ </td>
+ -->
+
+ <td>
+ <a href="javascript:moveUpInventoryTypeAttribute()"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownInventoryTypeAttribute()"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
</tr>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogDetails.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogDetails.vm 2012-04-30 11:24:11 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogDetails.vm 2012-06-18 09:15:09 +0000
@@ -1,3 +1,7 @@
+
+<table>
+<tr>
+<td>
<table>
<tr>
<td>
@@ -34,7 +38,8 @@
</td>
<td>
#if($catalogTypeAttribute.valueType=="YES/NO")
- $i18n.getString( $!catalogTypeAttributeValueMap.get( $catalogTypeAttribute.id ) )
+ ##$i18n.getString( $!catalogTypeAttributeValueMap.get( $catalogTypeAttribute.id ) )
+ $!catalogTypeAttributeValueMap.get( $catalogTypeAttribute.id )
#else
$!catalogTypeAttributeValueMap.get( $catalogTypeAttribute.id )
#end
@@ -44,4 +49,11 @@
#end
<tr><td> </td></tr>
+</table>
+</td>
+<td> </td>
+<td>
+ <img src="showImage.action?id=$catalog.id" style="width:200px;height:200px;">
+</td>
+</tr>
</table>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css 2012-04-25 05:52:37 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/css/basic.css 2012-06-18 09:15:09 +0000
@@ -28,7 +28,7 @@
input.filterButton
{
- width: 30px;
+ width: 50px;
padding-left:5px;
padding-right:5px;
text-align:center;
@@ -63,6 +63,11 @@
cursor:pointer;
}
+#selectedInventoryTypeAttributeList tr{
+cursor:pointer;
+}
+
+
.dataElementDiv
{
overflow:auto;
@@ -98,4 +103,16 @@
.catalogTypeAttributeDiv table
{
width:100%;
+}
+
+.inventoryTypeAttributeDiv
+{
+ overflow:auto;
+ height:20em;
+ width:30em;
+ border:1px solid #9DA1AA;
+}
+.inventoryTypeAttributeDiv table
+{
+ width:100%;
}
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-05-19 14:42:20 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-06-18 09:15:09 +0000
@@ -29,7 +29,8 @@
#set($equipmetnInstanceName = "" )
#foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
<col/>
- #set( $equipmetnInstanceName = $equipmetnInstanceName + " - " + $inventoryTypeAttribute.name )
+ ##set( $equipmetnInstanceName = $equipmetnInstanceName + " - " + $inventoryTypeAttribute.name )
+ #set( $equipmetnInstanceName = $equipmetnInstanceName + " - " + $inventoryTypeAttribute.inventoryTypeAttribute.name )
#end
<col width="200"/>
@@ -37,7 +38,8 @@
<tr>
<th>#</th>
#foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
- <th>$inventoryTypeAttribute.name</th>
+ <!--<th>$inventoryTypeAttribute.name</th>-->
+ <th>$inventoryTypeAttribute.inventoryTypeAttribute.name</th>
#end
<th style="text-align:center" class="{sorter: false}">$i18n.getString( "operations" )</th>
@@ -55,7 +57,8 @@
</td>
#foreach( $inventoryTypeAttribute in $inventoryTypeAttributeList )
- #set( $mapId = $equipmentInstance.id + ':' + $inventoryTypeAttribute.id )
+ ##set( $mapId = $equipmentInstance.id + ':' + $inventoryTypeAttribute.id )
+ #set( $mapId = $equipmentInstance.id + ':' + $inventoryTypeAttribute.inventoryTypeAttribute.id )
##set( $equipmetnInstanceName = '' + $inventoryTypeAttribute.name )
<td>$!equipmentDetailsMap.get( $mapId )</td>
#end
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js 2012-05-02 06:03:10 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addInventoryTypeForm.js 2012-06-18 09:15:09 +0000
@@ -1,4 +1,46 @@
+jQuery( document ).ready( function()
+ {
+ validation( 'addInventoryTypeForm', function( form ){
+ form.submit();
+ }, function(){
+
+ //$("#selectedInventoryTypeAttributeList").find("option").attr("selected", "selected");
+ var selectedInventoryTypeAttributeValidator = jQuery( "#selectedInventoryTypeAttributeValidator" );
+ selectedInventoryTypeAttributeValidator.empty();
+
+ var display = jQuery( "#display" );
+ display.empty();
+
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+
+ selectedInventoryTypeAttributeValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+
+ var forDisplay = jQuery( item ).find( "input[name='forDisplay']:first");
+ var checked = forDisplay.attr('checked') ? true : false;
+ display.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+
+ });
+ });
+
+ jQuery("#availableInventoryTypeAttributeList").dhisAjaxSelect({
+ source: "inventoryTypeAttributes.action",
+ iterator: "inventoryTypeAttributes",
+ connectedTo: 'selectedInventoryTypeAttributeValidator',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+
+ checkValueIsExist("name", "validateInventoryType.action");
+ });
+
+
+/*
jQuery(document).ready(function() {
validation2('addInventoryTypeForm', function(form) {
form.submit();
@@ -24,4 +66,4 @@
checkValueIsExist("name", "validateInventoryType.action");
});
-
+*/
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js 2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/inventoryType.js 2012-06-18 09:15:09 +0000
@@ -74,3 +74,126 @@
}
}
}
+
+
+//-----------------------------------------------------------------------------
+//select unselect InventoryTypeAttribute
+//-----------------------------------------------------------------------------
+
+function selectInventoryTypeAttributes()
+{
+ var selectedInventoryTypeAttributeList = jQuery("#selectedInventoryTypeAttributeList");
+ jQuery("#availableInventoryTypeAttributeList").children().each(function(i, item){
+ if( item.selected ){
+ html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectInventoryTypeAttribute( this )'><td onclick='select(this)'>" + item.text + "</td>";
+ html += "<td align='center'><input type='checkbox' name='forDisplay' value='" + item.value + "'></td>";
+ html += "</tr>";
+ selectedInventoryTypeAttributeList.append( html );
+ jQuery( item ).remove();
+ }
+ });
+}
+
+
+function unSelectInventoryTypeAttributes()
+{
+ var availableInventoryTypeAttributeList = jQuery("#availableInventoryTypeAttributeList");
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+ item = jQuery(item);
+ if( item.hasClass("selected") )
+ {
+ availableInventoryTypeAttributeList.append( "<option value='" + item.attr( "id" ) + "' selected='true'>" + item.find("td:first").text() + "</option>" );
+ item.remove();
+ }
+ });
+}
+
+
+function selectAllInventoryTypeAttributes()
+{
+ var selectedInventoryTypeAttributeList = jQuery("#selectedInventoryTypeAttributeList");
+ jQuery("#availableInventoryTypeAttributeList").children().each(function(i, item){
+ html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectInventoryTypeAttribute( this )'><td onclick='select(this)'>" + item.text + "</td>";
+ html += "<td align='center'><input type='checkbox' name='forDisplay' value='" + item.value + "'></td>";
+ html += "</tr>";
+ selectedInventoryTypeAttributeList.append( html );
+ jQuery( item ).remove();
+ });
+}
+
+
+function unSelectAllInventoryTypeAttributes()
+{
+ var availableInventoryTypeAttributeList = jQuery("#availableInventoryTypeAttributeList");
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+ item = jQuery(item);
+ availableInventoryTypeAttributeList.append( "<option value='" + item.attr( "id" ) + "' selected='true'>" + item.find("td:first").text() + "</option>" );
+ item.remove();
+ });
+}
+
+
+
+function unSelectInventoryTypeAttribute( element )
+{
+ element = jQuery(element);
+ jQuery("#availableInventoryTypeAttributeList").append( "<option value='" + element.attr( "id" ) + "' selected='true'>" + element.find("td:first").text() + "</option>" );
+ element.remove();
+}
+
+
+function select( element )
+{
+ element = jQuery( element ).parent();
+ if( element.hasClass( 'selected') ) element.removeClass( 'selected' );
+ else element.addClass( 'selected' );
+}
+//-----------------------------------------------------------------------------
+//Move Table Row Up and Down
+//-----------------------------------------------------------------------------
+
+
+function moveUpInventoryTypeAttribute()
+{
+ var selectedList = jQuery("#selectedInventoryTypeAttributeList");
+
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+ item = jQuery(item);
+ if( item.hasClass("selected") )
+ {
+ var prev = item.prev('#selectedInventoryTypeAttributeList tr');
+ if (prev.length == 1)
+ {
+ prev.before(item);
+ }
+ }
+ });
+}
+
+function moveDownInventoryTypeAttribute()
+{
+ var selectedList = jQuery("#selectedInventoryTypeAttributeList");
+ var items = new Array();
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+ items.push(jQuery(item));
+ });
+
+ for( var i=items.length-1;i>=0;i--)
+ {
+ var item = items[i];
+ if( item.hasClass("selected") )
+ {
+ var next = item.next('#selectedInventoryTypeAttributeList tr');
+ if (next.length == 1)
+ {
+ next.after(item);
+ }
+ }
+ }
+}
+
+
+
+
+
+
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js 2012-05-02 06:03:10 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeForm.js 2012-06-18 09:15:09 +0000
@@ -1,3 +1,55 @@
+jQuery( document ).ready( function()
+{
+ validation( 'updateInventoryTypeForm', function( form ){
+ form.submit() ;
+ }, function(){
+ var selectedInventoryTypeAttributeValidator = jQuery( "#selectedInventoryTypeAttributeValidator" );
+ selectedInventoryTypeAttributeValidator.empty();
+
+ var display = jQuery( "#display" );
+ display.empty();
+
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( i, item ){
+
+ selectedInventoryTypeAttributeValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+
+ var forDisplay = jQuery( item ).find( "input[name='forDisplay']:first");
+ var checked = forDisplay.attr('checked') ? true : false;
+ display.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+
+ });
+ });
+
+ checkValueIsExist( "name", "validateInventoryType.action", {id:getFieldValue('id')});
+
+ jQuery("#availableInventoryTypeAttributeList").dhisAjaxSelect({
+ source: "inventoryTypeAttributes.action",
+ iterator: "inventoryTypeAttributes",
+ connectedTo: 'selectedInventoryTypeAttributeValidator',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ var flag = false;
+ jQuery("#selectedInventoryTypeAttributeList").find("tr").each( function( k, selectedItem ){
+ if(selectedItem.id == item.id )
+ {
+ flag = true;
+ return;
+ }
+ });
+
+ if(!flag) return option;
+ }
+ });
+});
+
+
+
+
+/*
+
jQuery(document).ready(function() {
validation2('updateInventoryTypeForm', function(form) {
form.submit();
@@ -26,3 +78,4 @@
});
+*/
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm 2012-05-30 10:46:26 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm 2012-06-18 09:15:09 +0000
@@ -18,7 +18,7 @@
<input type="hidden" id="catalogTypeID" name="id" value="$catalog.catalogType.id">
</div>
<table>
-<td>
+<tr>
<td>
<table>
<!--<tr>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm 2012-06-13 06:35:38 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm 2012-06-18 09:15:09 +0000
@@ -12,7 +12,8 @@
<script>
jQuery(document).ready( function(){
-
+
+
currentDiv = 'equipmentForm';
isSubmit = true;
@@ -47,7 +48,7 @@
<tr>
<td>$i18n.getString( "catalog" ) : </td>
<td>
- <select id="catalog" name="catalog" onChange="catalogDetails( this.value );" >
+ <select id="catalog" name="catalog" onChange="catalogDetails( this.value );" >
<option value="">[$i18n.getString( "please_select" )]</option>
#foreach ($catalog in $catalogs )
<option value="$catalog.id" #if($equipmentInstance.catalog.id == $catalog.id) selected="selected" #end>$catalog.name</option>
@@ -86,7 +87,7 @@
<select id="attr$attribute.id" name="attr$attribute.id" onChange="catalogDetails( this.value );" class='#validate( "default" $attribute.mandatory )'>
<option value="">[$i18n.getString( "please_select" )]</option>
#foreach ($catalog in $catalogs )
- <option value="$catalog.id" #if($attributeValue == $catalog.name) selected="selected" #end>$catalog.name</option>
+ <option value="$catalog.id" #if($attributeValue == $catalog.name) selected="selected" #end>$catalog.name</option>
#end
</select>
#else
@@ -105,6 +106,15 @@
</form>
<div id="detailsCatalogInfo"></div>
<script>
+
+
+ var catalogDetailId = $equipmentInstanceCatalogId;
+ if ( catalogDetailId != 0 )
+ {
+ catalogDetails( catalogDetailId );
+ }
+
+
var i18n_error_connect_to_server = '$encoder.jsEscape( $i18n.getString( "error_connect_to_server" ) , "'" )';
var i18n_add_equipment_successfully = '$encoder.jsEscape( $i18n.getString( "updated_equipment_successfully" ) , "'" )';
</script>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm 2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateInventoryTypeForm.vm 2012-06-18 09:15:09 +0000
@@ -53,27 +53,39 @@
<br/>
- <table id="dataElementSelectionArea">
- <col style="width: 450px"/>
- <col/>
- <col style="width: 450px"/>
+ <table id="inventoryTypeMembersArea">
+
<thead>
<tr>
<th>$i18n.getString( "available_inventorytype_attributes" )</th>
<th>$i18n.getString( "filter" )</th>
- <th>$i18n.getString( "selected_inventorytype_attributes" )</th>
+ <th>$i18n.getString( "selected_inventorytype_attributes" )
+ <select id="selectedInventoryTypeAttributeValidator" name='selectedInventoryTypeAttributeValidator' multiple="multiple" class="hidden" ></select>
+ <select id="display" name='display' multiple="multiple" class="hidden"></select>
+ </th>
</tr>
</thead>
<tbody>
<tr>
<td>
- <select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select> </td>
- <td>
+ <!--<select id="availableInventoryTypeAttributeList" name="availableInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableInventoryTypeAttributeList', 'selectedInventoryTypeAttributeList' )"></select>-->
+ <select size="15" id="availableInventoryTypeAttributeList" name='availableInventoryTypeAttributeList' multiple="multiple" ondblclick="selectInventoryTypeAttributes()"></select>
+ </td>
+ <!-- <td>
<input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableInventoryTypeAttributeList' );"/><br/>
<input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedInventoryTypeAttributeList' );"/><br/>
<input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableInventoryTypeAttributeList' );"/><br/>
<input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedInventoryTypeAttributeList' );"/>
- </td>
+ </td>-->
+ <td style="text-align:center">
+ <input type="button" value=">" class='filterButton' onclick="selectInventoryTypeAttributes();"/><br/>
+ <input type="button" value="<" class='filterButton' onclick="unSelectInventoryTypeAttributes();"/><br/>
+ <input type="button" value=">>" class='filterButton' onclick="selectAllInventoryTypeAttributes();"/><br/>
+ <input type="button" value="<<" class='filterButton' onclick="unSelectAllInventoryTypeAttributes();"/>
+ </td>
+
+
+ <!--
<td>
<select id="selectedInventoryTypeAttributeList" name="selectedInventoryTypeAttributeList" multiple="multiple" style="height: 200px; width: 100%" ondblclick="moveSelectedById( 'selectedInventoryTypeAttributeList', 'availableInventoryTypeAttributeList' )">
#foreach( $inventoryTypeAttribute in $selInventoryTypeAttributes )
@@ -81,11 +93,37 @@
#end
</select>
</td>
+ -->
+
+ <td>
+ <div class="inventoryTypeAttributeDiv">
+ <table>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "dataelement" )</th>
+ <th width="20px">$i18n.getString( "display" )</th>
+ </thead>
+ <tbody id="selectedInventoryTypeAttributeList">
+ #foreach( $inventoryTypeAttribute in $selInventoryTypeAttributes )
+ <tr ondblclick="unSelectInventoryTypeAttribute( this )" id="$inventoryTypeAttribute.inventoryTypeAttribute.id">
+ <td onclick="select(this)">$encoder.htmlEncode( $inventoryTypeAttribute.inventoryTypeAttribute.name )</td>
+ <td align="center"><input type="checkbox" name="forDisplay" value="$inventoryTypeAttribute.inventoryTypeAttribute.id" #if($inventoryTypeAttribute.display == true ) checked #end /></td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </div>
+ </td>
+ <!--
<td>
<a href="javascript:moveUpSelectedOption( 'selectedInventoryTypeAttributeList' )"><img src="../images/move_up.png"/></a><br/><br/>
<a href="javascript:moveDownSelectedOption( 'selectedInventoryTypeAttributeList' )"><img src="../images/move_down.png"/></a><br/><br/>
</td>
-
+ -->
+ <td>
+ <a href="javascript:moveUpInventoryTypeAttribute()"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownInventoryTypeAttribute()"><img src="../images/move_down.png"/></a><br/><br/>
+ </td>
</tr>
<tr>
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2012-04-04 11:58:27 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/activeplan/action/ActivePlanReportsResultAction.java 2012-06-18 09:15:09 +0000
@@ -891,8 +891,8 @@
// OrgUnit Related Info
selectedOrgUnit = organisationUnitService.getOrganisationUnit( ouIDTB );
- Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>( patientService.getPatients( selectedOrgUnit ) );
-
+ // Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>( patientService.getPatients( selectedOrgUnit ) );
+ Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>( patientService.getPatients( selectedOrgUnit, null, null ) );
// Getting Programs
Program curProgram = programService.getProgram( Integer.parseInt( reportProgramTB ) );
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2012-02-02 09:56:51 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/benificiaryinfo/action/BenificiaryInfoReportsResultAction.java 2012-06-18 09:15:09 +0000
@@ -422,8 +422,8 @@
List<Patient> patientListByOuProgram = new ArrayList<Patient>();
List<Patient> patientListByOu = new ArrayList<Patient>();
- patientListByOu.addAll( patientService.getPatients( ou ) );
-
+ //patientListByOu.addAll( patientService.getPatients( ou ) );
+ patientListByOu.addAll( patientService.getPatients( ou, null, null ) );
Iterator<Patient> patientIterator = patientListByOu.iterator();
while ( patientIterator.hasNext() )
{
=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2012-06-01 10:13:48 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/portal/action/PortalReportsResultAction.java 2012-06-18 09:15:09 +0000
@@ -608,8 +608,8 @@
for ( OrganisationUnit ou : orgUnitList )
{
Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>();
- patientListByOrgUnit.addAll( patientService.getPatients( ou ) );
-
+ //patientListByOrgUnit.addAll( patientService.getPatients( ou ) );
+ patientListByOrgUnit.addAll( patientService.getPatients( ou, null, null ) );
Iterator<Patient> patientIterator = patientListByOrgUnit.iterator();
while ( patientIterator.hasNext() )
{
@@ -1327,7 +1327,8 @@
for ( OrganisationUnit ou : orgUnitList )
{
Collection<Patient> patientListByOrgUnit = new ArrayList<Patient>();
- patientListByOrgUnit.addAll( patientService.getPatients( ou ) );
+ //patientListByOrgUnit.addAll( patientService.getPatients( ou ) );
+ patientListByOrgUnit.addAll( patientService.getPatients( ou, null, null ) );
Iterator<Patient> patientIterator = patientListByOrgUnit.iterator();
// <editor-fold defaultstate="collapsed" desc="while patientIterator">
@@ -1345,7 +1346,7 @@
//System.out.println("_________________________________id = "+patient.getId() + " ou = "+ou.getName());
Collection<ProgramStageInstance> programStageInstances = new ArrayList<ProgramStageInstance>();
Collection<ProgramStageInstance> allProgramStageInstances = new ArrayList<ProgramStageInstance>();
- Iterator itr1 = programStagesList.iterator();
+ Iterator<ProgramStage> itr1 = programStagesList.iterator();
while ( itr1.hasNext() )
{
ProgramStage PSName = ( ProgramStage ) itr1.next();