From bc00a6bdbc922ed9da1d9396f3be23ad24e3431d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Jan 2009 16:08:15 +0000 Subject: [PATCH] Can modify invoice date --- htdocs/compta/facture.php | 58 ++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 1f8118a03ca..c6ccbc75d3e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -220,14 +220,6 @@ if ($_POST['action'] == 'setmode') if ($result < 0) dolibarr_print_error($facture->db,$facture->error); } -if ($_POST['action'] == 'setconditions') -{ - $facture = new Facture($db); - $facture->fetch($_GET['facid']); - $result=$facture->cond_reglement($_POST['cond_reglement_id']); - if ($result < 0) dolibarr_print_error($facture->db,$facture->error); -} - if ($_POST['action'] == 'setpaymentterm') { $facture = new Facture($db); @@ -237,6 +229,23 @@ if ($_POST['action'] == 'setpaymentterm') if ($result < 0) dolibarr_print_error($facture->db,$facture->error); } +if ($_POST['action'] == 'setinvoicedate') +{ + $facture = new Facture($db); + $facture->fetch($_GET['facid']); + $facture->date=dolibarr_mktime(12,0,0,$_POST['invoicedatemonth'],$_POST['invoicedateday'],$_POST['invoicedateyear']); + $result=$facture->update($user); + if ($result < 0) dolibarr_print_error($facture->db,$facture->error); +} + +if ($_POST['action'] == 'setconditions') +{ + $facture = new Facture($db); + $facture->fetch($_GET['facid']); + $result=$facture->cond_reglement($_POST['cond_reglement_id']); + if ($result < 0) dolibarr_print_error($facture->db,$facture->error); +} + if ($_REQUEST['action'] == 'setremisepercent' && $user->rights->facture->creer) { $fac = new Facture($db); @@ -2199,10 +2208,33 @@ else if (! $absolute_discount && ! $absolute_creditnote) print $langs->trans("CompanyHasNoAbsoluteDiscount").'.'; print ''; - // Dates - print ''.$langs->trans('Date').''; - print ''.dolibarr_print_date($fac->date,'daytext').''; - + // Date invoice + print ''; + print ''; + if ($fac->type != 2 && $_GET['action'] != 'editinvoicedate' && $fac->brouillon && $user->rights->facture->creer) print ''; + print '
'; + print $langs->trans('Date'); + print 'id.'">'.img_edit($langs->trans('SetDate'),1).'
'; + print ''; + if ($fac->type != 2) + { + if ($_GET['action'] == 'editinvoicedate') + { + $html->form_date($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->date,'invoicedate'); + } + else + { + print dolibarr_print_date($fac->date,'daytext'); + } + } + else + { + print ' '; + } + print ''; + + + // Payments $nbrows=8; if ($conf->global->FAC_USE_CUSTOMER_ORDER_REF) $nbrows++; if ($conf->projet->enabled) $nbrows++; @@ -2347,7 +2379,7 @@ else print ''; - // Date limite reglement + // Date payment term print ''; print '
'; print $langs->trans('DateMaxPayment');