feat: 💩 Update Matricule format on employees import and order export

This commit is contained in:
Vincent BRIDIER 2024-10-18 16:29:55 +02:00
parent 895843eccf
commit f156dd62ef
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
2 changed files with 8 additions and 9 deletions

View file

@ -87,8 +87,8 @@ class CsvOrderWrite extends CsvJobs
$product = $orderline->product;
// COLIS, KGM, PCE (faut il introduire un nouveau champs type unité de commande).
$unité_commande = $product->order_unit ?? 'PCE';
// Matricule rh transmis sans les lettres de l'identifiant windows.
$code_client = preg_replace('/[^\d]/', '', $customer->salarie->matricule);
// Matricule RH avec 6 caractères numériques, préfixé de deux zéros.
$code_client = sprintf("00%s", $customer->salarie->matricule);
$oneline = [
$product->foodProduct->no_art,

View file

@ -108,14 +108,13 @@ class CsvSalariesReader extends CsvJobs
$end_date = $line[$header['Date fin']] ?
$line[$header['Date fin']] : $line[$header['Date fin prévue']];
if ($end_date != '') {
$end_date = Carbon::createFromFormat('d/m/Y', $end_date);
} else {
$end_date = null;
}
$end_date = !empty($end_date) ? Carbon::createFromFormat('d/m/Y', $end_date) : null;
$salarie = Salarie::firstOrNew(['matricule' => $line[$header['Matricule']]]);
$salarie->matricule = $line[$header['Matricule']];
// Matricule RH avec 6 caractères numériques.
$matricule = substr($line[$header['Matricule']], -6);
$salarie = Salarie::firstOrNew(['matricule' => $matricule]);
$salarie->matricule = $matricule;
$salarie->nom = $line[$header['Nom']];
$salarie->prenom = $line[$header['Prénom']];
$salarie->start_date = Carbon::createFromFormat('d/m/Y', $line[$header['Date début']]);