diff --git a/cabinets.php b/cabinets.php index 0af9f4a6a..f90536150 100644 --- a/cabinets.php +++ b/cabinets.php @@ -53,6 +53,7 @@ $cab->CabRowID=$_POST['cabrowid']; $cab->CabinetHeight=$_POST['cabinetheight']; $cab->Model=$_POST['model']; + $cab->SerialNo=isset($_POST['serialno'])?$_POST['serialno']:''; $cab->Keylock=$_POST['keylock']; $cab->MaxKW=$_POST['maxkw']; $cab->MaxWeight=$_POST['maxweight']; @@ -315,6 +316,10 @@
',__("Model"),'
+
+
',__("Cabinet Serial Number"),'
+
+
',__("Key/Lock Information"),'
diff --git a/cabnavigator.php b/cabnavigator.php index 6e9753d81..404380cbb 100644 --- a/cabnavigator.php +++ b/cabnavigator.php @@ -48,6 +48,7 @@ function renderCabinetProps($cab, $audit, $AuditorName){ $renderedHTML="\t\t \t\t \t\t + \t\t \t\t \t\t\n"; diff --git a/classes/Cabinet.class.php b/classes/Cabinet.class.php index c34d1878e..68b8081b4 100644 --- a/classes/Cabinet.class.php +++ b/classes/Cabinet.class.php @@ -40,6 +40,7 @@ class Cabinet { var $CabRowID; //JMGA: Row of this cabinet var $CabinetHeight; var $Model; + var $SerialNo; var $Keylock; var $MaxKW; var $MaxWeight; @@ -62,6 +63,7 @@ function MakeSafe() { $this->CabRowID=intval($this->CabRowID); $this->CabinetHeight=intval($this->CabinetHeight); $this->Model=sanitize($this->Model); + $this->SerialNo=sanitize($this->SerialNo); $this->Keylock=sanitize($this->Keylock); $this->MaxKW=float_sqlsafe(floatval($this->MaxKW)); $this->MaxWeight=intval($this->MaxWeight); @@ -97,6 +99,7 @@ static function RowToObject($dbRow,$filterrights=true){ $cab->CabRowID=$dbRow["CabRowID"]; $cab->CabinetHeight=$dbRow["CabinetHeight"]; $cab->Model=$dbRow["Model"]; + $cab->SerialNo=$dbRow["SerialNo"]; $cab->Keylock=$dbRow["Keylock"]; $cab->MaxKW=$dbRow["MaxKW"]; $cab->MaxWeight=$dbRow["MaxWeight"]; @@ -188,7 +191,7 @@ function CreateCabinet($deferTreeRebuild=false){ $sql="INSERT INTO fac_Cabinet SET DataCenterID=$this->DataCenterID, Location=\"$this->Location\", LocationSortable=\"$this->LocationSortable\", AssignedTo=$this->AssignedTo, ZoneID=$this->ZoneID, CabRowID=$this->CabRowID, - CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", + CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", SerialNo=\"$this->SerialNo\", Keylock=\"$this->Keylock\", MaxKW=$this->MaxKW, MaxWeight=$this->MaxWeight, InstallationDate=\"".date("Y-m-d", strtotime($this->InstallationDate))."\", MapX1=$this->MapX1, MapY1=$this->MapY1, @@ -225,7 +228,7 @@ function UpdateCabinet(){ $sql="UPDATE fac_Cabinet SET DataCenterID=$this->DataCenterID, Location=\"$this->Location\", LocationSortable=\"$this->LocationSortable\", AssignedTo=$this->AssignedTo, ZoneID=$this->ZoneID, CabRowID=$this->CabRowID, - CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", + CabinetHeight=$this->CabinetHeight, Model=\"$this->Model\", SerialNo=\"$this->SerialNo\", Keylock=\"$this->Keylock\", MaxKW=$this->MaxKW, MaxWeight=$this->MaxWeight, InstallationDate=\"".date("Y-m-d", strtotime($this->InstallationDate))."\", MapX1=$this->MapX1, MapY1=$this->MapY1, diff --git a/create.sql b/create.sql index 3144611dc..c642adce5 100644 --- a/create.sql +++ b/create.sql @@ -13,6 +13,7 @@ CREATE TABLE fac_Cabinet ( CabRowID int(11) NOT NULL, CabinetHeight int(11) NOT NULL, Model varchar(80) NOT NULL, + SerialNo varchar(30) NOT NULL, Keylock varchar(30) NOT NULL, MaxKW float(11) NOT NULL, MaxWeight int(11) NOT NULL, diff --git a/custom_search.php b/custom_search.php index bc1a26fc5..3aaaa85ce 100644 --- a/custom_search.php +++ b/custom_search.php @@ -221,4 +221,4 @@ function newtab(searchlink){ - + \ No newline at end of file diff --git a/db-23.04-to-25.01.sql b/db-23.04-to-25.01.sql index 6f1c63bcc..c9411fb21 100644 --- a/db-23.04-to-25.01.sql +++ b/db-23.04-to-25.01.sql @@ -1,6 +1,12 @@ +--- +--- Schema changes for 23.04 to 25.01 +--- + -- --- Schema changes for 23.04 to 25.01 +-- Table structure for table `fac_Cabinet` -- +-- Add SerialNo column to fac_Cabinet after Model +ALTER TABLE fac_Cabinet ADD COLUMN SerialNo VARCHAR(30) AFTER Model; -- -- Table structure for table `fac_MediaConnectors` diff --git a/scripts/ajax_search.php b/scripts/ajax_search.php index 0f6d72b88..ed919cf2e 100644 --- a/scripts/ajax_search.php +++ b/scripts/ajax_search.php @@ -24,6 +24,8 @@ $field="Owner"; }elseif(isset($_REQUEST["notes"])){ $field="Notes"; + }elseif(isset($_REQUEST["cabserial"])){ + $field="CabinetSerial"; }elseif(isset($_REQUEST["ip"])){ $field="PrimaryIP"; }else{ @@ -65,6 +67,8 @@ $sql="SELECT DISTINCT Value FROM fac_DeviceCustomValue WHERE AttributeID=$custom AND Value LIKE '%$searchTerm%' AND Value !='' ORDER BY Value ASC;"; + }elseif($field=="CabinetSerial"){ + $sql="SELECT DISTINCT SerialNo FROM fac_Cabinet WHERE SerialNo LIKE '%$searchTerm%' ORDER BY SerialNo ASC LIMIT 500;"; }else{ $sql="SELECT DISTINCT $field FROM fac_Device WHERE $field LIKE '%$searchTerm%' LIMIT 500;"; } diff --git a/search.php b/search.php index 20c11ac82..f88368ccf 100644 --- a/search.php +++ b/search.php @@ -68,6 +68,11 @@ $devList=$dev->SearchDevicebyAssetTag(); $resultcount=count($devList); $title=__("Asset tag search results for")." "$searchTerm""; + }elseif($searchKey=='cabserial'){ + $cab->SerialNo=$searchTerm; + $cabList=$cab->Search(true,true); + $resultcount=count($cabList); + $title=__("Cabinet Serial Number search results for")." "$searchTerm""; }elseif($searchKey=="ctag"){ // TODO: this could be enhanced to allow searching for a specific custom attribute $devList=$dev->SearchByCustomTag($searchTerm); @@ -413,7 +418,7 @@ function formatTime(time) { hundredths = pad(time - (sec * 100) - (min * 6000), 2); return pad(sec, 2); } - var msg=$('

').append(''); ?>').click(function(){timer.stop();$(this).remove();}) + var msg=$('

').append(''); ?>').click(function(){timer.stop();$(this).remove();}) $('#resultcount').parent('p').append(msg); var currentTime=500, incrementTime=100, diff --git a/sidebar.inc.php b/sidebar.inc.php index 726ab44fa..cc6acce74 100644 --- a/sidebar.inc.php +++ b/sidebar.inc.php @@ -14,16 +14,17 @@

- + + + + + + + + + + '; foreach($attrList as $ca){ print "\t\n";

".__("Last Audit").":$audit->AuditStamp$AuditorName
".__("Model").":$cab->Model
".__("SerialNo").":$cab->SerialNo
".__("Data Center").":$tmpDC->Name
".__("Install Date").":$cab->InstallationDate