Beispiel #1
0
 public function testCRUD()
 {
     $relatedto = new org_openpsa_relatedto_dba();
     midcom::get('auth')->request_sudo('org.openpsa.relatedto');
     $stat = $relatedto->create();
     $this->assertTrue($stat);
     $this->assertEquals($relatedto->status, org_openpsa_relatedto_dba::SUSPECTED);
     $relatedto->status = org_openpsa_relatedto_dba::CONFIRMED;
     $stat = $relatedto->update();
     $this->assertTrue($stat);
     $this->assertEquals($relatedto->status, org_openpsa_relatedto_dba::CONFIRMED);
     $stat = $relatedto->delete();
     $this->assertTrue($stat);
     midcom::get('auth')->drop_sudo();
 }
Beispiel #2
0
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_delete($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     $response = new midcom_response_xml();
     try {
         $relation = new org_openpsa_relatedto_dba($args[0]);
         $response->result = $relation->delete();
         $response->status = 'Last message: ' . midcom_connection::get_error_string();
     } catch (midcom_error $e) {
         $response->result = false;
         $response->status = "Object '{$args[0]}' could not be loaded, error:" . $e->getMessage();
     }
     return $response;
 }