{ if ( ($i >= $offset && $i < $offset + $CountRowOnPage) || $navigatorParams == null ) { $group = GetCustomerGroupByCustomerId( $row["customerID"] ); $row["custgroup_name"] = $group["custgroup_name"]; $row["allowToDelete"] = regVerifyToDelete( $row["customerID"] ); $row["reg_datetime"] = format_datetime( $row["reg_datetime"] ); $data[] = $row; } $i++; } $count_row = $i; return $data; } function regSetSubscribed4news( $customerID, $value ) { db_query( "update ".CUSTOMERS_TABLE." set subscribed4news = ".(int)$value. " where customerID=".(int)$customerID ); if ($value > 0) { subscrAddRegisteredCustomerEmail($customerID); } else { subscrUnsubscribeSubscriberByCustomerId($customerID); } } function regSetCustgroupID( $customerID, $custgroupID ) { db_query( "update ".CUSTOMERS_TABLE." set custgroupID=".(int)$custgroupID. " where customerID=".(int)$customerID ); } function regAddressBelongToCustomer( $customerID, $addressID ) { if (!$customerID) return false; if (!$addressID) return false; $q_count = db_query( "select count(*) from ".CUSTOMER_ADDRESSES_TABLE. " where customerID=".(int)$customerID." AND addressID=".(int)$addressID ); $count = db_fetch_row( $q_count ); $count = $count[0]; return ( $count != 0 ); } function regVerifyToDelete( $customerID ) { if (!$customerID) return 0; $q = db_query( "select count(*) from ".CUSTOMERS_TABLE." where customerID=".(int)$customerID ); $row = db_fetch_row($q); if ( regIsAdminiatrator(regGetLoginById($customerID)) ) return false; return ($row[0] == 1); } function regDeleteCustomer( $customerID ) { if ( $customerID == null || trim($customerID) == "" ) return false; if (!$customerID) return 0; if ( regVerifyToDelete( $customerID ) ) { db_query( "delete from ".SHOPPING_CARTS_TABLE." where customerID=".(int)$customerID ); db_query( "delete from ".MAILING_LIST_TABLE." where customerID=".(int)$customerID ); db_query( "delete from ".CUSTOMER_ADDRESSES_TABLE." where customerID=".(int)$customerID ); db_query( "delete from ".CUSTOMER_REG_FIELDS_VALUES_TABLE." where customerID=".(int)$customerID ); db_query( "delete from ".CUSTOMERS_TABLE." where customerID=".(int)$customerID ); db_query( "update ".ORDERS_TABLE." set customerID=NULL where customerID=".(int)$customerID ); return true; } else return false; } function regActivateCustomer($_CustomerID){ $sql = 'UPDATE '.CUSTOMERS_TABLE.' SET ActivationCode = "" WHERE customerID='.(int)$_CustomerID; db_query($sql); } ?>