function formulaires_configurer_souscription_charger_dist() {
- $valeurs = array('adhesion_montants' => montants_array2str(lire_config("souscription/adhesion_montants")),
+ $valeurs = array('adhesion_montants' => lire_config("souscription/adhesion_montants"),
'adhesion_type_saisie' => lire_config("souscription/adhesion_type_saisie"),
"adhesion_activer" => lire_config("souscription/adhesion_activer"),
"adhesion_montants_description" => lire_config("souscription/adhesion_montants_description"),
"adhesion_montants_label" => lire_config("souscription/adhesion_montants_label"),
- 'don_montants' => montants_array2str(lire_config("souscription/don_montants")),
+ 'don_montants' => lire_config("souscription/don_montants"),
'don_type_saisie' => lire_config("souscription/don_type_saisie"),
"don_activer" => lire_config("souscription/don_activer"),
"don_montants_description" => lire_config("souscription/don_montants_description"),
function formulaires_configurer_souscription_traiter_dist() {
- ecrire_config("souscription/adhesion_montants", montants_str2array(_request("adhesion_montants")));
+ ecrire_config("souscription/adhesion_montants", _request("adhesion_montants"));
ecrire_config("souscription/adhesion_type_saisie", _request("adhesion_type_saisie"));
ecrire_config("souscription/adhesion_activer", _request("adhesion_activer"));
ecrire_config("souscription/adhesion_montants_description", _request("adhesion_montants_description"));
ecrire_config("souscription/adhesion_montants_label", _request("adhesion_montants_label"));
- ecrire_config("souscription/don_montants", montants_str2array(_request("don_montants")));
+ ecrire_config("souscription/don_montants", _request("don_montants"));
ecrire_config("souscription/don_type_saisie", _request("don_type_saisie"));
ecrire_config("souscription/don_activer", _request("don_activer"));
ecrire_config("souscription/don_montants_description", _request("don_montants_description"));
}
else {
$montant_type = $campagne['type_saisie'];
- $montant_datas = montants_str2array($campagne['montants']);
+ $montant_datas = $campagne['montants'];
}
$montant_label = lire_config("souscription/${type}_montants_label", _T('souscription:label_montant'));
'telephone' => '',
'id_souscription_campagne' => $id_souscription_campagne,
'type_souscription' => $type,
- 'montant_datas' => $montant_datas,
+ 'montant_datas' => montants_str2array($montant_datas),
'montant_type' => $montant_type,
'montant_label' => $montant_label,
'montant_explication' => $montant_explication
compatibilite="[3.0.5;3.0.*]"
logo=""
documentation=""
- schema="0.5">
+ schema="0.6">
<nom>Souscription</nom>
<auteur lien='http://olivier.miskin.fr'>Olivier Tétard</auteur>
array('sql_alter', "TABLE spip_souscription_campagnes ADD type_saisie varchar(255) NOT NULL DEFAULT ''"),
array('sql_alter', "TABLE spip_souscription_campagnes ADD montants text NOT NULL DEFAULT ''"));
+ $maj['0.6'] = array(array('maj_configuration_montants'));
+
include_spip('base/upgrade');
maj_plugin($nom_meta_base_version, $version_cible, $maj);
}
+/* Fonction permettant de changer le format des montants globaux pour
+ * le plugin souscription. Les montants étaient stockés sous la forme
+ * d'un array() sérialisés. Il sont désormais stockés dans leur format
+ * chaine de caractères. */
+function maj_configuration_montants() {
+ foreach(array('adhesion_montants', 'don_montants') as $cfg) {
+ $cle_cfg = "souscription/${cfg}";
+
+ $montants_orig = lire_config($cle_cfg);
+
+ $montants = "";
+ foreach($montants_orig as $prix => $description) {
+ $montants .= $prix . "|" . $description . "\n";
+ }
+
+ ecrire_config($cle_cfg, $montants);
+ }
+}
+
/**
* Fonction de désinstallation du plugin Souscription.
*
return $p;
}
-function montants_array2str($array) {
- include_spip('inc/saisies');
-
- $montants = "";
- foreach($array as $prix => $description) {
- $montants .= $prix . "|" . $description . "\n";
- }
-
- return $montants;
-}
-
function montants_str2array($str) {
include_spip('inc/saisies');