Ajout des options de configuration pour reçus
This commit is contained in:
parent
64dc0d541d
commit
b18cd91aa4
Binary file not shown.
|
@ -8,7 +8,7 @@ use Garradin\UserException;
|
|||
class Facture
|
||||
{
|
||||
private $keys = [
|
||||
'type_facture',
|
||||
'type_facture', // 0 : devis, 1 : facture, 2 : reçu cerfa, 3 : reçu cotis
|
||||
'numero',
|
||||
'receveur_membre',
|
||||
'receveur_id',
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
namespace Garradin\Plugin\RecuDon;
|
||||
|
||||
use Garradin\DB;
|
||||
use Garradin\UserException;
|
||||
|
||||
class GenDon
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function add($data)
|
||||
{
|
||||
//$this->_checkData($data);
|
||||
|
||||
/*if (!isset($data['numero']) == !trim($data['numero'])) {
|
||||
throw new UserException('Le numéro d ordre existe déjà sur un autre reçu.');
|
||||
}*/
|
||||
|
||||
$db = DB::getInstance();
|
||||
$db->insert('plugin_recudon', $data);
|
||||
|
||||
return $db->lastInsertRowID();
|
||||
}
|
||||
|
||||
public function edit($id, $data)
|
||||
{
|
||||
//$this->_checkData($data);
|
||||
|
||||
$db = DB::getInstance();
|
||||
return $db->simpleUpdate('plugin_recudon', $data, 'id = ' . (int) $id);
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
|
||||
return $db->first('SELECT * FROM plugin_recudon WHERE id = ?;', (int) $id);
|
||||
}
|
||||
|
||||
public function remove($id)
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
|
||||
return $db->simpleExec('DELETE FROM plugin_recudon WHERE id = ?;', (int) $id);
|
||||
}
|
||||
|
||||
public function listSimple()
|
||||
{
|
||||
$db = DB::getInstance();
|
||||
return $db->get('SELECT id, nom, prenom, ville, "date", gen_ordre, montant FROM plugin_recudon ORDER BY id;');
|
||||
}
|
||||
}
|
|
@ -11,18 +11,69 @@
|
|||
|
||||
<form method="post" action="{$self_url}">
|
||||
<fieldset>
|
||||
<legend>Configuration du plugin</legend>
|
||||
<legend>Informations de l'association</legend>
|
||||
<dl>
|
||||
<dt><label for="f_siret">RNA de l'assocation</label></dt>
|
||||
<dd><input type="text" name="rna_asso" id="f_rna" value="{$rna_asso}"></dd>
|
||||
<dd><input type="text" id="f_rna" name="rna_asso" value="{form_field data=$plugin.config name=rna_asso}"></dd>
|
||||
|
||||
<dt><label for="f_siret">SIRET de l'assocation</label></dt>
|
||||
<dd><input type="text" name="siret_asso" id="f_siret" value="{$siret_asso}"></dd>
|
||||
<dd><input type="text" id="f_siret" name="siret_asso" value="{form_field data=$plugin.config name=siret_asso}"></dd>
|
||||
</dl>
|
||||
<br>
|
||||
<fieldset>
|
||||
<legend>Adresse</legend>
|
||||
<dl>
|
||||
|
||||
<dt><label for="f_numero_rue">Numéro de rue</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
||||
<dd><input type="text" id="f_numero_rue" maxlength=5 name="numero_rue" value="{form_field data=$plugin.config name=numero_rue_asso}" /></dd>
|
||||
|
||||
<dt><label for="f_rue">Rue</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
||||
<dd><input type="text" id="f_rue" name="rue" value="{form_field data=$plugin.config name=rue_asso}" /></dd>
|
||||
|
||||
<dt><label for="f_codepostal">Code postal</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
||||
<dd><input type="text" id="f_codepostal" name="codepostal" value="{form_field data=$plugin.config name=cp_asso}" /></dd>
|
||||
|
||||
<dt><label for="f_ville">Ville</label> <b title="(Champ obligatoire)">obligatoire</b></dt>
|
||||
<dd><input type="text" id="f_ville" name="ville" value="{form_field data=$plugin.config name=ville_asso}" /></dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Objet</legend>
|
||||
<dl>
|
||||
<dt><label>L'objet (but) de l'association doit tenir sur 3 lignes, chaque ligne pouvant accueillir un maximum de 100 caractères.</label><b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b></dt>
|
||||
<dd><input type="text" maxlength=100 name="objet_0" value="{form_field data=$plugin.config name=objet_0}" /></dd>
|
||||
<dd><input type="text" maxlength=100 name="objet_1" value="{form_field data=$plugin.config name=objet_1}" /></dd>
|
||||
<dd><input type="text" maxlength=100 name="objet_2" value="{form_field data=$plugin.config name=objet_2}" /></dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Droit à la réduction d'impôt</legend>
|
||||
<dl>
|
||||
<dt><label>Articles conernés par l'association :</label> <b title="(Champ obligatoire)">obligatoire pour reçus fiscaux</b></dt>
|
||||
<dt><input type="checkbox" name="droit_art200" {form_field name="droit_art200" checked=1 data=$plugin.config } /><label>Article 200</label></dt>
|
||||
<dt><input type="checkbox" name="droit_art238bis" {form_field name="droit_art238bis" checked=1 data=$plugin.config } /><label>Article 238 bis</label></dt>
|
||||
<dt><input type="checkbox" name="droit_art885-0VbisA" {form_field name="droit_art885-0VbisA" checked=1 data=$plugin.config } /><label>Article 885-0V bis A</label></dt>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Factures</legend>
|
||||
<dl>
|
||||
<dt><label for="f_footer">Pied de documents/informations légales</label></dt>
|
||||
<dd><textarea name="footer" id="f_footer" cols="50" rows="5">{$footer}</textarea></dd>
|
||||
<dd><textarea name="footer" id="f_footer" cols="50" rows="5">{form_field data=$plugin.config name=footer}</textarea></dd>
|
||||
|
||||
<dt><input type="checkbox" name="validate_cp" id="f_validate_cp" {$validate_cp}> <label for="f_validate_cp">Vérifier le code postal lors de saisie/modification de client (seulement FR)</label></dt>
|
||||
<dt><input type="checkbox" name="unique_name" id="f_unique_name" {$unique_name}> <label for="f_unique_name">Noms des clients uniques</label></dt>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Configuration du plugin</legend>
|
||||
<dl>
|
||||
<dt><input type="checkbox" name="validate_cp" id="f_validate_cp" {form_field data=$plugin.config name=validate_cp checked=1}> <label for="f_validate_cp">Vérifier le code postal lors de saisie/modification de client (seulement FR)</label></dt>
|
||||
<dt><input type="checkbox" name="unique_name" id="f_unique_name" {form_field data=$plugin.config name=unique_client_name checked=1}> <label for="f_unique_name">Noms des clients uniques</label></dt>
|
||||
|
||||
</dl>
|
||||
<i>Pour personnaliser l'apparence de la facture, il faut pour l'instant se retrousser les manches et éditer soi-même le fichier www/admin/facture_pdf.php du plugin ! </i>
|
||||
|
@ -34,4 +85,27 @@
|
|||
</p>
|
||||
</form>
|
||||
|
||||
|
||||
<form method="post" enctype="multipart/form-data" action="{$self_url|escape}" id="f_upload">
|
||||
<fieldset>
|
||||
<legend>Signature du responsable</legend>
|
||||
|
||||
L'image de la signature doit être au format PNG, d'une taille raisonable et doit être dotée d'un fond transparent.
|
||||
|
||||
<br>
|
||||
{* <img src="{$image}" /> *}
|
||||
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="{$max_size|escape}" id="f_maxsize" />
|
||||
<dl>
|
||||
<dd class="help">Taille maximale : {$max_size|format_bytes}</dd>
|
||||
<dd class="fileUpload"><input type="file" name="fichier" id="f_fichier" data-hash-check /></dd>
|
||||
</dl>
|
||||
<p class="submit">
|
||||
{csrf_field key="signature_config"}
|
||||
<input type="submit" name="upload" id="f_submit" value="Envoyer le fichier" />
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
{include file="admin/_foot.tpl"}
|
|
@ -0,0 +1,55 @@
|
|||
{include file="admin/_head.tpl" title="Extension — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
|
||||
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="recu"}
|
||||
|
||||
{if $error}
|
||||
{if $error == 'OK'}
|
||||
<p class="confirm">
|
||||
La configuration a bien été enregistrée.
|
||||
</p>
|
||||
{else}
|
||||
<p class="error">
|
||||
{$error|escape}
|
||||
</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
{if !empty($trecus)}
|
||||
<p>Retrouvez l'ensemble des reçus fiscaux générés:</p>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<td title="Numéro unique"></td>
|
||||
<td>Nom</td>
|
||||
<td>Prénom</td>
|
||||
<td>Ville</td>
|
||||
<td>Montant</td>
|
||||
<td>Date</td>
|
||||
<td>Télécharger</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$trecus item="gendon"}
|
||||
<tr>
|
||||
<td>{$gendon.id|escape}</td>
|
||||
<td>{$gendon.nom|escape}</td>
|
||||
<td>{$gendon.prenom|escape}</td>
|
||||
<td>{$gendon.ville|escape}</td>
|
||||
<td>{$gendon.montant|escape}</td>
|
||||
<td>{$gendon.date|escape}</td>
|
||||
<td><a href="{plugin_url file="generation.php"}?id={$gendon.id}">{$gendon.gen_ordre|escape}.pdf</a></td>
|
||||
<td class="action">
|
||||
<a class="icn" href="{plugin_url file="supprimer.php"}?id={$gendon.id|escape}" title="Supprimer">✘</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
{else}
|
||||
<p class="alert">
|
||||
Aucun reçu fiscal trouvé.
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
{include file="admin/_foot.tpl"}
|
|
@ -0,0 +1,26 @@
|
|||
{include file="admin/_head.tpl" title="Extension — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
|
||||
{include file="%s/templates/_menu.tpl"|args:$plugin_root current="recu"}
|
||||
|
||||
{if $error}
|
||||
<p class="error">
|
||||
{$error|escape}
|
||||
</p>
|
||||
{/if}
|
||||
|
||||
<form method="post" action="{$self_url|escape}">
|
||||
|
||||
<fieldset>
|
||||
<legend>Supprimer ce reçu fiscal ?</legend>
|
||||
<h3 class="warning">
|
||||
Êtes-vous sûr de vouloir supprimer le reçu fiscal n°{$recu.gen_ordre|escape} concernant un don de {$recu.montant} € effectué par {$recu.prenom} {$recu.nom} le {$recu.date} ?
|
||||
</h3>
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
{csrf_field key="recu_supprimer_`$recu.id`"}
|
||||
<input type="submit" name="remove" value="Supprimer →" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
{include file="admin/_foot.tpl"}
|
|
@ -11,10 +11,24 @@ if (f('save') && $form->check('facturation_config'))
|
|||
try {
|
||||
$plugin->setConfig('rna_asso', trim(f('rna_asso')));
|
||||
$plugin->setConfig('siret_asso', trim(f('siret_asso')));
|
||||
$plugin->setConfig('validate_cp', f('validate_cp'));
|
||||
$plugin->setConfig('unique_client_name', f('unique_name'));
|
||||
|
||||
$plugin->setConfig('numero_rue_asso', trim(f('numero_rue')));
|
||||
$plugin->setConfig('rue_asso', trim(f('rue')));
|
||||
$plugin->setConfig('cp_asso', trim(f('codepostal')));
|
||||
$plugin->setConfig('ville_asso', trim(f('ville')));
|
||||
|
||||
$plugin->setConfig('droit_art200', (bool)f('droit_art200'));
|
||||
$plugin->setConfig('droit_art238bis', (bool)f('droit_art238bis'));
|
||||
$plugin->setConfig('droit_art885-0VbisA', (bool)f('droit_art885-0VbisA'));
|
||||
$plugin->setConfig('objet_0', trim(f('objet_0')));
|
||||
$plugin->setConfig('objet_1', trim(f('objet_1')));
|
||||
$plugin->setConfig('objet_2', trim(f('objet_2')));;
|
||||
|
||||
$plugin->setConfig('footer', f('footer'));
|
||||
|
||||
$plugin->setConfig('validate_cp', (bool)f('validate_cp'));
|
||||
$plugin->setConfig('unique_client_name', (bool)f('unique_name'));
|
||||
|
||||
Utils::redirect(PLUGIN_URL . 'config.php?ok');
|
||||
}
|
||||
catch (UserException $e)
|
||||
|
@ -23,12 +37,90 @@ if (f('save') && $form->check('facturation_config'))
|
|||
}
|
||||
}
|
||||
|
||||
// Traitement de l'image de signature
|
||||
// Copié du plugin de nfrery
|
||||
if (f('upload') || isset($_POST['uploadHelper_status']))
|
||||
{
|
||||
$form->check('signature_config');
|
||||
|
||||
if (f('uploadHelper_status') > 0)
|
||||
{
|
||||
throw new UserException('Un seul fichier peut être envoyé en même temps.');
|
||||
}
|
||||
elseif (!empty($_POST['fichier']) || isset($_FILES['fichier']))
|
||||
{
|
||||
try {
|
||||
if (isset($_POST['uploadHelper_status']) && !empty($_POST['fichier']))
|
||||
{
|
||||
$fichier = Fichiers::uploadExistingHash(f('fichier'), f('uploadHelper_fileHash'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$fichier = Fichiers::upload($_FILES['fichier']);
|
||||
}
|
||||
|
||||
// ?? je comprends pas tout dans ce bloc
|
||||
if (isset($_POST['uploadHelper_status']))
|
||||
{
|
||||
echo json_encode([
|
||||
'redirect' => WWW_URL,
|
||||
'callback' => 'insertHelper',
|
||||
'file' => [
|
||||
'image' => (int)$fichier->image,
|
||||
'id' => (int)$fichier->id,
|
||||
'nom' => $fichier->nom,
|
||||
'thumb' => $fichier->image ? $fichier->getURL(200) : false
|
||||
],
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!$plugin->getConfig('signaturetxt') == "")
|
||||
{
|
||||
$fichier_old = new Fichiers($plugin->getConfig('signaturetxt'));
|
||||
$fichier_old->remove();
|
||||
}
|
||||
|
||||
Static_Cache::storeFromUpload('fichiers.'.$fichier->id, $fichier->nom);
|
||||
$plugin->setConfig('signaturetxt', $fichier->id);
|
||||
Utils::redirect(PLUGIN_URL . 'config.php?ok');
|
||||
}
|
||||
catch (UserException $e)
|
||||
{
|
||||
throw new UserException($e->getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = 'Aucun fichier envoyé.';
|
||||
}
|
||||
}
|
||||
|
||||
if(!$plugin->getConfig('signaturetxt') == "")
|
||||
{
|
||||
$img1 = new Fichiers($plugin->getConfig('signaturetxt'));
|
||||
$cache_id = 'fichiers.' . $img1->id_contenu;
|
||||
|
||||
if (!Static_Cache::exists($cache_id))
|
||||
{
|
||||
$blob = DB::getInstance()->openBlob('fichiers_contenu', 'contenu', (int)$img1->id_contenu);
|
||||
Static_Cache::storeFromPointer($cache_id, $blob);
|
||||
fclose($blob);
|
||||
}
|
||||
|
||||
$uri = $img1->getURL();
|
||||
$tpl->assign('image', $uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
$tpl->assign('image', false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$tpl->assign('ok', qg('ok') !== null);
|
||||
|
||||
$tpl->assign('rna_asso', $plugin->getConfig('rna_asso') ?: '');
|
||||
$tpl->assign('siret_asso', $plugin->getConfig('siret_asso') ?: '');
|
||||
$tpl->assign('footer', $plugin->getConfig('footer') ?: '');
|
||||
$tpl->assign('validate_cp', $plugin->getConfig('validate_cp') ? 'checked':'');
|
||||
$tpl->assign('unique_name', $plugin->getConfig('unique_client_name') ? 'checked':'');
|
||||
$tpl->assign('max_size', Utils::getMaxUploadSize());
|
||||
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/config.tpl');
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
namespace Garradin;
|
||||
|
||||
$session->requireAccess('compta', Membres::DROIT_ADMIN);
|
||||
|
||||
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
|
||||
throw new UserException("Le numéro du reçu fiscal est manquant.");
|
||||
}
|
||||
|
||||
$id = (int) $_GET['id'];
|
||||
|
||||
$gendon = new Plugin\RecuDon\GenDon;
|
||||
|
||||
$recu = $gendon->get($id);
|
||||
|
||||
require_once PLUGIN_ROOT . '/lib/MPDF/vendor/autoload.php';
|
||||
|
||||
// require_once(PLUGIN_ROOT . '/lib/fpdf/fpdf.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/pdf_context.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/pdf_parser.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/fpdi_pdf_parser.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/fpdi_bridge.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/fpdf_tpl.php');
|
||||
// require_once(PLUGIN_ROOT . '/lib/FPDI/fpdi.php');
|
||||
|
||||
$pdf = new \Mpdf\Mpdf([
|
||||
'default_font_size' => 10,
|
||||
'default_font' => 'Helvetica',
|
||||
]);
|
||||
|
||||
$pdf->AddPage();
|
||||
$pdf->setSourceFile(PLUGIN_ROOT . '/data/11580-03.pdf');
|
||||
$pdf->useTemplate(
|
||||
$pdf->importPage(1)
|
||||
);
|
||||
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->WriteText(180, 18, $recu->gen_ordre);
|
||||
$pdf->WriteText(20, 43, $config->get('nom_asso'));
|
||||
$pdf->WriteText(24, 53, utf8_decode($plugin->getConfig('numero_rue')));
|
||||
$pdf->SetXY(42,53);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('rue')));
|
||||
$pdf->SetXY(38,59);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('codepostal')));
|
||||
$pdf->SetXY(72,59);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('ville')));
|
||||
$pdf->SetXY(20,69);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('objet0')));
|
||||
$pdf->SetXY(20,73);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('objet1')));
|
||||
$pdf->SetXY(20,77);
|
||||
$pdf->Write(0, utf8_decode($plugin->getConfig('objet2')));
|
||||
$pdf->SetXY(19,135);
|
||||
$pdf->Write(0, "X");
|
||||
|
||||
$pdf->AddPage();
|
||||
$pdf->useTemplate(
|
||||
$pdf->importPage(2)
|
||||
);
|
||||
|
||||
$pdf->SetXY(18,25);
|
||||
$pdf->Write(0, $recu->nom);
|
||||
$pdf->SetXY(108,25);
|
||||
$pdf->Write(0, $recu->prenom);
|
||||
$pdf->SetXY(18,38);
|
||||
$pdf->Write(0, utf8_decode($recu->adresse));
|
||||
$pdf->SetXY(38,44);
|
||||
$pdf->Write(0, $recu->codepostal);
|
||||
$pdf->SetXY(78,44);
|
||||
$pdf->Write(0, utf8_decode($recu->ville));
|
||||
$pdf->SetXY(85,69); // Somme en chiffre
|
||||
$pdf->Write(0, utf8_decode("***".$recu->montant."***"));
|
||||
$pdf->SetXY(58,79); // Somme en toute lettre
|
||||
$pdf->Write(0, utf8_decode(numfmt_create('fr_FR', \NumberFormatter::SPELLOUT)->format($recu->montant)) . ' euros');
|
||||
$date = date_parse($recu->date);
|
||||
|
||||
$pdf->SetXY(70,88); // Jour du don
|
||||
$pdf->Write(0, $date['day']);
|
||||
$pdf->SetXY(81,88); // Mois du don
|
||||
$pdf->Write(0, $date['month']);
|
||||
$pdf->SetXY(97,88); // Année du don
|
||||
$pdf->Write(0, $date['year']);
|
||||
if($plugin->getConfig('droit_art200')){
|
||||
$pdf->SetXY(56.5,103); // 200
|
||||
$pdf->Write(0, "X");
|
||||
}
|
||||
if($plugin->getConfig('droit_art238bis')){
|
||||
$pdf->SetXY(106.5,103); // 238 bis
|
||||
$pdf->Write(0, "X");
|
||||
}
|
||||
if($plugin->getConfig('droit_art885-0VbisA')){
|
||||
$pdf->SetXY(156.5,103); // 885-0 V bis A
|
||||
$pdf->Write(0, "X");
|
||||
}
|
||||
$pdf->SetXY(119,120.5); // Déclaration de don manuel
|
||||
$pdf->Write(0, "X");
|
||||
$pdf->SetXY(19,142.5); // Numéraire
|
||||
$pdf->Write(0, "X");
|
||||
switch ($recu->mode_paiement){
|
||||
case 0:
|
||||
$pdf->SetXY(19,165); // Remise d'espèces
|
||||
$pdf->Write(0, "X");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
$pdf->SetXY(61.5,165); // Chèque
|
||||
$pdf->Write(0, "X");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$pdf->SetXY(119,165); // Virement, prélèvement, carte bancaire
|
||||
$pdf->Write(0, "X");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$pdf->SetXY(143,245); // Jour de l'édition du document
|
||||
$pdf->Write(0, date('d'));
|
||||
$pdf->SetXY(151,245); // Mois de l'édition du document
|
||||
$pdf->Write(0, date('m'));
|
||||
$pdf->SetXY(158,245); // Année de l'édition du document
|
||||
$pdf->Write(0, date('y'));
|
||||
$img = new Fichiers($plugin->getConfig('signaturetxt'));
|
||||
$cache_id = 'fichiers.' . $img->id_contenu;
|
||||
if (!Static_Cache::exists($cache_id))
|
||||
{
|
||||
$blob = DB::getInstance()->openBlob('fichiers_contenu', 'contenu', (int)$img->id_contenu);
|
||||
Static_Cache::storeFromPointer($cache_id, $blob);
|
||||
fclose($blob);
|
||||
}
|
||||
$uri = Static_Cache::getPath($cache_id);
|
||||
$pdf->Image($uri, 140, 247, 50, 0, 'PNG' ); // Emplacement de la signature avec restriction de largeur pour tenir dans sur la case.
|
||||
$pdf->Output($recu->gen_ordre.".pdf", "I");
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace Garradin;
|
||||
|
||||
$session->requireAccess('compta', Membres::DROIT_ADMIN);
|
||||
|
||||
$error = false;
|
||||
|
||||
if (isset($_GET['ok']))
|
||||
{
|
||||
$error = 'OK';
|
||||
}
|
||||
|
||||
$recus = new Plugin\RecuDon\GenDon;
|
||||
|
||||
$trecus = $recus->listSimple();
|
||||
|
||||
$tpl->assign('trecus', $trecus);
|
||||
$tpl->assign('error', $error);
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/recu.tpl');
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
namespace Garradin;
|
||||
|
||||
if ($user['droits']['compta'] < Membres::DROIT_ADMIN)
|
||||
{
|
||||
throw new UserException("Vous n'avez pas le droit d'accéder à cette page.");
|
||||
}
|
||||
|
||||
$gendon = new Plugin\RecuDon\GenDon;
|
||||
|
||||
$recu = $gendon->get(Utils::get('id'));
|
||||
|
||||
if (!$recu)
|
||||
{
|
||||
throw new UserException("Le reçu demandé n'existe pas.");
|
||||
}
|
||||
|
||||
$error = false;
|
||||
|
||||
if (!empty($_POST['remove']))
|
||||
{
|
||||
if (!Utils::CSRF_check('recu_supprimer_'.$recu['id']))
|
||||
{
|
||||
$error = 'Une erreur est survenue, merci de renvoyer le formulaire.';
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
$gendon->remove($recu['id']);
|
||||
Utils::redirect(PLUGIN_URL . 'recu.php');
|
||||
}
|
||||
catch (UserException $e)
|
||||
{
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tpl->assign('error', $error);
|
||||
|
||||
$tpl->assign('recu', $recu);
|
||||
|
||||
$tpl->display(PLUGIN_ROOT . '/templates/supprimer.tpl');
|
Loading…
Reference in New Issue