Exemplo n.º 1
0
 /**
  * @see SugarBean::save()
  */
 public function save($check_notify = false)
 {
     if (!empty($this->uploadfile)) {
         $this->filename = $this->uploadfile;
     }
     return parent::save($check_notify);
 }
Exemplo n.º 2
0
 /**
  * @see parent::save()
  */
 public function save($check_notify = false)
 {
     if (!empty($GLOBALS['resavingRelatedBeans'])) {
         return parent::save($check_notify);
     }
     $this->add_address_streets('billing_address_street');
     $this->add_address_streets('shipping_address_street');
     $ori_in_workflow = empty($this->in_workflow) ? false : true;
     $this->emailAddress->handleLegacySave($this, $this->module_dir);
     $record_id = parent::save($check_notify);
     $override_email = array();
     if (!empty($this->email1_set_in_workflow)) {
         $override_email['emailAddress0'] = $this->email1_set_in_workflow;
     }
     if (!empty($this->email2_set_in_workflow)) {
         $override_email['emailAddress1'] = $this->email2_set_in_workflow;
     }
     if (!isset($this->in_workflow)) {
         $this->in_workflow = false;
     }
     if ($ori_in_workflow === false || !empty($override_email)) {
         $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow);
     }
     return $record_id;
 }
Exemplo n.º 3
0
 /**
  *
  * @see parent::save()
  */
 public function save($check_notify = false)
 {
     if (static::inOperation('saving_related')) {
         parent::save($check_notify);
         return $this;
     }
     $this->add_address_streets('billing_address_street');
     $this->add_address_streets('shipping_address_street');
     $ori_in_workflow = empty($this->in_workflow) ? false : true;
     $this->emailAddress->handleLegacySave($this, $this->module_dir);
     parent::save($check_notify);
     $override_email = array();
     if (!empty($this->email1_set_in_workflow)) {
         $override_email['emailAddress0'] = $this->email1_set_in_workflow;
     }
     if (!empty($this->email2_set_in_workflow)) {
         $override_email['emailAddress1'] = $this->email2_set_in_workflow;
     }
     if (!isset($this->in_workflow)) {
         $this->in_workflow = false;
     }
     if ($ori_in_workflow === false || !empty($override_email)) {
         $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow);
     }
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Saves the current comment.
  * @param  boolean $check_notify
  * @return string|bool           GUID of saved comment or false.
  */
 public function save($check_notify = false)
 {
     //if a string convert to object
     if (is_string($this->data)) {
         $this->data = json_decode($this->data, true);
     }
     if (!empty($this->data['value'])) {
         $this->data['value'] = SugarCleaner::cleanHtml($this->data['value']);
     }
     if (!is_string($this->data)) {
         $this->data = json_encode($this->data);
     }
     $activity = BeanFactory::getBean('Activities', $this->parent_id);
     if (!empty($activity) && $activity->id) {
         $isNew = empty($this->id) || $this->new_with_id;
         if (parent::save($check_notify)) {
             if ($isNew) {
                 $activity->addComment($this);
                 $this->processCommentTags($activity);
             }
             return $this->id;
         }
     }
     return false;
 }
Exemplo n.º 5
0
 /**
  * {@inheritDoc}
  *
  * The created_by field must be kept in sync with the user_id field in order for the $created filter to work. This
  * fix (for jira: MAR-1841; SI: 67320) should be replaced by a refactor of the UserSignatures module so that the
  * user_id field can be dropped in favor of created_by.
  *
  * @param bool $check_notify
  * @return String
  */
 public function save($check_notify = false)
 {
     if (empty($this->user_id)) {
         $this->user_id = $GLOBALS['current_user']->id;
     }
     if ($this->created_by !== $this->user_id) {
         $this->created_by = $this->user_id;
     }
     return parent::save($check_notify);
 }
Exemplo n.º 6
0
 function save($notification = false)
 {
     $focus = new Reports_Merge_Utils();
     $focus->uploadTemplate($this);
     $info = pathinfo($this->filename);
     $this->extension_template = $info['extension'];
     if (empty($this->report_filename)) {
         $this->report_filename = $info['filename'] . ' ' . $this->date_format_for_name;
     }
     parent::save($notification);
 }
Exemplo n.º 7
0
 function save($check_notify = FALSE)
 {
     if (empty($this->id)) {
         unset($_POST['aow_conditions_id']);
         unset($_POST['aow_actions_id']);
     }
     parent::save($check_notify);
     require_once 'modules/AOW_Conditions/AOW_Condition.php';
     $condition = new AOW_Condition();
     $condition->save_lines($_POST, $this, 'aow_conditions_');
     require_once 'modules/AOW_Actions/AOW_Action.php';
     $action = new AOW_Action();
     $action->save_lines($_POST, $this, 'aow_actions_');
 }
Exemplo n.º 8
0
 function save($check_notify = false)
 {
     $move = false;
     $upload_file = new UploadFile('uploadfile');
     if (isset($_FILES['uploadfile']) && $upload_file->confirm_upload()) {
         $this->filename = $upload_file->get_stored_file_name();
         $this->file_mime_type = $upload_file->mime_type;
         $this->file_ext = $upload_file->file_ext;
         $move = true;
     }
     parent::save($check_notify);
     if ($move) {
         $upload_file->final_move($this->id);
     }
     return $this->id;
     //handleRedirect($return_id, $this->object_name);
 }
Exemplo n.º 9
0
 function save($check_notify = FALSE)
 {
     if (empty($this->id)) {
         unset($_POST['aor_conditions_id']);
         unset($_POST['aor_fields_id']);
     }
     parent::save($check_notify);
     require_once 'modules/AOR_Fields/AOR_Field.php';
     $condition = new AOR_Field();
     $condition->save_lines($_POST, $this, 'aor_fields_');
     require_once 'modules/AOR_Conditions/AOR_Condition.php';
     $condition = new AOR_Condition();
     $condition->save_lines($_POST, $this, 'aor_conditions_');
     require_once 'modules/AOR_Charts/AOR_Chart.php';
     $chart = new AOR_Chart();
     $chart->save_lines($_POST, $this, 'aor_chart_');
 }
Exemplo n.º 10
0
 function save($check_notify = FALSE)
 {
     // TODO: process of saveing the fields and conditions is too long so we will have to make some optimization on save_lines functions
     set_time_limit(3600);
     if (empty($this->id)) {
         unset($_POST['aor_conditions_id']);
         unset($_POST['aor_fields_id']);
     }
     parent::save($check_notify);
     require_once 'modules/AOR_Fields/AOR_Field.php';
     $field = new AOR_Field();
     $field->save_lines($_POST, $this, 'aor_fields_');
     require_once 'modules/AOR_Conditions/AOR_Condition.php';
     $condition = new AOR_Condition();
     $condition->save_lines($_POST, $this, 'aor_conditions_');
     require_once 'modules/AOR_Charts/AOR_Chart.php';
     $chart = new AOR_Chart();
     $chart->save_lines($_POST, $this, 'aor_chart_');
 }
Exemplo n.º 11
0
 /**
  * Saving overwritten to add conditions.
  * @see Basic::save()
  */
 public function save()
 {
     if ($this->is_bad == true) {
         return false;
     }
     if (!mb_strlen($this->ga_headline, 'utf-8')) {
         echo "NO head\r\n";
         return false;
     }
     if (!mb_strlen($this->ga_description1, 'utf-8')) {
         echo "NO description1\r\n";
         return false;
     }
     if (!mb_strlen($this->ga_description2, 'utf-8')) {
         echo "NO description2\r\n";
         return false;
     }
     return parent::save();
 }
Exemplo n.º 12
0
 function save($check_notify = false)
 {
     $this->add_address_streets('primary_address_street');
     $this->add_address_streets('alt_address_street');
     $ori_in_workflow = empty($this->in_workflow) ? false : true;
     $this->emailAddress->handleLegacySave($this, $this->module_dir);
     parent::save($check_notify);
     $override_email = array();
     if (!empty($this->email1_set_in_workflow)) {
         $override_email['emailAddress0'] = $this->email1_set_in_workflow;
     }
     if (!empty($this->email2_set_in_workflow)) {
         $override_email['emailAddress1'] = $this->email2_set_in_workflow;
     }
     if (!isset($this->in_workflow)) {
         $this->in_workflow = false;
     }
     if ($ori_in_workflow === false || !empty($override_email)) {
         $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow);
     }
     return $this->id;
 }
Exemplo n.º 13
0
 /**
  * @see parent::save()
  */
 public function save($check_notify = false)
 {
     //If we are saving due to relationship changes, don't bother trying to update the emails
     if (!empty($GLOBALS['resavingRelatedBeans'])) {
         parent::save($check_notify);
         return $this->id;
     }
     $this->add_address_streets('primary_address_street');
     $this->add_address_streets('alt_address_street');
     $ori_in_workflow = empty($this->in_workflow) ? false : true;
     $this->emailAddress->handleLegacySave($this, $this->module_dir);
     // bug #39188 - store emails state before workflow make any changes
     $this->emailAddress->stash($this->id, $this->module_dir);
     parent::save($check_notify);
     // $this->emailAddress->evaluateWorkflowChanges($this->id, $this->module_dir);
     $override_email = array();
     if (!empty($this->email1_set_in_workflow)) {
         $override_email['emailAddress0'] = $this->email1_set_in_workflow;
     }
     if (!empty($this->email2_set_in_workflow)) {
         $override_email['emailAddress1'] = $this->email2_set_in_workflow;
     }
     if (!isset($this->in_workflow)) {
         $this->in_workflow = false;
     }
     if ($ori_in_workflow === false || !empty($override_email)) {
         $this->emailAddress->save($this->id, $this->module_dir, $override_email, '', '', '', '', $this->in_workflow);
         // $this->emailAddress->applyWorkflowChanges($this->id, $this->module_dir);
     }
     return $this->id;
 }
Exemplo n.º 14
0
 function save($check_notify = FALSE)
 {
     $this->fillInName();
     if (!is_admin($GLOBALS['current_user'])) {
         $this->assigned_user_id = $GLOBALS['current_user']->id;
     }
     $parentRet = parent::save($check_notify);
     // Nuke the EAPM cache for this record
     if (isset($_SESSION['EAPM'][$this->application])) {
         unset($_SESSION['EAPM'][$this->application]);
     }
     return $parentRet;
 }
Exemplo n.º 15
0
 /**
  * {@inheritdoc}
  *
  * Attempt to subscribe the user to the favorited bean after saving.
  *
  * @param bool $check_notify
  * @return String
  */
 public function save($check_notify = false)
 {
     parent::save($check_notify);
     $this->subscribeAfterFavorite();
     return $this->id;
 }
Exemplo n.º 16
0
 function save($check_notify = FALSE)
 {
     if (!empty($this->xebaylisting_id)) {
         $bean = BeanFactory::getBean('xeBayListings', $this->xebaylisting_id);
         $this->xinventory_id = $bean->xinventory_id;
     } else {
         $this->xinventory_id = '';
     }
     parent::save($check_notify);
 }
Exemplo n.º 17
0
 /**
  * This overrides the default save function setting assigned_user_id
  * @see SugarBean::save()
  *
  * 'view' is deprecated because it's reserved db word.
  * Some old API (before 7.2.0) can use 'view'.
  * Because of that API will use 'view' as 'view_name' if 'view_name' isn't present.
  */
 function save($check_notify = FALSE)
 {
     $this->assigned_user_id = $GLOBALS['current_user']->id;
     if (isset($this->view) && !isset($this->view_name)) {
         $this->view_name = $this->view;
     }
     // never send assignment notifications for dashboards
     return parent::save(false);
 }
Exemplo n.º 18
0
 function save($check_notify = FALSE)
 {
     $item = BeanFactory::getBean('xInventories');
     if ($this->new_with_id == true) {
         if ($item->retrieve($this->xinventory_id) != null) {
             switch ($this->operation) {
                 case 'in':
                     $item->quantity += $this->quantity;
                     break;
                 case 'out':
                     $quantity = $item->quantity;
                     $quantity -= $this->quantity;
                     if ($quantity < 0) {
                         $this->quantity = $item->quantity;
                         $item->quantity = 0;
                     } else {
                         $item->quantity = $quantity;
                     }
                     break;
                 default:
                     echo "inventory record operation error!!!";
                     exit;
                     break;
             }
             $item->save();
         }
     }
     parent::save($check_notify);
 }
Exemplo n.º 19
0
 function save($check_notify = false)
 {
     return parent::save($check_notify);
 }
Exemplo n.º 20
0
 public function save($check_notify = false)
 {
     $this->fillInName();
     if (!is_admin($GLOBALS['current_user'])) {
         $this->assigned_user_id = $GLOBALS['current_user']->id;
     }
     if (!empty($this->password) && $this->password == self::$passwordPlaceholder) {
         $this->password = empty($this->fetched_row['password']) ? '' : $this->fetched_row['password'];
     }
     $parentRet = parent::save($check_notify);
     // Nuke the EAPM cache for this record
     if (isset($_SESSION['EAPM'][$this->application])) {
         unset($_SESSION['EAPM'][$this->application]);
     }
     return $parentRet;
 }
Exemplo n.º 21
0
 function save($check_notify = FALSE)
 {
     $this->fillInName();
     if (!is_admin($GLOBALS['current_user'])) {
         $this->assigned_user_id = $GLOBALS['current_user']->id;
     }
     if (!empty($this->password) && $this->password == static::$passwordPlaceholder) {
         $this->password = empty($this->fetched_row['password']) ? '' : $this->fetched_row['password'];
     }
     $parentRet = parent::save($check_notify);
     // Nuke the EAPM cache for this record
     if (isset($_SESSION['EAPM'][$this->application])) {
         unset($_SESSION['EAPM'][$this->application]);
     }
     // Nuke the Meetings type dropdown cache
     sugar_cache_clear('meetings_type_drop_down');
     return $parentRet;
 }
Exemplo n.º 22
0
 function save($check_notify = FALSE)
 {
     $isUpdate = true;
     if (empty($this->id)) {
         $isUpdate = false;
     }
     if ($this->new_with_id == true) {
         $isUpdate = false;
     }
     if ($isUpdate || $isUpdate == false && empty($this->country_name)) {
         $nationality = (require_once 'modules/xeBayOrders/nationality.php');
         $country_name = $nationality[$this->country];
         if (!empty($country_name)) {
             $this->country_name = $country_name['en'];
         }
     }
     parent::save($check_notify);
 }
Exemplo n.º 23
0
 function save($check_notify = FALSE)
 {
     //"amount_usdollar" is really amount_basecurrency. We need to save a copy of the amount in the base currency.
     if (isset($this->amount) && !number_empty($this->amount)) {
         if (!number_empty($this->currency_id)) {
             $currency = new Currency();
             $currency->retrieve($this->currency_id);
             $this->amount_usdollar = $currency->convertToDollar($this->amount);
         } else {
             $this->amount_usdollar = $this->amount;
         }
     }
     return parent::save($check_notify);
 }
Exemplo n.º 24
0
 function save($check_notify = FALSE)
 {
     if (!isset($this->system_id) || empty($this->system_id)) {
         $admin = Administration::getSettings();
         $system_id = $admin->settings['system_system_id'];
         if (!isset($system_id)) {
             $system_id = 1;
         }
         $this->system_id = $system_id;
     }
     return parent::save($check_notify);
 }
Exemplo n.º 25
0
 function save($notification = false)
 {
     parent::save($notification);
 }
Exemplo n.º 26
0
 /**
  * Saves the current activity.
  * @param  boolean $check_notify
  * @return string|bool ID of the new post or false
  */
 public function save($check_notify = false)
 {
     $isUpdate = !(empty($this->id) || $this->new_with_id);
     $this->data = $this->getDataArray();
     $this->data = $this->processDataWithHtmlPurifier($this->activity_type, $this->data);
     if ($this->activity_type == 'post' || $this->activity_type == 'attach') {
         if (!isset($this->data['object']) && !empty($this->parent_type)) {
             $parent = BeanFactory::retrieveBean($this->parent_type, $this->parent_id);
             if ($parent && !is_null($parent->id)) {
                 $this->data['object'] = ActivityQueueManager::getBeanAttributes($parent);
             } else {
                 $this->data['module'] = $this->parent_type;
             }
         }
         if (!$isUpdate) {
             $this->processEmbed();
         }
     }
     $this->data = $this->getDataString();
     $this->last_comment = $this->last_comment_bean->toJson();
     $return = parent::save($check_notify);
     if (($this->activity_type === 'post' || $this->activity_type === 'attach') && !$isUpdate) {
         $this->processPostSubscription();
         $this->processPostTags();
     }
     return $return;
 }
Exemplo n.º 27
0
 function save($check_notify = FALSE)
 {
     return parent::save($check_notify);
 }
Exemplo n.º 28
0
 /**
  *This replaces the label values in the config with the corresponding keys (to make language agnostic).
  */
 public function save($check_notify = false)
 {
     $type = $_REQUEST['type'];
     $name = $_REQUEST['name'];
     $config = htmlspecialchars_decode($_REQUEST['config']);
     $jsonConfig = json_decode($config, true);
     $colsLabels = array();
     $rowsLabels = array();
     if (isset($jsonConfig['cols']) && count($jsonConfig['cols']) > 0) {
         $colsLabels = $this->getKeysForLabels($type, $jsonConfig['cols']);
         $jsonConfig['cols'] = $colsLabels;
     }
     if (isset($jsonConfig['rows']) && count($jsonConfig['rows']) > 0) {
         $rowsLabels = $this->getKeysForLabels($type, $jsonConfig['rows']);
         $jsonConfig['rows'] = $rowsLabels;
     }
     //Set the key value for the inclusions / exclusions
     if (isset($jsonConfig['exclusions']) && count($jsonConfig['exclusions']) > 0) {
         foreach ($jsonConfig['exclusions'] as $key => $value) {
             $newKey = $this->getKeyForLabel($type, $key);
             $jsonConfig['exclusions'][reset($newKey)] = $jsonConfig['exclusions'][$key];
             unset($jsonConfig['exclusions'][$key]);
             //Check that this is an array with 1 element
             if (count($newKey) !== 1) {
                 $this->logSpotsErrorWithKeyMatching($type);
             }
         }
     }
     if (isset($jsonConfig['inclusions']) && count($jsonConfig['inclusions']) > 0) {
         foreach ($jsonConfig['inclusions'] as $key => $value) {
             $newKey = $this->getKeyForLabel($type, $key);
             $jsonConfig['inclusions'][reset($newKey)] = $jsonConfig['inclusions'][$key];
             unset($jsonConfig['inclusions'][$key]);
             //Check that this is an array with 1 element
             if (count($newKey) !== 1) {
                 $this->logSpotsErrorWithKeyMatching($type);
             }
         }
     }
     if (isset($jsonConfig['inclusionsInfo']) && count($jsonConfig['inclusionsInfo']) > 0) {
         foreach ($jsonConfig['inclusionsInfo'] as $key => $value) {
             $newKey = $this->getKeyForLabel($type, $key);
             $jsonConfig['inclusionsInfo'][reset($newKey)] = $jsonConfig['inclusionsInfo'][$key];
             unset($jsonConfig['inclusionsInfo'][$key]);
             //Check that this is an array with 1 element
             if (count($newKey) !== 1) {
                 $this->logSpotsErrorWithKeyMatching($type);
             }
         }
     }
     $this->config = json_encode($jsonConfig);
     return parent::save($check_notify);
 }