Explorar o código

add servicecode

andre %!s(int64=3) %!d(string=hai) anos
pai
achega
407ab4a0da
Modificáronse 1 ficheiros con 7 adicións e 9 borrados
  1. 7 9
      servicecode.php

+ 7 - 9
servicecode.php

@@ -1,4 +1,5 @@
 <?php
+use Illuminate\Database\Capsule\Manager as Capsule;
 
 // this hook returns $addon->subscriptionid as $addon.code in smarty
 
@@ -6,13 +7,10 @@ if (!defined("WHMCS"))
     die("This file cannot be accessed directly");
 
 add_hook('ClientAreaProductDetailsPreModuleTemplate', 1, function($vars) {
-
-    logModuleCall(
-        'ClientAreaProductDetailsPreModuleTemplate',
-        __FUNCTION__,
-        $vars,
-        'debug',
-        ''
-    );
-
+    foreach($vars['addons'] as $addon) {
+        $servicecode[$addon['id']] = Capsule::table('tblhostingaddons')
+            ->where('id', $addon['id'])
+            ->value('subscriptionid');
+    }
+    return array('servicecodes' => $servicecode);
 });