Esempio n. 1
0
function getSyncFiles($date, $store)
{
    $po = PurchaseOrderQuery::create()->filterByDateCreated($date)->filterByStore($store)->find();
    if ($po->count() === 1) {
        echo $po->toJSON();
        logMessage("Return list of sync files: getSyncFiles " . date('m/d/Y h:i:s') . ".\n");
        //log something
    } else {
        echo "Zero result!";
        logMessage("Return zero result: getSyncFiles " . date('m/d/Y h:i:s') . ".\n");
        //log something
    }
}
Esempio n. 2
0
function setDone($id)
{
    //query the records having the passed id
    $filename = PurchaseOrderQuery::create()->findPK($id);
    $newFile = $filename->getFilename();
    $dirname = $filename->getStore();
    $fs = new Filesystem();
    $filePath = '../Repo/' . $dirname . '/';
    if ($fs->exists($filePath . $newFile)) {
        PurchaseOrderQuery::create()->filterByFilename($newFile)->filterByStore($dirname)->update(array('IsSync' => '1'));
        $fs->move($filePath . $newFile, '../Repo/' . 'done/' . $dirname . '/' . $newFile);
    }
}