Exemplo n.º 1
0
if (!$sortfield) {
    $sortfield = "name";
}
$object = new Account($db);
if ($id) {
    $object->fetch($id);
}
/*
 * Actions
 */
// Envoi fichier
if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
    if ($object->fetch($id)) {
        $upload_dir = $conf->bank->dir_output . "/" . $object->ref;
        if (dol_mkdir($upload_dir) >= 0) {
            $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 0, 0, $_FILES['userfile']['error']);
            if (is_numeric($resupload) && $resupload > 0) {
                if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) {
                    // Create small thumbs for image (Ratio is near 16/9)
                    // Used on logon for example
                    $imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
                    // Create mini thumbs for image (Ratio is near 16/9)
                    // Used on menu or for setup page for example
                    $imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
                }
                $mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
            } else {
                $langs->load("errors");
                if ($resupload < 0) {
                    // Unknown error
                    $mesg = '<div class="error">' . $langs->trans("ErrorFileNotUploaded") . '</div>';
Exemplo n.º 2
0
 * Actions
 */
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') {
    $bon = new BonPrelevement($db, "");
    $bon->id = $id;
    $bon->set_credite();
    Header("Location: fiche.php?id=" . $id);
    exit;
}
if ($action == 'infotrans' && $user->rights->prelevement->bons->send) {
    require_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
    $bon = new BonPrelevement($db, "");
    $bon->fetch($id);
    if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'], ".ps") == $bon->ref) {
        $dir = $conf->prelevement->dir_output . '/receipts';
        if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']), 1) > 0) {
            $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
            $bon->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
        }
        Header("Location: fiche.php?id=" . $id);
        exit;
    } else {
        dol_syslog("Fichier invalide", LOG_WARNING);
        $mesg = 'BadFile';
    }
}
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit) {
    $bon = new BonPrelevement($db, "");
    $bon->fetch($id);
    $dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
    $error = $bon->set_infocredit($user, $dt);