Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use count to use check return by ->get() #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jazz7381
Copy link
Contributor

@jazz7381 jazz7381 commented Dec 21, 2020

Description

Related Issues

#92
#88

Checklist:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you linted your code locally prior to submission?
  • Have you successfully ran tests with your changes locally?

@jazz7381
Copy link
Contributor Author

jazz7381 commented Dec 21, 2020

i have fixed this issue before but i didn't make a PR. Can anyone test this code cause i don't have access to whmcs anymore

Copy link

@SaneChoice SaneChoice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the code on a WHMCS installation and normally functionality for managing created servers is restored. This looks good from a testing perspective.

meramsey pushed a commit to meramsey/whmcs-vultr that referenced this pull request Feb 2, 2021
 Open
use count to use check return by ->get()
vultr#101
@Businezz99
Copy link

@jazz7381 That works! You saved me a lot of headache! I was looking for a solution for 8.1.x version. Thanks!

@SaneChoice
Copy link

@jazz7381 - Thank you from all of us!

@jazz7381
Copy link
Contributor Author

glad to help

@Businezz99
Copy link

Businezz99 commented Mar 1, 2021

@jazz7381 It doesn't work in 8.1.1 version now again :(

@Businezz99
Copy link

@SaneChoice Did you update to WHMCS 8.1.1? Are you having issues?

@tmunsch
Copy link

tmunsch commented Mar 12, 2021

I am Still on 8.0.3 and It doesn't work anymore when it did before and i haven't changed anything. I think they are phasing out the API v1 so maybe they are shutting it down. Has anyone started on the API v2 version. I am dying over here lol

@Businezz99
Copy link

I am Still on 8.0.3 and It doesn't work anymore when it did before and i haven't changed anything. I think they are phasing out the API v1 so maybe they are shutting it down. Has anyone started on the API v2 version. I am dying over here lol

I just started using Linode module, i bought one, less headaches to be honest.

@jazz7381
Copy link
Contributor Author

jazz7381 commented Apr 9, 2021

@jazz7381 It doesn't work in 8.1.1 version now again :(

@jazz7381 jazz7381 closed this Apr 9, 2021
@jazz7381 jazz7381 reopened this Apr 9, 2021
@jazz7381
Copy link
Contributor Author

jazz7381 commented Apr 9, 2021

@jazz7381 It doesn't work in 8.1.1 version now again :(

sorry but i don't have access to whmcs anymore

@@ -377,12 +377,12 @@ private function addVMCustomFields($SUBID)
->where('type', 'product')
->where('relid', $this->params['packageid'])
->where('fieldname', 'LIKE', 'subid|%')->get();
if ($customField)
if (count($customField) > 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed and actually breaks the logic flow in things when was debugging this thoroughly today

{
$customFieldValue = Capsule::table('tblcustomfieldsvalues')
->where('fieldid', $customField[0]->id)
->where('relid', $this->serviceID)->get();
if ($customFieldValue)
if (count($customFieldValue) > 0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here.

@@ -116,7 +116,7 @@ public static function getProductConfigOptions($productID, $field = 'all', $defa
public static function customFields($productID)
{
$result = DB::table('tblcustomfields')->where('fieldname', 'subid|Virtual machine ID')->where('type', 'product')->where('relid', $productID)->select('id')->get();
if (!$result)
if (count($result) < 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a good and necessary change needed for php72+ from what i can tell

@@ -490,7 +490,7 @@ public static function getAvailableIsos($isosList)
public static function getUserScripts($clientID, $scripts)
{
$allowScripts = Capsule::table('vultr_scripts')->where('client_id', $clientID)->get();
if (empty($allowScripts))
if (count($allowScripts) < 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also good.

@@ -521,7 +521,7 @@ public static function getUserScripts($clientID, $scripts)
public static function getUserSSHKeys($clientID, $keys)
{
$allowKeys = Capsule::table('vultr_sshkeys')->where('client_id', $clientID)->get();
if (empty($allowKeys))
if (count($allowKeys) < 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants