NEW: Table of membership types
This commit is contained in:
parent
f8af181cee
commit
e7058c253e
@ -74,6 +74,9 @@ Subscription=Contribution
|
|||||||
AnyAmountWithAdvisedAmount=Any amount with a recommended amount of %s %s
|
AnyAmountWithAdvisedAmount=Any amount with a recommended amount of %s %s
|
||||||
AnyAmountWithoutAdvisedAmount=Any amount
|
AnyAmountWithoutAdvisedAmount=Any amount
|
||||||
CanEditAmountShort=Any amount
|
CanEditAmountShort=Any amount
|
||||||
|
CanEditAmountShortForValues=recommended, any amount
|
||||||
|
MembershipDuration=Duration
|
||||||
|
GetMembershipButtonLabel=Get membership
|
||||||
Subscriptions=Contributions
|
Subscriptions=Contributions
|
||||||
SubscriptionLate=Late
|
SubscriptionLate=Late
|
||||||
SubscriptionNotReceived=Contribution never received
|
SubscriptionNotReceived=Contribution never received
|
||||||
|
|||||||
@ -202,6 +202,9 @@ CanEditAmount=Le visiteur peut modifier / choisir le montant de sa cotisation qu
|
|||||||
AmountIsLowerToMinimumNotice=sur un dû total de %s
|
AmountIsLowerToMinimumNotice=sur un dû total de %s
|
||||||
AnyAmountWithAdvisedAmount=Montant libre avec un montant recommandé de %s %s
|
AnyAmountWithAdvisedAmount=Montant libre avec un montant recommandé de %s %s
|
||||||
AnyAmountWithoutAdvisedAmount=Montant libre
|
AnyAmountWithoutAdvisedAmount=Montant libre
|
||||||
|
CanEditAmountShortForValues=conseillé, montant libre
|
||||||
|
MembershipDuration=Durée
|
||||||
|
GetMembershipButtonLabel=Adhérer
|
||||||
CanEditAmountShort=Montant libre
|
CanEditAmountShort=Montant libre
|
||||||
MEMBER_NEWFORM_PAYONLINE=Rediriger sur la page intégrée de paiement en ligne
|
MEMBER_NEWFORM_PAYONLINE=Rediriger sur la page intégrée de paiement en ligne
|
||||||
ByProperties=Par nature
|
ByProperties=Par nature
|
||||||
|
|||||||
@ -69,6 +69,7 @@ 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.'/adherents/class/adherent_type.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
|
||||||
|
|
||||||
// Init vars
|
// Init vars
|
||||||
$errmsg = '';
|
$errmsg = '';
|
||||||
@ -474,11 +475,10 @@ dol_htmloutput_errors($errmsg);
|
|||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
||||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
|
|
||||||
|
if (!empty($conf->global->MEMBER_NEWFORM_FORCETYPE) || $action == 'create') {
|
||||||
print '<input type="hidden" name="action" value="add" />';
|
print '<input type="hidden" name="action" value="add" />';
|
||||||
print '<input type="hidden" name="page_y" value="" />';
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
|
print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
|
||||||
//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
|
//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ print dol_get_fiche_end();
|
|||||||
|
|
||||||
// Save
|
// Save
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
|
print '<input type="submit" value="'.$langs->trans("GetMembershipButtonLabel").'" id="submitsave" class="button">';
|
||||||
if (!empty($backtopage)) {
|
if (!empty($backtopage)) {
|
||||||
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
|
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
|
||||||
}
|
}
|
||||||
@ -736,6 +736,92 @@ print '</div>';
|
|||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
print "<br>";
|
print "<br>";
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
}
|
||||||
|
else { // Show the table of membership types
|
||||||
|
// Get units
|
||||||
|
$measuringUnits = new CUnits($db);
|
||||||
|
$result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1));
|
||||||
|
$units = array();
|
||||||
|
foreach ($measuringUnits->records as $lines)
|
||||||
|
$units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
|
||||||
|
|
||||||
|
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy";
|
||||||
|
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||||
|
$sql .= " WHERE d.entity IN (".getEntity('member_type').")";
|
||||||
|
$sql .= " AND d.statut=1";
|
||||||
|
|
||||||
|
$result = $db->query($sql);
|
||||||
|
if ($result) {
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
print '<br><div class="div-table-responsive">';
|
||||||
|
print '<table class="tagtable liste">'."\n";
|
||||||
|
print '<input type="hidden" name="action" value="create">';
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<th>'.$langs->trans("Label").'</th>';
|
||||||
|
print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
|
||||||
|
print '<th class="center">'.$langs->trans("Amount").'</th>';
|
||||||
|
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
|
||||||
|
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||||
|
print '<th class="center">'.$langs->trans("NewSubscription").'</th>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
while ($i < $num) {
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
$unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
|
||||||
|
print max(1, intval($objp->duration)).' '.$units[$unit];
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center"><span class="amount nowrap">';
|
||||||
|
$displayedamount = max(intval($objp->amount), intval($conf->global->MEMBER_MIN_AMOUNT));
|
||||||
|
$caneditamount = !empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $objp->caneditamount;
|
||||||
|
if($objp->subscription) {
|
||||||
|
print $displayedamount.' '.strtoupper($conf->currency);
|
||||||
|
if ($caneditamount && $displayedamount>0) {
|
||||||
|
print $form->textwithpicto('', $langs->transnoentities("CanEditAmountShortForValues"), 1, 'help', '', 0, 3);
|
||||||
|
}
|
||||||
|
elseif ($caneditamount) {
|
||||||
|
print $langs->transnoentities("CanEditAmountShort");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "–"; // No subscription required
|
||||||
|
}
|
||||||
|
print '</span></td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
if ($objp->morphy == 'phy') {
|
||||||
|
print $langs->trans("Physical");
|
||||||
|
} elseif ($objp->morphy == 'mor') {
|
||||||
|
print $langs->trans("Moral");
|
||||||
|
} else {
|
||||||
|
print $langs->trans("MorAndPhy");
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||||
|
print '<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.'">'.$langs->trans("GetMembershipButtonLabel").'</button></td>';
|
||||||
|
print "</tr>";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no record found
|
||||||
|
if ($num == 0) {
|
||||||
|
$colspan = 8;
|
||||||
|
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooterVierge();
|
llxFooterVierge();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user