Projet

Général

Profil

« Précédent | Suivant » 

Révision ad0780e6

Ajouté par Serghei Mihai il y a plus de 9 ans

agenda: when adding events of type COURRIEL or TELEPHONE the start time and
duration are taken in account and default to 8h and 10 minutes if not defined

Closes #5015

Voir les différences:

calebasse/agenda/forms.py
67 67
                    .order_by('name')
68 68

  
69 69
    def clean_time(self):
70
        if self.cleaned_data['time']:
71
            return self.cleaned_data['time']
72

  
70 73
        act_type = self.data.get('act_type')
71 74
        # act type is available as raw data from the post request
72 75
        if act_type in self.special_types:
73 76
            return time(8, 0)
74
        if self.cleaned_data['time']:
75
            return self.cleaned_data['time']
76 77
        raise forms.ValidationError(_(u'This field is required.'))
77 78

  
78 79
    def clean_duration(self):
79
        act_type = self.data.get('act_type')
80
        if act_type in self.special_types:
81
            return 10
82 80
        if self.cleaned_data['duration']:
83 81
            duration = self.cleaned_data['duration']
84 82
            try:
......
88 86
                return duration
89 87
            except ValueError:
90 88
                raise forms.ValidationError(u'Le champ doit contenir uniquement des chiffres')
89

  
90
        act_type = self.data.get('act_type')
91
        if act_type in self.special_types:
92
            return 10
91 93
        raise forms.ValidationError(_(u'This field is required.'))
92 94

  
93 95
    def clean_patient(self):

Formats disponibles : Unified diff