186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
if (empty($data['date']) || !utils::checkDate($data['date']))
{
throw new UserException('Date vide ou invalide.');
}
if (!$db->simpleQuerySingle('SELECT 1 FROM compta_exercices WHERE cloture = 0
AND debut <= :date AND fin >= :date;', false, array('date' => $data['date'])))
{
throw new UserException('La date ne correspond pas à l\'exercice en cours.');
}
if (empty($data['moyen_paiement']))
{
$data['moyen_paiement'] = null;
|
|
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
if (empty($data['date']) || !utils::checkDate($data['date']))
{
throw new UserException('Date vide ou invalide.');
}
if (!$db->simpleQuerySingle('SELECT 1 FROM compta_exercices WHERE cloture = 0
AND debut <= :date AND fin >= :date;', false, ['date' => $data['date']]))
{
throw new UserException('La date ne correspond pas à l\'exercice en cours.');
}
if (empty($data['moyen_paiement']))
{
$data['moyen_paiement'] = null;
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
$data['montant'] = (float)$data['montant'];
if ($data['montant'] <= 0)
{
throw new UserException('Le montant ne peut être égal ou inférieur à zéro.');
}
foreach (array('remarques', 'numero_piece', 'numero_cheque') as $champ)
{
if (empty($data[$champ]) || !trim($data[$champ]))
{
$data[$champ] = '';
}
else
{
|
|
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
$data['montant'] = (float)$data['montant'];
if ($data['montant'] <= 0)
{
throw new UserException('Le montant ne peut être égal ou inférieur à zéro.');
}
foreach (['remarques', 'numero_piece', 'numero_cheque'] as $champ)
{
if (empty($data[$champ]) || !trim($data[$champ]))
{
$data[$champ] = '';
}
else
{
|