public function testsave()
 {
     $aowWorkFlow = new AOW_WorkFlow();
     $aowWorkFlow->name = 'test';
     $aowWorkFlow->flow_module = 'test';
     $aowWorkFlow->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($aowWorkFlow->id));
     $this->assertEquals(36, strlen($aowWorkFlow->id));
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $aowWorkFlow->mark_deleted($aowWorkFlow->id);
     $result = $aowWorkFlow->retrieve($aowWorkFlow->id);
     $this->assertEquals(null, $result);
 }
示例#2
0
 /**
  * Select and run all active flows for the specified bean
  */
 function run_bean_flows(SugarBean &$bean)
 {
     if ($_REQUEST['module'] != 'Import') {
         $query = "SELECT id FROM aow_workflow WHERE aow_workflow.flow_module = '" . $bean->module_dir . "' AND aow_workflow.status = 'Active' AND aow_workflow.deleted = 0 ";
         $result = $this->db->query($query, false);
         $flow = new AOW_WorkFlow();
         while (($row = $bean->db->fetchByAssoc($result)) != null) {
             $flow->retrieve($row['id']);
             if ($flow->check_valid_bean($bean)) {
                 $flow->run_actions($bean, true);
             }
         }
     }
     return true;
 }