Jump to content

Syleron

Members
  • Posts

    19
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    Syleron reacted to Adam in Plugin API Request - Support Manager   
    Syleron,
    This is a bug within Blesta and more so with minPHP. Great find.
     
    The issue is within app/controllers/api.php in the preAction function. The function tries to load the model from the url: support_manager.support_manager_tickets. 
    app/controllers/api.php // Ensure that the request is formatted correctly if (isset($this->get[0]) && isset($this->get[1])) { $this->model = Loader::toCamelCase($this->get[0]); It calls Loader:toCamelCase which returns
    SupportManager.supportManagerTickets
    What is expected is the following format:
    SupportManager.SupportManagerTickets
    On the surface this should not have caused an issue as if you called a function like get_declared_classes() it would show up as a class that was loaded. However, the problem is the case sensitive does manner when the api class calls method_exists and Router::isCallable. The minPHP function toCamelCase does not account for periods in its algorithm.
    /** * Convert a string to "CamelCase" from "file_case" * * @param string $str the string to convert * @return string the converted string */ public static function toCamelCase($str) { if (isset($str[0])) { $str[0] = strtoupper($str[0]); } return preg_replace_callback( '/_([a-z])/', function ($c) { return strtoupper($c[1]); }, $str ); }  
     
    The Blesta team will have a permanent fix in place as there are many ways to solve this. For now, the below patch file will get things working on your end. Apply the following patch file with patch(1):
    --- app/controllers/api.php 2017-03-14 10:23:18.000000000 -0700 +++ app/controllers/api.php 2017-07-05 21:35:18.337455862 -0700 @@ -68,7 +68,7 @@ // Ensure that the request is formatted correctly if (isset($this->get[0]) && isset($this->get[1])) { - $this->model = Loader::toCamelCase($this->get[0]); + $this->model = str_replace('_', '', ucwords($this->get[0], '_.')); $this->model_name = Loader::toCamelCase( strpos($this->model, '.') !== false ? ltrim(strrchr($this->model, '.'), '.') -Adam
  2. Like
    Syleron got a reaction from serge in How To Rearrange The Widgets On The Client Dashboard.   
    This is hardly the best way of doing it but it works. (Don't judge me )
     
    In /app/views/client/bootstrap/javascript/jquery-client-3.2.0.js method blestaLoadWidget find:
    var temp = $(data.content); after it put the following:
    // Append the widget to the page if (data.content.indexOf("services") >= 0)     $(container).prepend(temp); else     $(container).append(temp); That's it!
     
    edit: forgot to mention which method to change lol
  3. Like
    Syleron got a reaction from Blesta Addons in How To Rearrange The Widgets On The Client Dashboard.   
    This is hardly the best way of doing it but it works. (Don't judge me )
     
    In /app/views/client/bootstrap/javascript/jquery-client-3.2.0.js method blestaLoadWidget find:
    var temp = $(data.content); after it put the following:
    // Append the widget to the page if (data.content.indexOf("services") >= 0)     $(container).prepend(temp); else     $(container).append(temp); That's it!
     
    edit: forgot to mention which method to change lol
  4. Like
    Syleron got a reaction from Michael in How To Rearrange The Widgets On The Client Dashboard.   
    This is hardly the best way of doing it but it works. (Don't judge me )
     
    In /app/views/client/bootstrap/javascript/jquery-client-3.2.0.js method blestaLoadWidget find:
    var temp = $(data.content); after it put the following:
    // Append the widget to the page if (data.content.indexOf("services") >= 0)     $(container).prepend(temp); else     $(container).append(temp); That's it!
     
    edit: forgot to mention which method to change lol
  5. Like
    Syleron got a reaction from Michael in Override Service Renewal Date.   
    I don't believe this is currently possible through the web interface.
     
    I would like the ability to manually set/change the renewal date for a service.
     
    Cheers,
    Andrew
     
    EDIT:
     
    I just noticed the ability to change renewal date under the actions dropdown when modifying a service.
     
    My apologies.
×
×
  • Create New...