Run PHP script from the CRM page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Roman
    Junior Member
    • Jul 2023
    • 3

    Run PHP script from the CRM page

    Hi everybody!
    I'm a new member of EspoCRM. Maybe this topic was on the forum, but I don't find it.
    Help me please.
    I need read signature from PDFs. I written a PHP script. And don't know, how can i run this script from CRM page.
    Thanks a lot.​
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    what do you mean ? where did you write your PHP script ? the pdf file belongs to which entity ?
    Rabii
    Web Dev

    Comment

    • Roman
      Junior Member
      • Jul 2023
      • 3

      #3
      Originally posted by rabii
      what do you mean ? where did you write your PHP script ? the pdf file belongs to which entity ?
      A file is uploaded to the system and I must to display who signed the file and who didn't.

      I created a file SignCheck.php at espo/custom/Espo/Modules/SignCheck/Resources
      Now I need to call the script to display the signatures.​

      Comment

      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #4
        first you need to understand how metadata works in espocrm. you can't just create a php file and call you need to respect the conventions. the file that gets uploaded to the system must be linked to an entity you can't just have a file field without a entity, therefore you custom code should be applied to the entity that has the file field. you can create an action in a controller and create a custom view for your file field or for the entity that holds the file and then when the file is uploaded submit a request to your controller to process the request and do what you need.
        Rabii
        Web Dev

        Comment

        • Roman
          Junior Member
          • Jul 2023
          • 3

          #5
          Originally posted by rabii
          first you need to understand how metadata works in espocrm. you can't just create a php file and call you need to respect the conventions. the file that gets uploaded to the system must be linked to an entity you can't just have a file field without a entity, therefore you custom code should be applied to the entity that has the file field. you can create an action in a controller and create a custom view for your file field or for the entity that holds the file and then when the file is uploaded submit a request to your controller to process the request and do what you need.

          Thanks for answer.
          I know how create a controller. But i don't know how call the controller from site page.
          Explain me please how to call a controller from button on site or trigger. Or give site with this topic.
          Thanks a lot.​​

          Comment

          • rabii
            Active Community Member
            • Jun 2016
            • 1250

            #6
            Here is an example from the crm when sending invitations for a meeting. The user click on the button send open the modal and model send the request to the back end controller to process the request. check this out https://github.com/espocrm/espocrm/b...ations.js#L167 and here is the method on the controller https://github.com/espocrm/espocrm/b...eeting.php#L59
            Rabii
            Web Dev

            Comment

            Working...