Fix: Use default proposal delay when cloning.

This commit is contained in:
Laurent Destailleur 2010-11-16 21:05:52 +00:00
parent 286369145c
commit 77bb9b945c

View File

@ -120,7 +120,7 @@ class Propal extends CommonObject
*/ */
function Propal($DB, $socid="", $propalid=0) function Propal($DB, $socid="", $propalid=0)
{ {
global $langs; global $conf,$langs;
$this->db = $DB ; $this->db = $DB ;
$this->socid = $socid; $this->socid = $socid;
@ -130,6 +130,8 @@ class Propal extends CommonObject
$this->remise_percent = 0; $this->remise_percent = 0;
$this->remise_absolue = 0; $this->remise_absolue = 0;
$this->duree_validite=$conf->global->PROPALE_VALIDITY_DURATION;
$langs->load("propal"); $langs->load("propal");
$this->labelstatut[0]=$langs->trans("PropalStatusDraft"); $this->labelstatut[0]=$langs->trans("PropalStatusDraft");
$this->labelstatut[1]=$langs->trans("PropalStatusValidated"); $this->labelstatut[1]=$langs->trans("PropalStatusValidated");
@ -566,6 +568,8 @@ class Propal extends CommonObject
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
$error=0; $error=0;
$now=dol_now('gmt');
// Clean parameters // Clean parameters
$this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600); $this->fin_validite = $this->datep + ($this->duree_validite * 24 * 3600);
@ -622,7 +626,7 @@ class Propal extends CommonObject
$sql.= ", 0"; $sql.= ", 0";
$sql.= ", 0"; $sql.= ", 0";
$sql.= ", '".$this->db->idate($this->datep)."'"; $sql.= ", '".$this->db->idate($this->datep)."'";
$sql.= ", '".$this->db->idate(mktime())."'"; $sql.= ", '".$this->db->idate($now)."'";
$sql.= ", '(PROV)'"; $sql.= ", '(PROV)'";
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
$sql.= ", '".addslashes($this->note)."'"; $sql.= ", '".addslashes($this->note)."'";
@ -790,6 +794,8 @@ class Propal extends CommonObject
$error=0; $error=0;
$now=dol_now('gmt');
$object=new Propal($this->db); $object=new Propal($this->db);
// Instantiate hooks of thirdparty module // Instantiate hooks of thirdparty module
@ -821,8 +827,8 @@ class Propal extends CommonObject
$object->user_author = $user->id; $object->user_author = $user->id;
$object->user_valid = ''; $object->user_valid = '';
$object->date = ''; $object->date = '';
$object->datep = dol_now('gmt'); $object->datep = $now;
$object->fin_validite = ''; $object->fin_validite = $object->datep + ($this->duree_validite * 24 * 3600);
$object->ref_client = ''; $object->ref_client = '';
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".$conf->global->PROPALE_ADDON.".php");