Jump to content

ty0716

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by ty0716

  1. thank you ,but use post method still return same error. I found this can be success in order plugin,signup :$this->clients->create($vars); There are other ways to achieve registration by API, unless post data to a custom plugin then register?
  2. error: why this? <?php require_once "../blesta/blesta_api.php"; $user = "resller"; $key = "**********"; $url = "http://*********/api/"; $api = BlestaApi::getIns($url, $user, $key); $json='{"action":"signup","first_name":"\u9676","last_name":"\u96e8","company":"\u6c49\u53e3\u5b66\u9662","address1":"\u6c5f\u590f\u533a\u6587\u5316\u5927\u9053299\u53f7","address2":"16703","city":"\u6b66\u6c49\u5e02","country":"CN","state":"13","zip":"430070","numbers":[{"type":"phone","location":"work","number":"15527474844"},{"type":"fax","location":"work","number":"13396009700"}],"email":"hkxy99@163.com","tax_id":"95599","custom_field1":"424460883","username_type":"email","username":"","new_password":"qaz12345","confirm_password":"qaz12345","client_group_id":"1","settings":{"username_type":"email","tax_id":"95599","default_currency":null,"language":"en_us"},"custom":{"1":"424460883"}}'; $vars=json_decode($json,true); $response=$api->get('clients','create',$vars); print_r($response->response()); print_r($response->errors()); data: json->array: {"action":"signup","first_name":"\u9676","last_name":"\u96e8","company":"\u6c49\u53e3\u5b66\u9662","address1":"\u6c5f\u590f\u533a\u6587\u5316\u5927\u9053299\u53f7","address2":"16703","city":"\u6b66\u6c49\u5e02","country":"CN","state":"13","zip":"430070","numbers":[{"type":"phone","location":"work","number":"15527474844"},{"type":"fax","location":"work","number":"13396009700"}],"email":"hkxy99@163.com","tax_id":"95599","custom_field1":"424460883","username_type":"email","username":"","new_password":"qaz12345","confirm_password":"qaz12345","client_group_id":"1","settings":{"username_type":"email","tax_id":"95599","default_currency":null,"language":"en_us"},"custom":{"1":"424460883"}} Error: Internal error: Failed to retrieve the default valuestdClass Object ( [error] => stdClass Object ( [message] => An unexpected error occured. [response] => Internal error: Failed to retrieve the default value ) )
  3. Now i build a new user center base on blesta api.Simplifying a number of steps. In this site user can view invoices, so, how can i make this go to payment url? instead of redevelopment. my english is poor,May be expressed is not clear. thanks you.
  4. Hi, I want to achieve this function. When invoice payment is successful, and is pay for a service. Then post a json data to my other php url, like this {"client_id":1,"invoice_id":9,time:"2015-09-15 10:14:33",amount:"","service_id":13} How can this be achieved?
  5. I find in this : http://dev.blesta.com/browse/CORE-639 http://www.blesta.com/forums/index.php?/topic/2173-price-tiers/ This is still not achieved? for example, set in a group for some customers buy more frequently. When they buy automatic discount. Not use Coupon,this is not what I want, nor is it a good solution.Because such a group to go to a setting, and to inform the customer coupon code. Or what plugins to achieve?If the self-development seems to modify many system files are not easy to upgrade.in addition,I'm not very understanding blesta. Do you have any good suggestions to me?
  6. I found the recharge input 99999999999999999999999999999999999999 ......etc, And a large enough amount of my payment gateway would return parameter error.
  7. Now is the order option has no language change, because the database has been in the. But this is not all people can understand. I think of two ways. 1.Enter different languages in the label or name. 2.The label or name as an array of keys.
  8. Now only use client or admin setting to switch language. But unable to switch the language without the user logged in. It seems less friendly.When the user is not the default language may not understand the order information.
  9. why i not display add link button? and this can't edit exit system menu.
  10. I find when a plugin install, this navigation link name seems Fixed in database plugin_action table. It doesn't look very friendly.This can cause multiple languages to be invalid when language change if exist multiple languages. And one plugin not permit create More than one client navigation links?
  11. Sounds good。 Does this plugin need to modify the template file?
  12. for example,support_managepro plugin. when staff reply it will send a email to this client,i need to capture this event and send a sms? At the same time,when service Expire system would send a email, i need to send a sms Together. Is there a way to do this? Thank you.
  13. Is there such a plugins? I need to manage all of the menu like wordpress,There may be outside url. If not,Did you have any good suggestions? They are as follows: 1.menu add,edit,add,Whether to hide,Submenu 2.Sequence 3.Whether it is outside the chain. Another problem is: if i $this->set("value",$value); in plugins ,How to use this variable in the dashboard?
  14. alipay intro:http://global.alipay.com gateway notify_url: http://billing.domain.com/callback/gw/1/alipay/?client_id=1 which method use to check is paid? and then change this order status?
  15. as the picture shows,i want to echo total amount_due in client_main.pdt file,but not modify system files.Because it is not conducive to update. I used a very primitive way: <?php if(isset($message)){ $pa = '%<p>(.*?)</p>%sim'; preg_match($pa, trim($message), $arr); preg_match('/.\d{1,}.\d{1,2}/', $arr[1], $arr); $total_due=$arr[0]; }else{ $total_due='0.00'; } ?>
  16. As shown in figure: this client dashboard Widgets orign is show Invoices , Services and transactions. but now i need to change transactions to ticket. this ticket is support_mange plugin. I don't know how to add to dashboard. Then i change app/client_controller.php protected function clientWidgets(): protected function clientWidgets() { $widgets = array(); $widget_location = null; switch ($this->controller) { case "client_main": $widget_location = "widget_client_home"; // Set the default widgets to appear $widgets = array( 'client_invoices'=>array('uri'=>$this->base_uri . "invoices/?whole_widget=true"), 'client_services'=>array('uri'=>$this->base_uri . "services/?whole_widget=true"), 'client_tickets'=>array('uri'=>$this->base_uri . "plugin/support_manager/client_tickets/index/not_closed/"), /*'client_transactions'=>array('uri'=>$this->base_uri . "transactions/?whole_widget=true")*/ ); break; } but this not display title ,then i change $this->WidgetClient->create($this->_("ClientTickets.index.boxtitle_tickets", true), array('id'=>"client_tickets"),null); //or $this->WidgetClient->create($this->_("ClientTickets.index.boxtitle_tickets", true), array('id'=>"client_tickets"),"full"); It can display title, but click Open or Closed will display 2 panel-title. How should I solve this problem? I see invoces and services ajax return "{"replacer":null,"content":"\n\t\t\t\n\t\t\t\t<div id=\"client_invoices\" class=\"panel panel-blesta content_section\" but my ticket widgets ajax return "{"replacer":".panel_content","content":"\t\t\t<script type=\"text\/javascript\">\n$(document).blestaSetHeadTag(\"link\",";
  17. My solution: change websiteroot//app/client_controller.php on line:69 to→→ $widgets = array( 'client_invoices'=>array('uri'=>$this->base_uri . "invoices/?whole_widget=true"), 'client_services'=>array('uri'=>$this->base_uri . "services/?whole_widget=true"), 'client_tickets'=>array('uri'=>$this->base_uri . "plugin/support_manager/client_tickets/index/not_closed/")/*, 'client_transactions'=>array('uri'=>$this->base_uri . "transactions/?whole_widget=true")*/ ); Then if find this problem.Not show support tickets title Followed by a variety of search.I see a topic http://www.blesta.com/forums/index.php?/topic/3669-client-widget-render/ change /plugins/support_manager/views/default/client_tickets.pdt on line:22 $this->WidgetClient->create($this->_("ClientTickets.index.boxtitle_tickets", true), array('id'=>"client_tickets"),null); // $this->Html->ifSet($render_section, null) Perfect solution. ====================================================================================== As shown in Figure: in http://domain.com/client/main, this is ajax load. Now i want to remove "Transactions" area. or Replace "Transactions" to "ticket". How to do this?
  18. In "plugins/support_managerpro/controllers/client_tickets.php" Line:181 and 334 $this->SupportManagerproTickets->sendEmail($reply_id); to //$this->SupportManagerproTickets->sendEmail($reply_id); In "plugins/support_managerpro/models/support_managerpro_tickets.php" On line 468 change: // Return the ID of the reply to $this->sendEmail($reply_id); // Return the ID of the reply ================================================================================= I find use api create ticket or reply ticket seems to no email send. because sendEmail() in controller and some is private method,but api call the model.How to solve this problem? If there is not,whether through the API to send mail and choose a template?
  19. resolvent : $reply_data = array( 'ticket_id'=>9, 'vars' => array( 'ticket_id'=>9, 'staff_id' => null, // the reply is from this staff user 'client_id' => 2, // the reply is from this client user 'contact_id' => null, // the reply is from this client contact user 'type' => "reply", // this is a ticket reply 'details' => "API reply", // the ticket reply description 'status' => "open", // status of the ticket 'staff_id' => null, // the staff user the ticket is assigned to ), 'files' => null, 'new_ticket' => false // this reply is for a newly created ticket ); $response = $api->post("support_managerpro.support_managerpro_tickets", "addReply", $reply_data); ================================================================================================================================= Now i need to use api reply tickets. But I've had some problems. This is my code: $vars=array('ticket_id'=>9,'details'=>'API回复工单','action_type'=>'reply','type'=>'reply','staff_id'=>null,'contact_id'=>null,'status'=>'open'); $ticket= $api->post("support_managerpro.support_managerpro_tickets", "addReply",array("ticket_id"=>9,$vars)); print_r($ticket->raw()); when i use $ticket= $api->post("support_managerpro.support_managerpro_tickets", "addReply",array("ticket_id"=>9,$vars)); this page return {"message":"An unexpected error occured.","response":"Internal error: Failed to retrieve the default value"} when i use $ticket= $api->get("support_managerpro.support_managerpro_tickets", "addReply",array("ticket_id"=>9,$vars)); this page return this error info:{"message":"The requested resource does not exist.","response":null} What should I do to use API to achieve a reply?thanks! support_managerpro:: Model's addReply method(): /** * Adds a reply to a ticket. If ticket data (e.g. department_id, status, priority, summary) have changed * then this will also invoke SupportManagerproTickets::edit() to update the ticket, and record any log entries. * * Because of this functionality, this method is assumed to (and should) already be in a transaction when called, * and SupportManagerproTickets::edit() should not be called separately. * * @param int $ticket_id The ID of the ticket to reply to * @param array $vars A list of reply vars, including: * - staff_id The ID of the staff member this reply is from (optional) * - client_id The ID of the client this reply is from (optional) * - contact_id The ID of a client's contact that this reply is from (optional) * - type The type of reply (i.e. "reply, "note", "log") (optional, default "reply") * - details The details of the ticket (optional) * - department_id The ID of the ticket department (optional) * - summary The ticket summary (optional) * - priority The ticket priority (optional) * - status The ticket status (optional) * - ticket_staff_id The ID of the staff member the ticket is assigned to (optional) * @param array $files A list of file attachments that matches the global FILES array, which contains an array of "attachment" files * @param boolean $new_ticket True if this reply is apart of ticket being created, false otherwise (default false) * @return int The ID of the ticket reply on success, void on error */ public function addReply($ticket_id, array $vars, array $files = null, $new_ticket = false) { $vars['ticket_id'] = $ticket_id; $vars['date_added'] = date("c"); if (!isset($vars['type'])) $vars['type'] = "reply"; // Remove reply details if it contains only the signature if (isset($vars['details']) && isset($vars['staff_id'])) { if (!isset($this->SupportManagerproStaff)) Loader::loadModels($this, array("SupportManagerpro.SupportManagerproStaff")); $staff_settings = $this->SupportManagerproStaff->getSettings($vars['staff_id'], Configure::get("Blesta.company_id")); if (isset($staff_settings['signature']) && trim($staff_settings['signature']) == trim($vars['details'])) $vars['details'] = ""; } // Determine whether or not options have changed that need to be logged $log_options = array(); // "status" should be the last element in case it is set to closed, so it will be the last log entry added $loggable_fields = array('department_id' => "department_id", 'ticket_staff_id' => "staff_id", 'summary' => "summary", 'priority' => "priority", 'status' => "status"); if (!$new_ticket && (isset($vars['department_id']) || isset($vars['summary']) || isset($vars['priority']) || isset($vars['status']) || isset($vars['ticket_staff_id']))) { if (($ticket = $this->get($ticket_id, false))) { // Determine if any log replies need to be made foreach ($loggable_fields as $key => $option) { // Save to be logged iff the field has been changed if (isset($vars[$key]) && property_exists($ticket, $option) && $ticket->{$option} != $vars[$key]) $log_options[] = $key; } } } // Check whether logs are being added simultaneously, and if so, do not // add a reply iff no reply details, nor files, are attached // i.e. allow log entries to be added without a reply/note regardless of vars['type'] $skip_reply = false; if (!empty($log_options) && empty($vars['details']) && (empty($files) || empty($files['attachment']['name'][0]))) $skip_reply = true; if (!$skip_reply) { $this->Input->setRules($this->getReplyRules($vars, $new_ticket)); if ($this->Input->validates($vars)) { // Create the reply $fields = array("ticket_id", "staff_id", "contact_id", "type", "details", "date_added"); $this->Record->insert("support_repliespro", $vars, $fields); $reply_id = $this->Record->lastInsertId(); // Update reply ticket status to awaiting_reply if replyed by staff if (isset($vars['staff_id'])){ if ($vars['staff_id'] > 0 && $vars['type'] == "reply" && $vars['status'] != "awaiting_reply"){ $this->edit($vars['ticket_id'], array('status' => "awaiting_reply")); } } // Handle file upload if (!empty($files['attachment'])) { Loader::loadComponents($this, array("SettingsCollection", "Upload")); // Set the uploads directory $temp = $this->SettingsCollection->fetchSetting(null, Configure::get("Blesta.company_id"), "uploads_dir"); $upload_path = $temp['value'] . Configure::get("Blesta.company_id") . DS . "support_managerpro_files" . DS; $this->Upload->setFiles($files, false); $this->Upload->setUploadPath($upload_path); $file_vars = array('files' => array()); if (!($errors = $this->Upload->errors())) { // Will not overwrite existing file $this->Upload->writeFile("attachment", false, null, array($this, "makeFileName")); $data = $this->Upload->getUploadData(); // Set the file names/paths foreach ($files['attachment']['name'] as $index => $file_name) { if (isset($data['attachment'][$index])) { $file_vars['files'][] = array( 'name' => $data['attachment'][$index]['orig_name'], 'file_name' => $data['attachment'][$index]['full_path'] ); } } $errors = $this->Upload->errors(); } // Error, could not upload the files if ($errors) { $this->Input->setErrors($errors); // Attempt to remove the files if they were somehow written foreach ($file_vars['files'] as $files) { if (isset($files['file_name'])) @unlink($files['file_name']); } return; } else { // Add the attachments $file_fields = array("reply_id", "name", "file_name"); foreach ($file_vars['files'] as $files) { if (!empty($files)) $this->Record->insert("support_attachmentspro", array_merge($files, array('reply_id' => $reply_id)), $file_fields); } } } } } // Only attempt to update log options if there are no previous errors if (!empty($log_options) && !$this->errors()) { // Update the support ticket $data = array_intersect_key($vars, $loggable_fields); $ticket_staff_id_field = array(); if (isset($data['ticket_staff_id'])) $ticket_staff_id_field = (isset($data['ticket_staff_id']) ? array('staff_id' => $data['ticket_staff_id']) : array()); $this->edit($ticket_id, array_merge($data, $ticket_staff_id_field), false); if (!($errors = $this->errors())) { // Log each support ticket field change foreach ($log_options as $field) { $log_vars = array( 'staff_id' => (array_key_exists("staff_id", $vars) ? $vars['staff_id'] : $this->system_staff_id), 'type' => "log" ); $lang_var1 = ""; switch ($field) { case "department_id": $department = $this->Record->select("name")->from("support_departmentspro")-> where("id", "=", $vars['department_id'])->fetch(); $lang_var1 = ($department ? $department->name : ""); break; case "priority": $priorities = $this->getPriorities(); $lang_var1 = (isset($priorities[$vars['priority']]) ? $priorities[$vars['priority']] : ""); break; case "status": $statuses = $this->getStatuses(); $lang_var1 = (isset($statuses[$vars['status']]) ? $statuses[$vars['status']] : ""); break; case "ticket_staff_id": if (!isset($this->Staff)) Loader::loadModels($this, array("Staff")); $staff = $this->Staff->get($vars['ticket_staff_id']); if ($vars['ticket_staff_id'] && $staff) $lang_var1 = $staff->first_name . " " . $staff->last_name; else $lang_var1 = Language::_("SupportManagerproTickets.log.unassigned", true); default: break; } $log_vars['details'] = Language::_("SupportManagerproTickets.log." . $field, true, $lang_var1); $this->addReply($ticket_id, $log_vars); } } } // Return the ID of the reply if (isset($reply_id)) return $reply_id; }
  20. I need to change the title of the plugin to display in the client page. $response = $api->get("support_manager.support_manager_departments", "get", array('department_id' => 1)); Is this method also can be used for open ticket?
  21. 1: Can i user Record->select() method in plugin's controller? if use $this->Record->select()->from("clients"); then this page return 500. or this need to add some use("") ? Or can only be used in the plugin's model to database query? 2:How can i use API to achieve some plugin's method or model function? 3:I want to custom plugin's page title. THS!
  22. Yes, i have anther site, and i want to user login this site,then i can know this user's input whether correct.If true return client_id.
×
×
  • Create New...