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

カレンダーの一括削除などを行うとエラーが発生する不具合の修正 #1210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion modules/Calendar/actions/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,35 @@ public function process(Vtiger_Request $request) {
$adb = PearDatabase::getInstance();
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$cvId = $request->get('viewname');

if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
$recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
} else {
$recordIds = $this->getRecordsListFromRequest($request);
}
$cvId = $request->get('viewname');

$skipRecords = [];
asort($recordIds, SORT_NUMERIC);
foreach($recordIds as $recordId) {
if(Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
// Inveteeで作成された子レコードは親が削除された際に削除されるので、改めて削除処理行われないようにする
$query = 'SELECT activityid
FROM vtiger_activity
WHERE invitee_parentid = ?
AND deleted = 0
AND activityid <> ?
ORDER BY activityid';
$result = $adb->pquery($query, array($recordId, $recordId));
for($i = 0; $i < $adb->num_rows($result); $i++) {
$skipRecords[$adb->query_result($result, $i, 'activityid')] = true;
}

if (isset($skipRecords[$recordId])) {
unset($skipRecords[$recordId]);
continue;
}

$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$parentRecurringId = $recordModel->getParentRecurringRecord();
$adb->pquery('DELETE FROM vtiger_activity_recurring_info WHERE activityid=? AND recurrenceid=?', array($parentRecurringId, $recordId));
Expand Down