Пример #1
0
 public static ORecordValues valuesToData(OModel model, OValues value) {
   ORecordValues data = new ORecordValues();
   data.put("name", value.get("name"));
   data.put("db_datas", value.getString("datas"));
   data.put("datas_fname", value.get("name"));
   data.put("file_size", value.get("file_size"));
   data.put("res_model", false);
   data.put("res_id", false);
   data.put("file_type", value.get("file_type"));
   data.put("company_id", model.getUser().getCompanyId());
   return data;
 }
Пример #2
0
 public static JSONObject valuesToData(OModel model, OValues value) {
   JSONObject data = new JSONObject();
   try {
     data.put("name", value.get("name"));
     data.put("db_datas", value.getString("datas"));
     data.put("datas_fname", value.get("name"));
     data.put("file_size", value.get("file_size"));
     data.put("file_type", value.get("file_type"));
     data.put("company_id", model.getUser().getCompany_id());
     if (value.contains("res_id")) data.put("res_id", value.getInt("res_id"));
     else data.put("res_id", false);
     if (value.contains("res_model")) data.put("res_model", value.getString("res_model"));
     else data.put("res_model", false);
     return data;
   } catch (JSONException e) {
     e.printStackTrace();
   }
   return null;
 }
Пример #3
0
 public boolean createAttachment(OValues value, String rel_model, int res_id) {
   OValues values = new OValues();
   values.put("name", value.get("name"));
   values.put("datas_fname", value.getString("name"));
   values.put("file_size", value.get("file_size"));
   values.put("file_type", value.get("file_type"));
   values.put("company_id", getUser().getCompanyId());
   values.put("res_id", res_id);
   values.put("res_model", rel_model);
   values.put("file_uri", value.getString("file_uri"));
   values.put("type", value.getString("file_type"));
   values.put("id", value.get("id"));
   insert(values);
   return true;
 }