dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17274
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6811: CCEM - workinprogress; fixed verion for india modules
------------------------------------------------------------
revno: 6811
committer: Bharath <chbharathk@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-30 14:00:00 +0530
message:
CCEM - workinprogress; fixed verion for india modules
added:
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/ShowEquipmentStatusFormAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentStatusAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm
modified:
local/in/dhis-in-api/pom.xml
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatus.java
local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDetailsStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.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-configuration/pom.xml
local/in/dhis-in-services/dhis-in-service-dataentrystatus/pom.xml
local/in/dhis-in-services/dhis-in-service-dbmanager/pom.xml
local/in/dhis-in-services/dhis-in-service-linelisting/pom.xml
local/in/dhis-in-services/dhis-in-service-reports/pom.xml
local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml
local/in/dhis-in-services/dhis-in-service-survey/pom.xml
local/in/dhis-in-services/pom.xml
local/in/dhis-mobile/dhis-service-mobile/pom.xml
local/in/dhis-mobile/dhis-web-mobile/pom.xml
local/in/dhis-mobile/pom.xml
local/in/dhis-web-alert/pom.xml
local/in/dhis-web-coldchain/pom.xml
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/resources/struts.xml
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm
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/equipment.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm
local/in/dhis-web-dashboard/pom.xml
local/in/dhis-web-dataentry-linelisting/pom.xml
local/in/dhis-web-excelimport/pom.xml
local/in/dhis-web-leprosy/pom.xml
local/in/dhis-web-linelisting-in/pom.xml
local/in/dhis-web-maintenance-in/pom.xml
local/in/dhis-web-reports-in/pom.xml
local/in/dhis-web-reports-national/pom.xml
local/in/dhis-web-sandbox/pom.xml
local/in/dhis-web-sandboxbk/pom.xml
local/in/dhis-web-survey/pom.xml
local/in/dhis-web-validationrule-in/pom.xml
local/in/pom.xml
--
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/pom.xml'
--- local/in/dhis-in-api/pom.xml 2012-04-04 05:46:52 +0000
+++ local/in/dhis-in-api/pom.xml 2012-04-30 08:30:00 +0000
@@ -4,7 +4,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-api</artifactId>
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsService.java 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
{
String ID = EquipmentDetailsService.class.getName();
- int addEquipmentDetails( EquipmentDetails equipmentDetails );
+ void addEquipmentDetails( EquipmentDetails equipmentDetails );
void updateEquipmentDetails( EquipmentDetails equipmentDetails );
@@ -14,4 +14,7 @@
Collection<EquipmentDetails> getAllEquipmentDetails();
+ Collection<EquipmentDetails> getEquipmentDetails( EquipmentInstance equipmentInstance);
+
+ EquipmentDetails getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentDetailsStore.java 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
{
String ID = EquipmentDetailsStore.class.getName();
- int addEquipmentDetails( EquipmentDetails equipmentDetails );
+ void addEquipmentDetails( EquipmentDetails equipmentDetails );
void updateEquipmentDetails( EquipmentDetails equipmentDetails );
@@ -14,4 +14,8 @@
Collection<EquipmentDetails> getAllEquipmentDetails();
+ Collection<EquipmentDetails> getEquipmentDetails( EquipmentInstance equipmentInstance);
+
+ EquipmentDetails getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute );
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java 2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceService.java 2012-04-30 08:30:00 +0000
@@ -17,6 +17,8 @@
int createEquipment( EquipmentInstance equipmentInstance, List<EquipmentDetails> equipmentDetails );
+ EquipmentInstance getEquipmentInstance( int id );
+
Collection<EquipmentInstance> getAllEquipmentInstance();
Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType );
@@ -26,4 +28,6 @@
int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType );
Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max );
+
+ int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java 2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentInstanceStore.java 2012-04-30 08:30:00 +0000
@@ -9,13 +9,13 @@
{
String ID = EquipmentInstanceStore.class.getName();
- int addEquipmentInstance( EquipmentInstance equipmentInstance );
-
- void updateEquipmentInstance( EquipmentInstance equipmentInstance );
-
- void deleteEquipmentInstance( EquipmentInstance equipmentInstance );
-
- Collection<EquipmentInstance> getAllEquipmentInstance();
+ //int addEquipmentInstance( EquipmentInstance equipmentInstance );
+
+ //void updateEquipmentInstance( EquipmentInstance equipmentInstance );
+
+ //void deleteEquipmentInstance( EquipmentInstance equipmentInstance );
+
+ //Collection<EquipmentInstance> getAllEquipmentInstance();
Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit );
@@ -24,6 +24,7 @@
int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType );
Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max );
-
+
+ int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText );
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatus.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatus.java 2012-04-17 12:28:23 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/EquipmentStatus.java 2012-04-30 08:30:00 +0000
@@ -5,6 +5,11 @@
public class EquipmentStatus implements Serializable
{
+ public static final String STATUS_WORKING = "WORKING";
+ public static final String STATUS_NOTWORKING = "NOTWORKING";
+ public static final String STATUS_REPAIR = "REPAIR";
+
+
private int id;
private EquipmentInstance equipmentInstance;
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-coldchain</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentDetailsService.java 2012-04-30 08:30:00 +0000
@@ -2,8 +2,11 @@
import java.util.Collection;
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
import org.springframework.transaction.annotation.Transactional;
-
+@Transactional
public class DefaultEquipmentDetailsService implements EquipmentDetailsService
{
// -------------------------------------------------------------------------
@@ -21,29 +24,36 @@
// EquipmentDetails
// -------------------------------------------------------------------------
- @Transactional
+
@Override
- public int addEquipmentDetails( EquipmentDetails equipmentDetails )
+ public void addEquipmentDetails( EquipmentDetails equipmentDetails )
{
- return equipmentDetailsStore.addEquipmentDetails( equipmentDetails );
+ equipmentDetailsStore.addEquipmentDetails( equipmentDetails );
}
- @Transactional
@Override
public void deleteEquipmentDetails( EquipmentDetails equipmentDetails )
{
equipmentDetailsStore.deleteEquipmentDetails( equipmentDetails );
}
- @Transactional
@Override
public Collection<EquipmentDetails> getAllEquipmentDetails()
{
return equipmentDetailsStore.getAllEquipmentDetails();
}
- @Transactional
@Override
public void updateEquipmentDetails( EquipmentDetails equipmentDetails )
{
equipmentDetailsStore.updateEquipmentDetails( equipmentDetails );
}
+ public Collection<EquipmentDetails> getEquipmentDetails( EquipmentInstance equipmentInstance)
+ {
+ return equipmentDetailsStore.getEquipmentDetails( equipmentInstance );
+ }
+
+ public EquipmentDetails getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ return equipmentDetailsStore.getEquipmentDetails( equipmentInstance, inventoryTypeAttribute );
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java 2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/DefaultEquipmentInstanceService.java 2012-04-30 08:30:00 +0000
@@ -3,6 +3,7 @@
import java.util.Collection;
import java.util.List;
+import org.hibernate.Query;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.springframework.transaction.annotation.Transactional;
@@ -35,22 +36,26 @@
@Override
public int addEquipmentInstance( EquipmentInstance equipmentInstance )
{
- return equipmentInstanceStore.addEquipmentInstance( equipmentInstance );
+ //return equipmentInstanceStore.addEquipmentInstance( equipmentInstance );
+ return equipmentInstanceStore.save( equipmentInstance );
}
@Override
public void deleteEquipmentInstance( EquipmentInstance equipmentInstance )
{
- equipmentInstanceStore.deleteEquipmentInstance( equipmentInstance );
+ //equipmentInstanceStore.deleteEquipmentInstance( equipmentInstance );
+ equipmentInstanceStore.delete( equipmentInstance );
}
@Override
public Collection<EquipmentInstance> getAllEquipmentInstance()
{
- return equipmentInstanceStore.getAllEquipmentInstance();
+ //return equipmentInstanceStore.getAllEquipmentInstance();
+ return equipmentInstanceStore.getAll();
}
@Override
public void updateEquipmentInstance( EquipmentInstance equipmentInstance )
{
- equipmentInstanceStore.updateEquipmentInstance( equipmentInstance );
+ //equipmentInstanceStore.updateEquipmentInstance( equipmentInstance );
+ equipmentInstanceStore.update( equipmentInstance );
}
public int createEquipment( EquipmentInstance equipmentInstance, List<EquipmentDetails> equipmentDetails )
@@ -65,6 +70,10 @@
return equipmentInstanceId;
}
+ public EquipmentInstance getEquipmentInstance( int id )
+ {
+ return equipmentInstanceStore.get( id );
+ }
public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit )
{
@@ -87,4 +96,9 @@
return equipmentInstanceStore.getCountEquipmentInstance( orgUnit, inventoryType );
}
+ public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText )
+ {
+ return equipmentInstanceStore.getCountEquipmentInstance( orgUnit, inventoryType, inventoryTypeAttribute , searchText );
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDetailsStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDetailsStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentDetailsStore.java 2012-04-30 08:30:00 +0000
@@ -2,10 +2,17 @@
import java.util.Collection;
+import org.hibernate.Criteria;
+import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
import org.hisp.dhis.coldchain.inventory.EquipmentDetailsStore;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
public class HibernateEquipmentDetailsStore implements EquipmentDetailsStore
{
@@ -25,11 +32,11 @@
// -------------------------------------------------------------------------
@Override
- public int addEquipmentDetails( EquipmentDetails equipmentDetails )
+ public void addEquipmentDetails( EquipmentDetails equipmentDetails )
{
Session session = sessionFactory.getCurrentSession();
- return (Integer) session.save( equipmentDetails );
+ session.save( equipmentDetails );
}
@Override
@@ -56,4 +63,28 @@
session.update( equipmentDetails );
}
+ public Collection<EquipmentDetails> getEquipmentDetails( EquipmentInstance equipmentInstance )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( EquipmentDetails.class );
+
+ criteria.add( Restrictions.eq( "equipmentInstance", equipmentInstance ) );
+
+ return criteria.list();
+ }
+
+ public EquipmentDetails getEquipmentDetails( EquipmentInstance equipmentInstance, InventoryTypeAttribute inventoryTypeAttribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( EquipmentDetails.class );
+
+ criteria.add( Restrictions.eq( "equipmentInstance", equipmentInstance ) );
+ criteria.add( Restrictions.eq( "inventoryTypeAttribute", inventoryTypeAttribute ) );
+
+ return (EquipmentDetails) criteria.uniqueResult();
+ }
+
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java 2012-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/hibernate/HibernateEquipmentInstanceStore.java 2012-04-30 08:30:00 +0000
@@ -3,8 +3,8 @@
import java.util.Collection;
import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
+import org.hibernate.Query;
+import org.hibernate.criterion.Conjunction;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
@@ -13,7 +13,9 @@
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.springframework.transaction.annotation.Transactional;
+@Transactional
public class HibernateEquipmentInstanceStore
extends HibernateGenericStore<EquipmentInstance>
implements EquipmentInstanceStore
@@ -22,18 +24,21 @@
// Dependencies
// -------------------------------------------------------------------------
+ /*
private SessionFactory sessionFactory;
public void setSessionFactory( SessionFactory sessionFactory )
{
this.sessionFactory = sessionFactory;
}
+ */
+
// -------------------------------------------------------------------------
// EquipmentInstance
// -------------------------------------------------------------------------
- @Override
+ /*
public int addEquipmentInstance( EquipmentInstance equipmentInstance )
{
Session session = sessionFactory.getCurrentSession();
@@ -41,7 +46,7 @@
return (Integer) session.save( equipmentInstance );
}
- @Override
+
public void deleteEquipmentInstance( EquipmentInstance equipmentInstance )
{
Session session = sessionFactory.getCurrentSession();
@@ -49,7 +54,7 @@
session.delete( equipmentInstance );
}
- @Override
+
public Collection<EquipmentInstance> getAllEquipmentInstance()
{
Session session = sessionFactory.getCurrentSession();
@@ -57,7 +62,7 @@
return session.createCriteria( EquipmentInstance.class ).list();
}
- @Override
+
public void updateEquipmentInstance( EquipmentInstance equipmentInstance )
{
Session session = sessionFactory.getCurrentSession();
@@ -65,18 +70,27 @@
session.update( equipmentInstance );
}
+ */
+
+ @SuppressWarnings( "unchecked" )
public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit )
{
+ /*
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria( InventoryTypeAttribute.class );
criteria.add( Restrictions.eq( "organisationUnit", orgUnit ) );
return criteria.list();
+ */
+
+ return getCriteria( Restrictions.eq( "organisationUnit", orgUnit ) ).list();
}
+ @SuppressWarnings( "unchecked" )
public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType )
{
+ /*
Session session = sessionFactory.getCurrentSession();
Criteria criteria = session.createCriteria( InventoryTypeAttribute.class );
@@ -84,6 +98,17 @@
criteria.add( Restrictions.eq( "inventoryType", inventoryType ) );
return criteria.list();
+ */
+
+ Criteria crit = getCriteria();
+ Conjunction con = Restrictions.conjunction();
+
+ con.add( Restrictions.eq( "organisationUnit", orgUnit ) );
+ con.add( Restrictions.eq( "inventoryType", inventoryType ) );
+
+ crit.add( con );
+
+ return crit.list();
}
public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType )
@@ -94,12 +119,25 @@
return rs != null ? rs.intValue() : 0;
}
+ @SuppressWarnings( "unchecked" )
public Collection<EquipmentInstance> getEquipmentInstances( OrganisationUnit orgUnit, InventoryType inventoryType, int min, int max )
{
- String hql = "select e from EquipmentInstance e where e.organisationUnit = :orgUnit and e.inventoryType = :inventoryType order by e.id DESC";
-
- return getQuery( hql ).setEntity( "organisationUnit", orgUnit ).setFirstResult( min ).setMaxResults(
- max ).list();
+ return getCriteria( Restrictions.eq( "organisationUnit", orgUnit ) ).add( Restrictions.eq( "inventoryType", inventoryType ) ).setFirstResult( min ).setMaxResults( max ).list();
+ }
+
+ public int getCountEquipmentInstance( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchText )
+ {
+ String hql = "select count( distinct(ed.equipmentInstance)) from EquipmentDetails ed JOIN EquipmentInstance ei " +
+ " where ed.inventoryTypeAttribute = :inventoryTypeAttribute " +
+ " and ei.organisationUnit = :orgUnit " +
+ " and ei.inventoryType = :inventoryType " +
+ " and ed.value like '%" + searchText + "%'";
+
+ Query query = getQuery( hql );
+
+ Number rs = (Number) query.uniqueResult();
+
+ return (rs != null) ? rs.intValue() : 0;
}
}
=== 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-04-26 10:00:48 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-30 08:30:00 +0000
@@ -82,6 +82,7 @@
<bean id="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService"
class="org.hisp.dhis.coldchain.inventory.DefaultEquipmentInstanceService">
<property name="equipmentInstanceStore" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceStore"/>
+ <property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService"/>
</bean>
<bean id="org.hisp.dhis.coldchain.inventory.EquipmentStatusService"
class="org.hisp.dhis.coldchain.inventory.DefaultEquipmentStatusService">
=== modified file 'local/in/dhis-in-services/dhis-in-service-configuration/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-configuration/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-configuration/pom.xml 2012-04-30 08:30:00 +0000
@@ -5,7 +5,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-configuration</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-dataentrystatus/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-dataentrystatus/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-dataentrystatus/pom.xml 2012-04-30 08:30:00 +0000
@@ -5,7 +5,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-dataentrystatus</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-dbmanager/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-dbmanager/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-dbmanager/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-dbmanager</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-linelisting/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-linelisting/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-linelisting/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-linelisting</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-reports/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-reports/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-reports</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-in-services/dhis-in-service-scheduler/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-scheduler</artifactId>
=== modified file 'local/in/dhis-in-services/dhis-in-service-survey/pom.xml'
--- local/in/dhis-in-services/dhis-in-service-survey/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-in-services/dhis-in-service-survey/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-in-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-survey</artifactId>
=== modified file 'local/in/dhis-in-services/pom.xml'
--- local/in/dhis-in-services/pom.xml 2012-04-17 10:41:26 +0000
+++ local/in/dhis-in-services/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-services</artifactId>
=== modified file 'local/in/dhis-mobile/dhis-service-mobile/pom.xml'
--- local/in/dhis-mobile/dhis-service-mobile/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-mobile/dhis-service-mobile/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-services</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-service-mobile</artifactId>
=== modified file 'local/in/dhis-mobile/dhis-web-mobile/pom.xml'
--- local/in/dhis-mobile/dhis-web-mobile/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-mobile/dhis-web-mobile/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-in-web-mobile</artifactId>
=== modified file 'local/in/dhis-mobile/pom.xml'
--- local/in/dhis-mobile/pom.xml 2012-02-13 12:51:47 +0000
+++ local/in/dhis-mobile/pom.xml 2012-04-30 08:30:00 +0000
@@ -5,7 +5,7 @@
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-sms</artifactId>
- <version>2.7-SNAPSHOT</version>
+ <version>2.8</version>
<packaging>pom</packaging>
<name>Mobile SMS Modules</name>
=== modified file 'local/in/dhis-web-alert/pom.xml'
--- local/in/dhis-web-alert/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-alert/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-alert</artifactId>
=== modified file 'local/in/dhis-web-coldchain/pom.xml'
--- local/in/dhis-web-coldchain/pom.xml 2012-04-21 10:23:39 +0000
+++ local/in/dhis-web-coldchain/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-coldchain</artifactId>
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java 2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/AddEquipmentAction.java 2012-04-30 08:30:00 +0000
@@ -52,11 +52,13 @@
// -------------------------------------------------------------------------
public String execute()
{
+
+ System.out.println("inside AddEquipmentAction : "+ouId);
+
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( ouId );
InventoryType inventoryType = inventoryTypeService.getInventoryType( itypeId );
-
// -----------------------------------------------------------------------------
// Preparing EquipmentInstance
// -----------------------------------------------------------------------------
@@ -154,6 +156,4 @@
{
this.itypeId = itypeId;
}
-
-
}
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceDataAction.java 2012-04-30 08:30:00 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
+import org.hisp.dhis.coldchain.inventory.EquipmentDetailsService;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetEquipmentInstanceDataAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ private EquipmentDetailsService equipmentDetailsService;
+
+ public void setEquipmentDetailsService( EquipmentDetailsService equipmentDetailsService )
+ {
+ this.equipmentDetailsService = equipmentDetailsService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer equipmentInstanceId;
+
+ public void setEquipmentInstanceId( Integer equipmentInstanceId )
+ {
+ this.equipmentInstanceId = equipmentInstanceId;
+ }
+
+ private EquipmentInstance equipmentInstance;
+
+ public EquipmentInstance getEquipmentInstance()
+ {
+ return equipmentInstance;
+ }
+
+ private List<InventoryTypeAttribute> inventoryTypeAttributes;
+
+ public List<InventoryTypeAttribute> getInventoryTypeAttributes()
+ {
+ return inventoryTypeAttributes;
+ }
+
+ private Map<Integer, String> equipmentValueMap;
+
+ public Map<Integer, String> getEquipmentValueMap()
+ {
+ return equipmentValueMap;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+
+ inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( equipmentInstance.getInventoryType().getInventoryTypeAttributes() );
+
+ equipmentValueMap = new HashMap<Integer, String>();
+
+ List<EquipmentDetails> equipmentDetailsList = new ArrayList<EquipmentDetails>( equipmentDetailsService.getEquipmentDetails( equipmentInstance ) );
+
+ for( EquipmentDetails equipmentDetails : equipmentDetailsList )
+ {
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( equipmentDetails.getInventoryTypeAttribute().getValueType() ) )
+ {
+ equipmentValueMap.put( equipmentDetails.getInventoryTypeAttribute().getId(), equipmentDetails.getInventoryTypeAttributeOption().getName() );
+ }
+ else
+ {
+ equipmentValueMap.put( equipmentDetails.getInventoryTypeAttribute().getId(), equipmentDetails.getValue() );
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== 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-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/GetEquipmentInstanceListAction.java 2012-04-30 08:30:00 +0000
@@ -57,6 +57,13 @@
return equipmentInstanceList;
}
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
private String orgUnitId;
public void setOrgUnitId( String orgUnitId )
@@ -113,8 +120,7 @@
OrganisationUnit orgUnit = organisationUnitService.getOrganisationUnit( Integer.parseInt( orgUnitId ) );
- InventoryType inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
-
+ inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( inventoryTypeId ) );
if ( listAll != null && listAll )
{
@@ -124,7 +130,7 @@
}
InventoryTypeAttribute inventoryTypeAttribute = inventoryTypeAttributeService.getInventoryTypeAttribute( Integer.parseInt( inventoryTypeAttributeId ) );
-
+
listEquipmentInstancesByFilter( orgUnit, inventoryType, inventoryTypeAttribute, searchText);
//equipmentInstanceList = new ArrayList<EquipmentInstance>( equipmentInstanceService.getEquipmentInstances( orgUnit, inventoryType ) );
@@ -143,7 +149,9 @@
private void listEquipmentInstancesByFilter( OrganisationUnit orgUnit, InventoryType inventoryType, InventoryTypeAttribute inventoryTypeAttribute, String searchKey )
{
- //total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType, inventoryTypeAttribute, searchText );
+ total = equipmentInstanceService.getCountEquipmentInstance( orgUnit, inventoryType, inventoryTypeAttribute, searchText );
+
+ System.out.println("Total : "+total );
this.paging = createPaging( total );
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/ShowEquipmentStatusFormAction.java 2012-04-30 08:30:00 +0000
@@ -0,0 +1,34 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowEquipmentStatusFormAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private Integer equipmentInstanceId;
+
+ public void setEquipmentInstanceId( Integer equipmentInstanceId )
+ {
+ this.equipmentInstanceId = equipmentInstanceId;
+ }
+
+ public Integer getEquipmentInstanceId()
+ {
+ return equipmentInstanceId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentAction.java 2012-04-30 08:30:00 +0000
@@ -0,0 +1,158 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.math.NumberUtils;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.inventory.EquipmentDetails;
+import org.hisp.dhis.coldchain.inventory.EquipmentDetailsService;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOption;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateEquipmentAction implements Action
+{
+
+ public static final String PREFIX_ATTRIBUTE = "attr";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService;
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ private EquipmentDetailsService equipmentDetailsService;
+
+ // -------------------------------------------------------------------------
+ // Input/ Output
+ // -------------------------------------------------------------------------
+
+ private Integer equipmentInstanceID;
+
+ private String message;
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute()
+ {
+
+ System.out.println("inside UpdateEquipmentAction : "+equipmentInstanceID);
+
+ EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceID );
+
+ InventoryType inventoryType = equipmentInstance.getInventoryType();
+
+ // -----------------------------------------------------------------------------
+ // Preparing Equipment Details
+ // -----------------------------------------------------------------------------
+ HttpServletRequest request = ServletActionContext.getRequest();
+ String value = null;
+
+ List<InventoryTypeAttribute> inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>( inventoryType.getInventoryTypeAttributes() );
+
+ EquipmentDetails equipmentDetails = null;
+ for ( InventoryTypeAttribute attribute : inventoryTypeAttributes )
+ {
+ value = request.getParameter( PREFIX_ATTRIBUTE + attribute.getId() );
+
+ equipmentDetails = equipmentDetailsService.getEquipmentDetails( equipmentInstance, attribute );
+
+ if( equipmentDetails == null && value != null )
+ {
+ equipmentDetails = new EquipmentDetails();
+ equipmentDetails.setEquipmentInstance( equipmentInstance );
+ equipmentDetails.setInventoryTypeAttribute( attribute );
+
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) )
+ {
+ InventoryTypeAttributeOption option = inventoryTypeAttributeOptionService.getInventoryTypeAttributeOption( NumberUtils.toInt( value, 0 ) );
+ if ( option != null )
+ {
+ equipmentDetails.setInventoryTypeAttributeOption( option );
+ equipmentDetails.setValue( option.getName() );
+ }
+ else
+ {
+ // Someone deleted this option ...
+ }
+ }
+ else
+ {
+ equipmentDetails.setValue( value.trim() );
+ }
+
+ equipmentDetailsService.addEquipmentDetails( equipmentDetails );
+ }
+ else
+ {
+ if ( InventoryTypeAttribute.TYPE_COMBO.equalsIgnoreCase( attribute.getValueType() ) )
+ {
+ InventoryTypeAttributeOption option = inventoryTypeAttributeOptionService.getInventoryTypeAttributeOption( NumberUtils.toInt( value, 0 ) );
+ if ( option != null )
+ {
+ equipmentDetails.setInventoryTypeAttributeOption( option );
+ equipmentDetails.setValue( option.getName() );
+ }
+ else
+ {
+ // Someone deleted this option ...
+ }
+ }
+ else
+ {
+ equipmentDetails.setValue( value.trim() );
+ }
+
+ equipmentDetailsService.updateEquipmentDetails( equipmentDetails );
+ }
+
+ }
+
+ message = ""+ equipmentInstanceID;
+
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters & Getters
+ // -------------------------------------------------------------------------
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setInventoryTypeAttributeOptionService(
+ InventoryTypeAttributeOptionService inventoryTypeAttributeOptionService )
+ {
+ this.inventoryTypeAttributeOptionService = inventoryTypeAttributeOptionService;
+ }
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+ public void setEquipmentDetailsService( EquipmentDetailsService equipmentDetailsService )
+ {
+ this.equipmentDetailsService = equipmentDetailsService;
+ }
+
+ public void setEquipmentInstanceID( Integer equipmentInstanceID )
+ {
+ this.equipmentInstanceID = equipmentInstanceID;
+ }
+
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentStatusAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentStatusAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/equipment/action/UpdateEquipmentStatusAction.java 2012-04-30 08:30:00 +0000
@@ -0,0 +1,121 @@
+package org.hisp.dhis.coldchain.equipment.action;
+
+import org.hisp.dhis.coldchain.inventory.EquipmentInstance;
+import org.hisp.dhis.coldchain.inventory.EquipmentInstanceService;
+import org.hisp.dhis.coldchain.inventory.EquipmentStatus;
+import org.hisp.dhis.coldchain.inventory.EquipmentStatusService;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.user.CurrentUserService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateEquipmentStatusAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private EquipmentStatusService equipmentStatusService;
+
+ private EquipmentInstanceService equipmentInstanceService;
+
+ private CurrentUserService currentUserService;
+
+ private I18nFormat format;
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer equipmentInstanceId;
+
+ private String reportingDate;
+
+ private String dateOfUpdation;
+
+ private String status;
+
+ private String description;
+
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ EquipmentInstance equipmentInstance = equipmentInstanceService.getEquipmentInstance( equipmentInstanceId );
+
+ String storedBy = currentUserService.getCurrentUsername();
+
+ EquipmentStatus equipmentStatus = new EquipmentStatus();
+
+ equipmentStatus.setDescription( description );
+ equipmentStatus.setEquipmentInstance( equipmentInstance );
+ equipmentStatus.setStatus( status );
+ equipmentStatus.setReportingDate( format.parseDate( reportingDate.trim() ) );
+ equipmentStatus.setUpdationDate( format.parseDate( dateOfUpdation.trim() ) );
+ equipmentStatus.setStoredBy( storedBy );
+
+ equipmentStatusService.addEquipmentStatus( equipmentStatus );
+
+ return SUCCESS;
+ }
+
+ // -------------------------------------------------------------------------
+ // Setters & Getters
+ // -------------------------------------------------------------------------
+
+ public void setEquipmentStatusService( EquipmentStatusService equipmentStatusService )
+ {
+ this.equipmentStatusService = equipmentStatusService;
+ }
+
+
+ public void setEquipmentInstanceService( EquipmentInstanceService equipmentInstanceService )
+ {
+ this.equipmentInstanceService = equipmentInstanceService;
+ }
+
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
+
+ public void setFormat( I18nFormat format )
+ {
+ this.format = format;
+ }
+
+
+ public void setEquipmentInstanceId( Integer equipmentInstanceId )
+ {
+ this.equipmentInstanceId = equipmentInstanceId;
+ }
+
+
+ public void setReportingDate( String reportingDate )
+ {
+ this.reportingDate = reportingDate;
+ }
+
+
+ public void setDateOfUpdation( String dateOfUpdation )
+ {
+ this.dateOfUpdation = dateOfUpdation;
+ }
+
+
+ public void setStatus( String status )
+ {
+ this.status = status;
+ }
+
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+}
=== 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-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-30 08:30:00 +0000
@@ -273,6 +273,7 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="inventoryTypeAttributeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService" />
</bean>
<bean id="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
class="org.hisp.dhis.coldchain.equipment.action.ShowAddEquipmentFormAction"
@@ -280,6 +281,38 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
</bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction"
+ class="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction"
+ scope="prototype">
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction"
+ class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction"
+ scope="prototype">
+ <property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService" />
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction"
+ class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction"
+ scope="prototype">
+ <property name="equipmentDetailsService" ref="org.hisp.dhis.coldchain.inventory.EquipmentDetailsService" />
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <property name="inventoryTypeAttributeOptionService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeOptionService" />
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction"
+ scope="prototype">
+ </bean>
+ <bean id="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction"
+ class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction"
+ scope="prototype">
+ <property name="equipmentStatusService" ref="org.hisp.dhis.coldchain.inventory.EquipmentStatusService" />
+ <property name="equipmentInstanceService" ref="org.hisp.dhis.coldchain.inventory.EquipmentInstanceService" />
+ <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ </bean>
</beans>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-30 08:30:00 +0000
@@ -290,10 +290,34 @@
<param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
</action>
<action name="addEquipment"
- class="">
+ class="org.hisp.dhis.coldchain.equipment.action.AddEquipmentAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<param name="requiredAuthorities">F_EQUIPMENT_ADD</param>
</action>
+ <action name="showUpdateEquipmentForm"
+ class="org.hisp.dhis.coldchain.equipment.action.GetEquipmentInstanceDataAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-coldchain/updateEquipmentForm.vm</param>
+ <param name="requiredAuthorities">F_EQUIPMENT_UPDATE</param>
+ </action>
+ <action name="updateEquipment"
+ class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_EQUIPMENT_UPDATE</param>
+ </action>
+
+ <action name="showEquipmentStatusForm"
+ class="org.hisp.dhis.coldchain.equipment.action.ShowEquipmentStatusFormAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-coldchain/equipmentStatusForm.vm</param>
+ <param name="requiredAuthorities">F_EQUIPMENTSTATUS_UPDATE</param>
+ </action>
+
+ <action name="updateEquipmentStatus"
+ class="org.hisp.dhis.coldchain.equipment.action.UpdateEquipmentStatusAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_EQUIPMENTSTATUS_UPDATE</param>
+ </action>
</package>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm 2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addEquipmentForm.vm 2012-04-30 08:30:00 +0000
@@ -33,57 +33,55 @@
<h3>$i18n.getString( "add_new_equipment" )</h3>
<form id="equipmentForm" name="equipmentForm" method="post" >
-<input type="text" name="ouId" value="$organisationUnit.id" />
-<input type="text" name="itypeId" vlaue="$inventoryType.id" />
-<table>
- <tr>
- <td>$i18n.getString( "registering_unit" ) : </td>
- <td>$organisationUnit.name</td>
- </tr>
-
- <tr>
- <td>$i18n.getString( "inventory_type" ) : </th>
- <td>$inventoryType.name</th>
- </tr>
+ <input type="text" id="ouId" name="ouId" value="$organisationUnit.id" />
+ <input type="text" id="itypeId" name="itypeId" value="$inventoryType.id" />
+ <table>
+ <tr>
+ <td>$i18n.getString( "registering_unit" ) : </td>
+ <td>$organisationUnit.name</td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "inventory_type" ) : </th>
+ <td>$inventoryType.name</th>
+ </tr>
- <!-- InventoryType Attributes -->
- <tr><td> </td><td> </td></tr>
- <tr><th colspan="2" class="heading-column">$i18n.getString( "inventory_attribute_details" )</th></tr>
- #foreach( $attribute in $inventoryTypeAttributes )
- <tr>
- <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
- <td class="input-column">
- #if( $attribute.valueType == "YES/NO" )
- <select id="attr$attribute.id" name="attr$attribute.id" >
- <option value="" >[$i18n.getString( "please_select" )]</option>
- <option value="true">$i18n.getString( "yes" )</option>
- <option value="false" >$i18n.getString( "no" )</option>
- </select>
- #elseif( $attribute.valueType == "DATE" )
+ <!-- InventoryType Attributes -->
+ <tr><td> </td><td> </td></tr>
+ <tr><th colspan="2" class="heading-column">$i18n.getString( "inventory_attribute_details" )</th></tr>
+ #foreach( $attribute in $inventoryTypeAttributes )
+ <tr>
+ <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+ <td class="input-column">
+ #if( $attribute.valueType == "YES/NO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" >
+ <option value="" >[$i18n.getString( "please_select" )]</option>
+ <option value="true">$i18n.getString( "yes" )</option>
+ <option value="false" >$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $attribute.valueType == "DATE" )
<input type="text" id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )' />
<script type="text/javascript">
datePickerValid( 'attr$attribute.id' );
- </script>
- #elseif( $attribute.valueType == "COMBO" )
- <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ($option in $attribute.attributeOptions )
- <option value="$option.id" >$option.name</option>
- #end
- </select>
- #else
- <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
- #end
- </td>
- </tr>
- #end
+ </script>
+ #elseif( $attribute.valueType == "COMBO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.attributeOptions )
+ <option value="$option.id" >$option.name</option>
+ #end
+ </select>
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ #end
+ </td>
+ </tr>
+ #end
+ </table>
-
-</table>
-<p>
- <input type="submit" class="button" value="$i18n.getString( 'add' )"/>
- <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadPatientList();"/>
-</p>
+ <p>
+ <input type="submit" class="button" value="$i18n.getString( 'add' )"/>
+ <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadAllEquipments();"/>
+ </p>
</form>
=== 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-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentInstanceList.vm 2012-04-30 08:30:00 +0000
@@ -51,8 +51,10 @@
<td>
<a href="javascript:showUpdateEquipmentForm( '$equipmentInstance.id' )" title='$i18n.getString( "edit_equipment" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_equipment" )'></a>
- <a href="javascript:showEquipmentTrackingForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "migration_patient" )' style='width:25px; height:25px'></a>
- <a href="javascript:removePatient( '$equipmentInstance.id', '$encoder.jsEncode( $equipmentInstance.id )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
+ #if( $inventoryType.tracking )
+ <a href="javascript:showEquipmentStatusForm( '$equipmentInstance.id' ); " title='$i18n.getString( "equipment_tracking" )'><img src="../icons/dataentry.png" alt='$i18n.getString( "migration_patient" )' style='width:25px; height:25px'></a>
+ #end
+ <a href="javascript:removeEquipment( '$equipmentInstance.id', '$encoder.jsEncode( $equipmentInstance.id )' )" title='$i18n.getString( "remove" )'><img src="../images/delete.png" alt='$i18n.getString( "remove" )'></a>
<a href="javascript:showEquipmentDetails( '$equipmentInstance.id' )" title='$i18n.getString( "equipment_details" )'><img src="../images/information.png" alt='$i18n.getString( "equipment_details" )'></a>
</td>
@@ -80,19 +82,13 @@
#end
<script type="text/javascript">
jQuery(document).ready(function(){
- tableSorter( 'patientList' );
+ tableSorter( 'equipmentList' );
});
var i18n_patient_details_and_history = '$encoder.jsEscape( $i18n.getString( "patient_details_and_history" ) , "'" )';
var i18n_id = '$encoder.jsEscape( $i18n.getString( "id" ), "'")';
- var i18n_full_name = '$encoder.jsEscape( $i18n.getString( "full_name" ), "'")';
- var i18n_gender = '$encoder.jsEscape( $i18n.getString( "gender" ), "'")';
- var i18n_dob_type = '$encoder.jsEscape( $i18n.getString( "dob_type" ), "'")';
- var i18n_date_of_birth = '$encoder.jsEscape( $i18n.getString( "date_of_birth" ), "'")';
- var i18n_blood_group = '$encoder.jsEscape( $i18n.getString( "blood_group" ), "'")';
var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
var i18n_select = '[' + '$encoder.jsEscape( $i18n.getString( "select" ), "'")' + ']';
- var i18n_program_stages_history_plan = '$encoder.jsEscape( $i18n.getString( "program_stages_history_plan" ) , "'")';
var i18n_value_must_integer = '$encoder.jsEscape( $i18n.getString( "value_must_integer" ) , "'")';
var i18n_value_must_number = '$encoder.jsEscape( $i18n.getString( "value_must_number" ) , "'")';
var i18n_value_must_positive_integer = '$encoder.jsEscape( $i18n.getString( "value_must_positive_integer" ) , "'")';
@@ -100,12 +96,10 @@
var i18n_invalid_date = '$encoder.jsEscape( $i18n.getString( "invalid_date" ) , "'")' + ".\n " + '$encoder.jsEscape( $i18n.getString( "format_date" ) , "'")' + " '" + dateFormat.replace('yy', 'yyyy') + " '" ;
var i18n_saving_value_failed_status_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_status_code" ) , "'")';
var i18n_saving_value_failed_error_code = '$encoder.jsEscape( $i18n.getString( "saving_value_failed_error_code" ) , "'")';
- var i18n_searching_patient_failed = '$encoder.jsEscape( $i18n.getString( "searching_patient_failed" ) , "'")';
var i18n_complete_confirm_message = '$encoder.jsEscape( $i18n.getString( "complete_confirm_message" ) , "'")';
var i18n_error_required_field = '$encoder.jsEscape( $i18n.getString( "error_required_field" ) , "'")';
var i18n_violate_validation = '$encoder.jsEscape( $i18n.getString( "violate_validation" ) , "'")';
var i18n_date_is_greater_then_or_equals_due_date = '$encoder.jsEscape( $i18n.getString( "date_is_greater_then_or_equals_due_date" ) , "'")';
- var i18n_program_stage = '$encoder.jsEscape( $i18n.getString( "program_stage" ) , "'")';
var i18n_scheduled_for = '$encoder.jsEscape( $i18n.getString( "scheduled_for" ) , "'")';
var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
var i18n_create_new_encounter = '$encoder.jsEscape( $i18n.getString( "create_new_encounter" ) , "'")';
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/equipmentStatusForm.vm 2012-04-30 08:30:00 +0000
@@ -0,0 +1,69 @@
+<script>
+
+ jQuery(document).ready( function(){
+
+ currentDiv = 'equipmentStatusForm';
+ isSubmit = true;
+
+ jQuery("#equipmentStatusForm").validate({
+ meta:"validate"
+ ,errorElement:"span"
+ ,submitHandler: function(form)
+ {
+ if( isSubmit )
+ {
+ updateEquipmentStatus();
+ }
+ }
+ });
+ });
+
+</script>
+
+<h3>$i18n.getString( "equipmentstatus" )</h3>
+
+<form id="equipmentStatusForm" name="equipmentStatusForm" method="post" >
+ <input type="text" id="equipmentInstanceId" name="equipmentInstanceId" value="$equipmentInstanceId" />
+ <table>
+ <tr>
+ <td>$i18n.getString( "reporting_date" ) : </td>
+ <td>
+ <input type="text" id="reportingDate" name="reportingDate" />
+ <script type="text/javascript">
+ datePickerValid( 'reportingDate' );
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "date_of_updation" ) : </td>
+ <td>
+ <input type="text" id="dateOfUpdation" name="dateOfUpdation" />
+ <script type="text/javascript">
+ datePickerValid( 'dateOfUpdation' );
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "status" ) : </td>
+ <td>
+ <select id="status" name="status" >
+ <option value="" >[$i18n.getString( "please_select" )]</option>
+ <option value="WORKING">$i18n.getString( "working" )</option>
+ <option value="NOTWORKING" >$i18n.getString( "notworking" )</option>
+ <option value="REPAIR" >$i18n.getString( "repair" )</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "description" ) : </td>
+ <td><textarea id="description" name="description" style="width: 240px; height:8em;"></textarea></td>
+ </tr>
+ </table>
+
+ <p>
+ <input type="submit" class="button" value="$i18n.getString( 'add' )"/>
+ <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadAllEquipments();"/>
+ <input type="button" class="button" value="$i18n.getString( 'show_history' )" onclick="showEquipmentStatusHistory( "$equipmentInstanceId" );" />
+ </p>
+
+</form>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/equipment.js 2012-04-30 08:30:00 +0000
@@ -14,6 +14,7 @@
hideById('listEquipmentDiv');
hideById('editEquipmentDiv');
hideById('resultSearchDiv');
+ hideById('editEquipmentStatusDiv');
jQuery('#loaderDiv').show();
@@ -67,7 +68,8 @@
hideById('editEquipmentDiv');
hideById('resultSearchDiv');
-
+ hideById('editEquipmentStatusDiv');
+
showById('selectDiv');
showById('searchEquipmentDiv');
@@ -108,7 +110,7 @@
var inventoryTypeAttributeId = inventoryTypeAttribute.options[ inventoryTypeAttribute.selectedIndex ].value;
hideById('editEquipmentDiv');
hideById('resultSearchDiv');
-
+ hideById('editEquipmentStatusDiv');
showById('selectDiv');
showById('searchEquipmentDiv');
@@ -130,6 +132,46 @@
}
//----------------------------------------------------------------
+//Show Equipment Tracking Form
+//----------------------------------------------------------------
+
+function showEquipmentStatusForm( equipmentInstanceId )
+{
+ hideById('listEquipmentDiv');
+ hideById('editEquipmentStatusDiv');
+ hideById('selectDiv');
+ hideById('searchEquipmentDiv');
+
+ setInnerHTML('editEquipmentDiv', '');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#editEquipmentStatusDiv').load('showEquipmentStatusForm.action',
+ {
+ equipmentInstanceId:equipmentInstanceId
+ }, function()
+ {
+ showById('editEquipmentStatusDiv');
+ jQuery('#searchEquipmentDiv').dialog('close');
+ jQuery('#loaderDiv').hide();
+ });
+
+ jQuery('#resultSearchDiv').dialog('close');
+}
+
+function updateEquipmentStatus()
+{
+ $.ajax({
+ type: "POST",
+ url: 'updateEquipmentStatus.action',
+ data: getParamsForDiv('editEquipmentStatusDiv'),
+ success: function( json ) {
+ loadAllEquipments();
+ }
+ });
+}
+
+
+//----------------------------------------------------------------
//Add Equipment
//----------------------------------------------------------------
@@ -147,6 +189,7 @@
hideById('listEquipmentDiv');
hideById('selectDiv');
hideById('searchEquipmentDiv');
+ hideById('editEquipmentStatusDiv');
jQuery('#loaderDiv').show();
jQuery('#editEquipmentDiv').load('showAddEquipmentForm.action',{
@@ -169,7 +212,81 @@
success: function(json) {
var type = json.response;
jQuery('#resultSearchDiv').dialog('close');
+ loadAllEquipments();
}
});
return false;
}
+
+//----------------------------------------------------------------
+//Update Equipment
+//----------------------------------------------------------------
+
+function showUpdateEquipmentForm( equipmentInstanceId )
+{
+ hideById('listEquipmentDiv');
+ hideById('selectDiv');
+ hideById('searchEquipmentDiv');
+ hideById('editEquipmentStatusDiv');
+
+ setInnerHTML('editEquipmentDiv', '');
+
+ jQuery('#loaderDiv').show();
+ jQuery('#editEquipmentDiv').load('showUpdateEquipmentForm.action',
+ {
+ equipmentInstanceId:equipmentInstanceId
+ }, function()
+ {
+ showById('editEquipmentDiv');
+ jQuery('#searchEquipmentDiv').dialog('close');
+ jQuery('#loaderDiv').hide();
+ });
+
+ jQuery('#resultSearchDiv').dialog('close');
+}
+
+function updateEquipment()
+{
+ $.ajax({
+ type: "POST",
+ url: 'updateEquipment.action',
+ data: getParamsForDiv('editEquipmentDiv'),
+ success: function( json ) {
+ loadAllEquipments();
+ }
+ });
+}
+//----------------------------------------------------------------
+//Get Params form Div
+//----------------------------------------------------------------
+
+function getParamsForDiv( equipmentDiv )
+{
+ var params = '';
+
+ jQuery("#" + equipmentDiv + " :input").each(function()
+ {
+ var elementId = $(this).attr('id');
+
+ if( $(this).attr('type') == 'checkbox' )
+ {
+ var checked = jQuery(this).attr('checked') ? true : false;
+ params += elementId + "=" + checked + "&";
+ }
+ else if( $(this).attr('type') != 'button' )
+ {
+ var value = "";
+ if( jQuery(this).val() != '' )
+ {
+ value = htmlEncode(jQuery(this).val());
+ }
+ params += elementId + "="+ value + "&";
+ }
+
+ });
+
+ alert( params );
+
+ return params;
+}
+
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2012-04-26 10:00:48 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/selectEquipment.vm 2012-04-30 08:30:00 +0000
@@ -53,6 +53,7 @@
<div id='listEquipmentDiv'></div> <!-- List All/Filtered Equipments -->
<div id='editEquipmentDiv'></div> <!-- Add / Edit Equipment Form -->
+<div id='editEquipmentStatusDiv'></div> <!-- Add / Edit Equipment Status -->
<div id='resultSearchDiv' style='font-size:13px'></div> <!-- List searching Equipment -->
#parse( "/dhis-web-commons/loader/loader.vm" )
=== added 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 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateEquipmentForm.vm 2012-04-30 08:30:00 +0000
@@ -0,0 +1,92 @@
+## Macro for generating the jQuery validation rules
+#macro( validate $type $require )
+ #if( $type == "NUMBER" )
+ {validate:{ number:true #if($require), required:true #end }}
+ #elseif( $require )
+ {validate:{required:true}}
+ #end
+#end
+
+
+<script>
+
+ jQuery(document).ready( function(){
+
+ currentDiv = 'equipmentForm';
+ isSubmit = true;
+
+ jQuery("#equipmentForm").validate({
+ meta:"validate"
+ ,errorElement:"span"
+ ,submitHandler: function(form)
+ {
+ if( isSubmit )
+ {
+ updateEquipment();
+ }
+ }
+ });
+ });
+
+</script>
+
+<h3>$i18n.getString( "update_equipment" )</h3>
+
+<form id="equipmentForm" name="equipmentForm" method="post" >
+ <input type="text" id="equipmentInstanceID" name="equipmentInstanceID" value="$equipmentInstance.id" />
+ <table>
+ <tr>
+ <td>$i18n.getString( "registering_unit" ) : </td>
+ <td>$equipmentInstance.organisationUnit.name</td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "inventory_type" ) : </th>
+ <td>$equipmentInstance.inventoryType.name</th>
+ </tr>
+
+ <!-- InventoryType Attributes -->
+ <tr><td> </td><td> </td></tr>
+ <tr><th colspan="2" class="heading-column">$i18n.getString( "inventory_attribute_details" )</th></tr>
+ #foreach( $attribute in $inventoryTypeAttributes )
+ #set( $attributeValue = "" )
+ #set( $attributeValue = $!equipmentValueMap.get( $attribute.id ) )
+ <tr>
+ <td class='text-column'><label>$attribute.name #if($attribute.mandatory)<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
+ <td class="input-column">
+ #if( $attribute.valueType == "YES/NO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" >
+ <option value="" >[$i18n.getString( "please_select" )]</option>
+ <option value="true" #if( $attributeValue ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( !$attributeValue ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $attribute.valueType == "DATE" )
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class='#validate( "default" $attribute.mandatory )' />
+ <script type="text/javascript">
+ datePickerValid( 'attr$attribute.id' );
+ </script>
+ #elseif( $attribute.valueType == "COMBO" )
+ <select id="attr$attribute.id" name="attr$attribute.id" class='#validate( "default" $attribute.mandatory )'>
+ <option value="">[$i18n.getString( "please_select" )]</option>
+ #foreach ($option in $attribute.attributeOptions )
+ <option value="$option.id" #if($attributeValue == $option.name) selected="selected" #end>$option.name</option>
+ #end
+ </select>
+ #else
+ <input type="text" id="attr$attribute.id" name="attr$attribute.id" value="$!attributeValue" class="{validate:{required:$attribute.mandatory #if($!attribute.noChars),maxlength:$attribute.noChars #end #if($attribute.valueType=='NUMBER'),number:true #end }}" />
+ #end
+ </td>
+ </tr>
+ #end
+ </table>
+
+ <p>
+ <input type="submit" class="button" value="$i18n.getString( 'update' )"/>
+ <input type="button" class="button" value="$i18n.getString( 'back' )" onclick="loadAllEquipments();"/>
+ </p>
+
+</form>
+
+<script>
+ 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-dashboard/pom.xml'
--- local/in/dhis-web-dashboard/pom.xml 2012-04-17 10:41:26 +0000
+++ local/in/dhis-web-dashboard/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-dashboard</artifactId>
=== modified file 'local/in/dhis-web-dataentry-linelisting/pom.xml'
--- local/in/dhis-web-dataentry-linelisting/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-dataentry-linelisting/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-dataentry-national</artifactId>
=== modified file 'local/in/dhis-web-excelimport/pom.xml'
--- local/in/dhis-web-excelimport/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-excelimport/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-excelimport</artifactId>
=== modified file 'local/in/dhis-web-leprosy/pom.xml'
--- local/in/dhis-web-leprosy/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-web-leprosy/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-leprosy</artifactId>
=== modified file 'local/in/dhis-web-linelisting-in/pom.xml'
--- local/in/dhis-web-linelisting-in/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-linelisting-in/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-linelisting-in</artifactId>
=== modified file 'local/in/dhis-web-maintenance-in/pom.xml'
--- local/in/dhis-web-maintenance-in/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-maintenance-in/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-maintenance-in</artifactId>
=== modified file 'local/in/dhis-web-reports-in/pom.xml'
--- local/in/dhis-web-reports-in/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-web-reports-in/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-reports-in</artifactId>
=== modified file 'local/in/dhis-web-reports-national/pom.xml'
--- local/in/dhis-web-reports-national/pom.xml 2012-04-04 11:58:27 +0000
+++ local/in/dhis-web-reports-national/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-reports-national</artifactId>
=== modified file 'local/in/dhis-web-sandbox/pom.xml'
--- local/in/dhis-web-sandbox/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-web-sandbox/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-sandbox</artifactId>
=== modified file 'local/in/dhis-web-sandboxbk/pom.xml'
--- local/in/dhis-web-sandboxbk/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-web-sandboxbk/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-sandbox-bk</artifactId>
=== modified file 'local/in/dhis-web-survey/pom.xml'
--- local/in/dhis-web-survey/pom.xml 2012-03-30 08:17:05 +0000
+++ local/in/dhis-web-survey/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-survey</artifactId>
=== modified file 'local/in/dhis-web-validationrule-in/pom.xml'
--- local/in/dhis-web-validationrule-in/pom.xml 2011-12-26 07:15:40 +0000
+++ local/in/dhis-web-validationrule-in/pom.xml 2012-04-30 08:30:00 +0000
@@ -6,7 +6,7 @@
<parent>
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-web</artifactId>
- <version>2.6</version>
+ <version>2.8</version>
</parent>
<artifactId>dhis-web-validationrule-in</artifactId>
=== modified file 'local/in/pom.xml'
--- local/in/pom.xml 2012-04-17 10:41:26 +0000
+++ local/in/pom.xml 2012-04-30 08:30:00 +0000
@@ -5,7 +5,7 @@
<groupId>org.hisp.dhis</groupId>
<artifactId>dhis-local</artifactId>
- <version>2.8-SNAPSHOT</version>
+ <version>2.8</version>
<packaging>pom</packaging>
<name>Local India Modules</name>