Esempio n. 1
0
 public function saveCustEnroll(\CustomerEnrollVO $object)
 {
     $config_properties = (require '../../model-db-connection/GoGetRighconf.properties.php');
     // Create connection
     $mysqli = new mysqli($config_properties['domain'], $config_properties['username'], $config_properties['password'], $config_properties['databasename']);
     /* check connection */
     if (mysqli_connect_errno()) {
         printf("Connect failed: %s\n", mysqli_connect_error());
         exit;
     }
     $mysqli->set_charset("utf8");
     // prepare and bind
     $stmt = $mysqli->prepare("INSERT INTO RICH_CUSTOMER_ENROLL (ENROLL_ID, ENROLL_CUS_ID, ENROLL_PAYMENT_TERM,ENROLL_SEMINARDISCOUNT,ENROLL_INVITESUGGEST,ENROLL_KNOWLEDGE_FOR_REASON,ENROLL_OTHER_KNOWLEDGE_FOR_REASON,ENROLL_NEWSFROM,ENROLL_COURSE_ID,CREATED_DATE_TIME,PAYMENT_STATUS,ADDITIONAL_ENROLL_CUS_NAME,IS_REGISTERED_OWNER,ENROLL_STATUS) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,NOW(),'PENDING',?,?,?)");
     $stmt->bind_param("ssssssssssss", $object->getEnrollID(), $object->getRefCusID(), $object->getPaymentTerm(), $object->getSeminarDiscountReason(), $object->getInviteSuggestPersonName(), $object->getKnowledgeForReason(), $object->getOtherknowledgeForReason(), $object->getNewsFrom(), $object->getCourseID(), $object->getAdditionalUser(), $object->getIsRegisteredOwn(), $object->getEnrollmentStatus());
     $stmt->execute();
     $stmt->close();
     $mysqli->close();
     return 200;
 }
 $customerVO->setPhoneNumber($phone);
 $customerVO->setCusFacebookAddr("");
 $customerVO->setForceChange("true");
 $saveUserResult = $customerService->saveCustomer($customerVO);
 if ($saveUserResult == 200) {
     //Sending register email
     if ($iniConfiguration['email.sending.to.customer'] == true) {
         $resetUrl = $iniConfiguration['web.application.prefix'] . "view/forceChangePassword?cusID=" . $cusID;
         $emailContent = new EmailContent();
         $emailBody = $emailContent->getCustomerEmailRegister($resetUrl, $email, $iniConfiguration['guest.password.default'], $iniConfiguration['web.application.prefix']);
         $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $email, $iniConfiguration['email.subject.customer.register.prefix'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']);
         $sendingEmail->sendingEmail();
     }
     $resultFromCheckCust = $custEnrollService->checkCustAlreadyEnrollByEnrollID($courseID, $cusID);
     if ($resultFromCheckCust == 200) {
         $custEnrollVO = new CustomerEnrollVO();
         $custEnrollVO->setEnrollID(md5(date("h:i:sa") . "-" . $cusID));
         $custEnrollVO->setRefCusID($cusID);
         $custEnrollVO->setCourseID($courseID);
         $custEnrollVO->setInviteSuggestPersonName("");
         $custEnrollVO->setKnowledgeForReason("");
         $custEnrollVO->setNewsFrom("");
         $custEnrollVO->setOtherknowledgeForReason("");
         $custEnrollVO->setPaymentTerm($paymentTerm);
         $custEnrollVO->setSeminarDiscountReason($seminarDiscount);
         $custEnrollVO->setAdditionalUser("");
         $custEnrollVO->setIsRegisteredOwn("false");
         $custEnrollVO->setEnrollmentStatus("Confirm");
         $theNoti = $custEnrollService->saveCustEnroll($custEnrollVO);
         //Sending enrollment email to customer
         if ($iniConfiguration['email.sending.to.customer'] == true) {