Esempio n. 1
0
  Replacement for nightly.lanesync.php using Fannie's API
  instead of cURL

*/
// set class alias so lines don't get too long
use COREPOS\Fannie\API\data\SyncLanes;
include dirname(__FILE__) . '/../config.php';
if (!class_exists('FannieAPI')) {
    include $FANNIE_ROOT . 'classlib2.0/FannieAPI.php';
}
if (!function_exists('cron_msg')) {
    include $FANNIE_ROOT . 'src/cron_msg.php';
}
set_time_limit(0);
foreach (array('valutecRequest', 'valutecRequestMod', 'valutecResponse') as $table) {
    $result = SyncLanes::pull_table("{$table}", 'trans', SyncLanes::TRUNCATE_SOURCE);
    echo cron_msg($result['messages']);
}
$regularPushTables = array('products', 'custdata', 'memberCards', 'custReceiptMessage', 'CustomerNotifications', 'employees', 'departments', 'houseCoupons', 'houseCouponItems', 'houseVirtualCoupons');
foreach ($regularPushTables as $table) {
    $result = SyncLanes::push_table("{$table}", 'op', SyncLanes::TRUNCATE_DESTINATION);
    echo cron_msg($result['messages']);
}
if (isset($FANNIE_COMPOSE_LONG_PRODUCT_DESCRIPTION) && $FANNIE_COMPOSE_LONG_PRODUCT_DESCRIPTION == True) {
    $result = SyncLanes::push_table('productUser', 'op', SyncLanes::TRUNCATE_DESTINATION);
    echo cron_msg($result['messages']);
}
if (isset($FANNIE_COOP_ID) && $FANNIE_COOP_ID == 'WEFC_Toronto') {
    $result = SyncLanes::push_table('tenders', 'op', SyncLanes::TRUNCATE_DESTINATION);
    echo cron_msg($result['messages']);
    $result = SyncLanes::push_table('memtype', 'op', SyncLanes::TRUNCATE_DESTINATION);