From 638e9ff53568a8823a44db1e9a21130abe864ca8 Mon Sep 17 00:00:00 2001 From: RamkrishnaMondal Date: Tue, 26 Apr 2016 16:04:17 +0530 Subject: [PATCH] First commit --- application/config/autoload.php | 2 +- application/controllers/Config.php | 15 +++ application/controllers/Messages.php | 47 ++++++++++ application/helpers/table_helper.php | 60 +++++------- application/language/en/common_lang.php | 2 + application/language/en/config_lang.php | 5 + application/language/en/messages_lang.php | 3 + application/language/en/module_lang.php | 2 + application/libraries/Sms.php | 12 +++ application/views/configs/manage.php | 8 +- application/views/configs/message_config.php | 92 +++++++++++++++++++ application/views/messages/index.html | 11 +++ application/views/messages/sms-sender.php | 31 +++++++ application/views/messages/sms.php | 30 ++++++ database/database.sql | 10 +- database/tables.sql | 11 ++- images/menubar/messages.png | Bin 0 -> 1155 bytes 17 files changed, 299 insertions(+), 42 deletions(-) create mode 100644 application/controllers/Messages.php create mode 100644 application/language/en/messages_lang.php create mode 100644 application/libraries/Sms.php create mode 100755 application/views/configs/message_config.php create mode 100644 application/views/messages/index.html create mode 100755 application/views/messages/sms-sender.php create mode 100755 application/views/messages/sms.php create mode 100644 images/menubar/messages.png diff --git a/application/config/autoload.php b/application/config/autoload.php index 114114780..1da59fcb7 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -58,7 +58,7 @@ $autoload['packages'] = array(); | | $autoload['libraries'] = array('user_agent' => 'ua'); */ -$autoload['libraries'] = array('database', 'form_validation', 'session', 'user_agent', 'pagination'); +$autoload['libraries'] = array('database', 'form_validation', 'session', 'user_agent', 'pagination', 'sms'); /* | ------------------------------------------------------------------- diff --git a/application/controllers/Config.php b/application/controllers/Config.php index f874233ed..09646daa6 100644 --- a/application/controllers/Config.php +++ b/application/controllers/Config.php @@ -97,6 +97,21 @@ class Config extends Secure_area echo json_encode(array('success'=>$success, 'message'=>$this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully'))); } + function save_message() + { + $batch_save_data = array( + 'msg_msg'=>$this->input->post('msg_msg'), + 'msg_uid'=>$this->input->post('msg_uid'), + 'msg_pwd'=>$this->input->post('msg_pwd') + + ); + + $result = $this->Appconfig->batch_save($batch_save_data); + $success = $result ? true : false; + + echo json_encode(array('success'=>$success, 'message'=>$this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully'))); + } + function stock_locations() { $stock_locations = $this->Stock_location->get_all()->result_array(); diff --git a/application/controllers/Messages.php b/application/controllers/Messages.php new file mode 100644 index 000000000..425737482 --- /dev/null +++ b/application/controllers/Messages.php @@ -0,0 +1,47 @@ +get_controller_name(); + $this->load->view('messages/sms'); + + } + + + function view($person_id=-1) + { + $data['person_info']=$this->Person->get_info($person_id); + $this->load->view('messages/sms-sender',$data); + } + + + function send() + { + $uid = $this->config->item('msg_uid'); + $pwd = $this->config->item('msg_pwd'); + $phone = $this->input->post('phone'); + $msg = $this->input->post('msg'); + + $response = $this->sms->sendsms($uid,$pwd,$phone,$msg); + $this->load->view('messages/sms'); + + if('send') + { + echo "Message Submitted Successfully"; + } + else + { + echo "Message NOT Submitted Successfully"; + } + + } +} +?> diff --git a/application/helpers/table_helper.php b/application/helpers/table_helper.php index 8511d4b58..663683ad2 100644 --- a/application/helpers/table_helper.php +++ b/application/helpers/table_helper.php @@ -6,26 +6,17 @@ function get_sales_manage_table($sales, $controller) $table=''; $headers = array(' ', - $CI->lang->line('sales_receipt_number'), - $CI->lang->line('sales_sale_time'), - $CI->lang->line('customers_customer'), - $CI->lang->line('sales_amount_tendered'), - $CI->lang->line('sales_amount_due'), - $CI->lang->line('sales_change_due'), - $CI->lang->line('sales_payment')); - - if($CI->config->item('invoice_enable') == TRUE) - { - $headers[] = $CI->lang->line('sales_invoice_number'); - $headers[] = ' '; - $headers[] = ' '; - $headers[] = ' '; - } - else - { - $headers[] = ' '; - $headers[] = ' '; - } + $CI->lang->line('sales_receipt_number'), + $CI->lang->line('sales_sale_time'), + $CI->lang->line('customers_customer'), + $CI->lang->line('sales_amount_tendered'), + $CI->lang->line('sales_amount_due'), + $CI->lang->line('sales_change_due'), + $CI->lang->line('sales_payment'), + $CI->lang->line('sales_invoice_number'), + ' ', + ' ', + ' '); $table.=''; foreach($headers as $header) @@ -84,22 +75,11 @@ function get_sales_manage_sale_data_row($sale, $controller) $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; - if($CI->config->item('invoice_enable') == TRUE) - { - $table_data_row.=''; - $table_data_row.=''; - } - else - { - // this size includes the 8% of invoice number and 5% of the invoice gliphicon, pluf of course the 12% for the field itself - $table_data_row.=''; - } + $table_data_row.=''; + $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; - if($CI->config->item('invoice_enable') == TRUE) - { - $table_data_row.=''; - } + $table_data_row.=''; $table_data_row.=''; return $table_data_row; @@ -145,7 +125,8 @@ function get_people_manage_table($people,$controller) $CI->lang->line('common_first_name'), $CI->lang->line('common_email'), $CI->lang->line('common_phone_number'), - ' '); + $CI->lang->line('common_send_msg'), + $CI->lang->line('common_update'),); $table.=''; foreach($headers as $header) @@ -191,6 +172,7 @@ function get_person_data_row($person,$controller) $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; + $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; @@ -212,6 +194,9 @@ function get_detailed_data_row($row, $controller) return $table_data_row; } + + + /* Gets the html table to manage suppliers. */ @@ -227,8 +212,9 @@ function get_supplier_manage_table($suppliers,$controller) $CI->lang->line('common_first_name'), $CI->lang->line('common_email'), $CI->lang->line('common_phone_number'), + $CI->lang->line('common_send_msg'), $CI->lang->line('suppliers_supplier_id'), - ' '); + $CI->lang->line('common_update'),); $table.=''; foreach($headers as $header) @@ -276,6 +262,7 @@ function get_supplier_data_row($supplier,$controller) $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; + $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; $table_data_row.=''; @@ -283,6 +270,7 @@ function get_supplier_data_row($supplier,$controller) return $table_data_row; } + /* Gets the html table to manage items. */ diff --git a/application/language/en/common_lang.php b/application/language/en/common_lang.php index 9e1208b07..ac1bdafa7 100644 --- a/application/language/en/common_lang.php +++ b/application/language/en/common_lang.php @@ -60,3 +60,5 @@ $lang["common_export_excel"] = "Excel Export"; $lang["common_export_excel_yes"] = "Yes"; $lang["common_export_excel_no"] = "No"; $lang["common_required"] = "Required"; +$lang["common_send_msg"] = "SMS"; +$lang["common_update"] = "Update"; diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index 6688e9f97..0b984c797 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -93,6 +93,11 @@ $lang["config_location"] = "Stock"; $lang["config_location_configuration"] = "Stock Locations"; $lang["config_location_info"] = "Location Configuration Information"; $lang["config_logout"] = "Don't you want to make a backup before logging out? Click [OK] to backup, [Cancel] to logout"; +$lang["config_message"] = "Message"; +$lang["config_message_configuration"] = "Message Configuration"; +$lang["config_msg_msg"] = "Saved Text Message:"; +$lang["config_msg_uid"] = "SMS-API UserName:"; +$lang["config_msg_pwd"] = "SMS-API Password:"; $lang["config_number_format"] = "Number Format"; $lang["config_phone"] = "Company Phone"; $lang["config_phone_required"] = "Company phone is a required field"; diff --git a/application/language/en/messages_lang.php b/application/language/en/messages_lang.php new file mode 100644 index 000000000..752ba5373 --- /dev/null +++ b/application/language/en/messages_lang.php @@ -0,0 +1,3 @@ + diff --git a/application/views/configs/manage.php b/application/views/configs/manage.php index a61c89d96..05e7d3470 100644 --- a/application/views/configs/manage.php +++ b/application/views/configs/manage.php @@ -22,6 +22,9 @@
  • lang->line('config_invoice'); ?>
  • +
  • + lang->line('config_message'); ?> +
  • @@ -46,6 +49,9 @@
    load->view("configs/invoice_config"); ?>
    +
    + load->view("configs/message_config"); ?> +
    -load->view("partial/footer"); ?> \ No newline at end of file +load->view("partial/footer"); ?> diff --git a/application/views/configs/message_config.php b/application/views/configs/message_config.php new file mode 100755 index 000000000..21567712c --- /dev/null +++ b/application/views/configs/message_config.php @@ -0,0 +1,92 @@ +'message_config_form', 'enctype'=>'multipart/form-data', 'class'=>'form-horizontal')); ?> +
    +
    + +

    Message settings

    + +
    +
    + + + +
    + lang->line('config_msg_msg'), 'msg_msg', array('class'=>'control-label col-xs-2')); ?> +
    + 'msg_msg', + 'id'=>'msg_msg', + 'class'=>'form-control input-sm', + 'value'=>$this->config->item('msg_msg')));?> +
    + + + + + +
    + +
    + + +
    + lang->line('config_msg_uid'), 'msg_uid', array('class'=>'control-label col-xs-2')); ?> +
    + 'msg_uid', + 'id'=>'msg_uid', + 'class'=>'form-control input-sm', + 'type'=>'password', + 'value'=>$this->config->item('msg_uid')));?> +
    +
    + +
    + lang->line('config_msg_pwd'), 'msg_pwd', array('class'=>'control-label col-xs-2')); ?> +
    + 'msg_pwd', + 'id'=>'msg_pwd', + 'class'=>'form-control input-sm', + 'type'=>'password', + 'value'=>$this->config->item('msg_pwd')));?> +
    + + +
    + 'submit_form', + 'id'=>'submit_form', + 'value'=>$this->lang->line('common_submit'), + 'class'=>'btn btn-primary btn-sm pull-right'));?> +
    +
    + + + + diff --git a/application/views/messages/index.html b/application/views/messages/index.html new file mode 100644 index 000000000..b702fbc39 --- /dev/null +++ b/application/views/messages/index.html @@ -0,0 +1,11 @@ + + + + 403 Forbidden + + + +

    Directory access is forbidden.

    + + + diff --git a/application/views/messages/sms-sender.php b/application/views/messages/sms-sender.php new file mode 100755 index 000000000..4c1a5b2aa --- /dev/null +++ b/application/views/messages/sms-sender.php @@ -0,0 +1,31 @@ + + 'send_sms_form', 'enctype'=>'multipart/form-data', 'method'=>'post', 'class'=>'form-horizontal')); ?> +
    + +
    + +
    + 'form-control', 'type'=>'text','name'=>'first_name', 'value'=>$person_info->first_name));?> +
    +
    +
    + +
    + 'form-control', 'type'=>'text','name'=>'last_name', 'value'=>$person_info->last_name));?> +
    +
    +
    + +
    + 'form-control', 'type'=>'text','name'=>'phone', 'value'=>$person_info->phone_number));?> +
    +
    +
    + +
    + + (Maximum 140 characters) +
    +
    + + diff --git a/application/views/messages/sms.php b/application/views/messages/sms.php new file mode 100755 index 000000000..04cf721a1 --- /dev/null +++ b/application/views/messages/sms.php @@ -0,0 +1,30 @@ + +load->view("partial/header"); ?> + +
    + 'send_sms_form', 'enctype'=>'multipart/form-data', 'method'=>'post', 'class'=>'form-horizontal')); ?> +
    + SEND SMS +
    +
    + +
    + + ( In case of multiple recipients, enter mobile numbers separated with comma ) +
    +

    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +load->view("partial/footer"); ?> diff --git a/database/database.sql b/database/database.sql index 815759bcb..91a486795 100644 --- a/database/database.sql +++ b/database/database.sql @@ -64,7 +64,10 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('decimal_point', '.'), ('currency_decimals', '2'), ('tax_decimals', '2'), -('quantity_decimals', '0'); +('quantity_decimals', '0'), +('msg_msg',''), +('msg_uid', 'userName'), +('msg_pwd', 'password'); -- -------------------------------------------------------- @@ -289,12 +292,13 @@ CREATE TABLE `ospos_modules` ( -- INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_id`) VALUES -('module_config', 'module_config_desc', 100, 'config'), +('module_config', 'module_config_desc', 110, 'config'), ('module_customers', 'module_customers_desc', 10, 'customers'), ('module_employees', 'module_employees_desc', 80, 'employees'), ('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'), ('module_items', 'module_items_desc', 20, 'items'), ('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'), +('module_messages', 'module_messages_desc', 100, 'messages'), ('module_receivings', 'module_receivings_desc', 60, 'receivings'), ('module_reports', 'module_reports_desc', 50, 'reports'), ('module_sales', 'module_sales_desc', 70, 'sales'), @@ -365,6 +369,7 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES ('giftcards', 'giftcards'), ('items', 'items'), ('item_kits', 'item_kits'), +('messages', 'messages'), ('receivings', 'receivings'), ('reports', 'reports'), ('sales', 'sales'), @@ -410,6 +415,7 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('giftcards', 1), ('items', 1), ('item_kits', 1), +('messages', 1), ('receivings', 1), ('reports', 1), ('sales', 1), diff --git a/database/tables.sql b/database/tables.sql index 7651a1565..56871e0ab 100644 --- a/database/tables.sql +++ b/database/tables.sql @@ -64,7 +64,11 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('decimal_point', '.'), ('currency_decimals', '2'), ('tax_decimals', '2'), -('quantity_decimals', '0'); +('quantity_decimals', '0'), +('msg_msg',''), +('msg_uid', 'userName'), +('msg_pwd', 'password'); + -- -------------------------------------------------------- @@ -289,12 +293,13 @@ CREATE TABLE `ospos_modules` ( -- INSERT INTO `ospos_modules` (`name_lang_key`, `desc_lang_key`, `sort`, `module_id`) VALUES -('module_config', 'module_config_desc', 100, 'config'), +('module_config', 'module_config_desc', 110, 'config'), ('module_customers', 'module_customers_desc', 10, 'customers'), ('module_employees', 'module_employees_desc', 80, 'employees'), ('module_giftcards', 'module_giftcards_desc', 90, 'giftcards'), ('module_items', 'module_items_desc', 20, 'items'), ('module_item_kits', 'module_item_kits_desc', 30, 'item_kits'), +('module_messages', 'module_messages_desc', 100, 'messages'), ('module_receivings', 'module_receivings_desc', 60, 'receivings'), ('module_reports', 'module_reports_desc', 50, 'reports'), ('module_sales', 'module_sales_desc', 70, 'sales'), @@ -365,6 +370,7 @@ INSERT INTO `ospos_permissions` (`permission_id`, `module_id`) VALUES ('giftcards', 'giftcards'), ('items', 'items'), ('item_kits', 'item_kits'), +('messages', 'messages'), ('receivings', 'receivings'), ('reports', 'reports'), ('sales', 'sales'), @@ -410,6 +416,7 @@ INSERT INTO `ospos_grants` (`permission_id`, `person_id`) VALUES ('giftcards', 1), ('items', 1), ('item_kits', 1), +('messages', 1), ('receivings', 1), ('reports', 1), ('sales', 1), diff --git a/images/menubar/messages.png b/images/menubar/messages.png new file mode 100644 index 0000000000000000000000000000000000000000..4a582a0a37e9784b0b8f44a5c85e4026e8171da7 GIT binary patch literal 1155 zcmV-}1bq96P)|0G}6G0Sy-9{;;kO+z>LigND7Q~B}_S9<=4zYp;Sx@Yqx0L5iT= zUOh+(;zfl-!GovtB8bKACTW@`ZR))3q}|$Ne`aTACZ-P_O%FRW@0<7L{mh$*qoX5; zleSiK3*-;7L0Bi8_W7hrxJI}_xIFu)RE~3f6TAT+0;kBI4CN(G!)_2ZkqID{k^s=1 z&J)f-yi_7wAV5@<0Dua;jb+|<|aH6 zj)i05*evG2bOz89HMGs+&c{WJW2e2mL&C$)hYoPG%hP9e{{4r~@M3lCc%sB4%-*^Y zdi4+PEy5jR?nDz9DMw^72gM265W6q(*s;FwjvXHy!ftCX^cZVz-|QqRuq1kRJO}VRkVuZq+P{8LGzc;YWk(H=27m%FfdhacYj%tZF*=k;1_Gc;UApNoI@djYG z)fS!~AOKZW06^gp1c6jV0BR~}f#70E4FRaA1OOIG1m*`71fUFxkwBMN*5dBNW33a2 zI1Ewtz8Ba~5rmk@k-2|4ikF7m%VOrsXP_{d?l{1N@uO1!Xa_|}ouI;*JE1;sTySuevD3jEv{H#ArVa^F5)JnuGNHC-DUCub)E7`X1Hx^M2VN-V!tCr8_@9ISb{qTgN+J z--d5*o;zblNi$%;4fw!5LE0p>&N550eE>hLcrv=1sVSJ5O0a&O4b&t>4@8sIE#d-k zp_jA?Zi3@j5rr=e>m>K<6vfkW6#9cbj}9Wd;Z+dvq6L)-CM?2(&)sK`X6Y0ynv7zz zv_W>i=IN3Hq>LCc>LaEJxK`ay_&@--Ko}Ks2=!nh^qZlmfs%kECm-g6&}DHtK{iUT z6qCJY!wSy?fGbYWMW@iicAeTgQ%&RI;UveWvj&Z|MLeA?@+#(DJf0r+=ktFB7yw{{ V;NB
    '.to_currency( $sale['amount_tendered'] ).''.to_currency( $sale['amount_due'] ).''.to_currency( $sale['change_due'] ).''.$sale['payment_type'].''.$sale['invoice_number'].''.$sale['payment_type'].''.$sale['payment_type'].''.$sale['invoice_number'].'
    '.character_limiter($person->first_name,13).''.mailto($person->email,character_limiter($person->email,22)).''.character_limiter($person->phone_number,13).''.anchor('Messages'."/view/$person->person_id", '', array('class'=>"modal-dlg modal-btn-submit", 'title'=>$CI->lang->line('messages_send_msg'))).''.anchor($controller_name."/view/$person->person_id", '', array('class'=>"modal-dlg modal-btn-submit", 'title'=>$CI->lang->line($controller_name.'_update'))).'
    '.character_limiter($supplier->first_name,13).''.mailto($supplier->email,character_limiter($supplier->email,22)).''.character_limiter($supplier->phone_number,13).''.anchor('Messages'."/view/$supplier->person_id", '', array('class'=>'modal-dlg modal-btn-submit' , 'title'=>$CI->lang->line('messages_send_msg'))).''.character_limiter($supplier->person_id,5).''.anchor($controller_name."/view/$supplier->person_id", '', array('class'=>"modal-dlg modal-btn-submit",'title'=>$CI->lang->line($controller_name.'_update'))).'