function OpticalFiberJoin_replaceCableLine($oldCableLine, $newCableLine, $NetworkNode, $tmpT = FALSE) { $ofj = getNodeFibers($NetworkNode, -1, $oldCableLine, $tmpT); if (isset($ofj['error'])) { return $ofj; } foreach ($ofj['rows'] as $row) { $fiber = OpticalFiber_SELECT(0, array('CableLine' => $newCableLine, 'fiber' => $row['fiber']), $tmpT); OpticalFiberJoin_UPDATE(array('OpticalFiber' => $fiber['rows'][0]['id']), array('id' => $row['OFJ_id']), $tmpT); } return $ofj; }
function FiberSplice_Mod($OFJ_id, $CableLine, $fiber, $FiberSpliceOrganizer, $attenuation, $note) { if ($FiberSpliceOrganizer == '') { return array('error' => 'Выберите кассету!'); } $trans = startTransaction(); $wr['id'] = $OFJ_id; $res = OpticalFiberJoin_SELECT(1, $wr); $OpticalFiberSplice = $res['rows'][0]['OpticalFiberSplice']; unset($wr); $wr['fiber'] = $fiber; $wr['CableLine'] = $CableLine; $res = OpticalFiber_SELECT(1, $wr); unset($wr); $upd['OpticalFiber'] = $res['rows'][0]['id']; $wr['id'] = $OFJ_id; $res = OpticalFiberJoin_UPDATE($upd, $wr); if (isset($res['error'])) { if ($trans) { rollbackTransaction(); } return $res; } unset($wr); unset($upd); $wr['id'] = $OpticalFiberSplice; $upd['FiberSpliceOrganizer'] = $FiberSpliceOrganizer; $upd['attenuation'] = $attenuation; $upd['note'] = $note; $res = OpticalFiberSplice_UPDATE($upd, $wr); if (isset($res['error'])) { if ($trans) { rollbackTransaction(); } return $res; } return $trans ? commitTransaction() : 1; }