-
Notifications
You must be signed in to change notification settings - Fork 217
Feature/check serial exist #1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
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.
classes/Device.class.php
Outdated
| return $deviceList; | ||
| } | ||
|
|
||
| function SearchDevicebySerialNoExact(){ |
There was a problem hiding this comment.
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.
openDCIM/classes/Device.class.php
Line 1513 in 0ea5e3c
| 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);
Update SearchDevicebySerialNo($exact = false)
update $devList = $dev->SearchDevicebySerialNo(true);




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.