-
Notifications
You must be signed in to change notification settings - Fork 13
N°5139 - Let data that is null also be null at the other side-fix #52
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
Open
odain-cbd
wants to merge
13
commits into
master
Choose a base branch
from
issue/5139-nullify
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8cc66f7
N°5139 - Let data that is null also be null at the other side-fix
odain-cbd 8125470
Correct composer php version according to documentation
Hipska 19c8c2b
Apply min versions according to composer.json restrictions
Hipska 8e2d46b
Revert phpunit version
Hipska bfa7e5e
Update composer.json
Hipska 72819ef
Create action.yml
jf-cbd fb21d01
N°7783 - Relative paths cannot beused when the collector is not launc…
xtophe38 c7b6b59
Update jsoncollector.class.inc.php
xtophe38 bdc1a4c
Fix N°7338 to actually use "itop_login"
Hipska d3427bc
Fix default date_format (#54)
Hipska 1fb29bc
N°5139 - molkobain suggestion
odain-cbd 0f856a6
N°5139 - test small cleanup
odain-cbd b03b0c3
fix phpunit
odain-cbd 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,43 @@ | ||
name: Add PRs to Combodo PRs Dashboard | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
|
||
jobs: | ||
add-to-project: | ||
name: Add PR to Combodo Project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check if author is a member of the organization | ||
id: check-membership | ||
run: | | ||
ORG="Combodo" | ||
AUTHOR=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH") | ||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \ | ||
"https://api.github.com/orgs/$ORG/members/$AUTHOR") | ||
if [ "$RESPONSE" == "404" ]; then | ||
echo "project_url=https://github.com/orgs/Combodo/projects/5" >> $GITHUB_ENV | ||
echo "is_member=false" >> $GITHUB_ENV | ||
else | ||
echo "project_url=https://github.com/orgs/Combodo/projects/4" >> $GITHUB_ENV | ||
echo "is_member=true" >> $GITHUB_ENV | ||
|
||
fi | ||
|
||
- name: Add internal tag if member | ||
if: env.is_member == 'true' | ||
run: | | ||
curl -X POST -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/Combodo/itop-data-collector-base/issues/${{ github.event.pull_request.number }}/labels \ | ||
-d '{"labels":["internal"]}' | ||
env: | ||
is_member: ${{ env.is_member }} | ||
|
||
- name: Add PR to the appropriate project | ||
uses: actions/add-to-project@v1.0.2 | ||
with: | ||
project-url: ${{ env.project_url }} | ||
github-token: ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"require": { | ||
"php": "7.*", | ||
"php": "7.* || 8.* <= 8.3", | ||
"ext-libxml": "*" | ||
}, | ||
"require-dev": { | ||
|
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
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
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
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
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
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
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
38 changes: 38 additions & 0 deletions
38
test/single_json/json_file_with_relative_path/dataTest.json
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,38 @@ | ||
{ | ||
"objects": { | ||
"Person::1": { | ||
"key": "1", | ||
"name": {"bob": "My last name"}, | ||
"status": "active", | ||
"org_id": "Blala", | ||
"email": "my.email@foo.org", | ||
"phone": "+00 000 000 000", | ||
"notify": "yes", | ||
"function": "", | ||
"first_nameyo": "My first name" | ||
}, | ||
"Person::2": { | ||
"key": "2", | ||
"name": {"bob": "Picasso"}, | ||
"status": "active", | ||
"org_id": "Demo", | ||
"email": "pablo@demo.com", | ||
"phone": "", | ||
"notify": "yes", | ||
"function": "", | ||
"first_nameyo": "Pablo" | ||
}, | ||
"Person::3": { | ||
"key": "3", | ||
"name": {"bob": "Dali"}, | ||
"status": "active", | ||
"email": "dali@demo.com", | ||
"phone": "", | ||
"notify": "yes", | ||
"function": "", | ||
"first_nameyo": "Salvador" | ||
} | ||
}, | ||
"code": 0, | ||
"message": "Found: 1" | ||
} |
4 changes: 4 additions & 0 deletions
4
test/single_json/json_file_with_relative_path/expected_generated.csv
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,4 @@ | ||
primary_key;name;status;first_name;email;phone;function;org_id | ||
1;"My last name";active;"My first name";my.email@foo.org;"+00 000 000 000";;Blala | ||
2;Picasso;active;Pablo;pablo@demo.com;123456789;;Demo | ||
3;Dali;active;Salvador;dali@demo.com;123456789;;Demo |
34 changes: 34 additions & 0 deletions
34
test/single_json/json_file_with_relative_path/params.distrib.xml
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,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Default values for parameters. Do NOT alter this file, use params.local.xml in the conf folder instead --> | ||
<parameters> | ||
<itoppersonjsoncollector> | ||
<jsonfile>collectors/dataTest.json</jsonfile> | ||
<path>objects/*</path> | ||
<fields> | ||
<primary_key>key</primary_key> | ||
<name>name/bob</name> | ||
<status>status</status> | ||
<first_name>first_nameyo</first_name> | ||
<email>email</email> | ||
<phone>phone</phone> | ||
<mobile_phone>mobile</mobile_phone> | ||
<function>function</function> | ||
<employee_number>employeenumber</employee_number> | ||
<org_id>org_id</org_id> | ||
</fields> | ||
<defaults> | ||
<org_id>Demo</org_id> | ||
<status>active</status> | ||
<phone>123456789</phone> | ||
</defaults> | ||
</itoppersonjsoncollector> | ||
<json_placeholders> | ||
<!-- For compatibility with the version 1.1.x of the collector, define the data table names as following: | ||
<prefix></prefix> | ||
<persons_data_table>synchro_data_PersonAD</persons_data_table> | ||
<users_data_table></users_data_table> | ||
--> | ||
<prefix>$prefix$</prefix> | ||
<persons_data_table>synchro_data_person_1</persons_data_table> | ||
</json_placeholders> | ||
</parameters> |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
primary_key;name;status;first_name;email;phone;org_id;function | ||
1;"My last name";active;"My first name";my.email@foo.org;"+00 000 000 000";1;<NULL> | ||
2;Picasso;active;Pablo;pablo@demo.com;;3; | ||
3;Dali;active;Salvador;dali@demo.com;;3; | ||
2;Picasso;active;Pablo;pablo@demo.com;;3;<NULL> | ||
3;Dali;active;Salvador;dali@demo.com;;3;<NULL> |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty string is not the same as
null
.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed yes.
untouched scenario:
for a field, either it is configured as "nullified", and both null or empty string will be sent as
<NULL>
during datasynchro, which will leave it with its previous value on iTop side (untouched).reset scenario:
otherwise same field (either null or empty string) will be sent during datasynchro as empty field. which will reset field value to default one.
for some iTop attributes this usecase is supported. for some others it is not. at the end you can decide what to do from collector side (per attribute xml configuration).
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, The whole thing is to be able to set a field's value as
NULL
in the SQL database, not reset, not ignore!So it seems it will still not work and Combodo still doesn't understand the needs.. 😢