Project

General

Profile

« Previous | Next » 

Revision 88abfb2a

Added by Jérôme Schneider over 10 years ago

agenda: fix comments management

  • appointments.py: set description to empty string if None and fix
    description detection * forms.py: use UpdateAppoinment for PeriodicUpdate instead of
    NewAppoinment * ajax-worker-tab.html: remove now useless if

View differences:

calebasse/agenda/appointments.py
80 80
            self.patient_record_id = event.patient.id
81 81
            self.patient_record_paper_id = event.patient.paper_id
82 82
            self.act_type = event.act_type.name
83
            self.description = event.act.comment
83
            if self.act_id:
84
                self.description = event.act.comment
84 85
            self.is_billed = event.act.is_billed
85 86
            state = event.get_state()
86 87
            state_name = state.state_name if state else 'NON_VALIDE'
......
102 103
            self.event_type = event.event_type
103 104
        for worker in self.workers:
104 105
            self.workers_code.append("%s-%s" % (worker.id, worker.last_name.upper()))
106
        if not self.description:
107
            self.description = ''
105 108

  
106 109
    def init_free_time(self, length, begin_time):
107 110
        self.type = "free"
calebasse/agenda/forms.py
90 90
            appointment.services = [self.service]
91 91
        return appointment
92 92

  
93
class UpdatePeriodicAppointmentForm(NewAppointmentForm):
93
class UpdateAppointmentForm(NewAppointmentForm):
94
    class Meta(NewAppointmentForm.Meta):
95
        fields = (
96
                'start_datetime',
97
                'date',
98
                'time',
99
                'duration',
100
                'patient',
101
                'participants',
102
                'room',
103
                'act_type',
104
        )
105

  
106

  
107
class UpdatePeriodicAppointmentForm(UpdateAppointmentForm):
94 108

  
95 109
    def clean(self):
96 110
        cleaned_data = super(UpdatePeriodicAppointmentForm, self).clean()
......
102 116
                            u"La date doit être supérieur au dernier acte facturé de la récurrence"])
103 117
        return cleaned_data
104 118

  
105
class DisablePatientAppointmentForm(NewAppointmentForm):
119
class DisablePatientAppointmentForm(UpdateAppointmentForm):
106 120

  
107 121
    def __init__(self, instance, service=None, **kwargs):
108 122
        super(DisablePatientAppointmentForm, self).__init__(instance,
......
118 132
        else:
119 133
            return self.cleaned_data.get('patient', None)
120 134

  
121
class UpdateAppointmentForm(NewAppointmentForm):
122
    class Meta(NewAppointmentForm.Meta):
123
        fields = (
124
                'start_datetime',
125
                'date',
126
                'time',
127
                'duration',
128
                'patient',
129
                'participants',
130
                'room',
131
                'act_type',
132
        )
133

  
134 135

  
135 136
class NewEventForm(BaseForm):
136 137
    title = forms.CharField(label=u"Complément de l'intitulé", max_length=32, required=False)
calebasse/agenda/templates/agenda/ajax-worker-tab.html
129 129
    <div class="tabs-worker-{{ worker_agenda.worker.id }} textedit">
130 130
            <span></span>
131 131
            {% if service in appointment.services_names or not appointment.services_names %}
132
            <textarea>{% if appointment.description %}{{ appointment.description }}{% endif %}</textarea>
132
            <textarea>{{ appointment.description }}</textarea>
133 133
            <button disabled="disabled" data-event-id="{{ appointment.event_id }}" data-date="{{ date|date:"Y-m-d" }}" {% if appointment.act_id %}data-act-id="{{ appointment.act_id }}{% endif %}">✔</button>
134 134
            {% else %}
135 135
            <p>{{ appointment.description }}</p>
......
137 137
        </div>
138 138
    {% else %}
139 139
        {% if appointment.description %}
140
        <p>{% if appointment.description %}{{ appointment.description }}{% endif %}</p>
140
        <p>{{ appointment.description }}</p>
141 141
        {% endif %}
142 142
    {% endif %}
143 143
  </div>

Also available in: Unified diff