diff options
Diffstat (limited to 'archaeological_operations')
11 files changed, 343 insertions, 269 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 76d7055d9..2754f2d1a 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -103,6 +103,8 @@ class ParcelForm(forms.Form): return self.cleaned_data class ParcelSelectionForm(forms.Form): + _town = forms.ChoiceField(label=_("Town"), choices=(), required=False, + validators=[valid_id(models.Town)]) _parcel_selection = forms.CharField(label=_(u"Full text input"), widget=SelectParcelWidget(attrs={'class':'parcel-select'}), max_length=100, help_text=_(u"example: \"2013: XD:1 to "\ @@ -118,6 +120,13 @@ class ParcelFormSet(FormSet): if self.forms[0].__class__.__name__ == 'ParcelForm': self.selection_form = ParcelSelectionForm() self.extra_form = self.selection_form + # copy town choices + town_choices = self.forms[0].fields['town'].choices[:] + if town_choices and not town_choices[0][0]: + # remove empty + town_choices = town_choices[1:] + if town_choices: + self.selection_form.fields['_town'].choices = town_choices def as_table(self): # add dynamic widget @@ -142,25 +151,14 @@ class ParcelFormSet(FormSet): def clean(self): # manage parcel selection - last_town, parcels = None, [] - if hasattr(self, 'cleaned_data') and self.cleaned_data: - for parcel in reversed(self.cleaned_data): - if parcel.get('town'): - last_town = parcel.get('town') - break - if not last_town and 'town' in self.forms[0].fields.keys(): - towns = self.forms[0].fields['town'].choices - if towns: - towns.pop(0) # remove first empty - if towns: - last_town = towns[0][0] + selected_town, parcels = None, [] if self.data.get('_parcel_selection'): parcels = parse_parcels(self.data['_parcel_selection']) - if last_town: - for idx, parcel in enumerate(parcels): - parcel['town'] = last_town - parcel['DELETE'] = False - parcels[idx] = parcel + selected_town = self.data.get('_town') + for idx, parcel in enumerate(parcels): + parcel['town'] = selected_town + parcel['DELETE'] = False + parcels[idx] = parcel c_max = self.total_form_count() # pop the last extra form extra_form = self.forms.pop() @@ -188,6 +186,8 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True, ParcelFormSet.form_label = _(u"Parcels") class OperationSelect(TableSelect): + year = forms.IntegerField(label=_("Year")) + operation_code = forms.IntegerField(label=_(u"Numeric reference")) common_name = forms.CharField(label=_(u"Name (full text search)"), max_length=30) if settings.COUNTRY == 'fr': @@ -203,7 +203,6 @@ class OperationSelect(TableSelect): associated_model=Person), label=_(u"In charge")) remains = forms.ChoiceField(label=_(u"Remains"), choices=[]) periods = forms.ChoiceField(label=_(u"Periods"), choices=[]) - year = forms.IntegerField(label=_("Year")) start_before = forms.DateField(label=_(u"Started before"), widget=widgets.JQueryDate) start_after = forms.DateField(label=_(u"Started after"), @@ -591,8 +590,13 @@ OperationSourceFormSelection = get_form_selection( ################################################ class AdministrativeActOpeSelect(TableSelect): - operation__towns = get_town_field() + year = forms.IntegerField(label=_("Year")) + index = forms.IntegerField(label=_("Index")) + if settings.COUNTRY == 'fr': + ref_sra = forms.CharField(label=u"Référence SRA", + max_length=15) act_type = forms.ChoiceField(label=_("Act type"), choices=[]) + operation__towns = get_town_field() def __init__(self, *args, **kwargs): super(AdministrativeActOpeSelect, self).__init__(*args, **kwargs) @@ -684,13 +688,12 @@ class GenerateDocForm(forms.Form): self.fields['doc_generation'].choices = [('', u'-'*9)] + \ [(choice.pk , unicode(choice)) for choice in choices] -class AdministrativeActRegisterSelect(TableSelect): - signature_date__year = forms.IntegerField(label=_(u"Year")) - act_type = forms.ChoiceField(label=_("Act type"), choices=[]) +class AdministrativeActRegisterSelect(AdministrativeActOpeSelect): def __init__(self, *args, **kwargs): super(AdministrativeActRegisterSelect, self).__init__(*args, **kwargs) - self.fields['act_type'].choices = models.ActType.get_types() + self.fields['act_type'].choices = models.ActType.get_types( + dct={'indexed':True}) self.fields['act_type'].help_text = models.ActType.get_help() class AdministrativeActRegisterFormSelection(forms.Form): diff --git a/archaeological_operations/locale/fr/LC_MESSAGES/django.po b/archaeological_operations/locale/fr/LC_MESSAGES/django.po index 9fc0976be..52bce19da 100644 --- a/archaeological_operations/locale/fr/LC_MESSAGES/django.po +++ b/archaeological_operations/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: alpha\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-01-07 21:50+0100\n" +"POT-Creation-Date: 2014-01-16 22:23+0100\n" "PO-Revision-Date: 2010-12-09\n" "Last-Translator: Étienne Loks <etienne.loks at peacefrogs net>\n" "Language-Team: \n" @@ -18,12 +18,12 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n>1;\n" -#: forms.py:63 forms.py:188 forms.py:427 forms.py:448 forms.py:452 -#: models.py:523 templates/ishtar/sheet_operation.html:86 +#: forms.py:63 forms.py:186 forms.py:425 forms.py:446 forms.py:450 +#: models.py:534 templates/ishtar/sheet_operation.html:87 msgid "Parcels" msgstr "Parcelles" -#: forms.py:66 forms.py:405 models.py:517 +#: forms.py:66 forms.py:106 forms.py:403 models.py:528 #: templates/ishtar/dashboards/dashboard_operation.html:302 #: templates/ishtar/dashboards/dashboard_operation.html:315 #: templates/ishtar/dashboards/dashboard_operation.html:482 @@ -31,17 +31,16 @@ msgstr "Parcelles" msgid "Town" msgstr "Commune" -#: forms.py:68 forms.py:206 forms.py:306 forms.py:688 models.py:118 -#: models.py:450 models.py:515 templates/ishtar/sheet_operation.html:84 -#: templates/ishtar/sheet_operation.html:105 +#: forms.py:68 forms.py:204 forms.py:304 forms.py:686 models.py:118 +#: models.py:461 models.py:526 templates/ishtar/sheet_operation.html:85 msgid "Year" msgstr "Année" -#: forms.py:71 models.py:518 templates/ishtar/sheet_operation.html:85 +#: forms.py:71 models.py:529 templates/ishtar/sheet_operation.html:86 msgid "Section" msgstr "Section" -#: forms.py:73 models.py:519 +#: forms.py:73 models.py:530 msgid "Parcel number" msgstr "Numéro de parcelle" @@ -49,131 +48,132 @@ msgstr "Numéro de parcelle" msgid "Town section and parcel number fields are required." msgstr "La commune, la section et le numéro de parcelle sont obligatoire." -#: forms.py:106 +#: forms.py:108 msgid "Full text input" msgstr "Saisie libre" -#: forms.py:108 +#: forms.py:110 msgid "example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or \"AB:24,AC:42\"" msgstr "exemple : \"2013: XD:1 à 13,24,33 à 39, YD:24\" ou \"AB:24,AC:42\"" -#: forms.py:182 +#: forms.py:180 msgid "There are identical parcels." msgstr "Il y a des parcelles identiques." -#: forms.py:191 +#: forms.py:189 msgid "Name (full text search)" msgstr "Nom (recherche texte intégral)" -#: forms.py:196 forms.py:294 forms.py:572 models.py:44 models.py:125 +#: forms.py:194 forms.py:292 forms.py:570 models.py:44 models.py:125 msgid "Operation type" msgstr "Type d'opération" -#: forms.py:203 models.py:116 +#: forms.py:201 models.py:116 msgid "In charge" msgstr "Responsable" -#: forms.py:204 models.py:127 +#: forms.py:202 models.py:127 msgid "Remains" msgstr "Vestiges" -#: forms.py:205 forms.py:477 forms.py:496 models.py:130 -#: templates/ishtar/sheet_operation.html:160 +#: forms.py:203 forms.py:475 forms.py:494 models.py:130 +#: templates/ishtar/sheet_operation.html:144 msgid "Periods" msgstr "Périodes" -#: forms.py:207 +#: forms.py:205 msgid "Started before" msgstr "Commencé avant" -#: forms.py:209 +#: forms.py:207 msgid "Started after" msgstr "Commencé après" -#: forms.py:211 +#: forms.py:209 msgid "Ended before" msgstr "Terminé avant" -#: forms.py:213 +#: forms.py:211 msgid "Ended after" msgstr "Terminé après" -#: forms.py:215 +#: forms.py:213 msgid "Parcel (section/number)" msgstr "Parcelle (section/numéro)" -#: forms.py:216 +#: forms.py:214 msgid "Is open?" msgstr "Est ouvert ?" -#: forms.py:235 forms.py:566 views.py:168 +#: forms.py:233 forms.py:564 views.py:169 msgid "Operation search" msgstr "Recherche d'opérations" -#: forms.py:247 forms.py:568 +#: forms.py:245 forms.py:566 msgid "You should select an operation." msgstr "Vous devez sélectionner une opération." -#: forms.py:275 forms.py:622 templates/ishtar/sheet_operation.html:28 +#: forms.py:273 forms.py:620 templates/ishtar/sheet_administrativeact.html:11 +#: templates/ishtar/sheet_operation.html:28 msgid "General" msgstr "Général" -#: forms.py:283 models.py:400 +#: forms.py:281 models.py:401 msgid "Person in charge of the operation" msgstr "Responsable d'opération" -#: forms.py:290 models.py:378 models.py:414 wizards.py:80 +#: forms.py:288 models.py:378 models.py:415 wizards.py:80 msgid "Archaelogical file" msgstr "Dossier archéologique" -#: forms.py:296 models.py:66 models.py:109 models.py:569 +#: forms.py:294 models.py:66 models.py:109 models.py:580 msgid "Start date" msgstr "Date de début" -#: forms.py:298 models.py:110 +#: forms.py:296 models.py:110 msgid "Excavation end date" msgstr "Date de fin de chantier" -#: forms.py:300 models.py:113 +#: forms.py:298 models.py:113 msgid "Report delivery date" msgstr "Date de livraison du rapport" -#: forms.py:303 +#: forms.py:301 msgid "Total surface (m²)" msgstr "Surface totale des terrains (m²)" -#: forms.py:310 models.py:119 models.py:279 +#: forms.py:308 models.py:119 models.py:279 msgid "Operation code" msgstr "Code de l'opération" -#: forms.py:313 models.py:162 +#: forms.py:311 models.py:162 msgid "Generic name" msgstr "Nom générique" -#: forms.py:315 models.py:160 +#: forms.py:313 models.py:160 msgid "Operator reference" msgstr "Référence de l'opérateur" -#: forms.py:319 +#: forms.py:317 msgid "Associated archaeological sites" msgstr "Sites archéologiques associés" -#: forms.py:339 models.py:164 +#: forms.py:337 models.py:164 msgid "Comment" msgstr "Commentaire" -#: forms.py:352 +#: forms.py:350 msgid "" "If you want to set an excavation end date you have to provide a start date." msgstr "" "Avant de renseigner la date de fin de chantier, il est nécessaire de " "renseigner une date de début." -#: forms.py:355 +#: forms.py:353 msgid "The excavation end date cannot be before the start date." msgstr "La date de fin de chantier ne peut être avant la date de début." -#: forms.py:369 +#: forms.py:367 #, python-format msgid "" "Operation code already exist for year: %(year)d - use a value bigger than " @@ -182,110 +182,110 @@ msgstr "" "Ce code d'opération existe déjà pour l'année %(year)d - utilisez une valeur " "plus grande que %(last_val)d" -#: forms.py:373 +#: forms.py:371 msgid "Bad operation code" msgstr "Mauvais code d'opération" -#: forms.py:378 +#: forms.py:376 msgid "Preventive informations - excavation" msgstr "Information archéologie préventive - fouille" -#: forms.py:379 models.py:129 +#: forms.py:377 models.py:129 #: templates/ishtar/dashboards/dashboard_operation.html:495 msgid "Cost (€)" msgstr "Cout (€)" -#: forms.py:380 models.py:131 +#: forms.py:378 models.py:131 msgid "Scheduled man-days" msgstr "Jours-hommes prévus" -#: forms.py:382 models.py:133 +#: forms.py:380 models.py:133 msgid "Optional man-days" msgstr "Jours-hommes optionnels" -#: forms.py:384 models.py:135 +#: forms.py:382 models.py:135 msgid "Effective man-days" msgstr "Jours-hommes effectifs" -#: forms.py:393 +#: forms.py:391 msgid "Preventive informations - diagnostic" msgstr "Information archéologie préventive - diagnostic" -#: forms.py:396 models.py:148 +#: forms.py:394 models.py:148 msgid "Prescription on zoning" msgstr "Prescription sur zonage" -#: forms.py:398 models.py:150 +#: forms.py:396 models.py:150 msgid "Prescription on large area" msgstr "Prescription sur une vaste surface" -#: forms.py:400 models.py:152 +#: forms.py:398 models.py:152 msgid "Prescription on geoarchaeological context" msgstr "Prescription sur un contexte géoarchéologique" -#: forms.py:403 forms.py:424 models.py:128 models.py:459 +#: forms.py:401 forms.py:422 models.py:128 models.py:470 msgid "Towns" msgstr "Communes" -#: forms.py:429 models.py:522 models.py:568 -#: templates/ishtar/sheet_operation.html:132 -#: templates/ishtar/sheet_operation.html:164 +#: forms.py:427 models.py:533 models.py:579 +#: templates/ishtar/sheet_operation.html:116 +#: templates/ishtar/sheet_operation.html:148 msgid "Parcel" msgstr "Parcelle" -#: forms.py:455 forms.py:474 models.py:61 +#: forms.py:453 forms.py:472 models.py:61 msgid "Remain types" msgstr "Types de vestige" -#: forms.py:458 models.py:60 +#: forms.py:456 models.py:60 msgid "Remain type" msgstr "Type de vestige" -#: forms.py:470 +#: forms.py:468 msgid "There are identical remain types" msgstr "Il y a des types de vestige identiques." -#: forms.py:480 +#: forms.py:478 msgid "Period" msgstr "Période" -#: forms.py:492 +#: forms.py:490 msgid "There are identical periods" msgstr "Il y a des périodes identiques." -#: forms.py:499 models.py:80 +#: forms.py:497 models.py:80 msgid "Reference" msgstr "Référence" -#: forms.py:500 models.py:81 +#: forms.py:498 models.py:81 msgid "Name" msgstr "Nom" -#: forms.py:506 +#: forms.py:504 msgid "This reference already exists." msgstr "Cette référence existe déjà." -#: forms.py:515 +#: forms.py:513 msgid "Associated archaelogical sites" msgstr "Entités archéologiques associées" -#: forms.py:521 ishtar_menu.py:29 +#: forms.py:519 ishtar_menu.py:29 msgid "Search" msgstr "Recherche" -#: forms.py:525 +#: forms.py:523 msgid "Would you like to close this operation?" msgstr "Voulez vous clore cette opération ?" -#: forms.py:529 +#: forms.py:527 msgid "Would you like to delete this operation?" msgstr "Voulez vous supprimer cette opération ?" -#: forms.py:537 models.py:369 models.py:401 +#: forms.py:535 models.py:369 models.py:402 msgid "Index" msgstr "Index" -#: forms.py:560 +#: forms.py:558 #, python-format msgid "" "Index already exist for operation: %(operation)s - use a value bigger than " @@ -294,69 +294,69 @@ msgstr "" "Cet index existe déjà pour l'opération : %(operation)s, utilisez une valeur " "plus grande que %(last_val)d" -#: forms.py:571 +#: forms.py:569 msgid "Operation's town" msgstr "Commune de l'opération" -#: forms.py:574 +#: forms.py:572 msgid "Operation's year" msgstr "Année de l'opération" -#: forms.py:585 +#: forms.py:583 msgid "Documentation search" msgstr "Recherche de document" -#: forms.py:587 +#: forms.py:585 msgid "You should select a document." msgstr "Vous devez sélectionner un document." -#: forms.py:595 forms.py:625 forms.py:689 models.py:389 models.py:398 +#: forms.py:593 forms.py:623 forms.py:687 models.py:389 models.py:399 msgid "Act type" msgstr "Type d'acte" -#: forms.py:605 +#: forms.py:603 msgid "Administrative act search" msgstr "Recherche d'actes administratifs" -#: forms.py:617 forms.py:710 +#: forms.py:615 forms.py:708 msgid "You should select an administrative act." msgstr "Vous devez sélectionner un acte administratif." -#: forms.py:626 models.py:408 +#: forms.py:624 models.py:409 msgid "Signatory" msgstr "Signataire" -#: forms.py:630 models.py:417 +#: forms.py:628 models.py:418 msgid "Object" msgstr "Objet" -#: forms.py:632 models.py:415 +#: forms.py:630 models.py:416 msgid "Signature date" msgstr "Date de signature" -#: forms.py:647 +#: forms.py:645 msgid "Would you like to delete this administrative act?" msgstr "Voulez vous supprimer cet acte administratif ?" -#: forms.py:651 +#: forms.py:649 msgid "Template" msgstr "Patron" -#: forms.py:676 +#: forms.py:674 msgid "Doc generation" msgstr "Generation de document" -#: forms.py:678 +#: forms.py:676 msgid "Generate the associated doc?" msgstr "Générer le document associé ?" -#: forms.py:697 ishtar_menu.py:96 views.py:305 +#: forms.py:695 ishtar_menu.py:96 views.py:306 msgctxt "admin act register" msgid "Register" msgstr "Registre" #: ishtar_menu.py:27 models.py:172 models.py:356 models.py:367 models.py:379 -#: models.py:410 models.py:514 templates/ishtar/sheet_operation.html:6 +#: models.py:411 models.py:525 templates/ishtar/sheet_operation.html:6 msgid "Operation" msgstr "Opération" @@ -376,7 +376,8 @@ msgstr "Clotûre" msgid "Deletion" msgstr "Suppression" -#: ishtar_menu.py:51 models.py:425 +#: ishtar_menu.py:51 models.py:426 +#: templates/ishtar/sheet_administrativeact.html:6 msgid "Administrative act" msgstr "Acte administratif" @@ -421,7 +422,7 @@ msgstr "Types d'opération" msgid "Order" msgstr "Ordre" -#: models.py:67 models.py:570 +#: models.py:67 models.py:581 msgid "End date" msgstr "Date de fin" @@ -469,7 +470,7 @@ msgstr "Peut supprimer ses propres entités archéologiques" msgid "Closing date" msgstr "Date de clotûre" -#: models.py:123 models.py:512 +#: models.py:123 models.py:523 msgid "File" msgstr "Dossier" @@ -552,119 +553,124 @@ msgstr "Indexé" msgid "Act types" msgstr "Types d'acte" -#: models.py:403 +#: models.py:404 msgid "Archaeological preventive operator" msgstr "Opérateur d'archéologie préventive" -#: models.py:406 +#: models.py:407 msgid "Person in charge of the scientific part" msgstr "Responsable scientifique" -#: models.py:426 templates/ishtar/sheet_operation.html:103 +#: models.py:427 msgid "Administrative acts" msgstr "Actes administratifs" -#: models.py:429 +#: models.py:430 msgid "Can view all Administrative act" msgstr "Peut voir tout les Actes administratifs" -#: models.py:431 +#: models.py:432 msgid "Can view own Administrative act" msgstr "Peut voir son propre Acte administratif" -#: models.py:433 +#: models.py:434 msgid "Can add own Administrative act" msgstr "Peut ajouter son propre Acte administratif" -#: models.py:435 +#: models.py:436 msgid "Can change own Administrative act" msgstr "Peut changer son propre Acte administratif" -#: models.py:437 +#: models.py:438 msgid "Can delete own Administrative act" msgstr "Peut supprimer son propre Acte administratif" -#: models.py:505 +#: models.py:446 +#: templates/ishtar/blocks/window_tables/administrativacts.html:5 +msgid "Ref." +msgstr "Réf." + +#: models.py:516 msgid "This index already exists for this year" msgstr "Cet index existe déjà pour cette année." -#: models.py:567 +#: models.py:578 msgid "Owner" msgstr "Propriétaire" -#: models.py:573 +#: models.py:584 msgid "Parcel owner" msgstr "Propriétaire de parcelle" -#: models.py:574 +#: models.py:585 msgid "Parcel owners" msgstr "Propriétaires de parcelle" -#: models.py:598 +#: models.py:609 msgid "Recorded" msgstr "Enregistré" -#: models.py:599 +#: models.py:610 msgid "Effective" msgstr "Effectif" -#: models.py:600 +#: models.py:611 msgid "Active" msgstr "Actif" -#: models.py:601 +#: models.py:612 msgid "Field completed" msgstr "Terrain achevé" -#: models.py:602 +#: models.py:613 msgid "Associated report" msgstr "Rapport associé" -#: models.py:603 +#: models.py:614 msgid "Closed" msgstr "Fermé" -#: models.py:604 +#: models.py:615 msgid "Documented and closed" msgstr "Documenté et clôt" -#: views.py:182 +#: views.py:183 msgid "New operation" msgstr "Nouvelle opération" -#: views.py:213 +#: views.py:214 msgid "Operation modification" msgstr "Modification d'une opération" -#: views.py:243 +#: views.py:244 msgid "Operation closing" msgstr "Clotûre de l'opération" -#: views.py:249 +#: views.py:250 msgid "Operation deletion" msgstr "Suppression d'une opération" -#: views.py:257 +#: views.py:258 msgid "Operation: source creation" msgstr "Operation : nouvelle documentation associée" -#: views.py:265 +#: views.py:266 msgid "Operation: source modification" msgstr "Operation : modification d'une documentation associée" -#: views.py:271 +#: views.py:272 msgid "Operation: source deletion" msgstr "Operation : suppression d'une documentation associée" -#: views.py:280 +#: views.py:281 msgid "Operation: new administrative act" msgstr "Operation : nouvel acte administratif" -#: views.py:290 +#: views.py:291 msgid "Operation: administrative act modification" msgstr "Operation : modification d'un acte administratif" -#: views.py:299 +#: views.py:300 msgid "Operation: administrative act deletion" msgstr "Operation : suppression d'un acte administratif" @@ -676,46 +682,87 @@ msgstr "" "Attention : Aucun dossier archéologique n'a été précisé. S'il s'agit d'un " "oubli, définissez le à la première étape." -#: templates/ishtar/sheet_operation.html:14 -msgid "Previous version" -msgstr "Version précédente" - -#: templates/ishtar/sheet_operation.html:18 -msgid "Are you sure to rollback to this version?" -msgstr "Êtes vous sûr de vouloir revenir à cette version ?" - -#: templates/ishtar/sheet_operation.html:19 -msgid "Next version" -msgstr "Version suivante" - +#: templates/ishtar/sheet_administrativeact.html:10 #: templates/ishtar/sheet_operation.html:24 msgid "Export as:" msgstr "Exporter en :" +#: templates/ishtar/sheet_administrativeact.html:10 #: templates/ishtar/sheet_operation.html:24 msgid "OpenOffice.org file" msgstr "Fichier OpenOffice.org" +#: templates/ishtar/sheet_administrativeact.html:10 #: templates/ishtar/sheet_operation.html:24 msgid "PDF file" msgstr "Fichier PDF" -#: templates/ishtar/sheet_operation.html:26 -msgid "Modify" -msgstr "Modifier" - -#: templates/ishtar/sheet_operation.html:29 -msgid "Name:" -msgstr "Nom :" - +#: templates/ishtar/sheet_administrativeact.html:12 #: templates/ishtar/sheet_operation.html:30 msgid "Year:" msgstr "Année :" +#: templates/ishtar/sheet_administrativeact.html:13 #: templates/ishtar/sheet_operation.html:31 msgid "Numerical reference:" msgstr "Identifiant numérique :" +#: templates/ishtar/sheet_administrativeact.html:14 +#: templates/ishtar/sheet_operation.html:47 +msgid "Type:" +msgstr "Type :" + +#: templates/ishtar/sheet_administrativeact.html:15 +msgid "Signature date:" +msgstr "Date de signature :" + +#: templates/ishtar/sheet_administrativeact.html:16 +msgid "In charge:" +msgstr "Responsable :" + +#: templates/ishtar/sheet_administrativeact.html:17 +msgid "Archaeological preventive operator:" +msgstr "Opérateur d'archéologie préventive :" + +#: templates/ishtar/sheet_administrativeact.html:19 +#: templates/ishtar/sheet_operation.html:56 +msgid "Associated file:" +msgstr "Dossier archéologique associé :" + +#: templates/ishtar/sheet_administrativeact.html:20 +msgid "Associated operation:" +msgstr "Opération associée :" + +#: templates/ishtar/sheet_administrativeact.html:22 +#: templates/ishtar/sheet_operation.html:48 +msgid "Surface:" +msgstr "Surface :" + +#: templates/ishtar/sheet_administrativeact.html:23 +#: templates/ishtar/sheet_operation.html:37 +msgid "Created by:" +msgstr "Créé par :" + +#: templates/ishtar/sheet_operation.html:14 +msgid "Previous version" +msgstr "Version précédente" + +#: templates/ishtar/sheet_operation.html:18 +msgid "Are you sure to rollback to this version?" +msgstr "Êtes vous sûr de vouloir revenir à cette version ?" + +#: templates/ishtar/sheet_operation.html:19 +msgid "Next version" +msgstr "Version suivante" + +#: templates/ishtar/sheet_operation.html:26 +msgid "Modify" +msgstr "Modifier" + +#: templates/ishtar/sheet_operation.html:29 +msgid "Name:" +msgstr "Nom :" + #: templates/ishtar/sheet_operation.html:33 msgid "Patriarche OA code:" msgstr "Code d'opération Patriarche" @@ -728,231 +775,219 @@ msgstr "Code d'opération Patriarche non renseigné !" msgid "Edition date:" msgstr "Date d'édition :" -#: templates/ishtar/sheet_operation.html:38 +#: templates/ishtar/sheet_operation.html:39 msgid "Begining date:" msgstr "Date de début :" -#: templates/ishtar/sheet_operation.html:39 +#: templates/ishtar/sheet_operation.html:40 msgid "Excavation end date:" msgstr "Date de fin de chantier :" -#: templates/ishtar/sheet_operation.html:41 +#: templates/ishtar/sheet_operation.html:42 msgid "Head scientist:" msgstr "Responsable scientifique :" -#: templates/ishtar/sheet_operation.html:42 +#: templates/ishtar/sheet_operation.html:43 msgid "State:" msgstr "État :" -#: templates/ishtar/sheet_operation.html:42 +#: templates/ishtar/sheet_operation.html:43 msgid "Active file" msgstr "Dossier archéologique actif" -#: templates/ishtar/sheet_operation.html:43 +#: templates/ishtar/sheet_operation.html:44 msgid "Closed operation" msgstr "Opération fermée" -#: templates/ishtar/sheet_operation.html:44 +#: templates/ishtar/sheet_operation.html:45 msgid "Closing date:" msgstr "Date de clotûre :" -#: templates/ishtar/sheet_operation.html:44 +#: templates/ishtar/sheet_operation.html:45 msgid "by" msgstr "par" -#: templates/ishtar/sheet_operation.html:46 -msgid "Type:" -msgstr "Type :" - -#: templates/ishtar/sheet_operation.html:47 -msgid "Surface:" -msgstr "Surface :" - -#: templates/ishtar/sheet_operation.html:48 +#: templates/ishtar/sheet_operation.html:49 msgid "Cost:" msgstr "Coût :" -#: templates/ishtar/sheet_operation.html:49 +#: templates/ishtar/sheet_operation.html:50 msgid "Duration:" msgstr "Durée :" -#: templates/ishtar/sheet_operation.html:49 +#: templates/ishtar/sheet_operation.html:50 msgid "Day" msgstr "Jour" -#: templates/ishtar/sheet_operation.html:51 +#: templates/ishtar/sheet_operation.html:52 msgid "Remains:" msgstr "Vestiges :" -#: templates/ishtar/sheet_operation.html:52 +#: templates/ishtar/sheet_operation.html:53 msgid "Periods:" msgstr "Périodes :" -#: templates/ishtar/sheet_operation.html:55 -msgid "Associated file:" -msgstr "Dossier archéologique associé :" - -#: templates/ishtar/sheet_operation.html:58 +#: templates/ishtar/sheet_operation.html:59 msgid "Town planning service:" msgstr "Service instructeur :" -#: templates/ishtar/sheet_operation.html:59 +#: templates/ishtar/sheet_operation.html:60 msgid "Permit type:" msgstr "Type de permis :" -#: templates/ishtar/sheet_operation.html:60 +#: templates/ishtar/sheet_operation.html:61 msgid "Permit reference:" msgstr "Référence du permis :" -#: templates/ishtar/sheet_operation.html:61 +#: templates/ishtar/sheet_operation.html:62 msgid "General contractor organisation:" msgstr "Organisation de l'aménageur :" -#: templates/ishtar/sheet_operation.html:62 +#: templates/ishtar/sheet_operation.html:63 msgid "General contractor:" msgstr "Aménageur :" -#: templates/ishtar/sheet_operation.html:66 +#: templates/ishtar/sheet_operation.html:67 msgid "Comment:" msgstr "Commentaire :" -#: templates/ishtar/sheet_operation.html:68 +#: templates/ishtar/sheet_operation.html:69 msgid "Localisation" msgstr "Localisation" -#: templates/ishtar/sheet_operation.html:69 +#: templates/ishtar/sheet_operation.html:70 msgid "Towns:" msgstr "Communes :" -#: templates/ishtar/sheet_operation.html:71 +#: templates/ishtar/sheet_operation.html:72 msgid "Main address:" msgstr "Adresse des terrains :" -#: templates/ishtar/sheet_operation.html:72 +#: templates/ishtar/sheet_operation.html:73 msgid "Complement:" msgstr "Complément :" -#: templates/ishtar/sheet_operation.html:73 +#: templates/ishtar/sheet_operation.html:74 msgid "Postal code:" msgstr "Code postal :" -#: templates/ishtar/sheet_operation.html:81 +#: templates/ishtar/sheet_operation.html:82 msgid "Associated parcels" msgstr "Parcelles associées" -#: templates/ishtar/sheet_operation.html:83 +#: templates/ishtar/sheet_operation.html:84 msgid "Commune" msgstr "Commune" -#: templates/ishtar/sheet_operation.html:98 +#: templates/ishtar/sheet_operation.html:99 msgid "No parcel associated to this operation" msgstr "Pas de parcelle associée à cette opération" -#: templates/ishtar/sheet_operation.html:106 -msgid "Ref." -msgstr "Réf." - -#: templates/ishtar/sheet_operation.html:107 -#: templates/ishtar/sheet_operation.html:129 -#: templates/ishtar/dashboards/dashboard_operation.html:82 -msgid "Type" -msgstr "Type" - -#: templates/ishtar/sheet_operation.html:108 -msgid "Date" -msgstr "Date" - -#: templates/ishtar/sheet_operation.html:118 -msgid "No acts associated to this operation" -msgstr "Pas d'acte associé à cette opération" +#: templates/ishtar/sheet_operation.html:103 +msgid "Administrativ acts" +msgstr "Actes administratifs" -#: templates/ishtar/sheet_operation.html:122 +#: templates/ishtar/sheet_operation.html:106 msgid "Document from this operation" msgstr "Documents de cette opération" -#: templates/ishtar/sheet_operation.html:126 +#: templates/ishtar/sheet_operation.html:110 msgid "Context records" msgstr "Unité d'Enregistrement" -#: templates/ishtar/sheet_operation.html:128 +#: templates/ishtar/sheet_operation.html:112 msgid "ID" msgstr "Identifiant" -#: templates/ishtar/sheet_operation.html:130 +#: templates/ishtar/sheet_operation.html:113 +#: templates/ishtar/blocks/window_tables/administrativacts.html:6 +#: templates/ishtar/dashboards/dashboard_operation.html:82 +msgid "Type" +msgstr "Type" + +#: templates/ishtar/sheet_operation.html:114 msgid "Chronology" msgstr "Chronologie" -#: templates/ishtar/sheet_operation.html:131 -#: templates/ishtar/sheet_operation.html:161 +#: templates/ishtar/sheet_operation.html:115 +#: templates/ishtar/sheet_operation.html:145 msgid "Description" msgstr "Description" -#: templates/ishtar/sheet_operation.html:142 -#: templates/ishtar/sheet_operation.html:185 +#: templates/ishtar/sheet_operation.html:126 +#: templates/ishtar/sheet_operation.html:169 msgid "Details" msgstr "Détails" -#: templates/ishtar/sheet_operation.html:145 +#: templates/ishtar/sheet_operation.html:129 msgid "No context record associated to this operation" msgstr "Pas d'Unité d'Enregistrement associée à cette opération" -#: templates/ishtar/sheet_operation.html:149 +#: templates/ishtar/sheet_operation.html:133 msgid "Documents from associated context records" msgstr "Documents d'Unité d'Enregistrement associés" -#: templates/ishtar/sheet_operation.html:154 +#: templates/ishtar/sheet_operation.html:138 msgid "Finds" msgstr "Mobilier" -#: templates/ishtar/sheet_operation.html:156 +#: templates/ishtar/sheet_operation.html:140 msgid "Complete Id" msgstr "Id complet" -#: templates/ishtar/sheet_operation.html:157 +#: templates/ishtar/sheet_operation.html:141 msgid "Short Id" msgstr "Id court" -#: templates/ishtar/sheet_operation.html:158 +#: templates/ishtar/sheet_operation.html:142 msgid "Material type" msgstr "Type de matériau" -#: templates/ishtar/sheet_operation.html:159 +#: templates/ishtar/sheet_operation.html:143 msgctxt "short" msgid "Context record" msgstr "UE" -#: templates/ishtar/sheet_operation.html:162 +#: templates/ishtar/sheet_operation.html:146 msgid "Weight" msgstr "Poids" -#: templates/ishtar/sheet_operation.html:163 +#: templates/ishtar/sheet_operation.html:147 msgid "Numbers" msgstr "Nombre" -#: templates/ishtar/sheet_operation.html:165 +#: templates/ishtar/sheet_operation.html:149 msgid "Container ref." msgstr "Réf. du contenant" -#: templates/ishtar/sheet_operation.html:166 +#: templates/ishtar/sheet_operation.html:150 msgid "Warehouse" msgstr "Dépôt" -#: templates/ishtar/sheet_operation.html:189 +#: templates/ishtar/sheet_operation.html:173 msgid "No find associated to context record" msgstr "Pas de mobilier associé à cette Unité d'Enregistrement" -#: templates/ishtar/sheet_operation.html:192 +#: templates/ishtar/sheet_operation.html:176 msgid "No find associated to parcel" msgstr "Pas de mobilier associé à cette parcelle" -#: templates/ishtar/sheet_operation.html:192 +#: templates/ishtar/sheet_operation.html:176 msgid "(no context record)" msgstr "(pas d'Unité d'Enregistrement)" -#: templates/ishtar/sheet_operation.html:197 +#: templates/ishtar/sheet_operation.html:181 msgid "Documents from associated finds" msgstr "Documents concernant le mobilier associé" +#: templates/ishtar/blocks/window_tables/administrativacts.html:7 +msgid "Date" +msgstr "Date" + +#: templates/ishtar/blocks/window_tables/administrativacts.html:16 +msgid "No administrative act associated" +msgstr "Aucun acte administratif associé" + #: templates/ishtar/dashboards/dashboard_operation.html:11 msgid "Global informations" msgstr "Informations générales" @@ -1184,6 +1219,9 @@ msgstr "Coût FNAP" msgid "Main towns by cost" msgstr "Principales communes par coût" +#~ msgid "No acts associated to this operation" +#~ msgstr "Pas d'acte associé à cette opération" + #~ msgid "Scientific documentation" #~ msgstr "Documentation scientifique" diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index bbffe023f..82567842f 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -391,10 +391,11 @@ class ActType(GeneralType): ordering = ('label',) class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): - TABLE_COLS = ['year', 'index', 'act_type', 'signature_date', + TABLE_COLS = ['full_ref', 'act_type', 'signature_date', 'associated_file', 'operation'] - TABLE_COLS_FILE = ['act_type', 'associated_file', 'associated_file.towns',] - TABLE_COLS_OPE = ['act_type', 'operation', 'operation.towns'] + TABLE_COLS_FILE = ['full_ref', 'act_type', 'associated_file', + 'associated_file.towns',] + TABLE_COLS_OPE = ['full_ref', 'act_type', 'operation', 'operation.towns'] act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type")) in_charge = models.ForeignKey(Person, blank=True, null=True, related_name='+', verbose_name=_(u"Person in charge of the operation")) @@ -442,6 +443,18 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): for item in [self.operation, self.associated_file, self.act_object] if item]) + full_ref_lbl = _(u"Ref.") + @property + def full_ref(self): + lbl = [] + if self.year: + lbl.append(unicode(self.year)) + if self.index: + lbl.append(u"n°%d" %self.index) + if settings.COUNTRY == 'fr' and self.ref_sra: + lbl.append(u"[%s]" % self.ref_sra) + return u" ".join(lbl) + @property def year(self): if not self.signature_date: @@ -485,7 +498,7 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter): def save(self, *args, **kwargs): if not self.act_type.indexed or not self.signature_date: - super(AdministrativeAct, self).save(*args, **kwargs) + return super(AdministrativeAct, self).save(*args, **kwargs) year = self.signature_date.year if not self.index: c_index = 1 diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html new file mode 100644 index 000000000..9feb51e72 --- /dev/null +++ b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html @@ -0,0 +1,18 @@ +{% load i18n %} +<table> + <caption>{{caption}}</caption> + <tr> + <th>{% trans "Ref." %}</th> + <th>{% trans "Type" %}</th> + <th>{% trans "Date" %}</th> + </tr> + {% for act in data %} + <tr> + <td>{{act.full_ref}}</td> + <td class='string'>{{act.act_type}}</td> + <td>{{act.signature_date}}</td> + </tr> + {% empty %} + <tr><td colspan="4" class='no_items'>{% trans "No administrative act associated" %}</td></tr> + {% endfor %} +</table> diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact.html b/archaeological_operations/templates/ishtar/sheet_administrativeact.html index da80f6747..2cceb0222 100644 --- a/archaeological_operations/templates/ishtar/sheet_administrativeact.html +++ b/archaeological_operations/templates/ishtar/sheet_administrativeact.html @@ -11,6 +11,7 @@ <h3>{% trans "General"%}</h3> <p><label>{%trans "Year:"%}</label> <span class='value strong'>{{ item.year }}</span></p> {% if item.index %}<p><label>{%trans "Numerical reference:"%}</label> <span class='value strong'>{{ item.index }}</span></p>{% endif %} +{% if item.ref_sra %}<p><label>{%trans "Internal reference:"%}</label> <span class='value strong'>{{ item.ref_sra }}</span></p>{% endif %} <p><label>{%trans "Type:"%}</label> <span class='value'>{{ item.act_type }}</span></p> <p><label>{%trans "Signature date:"%}</label> <span class='value'>{{ item.signature_date }}</span></p> <p><label>{%trans "In charge:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p> diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 9d9b845e3..b403d29df 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -1,5 +1,5 @@ {% extends "ishtar/sheet.html" %} -{% load i18n window_tables %} +{% load i18n window_tables window_ope_tables %} {% block head_sheet %} {{block.super}} @@ -100,25 +100,8 @@ {% endfor %} </table> -<table> - <caption>{%trans "Administrative acts"%}</caption> - <tr> - <th>{% trans "Year" %}</th> - <th>{% trans "Ref." %}</th> - <th>{% trans "Type" %}</th> - <th>{% trans "Date" %}</th> - </tr> - {% for act in item.administrative_act.all %} - <tr> - <td>{{act.signature_date.year}}</td> - <td>{% if act.ref_sra %}{{act.ref_sra}}{% endif %}</td> - <td class='string'>{{act.act_type}}</td> - <td class="string">{{act.signature_date}}</td> - </tr> - {% empty %} - <tr><td colspan="4" class='no_items'>{% trans "No acts associated to this operation" %}</td></tr> - {% endfor %} -</table> +{% trans "Administrativ acts" as administrativeacts_label %} +{% table_administrativact administrativeacts_label item.administrative_act.all %} {% trans "Document from this operation" as operation_docs %} {% if item.source.count %} {% table_document operation_docs item.source.all %}{% endif %} @@ -140,7 +123,7 @@ <td class='string'>{{ context_record.datings.all|join:", " }}</td>{# periods ?#} <td class='string'>{{ context_record.description }}</td> <td class='string'>{{ context_record.parcel.section }} - {{context_record.parcel.parcel_number}}</td> - <td class='link'><a href="#" onclick='load_window("{%url show-contextrecord context_record.pk ''%}")'>{% trans "Details" %}</a></td> + <td class='link'><a href="#" class='display_details' onclick='load_window("{%url show-contextrecord context_record.pk ''%}")'>{% trans "Details" %}</a></td> </tr> {% empty %} <tr><td colspan="6" class='no_items'>{% trans "No context record associated to this operation" %}</td></tr> @@ -183,8 +166,8 @@ <td class="ref">{{ context_record.parcel.short_label }}</td> <td class='ref'>{{ find.get_last_find.container.reference|default:""}}</td> <td class='string'>{{ find.get_last_find.container.location|default:""}}</td> - <td class='link'><a href="#">{% trans "Details" %}</a></td> - {#<a href="#" onclick='load_window("{% url show-find find.pk%}");'>{%trans "Details"%}</a></td>#} + <td class='link'><a class='display_details' href="#">{% trans "Details" %}</a></td> + {#<a href="#" class='display_details' onclick='load_window("{% url show-find find.pk%}");'>{%trans "Details"%}</a></td>#} </tr> {% empty %} <tr><td colspan="9" class='no_items'>{% trans "No find associated to context record" %} {{context_record.short_label}}</td></tr> diff --git a/archaeological_operations/templatetags/__init__.py b/archaeological_operations/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archaeological_operations/templatetags/__init__.py diff --git a/archaeological_operations/templatetags/window_ope_tables.py b/archaeological_operations/templatetags/window_ope_tables.py new file mode 100644 index 000000000..5576fe32d --- /dev/null +++ b/archaeological_operations/templatetags/window_ope_tables.py @@ -0,0 +1,10 @@ +from django import template +from django.utils.translation import ugettext as _ +import re + +register = template.Library() + +@register.inclusion_tag('ishtar/blocks/window_tables/administrativacts.html') +def table_administrativact(caption, data): + return {'caption':caption, 'data':data} + diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index 26dc5b3d0..17f232455 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -83,6 +83,12 @@ urlpatterns += patterns('archaeological_operations.views', kwargs={'full':True}), url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_administrativeact', name='show-administrativeact'), + # allow specialization for operations + url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', + 'show_administrativeact', name='show-administrativeactop'), + # allow specialization for files + url(r'show-administrativeact(?:/(?P<pk>.+))?/(?P<type>.+)?$', + 'show_administrativeact', name='show-administrativeactfile'), url(r'generatedoc-administrativeactop/(?P<pk>.+)?/(?P<template_pk>.+)?$', 'generatedoc_administrativeactop', name='generatedoc-administrativeactop'), diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 7e5a64ab4..a957fe8c1 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -148,12 +148,14 @@ get_administrativeactop = get_item(models.AdministrativeAct, 'get_administrativeactop', 'administrativeactop', extra_request_keys={'associated_file__towns':'associated_file__towns__pk', 'operation__towns':'operation__towns__pk', - 'act_type__intented_to':'act_type__intented_to'}, + 'act_type__intented_to':'act_type__intented_to', + 'year':'signature_date__year', + }, relative_session_names={'operation':'operation__pk'}) get_administrativeact = get_item(models.AdministrativeAct, 'get_administrativeact', 'administrativeact', - extra_request_keys={}) + extra_request_keys={'year':'signature_date__year',}) show_administrativeact = show_item(models.AdministrativeAct, 'administrativeact') def dashboard_operation(request, *args, **kwargs): diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index d816cf9aa..6d25812eb 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -323,7 +323,7 @@ class OperationAdministrativeActWizard(OperationWizard): r = r[k] else: break - if level == len(keys): # the whole tree as been traversed + if level == len(keys): # the whole list as been traversed # redirect to the generated doc dct['redirect'] = reverse('generatedoc-administrativeactop', args=[admact.pk, r[0]]) |