Changeset 1533


Ignore:
Timestamp:
Feb 14, 2012, 10:52:06 AM (10 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #358: Consent registration always create virtual patients 'No000001' and 'Not asked000001'

The problem was a filter on subtype='Patient' causing the registration to stop working after the 'No' and 'Not asked' got their own subtypes in #353.

Location:
extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/dao/Patient.java

    r1518 r1533  
    102102    @since 2.1
    103103  */
    104   public static String generateNextName(DbControl dc, String prefix)
     104  public static String generateNextName(DbControl dc, String prefix, Subtype subtype)
    105105  {
    106106    ItemQuery<BioSource> patientQuery = BioSource.getQuery();
    107     Subtype.PATIENT.addFilter(dc, patientQuery);
     107    if (subtype != null) subtype.addFilter(dc, patientQuery);
    108108    patientQuery.restrict(Restrictions.rlike(Hql.property("name"), Expressions.string("^" + prefix + "[0-9]+$")));
    109109    patientQuery.order(Orders.desc(Hql.property("name")));
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/ConsentFormServlet.java

    r1526 r1533  
    225225            Subtype virtualSubtype = "No".equals(consent) ? Subtype.NO : Subtype.NOT_ASKED;
    226226            vPat.setItemSubtype(virtualSubtype.load(dc));
    227             vPat.setName(Patient.generateNextName(dc, consent));
     227            vPat.setName(Patient.generateNextName(dc, consent, virtualSubtype));
    228228            theCase.getCreationEvent().setSource(vPat);
    229229            dc.saveItem(vPat);
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/PersonalRegistrationServlet.java

    r1524 r1533  
    213213          jsonPat = new JSONObject();
    214214          jsonPat.put("personalNumber", pnr);
    215           jsonPat.put("name", Patient.generateNextName(dc, "PAT"));
     215          jsonPat.put("name", Patient.generateNextName(dc, "PAT", Subtype.PATIENT));
    216216          if (pnrIsValid)
    217217          {
Note: See TracChangeset for help on using the changeset viewer.