Merge pull request #17820 from frederic34/zapier_create_thirdparty

test zapier
This commit is contained in:
Laurent Destailleur 2021-06-05 00:47:53 +02:00 committed by GitHub
commit 91d2e30cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 4 deletions

View File

@ -6,7 +6,7 @@ const createThirdparty = async (z, bundle) => {
const response = await z.request({
method: 'POST',
url: apiurl,
body: JSON.stringify({
body: {
name: bundle.inputData.name,
name_alias: bundle.inputData.name_alias,
ref_ext: bundle.inputData.ref_ext,
@ -24,7 +24,7 @@ const createThirdparty = async (z, bundle) => {
code_client: bundle.inputData.code_client,
code_fournisseur: bundle.inputData.code_fournisseur,
sens: 'fromzapier'
})
}
});
const result = z.JSON.parse(response.content);
// api returns an integer when ok, a json when ko

View File

@ -15,7 +15,7 @@
"npm": ">=5.6.0"
},
"dependencies": {
"zapier-platform-core": "11.0.0"
"zapier-platform-core": "11.0.1"
},
"devDependencies": {
"mocha": "^5.2.0",

View File

@ -56,6 +56,12 @@ const getThirdparty = (z, bundle) => {
fournisseur: bundle.cleanedRequest.fournisseur,
code_client: bundle.cleanedRequest.code_client,
code_fournisseur: bundle.cleanedRequest.code_fournisseur,
idprof1: bundle.cleanedRequest.idprof1,
idprof2: bundle.cleanedRequest.idprof2,
idprof3: bundle.cleanedRequest.idprof3,
idprof4: bundle.cleanedRequest.idprof4,
idprof5: bundle.cleanedRequest.idprof5,
idprof6: bundle.cleanedRequest.idprof6,
authorId: bundle.cleanedRequest.authorId,
createdAt: bundle.cleanedRequest.createdAt,
action: bundle.cleanedRequest.action
@ -170,7 +176,13 @@ module.exports = {
{key: 'client', label: 'Customer/Prospect 0/1/2/3'},
{key: 'fournisseur', label: 'Supplier 0/1'},
{key: 'code_client', label: 'Customer code'},
{key: 'code_fournisseur', label: 'Supplier code'}
{key: 'code_fournisseur', label: 'Supplier code'},
{key: 'idprof1', label: 'Id Prof 1'},
{key: 'idprof2', label: 'Id Prof 2'},
{key: 'idprof3', label: 'Id Prof 3'},
{key: 'idprof4', label: 'Id Prof 4'},
{key: 'idprof5', label: 'Id Prof 5'},
{key: 'idprof6', label: 'Id Prof 6'}
]
}
};