public function mark_deleted($id)
 {
     // for now only delete comments, not the products
     //$lineItems = $this->getLineItems();
     $this->load_relationship('product_bundle_notes');
     $lineItems = $this->product_bundle_notes->getBeans();
     /* @var $item SugarBean */
     foreach ($lineItems as $item) {
         $item->mark_deleted($item->id);
     }
     return parent::mark_deleted($id);
 }
Exemple #2
0
 /**
  * Action Remove
  */
 protected function action_remove()
 {
     $this->view = 'json';
     if (!$this->retrieveCurrentBean('Delete')) {
         return;
     }
     if ($this->currentBean->module_dir == "Meetings" || $this->currentBean->module_dir == "Calls") {
         if (!empty($_REQUEST['remove_all_recurrences']) && $_REQUEST['remove_all_recurrences']) {
             CalendarUtils::markRepeatDeleted($this->currentBean);
         }
     }
     $this->currentBean->mark_deleted($_REQUEST['record']);
     $this->view_object_map['jsonData'] = array('access' => 'yes');
 }
Exemple #3
0
 public function mark_deleted($id)
 {
     // reset caches
     $this->clearACLCache();
     parent::mark_deleted($id);
 }
Exemple #4
0
 /**
  * Checks to see if the user owns this mapping or is an admin first
  * If true, then call parent function
  *
  * @param $id
  */
 public function mark_deleted($id)
 {
     global $current_user;
     if (!is_admin($current_user)) {
         $other_map = new ImportMap();
         $other_map->retrieve_by_string_fields(array('id' => $id), false);
         if ($other_map->assigned_user_id != $current_user->id) {
             return false;
         }
     }
     return parent::mark_deleted($id);
 }
Exemple #5
0
 /**
  * overrides SugarBean's method.
  * If a system setting is set, it will mark all related notes as deleted, and attempt to delete files that are
  * related to those notes
  * @param string id ID
  */
 function mark_deleted($id)
 {
     global $sugar_config;
     if ($this->parent_type == 'Emails') {
         if (isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
             $removeFile = "upload://{$id}";
             if (file_exists($removeFile)) {
                 if (!unlink($removeFile)) {
                     $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]");
                 }
             }
         }
     }
     // delete note
     parent::mark_deleted($id);
 }
Exemple #6
0
    public function mark_deleted($id)
    {
        require_once("modules/Calendar/CalendarUtils.php");
        CalendarUtils::correctRecurrences($this, $id);

        parent::mark_deleted($id);
    }
 /**
  * Overrides SugarBean's mark_deleted() to drop the related cache table
  * @param string $id GUID of I-E instance
  */
 function mark_deleted($id)
 {
     parent::mark_deleted($id);
     //bug52021  we need to keep the reference to the folders table in order for emails module to function properly
     //$q = "update inbound_email set groupfolder_id = null WHERE id = '{$id}'";
     //$r = $this->db->query($q);
     $this->deleteCache();
 }
Exemple #8
0
 function mark_deleted($id)
 {
     $query = "update contacts set campaign_id = null where campaign_id = '{$id}' ";
     $this->db->query($query);
     $query = "update accounts set campaign_id = null where campaign_id = '{$id}' ";
     $this->db->query($query);
     // bug49632 - delete campaign logs for the campaign as well
     $query = "update campaign_log set deleted = 1 where campaign_id = '{$id}' ";
     $this->db->query($query);
     return parent::mark_deleted($id);
 }
Exemple #9
0
 /**
  * Provides ability to mark a SugarBean deleted if related file upload failed (and user passed
  * the delete_if_fails optional parameter). Note, private to respect "Principle of least privilege"
  * If you need in derived classes then you may change to protected.
  *
  * @param SugarBean $bean Bean
  * @param array $args The request args
  * @return false if no deletion occured because delete_if_fails was not set otherwise true.
  */
 protected function deleteIfFails($bean, $args)
 {
     // Bug 57210: Need to be able to mark a related record 'deleted=1' when a file uploads fails.
     // delete_if_fails flag is an optional query string which can trigger this behavior. An example
     // use case might be: user's in a modal and client: 1. POST's related record 2. uploads file...
     // If the file was too big, the user may still want to go back and select a smaller file < max;
     // but now, upon saving, the client will attempt to PUT related record first and if their ACL's
     // may prevent edit/deletes it would fail. This rectifies such a scenario.
     if (!empty($args['delete_if_fails'])) {
         // First ensure user owns record
         if ($bean->created_by == $GLOBALS['current_user']->id) {
             $bean->mark_deleted($bean->id);
             return true;
         }
     }
     return false;
 }
Exemple #10
0
 function mark_deleted($id)
 {
     require_once 'modules/Reports/schedule/ReportSchedule.php';
     $report_schedule = new ReportSchedule();
     $scheduled_reports = $report_schedule->get_report_schedule($id);
     foreach ($scheduled_reports as $rs_row) {
         $report_schedule->mark_deleted($rs_row['id']);
     }
     parent::mark_deleted($id);
 }
Exemple #11
0
 /**
  * Delete all the associated Product Bundles from a Quote, This ensures that no orphaned records are left behind,
  * when deleting a record.
  *
  * @param string $id The ID of the record that is being marked as deleted
  */
 public function mark_deleted($id)
 {
     // make sure we have the bean loaded
     if ($this->id !== $id) {
         $this->retrieve($id);
     }
     // load up all the product bundles and delete them
     $this->load_relationship('product_bundles');
     $bundles = $this->product_bundles->getBeans();
     /* @var $bundle ProductBundle */
     foreach ($bundles as $bundle) {
         $bundle->mark_deleted($bundle->id);
     }
     parent::mark_deleted($id);
 }
Exemple #12
0
 public function mark_deleted($id)
 {
     if ($this->id != $id) {
         $this->retrieve($id);
         // does not exist - no need to delete
         if (empty($this->id)) {
             return;
         }
     }
     remove_logic_hook($this->webhook_target_module, $this->trigger_event, $this->getActionArray());
     parent::mark_deleted($id);
 }
Exemple #13
0
 function mark_deleted($id)
 {
     //remove prospects::prospectLists relationships
     $query = "UPDATE prospect_lists_prospects SET deleted = 1 WHERE prospect_list_id = '{$id}' ";
     $this->db->query($query);
     //remove campaigns::prospectLists relationships
     $query = "UPDATE prospect_list_campaigns SET deleted = 1 WHERE prospect_list_id = '{$id}' ";
     $this->db->query($query);
     return parent::mark_deleted($id);
 }
 /**
  * Perform the actual deletion.
  */
 protected function action_delete()
 {
     //do any pre delete processing
     //if there is some custom logic for deletion.
     if (!empty($_REQUEST['record'])) {
         if (!$this->bean->ACLAccess('Delete')) {
             ACLController::displayNoAccess(true);
             sugar_cleanup(true);
         }
         $this->bean->mark_deleted($_REQUEST['record']);
     } else {
         sugar_die("A record number must be specified to delete");
     }
 }
 function mark_deleted($id)
 {
     $rc = new ReportContainer();
     $rc = $rc->retrieve($id);
     if ($rc) {
         $child_containers = $rc->get_linked_beans("containers", "ReportContainer");
         $child_reports = $rc->get_linked_beans("reports", "ZuckerReport");
         foreach ($child_containers as $c) {
             $c->parent_id = $rc->parent_id;
             $c->save();
         }
         foreach ($child_reports as $r) {
             $r->container_id = $rc->parent_id;
             $r->save();
         }
     }
     SugarBean::mark_deleted($id);
 }
Exemple #16
0
 function mark_deleted($id)
 {
     global $current_user;
     parent::mark_deleted($id);
     if ($this->update_vcal) {
         vCal::cache_sugar_vcal($current_user);
     }
 }
 /**
  * Override the current SugarBean functionality to make sure that when this method is called that it will also
  * take care of any draft worksheets by rolling-up the data
  *
  * @param string $id            The ID of the record we want to delete
  */
 public function mark_deleted($id)
 {
     parent::mark_deleted($id);
     // this only happens when ent is built out
     $this->saveProductWorksheet();
 }
Exemple #18
0
 function mark_deleted($id)
 {
     require_once "modules/Calendar/CalendarUtils.php";
     CalendarUtils::correctRecurrences($this, $id);
     global $current_user;
     parent::mark_deleted($id);
     if ($this->update_vcal) {
         vCal::cache_sugar_vcal($current_user);
     }
 }
Exemple #19
0
 public function mark_deleted($id)
 {
     $query = "update data_sets set report_id='' where report_id='{$id}' and deleted=0";
     $this->db->query($query, true, "error removing data sets from reports: ");
     parent::mark_deleted($id);
 }
Exemple #20
0
 function mark_deleted($id)
 {
     $query = "update contacts set campaign_id = null where campaign_id = '{$id}' ";
     $this->db->query($query);
     return parent::mark_deleted($id);
 }
Exemple #21
0
 /**
  * Same as SugarBean::mark_deleted except clears api cache.
  * @param $id
  */
 public function mark_deleted($id)
 {
     sugar_cache_clear('currency_list');
     $return = parent::mark_deleted($id);
     // The per-module cache doesn't need to be cleared here
     MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_CURRENCIES));
 }
Exemple #22
0
 function mark_deleted($id)
 {
     $query = "UPDATE prospect_lists_prospects SET deleted = 1 WHERE prospect_list_id = '{$id}' ";
     $this->db->query($query);
     return parent::mark_deleted($id);
 }
Exemple #23
0
 /**
  * mark_deleted
  * This function handles the management of related workflow components when a workflow is deleted.  The
  * mark_deleted call is also run when the target module of an existing workflow is modified so that the
  * workflow may invalidate the related workflow alerts, actions, etc.
  *
  * @param string $id
  */
 function mark_deleted($id)
 {
     //Completely remove the trigger components////////////////////////
     $trigger_object_list = $this->get_linked_beans('triggers', 'WorkFlowTriggerShell');
     if (!empty($trigger_object_list)) {
         foreach ($trigger_object_list as $trigger_object) {
             //mark delete trigger components and sub expression components
             mark_delete_components($trigger_object->get_linked_beans('future_triggers', 'Expression'));
             mark_delete_components($trigger_object->get_linked_beans('past_triggers', 'Expression'));
             $trigger_object->mark_deleted($trigger_object->id);
             //end the foreach loop on trigger objects
         }
         //end if any alert objects exist
     }
     //Completely remove the trigger filter components////////////////////////
     $trigger_object_list = $this->get_linked_beans('trigger_filters', 'WorkFlowTriggerShell');
     if (!empty($trigger_object_list)) {
         foreach ($trigger_object_list as $trigger_object) {
             //mark delete trigger filter components and sub expression components
             mark_delete_components($trigger_object->get_linked_beans('expressions', 'Expression'));
             $trigger_object->mark_deleted($trigger_object->id);
             //end the foreach loop on trigger filter objects
         }
         //end if any alert objects exist
     }
     //Completely remove the alert components/////////////////////////
     $alert_object_list = $this->get_linked_beans('alerts', 'WorkFlowAlertShell');
     if (!empty($alert_object_list)) {
         foreach ($alert_object_list as $alert_object) {
             //mark delete alert components and sub expression components
             //Alert recipient Object///////
             $alert_object_list2 = $alert_object->get_linked_beans('alert_components', 'WorkFlowAlert');
             foreach ($alert_object_list2 as $alert_object2) {
                 mark_delete_components($alert_object2->get_linked_beans('expressions', 'Expression'));
                 mark_delete_components($alert_object2->get_linked_beans('rel1_alert_fil', 'Expression'));
                 mark_delete_components($alert_object2->get_linked_beans('rel2_alert_fil', 'Expression'));
                 $alert_object2->mark_deleted($alert_object2->id);
                 //end foreach alert_object2
             }
             //End Alert recipient Object/////
             $alert_object->mark_deleted($alert_object->id);
             //end the forloop on the alert objects
         }
         //end if any alert objects exist
     }
     //Completely remove the action components////////////////////////
     //mark delete actionshell components, action components and sub expression components
     $action_shell_list = $this->get_linked_beans('actions', 'WorkFlowActionShell');
     foreach ($action_shell_list as $action_shell_object) {
         //check for bridged child (invites for meetings/calls
         $action_shell_object->check_for_child_bridge(true);
         //mark delete actionshell sub components and actionshell
         mark_delete_components($action_shell_object->get_linked_beans('actions', 'WorkFlowAction'));
         mark_delete_components($action_shell_object->get_linked_beans('rel1_action_fil', 'Expression'));
         $action_shell_object->mark_deleted($action_shell_object->id);
     }
     if ($this->check_controller == true) {
         require_once 'include/controller/Controller.php';
         //Handle re-processing orders
         $controller = new Controller();
         $controller->init($this, "Delete");
         $controller->delete_adjust_order($this->base_module);
     }
     // Delete the schedules
     $this->deleteSchedules();
     //mark deleted the workflow object if delete_workflow_on_cascade is set to true
     if ($this->delete_workflow_on_cascade) {
         parent::mark_deleted($id);
     }
     $this->write_workflow();
     //end function mark_deleted
 }
Exemple #24
0
 /**
  * overrides SugarBean method
  */
 function mark_deleted($id)
 {
     SugarBean::mark_deleted($id);
 }
 /**
  * Deletes the Trigger.
  * If it's the primary Trigger, deletes all the Triggers
  * and Schedules for the parent WorkFlow
  *
  * @param $id - $id of the Trigger to be deleted. If empty use $this->id
  */
 public function mark_deleted($id = null)
 {
     if (!empty($id)) {
         $this->id = $id;
     }
     //mark delete trigger components
     mark_delete_components($this->get_linked_beans('future_triggers', 'Expression'));
     mark_delete_components($this->get_linked_beans('past_triggers', 'Expression'));
     mark_delete_components($this->get_linked_beans('expressions', 'Expression'));
     parent::mark_deleted($this->id);
     $workflow_object = $this->get_workflow_type();
     if ($this->frame_type == "Primary") {
         // Deleting a primary means we delete all triggers, and related schedules
         $workflow_object->deleteTriggers();
         $workflow_object->deleteTriggerFilters();
         $workflow_object->deleteSchedules();
     }
     //reload $workflow_object to make the trigger changes take effect.
     $workflow_object = $this->get_workflow_type();
     $workflow_object->write_workflow();
 }
 /**
  * Overrides SugarBean's mark_deleted() to drop the related cache table
  * @param string $id GUID of I-E instance
  */
 function mark_deleted($id)
 {
     parent::mark_deleted($id);
     $q = "update inbound_email set groupfolder_id = null WHERE id = '{$id}'";
     $r = $this->db->query($q);
     $this->deleteCache();
 }
 function mark_deleted($id)
 {
     require_once 'modules/vCals/vCal.php';
     global $current_user;
     parent::mark_deleted($id);
     if ($this->update_vcal) {
         vCal::cache_sugar_vcal($current_user);
     }
 }