Explorar el Código

try to use database

andre hace 4 años
padre
commit
cd62286b6b
Se han modificado 1 ficheros con 23 adiciones y 10 borrados
  1. 23 10
      zimbraSingle.php

+ 23 - 10
zimbraSingle.php

@@ -792,7 +792,9 @@ function zimbraSingle_ServiceSingleSignOn($params) {
 }
 
 function zimbraSingle_AdminServicesTabFieldsSave($params) {
-    $addonQuota = $params['configoptions']['addonQuota']  + $params['configoptions']['newAddQuota'] ;
+    $addonQuota = $params['configoptions']['addonQuota'] ? $params['configoptions']['addonQuota'] : 0 ;
+    $newAddQuota = $params['configoptions']['newAddQuota'] ? $params['configoptions']['newAddQuota'] : 0;
+    $addonQuota = $addonQuota + $newAddQuota;
     $newAddQuota = 0;
     $addonQuotaFieldIDObj = Capsule::table('tblproductconfigoptions')
         ->join('tblhostingconfigoptions', 'tblproductconfigoptions.id', '=', 'tblhostingconfigoptions.configid')
@@ -800,20 +802,31 @@ function zimbraSingle_AdminServicesTabFieldsSave($params) {
         ->where('tblproductconfigoptions.optionname', 'like', 'addonQuota%')
         ->select('tblhostingconfigoptions.id')
         ->get();
-    $addonQuotaFieldID = $addonQuotaFieldIDObj[0]->id;
+    if (isset($addonQuotaFieldIDObj[0]->id)) {
+        $addonQuotaFieldID = $addonQuotaFieldIDObj[0]->id;
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            'addonQuota gefunden',
+            'Debug',
+            $addonQuotaFieldID
+        );
+    };
     $newAddQuotaFieldIDObj = Capsule::table('tblproductconfigoptions')
         ->join('tblhostingconfigoptions', 'tblproductconfigoptions.id', '=', 'tblhostingconfigoptions.configid')
         ->where('tblhostingconfigoptions.relid', '=', $params['serviceid'])
         ->where('tblproductconfigoptions.optionname', 'like', 'newAddQuota%')
         ->select('tblhostingconfigoptions.id')
         ->get();
-    $newAddQuotaFieldID = $newAddQuotaFieldIDObj[0]->id;
-    logModuleCall(
-        'zimbrasingle',
-        __FUNCTION__,
-        $newAddQuotaFieldID,
-        'Debug',
-        $addonQuotaFieldID
-    );
+    if (isset($newAddQuotaFieldIDObj[0]->id)) {
+        $newAddQuotaFieldID = $newAddQuotaFieldIDObj[0]->id;
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            'newAddQuota gefunden',
+            'Debug',
+            $newAddQuotaFieldID
+        );
+    };
     return 'success';
 }