Example #1
0
 /**
  * Genera il nuovo tesserino per il socio ordinario sulla base della richiesta
  * @return bool(false)|File     Il tesserino del volontario, o false in caso di fallimento
  */
 public function generaTesserinoOrdinario()
 {
     $utente = $this->utente();
     // Verifica l'assegnazione di un codice al tesserino
     if (!$this->haCodice()) {
         $codice = $this->assegnaCodice();
     } else {
         $codice = $this->codice;
     }
     $f = new PDF('tesseriniordinari', "Tesserino_{$codice}.pdf");
     $f->formato = 'cr80';
     $f->orientamento = ORIENTAMENTO_ORIZZONTALE;
     $f->_NOME = $utente->nome;
     $f->_COGNOME = $utente->cognome;
     $f->_CODICEFISCALE = $utente->codiceFiscale;
     $f->_COMITATO = $utente->unComitato(MEMBRO_ORDINARIO)->locale()->formattato;
     $int = "Croce Rossa Italiana<br />{$utente->unComitato(MEMBRO_ORDINARIO)->locale()->nome}";
     $f->_INTESTAZIONE = $int;
     $socio = 'SOCIA';
     if ($utente->sesso == UOMO) {
         $socio = 'SOCIO';
     }
     $f->_SOCIO = $socio;
     $f->_INGRESSO = $utente->ingresso()->format('d/m/Y');
     $f->_CODICE = $codice;
     $scadenza = $this->timestamp + 5 * ANNO;
     $f->_SCADENZA = date('m/Y', $scadenza);
     $barcode = new Barcode();
     $barcode->genera($codice);
     $f->_BARCODE = $barcode->percorso();
     return $f->salvaFile();
 }