Index: pro-violet-viettel/sourcecode/application/modules/services/controllers/sync.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/controllers/sync.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/services/controllers/sync.php	(revision 906)
@@ -47,5 +47,6 @@
 								'id'=>(int)$item['id'],
 								'full_name'=>(string)$item['name'],
-								'passwd' => md5($phoneNumber),
+								'passwd'=>md5($phoneNumber),
+								'login_name'=>$phoneNumber,
 								'cellphone'=>$phoneNumber,
 								'precinct'=>(string)$item['precinct'],
Index: pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 884)
+++ pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php	(revision 906)
@@ -1,56 +1,58 @@
 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
-if ( ! defined('_SBG_MO_REGISTER')) 					define('_SBG_MO_REGISTER', 				'SUBSCR');
-if ( ! defined('_SBG_MO_REGISTER_FOR')) 				define('_SBG_MO_REGISTER_FOR', 			'SUBSCR_FOR');
-if ( ! defined('_SBG_MO_PHONENUM_CHANGE')) 				define('_SBG_MO_PHONENUM_CHANGE', 		'PHONE_CHANGE');
-if ( ! defined('_SBG_MO_PASSWORD_RECOVERY')) 			define('_SBG_MO_PASSWORD_RECOVERY', 	'PWD_RECOVER');
-if ( ! defined('_SBG_MO_VIP_REGISTER')) 				define('_SBG_MO_VIP_REGISTER', 			'REG_VIP');
-if ( ! defined('_SBG_MO_PAY_TO_ACCOUNT')) 				define('_SBG_MO_PAY_TO_ACCOUNT', 		'PAY');
-if ( ! defined('_SBG_MO_PAY_TO_ACCOUNT_FOR')) 			define('_SBG_MO_PAY_TO_ACCOUNT_FOR', 	'PAY_FOR');
-if ( ! defined('_SBG_MO_UNSUBSCRIBE_SERVICE')) 			define('_SBG_MO_UNSUBSCRIBE_SERVICE', 	'UNSUBSCR');
-if ( ! defined('_SBG_MO_SUPPOR_SERVICE')) 				define('_SBG_MO_SUPPOR_SERVICE', 		'SUPPORT');
-if ( ! defined('_SBG_MO_SYNTAX_ERR')) 					define('_SBG_MO_SYNTAX_ERR', 			'SYNTAX_ERR');
-
-if ( ! defined('_SBG_CARD_PAY_FAIL')) 					define('_SBG_CARD_PAY_FAIL', 			-1);
-if ( ! defined('_SBG_CARD_PAY_SUCCESS')) 				define('_SBG_CARD_PAY_SUCCESS', 		1);
-
-if ( ! defined('_SBG_CHARGING_FAIL')) 					define('_SBG_CHARGING_FAIL', -1);
-if ( ! defined('_SBG_CHARGING_SUCCESS')) 				define('_SBG_CHARGING_SUCCESS', 1);
-if ( ! defined('_SBG_CHARGING_FAIL_NOT_ENOUGH')) 		define('_SBG_CHARGING_FAIL_NOT_ENOUGH', 401);
-if ( ! defined('_SBG_CHARGING_FAIL_NOT_VIETTEL')) 		define('_SBG_CHARGING_FAIL_NOT_VIETTEL', 402);
-if ( ! defined('_SBG_CHARGING_NUMBER_NOT_EXISTED')) 	define('_SBG_CHARGING_NUMBER_NOT_EXISTED', 403);
-if ( ! defined('_SBG_CHARGING_NUMBER_NOT_AVAILABLE')) 	define('_SBG_CHARGING_NUMBER_NOT_AVAILABLE', 404);
-if ( ! defined('_SBG_CHARGING_NUMBER_CHANGED_OWNER')) 	define('_SBG_CHARGING_NUMBER_CHANGED_OWNER', 405);
-if ( ! defined('_SBG_CHARGING_FAIL_MORETHAN_LIMIT')) 	define('_SBG_CHARGING_FAIL_MORETHAN_LIMIT', 406);
-if ( ! defined('_SBG_CHARGING_GENERAL_ERROR')) 			define('_SBG_CHARGING_GENERAL_ERROR', 440);
-if ( ! defined('_SBG_CHARGING_NUMBER_NOT_REGISTED')) 	define('_SBG_CHARGING_NUMBER_NOT_REGISTED', 501);
-if ( ! defined('_SBG_CHARGING_MAX_VALUE')) 				define('_SBG_CHARGING_MAX_VALUE', 50000);
-if ( ! defined('_SBG_CHARGING_MIN_VALUE')) 				define('_SBG_CHARGING_MIN_VALUE', 5000);
-
-
-if ( ! defined('_SBG_SEND_MT_FAIL')) 					define('_SBG_SEND_MT_FAIL', -1);
-if ( ! defined('_SBG_SEND_MT_SUCCESS')) 				define('_SBG_SEND_MT_SUCCESS', 1);
-if ( ! defined('_SBG_MT_SEND_NUMBER')) 					define('_SBG_MT_SEND_NUMBER', '841662860000');
-if ( ! defined('_SBG_MT_CP_CODE')) 						define('_SBG_MT_CP_CODE', '601');
-
-if ( ! defined('_SBG_SERVICE_COMMAND_CODE'))			define('_SBG_SERVICE_COMMAND_CODE', 'SBG');
-if ( ! defined('_SBG_SERVICE_SERVICEID')) 				define('_SBG_SERVICE_SERVICEID', '8062');
-
-if ( ! defined('_SBG_MO_PROCCESS_ERR')) 				define('_SBG_MO_PROCCESS_ERR', 0);
-
-if ( ! defined('_SBG_GET_COLLABORATOR_FAIL')) 			define('_SBG_GET_COLLABORATOR_FAIL', -1);
+if ( ! defined('_SBG_MO_REGISTER')) 						define('_SBG_MO_REGISTER', 				 		'SUBSCR');
+if ( ! defined('_SBG_MO_REGISTER_FOR')) 					define('_SBG_MO_REGISTER_FOR', 					'SUBSCR_FOR');
+if ( ! defined('_SBG_MO_PHONENUM_CHANGE')) 					define('_SBG_MO_PHONENUM_CHANGE', 		 		'PHONE_CHANGE');
+if ( ! defined('_SBG_MO_PASSWORD_RECOVERY')) 				define('_SBG_MO_PASSWORD_RECOVERY', 	 		'PWD_RECOVER');
+if ( ! defined('_SBG_MO_VIP_REGISTER')) 					define('_SBG_MO_VIP_REGISTER', 			 		'REG_VIP');
+if ( ! defined('_SBG_MO_PAY_TO_ACCOUNT')) 					define('_SBG_MO_PAY_TO_ACCOUNT', 		 		'PAY');
+if ( ! defined('_SBG_MO_PAY_TO_ACCOUNT_FOR')) 				define('_SBG_MO_PAY_TO_ACCOUNT_FOR', 	 		'PAY_FOR');
+if ( ! defined('_SBG_MO_UNSUBSCRIBE_SERVICE')) 				define('_SBG_MO_UNSUBSCRIBE_SERVICE', 	 		'UNSUBSCR');
+if ( ! defined('_SBG_MO_SUPPOR_SERVICE')) 					define('_SBG_MO_SUPPOR_SERVICE', 		 		'SUPPORT');
+if ( ! defined('_SBG_MO_SYNTAX_ERR')) 						define('_SBG_MO_SYNTAX_ERR', 			 		'SYNTAX_ERR');
+if ( ! defined('_SBG_MO_PASSWORD_COLLABORATOR_SERVICE'))	define('_SBG_MO_PASSWORD_COLLABORATOR_SERVICE', 'PWD_COLLABORATOR');
+
+if ( ! defined('_SBG_CARD_PAY_FAIL')) 						define('_SBG_CARD_PAY_FAIL', 			-1);
+if ( ! defined('_SBG_CARD_PAY_SUCCESS')) 					define('_SBG_CARD_PAY_SUCCESS', 		1);
+
+if ( ! defined('_SBG_CHARGING_FAIL')) 						define('_SBG_CHARGING_FAIL', -1);
+if ( ! defined('_SBG_CHARGING_SUCCESS')) 					define('_SBG_CHARGING_SUCCESS', 1);
+if ( ! defined('_SBG_CHARGING_FAIL_NOT_ENOUGH')) 			define('_SBG_CHARGING_FAIL_NOT_ENOUGH', 401);
+if ( ! defined('_SBG_CHARGING_FAIL_NOT_VIETTEL')) 			define('_SBG_CHARGING_FAIL_NOT_VIETTEL', 402);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_EXISTED')) 		define('_SBG_CHARGING_NUMBER_NOT_EXISTED', 403);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_AVAILABLE')) 		define('_SBG_CHARGING_NUMBER_NOT_AVAILABLE', 404);
+if ( ! defined('_SBG_CHARGING_NUMBER_CHANGED_OWNER')) 		define('_SBG_CHARGING_NUMBER_CHANGED_OWNER', 405);
+if ( ! defined('_SBG_CHARGING_FAIL_MORETHAN_LIMIT')) 		define('_SBG_CHARGING_FAIL_MORETHAN_LIMIT', 406);
+if ( ! defined('_SBG_CHARGING_GENERAL_ERROR')) 				define('_SBG_CHARGING_GENERAL_ERROR', 440);
+if ( ! defined('_SBG_CHARGING_NUMBER_NOT_REGISTED')) 		define('_SBG_CHARGING_NUMBER_NOT_REGISTED', 501);
+if ( ! defined('_SBG_CHARGING_MAX_VALUE')) 					define('_SBG_CHARGING_MAX_VALUE', 50000);
+if ( ! defined('_SBG_CHARGING_MIN_VALUE')) 					define('_SBG_CHARGING_MIN_VALUE', 5000);
+
+
+if ( ! defined('_SBG_SEND_MT_FAIL')) 						define('_SBG_SEND_MT_FAIL', -1);
+if ( ! defined('_SBG_SEND_MT_SUCCESS')) 					define('_SBG_SEND_MT_SUCCESS', 1);
+if ( ! defined('_SBG_MT_SEND_NUMBER')) 						define('_SBG_MT_SEND_NUMBER', '841662860000');
+if ( ! defined('_SBG_MT_CP_CODE')) 							define('_SBG_MT_CP_CODE', '601');
+
+if ( ! defined('_SBG_SERVICE_COMMAND_CODE'))				define('_SBG_SERVICE_COMMAND_CODE', 'SBG');
+if ( ! defined('_SBG_SERVICE_SERVICEID')) 					define('_SBG_SERVICE_SERVICEID', '8062');
+
+if ( ! defined('_SBG_MO_PROCCESS_ERR')) 					define('_SBG_MO_PROCCESS_ERR', 0);
+
+if ( ! defined('_SBG_GET_COLLABORATOR_FAIL')) 				define('_SBG_GET_COLLABORATOR_FAIL', -1);
 
 Class Services_model extends CI_Model
 {
 	private $_arySmsMO = array(
-		_SBG_MO_REGISTER 			=> array('pattern' => '/^(SBG)([[:blank:]])(DK)$/'),
-		_SBG_MO_REGISTER_FOR 		=> array('pattern' => '/^(SBG)([[:blank:]])(DK)([[:blank:]])([0-9]{10,11})$/'),
-		//_SBG_MO_PHONENUM_CHANGE 	=> array('pattern' => '/^(SBG)([[:blank:]])(DDT)([[:blank:]])([0-9]{10,11})([[:blank:]])([a-zA-Z0-9]{1,})$/'),
-		_SBG_MO_PASSWORD_RECOVERY 	=> array('pattern' => '/^(SBG)([[:blank:]])(MK)$/'),
-		_SBG_MO_VIP_REGISTER 		=> array('pattern' => '/^(SBG)([[:blank:]])(VIP)([[:blank:]])([a-zA-Z0-9]{1,})$/'),
-		_SBG_MO_PAY_TO_ACCOUNT 		=> array('pattern' => '/^(SBG)([[:blank:]])(NAP)([[:blank:]])([0-9]{3,})$/'),
-		_SBG_MO_PAY_TO_ACCOUNT_FOR 	=> array('pattern' => '/^(SBG)([[:blank:]])(NAP)([[:blank:]])([0-9]{3,})([[:blank:]])([0-9]{10,11})$/'),
-		_SBG_MO_SUPPOR_SERVICE 		=> array('pattern' => '/^(SBG)([[:blank:]])(HD)$/'),
-		_SBG_MO_UNSUBSCRIBE_SERVICE => array('pattern' => '/^(SBG)([[:blank:]])(HUY)$/')
+		_SBG_MO_REGISTER 						=> array('pattern' => '/^(SBG)([[:blank:]])(DK)$/'),
+		_SBG_MO_REGISTER_FOR 					=> array('pattern' => '/^(SBG)([[:blank:]])(DK)([[:blank:]])([0-9]{10,11})$/'),
+		//_SBG_MO_PHONENUM_CHANGE 				=> array('pattern' => '/^(SBG)([[:blank:]])(DDT)([[:blank:]])([0-9]{10,11})([[:blank:]])([a-zA-Z0-9]{1,})$/'),
+		_SBG_MO_PASSWORD_RECOVERY 				=> array('pattern' => '/^(SBG)([[:blank:]])(MK)$/'),
+		_SBG_MO_VIP_REGISTER 					=> array('pattern' => '/^(SBG)([[:blank:]])(VIP)([[:blank:]])([a-zA-Z0-9]{1,})$/'),
+		_SBG_MO_PAY_TO_ACCOUNT 					=> array('pattern' => '/^(SBG)([[:blank:]])(NAP)([[:blank:]])([0-9]{3,})$/'),
+		_SBG_MO_PAY_TO_ACCOUNT_FOR 				=> array('pattern' => '/^(SBG)([[:blank:]])(NAP)([[:blank:]])([0-9]{3,})([[:blank:]])([0-9]{10,11})$/'),
+		_SBG_MO_SUPPOR_SERVICE 					=> array('pattern' => '/^(SBG)([[:blank:]])(HD)$/'),
+		_SBG_MO_UNSUBSCRIBE_SERVICE 			=> array('pattern' => '/^(SBG)([[:blank:]])(HUY)$/'),
+		_SBG_MO_PASSWORD_COLLABORATOR_SERVICE	=> array('pattern' => '/^(SBG)([[:blank:]])(CTV)$/')
 	);
 
@@ -113,4 +115,5 @@
 		$aryContents = isset($aryMOAnalys['content']) ? $aryMOAnalys['content']: null;
 		$this->load->model('frontend/user_model', 'objUserModel');
+		$this->load->model('collaborator/collaborator_model', 'objCollaboratorModel');
 		$debugMsg .= $case;
 
@@ -262,5 +265,9 @@
 				}
 				break;
-
+				
+			case _SBG_MO_PASSWORD_COLLABORATOR_SERVICE:
+				$smsReturn = $this->objCollaboratorModel->getPassword($sentNumber);
+				break;
+			
 			case _SBG_MO_UNSUBSCRIBE_SERVICE:
 			case _SBG_MO_SYNTAX_ERR:
@@ -508,5 +515,5 @@
 
 	public function deleteCollaborator($id){
-		$sql = "DELETE FROM tblcollaborator WHERE id = ". $id;
+		$sql = "DELETE FROM tblcollaborator WHERE id = ". $id. " AND author is null";
 		$this->db->query($sql);
 		if ($this->db->affected_rows()){
