Skip to content

Conversation

@alex001x
Copy link

On the devices.php page,
a serial number verification button has been added. This button is invisible by default and visible when the page is in edit mode (no serial number in the entry when loading) or when creating a new device.
An AJAX request is sent to verify the existence of a serial number, triggered by the serialexist button.

add function SearchDevicebySerialNoExact

$sql = "SELECT * FROM fac_Device WHERE SerialNo = :serial LIMIT 1;";
On the devices.php page,
a serial number verification button has been added. This button is invisible by default and visible when the page is in edit mode (no serial number in the entry when loading) or when creating a new device.
An AJAX request is sent to verify the existence of a serial number, triggered by the serialexist button.
On the devices.php page,
a serial number verification button has been added. This button is invisible by default and visible when the page is in edit mode (no serial number in the entry when loading) or when creating a new device.
An AJAX request is sent to verify the existence of a serial number, triggered by the serialexist button.
On the devices.php page,
a serial number verification button has been added. This button is invisible by default and visible when the page is in edit mode (no serial number in the entry when loading) or when creating a new device.
An AJAX request is sent to verify the existence of a serial number, triggered by the serialexist button.
@alex001x
Copy link
Author

2025-04-22 16_47_32-SERVEUR LABO IA __ 3880 — Mozilla Firefox
2025-04-22 16_47_47-SERVEUR LABO IA __ 3880 — Mozilla Firefox
2025-04-22 16_48_13-SERVEUR LABO IA __ 3880 — Mozilla Firefox
2025-04-22 16_49_32-SERVEUR LABO IA __ 3880 — Mozilla Firefox

return $deviceList;
}

function SearchDevicebySerialNoExact(){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a new function here, we should instead reuse the function above this but add an exact option.

function SearchDevicebySerialNo(){

	function SearchDevicebySerialNo($exact=false){
		global $dbh;

		$this->MakeSafe();

		if($exact){
			$extend="SerialNo = :serial LIMIT 1;"
		}else{
			$extend="SerialNo LIKE \"%$this->SerialNo%\" ORDER BY Label;"
		}

		$sql="SELECT * FROM fac_Device WHERE $extend";

		$deviceList=array();

		foreach($dbh->query($sql) as $deviceRow){
			$deviceList[$deviceRow["DeviceID"]]=Device::RowToObject($deviceRow);
		}

		return $deviceList;
	}

then over there in devices it would become $devList = $dev->SearchDevicebySerialNo(true);

@alex001x alex001x marked this pull request as draft April 22, 2025 17:11
Update SearchDevicebySerialNo($exact = false)
update 
$devList = $dev->SearchDevicebySerialNo(true);
@alex001x alex001x marked this pull request as ready for review April 22, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants