NEW change duration membertype

This commit is contained in:
ptibogxiv 2019-11-03 12:35:05 +01:00 committed by GitHub
parent ab7c300f43
commit 871b6d9dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,18 @@ class AdherentType extends CommonObject
* @var string Adherent type nature * @var string Adherent type nature
*/ */
public $morphy; public $morphy;
public $duration;
/*
* type expiration
*/
public $duration_value;
/**
* Expiration unit
*/
public $duration_unit;
/** /**
* @var int Subsription required (0 or 1) * @var int Subsription required (0 or 1)
@ -373,8 +385,9 @@ class AdherentType extends CommonObject
$sql.= "SET "; $sql.= "SET ";
$sql.= "statut = ".$this->statut.","; $sql.= "statut = ".$this->statut.",";
$sql.= "libelle = '".$this->db->escape($this->label) ."',"; $sql.= "libelle = '".$this->db->escape($this->label) ."',";
$sql.= "morphy = '".$this->db->escape($this->morphy) ."',"; $sql.= "morphy = '".$this->db->escape($this->morphy) ."',";
$sql.= "subscription = '".$this->db->escape($this->subscription)."',"; $sql.= "subscription = '".$this->db->escape($this->subscription)."',";
$sql.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',";
$sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = ".(integer) $this->db->escape($this->vote).","; $sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
@ -476,7 +489,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -494,6 +507,9 @@ class AdherentType extends CommonObject
$this->label = $obj->label; $this->label = $obj->label;
$this->morphy = $obj->morphy; $this->morphy = $obj->morphy;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->duration = $obj->duration;
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration)-1);
$this->duration_unit = substr($obj->duration, -1);
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note;