Forráskód Böngészése

debug configOptions

andre 5 éve
szülő
commit
917c7e51ea
2 módosított fájl, 84 hozzáadás és 9 törlés
  1. 83 0
      zimbraSingle.inc
  2. 1 9
      zimbraSingle.php

+ 83 - 0
zimbraSingle.inc

@@ -417,6 +417,89 @@ function zimbraSingleConfigOptions($params) {
     return $configOptions;
 }
 
+function zimbraSingleCreateCustomFields($packageconfigoption)
+{
+    $whmcs = App::self();
+    $productID = $whmcs->get_req_var('id');
+    Capsule::table('tblcustomfields')
+        ->where('relid', '=', $productID)
+        ->delete();
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'givenname | Vorname',
+                'fieldtype' => 'text',
+                'required' => 'on',
+                'showorder' => 'on',
+                'sortorder' => '0'
+            )
+        );
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'sn | Nachname',
+                'fieldtype' => 'text',
+                'required' => 'on',
+                'showorder' => 'on',
+                'sortorder' => '1'
+            )
+        );
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'username | E-Mail Name',
+                'fieldtype' => 'text',
+                'required' => 'on',
+                'showorder' => 'on',
+                'sortorder' => '2'
+            )
+        );
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'maildomain | Mail Domaine',
+                'fieldtype' => 'dropdown',
+                'fieldoptions' => implode(',', $packageconfigoption[2]),
+                'required' => 'on',
+                'showorder' => 'on',
+                'sortorder' => '3'
+            )
+        );
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'password | Password',
+                'fieldtype' => 'password',
+                'required' => 'on',
+                'showorder' => 'on',
+                'sortorder' => '4'
+            )
+        );
+    Capsule::table('tblcustomfields')
+        ->insert(
+            array(
+                'type' => 'product',
+                'relid' => $productID,
+                'fieldname' => 'cos | Class of Service',
+                'fieldtype' => 'dropdown',
+                'fieldoptions' => $packageconfigoption[1],
+                'adminonly' => 'on',
+                'required' => 'on',
+                'sortorder' => '5'
+            )
+        );
+}
+
 function recursiveFindAll($haystack, $needle)
 {
     $values = array();

+ 1 - 9
zimbraSingle.php

@@ -111,16 +111,8 @@ function zimbraSingle_ChangePackage($params)
 function zimbraSingle_ConfigOptions($params)
 {
     if(isset($_POST['packageconfigoption'])) {
-        global $whmcs;
-        logModuleCall(
-            'zimbrasingle',
-            __FUNCTION__,
-            $params,
-            "Debug: packageconfioptions",
-            $_POST
-        );
+        zimbraSingleCreateCustomFields($_POST['packageconfigoption']);
     }
-
     $response = zimbraSingleConfigOptions($params);
     if($response) {
         return $response;