Jump to content

elzek1

Members
  • Posts

    24
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by elzek1

  1. Hello

    I added functions to code of this module. Whit this code suspend and unsuspend works fine, please check it:

    Teamspeak.php suspend function:

        public function suspendService($package, $service, $parent_package = null, $parent_service = null)
        {
            $row = $this->getModuleRow();
            $api = $this->getApi(
                $row->meta->hostname,
                $row->meta->username,
                $row->meta->password,
                $row->meta->port
            );
    
            if (!$row) {
                $this->Input->setErrors(
                    ['module_row' => ['missing' => Language::_('Teamspeak.!error.module_row.missing', true)]]
                );
    
                return;
            }
    
            // Get service parameters
            $service_fields = $this->serviceFieldsToObject($service->fields);
            // Modify "virtualserver_autostart" to 0
            $this->parseResponse($api->suspendServer($service_fields->teamspeak_sid));
            // Stop server
            $this->parseResponse($api->stopServer($service_fields->teamspeak_sid));
    
    
            return null;
        }

    Teamspeak.php unsuspend function:

        public function unsuspendService($package, $service, $parent_package = null, $parent_service = null)
        {
            $row = $this->getModuleRow();
            $api = $this->getApi(
                $row->meta->hostname,
                $row->meta->username,
                $row->meta->password,
                $row->meta->port
            );
    
            if (!$row) {
                $this->Input->setErrors(
                    ['module_row' => ['missing' => Language::_('Teamspeak.!error.module_row.missing', true)]]
                );
    
                return;
            }
    
            // Get service parameters
            $service_fields = $this->serviceFieldsToObject($service->fields);
            // Modify "virtualserver_autostart" to 1
            $this->parseResponse($api->unsuspendServer($service_fields->teamspeak_sid));
            // Start server
            $this->parseResponse($api->startServer($service_fields->teamspeak_sid));
    
    
            return null;
        }

    These codes call two new functions in teamspeak_api.php:

    teamspeak_api.php suspendserver function:

        public function suspendServer($sid)
        {
            try {
                // Build the parameters array
                $api_params = [
                    'virtualserver_autostart' => 0
                ];
    
                // Fetch the virtual server instance, and modify it
                $instance = $this->apiRequest('serverquery')->serverList()[$sid];
                $result = $instance->modify($api_params);
    
                // Add a control variable to know if the API request has been send successfully
                if (empty($result['error'])) {
                    $result['status'] = true;
                }
    
            } catch (Exception $e) {
                $result = [
                    'error' => $e->getMessage(),
                    'status' => false,
                    'code' => $e->getCode()
                ];
            }
    
            return (object) $result;
    }

    teamspeak_api.php unsuspendserver function:

        public function unsuspendServer($sid)
    {
            try {
                // Build the parameters array
                $api_params = [
                    'virtualserver_autostart' => 1
                ];
    
                // Fetch the virtual server instance, and modify it
                $instance = $this->apiRequest('serverquery')->serverList()[$sid];
                $result = $instance->modify($api_params);
    
                // Add a control variable to know if the API request has been send successfully
                if (empty($result['error'])) {
                    $result['status'] = true;
                }
    
            } catch (Exception $e) {
                $result = [
                'error' => $e->getMessage(),
                'status' => false,
                'code' => $e->getCode()
                ];
            }
    
        return (object) $result;
    }

    That is all, i attached file if someone wants to donwnload it  

    teamspeak.php teamspeak_api.php

  2. 6 hours ago, Tyson said:

    Cancellations typically remove the account from the service, so it would make sense for the canceled service to delete the server on Teamspeak. It doesn't look like the Teamspeak API supports any type of service suspension, so the module doesn't support suspensions in Blesta. What is the behavior you are expecting?

    Hello Tyson

    Previously I used whmcs and when the service went into suspension, 2 things happened:
    1.- Virtual server was stopped
    2.- Auto-start function disabled, this in case vps was restarted  vitual server client did not start.

  3. 8 hours ago, Blesta.Store said:

    Sounds like WHMCS has a invalid client ID for a customer. Check every client on your installation has a valid client number.

    @Tyson

    I do not think so, because the process fails when it imports invoices. Clients are imported without problem.

    [1] => importInvoices: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null on line 196

    I checked the invoices and they are all associated with a client.

    1 hour ago, Paul said:

    @elzek1 Take a look at what Mike from Blesta.Store mentioned with your client ID's. Any imports must be done on a fresh Blesta installation, and we recommend making a backup of your Blesta install before attempting an import so you can restore and retry.

    I assume you are using Blesta 4.5.2?

    Im using Blesta 4.5.1 fresh installation only for testing because If the import is done correctly I hope to pass it to production.

  4. On 1/14/2019 at 3:59 PM, Paul said:

    WHMCS plays very loose with their data, so sometimes there is no data when data is expected and required and it results in an error. Check your WHMCS database to make sure all clients/contacts have a client ID. The subsequent errors are likely a result of the first.

    If you need help, and are willing to securely share a dump of your WHMCS database, we can attempt the import here and debug any issues and either update the importer to work for you, or send you a fresh Blesta database with your imported data. We delete all data when we are finished.

    Hello Paul

     

    I have same problem, I can give you a copy of the database, but you should delete it when you finish working on it.

     

    This is my error code:

     

    importStaff
    -----------------
    importStaff took: 0.293 seconds
    -----------------
    
    importClients
    -----------------
    importClients took: 0.0378 seconds
    -----------------
    
    importContacts
    -----------------
    importContacts took: 0.0013 seconds
    -----------------
    
    importTaxes
    -----------------
    importTaxes took: 0.0011 seconds
    -----------------
    
    importCurrencies
    -----------------
    importCurrencies took: 0.0054 seconds
    -----------------
    
    importInvoices
    -----------------
    importTransactions
    -----------------
    importPackageOptions
    -----------------
    importServices
    -----------------
    importSupportDepartments
    -----------------
    importSupportTickets
    -----------------
    importMisc
    -----------------
    decrypted 0 values using WHMCS' custom algorithm
    decrypt took: 0 seconds
    total time took: 0.3976 seconds
    Array
    (
        [error] => Array
            (
                [0] => The import completed but the following errors ocurred:
                [1] => importInvoices: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'client_id' cannot be null on line 196
                [2] => importTransactions: There is already an active transaction on line 231
                [3] => importPackageOptions: There is already an active transaction on line 231
                [4] => importServices: There is already an active transaction on line 231
                [5] => importSupportDepartments: There is already an active transaction on line 231
                [6] => importSupportTickets: There is already an active transaction on line 231
                [7] => importMisc: There is already an active transaction on line 231
            )
    
    )

     

  5. On 5/17/2019 at 11:06 AM, Blesta Addons said:

    you can open a ticket with blesta, give him more info about your reseller and license key, i'm sure they can move the license to your account or give you another license key with the matched expiration date .

     

    Thanks for the information

  6. 2 hours ago, GosuHost said:

    You wont lose your license. You can login your client panel and manage your license from the client area or you can talk and request a move of the license. the system was in maintence mode as i was moving servers. You should open a ticket with us as we dont know who you are and can help validate the license or work toward getting it moved to you directly.

    Hello

    Now your website is working, but previously I could not access the client platform because it was with the finishing message of your business. Which causes me concern because I have a blesta license with you. The important thing is to know if you continue in the business because if you leave, you should find a way to move the license to blesta.com otherwise it is not necessary.

  7. 2 hours ago, Blesta Addons said:

    you can open a ticket with blesta, give him more info about your reseller and license key, i'm sure they can move the license to your account or give you another license key with the matched expiration date .

     

    I have a blesta owned unbranded licence whit addon company buyed in @GosuHost

  8. I currently have a license with a blesta reseller. I opened the browser and went to the reseller's website, my surprise is that it is out of business with the following message "No longer in business, Closed 11/2018". The questions that arise immediately are:
    Will return?
    What will happen to my license?
    What do I do to reinstall my license?

    I am currently developing a payment gateway, and I do not have the web in production, but soon I want to have the system working and  with this problem I will not be able to. In case this dealer does not return I lose my license? I'm worried about the situation, I'll be waiting for your answers.

×
×
  • Create New...