Commit d6011aff authored by Eric Seigne's avatar Eric Seigne
Browse files

Merge branch 'master' into prod

parents b07051eb ada0498e
APP_NAME="DoliScan"
APP_VERSION="1.6.10"
APP_ENV="development"
NODE_ENV="development"
APP_ENV="dev"
NODE_ENV="dev"
APP_KEY=
APP_DEBUG="true"
APP_URL="http://localhost"
......@@ -48,6 +47,8 @@ MAIL_PING="ping@localhost"
# urgences, alertes, pannes etc.
MAIL_SAV="sav@localhost"
# niveau securite (en copie des mails sécu)
MAIL_SECURITY="secu.staff@localhost"
# configuration serveur mail
MAIL_MAILER="smtp"
......
<?php
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'combine_consecutive_unsets' => true,
'class_attributes_separation' => ['elements' => ['method' => 'one', ]],
'multiline_whitespace_before_semicolons' => false,
'single_quote' => false,
'binary_operator_spaces' => [
'operators' => [
// '=>' => 'align',
// '=' => 'align'
]
],
// 'blank_line_after_opening_tag' => true,
// 'blank_line_before_statement' => true,
'braces' => [
'allow_single_line_closure' => true,
],
// 'cast_spaces' => true,
// 'class_definition' => array('singleLine' => true),
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => true,
'function_typehint_space' => true,
'single_line_comment_style' => ['comment_types' => ['hash']],
'include' => true,
'lowercase_cast' => true,
// 'native_function_casing' => true,
// 'new_with_braces' => true,
// 'no_blank_lines_after_class_opening' => true,
// 'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => true,
// 'no_empty_comment' => true,
// 'no_empty_phpdoc' => true,
// 'no_empty_statement' => true,
'no_extra_blank_lines' => [
'tokens' => [
'curly_brace_block',
'extra',
// 'parenthesis_brace_block',
// 'square_brace_block',
'throw',
'use',
]
],
// 'no_leading_import_slash' => true,
// 'no_leading_namespace_whitespace' => true,
// 'no_mixed_echo_print' => array('use' => 'echo'),
'no_multiline_whitespace_around_double_arrow' => true,
// 'no_short_bool_cast' => true,
// 'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
// 'no_trailing_comma_in_list_call' => true,
// 'no_trailing_comma_in_singleline_array' => true,
// 'no_unneeded_control_parentheses' => true,
// 'no_unused_imports' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
// 'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
// 'php_unit_fqcn_annotation' => true,
// 'phpdoc_align' => true,
// 'phpdoc_annotation_without_dot' => true,
// 'phpdoc_indent' => true,
// 'phpdoc_inline_tag' => true,
// 'phpdoc_no_access' => true,
// 'phpdoc_no_alias_tag' => true,
// 'phpdoc_no_empty_return' => true,
// 'phpdoc_no_package' => true,
// 'phpdoc_no_useless_inheritdoc' => true,
// 'phpdoc_return_self_reference' => true,
// 'phpdoc_scalar' => true,
// 'phpdoc_separation' => true,
// 'phpdoc_single_line_var_spacing' => true,
// 'phpdoc_summary' => true,
// 'phpdoc_to_comment' => true,
// 'phpdoc_trim' => true,
// 'phpdoc_types' => true,
// 'phpdoc_var_without_name' => true,
// 'increment_style' => true,
// 'return_type_declaration' => true,
// 'self_accessor' => true,
// 'short_scalar_cast' => true,
// 'single_blank_line_before_namespace' => true,
// 'single_class_element_per_statement' => true,
// 'space_after_semicolon' => true,
// 'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
// 'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'whitespace_after_comma_in_array' => true,
'space_after_semicolon' => true,
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
'sort_algorithm' => 'length'
],
// 'single_blank_line_at_eof' => false
])
// ->setIndent("\t")
->setLineEnding("\n")
;
......@@ -2,7 +2,7 @@
/*
* SendLastNDF.php
*
* Copyright (c) 2019-2020 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (c) 2019-2021 Eric Seigne <eric.seigne@cap-rel.fr>
*
*This program is free software: you can redistribute it and/or modify
*it under the terms of the GNU Affero General Public License as
......@@ -17,15 +17,15 @@
*You should have received a copy of the GNU Affero General Public License
*along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Http\Controllers\NdeFraisController;
use App\LdeFrais;
use App\User;
use App\LdeFrais;
use App\NdeFrais;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\NdeFraisController;
class SendLastNDF extends Command
{
......@@ -67,7 +67,7 @@ class SendLastNDF extends Command
//
if ($this->option('email') != "") {
$users = User::where('email', $this->option('email'))->get();
if (! $users) {
if (!$users) {
Log::debug("mail not found : " . $this->option('email'));
return;
}
......
......@@ -25,6 +25,10 @@ use Illuminate\Support\Facades\Log;
class Exports
{
private $_ndf;
private $_justifsPath;
private $_basepath;
protected $_codeDossier; //Le code dossier, ex 4CAP
protected $_user;
protected $_initials;
......@@ -55,13 +59,25 @@ class Exports
{
// Log::debug("Création d'un Export " . $filename . " et " . $endOfMonth);
if ($user) {
Log::debug("SETUP filename=$filename, directory=$directory,endofmonth=$endOfMonth,filenamendf=$filenameNDF");
Log::debug("Exports::_setup filename=$filename, directory=$directory,endofmonth=$endOfMonth,filenamendf=$filenameNDF");
$this->_user = $user;
$this->_initials = $user->initials(2);
$this->_codeDossier = $user->compta_code_dossier;
if($this->_codeDossier == "") {
$this->_codeDossier = "CODECLIENTVIDE";
}
}
$this->_filename = $filename;
if ($endOfMonth) {
$this->_zipFileName = $endOfMonth->format('Ymd') . '-' . Str::slug($user->email, '_') . '-generic.zip';
if ($filename == null) {
if ($endOfMonth && $user) {
$this->_zipFileName = $endOfMonth->format('Ymd') . '-' . Str::slug($user->email, '_') . '-generic.zip';
} elseif ($user) {
$this->_zipFileName = 'NODATE-' . Str::slug($user->email, '_') . '-generic.zip';
} else {
$this->_zipFileName = 'NODATE-NONAME-generic.zip';
}
} else {
$this->_filename = $filename;
}
$this->_directory = $directory;
$this->_endOfMonth = $endOfMonth;
......@@ -93,15 +109,15 @@ class Exports
}
if (!is_dir($this->_directory)) {
Log::debug("Création du dossier " . $this->_directory);
Log::debug("Exports::export Création du dossier " . $this->_directory);
mkdir($this->_directory, 0770, true);
}
if (file_exists($filename) && !$forceUpdate) {
Log::debug("Le fichier $filename existe déjà, on le passe tel-quel");
Log::debug("Exports::export Le fichier $filename existe déjà, on le passe tel-quel");
return true;
} else {
Log::debug("Ecriture du fichier $filename ...");
Log::debug("Exports::export Ecriture du fichier $filename ...");
$file = fopen($filename, 'w');
fwrite($file, $this->_content);
fclose($file);
......
......@@ -596,6 +596,7 @@ class LoginController extends Controller
return $this->jsonResponse($message, $code);
}
//Attention code en doublon avec RegisterController::registered
//Au passage on retourne la clé API de l'utilisateur et pas la clé API via le nouveau module passport ...
//On ameliore donc le post possible si on demande au passage la création d'une clé passport
if (isset($request->askForAPI) && isset($request->askForAPIAppName)) {
......
......@@ -17,32 +17,32 @@
*You should have received a copy of the GNU Affero General Public License
*along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace App\Http\Controllers;
use App;
use App\BaseCalculIks;
use App\Entreprise;
use Auth;
use App\User;
use App\LdeFrais;
use App\MoyenPaiement;
use App\NdeFrais;
use App\Vehicule;
use App\TypeFrais;
use App\User;
use Auth;
use App\Entreprise;
use App\BaseCalculIks;
use App\MoyenPaiement;
use App\Events\ExportNDF;
use App\Exports\ExportFEC;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
//Pour la transformation en PDF
use App\Exports\ExportQuadratus;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Intervention\Image\Gd\Shapes\EllipseShape;
use Illuminate\Support\Arr;
//Pour la transformation en PDF
use Nwidart\Modules\Facades\Module;
use Illuminate\Support\Facades\Crypt;
use Symfony\Component\Process\Process;
use Intervention\Image\Gd\Shapes\EllipseShape;
use Symfony\Component\Process\Exception\ProcessFailedException;
use App\Exports\ExportQuadratus;
use App\Exports\ExportFEC;
use Illuminate\Support\Facades\Crypt;
use App\Events\ExportNDF;
use App\Vehicule;
class NdeFraisController extends Controller
{
......@@ -79,7 +79,7 @@ class NdeFraisController extends Controller
Log::debug("NdeFraisController::il reste $reste");
//On recupere la 1ere partie
$tab = explode("/", $reste);
$lenom = $tab[0];
$lenom = $tab[0];
$ladate = substr($tab[1], 0, strpos($tab[1], "-"));
Log::debug("NdeFraisController::le login est $lenom et $ladate");
//On remplace le "@" de l'adresse mail par un "-"
......@@ -104,7 +104,7 @@ class NdeFraisController extends Controller
//Les 12 dernières, à voir si on fait de la pagination ?
$retour = Auth::user()->NdeFrais->sortByDesc('debut')->splice(0, 12);
Log::debug(" retourne : " . json_encode($retour));
// Log::debug(" retourne : " . json_encode($retour));
return $retour;
}
......@@ -129,7 +129,7 @@ class NdeFraisController extends Controller
}
//Les 12 dernières, à voir si on fait de la pagination ?
Log::debug(" retourne : " . json_encode($retour));
// Log::debug(" retourne : " . json_encode($retour));
return $retour->sortByDesc('debut')->splice(0, 12);
}
......@@ -173,7 +173,7 @@ class NdeFraisController extends Controller
activity('NdeFrais')->log("NdeFrais: get details for NDF/" . Carbon::parse($this->_ndf->fin)->format('F Y'));
$lignes = array();
$lignes = [];
// sur l'api on mélange pro et perso, il faut donc pouvoir avoir l'info ... ainsi que le moyen de paiement
$lignes = NdeFrais::findOrFail($id)->ldeFrais()->with('moyenPaiement')->with('typeFrais')->get()->sortBy('ladate');
// Log::debug($lignes);
......@@ -202,14 +202,14 @@ class NdeFraisController extends Controller
//Dans certains cas il faut forcer l'update ... sauf si on a fait un appel de cette fonction "forcé" :)
//Tant que la note de frais n'est pas cloturée on force le refresh
if ($this->_ndf->status != NdeFrais::STATUS_CLOSED) {
Log::debug("NdeFraisController:: serveur en prod mais NDF pas encore cloturée force refresh PDF");
Log::debug("NdeFraisController:: NDF pas encore cloturée force refresh PDF");
$forceUpdate = true;
} else {
//A partir du moment où elle est cloturée on interdit le refresh ... sauf si elle n'a jamais été faite de manière "finale" (on a fait des)
//pdf en mode brouillons par exemple ou aucun pdf n'a été fait ... la manière de savoir si elle est faite de manière finale c'est lancé
//depuis le CLI (cron)
if (php_sapi_name() == 'cli') {
Log::debug("NdeFraisController:: serveur en prod, NDF cloturée mais lancé par la CLI donc force refresh PDF");
Log::debug("NdeFraisController:: NDF cloturée mais lancé par la CLI donc force refresh PDF");
$forceUpdate = true;
}
}
......@@ -229,7 +229,7 @@ class NdeFraisController extends Controller
$this->_userID = $this->_ndf->user_id;
$this->_user = User::find($this->_userID);
$finDuMois = Carbon::parse($this->_ndf->fin);
$finDuMois = Carbon::parse($this->_ndf->fin);
$debutDuMois = Carbon::parse($this->_ndf->fin)->startOfMonth();
$this->_endOfMonth = $finDuMois;
$this->_month = $finDuMois->month;
......@@ -245,14 +245,13 @@ class NdeFraisController extends Controller
$baseCalculIK = new BaseCalculIks($finDuMois);
$ldeFrais = new LdeFrais();
$lignesperso = array();
$lignesIK = array();
$lignespro = array();
$lignesperso = [];
$lignesIK = [];
$lignespro = [];
$idTypeFraisIK = TypeFrais::where('slug', 'ik')->pluck('id');
$idTypeFraisIKRegule = TypeFrais::where('slug', 'ik-regule')->pluck('id');
// Log::debug("NdeFraisController :: webBuildPDF 2");
//On archive le PDF généré et s'il existe déjà on le passe directement sans le recalculer
......@@ -263,7 +262,7 @@ class NdeFraisController extends Controller
//Attention, le PDF de la note de frais n'existe pas encore ou n'est pas à jour ...
$this->_QuadraObject = new ExportQuadratus($this->_user, $nomPJ . "_quadratus.TXT", $directory, $finDuMois, $nomPDF);
$this->_FECObject = new ExportFEC($this->_user, $nomPJ . ".TXT", $directory, $finDuMois, $nomPDF);
$this->_FECObject = new ExportFEC($this->_user, $nomPJ . ".TXT", $directory, $finDuMois, $nomPDF);
if (!is_dir($directory)) {
mkdir($directory, 0770, true);
......@@ -283,7 +282,7 @@ class NdeFraisController extends Controller
$debutUtilisationR = $this->_ndf->where('user_id', $this->_userID)->orderby('debut', 'asc')->first();
if ($debutUtilisationR) {
$debutUtilisation = $debutUtilisationR->debut;
Log::debug(" NdeFraisController :: webBuildPDF :: utilisationDoliScanAnneeComplete " . json_encode($debutUtilisationR));
// Log::debug(" NdeFraisController :: webBuildPDF :: utilisationDoliScanAnneeComplete " . json_encode($debutUtilisationR));
if (Carbon::parse($this->_ndf->fin)->startOfYear() > $debutUtilisation) {
$utilisationDoliScanAnneeComplete = true;
Log::debug(" NdeFraisController :: webBuildPDF :: utilisationDoliScanAnneeComplete [a] $utilisationDoliScanAnneeComplete ($debutUtilisation)");
......@@ -299,7 +298,7 @@ class NdeFraisController extends Controller
// ============================================================================== les frais payés perso ==========================================================================================================================
//On recupere les types de frais utilisés sur cette note de frais
$paiementPersoId = MoyenPaiement::where('is_pro', '0')->pluck('id');
$tabID = LdeFrais::where('nde_frais_id', $id)->whereIn('moyen_paiement_id', $paiementPersoId)->whereNotIn('type_frais_id', array($idTypeFraisIK, $idTypeFraisIKRegule))
$tabID = LdeFrais::where('nde_frais_id', $id)->whereIn('moyen_paiement_id', $paiementPersoId)->whereNotIn('type_frais_id', [$idTypeFraisIK, $idTypeFraisIKRegule])
->distinct()->pluck('type_frais_id');
$typeFrais = TypeFrais::whereIn('id', $tabID)->get();
Log::debug(' NdeFraisController :: webBuildPDF ======================================================== Frais payés perso =======================================================');
......@@ -379,7 +378,7 @@ class NdeFraisController extends Controller
$vehiculeNom = $tvehicule->name;
$vehiculeKMavant = $tvehicule->kmbefore;
$vehiculeType = $tvehicule->type;
$vehiculeAMC = $tvehicule->amc;
$vehiculeAMC = $tvehicule->amc;
$vehiculeCarbu = $tvehicule->energy; //cas particulier 2021 electrique
$vehiculeUUID = $tvehicule->uuid;
......@@ -595,7 +594,7 @@ class NdeFraisController extends Controller
'lignesIK' => $lignesIK,
'typeFraispro' => $typeFraispro,
'lignespro' => $lignespro,
'societe' => $societe,
'societe' => $societe,
'userName' => $this->_userName,
'userEmail' => $this->_userEmail,
'utilisationDoliScanAnneeComplete' => $utilisationDoliScanAnneeComplete,
......@@ -616,6 +615,8 @@ class NdeFraisController extends Controller
$r = $pdf->save($fullFilename);
$filename = $fullFilename;
}
$this->_ndf->pdfFullFileName = $filename;
$this->_ndf->pdfFileName = basename($filename);
//On force la re-création des fichiers d'exports mais pour ca il faut que le PDF de la note de frais soit fait
$this->_FECObject->export("", $forceUpdate);
......@@ -676,8 +677,8 @@ class NdeFraisController extends Controller
$this->_year = $finDuMois->year;
$this->_endOfMonth = $finDuMois;
$lignesperso = array();
$lignespro = array();
$lignesperso = [];
$lignespro = [];
$u = $this->_user;
......@@ -744,8 +745,8 @@ class NdeFraisController extends Controller
// ]);
//TODO Pour les justificatifs il faut virer les IK et régules d'ik
Log::debug("Type de frais: " . json_encode($typeFrais));
Log::debug("Type de frais pro: " . json_encode($typeFraispro));
// Log::debug("Type de frais: " . json_encode($typeFrais));
// Log::debug("Type de frais pro: " . json_encode($typeFraispro));
Log::debug("webBuildPDFJustificatifs::Direction blade dompdf.wrapper...");
$pdf = App::make('dompdf.wrapper');
......@@ -772,12 +773,16 @@ class NdeFraisController extends Controller
if ($pdfFileOutput != "") {
Log::debug("webBuildPDFJustificatifs::Génération du PDF vers $pdfFileOutput");
$r = $pdf->save($pdfFileOutput);
$filename = $pdfFileOutput;
} else {
Log::debug("webBuildPDFJustificatifs::Génération du PDF vers $fullFilename");
$r = $pdf->save($fullFilename);
$filename = $fullFilename;
}
Log::debug("webBuildPDFJustificatifs::Génération du PDF terminée");
$this->_ndf->pdfFullFileName = $filename;
$this->_ndf->pdfFileName = basename($filename);
//On lance un event qui devrait être capté par les plugins ...
Log::debug("NdeFraisController :: webBuildPDFJustificatifs un PDF est pret");
......@@ -801,8 +806,8 @@ class NdeFraisController extends Controller
$this->authorize('view', $this->_ndf);
}
$lignesperso = array();
$lignespro = array();
$lignesperso = [];
$lignespro = [];
// ==================== les frais payés perso
//On recupere les types de frais utilisés sur cette note de frais
......@@ -920,17 +925,17 @@ class NdeFraisController extends Controller
//Plugins
$this->_lignesExportCompta[] = json_encode([
'ecritureNum' => $ecritureNum,
'compteNum' => $compteNum,
'compteLib' => $compteLib,
'compteAux' => $compAuxNum,
'compteAuxLib' => $compAuxLib,
'ecritureLib' => $ecritureLib,
'debit' => $debit,
'credit' => $credit,
'documentJustif' => $documentJustif,
'ladate' => $ladate,
'isPro' => $isPro
'ecritureNum' => $ecritureNum,
'compteNum' => $compteNum,
'compteLib' => $compteLib,
'compteAux' => $compAuxNum,
'compteAuxLib' => $compAuxLib,
'ecritureLib' => $ecritureLib,
'debit' => $debit,
'credit' => $credit,
'documentJustif' => $documentJustif,
'ladate' => $ladate,
'isPro' => $isPro
]);
}
......@@ -945,7 +950,7 @@ class NdeFraisController extends Controller
*/
public function getAllTVAfor($id, $tid, $paiementID)
{
$tab = array();
$tab = [];
$pid = implode(',', $paiementID);
// Log::debug('====== getAllTVAfor : ' . $id . " / " . $tid . " / " . implode(',', $tab));
......@@ -981,7 +986,7 @@ class NdeFraisController extends Controller
*/
private function extractTVA($t1, $v1, $t2, $v2, $t3, $v3, $t4, $v4)
{
$ret = array();
$ret = [];
if (isset($t1)) {
$ret[$t1] = $v1;
}
......@@ -1176,7 +1181,6 @@ class NdeFraisController extends Controller
return $ligne;
}
/**
* carburantCalculTVARecuperable
*
......@@ -1214,17 +1218,18 @@ class NdeFraisController extends Controller
//progressif, cf https://www.legifiscal.fr/actualites-fiscales/2315-tva-essence-deductible-60-2020.html
if ($this->getYear() <= "2017") {
return 0;
} else if ($this->getYear() == "2018") {
} elseif ($this->getYear() == "2018") {
return 0.2;
} else if ($this->getYear() == "2019") {
} elseif ($this->getYear() == "2019") {
return 0.4;
} else if ($this->getYear() == "2020") {
} elseif ($this->getYear() == "2020") {
return 0.6;
} else if ($this->getYear() == "2021") {
} elseif ($this->getYear() == "2021") {
return 0.8;
} else if ($this->getYear() > "2021") {
} elseif ($this->getYear() > "2021") {
return 1;
}
// no break
case "gpl":
//100 % de recup
return 1;
......@@ -1254,17 +1259,18 @@ class NdeFraisController extends Controller
//progressif, cf https://www.legifiscal.fr/actualites-fiscales/2315-tva-essence-deductible-60-2020.html
if ($this->getYear() <= "2016") {
return 0;
} else if ($this->getYear() == "2017") {
} elseif ($this->getYear() == "2017") {
return 0.1;
} else if ($this->getYear() == "2018") {
} elseif ($this->getYear() == "2018") {
return 0.2;
} else if ($this->getYear() == "2019") {
} elseif ($this->getYear() == "2019") {
return 0.4;
} else if ($this->getYear() == "2020") {
} elseif ($this->getYear() == "2020") {
return 0.6;
} else if ($this->getYear() > "2020") {
} elseif ($this->getYear() > "2020") {
return 0.8;
}
// no break
case "gpl":
//100 % de recup
return 1;
......@@ -1286,7 +1292,22 @@ class NdeFraisController extends Controller
$tab[] = $this->getfilePDFFullPath();
$tab[] = $this->getfilePDFFullPathJustificatifs();
$tab[] = $this->_QuadraObject->getFullFileName();
//Les fichiers des différents modules
$modules = Module::allEnabled();
foreach ($modules as $name => $value) {
//Uniquement les plugins d'export
if (Str::startsWith($name, "Export")) {
$className = "\Modules\\" . $name . "\Listeners\NotifyExportNDF";
Log::debug("Creation d'un objet $className ...");
$p = new $className();
$p->handleForSupervisor($this->_ndf, $this->_user);
$tab[] = $p->getFullFileName();
}
}
//TODO ?: activer l'export FEC en fonction des paramètres du destinataire
//-> plus nécessaire vive les modules/plugins externes
// $tab[] = $this->_FECObject->getFullFileName();
return $tab;
}
......@@ -1371,7 +1392,7 @@ class NdeFraisController extends Controller
$c = "60recup";
if ($this->getYear() == "2020") {
$c = "60recup";
} else if ($this->getYear() >= "2021") {
} elseif ($this->getYear() >= "2021") {
$c = "80recup";
}
return $c;
......@@ -1392,7 +1413,7 @@ class NdeFraisController extends Controller
$c = "60recup";
if ($this->getYear() == "2020") {
$c = "60recup";
} else if ($this->getYear() >= "2021") {
} elseif ($this->getYear() >= "2021") {
$c = "80recup";
}
return $c;
......
......@@ -568,16 +568,16 @@ class LdeFrais extends Model
public function getFullDirName()
{
// Log::debug("=============== getFullDirName");
$user = $this->user()->get('email')->firstOrFail();
$ladate = \DateTime::createFromFormat('Y-m-d', $this->ladate);
$ladateSub = $ladate->format('Ym');
$directory = storage_path() . "/LdeFrais/" . $user->email . "/" . $ladateSub . "/";
if (file_exists($directory) && is_dir($directory)) {
return $directory;
} else {
return "";