Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createCustomer($fname, $lname, $mname, $dob, $gender, $email, $street, $pobox, $district, $region, $mobile, $createdBy, $language, $sim=NULL, $relmobile=NULL, $acceptreg=null, $idtype=NULL, $idno=NULL) {
- # Add user lang, gender, idtype
- echo $createdBy;
- if ($this->ussd) {
- if ($language == 1) {
- $language = 'en';
- } elseif ($language == 2) {
- $language = 'sw';
- } else {
- $language = 'en';
- }
- if ($gender == 1) {
- $gender = 'male';
- } elseif ($gender == 2) {
- $gender = 'female';
- }
- if ($idtype == 1) {
- $idtype = 'National ID ';
- } elseif ($idtype == 2) {
- $idtype = 'Voters Card';
- } elseif ($idtype == 3) {
- $idtype = 'WEO/VEO';
- } elseif ($idtype == 4) {
- $idtype = 'National ID';
- } elseif ($idtype == 5) {
- $iddtype = 'Passpot';
- }
- }
- $staffinfo = $this->getUserDetails($this->username);
- $custinfo = mysql_query("SELECT * FROM user WHERE mobile='$mobile'");
- if (mysql_num_rows($custinfo) > 0) {
- $data2['lang'] = $staffinfo['lang'];
- $data2['recipient'] = $staffinfo['mobile'];
- $data2['service'] = $this->getServiceId("CREATE CUSTOMER");
- $data2['receiver'] = 5;
- $data2['username'] = $mobile;
- if ($this->ussd)
- return $this->processUssd($data2);
- else
- return false;
- }
- $ret = $this->addUser($fname, $lname, $mname, $dob, $gender, $email, $street, $pobox, $district, $region, $mobile, $mobile, "CUSTOMER", "CUSTOMER", $createdBy, $language, '', $mobile, $sim, '', $relmobile, $acceptreg, '1', '1', null, $idno, $idtype);
- if ($ret != false) {
- # Create an Account
- $accNumber = $this->addAccount($mobile, 'CUSTOMER');
- # Assign Certificate
- $certificate = $this->assignCertificate($mobile, $this->accountNumber);
- #add to the agent creation list
- ##$sysset = $this->getSystemSettings('VENDOR_BONUS');
- #if($sysset['on_use'] == 1)
- #{
- mysql_query("INSERT INTO agent_customers(create_vendor, create_customer, create_transactions, create_deposits)
- VALUES('$this->accountNumber','$mobile','0','0')");
- #}
- $this->vendorBonus($this->accountNumber, 0, $mobile);
- # Send sms
- # To customer
- # The sms: Welcome to MOBIPAWA. Your login name is 07YYAAAAAA and password is tutututh. Thank you for using mobipawa.
- $data['lang'] = $language;
- $data['recipient'] = $mobile;
- $data['service'] = $this->getServiceId("CREATE CUSTOMER");
- $data['receiver'] = 2;
- $data['username'] = $mobile;
- $data['password'] = $ret['password'];
- $data['balance'] = 0;
- $data['certificate'] = $certificate;
- $this->processSms($data);
- # The sms: You have added a customer 07YYAAAAAA on the mobipawa system.
- $data2['lang'] = $staffinfo['lang'];
- $data2['recipient'] = $staffinfo['mobile'];
- $data2['service'] = $this->getServiceId("CREATE CUSTOMER");
- $data2['receiver'] = 1;
- $data2['username'] = $mobile;
- if ($this->ussd)
- return $this->processUssd($data2);
- else {
- $this->processSms($data2);
- return true;
- }
- } else {
- return false;
- }
- }
Add Comment
Please, Sign In to add comment