Overview
Comment:Ne pas permettre de supprimer le champ email !
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: b619ea4702a99c17116e5b7b4559d2a773d2c503
User & Date: bohwaz on 2018-02-21 04:51:25
Other Links: manifest | tags
Context
2018-02-21
04:56
Ne pas inclure les reports dans le rapprochement, signalé par @Alain check-in: c86a781f5e user: bohwaz tags: trunk, stable
04:51
Ne pas permettre de supprimer le champ email ! check-in: b619ea4702 user: bohwaz tags: trunk, stable
04:38
Corrige encodage du From dans les mails envoyés, signalé par @Emelyne check-in: 2cc684a884 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Membres/Champs.php from [880caee707] to [c81852e57e].

    87     87   	{
    88     88   		if ($champs instanceOf Champs)
    89     89   		{
    90     90   			$this->champs = $champs->getAll();
    91     91   		}
    92     92           elseif (is_array($champs))
    93     93           {
    94         -            $presets = self::importPresets();
    95         -            $this->champs = new \stdClass;
    96         -
    97         -            if (!isset($champs['passe']))
    98         -            {
    99         -                $champs['passe'] = ['type' => 'password'];
   100         -            }
   101         -
   102         -            foreach ($champs as $key=>&$config)
   103         -            {
   104         -                if (is_array($config))
   105         -                {
   106         -                    $config = (object) $config;
   107         -                }
   108         -
   109         -                if (isset($presets[$key]))
   110         -                {
   111         -                    $config->type = $presets[$key]['type'];
   112         -                }
   113         -
   114         -                $this->_checkField($key, $config);
   115         -
   116         -                $this->champs->$key = $config;
   117         -            }
           94  +            $this->setAll($champs);
   118     95           }
   119     96   		else
   120     97   		{
   121     98   			$champs = parse_ini_string((string)$champs, true);
   122     99   
   123    100               foreach ($champs as $key=>&$config)
   124    101               {
................................................................................
   439    416   	}
   440    417   
   441    418       /**
   442    419        * Modifie les champs en interne en vérifiant que tout va bien
   443    420        * @param array $champs Liste des champs
   444    421        * @return boolean true
   445    422        */
   446         -    public function setAll($champs)
          423  +    public function setAll(array $champs)
   447    424       {
          425  +        $presets = self::importPresets();
          426  +        $this->champs = new \stdClass;
          427  +
          428  +        if (!isset($champs['passe']))
          429  +        {
          430  +            $champs['passe'] = ['type' => 'password'];
          431  +        }
          432  +
          433  +        foreach ($champs as $key=>&$config)
          434  +        {
          435  +            if (is_array($config))
          436  +            {
          437  +                $config = (object) $config;
          438  +            }
          439  +
          440  +            if (isset($presets[$key]))
          441  +            {
          442  +                $config->type = $presets[$key]['type'];
          443  +            }
          444  +
          445  +            $this->_checkField($key, $config);
          446  +
          447  +            $this->champs->$key = $config;
          448  +        }
          449  +
          450  +        unset($config);
          451  +
   448    452           if (!array_key_exists('email', $champs))
   449    453           {
   450    454               throw new UserException('Le champ E-Mail ne peut être supprimé des fiches membres.');
   451    455           }
   452    456   
   453    457           if (!array_key_exists('passe', $champs))
   454    458           {

Modified src/templates/admin/config/membres.tpl from [166866b141] to [442c85f4e3].

   254    254           edit.title = 'Modifier ce champ';
   255    255           edit.onclick = function (e) {
   256    256               this.parentNode.parentNode.querySelector('dl').classList.toggle('hidden');
   257    257               return false;
   258    258           };
   259    259           actions.appendChild(edit);
   260    260   
   261         -        if (field.id != champ_identifiant && field.id != 'f_passe' && field.id != champ_identite && field.id != 'f_numero')
          261  +        if (field.id != champ_identifiant && field.id != 'f_passe' && field.id != champ_identite && field.id != 'f_numero' && field.id != 'f_email')
   262    262           {
   263    263               var rem = document.createElement('a');
   264    264               rem.className = 'icn remove';
   265    265               rem.innerHTML = '✘';
   266    266               rem.title = 'Enlever ce champ de la fiche';
   267    267               rem.onclick = function (e) {
   268    268                   if (!window.confirm('Êtes-vous sûr de supprimer ce champ des fiches de membre ?'))

Modified src/www/admin/static/admin.css from [758eb0ad20] to [d230c3bb28].

   992    992       line-height: .8em;
   993    993       color: #666;
   994    994   }
   995    995   
   996    996   #orderFields fieldset .actions {
   997    997       display: block;
   998    998       position: absolute;
   999         -    top: 1em;
          999  +    top: 0.2em;
  1000   1000       right: 1em;
  1001   1001   }
  1002   1002   
  1003   1003   #orderFields fieldset .actions .icn {
  1004   1004       position: absolute;
  1005   1005   }
  1006   1006