2019-11-02 17:53:27 +01:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Garradin;
|
|
|
|
|
|
|
|
|
|
require_once __DIR__ . '/_inc.php';
|
|
|
|
|
|
|
|
|
|
$session->requireAccess('compta', Membres::DROIT_ACCES);
|
|
|
|
|
|
|
|
|
|
use Garradin\Membres;
|
|
|
|
|
|
|
|
|
|
$membres = new Membres;
|
|
|
|
|
|
|
|
|
|
qv(['id' => 'required|numeric']);
|
|
|
|
|
$id = (int) qg('id');
|
|
|
|
|
|
|
|
|
|
$f = $facture->get($id);
|
|
|
|
|
|
|
|
|
|
if (!$f)
|
|
|
|
|
{
|
|
|
|
|
throw new UserException("Ce document n'existe pas.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$cats = new Compta\Categories;
|
|
|
|
|
$tpl->assign('moyens_paiement', $cats->listMoyensPaiement());
|
|
|
|
|
$tpl->assign('moyen_paiement', $cats->getMoyenPaiement($f->moyen_paiement));
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2019-11-03 17:51:31 +01:00
|
|
|
|
if ($f->receveur_membre)
|
|
|
|
|
{
|
|
|
|
|
$c = $membres->get($f->receveur_id);
|
|
|
|
|
foreach(['ville','code_postal','adresse'] as $v)
|
|
|
|
|
{
|
|
|
|
|
if($c->$v == '')
|
|
|
|
|
{
|
|
|
|
|
$c->$v = '[A RENSEIGNER DANS LA FICHE MEMBRE]';
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-02 17:53:27 +01:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-11-03 17:51:31 +01:00
|
|
|
|
$c = $client->get($f->receveur_id);
|
2019-11-02 17:53:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tpl->assign('facture', $f);
|
|
|
|
|
$tpl->assign('client', $c);
|
|
|
|
|
}
|
|
|
|
|
catch(UserException $e)
|
|
|
|
|
{
|
2019-11-03 17:51:31 +01:00
|
|
|
|
$form->addError("Pas de document correspondant à cet id trouvée.");
|
2019-11-02 17:53:27 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tpl->assign('id', $id);
|
2020-10-24 01:00:48 +02:00
|
|
|
|
$tpl->assign('footer', $plugin->getConfig('footer')?:'');
|
|
|
|
|
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso')?:'');
|
2019-11-02 17:53:27 +01:00
|
|
|
|
|
2019-11-03 17:51:31 +01:00
|
|
|
|
$tpl->display(PLUGIN_ROOT . '/templates/facture.tpl');
|