Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
34649221
Verified
Commit
34649221
authored
6 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Patches
Plain Diff
FIX #7806 remove delete user pref when basketgroup is updated
parent
368b8065
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/basket/controllers/BasketController.php
+88
-89
88 additions, 89 deletions
src/app/basket/controllers/BasketController.php
src/app/basket/models/GroupBasketModelAbstract.php
+55
-24
55 additions, 24 deletions
src/app/basket/models/GroupBasketModelAbstract.php
with
143 additions
and
113 deletions
src/app/basket/controllers/BasketController.php
+
88
−
89
View file @
34649221
...
...
@@ -4,11 +4,11 @@
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
/**
* @brief Basket Controller
*
* @author dev@maarch.org
*/
...
...
@@ -26,7 +26,6 @@ use Slim\Http\Request;
use
Slim\Http\Response
;
use
SrcCore\controllers\PreparedClauseController
;
use
User\models\UserBasketPreferenceModel
;
use
User\models\UserModel
;
class
BasketController
{
...
...
@@ -71,7 +70,7 @@ class BasketController
$existingBasket
=
BasketModel
::
getById
([
'id'
=>
$data
[
'id'
],
'select'
=>
[
'1'
]]);
if
(
!
empty
(
$existingBasket
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
_ID
.
' '
.
_ALREADY_EXISTS
]);
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
_ID
.
' '
.
_ALREADY_EXISTS
]);
}
if
(
!
PreparedClauseController
::
isRequestValid
([
'clause'
=>
$data
[
'clause'
],
'userId'
=>
$GLOBALS
[
'userId'
]]))
{
...
...
@@ -84,11 +83,11 @@ class BasketController
BasketModel
::
create
(
$data
);
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$data
[
'id'
],
'recordId'
=>
$data
[
'id'
],
'eventType'
=>
'ADD'
,
'info'
=>
_BASKET_CREATION
.
" :
{
$data
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketCreation'
,
'info'
=>
_BASKET_CREATION
.
" :
{
$data
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketCreation'
,
]);
return
$response
->
withJson
([
'basket'
=>
$data
[
'id'
]]);
...
...
@@ -126,11 +125,11 @@ class BasketController
BasketModel
::
update
(
$data
);
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'UP'
,
'info'
=>
_BASKET_MODIFICATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
'info'
=>
_BASKET_MODIFICATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
]);
return
$response
->
withJson
([
'success'
=>
'success'
]);
...
...
@@ -150,11 +149,11 @@ class BasketController
BasketModel
::
delete
([
'id'
=>
$aArgs
[
'id'
]]);
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'DEL'
,
'info'
=>
_BASKET_SUPPRESSION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketSuppression'
,
'info'
=>
_BASKET_SUPPRESSION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketSuppression'
,
]);
return
$response
->
withJson
([
'baskets'
=>
BasketModel
::
get
()]);
...
...
@@ -167,10 +166,10 @@ class BasketController
}
$baskets
=
BasketModel
::
get
([
'select'
=>
[
'basket_id'
,
'basket_name'
,
'basket_desc'
,
'basket_order'
],
'where'
=>
[
'is_visible = ?'
],
'data'
=>
[
'Y'
],
'orderBy'
=>
[
'basket_order'
]
'select'
=>
[
'basket_id'
,
'basket_name'
,
'basket_desc'
,
'basket_order'
],
'where'
=>
[
'is_visible = ?'
],
'data'
=>
[
'Y'
],
'orderBy'
=>
[
'basket_order'
]
,
]);
return
$response
->
withJson
([
'baskets'
=>
$baskets
]);
...
...
@@ -192,18 +191,18 @@ class BasketController
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'UP'
,
'info'
=>
_BASKETS_SORT_MODIFICATION
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
'info'
=>
_BASKETS_SORT_MODIFICATION
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
]);
$baskets
=
BasketModel
::
get
([
'select'
=>
[
'basket_id'
,
'basket_name'
,
'basket_desc'
,
'basket_order'
],
'where'
=>
[
'is_visible = ?'
],
'data'
=>
[
'Y'
],
'orderBy'
=>
[
'basket_order'
]
'select'
=>
[
'basket_id'
,
'basket_name'
,
'basket_desc'
,
'basket_order'
],
'where'
=>
[
'is_visible = ?'
],
'data'
=>
[
'Y'
],
'orderBy'
=>
[
'basket_order'
]
,
]);
return
$response
->
withJson
([
'baskets'
=>
$baskets
]);
...
...
@@ -233,9 +232,9 @@ class BasketController
}
$actionsForGroup
=
$allActions
;
$actions
=
BasketModel
::
getActionsForGroupById
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$group
[
'group_id'
],
'select'
=>
[
'id_action'
,
'where_clause'
,
'used_in_basketlist'
,
'used_in_action_page'
,
'default_action_list'
]
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$group
[
'group_id'
],
'select'
=>
[
'id_action'
,
'where_clause'
,
'used_in_basketlist'
,
'used_in_action_page'
,
'default_action_list'
]
,
]);
$actionIds
=
[];
foreach
(
$actions
as
$action
)
{
...
...
@@ -245,14 +244,14 @@ class BasketController
$redirects
=
[];
if
(
!
empty
(
$actionIds
))
{
$statuses
=
BasketModel
::
getGroupActionStatus
([
'select'
=>
[
'status_id'
,
'action_id'
],
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
,
'action_id in (?)'
],
'data'
=>
[
$aArgs
[
'id'
],
$group
[
'group_id'
],
$actionIds
]
'select'
=>
[
'status_id'
,
'action_id'
],
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
,
'action_id in (?)'
],
'data'
=>
[
$aArgs
[
'id'
],
$group
[
'group_id'
],
$actionIds
]
,
]);
$redirects
=
BasketModel
::
getGroupActionRedirect
([
'select'
=>
[
'entity_id'
,
'action_id'
,
'keyword'
,
'redirect_mode'
],
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
,
'action_id in (?)'
],
'data'
=>
[
$aArgs
[
'id'
],
$group
[
'group_id'
],
$actionIds
]
'select'
=>
[
'entity_id'
,
'action_id'
,
'keyword'
,
'redirect_mode'
],
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
,
'action_id in (?)'
],
'data'
=>
[
$aArgs
[
'id'
],
$group
[
'group_id'
],
$actionIds
]
,
]);
}
foreach
(
$actions
as
$actionKey
=>
$action
)
{
...
...
@@ -319,7 +318,7 @@ class BasketController
if
(
!
$check
)
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Bad Request'
]);
}
$data
[
'groupActions'
]
=
BasketController
::
checkGroupActions
([
'groupActions'
=>
$data
[
'groupActions'
],
'userId'
=>
$GLOBALS
[
'userId'
]]);
$data
[
'groupActions'
]
=
self
::
checkGroupActions
([
'groupActions'
=>
$data
[
'groupActions'
],
'userId'
=>
$GLOBALS
[
'userId'
]]);
if
(
!
empty
(
$data
[
'groupActions'
][
'errors'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
$data
[
'groupActions'
][
'errors'
]]);
}
...
...
@@ -332,34 +331,34 @@ class BasketController
foreach
(
$data
[
'groupActions'
]
as
$groupAction
)
{
if
(
$groupAction
[
'checked'
])
{
BasketModel
::
createGroupAction
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'whereClause'
=>
$groupAction
[
'where_clause'
],
'usedInBasketlist'
=>
$groupAction
[
'used_in_basketlist'
],
'usedInActionPage'
=>
$groupAction
[
'used_in_action_page'
],
'defaultActionList'
=>
$groupAction
[
'default_action_list'
]
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'whereClause'
=>
$groupAction
[
'where_clause'
],
'usedInBasketlist'
=>
$groupAction
[
'used_in_basketlist'
],
'usedInActionPage'
=>
$groupAction
[
'used_in_action_page'
],
'defaultActionList'
=>
$groupAction
[
'default_action_list'
]
,
]);
if
(
!
empty
(
$groupAction
[
'statuses'
]))
{
foreach
(
$groupAction
[
'statuses'
]
as
$status
)
{
BasketModel
::
createGroupActionStatus
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'statusId'
=>
$status
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'statusId'
=>
$status
,
]);
}
}
if
(
!
empty
(
$groupAction
[
'redirects'
]))
{
foreach
(
$groupAction
[
'redirects'
]
as
$redirect
)
{
BasketModel
::
createGroupActionRedirect
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'entityId'
=>
$redirect
[
'entity_id'
],
'keyword'
=>
$redirect
[
'keyword'
],
'redirectMode'
=>
$redirect
[
'redirect_mode'
]
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$data
[
'group_id'
],
'actionId'
=>
$groupAction
[
'id'
],
'entityId'
=>
$redirect
[
'entity_id'
],
'keyword'
=>
$redirect
[
'keyword'
],
'redirectMode'
=>
$redirect
[
'redirect_mode'
]
,
]);
}
}
...
...
@@ -370,20 +369,20 @@ class BasketController
$group
=
GroupModel
::
getByGroupId
([
'select'
=>
[
'id'
],
'groupId'
=>
$data
[
'group_id'
]]);
foreach
(
$users
as
$user
)
{
UserBasketPreferenceModel
::
create
([
'userSerialId'
=>
$user
[
'id'
],
'userSerialId'
=>
$user
[
'id'
],
'groupSerialId'
=>
$group
[
'id'
],
'basketId'
=>
$aArgs
[
'id'
],
'display'
=>
'true'
,
'basketId'
=>
$aArgs
[
'id'
],
'display'
=>
'true'
,
]);
}
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'UP'
,
'info'
=>
_BASKET_GROUP_CREATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
'info'
=>
_BASKET_GROUP_CREATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
]);
return
$response
->
withJson
([
'success'
=>
'success'
]);
...
...
@@ -407,7 +406,7 @@ class BasketController
if
(
!
$check
)
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Bad Request'
]);
}
$data
[
'groupActions'
]
=
BasketController
::
checkGroupActions
([
'groupActions'
=>
$data
[
'groupActions'
],
'userId'
=>
$GLOBALS
[
'userId'
]]);
$data
[
'groupActions'
]
=
self
::
checkGroupActions
([
'groupActions'
=>
$data
[
'groupActions'
],
'userId'
=>
$GLOBALS
[
'userId'
]]);
if
(
!
empty
(
$data
[
'groupActions'
][
'errors'
]))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
$data
[
'groupActions'
][
'errors'
]]);
}
...
...
@@ -416,40 +415,40 @@ class BasketController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Group does not exist for this basket'
]);
}
GroupBasketModel
::
deleteGroupBasket
([
'basketId'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
]]);
GroupBasketModel
::
deleteGroupBasket
WithoutUserPref
([
'basketId'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
]]);
GroupBasketModel
::
createGroupBasket
([
'basketId'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'resultPage'
=>
$data
[
'result_page'
]]);
foreach
(
$data
[
'groupActions'
]
as
$groupAction
)
{
if
(
$groupAction
[
'checked'
])
{
BasketModel
::
createGroupAction
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'whereClause'
=>
$groupAction
[
'where_clause'
],
'usedInBasketlist'
=>
$groupAction
[
'used_in_basketlist'
],
'usedInActionPage'
=>
$groupAction
[
'used_in_action_page'
],
'defaultActionList'
=>
$groupAction
[
'default_action_list'
]
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'whereClause'
=>
$groupAction
[
'where_clause'
],
'usedInBasketlist'
=>
$groupAction
[
'used_in_basketlist'
],
'usedInActionPage'
=>
$groupAction
[
'used_in_action_page'
],
'defaultActionList'
=>
$groupAction
[
'default_action_list'
]
,
]);
if
(
!
empty
(
$groupAction
[
'statuses'
]))
{
foreach
(
$groupAction
[
'statuses'
]
as
$status
)
{
BasketModel
::
createGroupActionStatus
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'statusId'
=>
$status
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'statusId'
=>
$status
,
]);
}
}
if
(
!
empty
(
$groupAction
[
'redirects'
]))
{
foreach
(
$groupAction
[
'redirects'
]
as
$redirect
)
{
BasketModel
::
createGroupActionRedirect
([
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'entityId'
=>
$redirect
[
'entity_id'
],
'keyword'
=>
$redirect
[
'keyword'
],
'redirectMode'
=>
$redirect
[
'redirect_mode'
]
'id'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
],
'actionId'
=>
$groupAction
[
'id'
],
'entityId'
=>
$redirect
[
'entity_id'
],
'keyword'
=>
$redirect
[
'keyword'
],
'redirectMode'
=>
$redirect
[
'redirect_mode'
]
,
]);
}
}
...
...
@@ -457,11 +456,11 @@ class BasketController
}
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'UP'
,
'info'
=>
_BASKET_GROUP_MODIFICATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
'info'
=>
_BASKET_GROUP_MODIFICATION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
]);
return
$response
->
withJson
([
'success'
=>
'success'
]);
...
...
@@ -481,11 +480,11 @@ class BasketController
GroupBasketModel
::
deleteGroupBasket
([
'basketId'
=>
$aArgs
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
]]);
HistoryController
::
add
([
'tableName'
=>
'baskets'
,
'recordId'
=>
$aArgs
[
'id'
],
'recordId'
=>
$aArgs
[
'id'
],
'eventType'
=>
'UP'
,
'info'
=>
_BASKET_GROUP_SUPPRESSION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
'info'
=>
_BASKET_GROUP_SUPPRESSION
.
" :
{
$aArgs
[
'id'
]
}
"
,
'moduleId'
=>
'basket'
,
'eventId'
=>
'basketModification'
,
]);
return
$response
->
withJson
([
'success'
=>
'success'
]);
...
...
@@ -519,7 +518,7 @@ class BasketController
$aArgs
[
'groupActions'
][
$key
][
'used_in_basketlist'
]
=
empty
(
$groupAction
[
'used_in_basketlist'
])
?
'N'
:
'Y'
;
$aArgs
[
'groupActions'
][
$key
][
'used_in_action_page'
]
=
empty
(
$groupAction
[
'used_in_action_page'
])
?
'N'
:
'Y'
;
$aArgs
[
'groupActions'
][
$key
][
'default_action_list'
]
=
empty
(
$groupAction
[
'default_action_list'
])
?
'N'
:
'Y'
;
if
(
$aArgs
[
'groupActions'
][
$key
][
'checked'
]
&&
$aArgs
[
'groupActions'
][
$key
][
'used_in_basketlist'
]
==
'N'
&&
$aArgs
[
'groupActions'
][
$key
][
'used_in_action_page'
]
==
'N'
)
{
return
[
'errors'
=>
'Action must be present in action page or in action list'
];
}
...
...
This diff is collapsed.
Click to expand it.
src/app/basket/models/GroupBasketModelAbstract.php
+
55
−
24
View file @
34649221
<?php
/**
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*
*/
* Copyright Maarch since 2008 under licence GPLv3.
* See LICENCE.txt file at the root folder for more details.
* This file is part of Maarch software.
*/
/**
* @brief GroupBasket Model Abstract
* @author dev@maarch.org
*/
* @brief GroupBasket Model Abstract
*
* @author dev@maarch.org
*/
namespace
Basket\models
;
...
...
@@ -25,11 +25,11 @@ abstract class GroupBasketModelAbstract
ValidatorModel
::
arrayType
(
$aArgs
,
[
'select'
,
'where'
,
'data'
,
'orderBy'
]);
$aGroupsBaskets
=
DatabaseModel
::
select
([
'select'
=>
empty
(
$aArgs
[
'select'
])
?
[
'*'
]
:
$aArgs
[
'select'
],
'table'
=>
[
'groupbasket'
],
'where'
=>
$aArgs
[
'where'
],
'data'
=>
$aArgs
[
'data'
],
'order_by'
=>
$aArgs
[
'orderBy'
]
'select'
=>
empty
(
$aArgs
[
'select'
])
?
[
'*'
]
:
$aArgs
[
'select'
],
'table'
=>
[
'groupbasket'
],
'where'
=>
$aArgs
[
'where'
],
'data'
=>
$aArgs
[
'data'
],
'order_by'
=>
$aArgs
[
'orderBy'
]
,
]);
return
$aGroupsBaskets
;
...
...
@@ -41,12 +41,12 @@ abstract class GroupBasketModelAbstract
ValidatorModel
::
stringType
(
$aArgs
,
[
'basketId'
,
'groupId'
,
'resultPage'
]);
DatabaseModel
::
insert
([
'table'
=>
'groupbasket'
,
'table'
=>
'groupbasket'
,
'columnsValues'
=>
[
'basket_id'
=>
$aArgs
[
'basketId'
],
'group_id'
=>
$aArgs
[
'groupId'
],
'result_page'
=>
$aArgs
[
'resultPage'
]
]
'basket_id'
=>
$aArgs
[
'basketId'
],
'group_id'
=>
$aArgs
[
'groupId'
],
'result_page'
=>
$aArgs
[
'resultPage'
]
,
]
,
]);
return
true
;
...
...
@@ -62,29 +62,60 @@ abstract class GroupBasketModelAbstract
DatabaseModel
::
delete
([
'table'
=>
'groupbasket'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
,
]);
DatabaseModel
::
delete
([
'table'
=>
'actions_groupbaskets'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
,
]);
DatabaseModel
::
delete
([
'table'
=>
'groupbasket_redirect'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
,
]);
DatabaseModel
::
delete
([
'table'
=>
'groupbasket_status'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]]
,
]);
DatabaseModel
::
delete
([
'table'
=>
'users_baskets_preferences'
,
'where'
=>
[
'basket_id = ?'
,
'group_serial_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$group
[
'id'
]]
'data'
=>
[
$aArgs
[
'basketId'
],
$group
[
'id'
]],
]);
return
true
;
}
public
static
function
deleteGroupBasketWithoutUserPref
(
array
$aArgs
)
{
ValidatorModel
::
notEmpty
(
$aArgs
,
[
'basketId'
,
'groupId'
]);
ValidatorModel
::
stringType
(
$aArgs
,
[
'basketId'
,
'groupId'
]);
$group
=
GroupModel
::
getByGroupId
([
'select'
=>
[
'id'
],
'groupId'
=>
$aArgs
[
'groupId'
]]);
DatabaseModel
::
delete
([
'table'
=>
'groupbasket'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]],
]);
DatabaseModel
::
delete
([
'table'
=>
'actions_groupbaskets'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]],
]);
DatabaseModel
::
delete
([
'table'
=>
'groupbasket_redirect'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]],
]);
DatabaseModel
::
delete
([
'table'
=>
'groupbasket_status'
,
'where'
=>
[
'basket_id = ?'
,
'group_id = ?'
],
'data'
=>
[
$aArgs
[
'basketId'
],
$aArgs
[
'groupId'
]],
]);
return
true
;
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment