コード例 #1
0
/**
 * Give an array of files in the storage directories that are not in the csv record
 * 
 * @param string $type -- one of our types
 * @return array
 */
function csv_newfile_list($type)
{
    //
    //f277  f997  ack  batch  csv  ebr  era  ibr  text
    if (!strpos("|era|f997|ibr|ebr|dpr|f277|batch|ack|ta1", $type)) {
        if ($type != 'text') {
            csv_edihist_log("csv_newfile_list: incorrect type {$type}");
        }
        return FALSE;
    }
    //
    $dir_files = csv_dirfile_list($type);
    $csv_files = csv_processed_files_list($type);
    // $dir_files should come first in array_diff()
    if (empty($dir_files)) {
        // logic error -- fixed; if dir_files is empty, there are no files of that type
        //$ar_new = $csv_files;
        $ar_new = $dir_files;
    } else {
        $ar_new = array_diff($dir_files, $csv_files);
    }
    //
    return $ar_new;
}
コード例 #2
0
/**
 * Give an array of files in the storage directories that are not in the csv record
 *
 * @param string $type -- one of our types
 * @return array
 */
function csv_newfile_list($type)
{
    //
    $ar_new = array();
    $tp = csv_file_type($type);
    if (!$tp) {
        csv_edihist_log('csv_newfile_list: incorrect type ' . $type);
        return false;
    }
    //
    $dir_files = csv_dirfile_list($tp);
    $csv_files = csv_processed_files_list($tp);
    //
    // $dir_files should come first in array_diff()
    if (empty($dir_files)) {
        $ar_new = array();
    } elseif (empty($csv_files) || is_null($csv_files)) {
        $ar_new = $dir_files;
    } else {
        $ar_new = array_diff($dir_files, $csv_files);
    }
    //
    return $ar_new;
}