<?php
 if ($R['deleteIdBalance']) { try { DB::startTransaction(); if ($R['reselectComponents']) { $balDet=\Entity\Balance::selectForUpdate($R['deleteIdBalance']); $reselectBalance_client=$balDet->orderServicesList; $reselectBalance_supplier=$balDet->supplierInvoiceRowsList; } $balance=\Entity\Balance::delete($R['deleteIdBalance']); $balance->save(); $balance->assignMessages($showMessage); DB::commitTransaction(); $userTrailItem->updateActionOld('Modules/Invoices/BalancesList-delete'); $userTrailItem->updateEntityOld('invoiceBalance', $R['deleteIdBalance']); if ($R['reselectComponents']) { $S['manualBalance']['idServices']=array(); foreach($reselectBalance_client as $idServ) $S['manualBalance']['idServices'][$idServ]=true; $S['manualBalance']['idSupplierRows']=array(); foreach($reselectBalance_supplier as $idRow) $S['manualBalance']['idSupplierRows'][$idRow]=true; } header("Location: ./"); exit; } catch (\App\Entity\Exception $e) { $e->decorate($showMessage); DB::rollbackTransaction(); } } 