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

unify categories #25269

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
2e14655
unify categories
frederic34 Jul 4, 2023
f1cdfef
unify categories
frederic34 Jul 4, 2023
8177758
unify categories
frederic34 Jul 4, 2023
d65ac69
unify categories
frederic34 Jul 4, 2023
f5b3fee
unify categories
frederic34 Jul 4, 2023
be7b6b2
unify categories
frederic34 Jul 4, 2023
d4cf3a4
unify categories
frederic34 Jul 5, 2023
b46a48d
unify categories
frederic34 Jul 5, 2023
b48eb4d
unify categories
frederic34 Jul 5, 2023
4e2c53f
unify categories
frederic34 Jul 5, 2023
d39dd4b
unify categories
frederic34 Jul 5, 2023
79b3ee8
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 6, 2023
a6e00a1
wip
frederic34 Jul 7, 2023
bf7b40f
wip unify categories
frederic34 Jul 7, 2023
b564b68
unify categories
frederic34 Jul 7, 2023
184b033
unify categories
frederic34 Jul 7, 2023
6a446bd
fetch data from llx_element_category
frederic34 Jul 7, 2023
3e331ea
fetch data from llx_element_category
frederic34 Jul 7, 2023
c25dbee
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 13, 2023
cf56f0a
sql changes
frederic34 Jul 13, 2023
eb229ae
sql changes
frederic34 Jul 13, 2023
265f2b8
sql changes
frederic34 Jul 13, 2023
2f7f28e
sql changes
frederic34 Jul 13, 2023
ca46bf0
wip
frederic34 Jul 16, 2023
b30204c
wip
frederic34 Jul 16, 2023
cf9df40
Fix php 8 list.php (#25363)
ptibogxiv Jul 16, 2023
97a20bb
Add missing Canadian territories (#25364)
mc2contributor Jul 16, 2023
3b6964c
Add 'name' property for fetching user's name (#25359)
mc2contributor Jul 16, 2023
d366102
wip
frederic34 Jul 17, 2023
b1ff766
wip
frederic34 Jul 17, 2023
a02dc90
wip
frederic34 Jul 17, 2023
7c00e34
wip
frederic34 Jul 18, 2023
7172c65
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 18, 2023
1539510
wip
frederic34 Jul 18, 2023
a8d8429
wip
frederic34 Jul 18, 2023
f277bcb
wip
frederic34 Jul 18, 2023
067b9df
wip
frederic34 Jul 19, 2023
893cca9
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 19, 2023
971eebe
fix merge
frederic34 Jul 19, 2023
d878ce0
wip
frederic34 Jul 19, 2023
e437171
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 25, 2023
54c3a9d
wip
frederic34 Jul 26, 2023
903da7b
wip
frederic34 Jul 26, 2023
dd8c5f5
wip
frederic34 Jul 26, 2023
dec2fe8
wip
frederic34 Jul 26, 2023
3dcfa66
wip
frederic34 Jul 26, 2023
088f8c1
wip
frederic34 Jul 27, 2023
b87cd20
wip
frederic34 Jul 27, 2023
7bf9bec
wip
frederic34 Jul 27, 2023
658b55b
wip
frederic34 Jul 27, 2023
1da39b6
wip
frederic34 Jul 27, 2023
150a593
wip
frederic34 Jul 27, 2023
cc4c5a8
wip
frederic34 Jul 27, 2023
71c74c3
wip
frederic34 Jul 27, 2023
ed4e2fe
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 27, 2023
d17e7e2
wip
frederic34 Jul 27, 2023
55a8a86
wip
frederic34 Jul 28, 2023
d04f849
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 28, 2023
2579200
wip
frederic34 Jul 28, 2023
a062306
wip
frederic34 Jul 28, 2023
7068b74
wip
frederic34 Jul 29, 2023
530e514
wip
frederic34 Jul 29, 2023
48cfc9b
wip
frederic34 Jul 29, 2023
f2ff06a
wip
frederic34 Jul 29, 2023
0c64666
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 31, 2023
05a0fd1
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Jul 31, 2023
bd0f9f5
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 1, 2023
a01e8b4
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 5, 2023
ae229a5
fix redeclare
frederic34 Aug 5, 2023
b5d5815
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 5, 2023
a2e9182
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 6, 2023
5938f9b
wip
frederic34 Aug 6, 2023
948ee15
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 7, 2023
d3fb92e
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 8, 2023
cb99d6d
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 8, 2023
da4dec4
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 9, 2023
19d54cc
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 9, 2023
2ea448e
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 9, 2023
a579c5d
remove debug
frederic34 Aug 9, 2023
b1a4ff8
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 10, 2023
17017f6
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 10, 2023
5ffa8e2
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 11, 2023
dada111
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 11, 2023
7be4947
fix tabs
frederic34 Aug 11, 2023
6a716a0
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 11, 2023
f21e871
fix
frederic34 Aug 11, 2023
5b433d3
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 11, 2023
b5f920a
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 11, 2023
03e2919
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 11, 2023
0c695f9
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 12, 2023
ceb96c8
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 14, 2023
846fb18
Merge branch 'develop' into unify_all_categories
frederic34 Aug 17, 2023
9e9b317
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 19, 2023
27840ff
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 19, 2023
882952c
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 22, 2023
f13234e
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 22, 2023
06265d9
Merge remote-tracking branch 'upstream/develop' into unify_all_catego…
frederic34 Aug 29, 2023
0a889f7
Merge remote-tracking branch 'origin/unify_all_categories' into unify…
frederic34 Aug 29, 2023
a174509
phpcs
frederic34 Aug 30, 2023
577ba95
phpcs
frederic34 Aug 30, 2023
81b73c5
try to fix
frederic34 Aug 30, 2023
53c3ae7
try to fix
frederic34 Aug 30, 2023
4d8e819
fix
frederic34 Aug 31, 2023
ea16044
Merge branch 'develop' into unify_all_categories
frederic34 Sep 8, 2023
d88af85
Merge branch 'develop' into unify_all_categories
frederic34 Sep 9, 2023
9fd2e6a
Merge branch 'develop' into unify_all_categories
frederic34 Sep 10, 2023
a52a6ad
fix phpcs
frederic34 Sep 11, 2023
0eab784
fix phpcs
frederic34 Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/phpcs.yml
Expand Up @@ -11,9 +11,9 @@ jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 50 # important!
fetch-depth: 0 # important!

# we may use whatever way to install phpcs, just specify the path on the next step
# however, curl seems to be the fastest
Expand All @@ -26,5 +26,6 @@ jobs:
with:
files: "**.php" # you may customize glob as needed
phpcs_path: php phpcs.phar
standard: dev/setup/codesniffer/ruleset.xml
standard: 'dev/setup/codesniffer/ruleset.xml'
fail_on_warnings: false
scope: "blame"
10 changes: 5 additions & 5 deletions htdocs/accountancy/admin/productaccount.php
Expand Up @@ -326,7 +326,7 @@
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
}
if (!empty($searchCategoryProductList)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."element_category as cp ON p.rowid = cp.fk_element"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if (strlen(trim($search_current_account))) {
Expand All @@ -342,9 +342,9 @@
if ($searchCategoryProductOperator == 1) {
foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL";
$searchCategoryProductSqlList[] = "cp.fk_category IS NULL";
} elseif (intval($searchCategoryProduct) > 0) {
$searchCategoryProductSqlList[] = "cp.fk_categorie = ".$db->escape($searchCategoryProduct);
$searchCategoryProductSqlList[] = "cp.fk_category = ".$db->escape($searchCategoryProduct);
}
}
if (!empty($searchCategoryProductSqlList)) {
Expand All @@ -353,9 +353,9 @@
} else {
foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "cp.fk_categorie IS NULL";
$searchCategoryProductSqlList[] = "cp.fk_category IS NULL";
} elseif (intval($searchCategoryProduct) > 0) {
$searchCategoryProductSqlList[] = "p.rowid IN (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_categorie = ".((int) $searchCategoryProduct).")";
$searchCategoryProductSqlList[] = "p.rowid IN (SELECT fk_element FROM ".MAIN_DB_PREFIX."element_category WHERE fk_category = ".((int) $searchCategoryProduct).")";
}
}
if (!empty($searchCategoryProductSqlList)) {
Expand Down
2 changes: 1 addition & 1 deletion htdocs/adherents/class/adherent.class.php
Expand Up @@ -1053,7 +1053,7 @@ public function delete($rowid, $user, $notrigger = 0)
}

// Remove category
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".((int) $rowid);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_category WHERE fk_category IN (SELECT rowid FROM ".MAIN_DB_PREFIX."categorie WHERE type=3) AND fk_element = ".((int) $rowid);
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
Expand Down
5 changes: 3 additions & 2 deletions htdocs/adherents/class/adherentstats.class.php
Expand Up @@ -269,10 +269,11 @@ public function countMembersByTagAndStatus($numberYears = 0)
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_EXCLUDED, "'members_excluded'", 'NULL').") as members_excluded";
$sql .= ", COUNT(".$this->db->ifsql("d.statut = ".Adherent::STATUS_RESILIATED, "'members_resiliated'", 'NULL').") as members_resiliated";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as ct ON c.rowid = ct.fk_categorie";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_member";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_category as ct ON c.rowid = ct.fk_category";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d ON d.rowid = ct.fk_element";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as t ON t.rowid = d.fk_adherent_type";
$sql .= " WHERE c.entity IN (".getEntity('member_type').")";
$sql .= " AND c.type = 3";
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
$sql .= " AND t.entity IN (" . getEntity('adherent') . ")";
if ($numberYears) {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/adherents/class/api_members.class.php
Expand Up @@ -224,16 +224,16 @@ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100,
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call
if ($category > 0) {
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
$sql .= ", ".MAIN_DB_PREFIX."element_category as c";
}
$sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
if (!empty($typeid)) {
$sql .= ' AND t.fk_adherent_type='.((int) $typeid);
}
// Select members of given category
if ($category > 0) {
$sql .= " AND c.fk_categorie = ".((int) $category);
$sql .= " AND c.fk_member = t.rowid";
$sql .= " AND c.fk_category = ".((int) $category);
$sql .= " AND c.fk_element = t.rowid";
}
// Add sql filters
if ($sqlfilters) {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/adherents/list.php
Expand Up @@ -388,17 +388,17 @@
$listofcategoryid = '';
foreach ($searchCategoryContactList as $searchCategoryContact) {
if (intval($searchCategoryContact) == -2) {
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member)";
$searchCategoryContactSqlList[] = "NOT EXISTS (SELECT ck.fk_category FROM ".MAIN_DB_PREFIX."element_category as ck WHERE d.rowid = ck.fk_element)";
} elseif (intval($searchCategoryContact) > 0) {
if ($searchCategoryContactOperator == 0) {
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie = ".((int) $searchCategoryContact).")";
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_category FROM ".MAIN_DB_PREFIX."element_category as ck WHERE d.rowid = ck.fk_element AND ck.fk_category = ".((int) $searchCategoryContact).")";
} else {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryContact);
}
}
}
if ($listofcategoryid) {
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_categorie FROM ".MAIN_DB_PREFIX."categorie_member as ck WHERE d.rowid = ck.fk_member AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
$searchCategoryContactSqlList[] = " EXISTS (SELECT ck.fk_category FROM ".MAIN_DB_PREFIX."element_category as ck WHERE d.rowid = ck.fk_element AND ck.fk_category IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryContactOperator == 1) {
if (!empty($searchCategoryContactSqlList)) {
Expand Down