Merge pull request #12309 from ptibogxiv/patch-274
NEW change duration membertype
This commit is contained in:
commit
bdbec58461
@ -71,6 +71,18 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public $morphy;
|
||||
|
||||
public $duration;
|
||||
|
||||
/*
|
||||
* type expiration
|
||||
*/
|
||||
public $duration_value;
|
||||
|
||||
/**
|
||||
* Expiration unit
|
||||
*/
|
||||
public $duration_unit;
|
||||
|
||||
/**
|
||||
* @var int Subsription required (0 or 1)
|
||||
* @since 5.0
|
||||
@ -373,8 +385,9 @@ class AdherentType extends CommonObject
|
||||
$sql.= "SET ";
|
||||
$sql.= "statut = ".$this->statut.",";
|
||||
$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.= "duration = '" . $this->db->escape($this->duration_value . $this->duration_unit) ."',";
|
||||
$sql.= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql.= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
@ -476,7 +489,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
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 .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@ -494,6 +507,9 @@ class AdherentType extends CommonObject
|
||||
$this->label = $obj->label;
|
||||
$this->morphy = $obj->morphy;
|
||||
$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->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note;
|
||||
|
||||
@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
|
||||
$langs->load("members");
|
||||
|
||||
@ -61,6 +62,8 @@ $label=GETPOST("label", "alpha");
|
||||
$morphy=GETPOST("morphy", "alpha");
|
||||
$statut=GETPOST("statut", "int");
|
||||
$subscription=GETPOST("subscription", "int");
|
||||
$duration_value = GETPOST('duration_value', 'int');
|
||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||
$vote=GETPOST("vote", "int");
|
||||
$comment=GETPOST("comment", 'alphanohtml');
|
||||
$mail_valid=GETPOST("mail_valid", 'none');
|
||||
@ -104,9 +107,11 @@ if ($cancel) {
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (int) $vote;
|
||||
@ -159,9 +164,11 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->statut = (int) $statut;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
@ -209,6 +216,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
||||
llxHeader('', $langs->trans("MembersTypeSetup"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||
|
||||
@ -354,6 +362,11 @@ if ($action == 'create')
|
||||
print $form->selectyesno("vote", 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$_POST["duration_value"].'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
@ -439,6 +452,18 @@ if ($rowid > 0)
|
||||
print yn($object->vote);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||
if ($object->duration_value > 1)
|
||||
{
|
||||
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||
}
|
||||
elseif ($object->duration_value > 0)
|
||||
{
|
||||
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." ";
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print nl2br($object->note)."</td></tr>";
|
||||
|
||||
@ -787,6 +812,11 @@ if ($rowid > 0)
|
||||
print $form->selectyesno("vote", $object->vote, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3">';
|
||||
print '<input name="duration_value" size="5" value="'.$object->duration_value.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user