Example #1
0
 public function update(array $arData = [], array $options = [])
 {
     if (empty($arData['password'])) {
         unset($arData['password']);
     }
     parent::update($arData);
 }
Example #2
0
 public function update($pa_options = null)
 {
     $this->_generateSortableValue();
     // populate sort field
     // Invalid entire labels-by-id cache since we can't know what entries pertain to the label we just changed
     LabelableBaseModelWithAttributes::$s_labels_by_id_cache = array();
     // Unset label cache entry for modified label only
     unset(LabelableBaseModelWithAttributes::$s_label_cache[$this->getSubjectTableName()][$this->get($this->getSubjectKey())]);
     return parent::update($pa_options);
 }
Example #3
0
 function update($values, $id)
 {
     $values = (array) $values;
     foreach ($values['params'] as $id_widget_param => $value) {
         if ($this->widgetParamModel->isExist($id_widget_param)) {
             $this->widgetParamModel->update($value, $id_widget_param);
         } else {
             $this->widgetParamModel->insert(array('id_widget' => $id) + (array) $value);
         }
     }
     unset($values['params']);
     $values['added'] = 1;
     parent::update($values, $id);
 }
Example #4
0
 public function update($data)
 {
     $this->mapping->fields['status'] = 'messageStatus';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'messageID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
Example #5
0
 public function update($data)
 {
     $this->mapping->fields['title'] = 'faqTitle';
     $this->mapping->fields['text'] = 'faqText';
     $this->mapping->fields['user'] = '******';
     // Tratamento adicional de dados
     $data->user = $_SESSION['admLogin']->getUserID();
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'faqID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(get_called_class() . "::" . __FUNCTION__, Text::read('message.model.error.update'), $exception);
     }
 }
Example #6
0
 public function update($data)
 {
     // Converte preço para formato do Banco
     $data->price = str_replace(',', '.', $data->price);
     $data->discount = str_replace(',', '.', $data->discount);
     if ($data->name) {
         $this->mapping->fields['name'] = 'productName';
     }
     if ($data->text) {
         $this->mapping->fields['text'] = 'productDescription';
     }
     if ($data->type) {
         $this->mapping->fields['type'] = 'typeID';
     }
     if ($data->subtype) {
         $this->mapping->fields['subtype'] = 'subTypeID';
     }
     if ($data->brand) {
         $this->mapping->fields['brand'] = 'brandID';
     }
     if ($data->price) {
         $this->mapping->fields['price'] = 'productPrice';
     }
     if ($data->discount) {
         $this->mapping->fields['discount'] = 'productDiscount';
     }
     if ($data->status) {
         $this->mapping->fields['status'] = 'productStatus';
     }
     // Tratamento adicional do produto
     //  - Altera status para NOVO quando o produto atualizado estiver reprovado
     if ($data->status == Config::read('product.status')['reproved']) {
         $data->status = Config::read('product.status')['new'];
     }
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'productID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
Example #7
0
 /**
  * {@inheritDoc}
  * @param string $name
  */
 public function update($name, $value, $type = 'i')
 {
     parent::update($name, $value, $type);
     $this->storeInCache();
 }
Example #8
0
 /**
  * Saves changes to user record. You must make sure all required user fields are set before calling this method. If errors occur you can use the standard Table class error handling methods to figure out what went wrong.
  *
  * Required fields are user_name, password, fname and lname.
  *
  * If you do not call this method at the end of your request changed user vars will not be saved! If you are also using the Auth class, the Auth->close() method will call this for you.
  *
  * @access public
  * @return bool Returns true if no error, false if error occurred
  */
 public function update($pa_options = null)
 {
     $this->clearErrors();
     # set user vars (the set() method automatically serializes the vars array)
     if ($this->opa_user_vars_have_changed) {
         $this->set("vars", $this->opa_user_vars);
     }
     if ($this->opa_volatile_user_vars_have_changed) {
         $this->set("volatile_vars", $this->opa_volatile_user_vars);
     }
     unset(ca_users::$s_user_role_cache[$this->getPrimaryKey()]);
     unset(ca_users::$s_group_role_cache[$this->getPrimaryKey()]);
     return parent::update();
 }
 public function update($pa_options = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $pa_options['dont_do_search_indexing'] = true;
     $va_field_values = $this->getFieldValuesArray();
     // get pre-update field values (including attribute values)
     // change status for attributes is only available **before** update
     $va_fields_changed_array = $this->_FIELD_VALUE_CHANGED;
     if (parent::update($pa_options)) {
         $this->_commitAttributes($this->getTransaction());
         //	$va_field_values_with_updated_attributes = $this->addAttributesToFieldValuesArray();	// copy committed attribute values to field values array
         // set the field values array for this instance
         //$this->setFieldValuesArray($va_field_values_with_updated_attributes);
         $this->doSearchIndexing($va_fields_changed_array);
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         if ($this->numErrors() > 0) {
             return false;
         }
         return true;
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return false;
 }
Example #10
0
 public function update($data)
 {
     $this->mapping->fields['name'] = 'accountFirstName';
     $this->mapping->fields['surname'] = 'accountLastName';
     $this->mapping->fields['sex'] = 'accountSex';
     $this->mapping->fields['email'] = 'accountEmail';
     $this->mapping->fields['news'] = 'accountNews';
     $this->mapping->fields['cpf'] = 'accountCPF';
     $this->mapping->fields['phone'] = 'accountPhone';
     $this->mapping->fields['cellphone'] = 'accountCellPhone';
     if ($this->addressModel) {
         $this->mapping->fields = array_merge($this->mapping->fields, $this->addressModel->addressMapping());
     }
     // Tratamento adicional de dados
     if ($data->passoword) {
         $this->mapping->fields['password'] = '******';
         $data->password = md5($data->password);
     }
     $data->news = (int) $data->news;
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'accountID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }
Example #11
0
 public function update($pa_options = null)
 {
     if (!$this->_preSaveActions()) {
         return false;
     }
     $vn_old_status = $this->getOriginalValue('order_status');
     $vn_old_ship_date = $this->getOriginalValue('shipping_date');
     $vn_old_shipped_on_date = $this->getOriginalValue('shipped_on_date');
     // Move order status automatically to reflect business logic
     switch ($this->get('order_status')) {
         case 'PROCESSED':
             if ($this->get('shipped_on_date') && $this->changed('shipped_on_date') && !$this->requiresDownload()) {
                 // If it shipped and there's nothing left to fulfill by download then ship status to "complete"
                 $this->set('order_status', 'COMPLETED');
             }
             break;
         case 'AWAITING_PAYMENT':
             if ($this->get('payment_received_on') && $this->changed('payment_received_on') || $this->getTotal() == 0) {
                 if ($this->get('order_type') == 'L') {
                     // LOANS
                     $this->set('order_status', 'PROCESSED');
                 } else {
                     // SALES ORDERS
                     // If it paid for then flip status to "PROCESSED" (if it's all ready to go) or "PROCESSED_AWAITING_DIGITIZATION" if stuff needs to be digitized
                     if (sizeof($va_items_with_no_media = $this->itemsWithNoDownloadableMedia()) > 0) {
                         $this->set('order_status', 'PROCESSED_AWAITING_DIGITIZATION');
                     } else {
                         // If "original" files are missing then mark as PROCESSED_AWAITING_MEDIA_ACCESS
                         if (sizeof($va_items_missing_media = $this->itemsMissingDownloadableMedia('original'))) {
                             $this->set('order_status', 'PROCESSED_AWAITING_MEDIA_ACCESS');
                         } else {
                             $this->set('order_status', 'PROCESSED');
                         }
                     }
                 }
             }
             break;
     }
     $vb_status_changed = $this->changed('order_status');
     $this->set('order_number', ca_commerce_orders::generateOrderNumber($this->getPrimaryKey(), $this->get('created_on', array('GET_DIRECT_DATE' => true))));
     if ($vn_rc = parent::update($pa_options)) {
         if ($vb_status_changed) {
             $this->sendStatusChangeEmailNotification($vn_old_status, $vn_old_ship_date, $vn_old_shipped_on_date);
         }
         if (in_array($this->get('order_status'), array('PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'PROCESSED_AWAITING_MEDIA_ACCESS', 'COMPLETED'))) {
             // Delete originating set if configured to do so
             if ($this->opo_client_services_config->get('set_disposal_policy') == 'DELETE_WHEN_ORDER_PROCESSED') {
                 $t_trans = new ca_commerce_transactions($this->get('transaction_id'));
                 if ($t_trans->getPrimaryKey()) {
                     $t_set = new ca_sets($t_trans->get('set_id'));
                     if ($t_set->getPrimaryKey()) {
                         $t_set->setMode(ACCESS_WRITE);
                         $t_set->delete(true);
                     }
                 }
             }
         }
     }
     return $vn_rc;
 }
Example #12
0
<?php

$outbox_id = $_REQUEST['outbox_id'];
if (!$outbox_id) {
    exit;
}
require_once 'config.inc.php';
require_once 'BaseModel.class.php';
$db = new BaseModel('recieved');
#  1: delivery success
#  2: delivery failure
#  4: message buffered
#  8: smsc submit
#  16: smsc reject
$status[1] = 'successful';
$status[2] = 'failure';
$status[4] = 'buffered';
$status[8] = 'success';
$status[16] = 'reject';
$type = $_REQUEST['type'];
$type = $status[$type] ? $status[$type] : $type;
$d['status'] = $type;
//$d['modified_date'] = "NOW()";
$db->update('outbox', $d, "id={$outbox_id}");
Example #13
0
 public function update($pa_options = null)
 {
     $vm_rc = parent::update($pa_options);
     $this->flushLocaleListCache();
     return $vm_rc;
 }
Example #14
0
 /**
  * update user's data
  *
  * @param int user id
  * @param array
  * @param bool update identity of logged user?
  * @param bool skip checking ACL? - used internally while logging in
  */
 public function update($id, array $data, $updateIdentity = false, $skipCheckingAcl = false)
 {
     if ($this->config['useAcl'] and !$skipCheckingAcl) {
         // check rights - client can update only users who he created
         if (!$this->user->isAllowed(new UserResource($id), Acl::PRIVILEGE_EDIT)) {
             throw new OperationNotAllowedException();
         }
     }
     // for $nonce in getHasherParamsFromUserData()
     $data['id'] = $id;
     //	if we come from userEdit form
     if (isset($data['password'])) {
         // user did not enter new password
         if (empty($data['password'])) {
             unset($data['password']);
         } else {
             // if current password is required (typically when calling from updateLoggedUser(); admin does not have to enter currentPassword)
             if (isset($data['currentPassword'])) {
                 $dbData = $this->find($this->userId);
                 // check if it's correct
                 if (!$this->hasher->checkPassword($data['currentPassword'], $dbData->password, $this->getHasherParamsFromUserData($data))) {
                     //		    			throw new InvalidPasswordException('Zadali ste nesprávne stávajúce heslo.');
                     throw new InvalidPasswordException('You entered invalid current password. Try again please!');
                 }
             }
             $data['password'] = $this->hasher->hashPassword($data['password'], $this->getHasherParamsFromUserData($data));
         }
         unset($data['currentPassword']);
         unset($data['password2']);
     }
     // update roles
     if (isset($data['roles'])) {
         $this->getRolesModel()->updateUserRoles($id, $data['roles']);
         unset($data['roles']);
     }
     if (isset($data['client_logo'])) {
         $this->saveClientLogo($id, $data['client_logo']);
         unset($data['client_logo']);
     }
     // update user
     parent::update($id, $data);
     if ($updateIdentity) {
         self::updateIdentity($data);
     }
 }
Example #15
0
 /**
  * Saves changes to user record. You must make sure all required user fields are set before calling this method. If errors occur you can use the standard Table class error handling methods to figure out what went wrong.
  *
  * Required fields are user_name, password, fname and lname.
  *
  * If you do not call this method at the end of your request changed user vars will not be saved! If you are also using the Auth class, the Auth->close() method will call this for you.
  *
  * @access public
  * @return bool Returns true if no error, false if error occurred
  */
 public function update($pa_options = null)
 {
     $this->clearErrors();
     if ($this->changed('email')) {
         if (!caCheckEmailAddress($this->get('email'))) {
             $this->postError(922, _t("Invalid email address"), 'ca_users->update()');
             return false;
         }
     }
     if ($this->changed('password')) {
         try {
             $vs_backend_password = AuthenticationManager::updatePassword($this->get('user_name'), $this->get('password'));
             $this->set('password', $vs_backend_password);
             $this->removePendingPasswordReset(true);
         } catch (AuthClassFeatureException $e) {
             $this->postError(922, $e->getMessage(), 'ca_users->update()');
             return false;
             // maybe don't barf here?
         }
     }
     # set user vars (the set() method automatically serializes the vars array)
     if ($this->opa_user_vars_have_changed) {
         $this->set("vars", $this->opa_user_vars);
     }
     if ($this->opa_volatile_user_vars_have_changed) {
         $this->set("volatile_vars", $this->opa_volatile_user_vars);
     }
     unset(ca_users::$s_user_role_cache[$this->getPrimaryKey()]);
     unset(ca_users::$s_group_role_cache[$this->getPrimaryKey()]);
     return parent::update();
 }
 public function update($pa_options = null)
 {
     if (!$this->_preSaveActions()) {
         return false;
     }
     $vn_rc = parent::update($pa_options);
     $this->_postSaveActions();
     return $vn_rc;
 }
Example #17
0
 public function update($data)
 {
     $this->mapping->fields['login'] = '******';
     $this->mapping->fields['name'] = 'accountFirstName';
     $this->mapping->fields['surname'] = 'accountLastName';
     $this->mapping->fields['email'] = 'accountEmail';
     $this->mapping->fields['inactive'] = 'accountInactive';
     $this->mapping->fields['user'] = '******';
     // Tratamento adicional de dados
     $data->inactive = $data->inactive ? 1 : 0;
     $data->user = $_SESSION['admLogin']->getUserID();
     if ($data->password) {
         $this->mapping->fields['password'] = '******';
         $data->password = md5($data->password);
     }
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'accountID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         if (is_array($data->roles)) {
             // Atualiza funções do usuário
             $this->roleModel->delete($data->id);
             $roleData = new stdclass();
             $roleData->account = $data->id;
             foreach ($data->roles as $role) {
                 $roleData->role = $role;
                 $this->roleModel->insert($roleData);
             }
         }
         $this->dbh->commit();
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(get_called_class() . "::" . __FUNCTION__, Text::read('message.model.error.update'), $exception);
     }
 }
Example #18
0
 public function update($data)
 {
     $this->mapping->fields['status'] = 'orderStatus';
     $this->mapping->criterias['id'] = new stdclass();
     $this->mapping->criterias['id']->field = 'orderID';
     $this->mapping->criterias['id']->operator = '=';
     $this->mapping->criterias['id']->value = $data->id;
     try {
         $this->dbh->beginTransaction();
         parent::update($data);
         $this->dbh->commit();
         // --------------------------------------- //
         // TODO: Componentizar essa inserção de mensagens
         // Insere mensagem na Caixa de entrada
         $dataInbox = new stdclass();
         $dataInbox->title = 'Produto ' . $data->name . ' foi ' . Text::read('order.status')[array_search($data->status, Config::read('order.status'))];
         $dataInbox->text = 'O produto ' . $data->name . ' foi ' . Text::read('order.status')[array_search($data->status, Config::read('order.status'))] . '. Para atualizar qualquer informação relacionada acesse a opção Meus Produtos no seu menu de usuário.';
         $dataInbox->type = 'order';
         $dataInbox->reference = $data->id;
         $dataInbox->account = $data->account;
         $this->inboxModel->insert($dataInbox);
         // --------------------------------------- //
     } catch (PDOException $exception) {
         $this->dbh->rollback();
         $this->modelException(Text::read('message.model.error.update'), $exception);
     }
 }