Changed the Support to send just the first name of cs

This commit is contained in:
Daniel Camargo 2014-06-22 16:51:32 -03:00
parent 8fa23ae957
commit 8dbc0c7491
5 changed files with 63 additions and 52 deletions

View File

@ -12,7 +12,7 @@ class Controller_api_support extends Crunchbutton_Controller_RestAccount {
$params = [];
$params[ 'Action' ] = 'FakeSMS';
$params[ 'Name' ] = $this->request()[ 'Name' ];
$params[ 'Created_By' ] = c::admin()->name;
$params[ 'Created_By' ] = c::admin()->firstName();
$params[ 'Body' ] = $this->request()[ 'Body' ];
$params[ 'From' ] = $this->request()[ 'From' ];
if( trim( $params[ 'Name' ] ) != '' && trim( $params[ 'Body' ] ) != '' && trim( $params[ 'From' ] ) != '' ){

View File

@ -137,7 +137,7 @@ class Controller_Support extends Crunchbutton_Controller_Account {
if( $_POST['text'] ){
$support->addAdminReply( $_POST['text'] );
if( ( $support->type == Crunchbutton_Support::TYPE_SMS || $support->type == Crunchbutton_Support::TYPE_BOX_NEED_HELP ) && $support->id_session_twilio ){
$message = c::admin()->name . ' replied @' . $support->id_session_twilio . ' : ' . $_POST['text'];
$message = c::admin()->firstName() . ' replied @' . $support->id_session_twilio . ' : ' . $_POST['text'];
Crunchbutton_Support::tellCustomerService( $message );
}
}

View File

@ -27,6 +27,14 @@ class Crunchbutton_Admin extends Cana_Table {
return $test;
}
public function firstName(){
$name = explode( ' ', $this->name );
if( trim( $name[ 0 ] ) != '' ){
return $name[ 0 ];
}
return $this->name;
}
public function createLogin(){
if( $this->login ){
return $this->login;

View File

@ -348,7 +348,7 @@ class Crunchbutton_Support extends Cana_Table {
$messageParams[ 'type' ] = Crunchbutton_Support_Message::TYPE_SMS;
$messageParams[ 'from' ] = Crunchbutton_Support_Message::TYPE_FROM_REP;
$messageParams[ 'visibility' ] = Crunchbutton_Support_Message::TYPE_VISIBILITY_EXTERNAL;
$messageParams[ 'name' ] = $admin->name;
$messageParams[ 'name' ] = $admin->firstName();
$messageParams[ 'phone' ] = $params[ 'phone' ];
$messageParams[ 'body' ] = $params[ 'body' ];
return $this->addMessage( $messageParams );
@ -416,7 +416,7 @@ class Crunchbutton_Support extends Cana_Table {
$messageParams[ 'type' ] = Crunchbutton_Support_Message::TYPE_NOTE;
$messageParams[ 'from' ] = Crunchbutton_Support_Message::TYPE_FROM_REP;
$messageParams[ 'visibility' ] = Crunchbutton_Support_Message::TYPE_VISIBILITY_INTERNAL;
$messageParams[ 'name' ] = $admin->name;
$messageParams[ 'name' ] = $admin->firstName();
$messageParams[ 'phone' ] = $params[ 'phone' ];
$messageParams[ 'body' ] = $body;
$message = $this->addMessage( $messageParams );
@ -497,7 +497,6 @@ class Crunchbutton_Support extends Cana_Table {
$message = '@'.$this->id_session_twilio.' : ' . $message;
$message = str_split( $message, 160 );
// Send this message to the customer service
foreach ( Crunchbutton_Support::getUsers() as $supportName => $supportPhone ) {
$num = $supportPhone;

View File

@ -36,7 +36,11 @@ class Crunchbutton_Support_Message extends Cana_Table {
$support = $this->support();
$phone = $support->phone;
if (!$phone) return;
$rep_name = $this->admin()->name;
if( $this->admin()->id_admin ){
$rep_name = $this->admin()->firstName();
} else {
$rep_name = '';
}
$msg = '' . ( $rep_name ? $rep_name.': ' : '' ) . $this->body;
$msgs = str_split( $msg, 160 );
foreach($msgs as $msg) {