Fix regression amount was always empty.
This commit is contained in:
parent
531dee31fd
commit
5a5fa1edbb
@ -762,6 +762,8 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$head = '';
|
||||
if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) {
|
||||
$head = '<link rel="stylesheet" type="text/css" href="'.$conf->global->ONLINE_PAYMENT_CSS_URL.'?lang='.$langs->defaultlang.'">'."\n";
|
||||
@ -1483,32 +1485,42 @@ if ($source == 'member' || $source == 'membersubscription') {
|
||||
}
|
||||
|
||||
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";
|
||||
$oldtypeid = $member->typeid;
|
||||
$newtypeid = (int) (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $member->typeid);
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$adht = new AdherentType($db);
|
||||
// Amount by member type
|
||||
$amountbytype = $adht->amountByType(1);
|
||||
// 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 = (!empty($amountbytype[$member->typeid])) ? $amountbytype[$member->typeid] : $member->last_subscription_amount;
|
||||
// list member type
|
||||
if ( !$action) {
|
||||
$form = new Form($db); // so we can 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='.urlencode($source).'&ref='.urlencode($ref).'&amount='.urlencode($amount).'&typeid=\' + this.value + \'&securekey='.urlencode($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");
|
||||
if ($oldtypeid != $newtypeid && !empty($conf->global->MEMBER_ALLOW_CHANGE_OF_TYPE)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$adht = new AdherentType($db);
|
||||
// Amount by member type
|
||||
$amountbytype = $adht->amountByType(1);
|
||||
|
||||
// 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";
|
||||
|
||||
// Set the new member type
|
||||
$member->typeid = $newtypeid;
|
||||
$member->type = dol_getIdFromCode($db, $newtypeid, 'adherent_type', 'rowid', 'libelle');
|
||||
|
||||
// list member type
|
||||
if (!$action) {
|
||||
// Set amount for the subscription
|
||||
$amount = (!empty($amountbytype[$member->typeid])) ? $amountbytype[$member->typeid] : $member->last_subscription_amount;
|
||||
|
||||
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='.urlencode($source).'&ref='.urlencode($ref).'&amount='.urlencode($amount).'&typeid=\' + this.value + \'&securekey='.urlencode($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";
|
||||
}
|
||||
} else {
|
||||
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("MemberType");
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ class Stripe extends CommonObject
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::PaymentIntent failed to insert paymentintent with id=".$paymentintent->id." into database.");
|
||||
dol_syslog(get_class($this)."::PaymentIntent failed to insert paymentintent with id=".$paymentintent->id." into database.", LOG_ERR);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user