Skip to content

Commit

Permalink
Merge pull request #655 from rufener/mpd
Browse files Browse the repository at this point in the history
MPD
  • Loading branch information
rufener authored Apr 6, 2022
2 parents 62cfe54 + 76a670c commit e309d32
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
1 change: 1 addition & 0 deletions back/development.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ weasyprint_baseurl = /*TO COMPLETE*/
affaires_directory = C:/infolica_project/affaire_technique/travail
affaires_directory_full_path = C:/infolica_project/affaire_technique/travail
affaireTemplateDir = C:/infolica_project/affaire_technique/__template
affaireTemplateDir_mpd = C:/infolica_project/affaire_technique/mpd_template
mails_templates_directory = C:/infolica_project/affaire_technique/mail_template
temporary_directory = C:/infolica_project/back/tmp
balance_file_rel_path = A_Administratif/Désignations
Expand Down
8 changes: 4 additions & 4 deletions back/infolica/scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ def get_role_id_by_name(cls, request, role_name):
return None

@classmethod
def create_affaire_folder(cls, request, affaire_folder):
if not os.path.isdir(affaire_folder):
copytree(request.registry.settings['affaireTemplateDir'], affaire_folder, ignore=ignore_patterns('Thumbs.db'))
def create_affaire_folder(cls, template_path, affaire_path):
if not os.path.isdir(affaire_path):
copytree(template_path, affaire_path, ignore=ignore_patterns('Thumbs.db'))
settime = time.time()
os.utime(affaire_folder, times=(settime, settime))
os.utime(affaire_path, times=(settime, settime))

@classmethod
def addNewRecord(cls, request, Model, params=None):
Expand Down
13 changes: 6 additions & 7 deletions back/infolica/views/affaire.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,15 @@ def affaires_new_view(request):
request.dbsession.flush()

# Créer le chemin du dossier de l'affaire
if model.type_id != request.registry.settings['affaire_type_mpd_id']:
affaire_chemin_full_path = os.path.join(request.registry.settings['affaires_directory'], str(model.id))
model.chemin = str(model.id) # chemin relatif
else:
affaire_chemin_full_path = None
affaire_chemin_full_path = os.path.join(request.registry.settings['affaires_directory'], str(model.id))
model.chemin = str(model.id) # chemin relatif

# Copier le dossier __template pour une nouvelle affaire
if not affaire_chemin_full_path is None:
Utils.create_affaire_folder(request, affaire_chemin_full_path)

if model.type_id == request.registry.settings['affaire_type_mpd_id']:
Utils.create_affaire_folder(request.registry.settings['affaireTemplateDir_mpd'], affaire_chemin_full_path)
else:
Utils.create_affaire_folder(request.registry.settings['affaireTemplateDir'], affaire_chemin_full_path)

# Créer les formulaires de contrôle
params = {'affaire_id': model.id}
Expand Down
1 change: 1 addition & 0 deletions back/production.ini.template
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ weasyprint_baseurl = /*TO COMPLETE*/
affaires_directory = /*TO COMPLETE*/
affaires_directory_full_path = /*TO COMPLETE*/
affaireTemplateDir = /*TO COMPLETE*/
affaireTemplateDir_mpd = /*TO COMPLETE*/
mails_templates_directory = /*TO COMPLETE*/
temporary_directory = /*TO COMPLETE*/
balance_file_rel_path = /*TO COMPLETE*/
Expand Down
Binary file modified back/requirements.txt
Binary file not shown.
28 changes: 15 additions & 13 deletions front/src/components/Affaires/NewAffaire/NewAffaire.vue
Original file line number Diff line number Diff line change
Expand Up @@ -525,19 +525,6 @@ export default {
moment(this.form.date_cloture, process.env.VUE_APP_DATEFORMAT_CLIENT).format(process.env.VUE_APP_DATEFORMAT_WS)
);
}
if (this.form.plan && this.form.type && this.form.type.id && this.form.type.id === this.typesAffaires_conf.mpd) {
let cadastre_2digits = this.form.cadastre.id.toLocaleString("en-US", {
minimumIntegerDigits: 2,
useGrouping: false,
});
let plan_3digits = Number(this.form.plan).toLocaleString("en-US", {
minimumIntegerDigits: 3,
useGrouping: false,
});
formData.append("no_access", "MPD" + cadastre_2digits + " " + plan_3digits + " " + new Date().getFullYear().toString().substr(-2));
}
// FACTURE
if (this.client_facture && this.client_facture.id &&
Expand Down Expand Up @@ -1198,6 +1185,7 @@ export default {
setPlanMoCadastre(){
if (this.form.cadastre && this.form.cadastre.id) {
this.plansMOListe_cadastre = stringifyAutocomplete(this.plansMOListe.filter(x => x.cadastre_id === this.form.cadastre.id), "planno", "idobj");
this.form.plan = null;
}
},
Expand Down Expand Up @@ -1268,6 +1256,20 @@ export default {
}).catch(err => handleException(err, this));
},
updateAffaireName(val) {
if (this.form.type && this.form.type.id == this.typesAffaires_conf.mpd) {
if (val) {
this.form.nom = "Mise à jour périodique - Plan " + val;
} else {
this.form.nom = "Mise à jour périodique";
}
} else {
this.form.nom = null;
}
}
},
mounted: function() {
Expand Down
7 changes: 5 additions & 2 deletions front/src/components/Affaires/NewAffaire/newAffaire.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
<md-autocomplete v-model="form.cadastre"
md-dense required
@md-selected="setPlanMoCadastre()"
@md-changed="updateAffaireName()"
:md-options="cadastres_list"
:class="getValidationClass($v.form.cadastre)">
<label>Cadastre</label>
Expand Down Expand Up @@ -42,7 +43,7 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
<md-autocomplete v-model="form.type"
md-dense required
@md-selected="onSelectType"
@md-changed="initMask"
@md-changed="initMask; updateAffaireName()"
:md-options="types_affaires_list"
:class="getValidationClass($v.form.type)">
<label>Type d'affaire</label>
Expand Down Expand Up @@ -97,7 +98,9 @@ <h1 style="flex: 1;">Nouvelle affaire</h1>
<div class="md-layout-item md-size-50">
<md-field>
<label>Plan</label>
<md-select v-model="form.plan" md-dense>
<md-select v-model="form.plan" md-dense
:disabled="!(form.cadastre && form.cadastre.id) || sending"
@md-selected="updateAffaireName">
<md-option v-for="item in plansMOListe_cadastre" :value="item.nom">{{ item.nom }}</md-option>
</md-select>
</md-field>
Expand Down

0 comments on commit e309d32

Please sign in to comment.