/**
  * Custom variables for the checkout module. Custom variables are stored in the following format:
  * array(variable_id, variable_name, variable_type, help_text, default_value, required, [variable_options], [multi_select], [multi_select_height])
  * variable_type types are: text,number,password,radio,dropdown
  * variable_options is used when the variable type is radio or dropdown and is a name/value array.
  */
 public function setCustomVars()
 {
     $this->_variables['scheduler'] = array('name' => GetLang('QuickBooksScheduler'), 'type' => 'dropdown', 'help' => GetLang('QuickBooksSchedulerHelp'), 'default' => 'never', 'savedvalue' => array(), 'required' => true, 'options' => array(GetLang('QuickBooksScheduler5min') => '5', GetLang('QuickBooksScheduler10min') => '10', GetLang('QuickBooksScheduler15min') => '15', GetLang('QuickBooksScheduler30min') => '30', GetLang('QuickBooksScheduler1hour') => '60', GetLang('QuickBooksScheduler2hour') => '120', GetLang('QuickBooksScheduler6hour') => '360', GetLang('QuickBooksScheduler12hour') => '720', GetLang('QuickBooksScheduler1day') => '1440', GetLang('QuickBooksScheduler2day') => '2880', GetLang('QuickBooksScheduler1week') => '10080'), 'multiselect' => false);
     $this->_variables['permission'] = array('name' => GetLang('QuickBooksShowPermissionList'), 'type' => 'custom', 'callback' => 'showPermissionList', 'javascript' => $this->showPermissionListJS(), 'help' => GetLang('QuickBooksShowPermissionListHelp'));
     $GLOBALS['AccountExtraJS'] = '';
     if (ModuleIsConfigured($this->getid())) {
         $this->_variables['sync'] = array('heading' => GetLang('QuickBooksShowSyncHeading'), 'name' => GetLang('QuickBooksShowSync'), 'type' => 'custom', 'callback' => 'showSyncList', 'help' => GetLang('QuickBooksShowSyncHelp'));
         $this->_variables['spool'] = array('name' => GetLang('QuickBooksShowSpoolList'), 'type' => 'custom', 'callback' => 'showSpoolList', 'javascript' => '', 'help' => GetLang('QuickBooksShowSpoolListHelp'), 'notemplate' => true);
         $GLOBALS['AccountExtraJS'] = '$("#qb-help-box-password").html("' . $this->_password . '"); $("#qb-help-box").show();';
     }
     $GLOBALS['AccountExtraJS'] .= '; $("#accounting_quickbooks_scheduler").css("width", "305px");';
 }
示例#2
0
文件: 5006.php 项目: hungnv0789/vhtm
	public function update_simplepay_checkout_module()
	{
		if (!ModuleIsConfigured('checkout_paysimple')) {
			return true;
		}

		GetModuleById('checkout', $module, 'checkout_paysimple');

		// Check to see if the module hasn't already been updated
		$value = $module->GetValue('merchantkey');

		if (!is_null($value) && trim($value) !== '') {
			return true;
		}

		// OK, it hasn't been updated yet, so do so
		$keyFile = ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt";

		if (!file_exists($keyFile)) {
			return true;
		}

		if (!is_readable($keyFile)) {
			$this->SetError('Unable to read the key file ' . GetConfig('AppPath') . '/modules/checkout/paysimple/lib/keyHalf.txt. Please CHMOD it to 646 or 666.');
			return false;
		}

		$newKey = @file_get_contents(ISC_BASE_PATH . "/modules/checkout/paysimple/lib/keyHalf.txt");
		$newKey = trim($newKey);

		if ($newKey == '') {
			return true;
		}

		// Make sure you get the 'static' part
		$newKey = Interspire_String::toUnixLineEndings($newKey);
		$newKey = explode("\n", $newKey);
		$newKey = $newKey[0];
		$module->setMerchantKey($newKey);

		return true;
	}
示例#3
0
/**
 * Get a list of the specified type of modules available. Can filter so only enabled, or only configured modules
 * are returned.
 *
 * @param string The type of module (analytics, notifications, checkout or shipping).
 * @param boolean Filter out disabled modules.
 * @param boolean Filter out modules that aren't configured.
 * @param boolean Should we also sort the modules into mutex groups.
 * @return array The array of modules.
 */
function GetAvailableModules($type, $OnlyEnabledModules = false, $OnlyConfiguredModules = false, $SortMutuallyExclusive = false)
{
    $valid_types = array('accounting', 'analytics', 'checkout', 'notification', 'shipping', 'currency', 'livechat', 'rule', 'addon');
    if (!in_array($type, $valid_types)) {
        return array();
    }
    if ($type == 'addon') {
        $dir = ISC_BASE_PATH . "/addons/";
    } else {
        $dir = ISC_BASE_PATH . "/modules/" . $type;
    }
    $modules = array();
    $matches = array();
    $directories = scandir($dir);
    if (!is_array($directories)) {
        return array();
    }
    foreach ($directories as $directory) {
        // Skip over anything we don't want
        if ($directory == "." || $directory == ".." || $directory == ".svn" || !is_dir($dir . "/" . $directory)) {
            continue;
        }
        if ($type == 'addon') {
            $file = "addon." . $directory . ".php";
        } else {
            $file = "module." . $directory . ".php";
        }
        if (!file_exists($dir . "/" . $directory . "/" . $file)) {
            continue;
        }
        $module_name = $directory;
        // If we only want configured modules and this module hasn't been configured, well then skip over it
        $moduleId = $type . '_' . $module_name;
        if ($OnlyConfiguredModules && !ModuleIsConfigured($moduleId)) {
            continue;
        }
        $class_name = isc_strtoupper($type . '_' . $module_name);
        include_once $dir . "/" . $directory . "/" . $file;
        if (!class_exists($class_name)) {
            continue;
        }
        $module = new $class_name();
        if (is_object($module)) {
            $errors = array();
            if (method_exists($module, "LECheck") && $module->LECheck() === false) {
                continue;
            }
            if (method_exists($module, "GetId") && method_exists($module, "GetName")) {
                $mod_details = array("id" => $module->GetId(), "name" => $module->GetName(), "enabled" => $module->IsEnabled(), "object" => $module);
                if ($OnlyEnabledModules) {
                    if ($module->IsEnabled()) {
                        // Nope, just as long as it's enabled
                        $modules[] = $mod_details;
                    }
                } else {
                    $modules[] = $mod_details;
                }
            }
        }
    }
    usort($modules, "sort_modules");
    if ($SortMutuallyExclusive) {
        usort($modules, "sort_modules_by_type");
    }
    $GLOBALS[$type . '_modules'] =& $modules;
    return $modules;
}
示例#4
0
 protected function showPermissionList($moduleid)
 {
     $output = '<div style="float:left;"><input type="hidden" id="' . $moduleid . '[permission]" name="' . $moduleid . '[permission]" value="" /><select size="11" multiple="multiple" name="tmpperm" id="tmpperm" class="Field300 ISSelectReplacement">';
     $mask = $this->getPermissionMask();
     $config = ModuleIsConfigured($this->getid());
     foreach ($this->_permissionset as $cat => $set) {
         foreach ($set as $sub => $flag) {
             if (!$config || ($flag & $mask) == $flag) {
                 $checked = 'selected="selected"';
             } else {
                 $checked = '';
             }
             $output .= '<option value="' . $flag . '" ' . $checked . '>' . GetLang('QuickBooksPerm' . ucfirst(strtolower($cat)) . ucfirst(strtolower($sub))) . '</option>';
         }
     }
     $output .= '</select><br style="clear:left" /></div>';
     return $output;
 }
示例#5
0
/**
 * Check if a particular addon has been set up.
 *
 * @param string The ID of the addon.
 * @return boolean True if the addon has been set up (configured) false if not.
 */
function AddonsModuleIsConfigured($id)
{
	return ModuleIsConfigured($id);
}
示例#6
0
	/**
	 * Build the custom field
	 *
	 * Method will build the custom field used in the settings admin
	 *
	 * @access public
	 * @param string $id The field ID
	 * @return string The built field HTML on success, empty string on error
	 */
	public function buildCustomFieldCallback($id)
	{
		if (trim($id) == '') {
			return '';
		}

		switch (isc_strtolower($id)) {
			case "orderoption":
				$orderOption = $this->getValue("orderoption");

				if ($orderOption == "order") {
					$GLOBALS["OrderTypeReceiptSelected"] = "";
					$GLOBALS["OrderTypeOrderSelected"] = " selected";
				} else {
					$GLOBALS["OrderTypeReceiptSelected"] = " selected";
					$GLOBALS["OrderTypeOrderSelected"] = "";
				}

				return $this->ParseTemplate("order.type", true);
				break;

			case "newprodcategoryidx":
				$GLOBALS["ISC_CLASS_ADMIN_CATEGORY"] = GetClass("ISC_ADMIN_CATEGORY");

				if (!ModuleIsConfigured($this->getid())) {
					$newProdCategoryIDX = array();

					$query = "SELECT categoryid FROM [|PREFIX|]categories";
					$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);

					while ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
						$newProdCategoryIDX[] = $row["categoryid"];
					}

				} else {
					$newProdCategoryIDX = $this->getValue("newprodcategoryidx");

					if (isId($newProdCategoryIDX)) {
						array($newProdCategoryIDX);
					}

					if (!is_array($newProdCategoryIDX)) {
						$newProdCategoryIDX = array();
						$newProdCategoryIDX[] = $this->getValue("newprodcategoryidx");
					}
				}
				$newProdCategoryIDX = array_filter($newProdCategoryIDX, "isId");

				$GLOBALS["CategoryOptions"] = $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->GetCategoryOptions($newProdCategoryIDX, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false);

				return $this->ParseTemplate("product.category", true);
				break;

			default:
				return "";
				break;
		}
	}