/** * Update List Inbox Table * * @param type $data * @return type * @throws type */ public function update($data, $isSelfService = false) { if ($isSelfService) { $users = new Users(); $users->refreshTotal($data['USR_UID'], 'add', 'inbox'); $listParticipatedLast = new ListParticipatedLast(); $listParticipatedLast->remove($data['APP_UID'], $data['USR_UID'], $data['DEL_INDEX']); //Update - WHERE $criteriaWhere = new Criteria("workflow"); $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::USR_UID, 'SELF_SERVICES', Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::DEL_INDEX, $data["DEL_INDEX"], Criteria::EQUAL); //Update - SET $criteriaSet = new Criteria("workflow"); $criteriaSet->add(ListParticipatedLastPeer::USR_UID, $data['USR_UID']); BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); $listParticipatedLast = new ListParticipatedLast(); $listParticipatedLast->refresh($data); $users = new Users(); $users->refreshTotal($data['USR_UID'], 'add', 'participated'); } $con = Propel::getConnection( ListInboxPeer::DATABASE_NAME ); try { $con->begin(); $this->setNew( false ); $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); if ($this->validate()) { $result = $this->save(); $con->commit(); // update participated history $listParticipatedHistory = new ListParticipatedHistory(); $listParticipatedHistory->update($data); return $result; } else { $con->rollback(); throw (new Exception( "Failed Validation in class " . get_class( $this ) . "." )); } } catch (Exception $e) { $con->rollback(); throw ($e); } }
/** * Update List Inbox Table * * @param type $data * @return type * @throws type */ public function update($data, $isSelfService = false) { if (isset($data['APP_TITLE'])) { $oCase = new Cases(); $aData = $oCase->loadCase($data["APP_UID"]); $data['APP_TITLE'] = G::replaceDataField($data['APP_TITLE'], $aData['APP_DATA']); } if ($isSelfService) { $users = new Users(); $users->refreshTotal($data['USR_UID'], 'add', 'inbox'); $listParticipatedLast = new ListParticipatedLast(); $listParticipatedLast->remove($data['APP_UID'], $data['USR_UID'], $data['DEL_INDEX']); //Update //Update - SET $criteriaSet = new Criteria("workflow"); $criteriaSet->add(ListParticipatedLastPeer::USR_UID, $data["USR_UID"]); //Update - WHERE $criteriaWhere = new Criteria("workflow"); $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::USR_UID, "SELF_SERVICES", Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::DEL_INDEX, $data["DEL_INDEX"], Criteria::EQUAL); BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); //Update $listParticipatedLast = new ListParticipatedLast(); $listParticipatedLast->refresh($data); $users = new Users(); $users->refreshTotal($data['USR_UID'], 'add', 'participated'); } else { if (isset($data["APP_UID"]) && isset($data["USER_UID"]) && isset($data["DEL_INDEX"]) && isset($data["APP_TITLE"])) { //Update //Update - SET $criteriaSet = new Criteria("workflow"); $criteriaSet->add(ListParticipatedLastPeer::APP_TITLE, $data["APP_TITLE"]); //Update - WHERE $criteriaWhere = new Criteria("workflow"); $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::USR_UID, $data["USER_UID"], Criteria::EQUAL); $criteriaWhere->add(ListParticipatedLastPeer::DEL_INDEX, $data["DEL_INDEX"], Criteria::EQUAL); $result = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); } } if (array_key_exists('TAS_UID', $data) && isset($data['TAS_UID']) && (array_key_exists('TAS_UID', $data) && isset($data['PRO_UID'])) && isset($data['APP_UID'])) { $data['DEL_PRIORITY'] = $this->getTaskPriority($data['TAS_UID'], $data['PRO_UID'], $data["APP_UID"]); } $con = Propel::getConnection(ListInboxPeer::DATABASE_NAME); try { $con->begin(); $this->setNew(false); $this->fromArray($data, BasePeer::TYPE_FIELDNAME); if ($this->validate()) { $result = $this->save(); $con->commit(); // update participated history $listParticipatedHistory = new ListParticipatedHistory(); $listParticipatedHistory->update($data); return $result; } else { $con->rollback(); throw new Exception("Failed Validation in class " . get_class($this) . "."); } } catch (Exception $e) { $con->rollback(); throw $e; } }