IsUpdated
bool CAdminList::IsUpdated( string $ID )
The IsUpdated method returns true if any of the table rows are changed when editing the table rows. The parameter is the table ID
Example
// save modified elements if($lAdmin->EditAction() && $POST_RIGHT=="W") { // walk the list of elements foreach($FIELDS as $ID=>$arFields) { // unchanged? do nothing if(!$lAdmin->IsUpdated($ID)) continue; // otherwise, save changes $DB->StartTransaction(); $ID = IntVal($ID); $cData = new CRubric; if(($rsData = $cData->GetByID($ID)) && ($arData = $rsData->Fetch())) { foreach($arFields as $key=>$value) $arData[$key]=$value; if(!$cData->Update($ID, $arData)) { $lAdmin->AddGroupError(GetMessage("rub_save_error")." ".
$cData->LAST_ERROR, $ID); $DB->Rollback(); } } else { $lAdmin->AddGroupError(GetMessage("rub_save_error")." ".
GetMessage("rub_no_rubric"), $ID); $DB->Rollback(); } $DB->Commit(); } }
© «Bitrix24», 2001-2024