From ebd5f292318c538e88709fffc2681f7f87e2c0c0 Mon Sep 17 00:00:00 2001 From: Dorian Vabre Date: Mon, 12 Apr 2021 15:44:25 +0200 Subject: [PATCH] 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"));