Subversion Repositories Applications.annuaire

Rev

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

Rev 296 Rev 329
Line 235... Line 235...
235
    		$infos_historique_cotisation_formatees[] = $this->formaterInformationsCotisationPourEnvoi($cotisation);
235
    		$infos_historique_cotisation_formatees[] = $this->formaterInformationsCotisationPourEnvoi($cotisation);
236
    	}
236
    	}
Line 237... Line 237...
237
    	
237
    	
238
    	return $infos_historique_cotisation_formatees;
238
    	return $infos_historique_cotisation_formatees;
239
    }
239
    }
240
        
240
    
241
	private function envoyerRecuCotisation($param) {
-
 
242
		
-
 
Line -... Line 241...
-
 
241
    private function obtenirNumeroRecuCotisation($param) {
243
    	$id_cotisation = $param['id_cotisation'];
242
    	
Line 244... Line 243...
244
    	
243
    	$id_cotisation = $param['id_cotisation'];
245
    	$id_utilisateur = $param['id_utilisateur'];
244
    	$id_utilisateur = $param['id_utilisateur'];
246
    	
245
    	
Line 266... Line 265...
266
    	if(empty($infos_cotisation)) {
265
    	if(empty($infos_cotisation)) {
267
    		return;
266
    		return;
268
    	}
267
    	}
Line 269... Line 268...
269
    	
268
    	
270
    	$infos_cotisation_formatees = $this->formaterInformationsCotisationPourEnvoi($infos_cotisation);
269
    	$infos_cotisation_formatees = $this->formaterInformationsCotisationPourEnvoi($infos_cotisation);
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);
275
    		$infos_cotisation_formatees['recu_envoye'] = $numero_nouveau_recu;
-
 
276
    		$infos_cotisation_formatees = $this->mettreAJourNumeroRecu($infos_cotisation_formatees['id_cotisation'],$numero_nouveau_recu);
-
 
277
    	
-
 
278
	    }
-
 
279
	    
-
 
280
	    if(!$this->recuEstEnvoye($infos_cotisation_formatees)) {
-
 
281
	    	$infos_cotisation_formatees = $this->mettreAJourDateEnvoiRecuPourCotisation($infos_cotisation_formatees);
-
 
282
	    }
-
 
283
	    
-
 
284
    	$recu = new Recu();
-
 
285
    	
-
 
286
    	$recu_pdf = $recu->renvoyerRecuPdf($utilisateur, $infos_cotisation_formatees);
-
 
Line 287... Line -...
287
    	
-
 
288
    	$messagerie = new MessageControleur();
274
    		$infos_cotisation_formatees['recu_envoye'] = $numero_nouveau_recu;
289
    	
-
 
290
    	$donnees['url_voir_recu'] = $this->getUrlTelechargementRecuPourMail($id_cotisation);
275
    		$this->mettreAJourNumeroRecu($infos_cotisation_formatees['id_cotisation'],$numero_nouveau_recu);
291
    	
-
 
292
    	$contenu_message = $this->renvoyerSquelette('message_recu_cotisation', $donnees);
-
 
293
    	
-
 
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
    	
276
    	
296
    	$param['message'] = 'Votre reçu a bien été envoyé à l\'adresse '.$utilisateur['mail']['amv_valeur'];
277
	    }    
Line 297... Line 278...
297
    	
278
 
Line 298... Line 279...
298
    	return $this->afficherInformationsCotisationPourInscrit($param);
279
	    return $infos_cotisation_formatees;
299
    }
-
 
300
    
280
    }
Line 301... Line 281...
301
    private function voirRecuCotisation($param) {
281
    
302
    	
282
    private function initialiserInformationsAnnuaireUtilisateur($param) {
303
    	$id_cotisation = $param['id_cotisation'];
283
    	
Line 304... Line 284...
304
    	
284
    	$id_cotisation = $param['id_cotisation'];
Line 305... Line 285...
305
    	$id_utilisateur = $param['id_utilisateur'];
285
    	$id_utilisateur = $param['id_utilisateur'];
306
    	
286
    	
307
    	if(!Registre::getInstance()->get('est_admin')) {
287
		if(!Registre::getInstance()->get('est_admin')) {
Line 308... Line 288...
308
    		$id_utilisateur = Registre::getInstance()->get('identification_id');
288
    		$param['id_utilisateur'] = Registre::getInstance()->get('identification_id');
Line -... Line 289...
-
 
289
    	}
-
 
290
    	
-
 
291
    	$id_annuaire = Config::get('annuaire_defaut');
-
 
292
    	
-
 
293
    	if(isset($_GET['id_annuaire'])) {
-
 
294
    		$param['id_annuaire'] = $_GET['id_annuaire'];
-
 
295
    	}
-
 
296
    	
-
 
297
    	$param['utilisateur'] = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
-
 
298
    	
-
 
299
    	return $param;
-
 
300
    }
-
 
301
        
-
 
302
	private function envoyerRecuCotisation($param) {
-
 
303
		
-
 
304
		$param = $this->initialiserInformationsAnnuaireUtilisateur($param);
-
 
305
		
-
 
306
		$infos_cotisation_formatees = $this->obtenirNumeroRecuCotisation($param);
-
 
307
		
-
 
308
		if(!$this->recuEstEnvoye($infos_cotisation_formatees)) {
-
 
309
	    	$infos_cotisation_formatees['date_envoi_recu'] = $this->mettreAJourDateEnvoiRecuPourCotisation($infos_cotisation_formatees);
-
 
310
	    }
-
 
311
		
-
 
312
    	$recu = new Recu();
-
 
313
    	$recu_pdf = $recu->renvoyerRecuPdf($param['utilisateur'], $infos_cotisation_formatees);
-
 
314
    	
-
 
315
    	$messagerie = new MessageControleur();
-
 
316
    	$donnees['url_voir_recu'] = $this->getUrlTelechargementRecuPourMail($param['id_cotisation']);
-
 
317
    	$contenu_message = $this->renvoyerSquelette('message_recu_cotisation', $donnees);
-
 
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');
309
    	}
319
   
310
    	
320
    	$param['message'] = 'Votre reçu a bien été envoyé à l\'adresse '.$param['utilisateur']['mail']['amv_valeur'];
311
    	$id_annuaire = Config::get('annuaire_defaut');
321
    	
Line 312... Line 322...
312
    	
322
    	return $this->afficherInformationsCotisationPourInscrit($param);
313
    	if(isset($_GET['id_annuaire'])) {
323
    }
Line 314... Line 324...
314
    		$id_annuaire = $_GET['id_annuaire'];
324
    
315
    	}
325
    private function voirRecuCotisation($param) {
316
    	
326
    	
Line 317... Line 327...
317
    	$utilisateur = $this->obtenirValeursUtilisateur($id_annuaire, $id_utilisateur);
327
		$param = $this->initialiserInformationsAnnuaireUtilisateur($param);
-
 
328
		    	
318
    	
329
	    if(!isset($param['id_cotisation'])) {
319
	    if(!isset($id_cotisation)) {
330
    		return;
320
    		return;
331
    	}
321
    	}
332
    	
322
    	
-
 
323
    	$cotisation_modele = new CotisationModele(); 
333
    	$cotisation_modele = new CotisationModele(); 
Line 324... Line 334...
324
    	$infos_cotisation = $cotisation_modele->obtenirInformationsPourIdCotisation($id_cotisation, $id_utilisateur);
334
    	$infos_cotisation = $cotisation_modele->obtenirInformationsPourIdCotisation($param['id_cotisation'], $param['id_utilisateur']);
Line 325... Line 335...
325
 
335
 
Line 326... Line 336...
326
    	if(empty($infos_cotisation)) {
336
    	if(empty($infos_cotisation)) {
327
    		return;
337
    		return;
Line 328... Line 338...
328
    	}
338
    	}
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;