示例#1
0
if ($action == 'setnote' && $user->rights->fournisseur->facture->creer) {
    $db->begin();
    $object->fetch($id);
    $result = $object->update_note(GETPOST('note'));
    if ($result > 0) {
        $db->commit();
        $action = '';
    } else {
        $mesg = '<div class="error">' . $object->error . '</div>';
        $db->rollback();
    }
}
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer) {
    $db->begin();
    $object->fetch($id);
    $result = $object->delete();
    if ($result > 0) {
        $db->commit();
        header('Location: ' . DOL_URL_ROOT . '/fourn/facture/paiement.php');
        exit;
    } else {
        $mesg = '<div class="error">' . $object->error . '</div>';
        $db->rollback();
    }
}
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->fournisseur->facture->valider) {
    $db->begin();
    $object->fetch($id);
    if ($object->valide() >= 0) {
        $db->commit();
        header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id);
示例#2
0
$langs->load("suppliers");

$mesg='';


/*
 * Actions
 */

if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->facture->supprimer)
{
	$db->begin();

	$paiement = new PaiementFourn($db);
	$paiement->fetch($_GET['id']);
	$result = $paiement->delete();
	if ($result > 0)
	{
		$db->commit();
		Header('Location: '.DOL_URL_ROOT.'/fourn/facture/paiement.php');
		exit;
	}
	else
	{
		$mesg='<div class="error">'.$paiement->error.'</div>';
		$db->rollback();
	}
}

if ($_POST['action'] == 'confirm_valide' && $_POST['confirm'] == 'yes' && $user->rights->fournisseur->facture->valider)
{
示例#3
0
     $object->date_echeance = dol_mktime(12, 0, 0, $_POST['date_lim_reglementmonth'], $_POST['date_lim_reglementday'], $_POST['date_lim_reglementyear']);
     if (!empty($object->date_echeance) && $object->date_echeance < $object->date) {
         $object->date_echeance = $object->date;
         setEventMessages($langs->trans("DatePaymentTermCantBeLowerThanObjectDate"), null, 'warnings');
     }
     $result = $object->update($user);
     if ($result < 0) {
         dol_print_error($db, $object->error);
     }
 } elseif ($action == 'deletepaiement' && $user->rights->fournisseur->facture->creer) {
     $object->fetch($id);
     if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0) {
         $paiementfourn = new PaiementFourn($db);
         $result = $paiementfourn->fetch(GETPOST('paiement_id'));
         if ($result > 0) {
             $result = $paiementfourn->delete();
         }
         // If fetch ok and found
         if ($result < 0) {
             setEventMessages($paiementfourn->error, $paiementfourn->errors, 'errors');
         }
     }
 } elseif ($action == 'add' && $user->rights->fournisseur->facture->creer) {
     $error = 0;
     $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
     $datedue = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);
     if (GETPOST('socid', 'int') < 1) {
         setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Supplier')), null, 'errors');
         $action = 'create';
         $error++;
     }
示例#4
0
    $facturefourn->fetch($facid);
    $facturefourn->label=$_POST['label'];
    $result=$facturefourn->update($user);
    if ($result < 0) dol_print_error($db);
    $_GET['facid']=$facid;
}

if($_GET['action'] == 'deletepaiement')
{
    $facfou = new FactureFournisseur($db);
    $facfou->fetch($_GET['facid']);
    if ($facfou->statut == 1 && $facfou->paye == 0 && $user->societe_id == 0)
    {
        $paiementfourn = new PaiementFourn($db);
        $paiementfourn->fetch($_GET['paiement_id']);
        $paiementfourn->delete();
    }
}

if ($_POST['action'] == 'update' && ! $_POST['cancel'])
{
    $error=0;

    $date = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
    $date_echeance = dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']);

    if (! $date)
    {
        $msg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("DateEch"));
        $error++;
    }