public void setDocTypeId(int docType) {
   this.docTypeId = docType;
   bashConfirm.setDisabled(docType < 0);
   bashConfirm.setVisible(
       DocFlow.hasPermition(PermissionNames.CAN_CONFIRM_BASH)
           || (docType == 30 && DocFlow.hasPermition(PermissionNames.CAN_CONFIRM_BASH_COEF)));
 }
 public ArrayList<String> createCriteria() {
   ArrayList<String> criterias = new ArrayList<String>();
   criterias.add("system_id=" + DocFlow.system_id);
   addCriteria(criterias, tiUserName, "user_name='%s'", "");
   addCriteria(criterias, addrComp.getSiRegion(), "regionid=%s", "-1");
   addCriteria(criterias, addrComp.getSiSubregion(), "subregionid=%s", "-1");
   addCriteria(criterias, addrComp.getSiCity(), "cityid=%s", "-1");
   addCriteria(criterias, iiZona, "czona=%s", "");
   addCriteria(criterias, siDocStatus, "doc_status_id=%s", "-1");
   addCriteria(criterias, iiCustomer, "cust_id=%s", "");
   addCriteria(criterias, tiContent, "content_xml like '%%s%'", "");
   addCriteria(criterias, tiDocId, "id::character varying like '%s%'", "");
   addCriteria(criterias, tiCancelary, "cancelary_nom like '%%s%'", "");
   String doctypeFilter = "doc_type_id=" + docTypeId;
   if (docTypeId <= 0) doctypeFilter = "group_id=" + Math.abs(docTypeId);
   criterias.add(doctypeFilter);
   if (!DocFlow.hasPermition(PermissionNames.VIEW_ALL_DOCUMENTS))
     criterias.add("user_id=" + DocFlow.user_id);
   return criterias;
 }
  public void setData(
      HashMap<String, String> values, long customer_id, HashMap<String, String> displayValues) {
    if (displayValues == null) displayValues = new HashMap<String, String>();
    newData = true;
    Set<String> fieldKeys = formitemMap.keySet();
    for (String key : fieldKeys) {
      FieldDefinitionItem item = formitemMap.get(key);
      FieldDefinition fieldDef = item.getFieldDef();
      if (fieldDef.getFieldType() == FieldDefinition.FT_IMAGE_ITEM
          && displayValues.containsKey(key))
        ((ImageItem) item.getFormItem()).setDisplayValue(displayValues.get(key));

      if ((fieldDef.getFieldType() == FieldDefinition.FT_COMBO
          || fieldDef.getFieldType() == FieldDefinition.FT_SELECTION
          || fieldDef.getFieldType() == FieldDefinition.FT_CHK_GRID)) {
        String val = fieldDef.getDefaultValue();
        if (val != null && val.trim().length() > 0) {
          val = val.trim();
          if (DocFlow.hasPermition("CAN_VIEW_ALL_REGIONS")
              && (val.toLowerCase().equals("$regionId".toLowerCase())
                  || val.toLowerCase().equals("$subregionId".toLowerCase()))) {
            if (values.get(key) != null) continue;
          }
          if (val.toLowerCase().equals("$regionId".toLowerCase())
              && DocFlow.user_obj.getUser().getRegionid() >= 0) {
            values.put(key, "" + DocFlow.user_obj.getUser().getRegionid());
            if (!item.getFieldDef().isFieldReadOnly())
              item.getFormItem().setDisabled(!DocFlow.hasPermition("CAN_VIEW_ALL_REGIONS"));
          }
          if (val.toLowerCase().equals("$subregionId".toLowerCase())
              && DocFlow.user_obj.getUser().getSubregionid() >= 0) {
            values.put(key, "" + DocFlow.user_obj.getUser().getSubregionid());
            if (!item.getFieldDef().isFieldReadOnly())
              item.getFormItem().setDisabled(!DocFlow.hasPermition("CAN_VIEW_ALL_REGIONS"));
          }
        }
      }
      setDefaultValue(fieldDef, item.getFormItem());
    }

    HashMap<String, String> listSqls = new HashMap<String, String>();
    for (String key : fieldKeys) {
      FieldDefinitionItem item = formitemMap.get(key);
      FieldDefinition fieldDef = item.getFieldDef();

      if (fieldDef.getFieldType() == FieldDefinition.FT_COMBO
          || fieldDef.getFieldType() == FieldDefinition.FT_SELECTION
          || fieldDef.getFieldType() == FieldDefinition.FT_CHK_GRID) {
        String value = "";
        if (fieldDef.getFieldSelectMethode() > 0) {
          value = fieldDef.getFieldSelectMethode() + "";
          String parentField = fieldDef.getParentField();
          parentField = parentField == null ? "" : parentField;
          if (parentField.length() != 0) {
            FieldDefinitionItem pItem = formitemMap.get(parentField);
            String parent_id = values.get(parentField);
            if (parent_id == null || parent_id.trim().length() == 0) {
              parent_id = "-1";
            }
            parent_id = parent_id.trim();

            if (pItem != null && pItem.getFieldDef() != null)
              value += "_" + pItem.getFieldDef().getFieldSelectMethode() + "_" + parent_id;
          }

        } else value = fieldDef.getFieldSelectionSQL();
        if (value == null || value.length() < 1) continue;
        listSqls.put(key, value);
      }
    }

    getRemouteValues(values, customer_id, listSqls, true);
  }