示例#1
0
  public static void show(Long id) {
    Person p = Person.findById(id);
    List<Person> employes = Person.getTSMJ();
    long nbOlds = MJEvaluation.nbOlds(p);
    MJEvaluation evaluation = MJEvaluation.getLast(p);

    render(nbOlds, employes, p, evaluation);
  }
示例#2
0
  public static void show(long residentID) {
    Person p = Person.findById(residentID);
    MJPastTraining pastTraining = MJPastTraining.getLastActif(p);
    long nbOlds = MJPastTraining.nbOlds(p);

    render(p, pastTraining, nbOlds);
  }
  public static void create(long personID, String content) {
    try {
      User user = User.loadFromSession();
      Person person = Person.findById(personID);

      Policy policy =
          Policy.getInstance(
              Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
      AntiSamy as = new AntiSamy();
      CleanResults cr = as.scan(content, policy);

      InsConfidential c = new InsConfidential();
      c.content = cr.getCleanHTML();
      c.createAt = new GregorianCalendar();
      c.employe = user.person;
      c.person = person;
      c.save();

      flash.success("messageAdded");

      InsConfidentials.show(personID);
    } catch (ScanException ex) {
      Logger.error(InsConfidentials.class.getName() + " : " + ex);
    } catch (PolicyException ex) {
      Logger.error(InsConfidentials.class.getName() + " : " + ex);
    }
  }
  public static void show(Long id) {
    User user = User.loadFromSession();
    Person p = Person.findById(id);
    List<InsConfidential> insConfidentials = InsConfidential.byPerson(p);

    render(id, insConfidentials, p, user);
  }
示例#5
0
  public static void save(MJEvaluation evaluation, Long appraisers[]) throws Exception {
    Policy policy =
        Policy.getInstance(
            Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
    AntiSamy as = new AntiSamy();
    CleanResults cr = as.scan(evaluation.content, policy);
    User editor = User.loadFromSession();

    evaluation.actif = false;
    evaluation.editor = editor.person;
    evaluation.evaluationDate = new GregorianCalendar();

    List<Person> employes = new ArrayList<Person>();
    for (Long id : appraisers) {
      employes.add((Person) Person.findById(id));
    }

    evaluation.appraisers = employes;
    evaluation.save();

    MJEvaluation newEvaluation = new MJEvaluation();
    GregorianCalendar date = new GregorianCalendar();
    date.setTimeInMillis(evaluation.evaluationDate.getTimeInMillis());
    date.add(Calendar.MONTH, 6);

    evaluation.actif = true;
    newEvaluation.evaluationDate = date;
    newEvaluation.resident = evaluation.resident;
    newEvaluation.save();

    flash.success("saved");

    MJEvaluations.show(evaluation.resident.id);
  }
示例#6
0
  public static void saveSignature(long personID, double amount, File signature) {
    Person person = Person.findById(personID);
    person.signAmount = amount;
    person.save();

    if (amount > 0 && !person.user.hasRole("userIV")) {
      Role role = Role.getUserIV();
      person.user.roles.add(role);
      person.user.save();
    }

    if (signature != null) {
      try {
        FileUtils.copyFile(
            signature, new File(Invoice.INVOICE_SIGN_DIR + person.user.username + ".png"));
      } catch (IOException e) {
        e.printStackTrace();
      }
    }

    flash.success("saved");

    signature();
  }
示例#7
0
  public static void showOlds(long residentID) {
    Person resident = Person.findById(residentID);
    List<MJPastTraining> pastTrainings = MJPastTraining.getOlds(resident);

    render(pastTrainings);
  }