Merge branch 'daraelmin-amountbymebertype' of https://github.com/daraelmin/dolibarr into daraelmin-amountbymebertype
This commit is contained in:
commit
8de7db9afb
@ -224,10 +224,10 @@ print "</td></tr>\n";
|
||||
$adht = new AdherentType($db);
|
||||
$amountbytype = empty($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE) ? -1 : json_decode($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE, true);
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefineAmountMemberType").'</td><td>';
|
||||
foreach ($adht->liste_array(1) as $typeid => $type){
|
||||
print $type .' : ';
|
||||
print '<input type="text" id="MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE['.$typeid.']" name="MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE['.$typeid.']" " size="5" value="'.(!empty($amountbytype[$typeid]) ? $amountbytype[$typeid] : '').'">';
|
||||
print '<br />';
|
||||
foreach ($adht->liste_array(1) as $typeid => $type) {
|
||||
print $type .' : ';
|
||||
print '<input type="text" id="MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE['.$typeid.']" name="MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE['.$typeid.']" " size="5" value="'.(!empty($amountbytype[$typeid]) ? $amountbytype[$typeid] : '').'">';
|
||||
print '<br />';
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
@ -1494,7 +1494,7 @@ class Adherent extends CommonObject
|
||||
*
|
||||
* @return int rowid of record added, <0 if KO
|
||||
*/
|
||||
public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0, $fk_type = NULL)
|
||||
public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0, $fk_type = null)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
|
||||
@ -1437,38 +1437,38 @@ if ($source == 'membersubscription') {
|
||||
$_GET['newamount'] = $member->last_subscription_amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($member->type) {
|
||||
// Last member type
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastMemberType");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_escape_htmltag($member->type);
|
||||
print "</td></tr>"."\n";
|
||||
// Last member type
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("LastMemberType");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_escape_htmltag($member->type);
|
||||
print "</td></tr>"."\n";
|
||||
}
|
||||
|
||||
|
||||
if (!empty($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE)) {
|
||||
// Amount by member type
|
||||
$amountbytype = json_decode($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE, true);
|
||||
// Set the member type
|
||||
$member->typeid = (int)(GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid);
|
||||
// If we change the type of membership, we set also label of new type
|
||||
$member->type = dol_getIdFromCode($db, $member->typeid, 'adherent_type', 'rowid', 'libelle');
|
||||
// Set amount for the subscription
|
||||
$amount = $amountbytype[$member->typeid] ? $amountbytype[$member->typeid] : $member->last_subscription_amount;
|
||||
// list member type
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$adht = new AdherentType($db);
|
||||
if( !$action){
|
||||
$form = new Form($db); // so wecan call method selectarray
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("NewSubscription");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
|
||||
print $form->selectarray("typeid", $adht->liste_array(1) , $member->typeid, 0, 0, 0, 'onchange="window.location.replace(\''.$urlwithroot.'/public/payment/newpayment.php?source='.$source.'&ref='.$ref.'&amount='.$amount.'&typeid=\' + this.value + \'&securekey='.$SECUREKEY.'\');"', 0, 0, 0, '', '', 1);
|
||||
print "</td></tr>"."\n";
|
||||
} elseif ($action == dopayment) {
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("NewMemberType");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_escape_htmltag($member->type);
|
||||
print '<input type="hidden" name="membertypeid" value="'.$member->typeid.'">';
|
||||
print "</td></tr>"."\n";
|
||||
}
|
||||
// Amount by member type
|
||||
$amountbytype = json_decode($conf->global->MEMBER_SUBSCRIPTION_AMOUNT_BY_TYPE, true);
|
||||
// Set the member type
|
||||
$member->typeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid);
|
||||
// If we change the type of membership, we set also label of new type
|
||||
$member->type = dol_getIdFromCode($db, $member->typeid, 'adherent_type', 'rowid', 'libelle');
|
||||
// Set amount for the subscription
|
||||
$amount = $amountbytype[$member->typeid] ? $amountbytype[$member->typeid] : $member->last_subscription_amount;
|
||||
// list member type
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$adht = new AdherentType($db);
|
||||
if ( !$action) {
|
||||
$form = new Form($db); // so wecan call method selectarray
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("NewSubscription");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
|
||||
print $form->selectarray("typeid", $adht->liste_array(1), $member->typeid, 0, 0, 0, 'onchange="window.location.replace(\''.$urlwithroot.'/public/payment/newpayment.php?source='.$source.'&ref='.$ref.'&amount='.$amount.'&typeid=\' + this.value + \'&securekey='.$SECUREKEY.'\');"', 0, 0, 0, '', '', 1);
|
||||
print "</td></tr>"."\n";
|
||||
} elseif ($action == dopayment) {
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("NewMemberType");
|
||||
print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.dol_escape_htmltag($member->type);
|
||||
print '<input type="hidden" name="membertypeid" value="'.$member->typeid.'">';
|
||||
print "</td></tr>"."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Amount
|
||||
|
||||
@ -340,7 +340,7 @@ if ($ispaymentok) {
|
||||
$user->rights->facture = new stdClass();
|
||||
}
|
||||
if (empty($user->rights->adherent)) {
|
||||
$user->rights->adherent = new stdClass();
|
||||
$user->rights->adherent = new stdClass();
|
||||
$user->rights->adherent->cotisation = new stdClass();
|
||||
}
|
||||
$user->rights->societe->creer = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user