Subversion Repositories Applications.annuaire

Rev

Rev 296 | Rev 336 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 296 Rev 329
Line 236... Line 236...
236
    	}
236
    	}
Line 237... Line 237...
237
    	
237
    	
238
    	return $infos_historique_cotisation_formatees;
238
    	return $infos_historique_cotisation_formatees;
Line 239... Line 239...
239
    }
239
    }
Line 240... Line 240...
240
        
240
    
241
	private function envoyerRecuCotisation($param) {
-
 
242
		
241
    private function obtenirNumeroRecuCotisation($param) {
Line 243... Line 242...
243
    	$id_cotisation = $param['id_cotisation'];
242
    	
244
    	
243
    	$id_cotisation = $param['id_cotisation'];
245
    	$id_utilisateur = $param['id_utilisateur'];
244
    	$id_utilisateur = $param['id_utilisateur'];
Line 271... Line 270...
271
 
270
    	
Line 272... Line 271...
272
	    if(!$this->recuEstGenere($infos_cotisation_formatees)) {
271
	    if(!$this->recuEstGenere($infos_cotisation_formatees)) {
273
	    	
272
	    	
274
    		$numero_nouveau_recu = $this->calculerNouvelOrdreRecuPourCotisation($infos_cotisation_formatees);
273
    		$numero_nouveau_recu = $this->calculerNouvelOrdreRecuPourCotisation($infos_cotisation_formatees);
Line 275... Line 274...
275
    		$infos_cotisation_formatees['recu_envoye'] = $numero_nouveau_recu;
274
    		$infos_cotisation_formatees['recu_envoye'] = $numero_nouveau_recu;
Line 276... Line 275...
276
    		$infos_cotisation_formatees = $this->mettreAJourNumeroRecu($infos_cotisation_formatees['id_cotisation'],$numero_nouveau_recu);
275
    		$this->mettreAJourNumeroRecu($infos_cotisation_formatees['id_cotisation'],$numero_nouveau_recu);
277
    	
-
 
278
	    }
276
    	
Line 279... Line -...
279
	    
-
 
280
	    if(!$this->recuEstEnvoye($infos_cotisation_formatees)) {
-
 
281
	    	$infos_cotisation_formatees = $this->mettreAJourDateEnvoiRecuPourCotisation($infos_cotisation_formatees);
277
	    }    
Line -... Line 278...
-
 
278
 
282
	    }
279
	    return $infos_cotisation_formatees;
Line -... Line 280...
-
 
280
    }
283
	    
281
    
-
 
282
    private function initialiserInformationsAnnuaireUtilisateur($param) {
Line 284... Line 283...
284
    	$recu = new Recu();
283
    	
Line -... Line 284...
-
 
284
    	$id_cotisation = $param['id_cotisation'];
285
    	
285
    	$id_utilisateur = $param['id_utilisateur'];
-
 
286
    	
Line 286... Line 287...
286
    	$recu_pdf = $recu->renvoyerRecuPdf($utilisateur, $infos_cotisation_formatees);
287
		if(!Registre::getInstance()->get('est_admin')) {
Line 287... Line 288...
287
    	
288
    		$param['id_utilisateur'] = Registre::getInstance()->get('identification_id');
288
    	$messagerie = new MessageControleur();
289
    	}
Line 289... Line 290...
289
    	
290
    	
Line 290... Line 291...
290
    	$donnees['url_voir_recu'] = $this->getUrlTelechargementRecuPourMail($id_cotisation);
291
    	$id_annuaire = Config::get('annuaire_defaut');
Line 291... Line 292...
291
    	
292
    	
Line 292... Line 293...
292
    	$contenu_message = $this->renvoyerSquelette('message_recu_cotisation', $donnees);
293
    	if(isset($_GET['id_annuaire'])) {
293
    	
294
    		$param['id_annuaire'] = $_GET['id_annuaire'];
294
    	$envoi = $messagerie->envoyerMailAvecPieceJointe(Config::get('adresse_mail_cotisation'), 'aurelienperonnet@gmail.com', 'Recu pour votre don à tela botanica', $contenu_message, $recu_pdf, 'Recu.pdf', 'application/pdf');
295
    	}
Line 295... Line 296...
295
    	
296
    	
-
 
297
    	$param['utilisateur'] = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
Line 296... Line 298...
296
    	$param['message'] = 'Votre reçu a bien été envoyé à l\'adresse '.$utilisateur['mail']['amv_valeur'];
298
    	
-
 
299
    	return $param;
-
 
300
    }
-
 
301
        
-
 
302
	private function envoyerRecuCotisation($param) {
-
 
303
		
-
 
304
		$param = $this->initialiserInformationsAnnuaireUtilisateur($param);
297
    	
305
		
298
    	return $this->afficherInformationsCotisationPourInscrit($param);
306
		$infos_cotisation_formatees = $this->obtenirNumeroRecuCotisation($param);
Line 299... Line 307...
299
    }
307
		
Line -... Line 308...
-
 
308
		if(!$this->recuEstEnvoye($infos_cotisation_formatees)) {
-
 
309
	    	$infos_cotisation_formatees['date_envoi_recu'] = $this->mettreAJourDateEnvoiRecuPourCotisation($infos_cotisation_formatees);
300
    
310
	    }
301
    private function voirRecuCotisation($param) {
311
		
302
    	
312
    	$recu = new Recu();
Line 303... Line 313...
303
    	$id_cotisation = $param['id_cotisation'];
313
    	$recu_pdf = $recu->renvoyerRecuPdf($param['utilisateur'], $infos_cotisation_formatees);
304
    	
314
    	
Line 305... Line 315...
305
    	$id_utilisateur = $param['id_utilisateur'];
315
    	$messagerie = new MessageControleur();
306
    	
316
    	$donnees['url_voir_recu'] = $this->getUrlTelechargementRecuPourMail($param['id_cotisation']);
307
    	if(!Registre::getInstance()->get('est_admin')) {
317
    	$contenu_message = $this->renvoyerSquelette('message_recu_cotisation', $donnees);
Line 308... Line 318...
308
    		$id_utilisateur = Registre::getInstance()->get('identification_id');
318
    	$envoi = $messagerie->envoyerMailAvecPieceJointe(Config::get('adresse_mail_cotisation'), $param['utilisateur']['mail']['amv_valeur'], 'Recu pour votre don à tela botanica', $contenu_message, $recu_pdf, 'Recu.pdf', 'application/pdf');
-
 
319
   
Line 309... Line 320...
309
    	}
320
    	$param['message'] = 'Votre reçu a bien été envoyé à l\'adresse '.$param['utilisateur']['mail']['amv_valeur'];
310
    	
321
    	
311
    	$id_annuaire = Config::get('annuaire_defaut');
322
    	return $this->afficherInformationsCotisationPourInscrit($param);
312
    	
-
 
313
    	if(isset($_GET['id_annuaire'])) {
323
    }
Line 314... Line 324...
314
    		$id_annuaire = $_GET['id_annuaire'];
324
    
Line 315... Line 325...
315
    	}
325
    private function voirRecuCotisation($param) {
Line 316... Line 326...
316
    	
326
    	
317
    	$utilisateur = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
327
		$param = $this->initialiserInformationsAnnuaireUtilisateur($param);
Line 318... Line 328...
318
    	
328
		    	
Line 371... Line 381...
371
    private function mettreAJourDateEnvoiRecuPourCotisation($cotisation) {
381
    private function mettreAJourDateEnvoiRecuPourCotisation($cotisation) {
Line 372... Line 382...
372
    	
382
    	
373
    	$cotisation_modele = new CotisationModele();
383
    	$cotisation_modele = new CotisationModele();
Line 374... Line 384...
374
    	$cotisation_modele->mettreAJourDateEnvoiRecu($cotisation['id_cotisation']);
384
    	$cotisation_modele->mettreAJourDateEnvoiRecu($cotisation['id_cotisation']);
Line 375... Line 385...
375
    	
385
    	
376
    	$cotisation['date_envoi_recu'] = $this->genererDateCouranteFormatMySql();
386
    	$date_envoi_recu = $this->genererDateCouranteFormatAnnuaire();
Line 377... Line 387...
377
    	
387
    	
Line 378... Line 388...
378
    	return $cotisation;
388
    	return $date_envoi_recu;
379
    }
389
    }
Line 380... Line 390...
380
    
390
    
381
	private function mettreAJourNumeroRecu($id_cotisation, $numero_recu) {
391
	private function mettreAJourNumeroRecu($id_cotisation, $numero_recu) {
Line 382... Line 392...
382
       	
392
       	
Line 383... Line 393...
383
    	$cotisation_modele = new CotisationModele();
393
    	$cotisation_modele = new CotisationModele();
Line 384... Line 394...
384
    	$cotisation_modele->mettreAJourNumeroRecu($id_cotisation, $numero_recu);
394
    	$maj_cotisation_num_recu = $cotisation_modele->mettreAJourNumeroRecu($id_cotisation, $numero_recu);
385
    	
395
    	
386
    	return $cotisation;
396
    	return $maj_cotisation_num_recu;
-
 
397
    }
387
    }
398
    
388
    
399
    private function formaterInformationsCotisationPourEnvoi($cotisation) {
389
    private function formaterInformationsCotisationPourEnvoi($cotisation) {
400
    	
390
    	
401
    	$cotisation_modele = new CotisationModele(); 
391
    	$cotisation_modele = new CotisationModele(); 
402
    	
Line 515... Line 526...
515
    	}
526
    	}
Line 516... Line 527...
516
    	
527
    	
517
    	return true;
528
    	return true;
Line -... Line 529...
-
 
529
    }
-
 
530
    
-
 
531
    private function formaterAnneeDateCotisationMySql($date_cotisation) {
-
 
532
    	
-
 
533
    	$annee_cotisation = '0';
-
 
534
    	
-
 
535
    	if($date_cotisation != '0') {
-
 
536
    		$annee_cotisation = date('Y',strtotime($date_cotisation));
-
 
537
    	}
-
 
538
    	
-
 
539
    	return $annee_cotisation;
518
    }
540
    }
519
    
541
    
520
    private function formaterDateMysqlVersDateCotisation($date) {
542
    private function formaterDateMysqlVersDateCotisation($date) {
521
    	if($date == '0000-00-00') {
543
    	if($date == '0000-00-00') {
522
    		return 0;
544
    		return 0;