Overview
Comment:Ne pas requérir le mot de passe à l'import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 677a7113060bdc54671e8dec433e05b2b40a42ea
User & Date: bohwaz on 2017-09-20 06:32:09
Other Links: branch diff | manifest | tags
References
2020-12-08
23:25 Wiki page "Changelog/0.9" artifact: b9c916b4d1 user: bohwaz
Context
2017-09-20
06:33
@count n'est plus une syntaxe valide check-in: b4e9e4804f user: bohwaz tags: dev
06:32
Ne pas requérir le mot de passe à l'import check-in: 677a711306 user: bohwaz tags: dev
06:31
Correction affichage choix multiple dans fiche de membre check-in: 41e771b47c user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Membres.php from [924a6da939] to [f42c21d7f7].

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
                }
            }
        }

        return true;
    }

    public function add($data = [])
    {
        $db = DB::getInstance();
        $config = Config::getInstance();
        $id = $config->get('champ_identifiant');
        $champs = $config->get('champs_membres');

        // Numéro de membre
        if ($champs->get('numero'))
        {
            if (empty($data['numero']))
            {
                $data['numero'] = $db->firstColumn('SELECT MAX(numero) + 1 FROM membres;') ?: 1;
            }
            elseif ($db->test('membres', $db->where('numero', $data['numero'])))
            {
                throw new UserException('Ce numéro de membre est déjà attribué à un autre membre.');
            }
        }

        $this->_checkFields($data);

        if (!empty($data[$id]) && $db->test('membres', $db->where($id, $data[$id])))
        {
            throw new UserException('La valeur du champ '.$id.' est déjà utilisée par un autre membre, hors ce champ doit être unique à chaque membre.');
        }

        if (isset($data['passe']) && trim($data['passe']) != '')







|



















|







131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
                }
            }
        }

        return true;
    }

    public function add($data = [], $require_password = true)
    {
        $db = DB::getInstance();
        $config = Config::getInstance();
        $id = $config->get('champ_identifiant');
        $champs = $config->get('champs_membres');

        // Numéro de membre
        if ($champs->get('numero'))
        {
            if (empty($data['numero']))
            {
                $data['numero'] = $db->firstColumn('SELECT MAX(numero) + 1 FROM membres;') ?: 1;
            }
            elseif ($db->test('membres', $db->where('numero', $data['numero'])))
            {
                throw new UserException('Ce numéro de membre est déjà attribué à un autre membre.');
            }
        }

        $this->_checkFields($data, true, $require_password);

        if (!empty($data[$id]) && $db->test('membres', $db->where($id, $data[$id])))
        {
            throw new UserException('La valeur du champ '.$id.' est déjà utilisée par un autre membre, hors ce champ doit être unique à chaque membre.');
        }

        if (isset($data['passe']) && trim($data['passe']) != '')

Modified src/include/lib/Garradin/Membres/Import.php from [9f36948de3] to [c8e1a71b74].

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
				if (isset($data[$garradin]))
					$data[$garradin] .= "\n" . $col($galette);
				else
					$data[$garradin] = $col($galette);
			}

			try {
				$membres->add($data);
			}
			catch (UserException $e)
			{
				$db->rollback();
				throw new UserException('Erreur sur la ligne ' . $line . ' : ' . $e->getMessage());
			}
		}







|







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
				if (isset($data[$garradin]))
					$data[$garradin] .= "\n" . $col($galette);
				else
					$data[$garradin] = $col($galette);
			}

			try {
				$membres->add($data, false);
			}
			catch (UserException $e)
			{
				$db->rollback();
				throw new UserException('Erreur sur la ligne ' . $line . ' : ' . $e->getMessage());
			}
		}
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
			try {
				if ($numero && ($id = $membres->getIDWithNumero($numero)))
				{
					$membres->edit($id, $data);
				}
				else
				{
					$membres->add($data);
				}
			}
			catch (UserException $e)
			{
				$db->rollback();
				throw new UserException('Erreur sur la ligne ' . $line . ' : ' . $e->getMessage());
			}







|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
			try {
				if ($numero && ($id = $membres->getIDWithNumero($numero)))
				{
					$membres->edit($id, $data);
				}
				else
				{
					$membres->add($data, false);
				}
			}
			catch (UserException $e)
			{
				$db->rollback();
				throw new UserException('Erreur sur la ligne ' . $line . ' : ' . $e->getMessage());
			}