-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - dolibarr #17030
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
Merged
Merged
New Components - dolibarr #17030
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ef60a95
new components
michelle0927 7c623ed
pnpm-lock.yaml
michelle0927 d2d89d4
updates
michelle0927 f069651
update
michelle0927 4ccf604
pnpm-lock.yaml
michelle0927 1b5b589
Merge remote-tracking branch 'origin/master' into issue-16920
michelle0927 be16599
pnpm-lock.yaml
michelle0927 1e20eb1
pnpm-lock.yaml
michelle0927 48770d2
updates
michelle0927 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import dolibarr from "../../dolibarr.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "dolibarr-create-order", | ||
| name: "Create Order", | ||
| description: "Create a new order in Dolibarr.", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| dolibarr, | ||
| thirdPartyId: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "thirdPartyId", | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "The date of the order in YYYY-MM-DD format", | ||
| }, | ||
| deliveryDate: { | ||
| type: "string", | ||
| label: "Delivery Date", | ||
| description: "The expecteddelivery date of the order in YYYY-MM-DD format", | ||
| optional: true, | ||
| }, | ||
| paymentMethodCode: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "paymentMethodCode", | ||
| ], | ||
| }, | ||
| paymentTermCode: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "paymentTermCode", | ||
| ], | ||
| }, | ||
| notePublic: { | ||
| type: "string", | ||
| label: "Note Public", | ||
| description: "A public note to add to the order", | ||
| optional: true, | ||
| }, | ||
| notePrivate: { | ||
| type: "string", | ||
| label: "Note Private", | ||
| description: "A private note to add to the order", | ||
| optional: true, | ||
| }, | ||
| additionalProperties: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "additionalProperties", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.dolibarr.createOrder({ | ||
| $, | ||
| data: { | ||
| socid: this.thirdPartyId, | ||
| date: Date.parse(this.date) / 1000, | ||
| deliverydate: this.deliveryDate | ||
| ? Date.parse(this.deliveryDate) / 1000 | ||
| : undefined, | ||
| mode_reglement_code: this.paymentMethodCode, | ||
| cond_reglement_code: this.paymentTermCode, | ||
| note_public: this.notePublic, | ||
| note_private: this.notePrivate, | ||
| ...parseObject(this.additionalProperties), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created order ${response}`); | ||
| return response; | ||
| }, | ||
| }; | ||
70 changes: 70 additions & 0 deletions
70
components/dolibarr/actions/create-thirdparty/create-thirdparty.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import dolibarr from "../../dolibarr.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "dolibarr-create-thirdparty", | ||
| name: "Create Third Party", | ||
| description: "Create a new third party in Dolibarr.", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| dolibarr, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the third party", | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the third party", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the third party", | ||
| optional: true, | ||
| }, | ||
| streetAddress: { | ||
| type: "string", | ||
| label: "Street Address", | ||
| description: "The street address of the third party", | ||
| optional: true, | ||
| }, | ||
| zip: { | ||
| type: "string", | ||
| label: "Zip", | ||
| description: "The zip code of the third party", | ||
| optional: true, | ||
| }, | ||
| town: { | ||
| type: "string", | ||
| label: "Town", | ||
| description: "The city or town of the third party", | ||
| optional: true, | ||
| }, | ||
| additionalProperties: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "additionalProperties", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.dolibarr.createThirdParty({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| email: this.email, | ||
| phone: this.phone, | ||
| address: this.streetAddress, | ||
| zip: this.zip, | ||
| town: this.town, | ||
| ...parseObject(this.additionalProperties), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created third party with ID${response}`); | ||
| return response; | ||
| }, | ||
| }; |
105 changes: 105 additions & 0 deletions
105
components/dolibarr/actions/create-user/create-user.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import dolibarr from "../../dolibarr.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "dolibarr-create-user", | ||
| name: "Create User", | ||
| description: "Create a new user in Dolibarr.", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| dolibarr, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The first name of the user", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The last name of the user", | ||
| }, | ||
| login: { | ||
| type: "string", | ||
| label: "Login", | ||
| description: "The login name of the user. Must be unique.", | ||
| }, | ||
| password: { | ||
| type: "string", | ||
| label: "Password", | ||
| description: "The password of the user", | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the user", | ||
| optional: true, | ||
| }, | ||
| officePhone: { | ||
| type: "string", | ||
| label: "Office Phone", | ||
| description: "The office phone number of the user", | ||
| optional: true, | ||
| }, | ||
| jobPosition: { | ||
| type: "string", | ||
| label: "Job Position", | ||
| description: "The job position of the user", | ||
| optional: true, | ||
| }, | ||
| isAdmin: { | ||
| type: "boolean", | ||
| label: "Is Admin", | ||
| description: "Whether the user is an administrator", | ||
| optional: true, | ||
| }, | ||
| streetAddress: { | ||
| type: "string", | ||
| label: "Street Address", | ||
| description: "The street address of the user", | ||
| optional: true, | ||
| }, | ||
| zip: { | ||
| type: "string", | ||
| label: "Zip", | ||
| description: "The zip code of the user", | ||
| optional: true, | ||
| }, | ||
| town: { | ||
| type: "string", | ||
| label: "Town", | ||
| description: "The city or town of the user", | ||
| optional: true, | ||
| }, | ||
| additionalProperties: { | ||
| propDefinition: [ | ||
| dolibarr, | ||
| "additionalProperties", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.dolibarr.createUser({ | ||
| $, | ||
| data: { | ||
| firstname: this.firstName, | ||
| lastname: this.lastName, | ||
| login: this.login, | ||
| password: this.password, | ||
| email: this.email, | ||
| office_phone: this.officePhone, | ||
| job: this.jobPosition, | ||
| admin: this.isAdmin | ||
| ? 1 | ||
| : 0, | ||
| address: this.streetAddress, | ||
| zip: this.zip, | ||
| town: this.town, | ||
| ...parseObject(this.additionalProperties), | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created user ${response}`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| export function parseObject(obj) { | ||
| if (!obj) { | ||
| return {}; | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| if (Array.isArray(obj)) { | ||
| return obj.map(parseObject); | ||
| } | ||
| if (typeof obj === "object") { | ||
| return Object.fromEntries( | ||
| Object.entries(obj).map(([ | ||
| key, | ||
| value, | ||
| ]) => [ | ||
| key, | ||
| parseObject(value), | ||
| ]), | ||
| ); | ||
| } | ||
| return obj; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.