Fix: Option force invoice date to validation date working correctly

This commit is contained in:
Laurent Destailleur 2009-03-09 18:40:16 +00:00
parent bf7722d3ed
commit 70c1ea4ab2
3 changed files with 17 additions and 6 deletions

View File

@ -61,6 +61,7 @@ For users:
- Fix: Validation of order if a file was attached.
- Fix: A lot of fixes in PDF generators.
- Fix: Bad line/pagebreak with long description of products on PDF.
- Fix: Option force invoice date to validation date working correctly.
For translators:
- Added 10 more new language files.

View File

@ -298,7 +298,7 @@ if ($_POST['action'] == 'set_ref_client')
$facture->set_ref_client($_POST['ref_client']);
}
// Classe à "validée"
// Classify to validated
if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $user->rights->facture->valider)
{
$fac = new Facture($db);
@ -1969,7 +1969,14 @@ else
$facref = substr($fac->ref, 1, 4);
if ($facref == 'PROV')
{
$savdate=$fac->date;
if ($conf->global->FAC_FORCE_DATE_VALIDATION)
{
$fac->date=gmmktime();
$fac->date_lim_reglement=$fac->calculate_date_lim_reglement();
}
$numfa = $fac->getNextNumRef($soc);
//$fac->date=$savdate;
}
else
{

View File

@ -1267,6 +1267,12 @@ class Facture extends CommonObject
}
else if ($facref == 'PROV')
{
$savdate=$this->date;
if ($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
{
$this->date=gmmktime();
$this->date_lim_reglement=$this->calculate_date_lim_reglement();
}
$numfa = $this->getNextNumRef($this->client);
}
else
@ -1279,13 +1285,10 @@ class Facture extends CommonObject
// Validation de la facture
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= " SET facnumber='".$numfa."', fk_statut = 1, fk_user_valid = ".$user->id;
if ($conf->global->FAC_FORCE_DATE_VALIDATION)
if ($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
{
// Si l'option est activée, on force la date de facture
$this->date=time();
$datelim=$this->calculate_date_lim_reglement();
$sql.= ', datef='.$this->db->idate($this->date);
$sql.= ', date_lim_reglement='.$this->db->idate($datelim);
$sql.= ', date_lim_reglement='.$this->db->idate($this->date_lim_reglement);
}
$sql.= ' WHERE rowid = '.$this->id;