CORE-POS/IS4C

View on GitHub
fannie/sync/special/taxrates.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/**
  Special: connect to transactional database on the lane
  instead of the operational database. Tax rates are on
  the operational side on the server and transactional
  side on the lanes.
*/

include(__DIR__ . '/../../config.php');
foreach ($FANNIE_LANES as $lane) {
    $dbc->addConnection($lane['host'],$lane['type'],$lane['trans'],
            $lane['user'],$lane['pw']);
    if ($dbc->connections[$lane['trans']] !== false) {
        $selectQ = '
            SELECT id,
                rate,
                description
            FROM taxrates';
        $insQ = '
            INSERT INTO taxrates
                (id, rate, description)';
        $dbc->query("TRUNCATE TABLE taxrates", $lane['trans']);
        $ret = $dbc->transfer($FANNIE_OP_DB, $selectQ, $lane['trans'], $insQ);
    }
}

echo "<li>Tax rates table synched</li>";