-
Notifications
You must be signed in to change notification settings - Fork 176
Open
Description
ISSUE TYPE
Bug Report
OS
Irrelevant, but Ubuntu 20.04
VERSION
Tested on 6.0.2, but v7 has same code
SUMMARY
Contacts export via artisan command does not exclude members in status other than normal, and also not closed members
STEPS TO REPRODUCE
Do an export and check ;-)
EXPECTED RESULTS
Contacts are included only from non-closed members in status "Normal"
ACTUAL RESULTS
Contacts from closed members, Not connected members, and Suspended members are all included in the export.
IMPORTANCE
Reduces usefulness of the export
Proposed fix
Here is an attempt at partially fixing this: the following code is able to filter for only "Normal" members. But the constant should be referenced by name, and this does not cater for "closed" members. I do not know any PHP at all, so - reviewer beware.
In app/Console/Commands/Contact/ExportGroup.php:
@@ -83,9 +83,10 @@
$contacts = Contact::selectRaw( 'c.name AS name, c.position as position, c.email AS email, c.phone AS phone, c.mobile AS mobile,
c.facilityaccess AS facilityaccess, c.mayauthorize AS mayauthorize, c.notes as notes' )
->from( 'contact AS c' )
->leftJoin( 'contact_to_group AS ctg', 'ctg.contact_id', 'c.id' )
->leftJoin( 'contact_group AS cg', 'cg.id', 'ctg.contact_group_id' )
->leftJoin( 'cust AS cu', 'cu.id', 'c.custid')
+ ->where( 'cu.status', '1')
->when( $type, function( Builder $q, $type ) {
return $q->where( 'cg.type', $type );
}, function( $query ) use( $name ) {
Metadata
Metadata
Assignees
Labels
No labels