Example #1
0
 public function testSampleData()
 {
     $samples = array('couponcodes', 'custdata', 'departments', 'employees', 'globalvalues', 'houseCoupons', 'houseCouponItems', 'MasterSuperDepts', 'parameters', 'products', 'subdepts', 'tenders');
     $dbc = Database::pDataConnect();
     foreach ($samples as $sample) {
         ob_start();
         $dbc->query('TRUNCATE TABLE ' . $dbc->identifier_escape($sample));
         $loaded = InstallUtilities::loadSampleData($dbc, $sample, false);
         $output = ob_get_clean();
         $this->assertEquals(true, $loaded, 'Error with sample data for ' . $sample . ' (' . $output . ')');
     }
 }
Example #2
0
<hr />
<form action=debug.php method=post>
<b>Log State Changes</b>: 
<?php 
echo InstallUtilities::installSelectField('Debug_CoreLocal', array(1 => 'Yes', 0 => 'No'), 0);
?>
<br />
See optional logs above.
<hr />
<b>Show Page Changes</b>: 
<?php 
echo InstallUtilities::installSelectField('Debug_Redirects', array(1 => 'Yes', 0 => 'No'), 0);
?>
<br />
This option changes HTTP redirects into manual, clickable links. A stack
trace is also included. There are some javascript-based URL changes that
this won't catch, but your browser surely has a fancy javascript console
available for those. If not, find a better browser.
<hr />
<b>Character Set</b>
<?php 
echo InstallUtilities::installTextField('CoreCharSet', 'utf-8');
?>
Change the character set used to display pages. Common values are "utf-8" and "iso-8859-1".
<hr />
<input type=submit value="Save Changes" />
</form>
</div> <!--    wrapper -->
</body>
</html>
Example #3
0
</td></tr>
<tr>
    <td colspan=2>
    <b>Variable Weight Item Mapping</b> (UPC Prefix "2"):<br />
    Variable-weight items do not have identical barcodes because the
    price is encoded in the barcode. A translator is required to map
    these different barcodes back to one logical product.
    </td>
</tr>
<tr>
    <td>
    <b>Translator</b>:
    </td>
    <td>
    <?php 
$mods = AutoLoader::listModules('VariableWeightReWrite');
echo InstallUtilities::installSelectField('VariableWeightReWriter', $mods, 'ZeroedPriceReWrite');
?>
    </td>
</tr>
<tr><td colspan=2>
<hr />
</td></tr>
<tr><td>
<input type=submit name=scansubmit value="Save Changes" />
</td></tr></table>
</form>
</div> <!--    wrapper -->
</body>
</html>
Example #4
0
<tr>
    <td><b>STMP Security</b>:</td>
    <td><?php 
echo InstallUtilities::installSelectField('emailReceiptSSL', array('none', 'SSL', 'TLS'), 'none');
?>
</td>
</tr>
<tr>
    <td><b>HTML Receipt Builder</b>:</td>
    <?php 
$mods = AutoLoader::listModules('DefaultHtmlEmail');
sort($mods);
$e_mods = array('' => '[None]');
foreach ($mods as $m) {
    $e_mods[$m] = $m;
}
?>
    <td><?php 
echo InstallUtilities::installSelectField('emailReceiptHtml', $e_mods, '');
?>
</td>
</tr>
<tr><td colspan=2 class="submitBtn">
<input type=submit name=esubmit value="Save Changes" />
</td></tr>
</table>
</form>
</div> <!--    wrapper -->
</body>
</html>
Example #5
0
 /**
   Examine configuration file. Extract settings
   that do not belong in the configuration file,
   write them to opdata.parameters, then remove
   them from the configuration file
 */
 public static function migrateSettings()
 {
     if (file_exists(dirname(__FILE__) . '/../../ini.php') && class_exists('InstallUtilities')) {
         $file = dirname(__FILE__) . '/../../ini.php';
         $settings = self::readIniPhp();
         foreach ($settings as $key => $value) {
             if (!in_array($key, self::$INI_SETTINGS)) {
                 if ($key == 'SpecialDeptMap') {
                     // SpecialDeptMap has a weird array structure
                     // and gets moved to a dedicated table
                     $db = Database::pDataConnect();
                     if ($db->table_exists('SpecialDeptMap')) {
                         $mapModel = new \COREPOS\pos\lib\models\op\SpecialDeptMapModel($db);
                         $mapModel->initTable($sconf);
                         InstallUtilities::confRemove($key);
                     }
                 } else {
                     // other settings go into opdata.parameters
                     $saved = InstallUtilities::paramSave($key, $value);
                     if ($saved && is_writable($file)) {
                         InstallUtilities::confRemove($key);
                     }
                 }
             }
         }
     }
 }
Example #6
0
if (!is_array($settings2)) {
    $settings2 = array();
}
if (isset($_REQUEST['TR_LIST'])) {
    $saveStr2 = "array(";
    $settings2 = array();
    foreach ($_REQUEST['TR_LIST'] as $dt) {
        if ($dt == "") {
            continue;
        }
        list($code2, $name2) = explode(":", $dt);
        $settings2[$code2] = $name2;
        $saveStr2 .= "'" . $code2 . "'=>'" . addslashes($name2) . "',";
    }
    $saveStr2 = rtrim($saveStr2, ",") . ")";
    InstallUtilities::paramSave('TRDesiredTenders', $settings2);
}
//end TR desired tenders
$db = Database::pDataConnect();
$res = $db->query("SELECT TenderCode, TenderName FROM tenders ORDER BY TenderName");
?>
<table cellspacing="0" cellpadding="4" border="1">
<?php 
echo "<thead><tr><th>Tender Name</th><th>Map To</th><th>Tender Rpt</th></tr></thead><tbody>\n";
while ($row = $db->fetch_row($res)) {
    printf('<tr><td>%s (%s)</td>', $row['TenderName'], $row['TenderCode']);
    echo '<td><select name="TenderMapping[]">';
    echo '<option value="">default</option>';
    foreach ($mods as $m) {
        printf('<option value="%s:%s" %s>%s</option>', $row['TenderCode'], $m, isset($settings[$row['TenderCode']]) && $settings[$row['TenderCode']] == $m ? 'selected' : '', $m);
    }
Example #7
0
 public static function createMinServer($db, $name)
 {
     $errors = array();
     $type = $db->dbms_name();
     if (CoreLocal::get('laneno') == 0) {
         $errors[] = array('struct' => 'No structures created for lane #0', 'query' => 'None', 'details' => 'Zero is reserved for server');
         return $errors;
     }
     $models = array('\\COREPOS\\pos\\lib\\models\\trans\\DTransactionsModel', '\\COREPOS\\pos\\lib\\models\\trans\\SuspendedModel', '\\COREPOS\\pos\\lib\\models\\trans\\EfsnetRequestModel', '\\COREPOS\\pos\\lib\\models\\trans\\EfsnetRequestModModel', '\\COREPOS\\pos\\lib\\models\\trans\\EfsnetResponseModel', '\\COREPOS\\pos\\lib\\models\\trans\\EfsnetTokensModel', '\\COREPOS\\pos\\lib\\models\\trans\\PaycardTransactionsModel', '\\COREPOS\\pos\\lib\\models\\trans\\CapturedSignatureModel', '\\COREPOS\\pos\\lib\\models\\trans\\CcReceiptViewModel');
     foreach ($models as $class) {
         $obj = new $class($db);
         $errors[] = $obj->createIfNeeded($name);
     }
     $dlogQ = "CREATE VIEW dlog AS\n            SELECT datetime AS tdate,\n                register_no,\n                emp_no,\n                trans_no,\n                upc,\n                CASE \n                    WHEN trans_subtype IN ('CP','IC') OR upc LIKE '%000000052' THEN 'T' \n                    WHEN upc = 'DISCOUNT' THEN 'S' \n                    ELSE trans_type \n                END AS trans_type,\n                CASE \n                    WHEN upc = 'MAD Coupon' THEN 'MA' \n                    WHEN upc LIKE '%00000000052' THEN 'RR' \n                    ELSE trans_subtype \n                END AS trans_subtype,\n                trans_status,\n                department,\n                quantity,\n                unitPrice,\n                total,\n                tax,\n                foodstamp,\n                ItemQtty,\n                memType,\n                staff,\n                numflag,\n                charflag,\n                card_no,\n                trans_id, " . $db->concat($db->convert('emp_no', 'char'), "'-'", $db->convert('register_no', 'char'), "'-'", $db->convert('trans_no', 'char'), '') . " AS trans_num\n            FROM dtransactions\n            WHERE trans_status NOT IN ('D','X','Z')\n                AND emp_no <> 9999 \n                AND register_no <> 99";
     if (!$db->table_exists("dlog", $name)) {
         $errors = InstallUtilities::dbStructureModify($db, 'dlog', $dlogQ, $errors);
     }
     $ttG = "\n            CREATE VIEW TenderTapeGeneric AS\n            SELECT tdate, \n                emp_no, \n                register_no,\n                trans_no,\n                CASE \n                    WHEN trans_subtype = 'CP' AND upc LIKE '%MAD%' THEN ''\n                    WHEN trans_subtype IN ('EF','EC','TA') THEN 'EF'\n                    ELSE trans_subtype\n                END AS trans_subtype,\n                CASE \n                    WHEN trans_subtype = 'ca' THEN\n                        CASE WHEN total >= 0 THEN total ELSE 0 END\n                    ELSE -1 * total\n            END AS tender\n            FROM dlog\n            WHERE tdate >= " . $db->curdate() . "\n                AND trans_subtype NOT IN ('0','')";
     if (!$db->table_exists("TenderTapeGeneric", $name)) {
         InstallUtilities::dbStructureModify($db, 'TenderTapeGeneric', $ttG, $errors);
     }
     return $errors;
 }
Example #8
0
function buildLTTViewsMySQL($db, $errors = array())
{
    //--------------------------------------------------------------
    // CREATE lttSummary VIEW
    //--------------------------------------------------------------
    $createStr = "CREATE view lttsummary as\n    select \n    (case when min(datetime) is null then " . $db->now() . " else min(datetime) end) as tdate,\n    max(card_no) as card_no, \n    CAST(sum(total) AS decimal(10,2)) as runningTotal,\n    CAST(sum(case when discounttype = 1 then discount else 0 end) AS decimal(10,2)) as discountTTL,\n    CAST(sum(case when discountable <> 0 and tax <> 0 then total else 0 end) AS decimal(10,2)) as discTaxable,\n    CAST(sum(case when discounttype in (2,3) then memDiscount else 0 end) AS decimal(10,2)) as memSpecial,\n    CAST(sum(case when discounttype=4 THEN memDiscount ELSE 0 END) AS decimal(10,2)) as staffSpecial,\n    CAST(sum(case when discountable = 0 then 0 else total end) AS decimal(10,2)) as discountableTTL,\n    ";
    $taxRatesQ = "select id,description from taxrates order by id";
    $taxRatesR = $db->query($taxRatesQ);
    while ($taxRatesW = $db->fetch_row($taxRatesR)) {
        $createStr .= "CAST(sum(case when (trans_type = 'I' or trans_type = 'D') and tax = " . $taxRatesW[0] . " and discountable = 0 then total else 0 end) AS decimal(10,2)) as noDiscTaxable_" . $taxRatesW[1] . ",\n";
        $createStr .= "CAST(sum(case when (trans_type = 'I' or trans_type = 'D') and tax = " . $taxRatesW[0] . " and discountable <> 0 then total else 0 end) AS decimal(10,2)) as discTaxable_" . $taxRatesW[1] . ",\n";
        $createStr .= "CAST(sum(case when (trans_type = 'I' or trans_type = 'D') and tax = " . $taxRatesW[0] . " and discountable = 0 and foodstamp=1 then total else 0 end) AS decimal(10,2)) as fsTaxable_" . $taxRatesW[1] . ",\n";
        $createStr .= "CAST(sum(case when (trans_type = 'I' or trans_type = 'D') and tax = " . $taxRatesW[0] . " and discountable <> 0 and foodstamp=1 then total else 0 end) AS decimal(10,2)) as fsDiscTaxable_" . $taxRatesW[1] . ",\n";
    }
    $createStr .= "\nCAST(sum(case when trans_subtype = 'MI' or trans_subtype = 'CX'  then total else 0 end) AS decimal(10,2)) as chargeTotal,\nCAST(sum(case when department = 990  then total else 0 end) AS decimal(10,2)) as paymentTotal,\nCAST(sum(case when trans_type = 'T' and department = 0 then total else 0 end) AS decimal(10,2)) as tenderTotal,\n";
    $createStr .= "CAST(sum(case when trans_subtype = 'FS' or trans_subtype = 'EF' then total else 0 end) AS decimal(10,2)) as fsTendered,\nCAST(sum(case when foodstamp = 1 and discountable = 0 then total else 0 end) AS decimal(10,2)) as fsNoDiscTTL,\nCAST(sum(case when foodstamp = 1 and discountable <> 0 then total else 0 end) AS decimal(10,2)) as fsDiscTTL,\n(case when (max(percentDiscount) is null or max(percentDiscount) < 0) then 0.00 else max(CAST(percentDiscount AS decimal)) end) as percentDiscount,\nCAST(sum(case when numflag=1 THEN total ELSE 0 END) AS decimal(10,2)) as localTotal,\nCAST(sum(case when trans_status='V' THEN -total ELSE 0 END) AS decimal(10,2)) as voidTotal,\nmax(trans_id) as LastID\nfrom localtemptrans WHERE trans_type <> 'L'\n";
    $errors = InstallUtilities::dbStructureModify($db, 'lttsummary', 'DROP VIEW lttsummary', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'lttsummary', $createStr, $errors);
    $rpQ = str_replace("select", "select emp_no,register_no,trans_no,", $createStr);
    $rpQ = str_replace("localtemptrans", "localtranstoday", $rpQ);
    $rpQ = str_replace("lttsummary", "rp_lttsummary", $rpQ);
    $rpQ .= " AND datetime >= CURRENT_DATE GROUP BY emp_no,register_no,trans_no";
    $errors = InstallUtilities::dbStructureModify($db, 'rp_lttsummary', 'DROP VIEW rp_lttsummary', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'rp_lttsummary', $rpQ, $errors);
    //echo str_replace("\n","<br />",$createStr)."<br />";
    //echo "<hr />";
    //--------------------------------------------------------------
    // CREATE lttSubTotals VIEW
    //--------------------------------------------------------------
    $createStr = "CREATE VIEW lttsubtotals AS\n    select tdate,\n";
    $ratesQ = "select description,rate from taxrates";
    $ratesR = $db->query($ratesQ);
    $desc = array();
    $rates = array();
    while ($ratesW = $db->fetch_row($ratesR)) {
        array_push($desc, $ratesW[0]);
        array_push($rates, $ratesW[1]);
    }
    if (count($rates) > 0) {
        $createStr .= "CAST(";
        for ($i = 0; $i < count($rates); $i++) {
            $createStr .= "(noDiscTaxable_" . $desc[$i] . " * " . $rates[$i] . ") + ";
            $createStr .= "(discTaxable_" . $desc[$i] . " * ((100-percentDiscount)/100) * " . $rates[$i] . ") + ";
        }
        $createStr = substr($createStr, 0, strlen($createStr) - 2);
        $createStr .= " AS decimal(10,2)) as taxTotal,\n";
    } else {
        $createStr .= "0 as taxTotal,\n";
    }
    $createStr .= "fsTendered,\nCAST(fsTendered + fsNoDiscTTL + (fsDiscTTL * ((100-percentDiscount)/100)) AS  DECIMAL(10,2)) AS fsEligible,\n";
    if (count($rates) > 0) {
        for ($i = 0; $i < count($rates); $i++) {
            $createStr .= "CAST((fsDiscTaxable_" . $desc[$i] . "*((100-percentDiscount)/100)) + fsTaxable_" . $desc[$i] . " AS decimal(10,2)) as fsTaxable_" . $desc[$i] . ",";
            $createStr .= "CAST((fsDiscTaxable_" . $desc[$i] . "*((100-percentDiscount)/100)*" . $rates[$i] . ")+(fsTaxable_" . $desc[$i] . "*" . $rates[$i] . ") AS decimal(10,2)) as fsTax_" . $desc[$i] . ",\n";
        }
    } else {
        $createStr .= "0 as fsTax,\n";
    }
    $createStr .= "CAST(discountableTTL * percentDiscount / 100 AS decimal(10,2)) as transDiscount\n\nfrom lttsummary\n";
    $errors = InstallUtilities::dbStructureModify($db, 'lttsubtotals', 'DROP VIEW lttsubtotals', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'lttsubtotals', $createStr, $errors);
    $rpQ = str_replace("select", "select emp_no,register_no,trans_no,", $createStr);
    $rpQ = str_replace("lttsummary", "rp_lttsummary", $rpQ);
    $rpQ = str_replace("lttsubtotals", "rp_lttsubtotals", $rpQ);
    $errors = InstallUtilities::dbStructureModify($db, 'rp_lttsubtotals', 'DROP VIEW rp_lttsubtotals', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'rp_lttsubtotals', $rpQ, $errors);
    //echo str_replace("\n","<br />",$createStr)."<br />";
    //echo "<hr />";
    //--------------------------------------------------------------
    // CREATE SubTotals VIEW
    //--------------------------------------------------------------
    $createStr = "CREATE view subtotals as\nselect\n(case when l.LastID is null then 0 else l.LastID end) as LastID,\nl.card_no as card_no,\nl.runningTotal as runningTotal,\nl.discountableTTL as discountableTotal,\nl.tenderTotal as tenderTotal,\nl.chargeTotal as chargeTotal,\nl.paymentTotal as paymentTotal,\nl.discountTTL as discountTTL,\nl.memSpecial as memSpecial,\nl.staffSpecial as staffSpecial,\ns.fsEligible as fsEligible,\n";
    $ratesQ = "select description,rate from taxrates order by rate desc";
    $ratesR = $db->query($ratesQ);
    $desc = array();
    $rates = array();
    while ($ratesW = $db->fetch_row($ratesR)) {
        array_push($desc, $ratesW[0]);
        array_push($rates, $ratesW[1]);
    }
    $fsTaxStr = "CAST(CASE WHEN ";
    for ($i = 0; $i < count($rates); $i++) {
        $fsTaxStr .= "s.fsTaxable_" . $desc[$i] . "+";
    }
    $fsTaxStr = substr($fsTaxStr, 0, strlen($fsTaxStr) - 1);
    $fsTaxStr .= " = 0 THEN 0 ELSE CASE WHEN l.fsTendered <> 0 AND -1 * l.fsTendered >= ";
    for ($i = 0; $i < count($rates); $i++) {
        $fsTaxStr .= "s.fsTaxable_" . $desc[$i] . "+";
    }
    $fsTaxStr = substr($fsTaxStr, 0, strlen($fsTaxStr) - 1);
    $fsTaxStr .= " THEN -1 * (";
    for ($i = 0; $i < count($rates); $i++) {
        $fsTaxStr .= "s.fsTax_" . $desc[$i] . "+";
    }
    $fsTaxStr = substr($fsTaxStr, 0, strlen($fsTaxStr) - 1);
    $fsTaxStr .= ") ELSE CASE ";
    for ($i = 0; $i < count($rates); $i++) {
        $fsTaxStr .= "WHEN -1*l.fsTendered ";
        for ($j = $i - 1; $j >= 0; $j--) {
            $fsTaxStr .= "-s.fsTaxable_" . $desc[$j];
        }
        $fsTaxStr .= "<= s.fsTaxable_" . $desc[$i];
        $fsTaxStr .= " THEN -(";
        for ($j = $i - 1; $j >= 0; $j--) {
            $fsTaxStr .= "s.fsTax_" . $desc[$j] . "+";
        }
        $fsTaxStr .= "((-1*l.fsTendered ";
        for ($j = $i - 1; $j >= 0; $j--) {
            $fsTaxStr .= "-s.fsTaxable_" . $desc[$j];
        }
        $fsTaxStr .= ") * " . $rates[$i] . "))";
    }
    $fsTaxStr .= " ELSE 0 ";
    $fsTaxStr .= " END END END AS decimal(10,2))\n";
    if (count($rates) > 0) {
        $createStr .= $fsTaxStr . " as fsTaxExempt,\n";
        $createStr .= "CAST(s.taxTotal+" . $fsTaxStr . " AS decimal(10,2)) as taxTotal,\n";
    } else {
        $createStr .= "0 as fsTaxExempt,\n";
        $createStr .= "0 as taxTotal,\n";
    }
    $createStr .= "\ns.transDiscount as transDiscount,\nl.percentDiscount as percentDiscount,\nl.localTotal as localTotal,\nl.voidTotal as voidTotal\nfrom lttsummary l, lttsubtotals s where l.tdate = s.tdate\n";
    $errors = InstallUtilities::dbStructureModify($db, 'subtotals', 'DROP VIEW subtotals', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'subtotals', $createStr, $errors);
    $rpQ = str_replace("select", "select l.emp_no,l.register_no,l.trans_no,", $createStr);
    $rpQ = str_replace("lttsummary", "rp_lttsummary", $rpQ);
    $rpQ = str_replace("lttsubtotals", "rp_lttsubtotals", $rpQ);
    $rpQ = str_replace("view subtotals", "view rp_subtotals", $rpQ);
    $rpQ .= " AND l.emp_no=s.emp_no AND \n    l.register_no=s.register_no AND\n    l.trans_no=s.trans_no";
    $errors = InstallUtilities::dbStructureModify($db, 'rp_subtotals', 'DROP VIEW rp_subtotals', $errors);
    $errors = InstallUtilities::dbStructureModify($db, 'rp_subtotals', $rpQ, $errors);
    //echo str_replace("\n","<br />",$createStr)."<br />";
    return $errors;
}
Example #9
0
    echo "<span class='fail'>Failed</span>";
    echo '<div class="db_hints" style="margin-left:25px;width:350px;">';
    if (!function_exists('socket_create')) {
        echo '<i>Try enabling PHP\'s socket extension in php.ini for better diagnostics</i>';
    } elseif (@MiscLib::pingport(CoreLocal::get('mServer'), CoreLocal::get('DBMS'))) {
        echo '<i>Database found at ' . CoreLocal::get('mServer') . '. Verify username and password
            and/or database account permissions.</i>';
    } else {
        echo '<i>Database does not appear to be listening for connections on ' . CoreLocal::get('mServer') . '. Verify host is correct, database is running and
            firewall is allowing connections.</i>';
    }
    echo '</div>';
} else {
    echo "<span class='success'>Succeeded</span><br />";
    //echo "<textarea rows=3 cols=80>";
    $sErrors = InstallUtilities::createMinServer($sql, CoreLocal::get('mDatabase'));
    $sErrors = array_filter($sErrors, function ($x) {
        return $x['error'] != 0;
    });
    if (!empty($sErrors)) {
        echo '<div class="db_create_errors" style="border: solid 1px red;padding:5px;">';
        echo 'There were some errors creating transactional DB structure';
        echo '<ul style="margin-top:2px;">';
        foreach ($sErrors as $error) {
            if ($error['error'] == 0) {
                continue;
                // no error occurred
            }
            echo '<li>';
            echo 'Error on structure <b>' . $error['struct'] . '</b>. ';
            printf('<a href="" onclick="$(\'#eDetails%s\').toggle();return false;">Details</a>', $error['struct']);
Example #10
0
    InstallUtilities::loadSampleData($db, 'products');
} elseif (isset($_REQUEST['tenders'])) {
    echo "Loading tenders";
    $db->query("TRUNCATE TABLE tenders");
    InstallUtilities::loadSampleData($db, 'tenders');
} elseif (isset($_REQUEST['depts'])) {
    echo "Loading departments";
    $db->query("TRUNCATE TABLE departments");
    InstallUtilities::loadSampleData($db, 'departments');
    echo "<br />Loading super departments";
    $db->query("TRUNCATE TABLE MasterSuperDepts");
    InstallUtilities::loadSampleData($db, 'MasterSuperDepts');
} elseif (isset($_REQUEST['quicklookups'])) {
    echo "Loading QuickLookups";
    $db->query("TRUNCATE TABLE QuickLookups");
    InstallUtilities::loadSampleData($db, 'QuickLookups');
}
?>
</b></div>
<p>Some sample data is available to get a test lane
up &amp; running quickly. Keep in mind this data
overwrites whatever is currently in the table.</p>
<hr />
<b>Employees</b>
<p>This table contains login information for cashiers. The two
included logins are '56' and '7000'.</p>
<input id="data" type=submit name=employees value="Load sample employees" />
<hr />
<b>Custdata</b>
<p>Customer data is the membership information. Sample data includes
 a way too many mostly identical lines. A very scrubbed version
Example #11
0
// list available updates
$cmd = new ReflectionClass('BasicModel');
$cmd = $cmd->getFileName();
$mods = AutoLoader::listModules('BasicModel');
$adds = 0;
$unknowns = 0;
$errors = 0;
echo '<ul>';
foreach ($mods as $class) {
    if ($class == 'ViewModel') {
        // just a helper subclass not an
        // actual structure
        continue;
    }
    $model = new $class(null);
    $db_name = InstallUtilities::normalizeDbName($model->preferredDB());
    if ($db_name === false) {
        echo '<li>Error: Unknown database "' . $model->preferredDB() . '" for model ' . $class;
        $errors++;
        continue;
    }
    ob_start();
    $changes = $model->normalize($db_name, BasicModel::NORMALIZE_MODE_CHECK);
    $details = ob_get_clean();
    if ($changes === false) {
        printf('<li>%s had errors.', $class);
        $errors++;
    } elseif ($changes > 0) {
        printf('<li>%s has updates available.', $class);
        $adds += $changes;
    } elseif ($changes < 0) {
Example #12
0
echo InstallUtilities::installSelectField('SecurityRefund', $privLevels, 20);
?>
</td>
</tr>
<tr>
    <td><b>Line Item Discount</b>: </td>
    <td><?php 
echo InstallUtilities::installSelectField('SecurityLineItemDiscount', $privLevels, 20);
?>
</td>
</tr>
<tr>
    <td><b>Void Limit</b>:</td>
    <td>
    <?php 
echo InstallUtilities::installTextField('VoidLimit', 0);
?>
 
    (in dollars, per transaction. Zero for unlimited).
    </td>
</tr>
<tr>
    <td colspan=2>
    <hr />
    <input type=submit name=secsubmit value="Save Changes" />
    </td>
</tr>
</table>
</form>
</div> <!--    wrapper -->
</body>
Example #13
0
                        $invert[$value] = $label;
                    }
                    $attributes = array();
                    if (is_array($default)) {
                        $attributes['multiple'] = 'multiple';
                        $attributes['size'] = 5;
                    }
                    echo InstallUtilities::installSelectField($field, $invert, $default, InstallUtilities::EITHER_SETTING, true, $attributes);
                } else {
                    echo InstallUtilities::installTextField($field, $default);
                }
                if (isset($info['description'])) {
                    echo '<span class="noteTxt" style="width:200px;">' . $info['description'] . '</span>';
                }
                InstallUtilities::paramSave($field, CoreLocal::get($field));
                echo '</td></tr>';
            }
            $instance->settingChange();
        }
    }
}
echo '</table>';
InstallUtilities::paramSave('PluginList', CoreLocal::get('PluginList'));
?>
<hr />
<input type=submit name=psubmit value="Save Changes" />
</form>
</div> <!--    wrapper -->
</body>
</html>
Example #14
0
    if (isset($known_good_modules[$name]) && isset($known_good_modules[$name]['description'])) {
        $name = $known_good_modules[$name]['description'];
    }
    echo '<tr>';
    printf('<td style="width: 40%%;"><b>Device</b>: %s</td>', $name);
    printf('<input type="hidden" name="entryID[]" value="%d" />', $i);
    echo '<td><b>Port</b>: <select name="port[]" title="Stored in ini.json">';
    if (isset($known_good_modules[$port['module']])) {
        foreach (expand_port_list($known_good_modules[$port['module']]['common-ports']) as $k => $v) {
            printf('<option %s value="%s">%s</option>', $port['port'] == $k ? 'selected' : '', $k, $v);
        }
    } else {
        echo '<option>' . $port['port'] . '</option>';
    }
    echo '</select></td>';
    printf('<td><label>Delete entry <input type="checkbox" name="delete[]" value="%d" /></label></td>', $i);
    echo '</tr>';
    $i++;
}
$json['NewMagellanPorts'] = $valid;
InstallUtilities::jsonConfSave('NewMagellanPorts', $json['NewMagellanPorts']);
?>
<tr>
    <td colspan=3 class="tblHeader">&nbsp;</td>
</tr>
</table>
<input type="submit" value="Save Changes" />
</form>
</body>
</html>