mirror of
https://github.com/fspc/Yellow-Bike-Database.git
synced 2025-02-22 17:03:22 -05:00
Distinct values if user logins more than once - list_CurrentShopUsers
1) a user can serve in many roles, but before this change there were duplicated entries in the pull-down in transactions if that would happen.
This commit is contained in:
parent
8d73c85cca
commit
67ffd06c37
@ -168,13 +168,15 @@ define("INDIVIDUAL_HISTORY_LOG", "/individual_history_log.php");
|
||||
define("PAGE_SALE_LOG", "/transaction_log.php");
|
||||
define("PAGE_EDIT_LOCATION", "/location_add_edit.php");
|
||||
define("PAGE_SELECT_LOCATION", "/location_add_edit_select.php");
|
||||
|
||||
|
||||
|
||||
//This is a general function to generate the contents of a list box based on a MySQL query. All necessary parameters for the query are passed
|
||||
function generate_list($querySQL,$list_value,$list_text, $form_name, $default_value)
|
||||
{
|
||||
global $database_YBDB, $YBDB;
|
||||
mysql_select_db($database_YBDB, $YBDB);
|
||||
$recordset = mysql_query($querySQL, $YBDB) or die(mysql_error());
|
||||
$recordset = mysql_query($querySQL, $YBDB) or die(mysql_error());
|
||||
$row_recordset = mysql_fetch_assoc($recordset);
|
||||
$totalRows_recordset = mysql_num_rows($recordset);
|
||||
$default_delimiter = '';
|
||||
@ -207,10 +209,11 @@ function generate_list($querySQL,$list_value,$list_text, $form_name, $default_va
|
||||
|
||||
function list_CurrentShopUsers($form_name = "none", $default_value = "", $max_name_length = 20){
|
||||
$current_shop = current_shop_by_ip();
|
||||
$querySQL = "SELECT full_name, shop_hours.contact_id ,hidden FROM shop_hours
|
||||
LEFT JOIN (SELECT LEFT(CONCAT(last_name, ', ', first_name, ' ',middle_initial),$max_name_length) AS full_name, contact_id, hidden FROM contacts) as contacts ON shop_hours.contact_id=contacts.contact_id
|
||||
WHERE shop_hours.shop_id = $current_shop
|
||||
ORDER BY full_name;";
|
||||
$querySQL = "SELECT DISTINCT full_name, shop_hours.contact_id ,hidden FROM shop_hours
|
||||
LEFT JOIN (SELECT LEFT(CONCAT(last_name, ', ', first_name, ' ',middle_initial),$max_name_length)
|
||||
AS full_name, contact_id, hidden FROM contacts) as contacts ON shop_hours.contact_id=contacts.contact_id
|
||||
WHERE shop_hours.shop_id = $current_shop
|
||||
ORDER BY full_name;";
|
||||
$list_value = "contact_id";
|
||||
$list_text = "full_name";
|
||||
generate_list($querySQL,$list_value,$list_text,$form_name, $default_value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user