Merge branch 'dev_EventOrganizer_payment' of github.com:DorianVabre/dolibarr into dev_EventOrganizer_suggest
This commit is contained in:
commit
8fc45da56e
@ -244,7 +244,7 @@ class ConferenceOrBooth extends ActionComm
|
|||||||
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||||
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
|
$link_subscription = $dolibarr_main_url_root.'/public/eventorganization/attendee_subscription.php?id='.$encodedid;
|
||||||
|
|
||||||
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
|
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
|
||||||
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
$link_subscription .= '&securekey='.urlencode($encodedsecurekey);
|
||||||
|
|
||||||
$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
|
$this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1);
|
||||||
|
|||||||
@ -366,7 +366,7 @@ if ($projectid > 0) {
|
|||||||
print '<tr><td>'.$langs->trans("RegisterPage").'</td><td>';
|
print '<tr><td>'.$langs->trans("RegisterPage").'</td><td>';
|
||||||
$encodedid = dol_encode($project->id, $dolibarr_main_instance_unique_id);
|
$encodedid = dol_encode($project->id, $dolibarr_main_instance_unique_id);
|
||||||
$linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$encodedid;
|
$linkregister = $dolibarr_main_url_root.'/public/project/index.php?id='.$encodedid;
|
||||||
$encodedsecurekey = dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY.$encodedid, $dolibarr_main_instance_unique_id);
|
$encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 2);
|
||||||
$linkregister .= '&securekey='.urlencode($encodedsecurekey);
|
$linkregister .= '&securekey='.urlencode($encodedsecurekey);
|
||||||
print '<a target="_blank" href="'.$linkregister.'">'.$linkregister.'</a>';
|
print '<a target="_blank" href="'.$linkregister.'">'.$linkregister.'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -104,9 +104,9 @@ SuggestBooth = Suggest a booth
|
|||||||
ViewAndVote = View and vote for suggested events
|
ViewAndVote = View and vote for suggested events
|
||||||
PublicAttendeeSubscriptionPage = Public link of registration to a conference
|
PublicAttendeeSubscriptionPage = Public link of registration to a conference
|
||||||
MissingOrBadSecureKey = The security key is invalid or missing
|
MissingOrBadSecureKey = The security key is invalid or missing
|
||||||
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference
|
EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference : '%s'
|
||||||
EvntOrgDuration = This conference starts on %s and ends on %s
|
EvntOrgDuration = This conference starts on %s and ends on %s.
|
||||||
ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s
|
ConferenceAttendeeFee = Conference attendee fee for the event : '%s' occurring from %s to %s.
|
||||||
BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s
|
BoothLocationFee = Booth location for the event : '%s' occurring from %s to %s
|
||||||
#
|
#
|
||||||
# SubscriptionOk page
|
# SubscriptionOk page
|
||||||
|
|||||||
@ -101,16 +101,13 @@ if ($resultproject < 0) {
|
|||||||
$errmsg .= $project->error;
|
$errmsg .= $project->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getting 'securekey'.'id' from Post and decoding it
|
|
||||||
$encodedsecurekeyandid = GETPOST('securekey', 'alpha');
|
|
||||||
$securekeyandid = dol_decode($encodedsecurekeyandid, $dolibarr_main_instance_unique_id);
|
|
||||||
|
|
||||||
// Securekey decomposition into pure securekey and id added at the end
|
// Security check
|
||||||
$securekey = substr($securekeyandid, 0, strlen($securekeyandid)-strlen($encodedid));
|
$securekeyreceived = GETPOST('securekey', 'alpha');
|
||||||
$idgotfromsecurekey = dol_decode(substr($securekeyandid, -strlen($encodedid), strlen($encodedid)), $dolibarr_main_instance_unique_id);
|
$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
|
||||||
|
|
||||||
// We check if the securekey collected is OK and if the id collected is the same than the id in the securekey
|
// We check if the securekey collected is OK
|
||||||
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY || $idgotfromsecurekey != $id) {
|
if ($securekeytocompare != $securekeyreceived) {
|
||||||
print $langs->trans('MissingOrBadSecureKey');
|
print $langs->trans('MissingOrBadSecureKey');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -251,7 +248,9 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
|
|
||||||
// If the attendee has already paid
|
// If the attendee has already paid
|
||||||
if ($confattendee->status == 1) {
|
if ($confattendee->status == 1) {
|
||||||
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id);
|
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||||
|
$securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
|
||||||
|
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl;
|
||||||
Header("Location: ".$redirection);
|
Header("Location: ".$redirection);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -342,7 +341,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$facture->paye = 0;
|
$facture->paye = 0;
|
||||||
$facture->date = dol_now();
|
$facture->date = dol_now();
|
||||||
$facture->cond_reglement_id = $confattendee->cond_reglement_id;
|
$facture->cond_reglement_id = $confattendee->cond_reglement_id;
|
||||||
|
$facture->fk_project = $project->id;
|
||||||
if (empty($facture->cond_reglement_id)) {
|
if (empty($facture->cond_reglement_id)) {
|
||||||
$paymenttermstatic = new PaymentTerm($confattendee->db);
|
$paymenttermstatic = new PaymentTerm($confattendee->db);
|
||||||
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
|
$facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
|
||||||
@ -435,7 +434,9 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?securekey='.dol_encode($conf->global->EVENTORGANIZATION_SECUREKEY, $dolibarr_main_instance_unique_id);
|
$encodedid = dol_encode($id, $dolibarr_main_instance_unique_id);
|
||||||
|
$securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
|
||||||
|
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$encodedid.'&securekey='.$securekeyurl;
|
||||||
Header("Location: ".$redirection);
|
Header("Location: ".$redirection);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -465,8 +466,8 @@ print '<div id="divsubscribe">';
|
|||||||
print '<div class="center subscriptionformhelptext justify">';
|
print '<div class="center subscriptionformhelptext justify">';
|
||||||
|
|
||||||
// Welcome message
|
// Welcome message
|
||||||
print $langs->trans("EvntOrgWelcomeMessage");
|
print $langs->trans("EvntOrgWelcomeMessage", $conference->label);
|
||||||
print $id.".".'<br>';
|
print '<br>';
|
||||||
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
|
print $langs->trans("EvntOrgDuration", dol_print_date($conference->datep), dol_print_date($conference->datef));
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -478,7 +479,7 @@ print '<input type="hidden" name="token" value="'.newToken().'" / >';
|
|||||||
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
print '<input type="hidden" name="action" value="add" />';
|
print '<input type="hidden" name="action" value="add" />';
|
||||||
print '<input type="hidden" name="id" value="'.$encodedid.'" />';
|
print '<input type="hidden" name="id" value="'.$encodedid.'" />';
|
||||||
print '<input type="hidden" name="securekey" value="'.$encodedsecurekeyandid.'" />';
|
print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|||||||
@ -65,8 +65,12 @@ $object = new stdClass(); // For triggers
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$securekey = dol_decode(GETPOST('securekey'), $dolibarr_main_instance_unique_id);
|
$encodedid = GETPOST("id");
|
||||||
if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY) {
|
$id = dol_decode($encodedid, $dolibarr_main_instance_unique_id);
|
||||||
|
$securekeyreceived = GETPOST("securekey");
|
||||||
|
$securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
|
||||||
|
|
||||||
|
if ($securekeyreceived != $securekeytocompare) {
|
||||||
print $langs->trans('MissingOrBadSecureKey');
|
print $langs->trans('MissingOrBadSecureKey');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -393,9 +393,6 @@ if ($action == 'dopayment') {
|
|||||||
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
dol_syslog("SCRIPT_URI: ".(empty($_SERVER["SCRIPT_URI"]) ? '' : $_SERVER["SCRIPT_URI"]), LOG_DEBUG); // If defined script uri must match domain of PAYPAL_API_OK and PAYPAL_API_KO
|
||||||
|
|
||||||
// A redirect is added if API call successfull
|
// A redirect is added if API call successfull
|
||||||
if ($source == 'conferencesubscription') {
|
|
||||||
$PAYPAL_API_OK .= '&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
|
||||||
}
|
|
||||||
$mesg = print_paypal_redirect($PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG);
|
$mesg = print_paypal_redirect($PAYPAL_API_PRICE, $PAYPAL_API_DEVISE, $PAYPAL_PAYMENT_TYPE, $PAYPAL_API_OK, $PAYPAL_API_KO, $FULLTAG);
|
||||||
|
|
||||||
// If we are here, it means the Paypal redirect was not done, so we show error message
|
// If we are here, it means the Paypal redirect was not done, so we show error message
|
||||||
@ -414,10 +411,6 @@ if ($action == 'dopayment') {
|
|||||||
$urlok = preg_replace('/securekey=[^&]+/', '', $urlok);
|
$urlok = preg_replace('/securekey=[^&]+/', '', $urlok);
|
||||||
$urlko = preg_replace('/securekey=[^&]+/', '', $urlko);
|
$urlko = preg_replace('/securekey=[^&]+/', '', $urlko);
|
||||||
|
|
||||||
if ($source == 'conferencesubscription') {
|
|
||||||
$urlok .= '&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$mesg = '';
|
$mesg = '';
|
||||||
if (empty($PRICE) || !is_numeric($PRICE)) {
|
if (empty($PRICE) || !is_numeric($PRICE)) {
|
||||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount"));
|
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount"));
|
||||||
@ -772,9 +765,6 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
|||||||
header("Location: ".$urlko);
|
header("Location: ".$urlko);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
if ($source == 'conferencesubscription') {
|
|
||||||
$urlok .= '&invoice='.dol_encode($invoice->id, $dolibarr_main_instance_unique_id);
|
|
||||||
}
|
|
||||||
header("Location: ".$urlok);
|
header("Location: ".$urlok);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user