0001-mails-add-reference-field-only-for-alfortville-flavo.patch
welco/contrib/alfortville/templates/alfortville/dg-table.html | ||
---|---|---|
19 | 19 |
<thead> |
20 | 20 |
<th>{% trans 'Scan Date' %}</th> |
21 | 21 |
<th>{% trans 'Post Date' %}</th> |
22 |
<th>{% trans 'Reference' %}</th> |
|
22 | 23 |
<th>{% trans 'Subject' %}</th> |
23 | 24 |
<th>{% trans 'User' %}</th> |
24 | 25 |
<th>{% trans 'Category' %}</th> |
... | ... | |
30 | 31 |
<tr data-mail-id="{{object.id}}"> |
31 | 32 |
<td class="r">{{object.creation_timestamp|date:"d F Y"|lower}}</td> |
32 | 33 |
<td class="r">{{object.post_date|date:"d F Y"|lower}}</td> |
34 |
<td class="r">{{object.reference|default:'-'}}</td> |
|
33 | 35 |
<td class="r">{{object.subject|default:'-'}}</td> |
34 | 36 |
<td class="r">{{object.contact_name }}</td> |
35 | 37 |
<td class="r">{{object.categories|join:", " }}</td> |
welco/contrib/alfortville/templates/alfortville/mail-table-waiting.html | ||
---|---|---|
14 | 14 |
<thead> |
15 | 15 |
<th>{% trans 'Scan Date' %}</th> |
16 | 16 |
<th>{% trans 'Post Date' %}</th> |
17 |
<th>{% trans 'Reference' %}</th> |
|
17 | 18 |
<th>{% trans 'Subject' %}</th> |
18 | 19 |
<th>{% trans 'Related Forms' %}</th> |
19 | 20 |
<th>{% trans 'Status' %}</th> |
... | ... | |
23 | 24 |
<tr> |
24 | 25 |
<td>{{object.creation_timestamp|date:"d F Y"|lower}}</td> |
25 | 26 |
<td>{{object.post_date|default:'-'}}</td> |
27 |
<td>{{object.reference|default:'-'}}</td> |
|
26 | 28 |
<td>{{object.subject|default:'-'}}</td> |
27 | 29 |
<td>{% for association in object.associations.all %}{{association.formdef_name}}{% if not forloop.last %}, {% endif %}{% endfor %}</td> |
28 | 30 |
<td>{% if object.status == 'done-qualif' %}En attente de validation DGS |
welco/sources/mail/forms.py | ||
---|---|---|
21 | 21 |
class MailQualificationForm(forms.Form): |
22 | 22 |
post_date = forms.DateTimeField(label=_('Post Date (*)'), required=False) |
23 | 23 |
registered_mail_number = forms.CharField(label=_('Registered Mail Number'), required=False) |
24 |
reference = forms.CharField(label=_('Reference'), required=False, widget=forms.HiddenInput) |
|
24 | 25 |
subject = forms.CharField(label=_('Subject'), required=False, widget=forms.HiddenInput) |
25 | 26 | |
26 | 27 |
def __init__(self, *args, **kwargs): |
27 | 28 |
super(MailQualificationForm, self).__init__(*args, **kwargs) |
28 | 29 |
if 'alfortville' in getattr(settings, 'FLAVOURS', []): |
30 |
self.fields['reference'].widget = forms.TextInput() |
|
29 | 31 |
self.fields['subject'].widget = forms.TextInput() |
welco/sources/mail/migrations/0011_mail_reference.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
from __future__ import unicode_literals |
|
3 | ||
4 |
from django.db import migrations, models |
|
5 | ||
6 | ||
7 |
class Migration(migrations.Migration): |
|
8 | ||
9 |
dependencies = [ |
|
10 |
('mail', '0010_mail_subject'), |
|
11 |
] |
|
12 | ||
13 |
operations = [ |
|
14 |
migrations.AddField( |
|
15 |
model_name='mail', |
|
16 |
name='reference', |
|
17 |
field=models.CharField(max_length=30, null=True, verbose_name='Reference'), |
|
18 |
), |
|
19 |
] |
welco/sources/mail/models.py | ||
---|---|---|
42 | 42 |
note = models.TextField(_('Note'), null=True) |
43 | 43 | |
44 | 44 |
# used only if settings.FLAVOURS contains 'alfortville' |
45 |
reference = models.CharField(_('Reference'), null=True, max_length=30) |
|
45 | 46 |
subject = models.CharField(_('Subject'), null=True, max_length=200) |
46 | 47 | |
47 | 48 |
scanner_category = models.CharField(max_length=100, blank=True, null=True) |
... | ... | |
66 | 67 |
'registered_mail_number': self.registered_mail_number, |
67 | 68 |
} |
68 | 69 |
if 'alfortville' in getattr(settings, 'FLAVOURS', []): |
70 |
data['reference'] = self.reference |
|
69 | 71 |
data['subject'] = self.subject |
70 | 72 |
return self.get_qualification_form_class()(data) |
71 | 73 | |
... | ... | |
120 | 122 |
'registered_mail_number': self.registered_mail_number, |
121 | 123 |
} |
122 | 124 |
if 'alfortville' in getattr(settings, 'FLAVOURS', []): |
125 |
context['reference'] = self.reference |
|
123 | 126 |
context['subject'] = self.subject |
124 | 127 |
return context |
125 | 128 |
welco/sources/mail/templates/welco/mail_home.html | ||
---|---|---|
11 | 11 |
data-pdf-href="{{ mail.content.url }}" |
12 | 12 |
data-post-date="{{ mail.post_date|date:"d/m/Y" }}" |
13 | 13 |
data-registered-mail-number="{{ mail.registered_mail_number|default:"" }}" |
14 |
data-reference="{{ mail.reference|default:"" }}" |
|
14 | 15 |
data-subject="{{ mail.subject|default:"" }}" |
15 | 16 |
>{{ mail.creation_timestamp|date:"d/m/Y" }} |
16 | 17 |
{{mail.contact_name}} |
welco/sources/mail/templates/welco/mail_summary.html | ||
---|---|---|
7 | 7 |
<p class="registered-mail-number">{% trans "Registered Mail Number:" %} {{object.registered_mail_number}}</p> |
8 | 8 |
{% endif %} |
9 | 9 | |
10 |
{% if object.reference %} |
|
11 |
<p class="reference">{% trans "Reference:" %} {{object.reference}}</p> |
|
12 |
{% endif %} |
|
13 | ||
10 | 14 |
{% if object.subject %} |
11 | 15 |
<p class="subject">{% trans "Subject:" %} {{object.subject}}</p> |
12 | 16 |
{% endif %} |
welco/sources/mail/views.py | ||
---|---|---|
88 | 88 |
if form.is_valid(): |
89 | 89 |
mail.post_date = form.cleaned_data['post_date'] |
90 | 90 |
mail.registered_mail_number = form.cleaned_data['registered_mail_number'] |
91 |
mail.reference = form.cleaned_data['reference'] |
|
91 | 92 |
mail.subject = form.cleaned_data['subject'] |
92 | 93 |
mail.save() |
93 | 94 |
return HttpResponseRedirect(reverse('qualif-zone') + |
welco/static/css/style.css | ||
---|---|---|
480 | 480 |
padding: 0.5ex 0.5ex; |
481 | 481 |
} |
482 | 482 | |
483 |
#source-mainarea input#id_reference { |
|
484 |
width: 10em; |
|
485 |
} |
|
486 | ||
483 | 487 |
#source-mainarea input#id_subject { |
484 |
width: 40em;
|
|
488 |
width: 30em;
|
|
485 | 489 |
} |
486 | 490 | |
487 | 491 |
#source-mainarea button { |
welco/static/js/welco.js | ||
---|---|---|
79 | 79 |
$(this).addClass('active'); |
80 | 80 |
$('#id_post_date').val($(this).data('post-date')); |
81 | 81 |
$('#id_registered_mail_number').val($(this).data('registered-mail-number')); |
82 |
$('#id_reference').val($(this).data('reference')); |
|
82 | 83 |
$('#id_subject').val($(this).data('subject')); |
83 | 84 |
var source_pk = $('div.source .active[data-source-pk]').data('source-pk'); |
84 | 85 |
$('#postit > div.content').data('url', $('#postit > div.content').data('base-url') + '?mail=' + source_pk); |
... | ... | |
213 | 214 |
$('.document').delegate('button.save', 'click', function() { |
214 | 215 |
var post_date = $('#id_post_date').val(); |
215 | 216 |
var registered_mail_number = $('#id_registered_mail_number').val(); |
217 |
var reference = $('#id_reference').val(); |
|
216 | 218 |
var subject = $('#id_subject').val(); |
217 | 219 |
var source_type = $('div.source div[data-source-type]').data('source-type'); |
218 | 220 |
var source_pk = $('div.source .active[data-source-pk]').data('source-pk'); |
219 | 221 |
$.ajax({url: $(this).data('action-url'), |
220 | 222 |
data: {post_date: post_date, |
221 | 223 |
registered_mail_number: registered_mail_number, |
224 |
reference: reference, |
|
222 | 225 |
subject: subject, |
223 | 226 |
source_type: source_type, |
224 | 227 |
source_pk: source_pk}, |
... | ... | |
227 | 230 |
success: function(data) { |
228 | 231 |
$('div.source .active').data('post-date', post_date); |
229 | 232 |
$('div.source .active').data('registered-mail-number', registered_mail_number); |
233 |
$('div.source .active').data('reference', reference); |
|
230 | 234 |
$('div.source .active').data('subject', subject); |
231 | 235 |
$('#source-mainarea form').effect('highlight'); |
232 | 236 |
if ($('#id_post_date').length && !$('#id_post_date').val()) { |
233 |
- |