1 parent
28a98f5790
commit
348a8f1811
2 files changed
+12
-3
No files matched your search
@@ -197,6 +197,12 @@ if ($action === 'validate_transfers') {
|
|||||||
$dbPersonName = $stmtP->fetchColumn();
|
$dbPersonName = $stmtP->fetchColumn();
|
||||||
if (!$dbPersonName) throw new Exception("Parent introuvable.");
|
if (!$dbPersonName) throw new Exception("Parent introuvable.");
|
||||||
|
|
||||||
|
$stmtAcc = $pdo->query("SELECT a.name as acc_name, p.name as owner_name FROM pf_bank_accounts a LEFT JOIN pf_people p ON a.owner_person_id = p.id");
|
||||||
|
$bankAccountsMap = [];
|
||||||
|
while ($row = $stmtAcc->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$bankAccountsMap['vers ' . $row['acc_name']] = $row['owner_name'];
|
||||||
|
}
|
||||||
|
|
||||||
$stmt = $pdo->prepare("
|
$stmt = $pdo->prepare("
|
||||||
SELECT v.amount, c.name as cat_name, c.transfer_dest, c.holiday_id
|
SELECT v.amount, c.name as cat_name, c.transfer_dest, c.holiday_id
|
||||||
FROM pf_alloc_values v
|
FROM pf_alloc_values v
|
||||||
@@ -217,7 +223,10 @@ if ($action === 'validate_transfers') {
|
|||||||
$holidayId = $line['holiday_id'];
|
$holidayId = $line['holiday_id'];
|
||||||
|
|
||||||
$targetOwner = null;
|
$targetOwner = null;
|
||||||
if ($dest === 'vers L.Perso') { $targetOwner = $dbPersonName; }
|
if (isset($bankAccountsMap[$dest])) {
|
||||||
|
$targetOwner = $bankAccountsMap[$dest];
|
||||||
|
if (!$targetOwner) continue; // Compte commun sans propriétaire
|
||||||
|
} elseif ($dest === 'vers L.Perso') { $targetOwner = $dbPersonName; }
|
||||||
elseif ($dest === 'vers L.Pol') { $targetOwner = 'Pol'; }
|
elseif ($dest === 'vers L.Pol') { $targetOwner = 'Pol'; }
|
||||||
elseif ($dest === 'vers L.Pep') { $targetOwner = 'Pep'; }
|
elseif ($dest === 'vers L.Pep') { $targetOwner = 'Pep'; }
|
||||||
elseif ($dest === 'vers commune') { continue; }
|
elseif ($dest === 'vers commune') { continue; }
|
||||||
@@ -261,7 +270,7 @@ if ($action === 'validate_transfers') {
|
|||||||
$catAmount = $catInfo['amount'];
|
$catAmount = $catInfo['amount'];
|
||||||
$catHolidayId = $catInfo['holiday_id'];
|
$catHolidayId = $catInfo['holiday_id'];
|
||||||
|
|
||||||
if (strpos($catName, 'Eco P') === 0) { continue; }
|
if (preg_match('/^(Eco\s|Eco P\d|Livret)/i', $catName)) { continue; }
|
||||||
|
|
||||||
$stmtCheckCat = $pdo->prepare("SELECT id FROM pf_savings WHERE owner = ? AND month_date = ? AND category = ?");
|
$stmtCheckCat = $pdo->prepare("SELECT id FROM pf_savings WHERE owner = ? AND month_date = ? AND category = ?");
|
||||||
$stmtCheckCat->execute([$owner, $monthDate, $catName]);
|
$stmtCheckCat->execute([$owner, $monthDate, $catName]);
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ if (count($parentMapping) >= 2) {
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php foreach ($cats as $cat):
|
<?php foreach ($cats as $cat):
|
||||||
$isIndicative = (strpos($cat['name'], 'Eco P') === 0);
|
$isIndicative = (preg_match('/^(Eco\s|Eco P\d|Livret)/i', $cat['name']) === 1);
|
||||||
$rowClass = $isIndicative ? 'row-indicative' : '';
|
$rowClass = $isIndicative ? 'row-indicative' : '';
|
||||||
$inputClass = $isIndicative ? 'ignore-calc' : '';
|
$inputClass = $isIndicative ? 'ignore-calc' : '';
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user