Exemplo n.º 1
0
 /**
  *
  */
 public static function do_edit_entity($entity_data)
 {
     // First check if the user exists
     $display_name = $entity_data['display_name'];
     $entity_data = EntityAPI::do_create_entity($entity_data);
     if (!isset($entity_data['id'])) {
         return EntityAPIUtils::init_error($entity_data, 'Could not update party');
     }
     $entity_data['display_name'] = $display_name;
     PartyProfileAPI::do_edit_party_profile($entity_data);
     BillingAccountAPI::do_edit_billing_account($entity_data);
     return $entity_data;
 }
 /**
  *
  */
 public static function do_create_entity($entity_data)
 {
     // First check if the user exists
     if ($entity_data['edit_mode']) {
         if (UserPartyAPI::does_party_exist($entity_data['user_name'])) {
             return EntityAPIUtils::init_error($entity_data, 'Party with the specified user name already exists');
         }
     }
     $party_role = $entity_data['role'];
     $display_name = $entity_data['display_name'];
     $entity_data = EntityAPI::do_create_entity($entity_data);
     if (isset($entity_data['id'])) {
         $entity_data['display_name'] = $display_name;
         PartyProfileAPI::do_create_party_profile($entity_data);
         BillingAccountAPI::do_create_billing_account($entity_data);
         PartyRoleAPI::add_role_to_party($entity_data, $party_role);
     }
     return $entity_data;
 }