payment page structure ok, still need to confirm the attendee after the payment

This commit is contained in:
Dorian Vabre 2021-04-15 10:45:44 +02:00
parent caf74fe1cb
commit dd7c09582f
4 changed files with 193 additions and 65 deletions

View File

@ -282,19 +282,10 @@ if ($action == 'edit') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>'; print '<td>';
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); $selected = (empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) ? '' : $conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS);
$form->select_produits($selected, $constname, '', 0); $form->select_produits($selected, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', '', 0);
print '</td>';
print "</tr>\n";
}
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
print '<tr class="oddeven"><td>'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'</td>';
print '<td>';
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
print '</td>'; print '</td>';
} }
print "</tr>\n";
} else { } else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">'; print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
} }

View File

@ -105,3 +105,7 @@ EvntOrgEndDuration = and ends on
# SubscriptionOk page # SubscriptionOk page
# #
SubscriptionOk = Your subscription to this conference has been validated SubscriptionOk = Your subscription to this conference has been validated
#
# Payment page
#
PaymentConferenceAttendee = Paiement de participation à une conférence

View File

@ -95,6 +95,7 @@ if ($resultproject < 0){
$error++; $error++;
$errmsg .= $project->error; $errmsg .= $project->error;
} }
var_dump($conference->fk_project);
// Getting 'securekey'.'id' from Post and decoding it // Getting 'securekey'.'id' from Post and decoding it
$encodedsecurekeyandid = GETPOST('securekey', 'alpha'); $encodedsecurekeyandid = GETPOST('securekey', 'alpha');
@ -307,11 +308,10 @@ if (empty($reshook) && $action == 'add') {
$error++; $error++;
$errmsg .= $facture->error; $errmsg .= $facture->error;
} else { } else {
$redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source=conferencesubscription&ref='.$confattendee->id;
Header("Location: ".$redirection); Header("Location: ".$redirection);
exit; exit;
} }
} else { } else {
// No price has been set // No price has been set
// Validating the subscription // Validating the subscription

View File

@ -61,6 +61,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Hook to be used by external payment modules (ie Payzen, ...) // Hook to be used by external payment modules (ie Payzen, ...)
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager = new HookManager($db); $hookmanager = new HookManager($db);
@ -1724,6 +1727,136 @@ if ($source == 'donation') {
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n"; print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
} }
if ($source == 'conferencesubscription') {
// @todo cas paiement de conferenceattendee
$found = true;
$langs->load("members");
// Finding the Attendee
$attendee = new ConferenceOrBoothAttendee($db);
$result = $attendee->fetch('', $ref);
if ($result <= 0) {
$mesg = $attendee->error;
$error++;
}
$object = $attendee;
// Finding the thirdparty associated to the Attendee
$thirdparty = new Societe($db);
$resultthirdparty = $thirdparty->fetch($attendee->fk_soc);
if ($resultthirdparty <= 0) {
$mesg = $thirdparty->error;
$error++;
}
// Finding the conference
$conference = new ConferenceOrBooth($db);
$resultconf = $conference->fetch($attendee->fk_actioncomm);
if ($resultconf <= 0) {
$mesg = $conference->error;
$error++;
}
// Finding the project
$project = new Project($db);
$resultproj = $project->fetch($conference->fk_project);
if ($resultproj <= 0) {
$mesg = $project->error;
$error++;
}
if ($action != 'dopayment') { // Do not change amount if we just click on first dopayment
$amount = $project->price_registration;
if (GETPOST("amount", 'alpha')) {
$amount = GETPOST("amount", 'alpha');
}
$amount = price2num($amount, 'MT');
}
if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S');
if (!empty($TAG)) {
$tag = $TAG; $fulltag .= '.TAG='.$TAG;
}
}
$fulltag = dol_string_unaccent($fulltag);
// Creditor
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor");
print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>'.$creditor.'</b>';
print '<input type="hidden" name="creditor" value="'.$creditor.'">';
print '</td></tr>'."\n";
// Debitor
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Member");
print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b>';
print $thirdparty->name;
print '</b>';
print '</td></tr>'."\n";
// Object
$text = '<b>'.$langs->trans("PaymentConferenceAttendee").'</b>';
if (GETPOST('desc', 'alpha')) {
$text = '<b>'.$langs->trans(GETPOST('desc', 'alpha')).'</b>';
}
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Designation");
print '</td><td class="CTableRow'.($var ? '1' : '2').'">'.$text;
print '<input type="hidden" name="source" value="'.dol_escape_htmltag($source).'">';
print '<input type="hidden" name="ref" value="'.dol_escape_htmltag($member->ref).'">';
print '</td></tr>'."\n";
// Amount
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Amount");
print '</td><td class="CTableRow'.($var ? '1' : '2').'">';
$valtoshow = $project->price_registration;
print '<b>'.price($valtoshow).'</b>';
print '<input type="hidden" name="amount" value="'.$valtoshow.'">';
print '<input type="hidden" name="newamount" value="'.$valtoshow.'">';
// Currency
print ' <b>'.$langs->trans("Currency".$currency).'</b>';
print '<input type="hidden" name="currency" value="'.$currency.'">';
print '</td></tr>'."\n";
// Tag
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("PaymentCode");
print '</td><td class="CTableRow'.($var ? '1' : '2').'"><b style="word-break: break-all;">'.$fulltag.'</b>';
print '<input type="hidden" name="tag" value="'.$tag.'">';
print '<input type="hidden" name="fulltag" value="'.$fulltag.'">';
print '</td></tr>'."\n";
// Shipping address
$shipToName = $thirdparty->getFullName($langs);
$shipToStreet = $thirdparty->address;
$shipToCity = $thirdparty->town;
$shipToState = $thirdparty->state_code;
$shipToCountryCode = $thirdparty->country_code;
$shipToZip = $thirdparty->zip;
$shipToStreet2 = '';
$phoneNum = $thirdparty->phone;
if ($shipToName && $shipToStreet && $shipToCity && $shipToCountryCode && $shipToZip) {
print '<!-- Shipping address information -->';
print '<input type="hidden" name="shipToName" value="'.$shipToName.'">'."\n";
print '<input type="hidden" name="shipToStreet" value="'.$shipToStreet.'">'."\n";
print '<input type="hidden" name="shipToCity" value="'.$shipToCity.'">'."\n";
print '<input type="hidden" name="shipToState" value="'.$shipToState.'">'."\n";
print '<input type="hidden" name="shipToCountryCode" value="'.$shipToCountryCode.'">'."\n";
print '<input type="hidden" name="shipToZip" value="'.$shipToZip.'">'."\n";
print '<input type="hidden" name="shipToStreet2" value="'.$shipToStreet2.'">'."\n";
print '<input type="hidden" name="phoneNum" value="'.$phoneNum.'">'."\n";
} else {
print '<!-- Shipping address not complete, so we don t use it -->'."\n";
}
print '<input type="hidden" name="thirdparty_id" value="'.$thirdparty->id.'">'."\n";
print '<input type="hidden" name="email" value="'.$thirdparty->email.'">'."\n";
$labeldesc = $langs->trans("PaymentSubscription");
if (GETPOST('desc', 'alpha')) {
$labeldesc = GETPOST('desc', 'alpha');
}
print '<input type="hidden" name="desc" value="'.dol_escape_htmltag($labeldesc).'">'."\n";
}
if (!$found && !$mesg) { if (!$found && !$mesg) {
$mesg = $langs->trans("ErrorBadParameters"); $mesg = $langs->trans("ErrorBadParameters");