Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Detailed Input Value References in DocumentBuilder #65

Closed
OLLIVAULT opened this issue May 29, 2024 · 3 comments
Closed

[FEATURE] Detailed Input Value References in DocumentBuilder #65

OLLIVAULT opened this issue May 29, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@OLLIVAULT
Copy link
Contributor

OLLIVAULT commented May 29, 2024

Describe the feature
Would it be possible for the DocumentBuilder to include the corresponding BT-XX for each input value? Indeed, it is not always easy to find them. Additionally, could you indicate for which profile it is called and if this value is required for the profile(s) in question ?

Sample Code

/**
     * Set grouping of business process information
     *
     * @param string $id // BT-23 (all-profile -> require = true)
     * Identifies the context of a business process where the transaction is taking place, thus allowing the buyer to
     * process the invoice in an appropriate manner.
     * __Note__: These data make it possible to define the purpose of the settlement (invoice of the authorised person,
     * contractual partner, subcontractor, settlement document for a building contract etc.).
     * @return ZugferdDocumentBuilder
     */
    public function setDocumentBusinessProcess(string $id): ZugferdDocumentBuilder
    {
        if ($this->getObjectHelper()->isNullOrEmpty($id)) {
            return $this;
        }

        $busProcessCtxParameter = $this->getObjectHelper()->createClassInstance('ram\DocumentContextParameterType');
        $this->getObjectHelper()->tryCall($busProcessCtxParameter, 'setID', $this->getObjectHelper()->getIdType($id));
        $this->getObjectHelper()->tryCall($this->getInvoiceObject()->getExchangedDocumentContext(), 'setBusinessProcessSpecifiedDocumentContextParameter', $busProcessCtxParameter);

        return $this;
    }
@OLLIVAULT OLLIVAULT added the enhancement New feature or request label May 29, 2024
@horstoeko
Copy link
Owner

Hi @OLLIVAULT,

Thanks first of all for the issue. This is a lot of work and I can't promise that it can be done in the next few days/weeks. Basically, however, it doesn't matter which profile the function/method applies to. The approach of the library is that you don't have to worry about the profiles (and the methods to be called). However, the idea with the BT-* is good in that you can find the required methods (and therefore also the parameters) more quickly. As I said, a lot of work. If you want to support me, I would be very happy. I'm very busy at work at the moment and don't know when I'll find the time.

Best regards....

@OLLIVAULT
Copy link
Contributor Author

dans

Hi horstoeko,

First of all, I want to thank you immensely for all the work you've done. You've saved me an enormous amount of time, and I would be happy to help you out. Just give me an example of how you'd like me to set it up.

@horstoeko
Copy link
Owner

Hi @OLLIVAULT,

Many, many thanks for the praise and appreciation. I really enjoy reading (and hearing) that.

I think we should follow the example below:

/**
 * Set grouping of business process information
 *
 * @param string $id
 * __BT23, All Profiles__: Identifies the context of a business process where the transaction is taking place, thus allowing the buyer to
 * process the invoice in an appropriate manner.
 * __Note__: These data make it possible to define the purpose of the settlement (invoice of the authorised person,
 * contractual partner, subcontractor, settlement document for a building contract etc.).
 * @return ZugferdDocumentBuilder
 */
public function setDocumentBusinessProcess(string $id): ZugferdDocumentBuilder
{
    if ($this->getObjectHelper()->isNullOrEmpty($id)) {
        return $this;
    }

    $busProcessCtxParameter = $this->getObjectHelper()->createClassInstance('ram\DocumentContextParameterType');
    $this->getObjectHelper()->tryCall($busProcessCtxParameter, 'setID', $this->getObjectHelper()->getIdType($id));
    $this->getObjectHelper()->tryCall($this->getInvoiceObject()->getExchangedDocumentContext(), 'setBusinessProcessSpecifiedDocumentContextParameter', $busProcessCtxParameter);

    return $this;
}

So: The BT rule at the very beginning, then a reference to the profiles separated by a comma.

Is that sufficient from your point of view?

Best regards...

Repository owner locked as resolved and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants