/**
 * $Id:$
 *
 * @package    Mediboard
 * @subpackage dPfacturation
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision:$
 */
CCanDo::checkEdit();
$date_min = CValue::getOrSession("_date_min", CMbDT::date());
$date_max = CValue::getOrSession("_date_max", CMbDT::date());
$type_journal = CValue::get("type_journal");
$date_min = CMbDT::dateTime($date_min);
$date_max = CMbDT::dateTime(CMbDT::date("+1 day", $date_max));
$ljoin = array();
$ljoin["facture_journal"] = "facture_journal.journal_id = files_mediboard.object_id";
$where = array();
$where["object_class"] = " = 'CJournalBill'";
$where["file_date"] = "BETWEEN '{$date_min}' AND '{$date_max}'";
$where["facture_journal.type"] = "= '{$type_journal}'";
$file = new CFile();
$files = $file->loadList($where, null, null, null, $ljoin);
foreach ($files as $_file) {
    $_file->canDo();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("files", $files);
$smarty->assign("name_readonly", 1);
$smarty->display("vw_files_journaux.tpl");
Example #2
0
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
$nb_files = round(CValue::get("nb_files", 0));
$date_debut = CValue::get("date_debut");
$date_fin = CValue::get("date_fin");
$purge = CValue::get("purge", 0);
$step_from = CValue::get("step_from", 0);
$file = new CFile();
if ($date_debut && $date_fin) {
    $where = array();
    $where["file_date"] = "BETWEEN '" . CMbDT::dateTime($date_debut) . "' AND '" . CMbDT::dateTime($date_fin) . "'";
    $files = $file->loadList($where, null, "{$step_from}, 100");
    $count = 0;
    foreach ($files as $_file) {
        if (!file_exists($_file->_file_path) || filesize($_file->_file_path) == 0 || file_get_contents($_file->_file_path) == "") {
            if (!$purge) {
                CAppUI::stepAjax($_file->_id);
                $count++;
                continue;
            }
            if ($msg = $_file->purge()) {
                CAppUI::stepAjax("File id: " . $_file->_id . " - " . $_file->purge());
            } else {
                $count++;
            }
        }
    }
Example #3
0
CCanDo::checkEdit();
$do = CValue::get("do", "0");
// Auto send categories
$category = new CFilesCategory();
$category->send_auto = "1";
foreach ($categories = $category->loadMatchingList() as $_category) {
    $_category->countDocItems();
    $_category->countUnsentDocItems();
}
// Unsent docItems
$max_load = CAppUI::conf("dPfiles CDocumentSender auto_max_load");
$where["file_category_id"] = CSQLDataSource::prepareIn(array_keys($categories));
$where["etat_envoi"] = "!= 'oui'";
$where["object_id"] = "IS NOT NULL";
$file = new CFile();
$items["CFile"] = $file->loadList($where, "file_id DESC", $max_load);
$count["CFile"] = $file->countList($where);
$document = new CCompteRendu();
$items["CCompteRendu"] = $document->loadList($where, "compte_rendu_id DESC", $max_load);
$count["CCompteRendu"] = $document->countList($where);
// Sending
$max_send = CAppUI::conf("dPfiles CDocumentSender auto_max_send");
foreach ($items as $_items) {
    $sent = 0;
    /** @var CDocumentItem[] $_items */
    foreach ($_items as $_item) {
        $_item->loadTargetObject();
        if ($do && !$_item->_send_problem) {
            // Max sent
            if (++$sent > $max_send) {
                break;
Example #4
0
$extensions = CValue::get("extensions", CFile::$file_types);
$file = new CFile();
$where = array();
$where["object_class"] = " NOT LIKE 'CFile'";
// Ne convertir que les fichiers dont le nom se finit par une extension convertible
$like = "";
$types = preg_split("/[\\s]+/", $extensions);
foreach ($types as $key => $_type) {
    $like .= " file_name LIKE '%.{$_type}'";
    if ($key != count($types) - 1) {
        $like .= " OR";
    }
}
$where[] = $like;
$where[] = "file_id NOT IN (SELECT object_id from files_mediboard WHERE object_class LIKE 'CFile')";
$order = "file_id DESC";
$files = $file->loadList($where, $order, $nb_files);
$nb_files_total = $file->countList($where);
$converted = 0;
$not_converted = "";
foreach ($files as $_file) {
    if ($_file->convertToPDF()) {
        $converted++;
    } else {
        $not_converted .= $_file->_id . " - ";
    }
}
CAppUI::stepAjax("{$converted}/" . count($files) . " fichiers convertis parmi {$nb_files_total}");
if ($converted != count($files)) {
    trigger_error("Les fichiers suivants n'ont pas été convertis : {$not_converted}", E_USER_ERROR);
}