From eef5b9514d3f1ca219ef807e23aa633bd6547225 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Fri, 9 Apr 2021 16:55:54 +0200 Subject: [PATCH 001/135] wip --- .../eventorganization/attendee_subscription.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 885058d34bb..2e49ad131d9 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -263,6 +263,19 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $db->commit(); + + $project = new Project($db); + $resultproject = $project->fetch($object->fk_project); + if ($resultproject < 0){ + $error++; + $errmsg .= $project->error; + } else { + if (!empty($project->price_registration)){ + // @todo traiter invoice et payment page + } + } + + // invoice //Header("Location: ".$urlback); //exit; } else { From ebd5f292318c538e88709fffc2681f7f87e2c0c0 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 12 Apr 2021 15:44:25 +0200 Subject: [PATCH 002/135] invoice OK except price, wip on the payment page --- .../attendee_subscription.php | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index b044ad2e914..172e6cee798 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -66,6 +66,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.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'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; // Init vars @@ -78,6 +80,12 @@ $action = GETPOST('action', 'aZ09'); $key = 'DV3PH'; $id = dol_decode(GETPOST('id'), $key); +$conference = new ConferenceOrBooth($db); +$resultconf = $conference->fetch($id); +if ($resultconf < 0) { + setEventMessages(null, $object->errors, "errors"); +} + // Securekey check $securekey = GETPOST('securekey', 'alpha'); if ($securekey != $conf->global->EVENTORGANIZATION_SECUREKEY) { @@ -258,22 +266,39 @@ if (empty($reshook) && $action == 'add') { } } } - if (!$error) { $db->commit(); - $project = new Project($db); - $resultproject = $project->fetch($object->fk_project); - if ($resultproject < 0){ + $resultproject = $project->fetch($conference->fk_project); + if ($resultproject < 0){ $error++; $errmsg .= $project->error; } else { - if (!empty($project->price_registration)){ - // @todo traiter invoice et payment page + var_dump($project->price_registration); + if (!empty(floatval($project->price_registration))){ + $facture = new Facture($db); + //$facture->rowid = ; + //$facture->ref = ; + //$facture->entity = ; + $facture->type = 0; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + //$facture->fk_user_modif = ; + //$facture->fk_cond_reglement = ; + //$facture->tms = ; + //$facture->fk_statut = ; + $facture->date = dol_now(); + $resultfacture = $facture->create($user); + } else { + // No price has been set + // Validating the subscription + $confattendee->setStatut(1); + global $dolibarr_main_url_root; + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php'; + Header("Location: ".$redirection); + exit; } } - - // invoice //Header("Location: ".$urlback); //exit; } else { @@ -289,12 +314,6 @@ if (empty($reshook) && $action == 'add') { $form = new Form($db); $formcompany = new FormCompany($db); -$conference = new ConferenceOrBooth($db); -$resultconf = $conference->fetch($id); -if ($resultconf < 0) { - setEventMessages(null, $object->errors, "errors"); -} - llxHeaderVierge($langs->trans("NewSubscription")); From 15d103e957f94e63d1b9b50fd80bd7fcff69ad4f Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 12 Apr 2021 15:52:49 +0200 Subject: [PATCH 003/135] subs validation for free conferences added --- htdocs/langs/en_US/eventorganization.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 03fb460d6b9..302790f91f0 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -98,3 +98,7 @@ MissingOrBadSecureKey = The security key is invalid or missing EvntOrgWelcomeMessage = This form allows you to register as a new participant to the conference EvntOrgStartDuration = This conference starts on EvntOrgEndDuration = and ends on +# +# SubscriptionOk page +# +SubscriptionOk = Your subscription to this conference has been validated From e1fb368d3a40662623f02199f528540a073055b7 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 12 Apr 2021 16:50:56 +0200 Subject: [PATCH 004/135] wip --- .../public/eventorganization/attendee_subscription.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 172e6cee798..0adf783ee05 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -274,7 +274,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $project->error; } else { - var_dump($project->price_registration); + global $dolibarr_main_url_root; if (!empty(floatval($project->price_registration))){ $facture = new Facture($db); //$facture->rowid = ; @@ -288,12 +288,15 @@ if (empty($reshook) && $action == 'add') { //$facture->tms = ; //$facture->fk_statut = ; $facture->date = dol_now(); - $resultfacture = $facture->create($user); + $resultfacture = $facture->create($user); + //@todo rediriger page paiement + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; + Header("Location: ".$redirection); + exit; } else { // No price has been set // Validating the subscription $confattendee->setStatut(1); - global $dolibarr_main_url_root; $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php'; Header("Location: ".$redirection); exit; From db8dfb219cbea1814ba6f7f951e91fe9dcff06e9 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 13 Apr 2021 14:10:20 +0200 Subject: [PATCH 005/135] addition of the subscriptionok page when the subscription price is not set or 0 --- .../eventorganization/subscriptionok.php | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 htdocs/public/eventorganization/subscriptionok.php diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php new file mode 100644 index 00000000000..c12c1053e97 --- /dev/null +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -0,0 +1,156 @@ + + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2021 Waël Almoman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/payment/paymentok.php + * \ingroup core + * \brief File to show page after a successful payment + * This page is called by payment system with url provided to it completed with parameter TOKEN=xxx + * This token can be used to get more informations. + */ + +if (!defined('NOLOGIN')) { + define("NOLOGIN", 1); // This means this output page does not require to be logged. +} +if (!defined('NOCSRFCHECK')) { + define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} +if (!defined('NOBROWSERNOTIF')) { + define('NOBROWSERNOTIF', '1'); +} + +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +// TODO This should be useless. Because entity must be retrieve from object ref and not from url. +$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)); +if (is_numeric($entity)) { + define("DOLENTITY", $entity); +} + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + +if (!empty($conf->paypal->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php'; +} + +$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization")); + +$object = new stdClass(); // For triggers + +$error = 0; + + +/* + * Actions + */ + + + +/* + * View + */ + +$now = dol_now(); + +dol_syslog("Callback url when a payment was done. query_string=".(dol_escape_htmltag($_SERVER["QUERY_STRING"]) ?dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '')." script_uri=".(dol_escape_htmltag($_SERVER["SCRIPT_URI"]) ?dol_escape_htmltag($_SERVER["SCRIPT_URI"]) : ''), LOG_DEBUG, 0, '_payment'); + +$tracepost = ""; +foreach ($_POST as $k => $v) { + $tracepost .= "{$k} - {$v}\n"; +} +dol_syslog("POST=".$tracepost, LOG_DEBUG, 0, '_payment'); + +$head = ''; +if (!empty($conf->global->ONLINE_PAYMENT_CSS_URL)) { + $head = ''."\n"; +} + +$conf->dol_hide_topmenu = 1; +$conf->dol_hide_leftmenu = 1; + +$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; +llxHeader($head, $langs->trans("PaymentForm"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea); + + +// Show message +print ''."\n"; +print '
'."\n"; + + +// Show logo (search order: logo defined by PAYMENT_LOGO_suffix, then PAYMENT_LOGO, then small company logo, large company logo, theme logo, common logo) +// Define logo and logosmall +$logosmall = $mysoc->logo_small; +$logo = $mysoc->logo; +$paramlogo = 'ONLINE_PAYMENT_LOGO_'.$suffix; +if (!empty($conf->global->$paramlogo)) { + $logosmall = $conf->global->$paramlogo; +} elseif (!empty($conf->global->ONLINE_PAYMENT_LOGO)) { + $logosmall = $conf->global->ONLINE_PAYMENT_LOGO; +} +//print ''."\n"; +// Define urllogo +$urllogo = ''; +$urllogofull = ''; +if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); + $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); +} + +// Output html code for logo +if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + print ''; + } + print '
'; +} + + +print '


'; + +print $langs->trans("SubscriptionOk"); + +print "\n
\n"; + + +htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); + + +// Clean session variables to avoid duplicate actions if post is resent +unset($_SESSION["FinalPaymentAmt"]); +unset($_SESSION["TRANSACTIONID"]); + + +llxFooter('', 'public'); + +$db->close(); \ No newline at end of file From 633a3d39c6bbfecf3df67edf3e13fbeebf9234b4 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 13 Apr 2021 14:32:17 +0200 Subject: [PATCH 006/135] wip on adding taxes and price to invoice --- .../attendee_subscription.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index ba52057b796..1887754bf23 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -284,7 +284,7 @@ if (empty($reshook) && $action == 'add') { } if (!$error) { - $db->commit(); + $db->commit(); $project = new Project($db); $resultproject = $project->fetch($conference->fk_project); if ($resultproject < 0){ @@ -294,22 +294,22 @@ if (empty($reshook) && $action == 'add') { global $dolibarr_main_url_root; if (!empty(floatval($project->price_registration))){ $facture = new Facture($db); - //$facture->rowid = ; - //$facture->ref = ; - //$facture->entity = ; $facture->type = 0; $facture->socid = $thirdparty->id; $facture->paye = 0; - //$facture->fk_user_modif = ; - //$facture->fk_cond_reglement = ; - //$facture->tms = ; - //$facture->fk_statut = ; + //@todo price and taxes to add + $tva = get_default_tva($mysoc, $thirdparty); + $facture->date = dol_now(); $resultfacture = $facture->create($user); - //@todo rediriger page paiement - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; - Header("Location: ".$redirection); - exit; + if ($resultfacture < 0){ + $error++; + $errmsg .= $facture->error; + } else { + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; + Header("Location: ".$redirection); + exit; + } } else { // No price has been set // Validating the subscription From a3e75c587c425a908b81b898061e570873b887af Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 13 Apr 2021 15:07:15 +0200 Subject: [PATCH 007/135] adding amount and source to redirection url to newpayment --- htdocs/public/eventorganization/attendee_subscription.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index 1887754bf23..f5efd274edf 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -306,7 +306,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $facture->error; } else { - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription'; Header("Location: ".$redirection); exit; } From 339596f13410f7358ffce6b7bd74c92aae404e13 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Tue, 13 Apr 2021 15:30:28 +0200 Subject: [PATCH 008/135] ref add in redirection url to payment page --- htdocs/public/eventorganization/attendee_subscription.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index f5efd274edf..a47a93557d3 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -306,7 +306,8 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $facture->error; } else { - $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription'; + $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription&ref='.$thirdparty->ref; Header("Location: ".$redirection); exit; } From 55afc59db25c55839a8df10dcdd267d9a763ed60 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Wed, 14 Apr 2021 14:33:11 +0200 Subject: [PATCH 009/135] removed useless fetch, moved link to the fetch method of the conferenceorbooth class, wip on service to use on the invoice --- htdocs/admin/eventorganization.php | 19 +++++++++++++++++++ .../class/conferenceorbooth.class.php | 12 ++++++++++++ .../conferenceorbooth_card.php | 12 +----------- htdocs/langs/en_US/eventorganization.lang | 2 ++ .../attendee_subscription.php | 4 ++-- 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index b6a964d8617..c76d9a5c188 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -61,6 +61,8 @@ $arrayofparameters = array( 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), + 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), + 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), ); $error = 0; @@ -276,6 +278,23 @@ if ($action == 'edit') { });'; print ''; } + } elseif ($var['type'] == 'product') { + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; + print ''; + $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $form->select_produits($selected, $constname, '', 0); + print ''; + print "\n"; + } + if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { + print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; + print ''; + $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $form->select_produits($selected, $constname, '', 0); + print ''; + } + print "\n"; } else { print ''; } diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 41fe4ebd94d..b859c10a98d 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -237,7 +237,19 @@ class ConferenceOrBooth extends ActionComm */ public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '') { + global $dolibarr_main_url_root, $dolibarr_main_instance_unique_id, $conf, $langs; + $result = parent::fetch($id, $ref, $ref_ext, $email_msgid); + + $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); + $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); + $link_subscription .= '&securekey='.urlencode($encodedsecurekey); + + $this->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1); + $this->pubregister = $link_subscription; + $this->getActionCommFields(); return $result; } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 15b52eda038..fc232406ce9 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -493,18 +493,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field //unset($object->fields['fk_project']); // Hide field already shown in banner //unset($object->fields['fk_soc']); // Hide field already shown in banner - global $dolibarr_main_url_root; - - $encodedid = dol_encode($id, $dolibarr_main_instance_unique_id); - $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); - $link_subscription .= '&securekey='.urlencode($encodedsecurekey); - - $object->fields['pubregister'] = array('type'=>'url', 'label'=>$langs->trans("PublicAttendeeSubscriptionPage"), 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>1); - $object->pubregister = $link_subscription; $keyforbreak='pubregister'; - + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; //var_dump($object); // Other attributes. Fields from hook formObjectOptions and Extrafields. diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index fbee3de4e3d..3fc655b92e9 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -82,6 +82,8 @@ EventOrganizationICSLink=Link ICS for events ConferenceOrBoothInformation=Conference Or Booth informations Attendees = Attendees EVENTORGANIZATION_SECUREKEY = Secure Key of the public registration link to a conference +SERVICE_BOOTH_LOCATION = Service used for the invoice row about a booth location +SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION = Service used for the invoice row about an attendee subscription to a conference # # Status # diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index a47a93557d3..9aa1ca7d2e0 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -299,14 +299,14 @@ if (empty($reshook) && $action == 'add') { $facture->paye = 0; //@todo price and taxes to add $tva = get_default_tva($mysoc, $thirdparty); - $facture->date = dol_now(); + $resultfacture = $facture->create($user); if ($resultfacture < 0){ $error++; $errmsg .= $facture->error; } else { - $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); + // @todo corriger la réf qui est surement celle de la facture au lieu du client $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?amount='.$project->price_registration.'&source=conferenceattendeesubscription&ref='.$thirdparty->ref; Header("Location: ".$redirection); exit; From caf74fe1cb3452c93146ac8a00a89786afaededd Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Wed, 14 Apr 2021 16:20:05 +0200 Subject: [PATCH 010/135] pull problem corrected --- .../attendee_subscription.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/htdocs/public/eventorganization/attendee_subscription.php b/htdocs/public/eventorganization/attendee_subscription.php index faff3d40712..cdb848ed28c 100644 --- a/htdocs/public/eventorganization/attendee_subscription.php +++ b/htdocs/public/eventorganization/attendee_subscription.php @@ -293,6 +293,33 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $db->commit(); + global $dolibarr_main_url_root; + if (!empty(floatval($project->price_registration))){ + $facture = new Facture($db); + $facture->type = 0; + $facture->socid = $thirdparty->id; + $facture->paye = 0; + //@todo price and taxes to add + $tva = get_default_tva($mysoc, $thirdparty); + $facture->date = dol_now(); + $resultfacture = $facture->create($user); + if ($resultfacture < 0){ + $error++; + $errmsg .= $facture->error; + } else { + $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php'; + Header("Location: ".$redirection); + exit; + } + + } else { + // No price has been set + // Validating the subscription + $confattendee->setStatut(1); + $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php'; + Header("Location: ".$redirection); + exit; + } //Header("Location: ".$urlback); //exit; } else { From dd7c09582fdc7b19bdaac710e765f9e1f4cf39e2 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Thu, 15 Apr 2021 10:45:44 +0200 Subject: [PATCH 011/135] payment page structure ok, still need to confirm the attendee after the payment --- htdocs/admin/eventorganization.php | 57 ++++---- htdocs/langs/en_US/eventorganization.lang | 4 + .../attendee_subscription.php | 64 ++++----- htdocs/public/payment/newpayment.php | 133 ++++++++++++++++++ 4 files changed, 193 insertions(+), 65 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index c76d9a5c188..58f09786e23 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -61,8 +61,8 @@ $arrayofparameters = array( 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), - 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), - 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), + 'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1), + 'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1), ); $error = 0; @@ -209,12 +209,12 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $constname => $val) { - if ($val['enabled']==1) { - $setupnotempty++; - print ''; - $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); - print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; - print ''; + if ($val['enabled']==1) { + $setupnotempty++; + print ''; + $tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : ''); + print ''.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).''; + print ''; if ($val['type'] == 'textarea') { print '