-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* suppression du badge de build status de Travis CI * Rewrite tests to be more demanding * Fix test and bahevior when there is no CodNatJurBenefCA to anonymize the LibOrgaBenef * bump xmldom * Change occultation string to something more generic Also, make it a argument to the anonymize function with a default value * PJRef > NomPJ elements are anonymized * Occultation of all Champ_Editeurs * anonymise all <Proprietaire>s in all <MEMBREASA>s * 1.2.0
- Loading branch information
1 parent
07eb4f2
commit 2302188
Showing
5 changed files
with
130 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,47 @@ | ||
const ANONYMIZED_NAME = "Nom anonymisé"; | ||
|
||
// http://odm-budgetaire.org/doc-schema/CommunAnnexe_xsd_Complex_Type_ATCodNatJurBenef.html#ATCodNatJurBenef_V | ||
const CodNatJurBenefPersonnesPhysiques = 'P3'; | ||
|
||
export default function(doc){ | ||
export default function(doc, OCCULTATION_STRING = "Occultation Article L311-7 CRPA"){ | ||
const concours = Array.from(doc.getElementsByTagName('CONCOURS')); | ||
|
||
concours.forEach(c => { | ||
const natJurEl = c.getElementsByTagName('CodNatJurBenefCA')[0]; | ||
|
||
if(natJurEl && natJurEl.getAttribute('V') === CodNatJurBenefPersonnesPhysiques){ | ||
if(!natJurEl || natJurEl.getAttribute('V') === CodNatJurBenefPersonnesPhysiques){ | ||
const libOrgaBenef = c.getElementsByTagName('LibOrgaBenef')[0]; | ||
libOrgaBenef.setAttribute('V', ANONYMIZED_NAME); | ||
libOrgaBenef.setAttribute('V', OCCULTATION_STRING); | ||
} | ||
}) | ||
|
||
const prets = Array.from(doc.getElementsByTagName('PRET')) | ||
|
||
prets.forEach(c => { | ||
const nomBenefPret = c.getElementsByTagName('NomBenefPret')[0]; | ||
|
||
if(nomBenefPret){ | ||
nomBenefPret.setAttribute('V', ANONYMIZED_NAME); | ||
nomBenefPret.setAttribute('V', OCCULTATION_STRING); | ||
} | ||
}) | ||
|
||
const BlocBudget = doc.getElementsByTagName('BlocBudget')[0]; | ||
const PJRefs = Array.from(BlocBudget.getElementsByTagName('PJRef')); | ||
PJRefs.forEach(pjref => { | ||
const NomPJ = pjref.getElementsByTagName('NomPJ')[0]; | ||
|
||
if(NomPJ){ | ||
NomPJ.setAttribute('V', OCCULTATION_STRING); | ||
} | ||
}) | ||
|
||
const Champ_Editeurs = Array.from(doc.getElementsByTagName('Champ_Editeur')); | ||
Champ_Editeurs.forEach(ce => { | ||
ce.setAttribute('V', OCCULTATION_STRING); | ||
}) | ||
|
||
const MEMBREASAs = Array.from(doc.getElementsByTagName('MEMBREASA')) | ||
MEMBREASAs.forEach(masa => { | ||
const Proprietaire = masa.getElementsByTagName('Proprietaire')[0]; | ||
|
||
if(Proprietaire){ | ||
Proprietaire.setAttribute('V', OCCULTATION_STRING); | ||
} | ||
}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters