예제 #1
0
파일: event.php 프로젝트: ASDAFF/bitrix-5
 function Update($arID = array(), $arFields = array())
 {
     global $DB;
     $ID = array();
     // update event type by ID, or (LID+EVENT_NAME)
     if (is_array($arID) && !empty($arID)) {
         foreach ($arID as $key => $val) {
             if (in_array($key, array("ID", "LID", "EVENT_NAME"))) {
                 $ID[$key] = $val;
             }
         }
     }
     if (!empty($ID) && CEventType::CheckFields($arFields, "UPDATE", $ID)) {
         foreach ($ID as $key => $val) {
             $ID[$key] = $key . "='" . $DB->ForSql($val) . "'";
         }
         $arBinds = array();
         if (is_set($arFields, "DESCRIPTION")) {
             $arBinds["DESCRIPTION"] = $arFields["DESCRIPTION"];
         }
         unset($arFields["ID"]);
         return $DB->QueryBind("UPDATE b_event_type SET " . $DB->PrepareUpdate("b_event_type", $arFields) . " WHERE (" . implode(") AND (", $ID) . ")", $arBinds, false);
     }
     return false;
 }
예제 #2
0
 function Update($arID = array(), $arFields = array())
 {
     $ID = array();
     // update event type by ID, or (LID+EVENT_NAME)
     if (is_array($arID) && !empty($arID)) {
         foreach ($arID as $key => $val) {
             if (in_array($key, array("ID", "LID", "EVENT_NAME"))) {
                 $ID[$key] = $val;
             }
         }
     }
     if (!empty($ID) && CEventType::CheckFields($arFields, "UPDATE", $ID)) {
         if (isset($arFields["ID"])) {
             unset($arFields["ID"]);
         }
         $affectedRowsCount = 0;
         $result = false;
         $listDb = Mail\Internal\EventTypeTable::getList(array('select' => array('ID'), 'filter' => $ID));
         while ($arListId = $listDb->fetch()) {
             $result = Mail\Internal\EventTypeTable::update($arListId['ID'], $arFields);
             $affectedRowsCount += $result->getAffectedRowsCount();
         }
         $res = new CDBResultEventMultiResult();
         $res->affectedRowsCount = $affectedRowsCount;
         return $res;
     }
     return false;
 }