Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/2.1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreJunod committed Mar 20, 2023
2 parents 73e9e81 + 302c0b3 commit 375f33b
Show file tree
Hide file tree
Showing 34 changed files with 619 additions and 244 deletions.
13 changes: 0 additions & 13 deletions .github/dependabot.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ repos:
rev: "22.3.0"
hooks:
- id: black
# Renovate configuration
- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 35.10.0
hooks:
- id: renovate-config-validator
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM sitdocker/geocity-base:v1.3.2.2021
FROM sitdocker/geocity-base:v2.1.5

ARG ENV

Expand Down
6 changes: 2 additions & 4 deletions geocity/apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@
PUBLIC_TYPE_CHOICES = (
(
True,
_("Permettre la saisie à n'importe quel utilisateur disposant d'un compte"),
_("Tout public"),
),
(
False,
_(
"Restreindre la saisie aux utilisateurs autorisés de l'entité administrative"
),
_("Restreint aux utilisateurs autorisés"),
),
)

Expand Down
6 changes: 5 additions & 1 deletion geocity/apps/core/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ h5 {
font-size: 1.1em;
}

.bold {
font-weight: bold;
}

.progress-nav {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -556,7 +560,7 @@ th.actions {
}

.global-search-form-container {
width: 600px;
width: 400px;
min-width: 0;
}

Expand Down
37 changes: 25 additions & 12 deletions geocity/apps/core/static/js/submission_contacts.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
let update_form_value = function(item, userprofile) {

if (document.getElementById(`self_contact_${parseInt(item) + 1}`).checked == true) {
document.getElementById(`id_form-${item}-first_name`).value = userprofile.first_name;
for (const [key, value] of Object.entries(userprofile)) {
document.getElementById(`id_form-${item}-${key}`).value = value;
document.getElementById(`id_form-${item}-${key}`).readOnly = true;
}
} else {
for (const [key, value] of Object.entries(userprofile)) {
document.getElementById(`id_form-${item}-${key}`).value = '';
document.getElementById(`id_form-${item}-${key}`).readOnly = false;
}
if (document.getElementById(`self_contact_${parseInt(item) + 1}`).checked == true) {
document.getElementById(`id_form-${item}-first_name`).value = userprofile.first_name;
for (const [key, value] of Object.entries(userprofile)) {
document.getElementById(`id_form-${item}-${key}`).value = value;
document.getElementById(`id_form-${item}-${key}`).readOnly = true;
}

} else {
for (const [key, value] of Object.entries(userprofile)) {
document.getElementById(`id_form-${item}-${key}`).value = '';
document.getElementById(`id_form-${item}-${key}`).readOnly = false;
}
}
}

// Create a label to replace "readonly hidden select" readonly
window.addEventListener('load', function () {
var selects = document.querySelectorAll("select[readonly][hidden]");
for (select of selects) {
let elem = document.createElement('label');
let text = select.querySelector("option[selected]").text
let div = select.closest('.col-md-9');

elem.innerHTML = text;
elem.classList.add('col-form-label', 'bold');
div.appendChild(elem);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Generated by Django 4.1.7 on 2023-03-10 16:03

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("forms", "0017_field_message_for_notified_services_and_more"),
]

operations = [
migrations.AlterField(
model_name="historicalprice",
name="amount",
field=models.DecimalField(
decimal_places=2,
help_text="Un montant de 0 peut être utilisé pour avoir un tarif gratuit",
max_digits=6,
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="Montant",
),
),
migrations.AlterField(
model_name="price",
name="amount",
field=models.DecimalField(
decimal_places=2,
help_text="Un montant de 0 peut être utilisé pour avoir un tarif gratuit",
max_digits=6,
validators=[django.core.validators.MinValueValidator(0)],
verbose_name="Montant",
),
),
]
8 changes: 7 additions & 1 deletion geocity/apps/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,13 @@ def clean(self):

class Price(models.Model):
text = models.CharField(_("Texte"), max_length=255)
amount = models.DecimalField(_("Montant"), max_digits=6, decimal_places=2)
amount = models.DecimalField(
_("Montant"),
max_digits=6,
decimal_places=2,
validators=[MinValueValidator(0)],
help_text=_("Un montant de 0 peut être utilisé pour avoir un tarif gratuit"),
)
currency = models.CharField(_("Devise"), max_length=20, default=default_currency)
integrator = models.ForeignKey(
Group,
Expand Down
9 changes: 8 additions & 1 deletion geocity/apps/reports/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.utils.translation import gettext_lazy as _
from polymorphic.admin import PolymorphicInlineSupportMixin, StackedPolymorphicInline

from geocity.apps.accounts.admin import IntegratorFilterMixin
from geocity.apps.accounts.admin import IntegratorFilterMixin, filter_for_user
from geocity.apps.submissions.models import ComplementaryDocumentType

from .models import HeaderFooter, Report, ReportLayout, Section
Expand Down Expand Up @@ -191,6 +191,13 @@ def formfield_for_manytomany(self, db_field, request, **kwargs):
)
return super().formfield_for_manytomany(db_field, request, **kwargs)

def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "layout":
kwargs["queryset"] = filter_for_user(
request.user, ReportLayout.objects.all()
)
return super().formfield_for_foreignkey(db_field, request, **kwargs)

def save_related(self, request, form, formsets, change):
super().save_related(request, form, formsets, change)
sections = form.instance.sections.order_by("order").all()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def _create_payment_report(self, group, layout):
Date :&nbsp;{{ transaction_data.creation_date }}<br />
<strong>Ann&eacute;e :&nbsp;{{ transaction_data.creation_date_year }}</strong><br />
Page : 1/1</p>""",
text_align="right",
location="right",
)
section_paragraph_1.save()
Expand All @@ -41,6 +42,7 @@ def _create_payment_report(self, group, layout):
<p>{{request_data.properties.author.first_name}}&nbsp;{{request_data.properties.author.last_name}}<br />
{{request_data.properties.author.address}}<br />
{{request_data.properties.author.zipcode}}&nbsp;{{request_data.properties.author.city}}</p>""",
text_align="right",
location="right",
)
section_paragraph_2.save()
Expand Down Expand Up @@ -110,6 +112,7 @@ def _create_refund_report(self, group, layout):
Date :&nbsp;{{ transaction_data.creation_date }}<br />
<strong>Ann&eacute;e :&nbsp;{{ transaction_data.creation_date_year }}</strong><br />
Page : 1/1</p>""",
text_align="right",
location="right",
)
section_paragraph_1.save()
Expand All @@ -123,6 +126,7 @@ def _create_refund_report(self, group, layout):
<p>{{request_data.properties.author.first_name}}&nbsp;{{request_data.properties.author.last_name}}<br />
{{request_data.properties.author.address}}<br />
{{request_data.properties.author.zipcode}}&nbsp;{{request_data.properties.author.city}}</p>""",
text_align="right",
location="right",
)
section_paragraph_2.save()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Generated by Django 4.1.7 on 2023-03-20 07:35

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("reports", "0020_headerfooter_sectionrecipient_and_more"),
]

operations = [
migrations.RemoveField(
model_name="section",
name="padding_top",
),
migrations.AddField(
model_name="sectionamendproperty",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionauthor",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectioncontact",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectioncreditor",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectiondetail",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionmap",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionparagraph",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionplanning",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionrecipient",
name="padding_top",
field=models.PositiveIntegerField(
default=40,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionrecipient",
name="uses_dynamic_recipient",
field=models.BooleanField(
default=True,
help_text="Si le demande est saisie au nom d'une autre personne (requérant) celui-ci sera utilisé",
verbose_name="Destinataire dynamique",
),
),
migrations.AddField(
model_name="sectionstatus",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
migrations.AddField(
model_name="sectionvalidation",
name="padding_top",
field=models.PositiveIntegerField(
default=0,
help_text="Espace vide au dessus afin de placer le texte au bon endroit (en pixels). Augmenter la valeur fait descendre le texte",
verbose_name="Espace vide au dessus",
),
),
]
Loading

0 comments on commit 375f33b

Please sign in to comment.