public function save() { if (empty($this->password) && $this->id > 0) { // If password is empty, keep the old password $dbAccount = new Cart66Account($this->id); $this->password = $dbAccount->password; } return parent::save(); }
public function save() { $errors = $this->validate(); if (count($errors) == 0) { $reminderId = parent::save(); } if (count($errors)) { $this->setErrors($errors); $errors = print_r($errors, true); throw new Cart66Exception('Reminder save failed: ' . $errors, 66302); } return $reminderId; }
/** * Only save shipping methods if the carrier code combo does not exist. */ public function save() { $save = true; $shippingMethods = Cart66Common::getTableName('shipping_methods'); if (!empty($this->carrier) && !empty($this->code)) { $sql = "SELECT id from {$shippingMethods} where carrier=%s and code=%s"; $sql = $this->_db->prepare($sql, $this->carrier, $this->code); $id = $this->_db->get_var($sql); $save = $id === NULL; } if ($save) { parent::save(); } }
public function save() { $errors = $this->validate(); if (count($errors) == 0) { $fulfillmentSave = parent::save(); } if (count($errors)) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] " . get_class($this) . " save errors: " . print_r($errors, true)); $this->setErrors($errors); $errors = print_r($errors, true); throw new Cart66Exception('Order fulfillment save failed: ' . $errors, 66303); } return $fulfillmentSave; }
/** * Override base class save method by validating the data before and after saving. * Return the product id of the saved product. * Throw Cart66Exception if the save fails. * * @return int The product id * @throws Cart66Exception on save failure */ public function save($override_nonce = false) { $errors = $this->validate($override_nonce); if (count($errors) == 0) { $productId = parent::save(); $errors = $this->validate($override_nonce); } if (count($errors)) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] " . get_class($this) . " save errors: " . print_r($errors, true)); $this->setErrors($errors); $errors = print_r($errors, true); throw new Cart66Exception('Product save failed: ' . $errors, 66102); } return $productId; }
public function save($saveOverride = false) { $errors = $this->validate(); if (count($errors) == 0 || $saveOverride) { $this->_data['code'] = $this->cleanCodes($this->_data['code']); $this->min_order = $this->min_order == "" ? null : $this->min_order; $this->max_order = $this->max_order == "" ? null : $this->max_order; $this->effective_from = !empty($this->effective_from) && $this->effective_from != "0000-00-00 00:00:00" ? date("Y-m-d H:i:s", strtotime($this->effective_from)) : null; $this->effective_to = !empty($this->effective_to) && $this->effective_to != "0000-00-00 00:00:00" ? date("Y-m-d H:i:s", strtotime($this->effective_to)) : null; $promotionId = parent::save(); } else { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] " . get_class($this) . " save errors: " . print_r($errors, true)); $this->setErrors($errors); $errors = print_r($errors, true); throw new Cart66Exception('Promotion save failed: ' . $errors, 66301); } return $promotionId; }