Fix indent ++
This commit is contained in:
parent
d45f81a515
commit
541c5820bc
16 changed files with 415 additions and 417 deletions
|
|
@ -34,7 +34,7 @@ class Facture
|
|||
{
|
||||
throw new UserException("Clé inattendue : $k.");
|
||||
}
|
||||
|
||||
|
||||
if(!is_array($data)){
|
||||
$datas[$k] = trim($data);
|
||||
}
|
||||
|
|
@ -46,49 +46,49 @@ class Facture
|
|||
|
||||
switch($k)
|
||||
{
|
||||
case 'type_facture':
|
||||
case 'receveur_membre':
|
||||
case 'reglee':
|
||||
case 'archivee':
|
||||
if ($datas[$k] != 1 && $datas[$k] != 0)
|
||||
{
|
||||
throw new UserException("$k est de valeur non-attendue ($data).");
|
||||
case 'type_facture':
|
||||
case 'receveur_membre':
|
||||
case 'reglee':
|
||||
case 'archivee':
|
||||
if ($datas[$k] != 1 && $datas[$k] != 0)
|
||||
{
|
||||
throw new UserException("$k est de valeur non-attendue ($data).");
|
||||
}
|
||||
break;
|
||||
case 'receveur_id':
|
||||
if (!is_numeric($datas[$k]) || $datas[$k] < 0 )
|
||||
{
|
||||
throw new UserException("L'id du receveur est non-attendu ($data).");
|
||||
case 'receveur_id':
|
||||
if (!is_numeric($datas[$k]) || $datas[$k] < 0 )
|
||||
{
|
||||
throw new UserException("L'id du receveur est non-attendu ($data).");
|
||||
}
|
||||
break;
|
||||
case 'date_emission':
|
||||
if (!strtotime($datas[$k]))
|
||||
{
|
||||
throw new UserException("La date d'émission est non-attendue ($data).");
|
||||
case 'date_emission':
|
||||
if (!strtotime($datas[$k]))
|
||||
{
|
||||
throw new UserException("La date d'émission est non-attendue ($data).");
|
||||
}
|
||||
break;
|
||||
case 'date_echeance':
|
||||
if (!strtotime($datas[$k]))
|
||||
{
|
||||
throw new UserException("La date d'émission est non-attendue ($data).");
|
||||
case 'date_echeance':
|
||||
if (!strtotime($datas[$k]))
|
||||
{
|
||||
throw new UserException("La date d'émission est non-attendue ($data).");
|
||||
}
|
||||
if (isset($datas['date_emission']) && (strtotime($datas[$k]) <= strtotime($datas['date_emission']) ) )
|
||||
{
|
||||
throw new UserException("La date d'échéance est antérieure ou égale à la date d'émission ($data).");
|
||||
}
|
||||
break;
|
||||
case 'moyen_paiement':
|
||||
$cats = new \Garradin\Compta\Categories;
|
||||
if(!array_key_exists($datas[$k], $cats->listMoyensPaiement()))
|
||||
{
|
||||
throw new UserException("Le moyen de paiement ne correspond pas à la liste interne ($data).");
|
||||
case 'moyen_paiement':
|
||||
$cats = new \Garradin\Compta\Categories;
|
||||
if(!array_key_exists($datas[$k], $cats->listMoyensPaiement()))
|
||||
{
|
||||
throw new UserException("Le moyen de paiement ne correspond pas à la liste interne ($data).");
|
||||
}
|
||||
unset($cats);
|
||||
break;
|
||||
case 'contenu':
|
||||
if(!is_array($datas[$k]) || empty($datas[$k]))
|
||||
{
|
||||
throw new UserException("Le contenu du document est vide ($data).");
|
||||
case 'contenu':
|
||||
if(!is_array($datas[$k]) || empty($datas[$k]))
|
||||
{
|
||||
throw new UserException("Le contenu du document est vide ($data).");
|
||||
}
|
||||
$total = 0;
|
||||
$vide = 1;
|
||||
|
|
@ -110,10 +110,10 @@ class Facture
|
|||
}
|
||||
$datas[$k] = serialize($datas[$k]);
|
||||
break;
|
||||
case 'total':
|
||||
if(!isset($datas['contenu']))
|
||||
{
|
||||
throw new UserException("Pas de contenu fourni pour vérifier le total.");
|
||||
case 'total':
|
||||
if(!isset($datas['contenu']))
|
||||
{
|
||||
throw new UserException("Pas de contenu fourni pour vérifier le total.");
|
||||
}
|
||||
if ($total != $datas[$k])
|
||||
{
|
||||
|
|
@ -132,15 +132,15 @@ class Facture
|
|||
|
||||
if(isset($data['numero']) && $db->test('plugin_facturation_factures', 'numero = ? COLLATE NOCASE', $data['numero']))
|
||||
{
|
||||
throw new UserException('Une facture avec ce numéro existe déjà, hors le numéro doit être unique.');
|
||||
throw new UserException('Une facture avec ce numéro existe déjà, hors le numéro doit être unique.');
|
||||
}
|
||||
$db->insert('plugin_facturation_factures', $data);
|
||||
return $db->lastInsertRowId();
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
|
||||
$r = $db->first('SELECT *, strftime(\'%s\', date_emission) AS date_emission,
|
||||
strftime(\'%s\', date_echeance) AS date_echeance
|
||||
|
|
@ -150,7 +150,7 @@ class Facture
|
|||
{
|
||||
throw new UserException("Pas de facture retournée avec cet id.");
|
||||
}
|
||||
|
||||
|
||||
$r->contenu = unserialize($r->contenu);
|
||||
|
||||
return $r;
|
||||
|
|
@ -161,7 +161,7 @@ class Facture
|
|||
$r = (array)DB::getInstance()->get('SELECT *, strftime(\'%s\', date_emission) AS date_emission,
|
||||
strftime(\'%s\', date_echeance) AS date_echeance
|
||||
FROM plugin_facturation_factures');
|
||||
|
||||
|
||||
foreach ($r as $e)
|
||||
{
|
||||
$e->contenu = unserialize((string)$e->contenu);
|
||||
|
|
@ -178,7 +178,7 @@ class Facture
|
|||
|
||||
if(isset($data['numero']) && $db->test('plugin_facturation_factures', 'numero = ? COLLATE NOCASE AND id != ?', $data['numero'], (int)$id))
|
||||
{
|
||||
throw new UserException('Une facture avec ce numéro existe déjà, hors le numéro doit être unique.');
|
||||
throw new UserException('Une facture avec ce numéro existe déjà, hors le numéro doit être unique.');
|
||||
}
|
||||
return $db->update('plugin_facturation_factures', $data, $db->where('id', (int)$id));
|
||||
}
|
||||
|
|
@ -200,15 +200,15 @@ class Facture
|
|||
}
|
||||
|
||||
$r = (array)DB::getInstance()->get('SELECT *, strftime(\'%s\', date_emission) AS date_emission,
|
||||
strftime(\'%s\', date_echeance) AS date_echeance
|
||||
FROM plugin_facturation_factures
|
||||
WHERE receveur_membre = ? AND receveur_id = ?', (int)$base, (int)$id);
|
||||
strftime(\'%s\', date_echeance) AS date_echeance
|
||||
FROM plugin_facturation_factures
|
||||
WHERE receveur_membre = ? AND receveur_id = ?', (int)$base, (int)$id);
|
||||
|
||||
foreach ($r as $e)
|
||||
{
|
||||
$e->contenu = unserialize((string)$e->contenu);
|
||||
}
|
||||
|
||||
|
||||
return empty($r)?false:$r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue