Compare commits

..

4 Commits

13 changed files with 26 additions and 19 deletions

View File

@ -121,7 +121,7 @@ $form->runIf(f('select_cotis') && !$form->hasErrors(),
}, 'add_cotis_1'); }, 'add_cotis_1');
$form->runIf(f('add_cotis') && !$form->hasErrors(), $form->runIf(f('add_cotis') && !$form->hasErrors(),
function () use ($radio, $fields, $facture) function () use ($radio, $fields, $facture, $form)
{ {
$radio['type'] = f('cotisation'); $radio['type'] = f('cotisation');
try try

View File

@ -17,7 +17,7 @@ if (!$c)
} }
$form->runIf(f('save') && !$form->hasErrors(), $form->runIf(f('save') && !$form->hasErrors(),
function () use ($client, $id) function () use ($client, $id, $form)
{ {
try try
{ {

View File

@ -7,7 +7,7 @@ require_once __DIR__ . '/_inc.php';
$session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ); $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);
$form->runIf(f('add') && !$form->hasErrors(), $form->runIf(f('add') && !$form->hasErrors(),
function () use ($client) function () use ($client, $form)
{ {
try try
{ {

View File

@ -18,7 +18,7 @@ if (!$client)
} }
$form->runIf(f('delete') && !$form->hasErrors(), $form->runIf(f('delete') && !$form->hasErrors(),
function () use ($facture, $f) function () use ($facture, $f, $form)
{ {
try { try {
$facture->delete($f->id); $facture->delete($f->id);

View File

@ -12,6 +12,7 @@ $session->requireAccess($session::SECTION_ACCOUNTING, $session::ACCESS_READ);
$list = $facture->list(); $list = $facture->list();
$list->loadFromQueryString(); $list->loadFromQueryString();
$list->setPageSize(50);
$tpl->assign(compact('list')); $tpl->assign(compact('list'));

View File

@ -58,13 +58,19 @@ if ($f->type_facture != CERFA)
switch ($f->type_facture) switch ($f->type_facture)
{ {
case FACT: case FACT:
$doc = 'Facture n°'. $f->numero; $doc = 'Facture n° '. $f->numero;
$txtemis = $doc . " - Émise le " . $emission;
$txtdest = "Adressée à :";
break; break;
case DEVIS: case DEVIS:
$doc = 'Devis n°'. $f->numero; $doc = 'Devis n° '. $f->numero;
$txtemis = $doc . " - Émis le " . $emission;
$txtdest = "Adressé à :";
break; break;
case COTIS: case COTIS:
$doc = 'Reçu de cotisation n°'. $f->numero; $doc = 'Reçu de cotisation n° '. $f->numero;
$txtemis = $doc . " - Émis le " . $emission;
$txtdest = "Adressé à :";
break; break;
} }
@ -97,7 +103,7 @@ if ($f->type_facture != CERFA)
(($t = $config->get('site_asso'))?"Site web : $t<br>":''); (($t = $config->get('site_asso'))?"Site web : $t<br>":'');
$receveur = $receveur =
'Adressé à :<br><br>'. $txtdest.'<br>'.
'<b>'.$c->nom.'</b><br>'. '<b>'.$c->nom.'</b><br>'.
$c->adresse."<br>". $c->adresse."<br>".
$c->code_postal.' '.$c->ville."<br>". $c->code_postal.' '.$c->ville."<br>".
@ -307,7 +313,7 @@ EOF;
</head> </head>
<body> <body>
<p class="titre"> <p class="titre">
$doc - Émis le $emission $txtemis
</p> </p>
<table class="adressage"> <table class="adressage">

View File

@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS plugin_facturation_clients (
adresse TEXT NOT NULL, adresse TEXT NOT NULL,
code_postal TEXT NOT NULL, code_postal TEXT NOT NULL,
ville TEXT NOT NULL, ville TEXT NOT NULL,
siret TEXT NOT NULL, siret TEXT,
date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), -- Date d\'inscription date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), -- Date d\'inscription
telephone TEXT, telephone TEXT,
email TEXT email TEXT

View File

@ -40,7 +40,7 @@ class Client
{ {
$data[$key] = trim($data[$key]); $data[$key] = trim($data[$key]);
if($data[$key] == '' && ($key != 'telephone' && $key != 'email')) if($data[$key] == '' && ($key != 'siret' && $key != 'telephone' && $key != 'email'))
{ {
throw new UserException('Le champs '.$key.' doit être renseigné.'); throw new UserException('Le champs '.$key.' doit être renseigné.');
} }
@ -128,7 +128,7 @@ class Client
'label' => 'Ville', 'label' => 'Ville',
], ],
'siret' => [ 'siret' => [
'label' => 'Siret', 'label' => 'SIRET',
], ],
'telephone' => [ 'telephone' => [
'label' => 'Téléphone', 'label' => 'Téléphone',

View File

@ -352,11 +352,11 @@ class Facture
'select' => sprintf('CASE WHEN receveur_membre THEN %s ELSE c.nom END', $id_field), 'select' => sprintf('CASE WHEN receveur_membre THEN %s ELSE c.nom END', $id_field),
], ],
'receveur_adresse' => [ 'receveur_adresse' => [
'label' => 'Son adresse', 'label' => 'Adresse',
'select' => 'CASE WHEN receveur_membre THEN u.adresse ELSE c.adresse END', 'select' => 'CASE WHEN receveur_membre THEN u.adresse ELSE c.adresse END',
], ],
'receveur_ville' => [ 'receveur_ville' => [
'label' => 'Sa ville', 'label' => 'Ville',
'select' => 'CASE WHEN receveur_membre THEN u.ville ELSE c.ville END', 'select' => 'CASE WHEN receveur_membre THEN u.ville ELSE c.ville END',
], ],
'date_emission' => [ 'date_emission' => [
@ -391,6 +391,7 @@ class Facture
$list = new DynamicList($columns, $tables); $list = new DynamicList($columns, $tables);
$list->orderBy('date_emission', true); $list->orderBy('date_emission', true);
$list->setCount('COUNT(f.id)');
$currency = Config::getInstance()->monnaie; $currency = Config::getInstance()->monnaie;
@ -420,7 +421,6 @@ class Facture
} }
}); });
$list->setPageSize(1000);
return $list; return $list;
} }

View File

@ -11,7 +11,7 @@
{input type="text" name="adresse" label="Adresse" required=true source=$client} {input type="text" name="adresse" label="Adresse" required=true source=$client}
{input type="text" name="code_postal" label="Code postal" required=true source=$client} {input type="text" name="code_postal" label="Code postal" required=true source=$client}
{input type="text" name="ville" label="Ville" required=true source=$client} {input type="text" name="ville" label="Ville" required=true source=$client}
{input type="text" name="siret" label="SIREN/SIRET" required=true source=$client} {input type="text" name="siret" label="SIREN/SIRET" source=$client}
{input type="tel" name="telephone" label="Téléphone" source=$client} {input type="tel" name="telephone" label="Téléphone" source=$client}
{input type="email" name="email" label="Adresse e-mail" source=$client} {input type="email" name="email" label="Adresse e-mail" source=$client}
</dl> </dl>

View File

@ -55,7 +55,7 @@
{input type="text" name="adresse" label="Adresse" required=true} {input type="text" name="adresse" label="Adresse" required=true}
{input type="text" name="code_postal" label="Code postal" required=true} {input type="text" name="code_postal" label="Code postal" required=true}
{input type="text" name="ville" label="Ville" required=true} {input type="text" name="ville" label="Ville" required=true}
{input type="text" name="siret" label="SIREN/SIRET" required=true} {input type="text" name="siret" label="SIREN/SIRET"}
{input type="tel" name="telephone" label="Téléphone"} {input type="tel" name="telephone" label="Téléphone"}
{input type="email" name="email" label="Adresse e-mail"} {input type="email" name="email" label="Adresse e-mail"}
</dl> </dl>

View File

@ -33,6 +33,7 @@
</tbody> </tbody>
</table> </table>
{$list->getHTMLPagination()|raw}
<p class="help"> <p class="help">
Export de la liste&nbsp;: Export de la liste&nbsp;:

View File

@ -222,7 +222,7 @@ if (version_compare($old_version, '0.8.5', '<'))
adresse TEXT NOT NULL, adresse TEXT NOT NULL,
code_postal TEXT NOT NULL, code_postal TEXT NOT NULL,
ville TEXT NOT NULL, ville TEXT NOT NULL,
siret TEXT NOT NULL, siret TEXT,
date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation), date_creation TEXT NOT NULL DEFAULT CURRENT_DATE CHECK (date(date_creation) IS NOT NULL AND date(date_creation) = date_creation),
telephone TEXT, telephone TEXT,
email TEXT email TEXT
@ -233,7 +233,6 @@ if (version_compare($old_version, '0.8.5', '<'))
$sql = 'SELECT * FROM plugin_facturation_clients'; $sql = 'SELECT * FROM plugin_facturation_clients';
foreach ($db->iterate($sql) as $client) foreach ($db->iterate($sql) as $client)
{ {
$client->siret = "";
$db->insert('plugin_facturation_clients_tmp', $client); $db->insert('plugin_facturation_clients_tmp', $client);
} }
// remplacer l'ancienne table par la nouvelle // remplacer l'ancienne table par la nouvelle