Module:Infobox/Fonctions/Organisation

Cha vient éd Wikipedia

La documentation pour ce module peut être créée à Module:Infobox/Fonctions/Organisation/doc

-- Ce module étant utilisé par plus de 10 000 pages, avant de le modifier, testez le avec sa version bac à sable et à l'aide de la page de test (Modèle:Infobox Organisation2/Test).

local p = {}
local localdata = require 'Module:Infobox/Localdata'
local item = localdata.item
local wd = require 'Module:Wikidata'
local linguistic = require 'Module:Linguistique'

-- Recherche le titre le plus approprié en fonction de la forme juridique de l'organisation (P1454)
--   item   : élement wikidata sous la forme Qxxxx
--   plural : booléen pour indiquer le pluriel
local function ownerLabel(item, plural)
    local formeJuridique = wd.stringTable{entity = item, property = 'P1454', displayformat = 'raw', excludespecial = true}
	if wd.isSubclass('Q134161', formeJuridique[1]) then -- société par actions
       if plural then return "Actionnaires" else return "Actionnaire" end
    else
       if plural then return "Propriétaires" else return "Propriétaire" end
    end
end

function p.membres(id)
	local dir = wd.formatStatements{entity = item, property = 'P1037', defaultlink = '-', numval = 1, displayformat = 'raw'}
	local pres = wd.formatStatements{entity = item, property = 'P488', defaultlink = '-', numval = 1, displayformat = 'raw'}
	local direx = wd.formatStatements{entity = item, property = 'P169', defaultlink = '-', numval = 1, displayformat = 'raw'}
	local secgen = wd.formatStatements{entity = item, property = 'P3975', defaultlink = '-', numval = 1, displayformat = 'raw'}
	
	dir = dir or pres or direx or secgen
	local genredirigeant = wd.getgender(dir) or "m"
	
	local titredirigeant = localdata['titre dirigeant'] or localdata['titre dirigeant1']
	titredirigeant = titredirigeant or wd.formatStatements{
		entity = item,
		property = 'P2388',
		defaultlink = '-',
		labelformat = function(titleid) return wd.genderedlabel(titleid, genredirigeant) end,
		labelformat2 = linguistic.removecomplement
	}
	return {type = 'multi', rows = {
				{type = 'row',
					label = 'Membres',
					value = {'membre', 'membres', 'nombre_membres', 'nombre de membres'},
					wikidata = {property = 'P2124', showdate = true, sorttype = 'inverted', showunit = 'long'}
				},
				{type = 'row',
					label = '[[Bénévolat|Volontaires]]',
					value = {'volontaires', 'bénévoles', 'nombre_volontaires', 'nombre_benevoles'},
					wikidata = {property = 'P6125', showdate = true, sorttype = 'inverted'}
				},
				{type = 'row',
					label = 'Effectif',
					value = {'effectif', 'effectifs', 'employés', 'personnel', 'personnels', 'nombre_employes', 'effectif total'},
					wikidata = {property = 'P1128', showdate = true, sorttype = 'inverted', targetunit = 'employé', showunit = 'long'}
				},
				{type = 'row', label = 'Effectif statutaire', value = 'effectif statutaire'},
				{type = 'row', label = '[[Chercheur]]s', value = {'chercheurs', 'chercheurs statutaires'}},
				{type = 'row', label = 'Chercheurs associés', value = 'chercheurs associés'},
				{type = 'row', label = '[[Doctorant]]s', value = 'doctorants'},
				{type = 'row',
					label = {ms = 'Fondateur', fs = 'Fondatrice', mp = 'Fondateurs', fp = 'Fondatrices', default = 'Fondateur'},
					value = {'fondateur', 'fondatrice', 'fondateurs', 'fondatrices'},
					wikidata = {property = {'P112', 'P170'}}
				},
				{type = 'row',
	                label = {
                            ms      = function() if titredirigeant and not direx then return titredirigeant else return "Président" end end, 
                            fs      = function() if titredirigeant and not direx then return titredirigeant else return "Présidente" end end, 
                            mp      = function() if titredirigeant and not direx then return titredirigeant else return "Présidents" end end, 
                            fp      = function() if titredirigeant and not direx then return titredirigeant else return "Présidentes" end end,
                            default = function() if titredirigeant and not direx then return titredirigeant else return "Président" end end
                            },
				    value = {'président', 'president', 'presidente'},
					wikidata = {property = 'P488', atdate = 'today', showdate = true, precision = 'year'}
				},
            	{type = 'row',
            		label = {
                            ms      = function() return localdata['titre recteur'] or '[[Recteur d\'université|Recteur]]' end, 
                            fs      = function() return localdata['titre recteur'] or '[[Recteur d\'université|Rectrice]]' end, 
                            mp      = function() return localdata['titre recteur'] or '[[Recteur d\'université|Recteurs]]' end, 
                            fp      = function() return localdata['titre recteur'] or '[[Recteur d\'université|Rectrices]]' end,
                            default = function() return localdata['titre recteur'] or '[[Recteur d\'université|Recteur]]' end
                            },
            		value = 'recteur',
            		wikidata = { property = 'P1075', atdate = 'today', showdate = true, precision = 'year' }
            	},		
				{type = 'row',
					label = function()
						return localdata['titre dirigeant'] or localdata['titre dirigeant1'] or localdata['intitulé dirigeant1'] or localdata['intitule_fonction1'] or 'Dirigeant'
					end,
					value = {'dirigeant', 'dirigeant1', 'fonction1'}
				},
				{type = 'row',
					label = function()
						return localdata['titre dirigeant2'] or localdata['intitulé dirigeant2'] or localdata['intitule_fonction2'] or 'Dirigeant'
					end,
					value = {'dirigeant2', 'fonction2'}
				},
				{type = 'row',
					label = function()
						return localdata['titre dirigeant3'] or localdata['intitulé dirigeant3'] or localdata['intitule_fonction3'] or 'Dirigeant'
					end,
					value = {'dirigeant3', 'fonction3'}
				},
				{type = 'row',
					label = function() return localdata['titre dirigeant4'] or localdata['intitulé dirigeant4'] or localdata['intitule_fonction4'] or 'Dirigeant' end,
					value = {'dirigeant4', 'fonction4'}
				},
				{type = 'row',
					label = function() return localdata['titre dirigeant5'] or localdata['intitulé dirigeant5'] or localdata['intitule_fonction5'] or 'Dirigeant' end,
					value = {'dirigeant5', 'fonction5'}
				},
				{type = 'row',
					label = {ms = 'Président d\'honneur', fs = 'Présidente d\'honneur', mp = 'Présidents d\'honneur', fp = 'Présidentes d\'honneur', default = 'Président d\'honneur'},
                    value = {'président d\'honneur', 'président honoraire'},
                    wikidata = {property = {'P2828', 'P3320'}, qualifier = 'P39', qualifiervalue = 'Q1300660', atdate = 'today', showdate = true, precision = 'year'}},
				{type = 'row',
					label = {ms = '[[Vice-président]]', fs = '[[Vice-président]]e', mp = '[[Vice-président]]s', fp = '[[Vice-président]]es', default = '[[Vice-président]]'},
                    value = {'vice-président', 'vice-president', 'vice-présidente', 'vice-presidente', 'vice-présidents', 'vice-presidents'},
                    wikidata = {property = {'P2828', 'P3320'}, qualifier = 'P39', qualifiervalue = 'Q42178', atdate = 'today', showdate = true, precision = 'year'}},
				{type = 'row',
					label = {ms = 'Procureur', fs = 'Procureure', mp = 'Procureurs', fp = 'Procureures', default = 'Procureur'},
                    value = {'procureur', 'procureure', 'procureuse', 'procureures', 'procureuses', 'procureurs'}, 
                    wikidata = {property = {'P1592'}, qualifier = 'P39', atdate = 'today', showdate = true, precision = 'year'}},
				{type = 'row',
					label = function(id)
						if titredirigeant then
							return titredirigeant
						else
							return "Direction"
						end
					end,
            		label = {
                            ms      = function() if titredirigeant then return titredirigeant else return "Directeur" end end, 
                            fs      = function() if titredirigeant then return titredirigeant else return "Directrice" end end, 
                            mp      = function() if titredirigeant then return titredirigeant else return "Directeurs" end end, 
                            fp      = function() if titredirigeant then return titredirigeant else return "Directrices" end end,
                            default = function() if titredirigeant then return titredirigeant else return "Direction" end end
                            },
					value = {'directeur', 'directrice', 'direction', 'directeur_general'}, 
                    wikidata = {property = {'P169', 'P1037'}, atdate = 'today', showdate = true, precision = 'year'},
                    blockers = {'dirigeant', 'dirigeant1', 'fonction1'}},
				{type = 'row',
					label = function(id)
						if titredirigeant and not pres and not direx then
							return titredirigeant
						else
							return "Secrétaire général"
						end
						end,
					plurallabel = 'Secrétaires généraux',
					value = {'secrétaire général', 'secretaire_general', 'secretaire_generale'},
					wikidata = {property = 'P3975', atdate = 'today', showdate = true, precision = 'year'},
					blockers = {'dirigeant', 'dirigeant1', 'fonction1'}
				},
				{type = 'row',
					label = '[[Secrétaire perpétuel]]',
					plurallabel = '[[Secrétaire perpétuel|Secrétaire perpétuels]]',
					value = {'secrétaire perpétuel', 'secretaire perpetuel'},
					wikidata = {
						property = {'P2828', 'P3320'},
						qualifier = {'P39', 'P2868', 'P642'},
						qualifiervalue = 'Q1282146',
						atdate = 'today',
                        showdate = true,
						precision = 'year'
					}
				},
				{type = 'row',
					label = 'Secrétaire',
					plurallabel = 'Secrétaires',
					value = {'secrétaire', 'secretaire'},
					wikidata = {
						property = {'P2828', 'P3320'},
						qualifier = 'P39',
						qualifiervalue = {'Q80687', 'Q836971'},
						atdate = 'today',
                        showdate = true,
						sorttype = 'inverted',
						precision = 'year'
					}
				},
				{type = 'row', label = 'Protecteur', plurallabel = 'Protecteurs', value = 'protecteur'},
				{type = 'row',
					label = {ms = 'Trésorier', fs = 'Trésorière', mp = 'Trésoriers', fp = 'Trésorière', default = 'Trésorier'},
					value = {'trésorier', 'tresorier', 'trésorière', 'tresoriere'},
					wikidata = {property = 'P3320', qualifier = 'P39', qualifiervalue = 'Q388338', atdate = 'today', showdate = true, precision = 'year'}
				},
				{type = 'row',
					label = 'Personnes clés',
					value = {'personne clé', 'pers', 'personnage_clef'},
					wikidata = {
						property = {'P3342', 'P2828', 'P3320', 'P5052'},
						conjtype = 'new line',
						showqualifiers = {'P39', 'P2868', 'P642'},
						qualifconjtype = 'comma',
						excludequalifier = {'P39', 'P2868', 'P642'},
						excludequalifiervalue = {'Q1300660', 'Q42178', 'Q1282146', 'Q80687', 'Q836971', 'Q388338'},
						atdate = 'today'
					}
				},
				{type = 'row',
					label = ownerLabel(item, false),
					plurallabel = ownerLabel(item, true),
					value = 'propriétaire',
					wikidata = {property = 'P127', atdate = "today", showdate = true, sorttype = 'inverted', precision = 'year', showqualifiers = "P1107", qualiftargetunit = 'percent'}},
				{type = 'row',
					label = 'Soutenu par',
					value = {'soutenu par', 'soutien', 'soutiens'},
					wikidata = {property = 'P8001', showdate = true, sorttype = 'inverted'}
				},
			}
		}
end

-- Champs optionnels
function p.custom()
	return {type = 'multi', rows = {
				{type = 'row', label = function() return localdata['option-1'] or 'Option 1' end, value = 'valeur-1'},
				{type = 'row', label = function() return localdata['option-2'] or 'Option 2' end, value = 'valeur-2'},
				{type = 'row', label = function() return localdata['option-3'] or 'Option 3' end, value = 'valeur-3'},
				{type = 'row', label = function() return localdata['option-4'] or 'Option 4' end, value = 'valeur-4'},
				{type = 'row', label = function() return localdata['option-5'] or 'Option 5' end, value = 'valeur-5'},
				{type = 'row', label = function() return localdata['option-6'] or 'Option 6' end, value = 'valeur-6'},
			}
		}
end

-- Identifiants
function p.ids()
	return {type = 'table', title = 'Identifiants',
				rows = 	{
				{type = 'row', label = '[[Répertoire national des associations|RNA]]', value = 'rna', wikidata = {property = {'P3918', 'P6309'}, urlpattern = wd.formatStatements{entity = "P3918", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[Système d\'identification du répertoire des entreprises|SIREN]]', value = 'siren', wikidata = {property = 'P1616', urlpattern = wd.formatStatements{entity = "P1616", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[Système d\'identification du répertoire des établissements|SIRET]]', value = 'siret', wikidata = {property = 'P3215', urlpattern = wd.formatStatements{entity = "P3215", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[TVA dans l\'Union européenne|TVA européenne]]', value = 'tva', wikidata = {property = 'P3608', urlpattern = wd.formatStatements{entity = "P3608", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[Internal Revenue Service|IRS]]', value = 'irs', wikidata = {property = 'P1297', urlpattern = wd.formatStatements{entity = "P1297", property = "P3303", numval = 1}}},
				{type = 'row', label = '[[Securities and Exchange Commission|CIK]]', value = 'cik', wikidata = {property = 'P5531', urlpattern = wd.formatStatements{entity = "P5531", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[Banque-Carrefour des Entreprises|BCE]]', value = 'bce', wikidata = {property = 'P3376', urlpattern = wd.formatStatements{entity = "P3376", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[:en:Central Business Register (Denmark)|CVR]]', value = 'cvr', wikidata = {property = 'P1059', urlpattern = wd.formatStatements{entity = "P1059", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[:hu:Cégjegyzékszámok Magyarországon|Cégjegyzékszám]]', value = 'hun', wikidata = {property = 'P2619', urlpattern = wd.formatStatements{entity = "P2619", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[:en:Companies House|Companies House]]', value = 'companies house', wikidata = {property = 'P2622', urlpattern = wd.formatStatements{entity = "P2622", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[:en:Brønnøysund Register Centre|Registre de Brønnøysund]]', value = 'orgnr', wikidata = {property = 'P2333', urlpattern = wd.formatStatements{entity = "P2333", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[:en:Russian Federal State Statistics Service|OKPO]]', value = 'okpo', wikidata = {property = 'P2391', urlpattern = wd.formatStatements{entity = "P2391", property = "P1630", numval = 1}}},
				{type = 'row', label = '[[OpenCorporates]]', value = 'opencorporates', wikidata = {property = 'P1320', urlpattern = wd.formatStatements{entity = "P1320", property = "P1630", numval = 1}}}, 
                                {type = 'row', label = '[[data.gouv.fr]]', value = 'datagouv', wikidata = {property = {'P3206'}, urlpattern = wd.formatStatements{entity = "P3206", property = "P1630", numval = 1}}},

{type = 'row', label = '[[Unité administrative immatriculée|UAI]]', value = 'uai', wikidata = {property = {'P3202'}, urlpattern = wd.formatStatements{entity = "P3202", property = "P1630", numval = 1}}},

{type = 'row', label = '[[Service-public.fr|Annuaire du service public]]', value = 'servicepublic', wikidata = {property = {'P6671'}, urlpattern = wd.formatStatements{entity = "P6671", property = "P1630", numval = 1}}},

				}
			}
end

return p