Ejemplo n.º 1
0
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
	require_once(DOL_DOCUMENT_ROOT."/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 . "/" . $_FILES['userfile']['name'],1) > 0)
		{
			$dt = dol_mktime(12,0,0,GETPOST("remonth"),GETPOST("reday"),GETPOST("reyear"));

			$bon->set_infotrans($user, $dt, GETPOST("methode"));
		}

		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,"");
Ejemplo n.º 2
0
    		$dir = $conf->prelevement->dir_output.'/receipts';
    
    		if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
    		{
    			$bon->set_infotrans($user, $dt, GETPOST('methode','alpha'));
    		}
    
    		header("Location: card.php?id=".$id);
            exit;
    	}
    	else
    	{
    		dol_syslog("Fichier invalide",LOG_WARNING);
    		$mesg='BadFile';
    	}*/
    $error = $bon->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
    if ($error) {
        header("Location: card.php?id=" . $id . "&error={$error}");
        exit;
    }
}
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);
    if ($error) {
        header("Location: card.php?id=" . $id . "&error={$error}");
        exit;
    }
}