From 44b80fdc441f63a4e2829e79ecd152c1a2b8ecce Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 3 Nov 2019 12:35:52 +0100 Subject: [PATCH] Update type.php --- htdocs/adherents/type.php | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 94978e7f8a9..139f4b1fb73 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -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'); @@ -353,6 +361,11 @@ if ($action == 'create') print ''.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", 0, 1); print ''; + + print ''.$langs->trans("Duration").''; + print ' '; + print $formproduct->selectMeasuringUnits("duration_unit", "time", $_POST["duration_unit"], 0, 1); + print ''; print ''.$langs->trans("Description").''; print ''; @@ -438,6 +451,18 @@ if ($rowid > 0) print ''.$langs->trans("VoteAllowed").''; print yn($object->vote); print ''; + + print ''.$langs->trans("Duration").''.$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 ''; print ''.$langs->trans("Description").''; print nl2br($object->note).""; @@ -786,6 +811,11 @@ if ($rowid > 0) print ''.$langs->trans("VoteAllowed").''; print $form->selectyesno("vote", $object->vote, 1); print ''; + + print ''.$langs->trans("Duration").''; + print ' '; + print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); + print ''; print ''.$langs->trans("Description").''; print '';