public void modeAuto(Loan loan) {

        if (user.isAllowedToBorrow(loan, this.getStockController())) {

            if (CalendarController.checkCalendars(loan.getStart(),
                    loan.getEnd())) {

                if (this.getStockController().isAvailable(loan)
                        && CalendarController.differenceDate(loan.getStart(),
                                loan.getEnd()) < this.getStockController()
                                .numberOfDayMaterialCanBeLoaned(loan)) {

                    System.out
                            .println("Your loan has been automatically validated.");

                    this.getStockController().getStock().getLoans().add(loan);

                    System.out.println("Loan added : ");

                    System.out.println(loan.toString());
                } else {

                    System.out
                            .println("Your loan is not valid. You claim to much equipment.");

                    int quantity = this.getStockController()
                            .numberOfMaterialAvailable(loan);

                    System.out.print("You could have claimed " + quantity
                            + loan.getName() + ".");

                    int period = this.getStockController()
                            .numberOfDayMaterialCanBeLoaned(loan);

                    System.out.println("For a period of " + period + " days");

                    GregorianCalendar start = this.getStockController()
                            .dayWhenMaterialIsAvailable(loan);

                    if (start != null) {

                        System.out.println("Or wait until "
                                + CalendarController.calendarToString(start));

                        GregorianCalendar end = this.getStockController()
                                .dayWhenMaterialIsNotAvailable(loan);

                        System.out.print(" to "
                                + CalendarController.calendarToString(end));
                    }
                }
            } else {

                System.out.println("Wrong parameters : \tCalendars.");
            }
        } else {

            System.out.println("You are not allowed to make this loan.");
        }
    }