Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
justinfreeman (Agileware)
Core
Commits
b3fdbf3d
Commit
b3fdbf3d
authored
12 years ago
by
lobo
Browse files
Options
Downloads
Patches
Plain Diff
CRM-12261
parent
bc028df3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CRM/Core/BAO/File.php
+12
-4
12 additions, 4 deletions
CRM/Core/BAO/File.php
CRM/Core/Page/File.php
+3
-6
3 additions, 6 deletions
CRM/Core/Page/File.php
CRM/Custom/Form/DeleteFile.php
+0
-93
0 additions, 93 deletions
CRM/Custom/Form/DeleteFile.php
CRM/Dedupe/Merger.php
+6
-6
6 additions, 6 deletions
CRM/Dedupe/Merger.php
with
21 additions
and
109 deletions
CRM/Core/BAO/File.php
+
12
−
4
View file @
b3fdbf3d
...
...
@@ -154,11 +154,10 @@
}
/**
* The $useWhere is used so that the signature matches the parent class
* A static function wrapper that deletes the various objects that are
* connected to a file object (i.e. file, entityFile and customValue
*/
public
function
delete
(
$useWhere
=
false
)
{
list
(
$fileID
,
$entityID
,
$fieldID
)
=
func_get_args
();
public
static
function
deleteFileReferences
(
$fileID
,
$entityID
,
$fieldID
)
{
$fileDAO
=
new
CRM_Core_DAO_File
();
$fileDAO
->
id
=
$fileID
;
if
(
!
$fileDAO
->
find
(
TRUE
))
{
...
...
@@ -190,6 +189,15 @@
CRM_Core_DAO
::
executeQuery
(
$query
,
$params
);
}
/**
* The $useWhere is used so that the signature matches the parent class
*/
public
function
delete
(
$useWhere
=
false
)
{
list
(
$fileID
,
$entityID
,
$fieldID
)
=
func_get_args
();
self
::
deleteFileReferences
(
$fileID
,
$entityID
,
$fieldID
);
}
/**
* delete all the files and associated object associated with this
* combination
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/Page/File.php
+
3
−
6
View file @
b3fdbf3d
...
...
@@ -53,20 +53,17 @@ class CRM_Core_Page_File extends CRM_Core_Page {
if
(
$action
&
CRM_Core_Action
::
DELETE
)
{
if
(
CRM_Utils_Request
::
retrieve
(
'confirmed'
,
'Boolean'
,
CRM_Core_DAO
::
$_nullObject
))
{
CRM_Core_BAO_File
::
delete
(
$id
,
$eid
,
$fid
);
CRM_Core_BAO_File
::
delete
FileReferences
(
$id
,
$eid
,
$fid
);
CRM_Core_Session
::
setStatus
(
ts
(
'The attached file has been deleted.'
),
ts
(
'Complete'
),
'success'
);
$session
=
CRM_Core_Session
::
singleton
();
$toUrl
=
$session
->
popUserContext
();
CRM_Utils_System
::
redirect
(
$toUrl
);
}
else
{
$wrapper
=
new
CRM_Utils_Wrapper
();
return
$wrapper
->
run
(
'CRM_Custom_Form_DeleteFile'
,
ts
(
'Domain Information Page'
),
NULL
);
}
}
else
{
CRM_Utils_System
::
download
(
CRM_Utils_File
::
cleanFileName
(
basename
(
$path
)),
CRM_Utils_System
::
download
(
CRM_Utils_File
::
cleanFileName
(
basename
(
$path
)),
$mimeType
,
$buffer
);
...
...
This diff is collapsed.
Click to expand it.
CRM/Custom/Form/DeleteFile.php
deleted
100644 → 0
+
0
−
93
View file @
bc028df3
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
class
CRM_Custom_Form_DeleteFile
extends
CRM_Core_Form
{
/**
* the file id
*
* @var int
*/
protected
$_id
;
/**
* the entity id
*
* @var array
*/
protected
$_eid
;
function
preProcess
()
{
$this
->
_id
=
CRM_Utils_Request
::
retrieve
(
'id'
,
'Positive'
,
$this
,
TRUE
);
$this
->
_eid
=
CRM_Utils_Request
::
retrieve
(
'eid'
,
'Positive'
,
$this
,
TRUE
);
}
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public
function
buildQuickForm
()
{
$this
->
addButtons
(
array
(
array
(
'type'
=>
'next'
,
'name'
=>
ts
(
'Delete'
),
'subName'
=>
'view'
,
'isDefault'
=>
TRUE
,
),
array
(
'type'
=>
'cancel'
,
'name'
=>
ts
(
'Cancel'
),
),
));
}
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public
function
postProcess
()
{
CRM_Core_BAO_File
::
delete
(
$this
->
_id
,
$this
->
_eid
);
CRM_Core_Session
::
setStatus
(
ts
(
'The attached file has been deleted.'
),
ts
(
'Deleted'
),
'success'
);
$session
=
CRM_Core_Session
::
singleton
();
$toUrl
=
$session
->
popUserContext
();
CRM_Utils_System
::
redirect
(
$toUrl
);
}
}
This diff is collapsed.
Click to expand it.
CRM/Dedupe/Merger.php
+
6
−
6
View file @
b3fdbf3d
...
...
@@ -432,7 +432,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
// Skip normal processing
continue
;
}
// use UPDATE IGNORE + DELETE query pair to skip on situations when
// there's a UNIQUE restriction on ($field, some_other_field) pair
if
(
isset
(
$cidRefs
[
$table
]))
{
...
...
@@ -474,7 +474,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
/**
* Find differences between contacts.
*
*
* @param array $main contact details
* @param array $other contact details
*
...
...
@@ -785,8 +785,8 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
if
(
CRM_Utils_array
::
value
(
'preferred_communication_method'
,
$contact
)){
// api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct
$prefCommList
=
is_array
(
$specialValues
[
$moniker
][
'preferred_communication_method'
])
?
implode
(
CRM_Core_DAO
::
VALUE_SEPARATOR
,
$specialValues
[
$moniker
][
'preferred_communication_method'
])
:
$prefCommList
=
is_array
(
$specialValues
[
$moniker
][
'preferred_communication_method'
])
?
implode
(
CRM_Core_DAO
::
VALUE_SEPARATOR
,
$specialValues
[
$moniker
][
'preferred_communication_method'
])
:
$specialValues
[
$moniker
][
'preferred_communication_method'
];
$specialValues
[
$moniker
][
'preferred_communication_method'
]
=
CRM_Core_DAO
::
VALUE_SEPARATOR
.
$prefCommList
.
CRM_Core_DAO
::
VALUE_SEPARATOR
;
}
...
...
@@ -1371,7 +1371,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
// **** Do file custom fields related migrations
// FIXME: move this someplace else (one of the BAOs) after discussing
// where to, and whether CRM_Core_BAO_File::delete() shouldn't actually,
// where to, and whether CRM_Core_BAO_File::delete
FileReferences
() shouldn't actually,
// like, delete a file...
if
(
!
isset
(
$customFiles
))
{
...
...
@@ -1391,7 +1391,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m
// delete the main contact's file
if
(
!
empty
(
$fileIds
[
$mainId
]))
{
CRM_Core_BAO_File
::
delete
(
$fileIds
[
$mainId
],
$mainId
,
$customId
);
CRM_Core_BAO_File
::
delete
FileReferences
(
$fileIds
[
$mainId
],
$mainId
,
$customId
);
}
// move the other contact's file to main contact
...
...
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