Differences From Artifact [89d5daa285]:

To Artifact [c116527d87]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

class Garradin_Config
{
    protected $fields_types = null;
    protected $config = null;
    protected $modified = array();

    protected $allowed_fields_membres = array('passe', 'nom', 'email', 'adresse', 'code_postal',
        'ville', 'pays', 'telephone', 'date_naissance', 'notes');

    static protected $_instance = null;

    static public function getInstance()
    {
        return self::$_instance ?: self::$_instance = new Garradin_Config;








|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php

class Garradin_Config
{
    protected $fields_types = null;
    protected $config = null;
    protected $modified = array();

    protected $allowed_fields_membres = array('nom', 'passe', 'email', 'adresse', 'code_postal',
        'ville', 'pays', 'telephone', 'date_naissance', 'notes');

    static protected $_instance = null;

    static public function getInstance()
    {
        return self::$_instance ?: self::$_instance = new Garradin_Config;
183
184
185
186
187
188
189

190
191
192
193
194
195
196
                    }
                }
                break;
            }
            case 'categorie_cotisations':
            case 'categorie_dons':
            {

                $db = Garradin_DB::getInstance();
                if (!$db->simpleQuerySingle('SELECT 1 FROM compta_categories WHERE id = ?;', false, $value))
                {
                    throw new UserException('Champ '.$key.' : La catégorie comptable numéro \''.$value.'\' ne semble pas exister.');
                }
                break;
            }







>







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
                    }
                }
                break;
            }
            case 'categorie_cotisations':
            case 'categorie_dons':
            {
                return false;
                $db = Garradin_DB::getInstance();
                if (!$db->simpleQuerySingle('SELECT 1 FROM compta_categories WHERE id = ?;', false, $value))
                {
                    throw new UserException('Champ '.$key.' : La catégorie comptable numéro \''.$value.'\' ne semble pas exister.');
                }
                break;
            }
211
212
213
214
215
216
217





218
219
220
221
222
223

224

































225
        {
            $this->config[$key] = $value;
            $this->modified[$key] = true;
        }

        return true;
    }






    public function getConfig()
    {
        return $this->config;
    }
}



































?>







>
>
>
>
>





|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
        {
            $this->config[$key] = $value;
            $this->modified[$key] = true;
        }

        return true;
    }

    public function getFieldsTypes()
    {
        return $this->fields_types;
    }

    public function getConfig()
    {
        return $this->config;
    }

    public function getChampsMembres()
    {
        $out = $this->allowed_fields_membres;
        $out = array_flip($out);

        foreach ($out as $key=>&$value)
        {
            if ($key == 'passe')
                $value = 'Mot de passe';
            elseif ($key == 'email')
                $value = 'Adresse E-Mail';
            elseif ($key == 'adresse')
                $value = 'Adresse postale';
            elseif ($key == 'code_postal')
                $value = 'Code postal';
            elseif ($key == 'ville')
                $value = 'Ville';
            elseif ($key == 'pays')
                $value = 'Pays';
            elseif ($key == 'telephone')
                $value = 'Numéro de téléphone';
            elseif ($key == 'date_naissance')
                $value = 'Date de naissance';
            elseif ($key == 'notes')
                $value = 'Notes';
            elseif ($key == 'nom')
                $value = 'Prénom et nom';
            else
                $value = key;
        }

        return $out;
    }
}

?>