Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SUD Éducation
Cartable
Commits
96de4166
Commit
96de4166
authored
3 years ago
by
Bastien Ho
👽
Browse files
Options
Download
Email Patches
Plain Diff
(un)Install custom data
parent
3ec71b26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Cartable/Upgrader/Install.php
+197
-0
CRM/Cartable/Upgrader/Install.php
CRM/Cartable/Upgrader/Uninstall.php
+55
-0
CRM/Cartable/Upgrader/Uninstall.php
with
252 additions
and
0 deletions
+252
-0
CRM/Cartable/Upgrader/Install.php
+
197
-
0
View file @
96de4166
<?php
use
CRM_Cartable_ExtensionUtil
as
E
;
civicrm_api3
(
'ContactType'
,
'create'
,
[
'name'
=>
"SyndicatSUD"
,
'label'
=>
"Syndicat SUD"
,
'is_reserved'
=>
1
,
'is_active'
=>
1
,
'parent_id'
=>
'Organization'
,
]);
civicrm_api3
(
'CustomGroup'
,
'create'
,
[
'title'
=>
"Données de Syndicat"
,
'name'
=>
'DonneesSyndicat'
,
'extends'
=>
[
'Organization'
,
'SyndicatSUD'
],
'column_name'
=>
'donnees_syndicat'
,
'weight'
=>
1
,
'collapse_display'
=>
0
,
'is_active'
=>
1
,
'style'
=>
"Inline"
,
'api.CustomField.create'
=>
[
[
'label'
=>
'Département(s) couvert(s)'
,
'name'
=>
'Departements'
,
'column_name'
=>
'departements'
,
'data_type'
=>
'StateProvince'
,
'html_type'
=>
'Multi-Select State/Province'
,
'weight'
=>
4
,
'is_required'
=>
1
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
// Banque
[
'label'
=>
'Banque'
,
'name'
=>
'Banque'
,
'column_name'
=>
'banque'
,
'html_type'
=>
'Text'
,
'weight'
=>
7
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
[
'label'
=>
'ICS'
,
'name'
=>
'ICS'
,
'column_name'
=>
'ics'
,
'html_type'
=>
'Text'
,
'help_pre'
=>
'Identifiant Créancier SEPA'
,
'weight'
=>
8
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
[
'label'
=>
'IBAN'
,
'name'
=>
'IBAN'
,
'column_name'
=>
'iban'
,
'html_type'
=>
'Text'
,
'weight'
=>
9
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
[
'label'
=>
'BIC/Swift'
,
'name'
=>
'BIC'
,
'column_name'
=>
'bic'
,
'html_type'
=>
'Text'
,
'weight'
=>
10
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
[
'label'
=>
'Ordre pour les chèques'
,
'name'
=>
'Ordre_Pour_Cheques'
,
'column_name'
=>
'ordre_pour_cheques'
,
'html_type'
=>
'Text'
,
'weight'
=>
11
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
],
]);
civicrm_api3
(
'CustomGroup'
,
'create'
,
[
'title'
=>
"Données de particulier"
,
'name'
=>
'DonneesParticulier'
,
'extends'
=>
[
'Individual'
],
'column_name'
=>
'donnees_particulier'
,
'weight'
=>
1
,
'collapse_display'
=>
0
,
'is_active'
=>
1
,
'style'
=>
"Inline"
,
'api.CustomField.create'
=>
[
[
'label'
=>
'Date de première adhésion'
,
'name'
=>
'DateADH'
,
'column_name'
=>
'date_adh'
,
'data_type'
=>
'Date'
,
'html_type'
=>
'Select Date'
,
'start_date_years'
=>
'20'
,
'end_date_years'
=>
'2'
,
'date_format'
=>
'dd/mm/yy'
,
'weight'
=>
1
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
[
'label'
=>
'Statut'
,
'name'
=>
'Statut'
,
'column_name'
=>
'statut'
,
'html_type'
=>
'Select'
,
'weight'
=>
2
,
'is_required'
=>
1
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
'option_values'
=>
[
"titulaire"
=>
"Fonctionnaire titulaire"
,
"stagiaire"
=>
"Fonctionnaire stagiaire"
,
"retraite"
=>
"Retraité·e"
,
"cdd"
=>
"Non titulaire - CDD"
,
"cdi"
=>
"Non titulaire - CDI"
,
],
],
[
'label'
=>
'Corps'
,
'name'
=>
'Corps'
,
'column_name'
=>
'corps'
,
'html_type'
=>
'Select'
,
'weight'
=>
3
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
'option_values'
=>
[
"Adjaenes"
=>
"Adjaenes"
,
"Saenes"
=>
"Saenes"
,
"Biatss"
=>
"Biatss"
,
"Biblio"
=>
"Biblio"
,
"MCF"
=>
"MCF"
,
"PU"
=>
"PU"
,
"PsyEN"
=>
"PsyEN"
,
"IGR/IGA"
=>
"IGR/IGA"
,
"PE"
=>
"PE"
,
"Certifié·e"
=>
"Certifié·e"
,
"Agrégé·e"
=>
"Agrégé·e"
,
],
],
[
'label'
=>
'Type de poste'
,
'name'
=>
'TypeDePoste'
,
'column_name'
=>
'type_de_poste'
,
'html_type'
=>
'Select'
,
'weight'
=>
3
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
'option_values'
=>
[
"AED"
=>
"AED"
,
"AESH"
=>
"AESH"
,
"CPE"
=>
"CPE"
,
"Administratif·ve"
=>
"Administratif·ve"
,
"Chercheur·euse"
=>
"Chercheur·euse"
,
"Doctorat / Post-doc"
=>
"Doctorat / Post-doc"
,
"ATER"
=>
"ATER"
,
"Technique"
=>
"Technique"
,
"Social / santé"
=>
"Social / santé"
,
"Enseignant·e"
=>
"Enseignant·e"
,
"Autre"
=>
"Autre"
,
],
],
[
'label'
=>
'Discipline'
,
'name'
=>
'Discipline'
,
'column_name'
=>
'discipline'
,
'html_type'
=>
'Autocomplete-Select'
,
'weight'
=>
5
,
'is_required'
=>
0
,
'is_searchable'
=>
1
,
'is_active'
=>
1
,
'is_reserved'
=>
1
,
],
],
]);
This diff is collapsed.
Click to expand it.
CRM/Cartable/Upgrader/Uninstall.php
+
55
-
0
View file @
96de4166
<?php
function
delete_entities
(
string
$entity
,
array
$names
){
try
{
$result
=
civicrm_api3
(
$entity
,
'get'
,
[
'return'
=>
[
'id'
],
'name'
=>
[
'IN'
=>
$names
,
],
'sequential'
=>
1
,
]);
if
(
$result
[
'count'
]){
foreach
(
$result
[
'values'
]
as
$item
){
civicrm_api3
(
$entity
,
'delete'
,
[
'id'
=>
$item
[
'id'
],
]);
}
}
return
true
;
}
catch
(
CiviCRM_API3_Exception
$e
){
error_log
(
"DEBUG:
\t
Uninstall
{
$entity
}
\t
"
.
json_encode
(
$e
->
getMessage
()));
return
false
;
}
}
delete_entities
(
'CustomField'
,
[
"Departements"
,
"Banque"
,
"ICS"
,
"IBAN"
,
"BIC"
,
"Ordre_Pour_Cheques"
,
"DateADH"
,
"Statut"
,
"Corps"
,
"TypeDePoste"
,
"Discipline"
,
]
);
delete_entities
(
'CustomGroup'
,
[
"DonneesSyndicat"
,
"DonneesParticulier"
,
]
);
delete_entities
(
'ContactType'
,
[
"SyndicatSUD"
,
]
);
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment