From cc6ffc0c6be0c42045b68620b9895d852f66cfef Mon Sep 17 00:00:00 2001 From: samilliken Date: Sat, 28 Mar 2015 13:39:30 -0400 Subject: [PATCH] Added in the new fields for the linked list of panels and updated the input screen. Leaving the Power Source in for now since we won't have time to remove all elements of that before 4.0-release. Also wrote a conversion script to create panels that match the existing sources and set the ParentPanelID on all of the children to point that way. In the next release we'll drop the column from the db and remove the table for PowerSource. #553 --- panelconversion.php | 15 +++++++++++++++ power.inc.php | 4 ++-- power_panel.php | 20 ++++++++++++++++++++ unauthorized.php | 8 ++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 panelconversion.php create mode 100644 unauthorized.php diff --git a/panelconversion.php b/panelconversion.php new file mode 100644 index 000000000..7b00f678e --- /dev/null +++ b/panelconversion.php @@ -0,0 +1,15 @@ +prepare( "select * from fac_PowerSource" ); + $ss->setFetchMode( PDO::FETCH_CLASS, "PowerSource" ); + $ss->execute(); + + $ps = $dbh->prepare( "insert into fac_PowerPanel set PanelLabel=:PanelLabel" ); + $us = $dbh->prepare( "update fac_PowerPanel set ParentPanelID=:PanelID where PowerSourceID=:SourceID" ); + while ( $row = $ss->fetch() ) { + $ps->execute( array( ":PanelLabel"=>$row->SourceName )); + $us->execute( array( ":PanelID"=>$dbh->LastInsertId(), ":SourceID"=>$row->PowerSourceID ) ); + } +?> diff --git a/power.inc.php b/power.inc.php index 7a16ccd73..b80724708 100644 --- a/power.inc.php +++ b/power.inc.php @@ -1318,7 +1318,7 @@ function MakeSafe(){ $this->PanelVoltage=intval($this->PanelVoltage); $this->NumberScheme=($this->NumberScheme=='Sequential')?$this->NumberScheme:'Odd/Even'; $this->ParentPanelID=intval($this->ParentPanelID); - $this->ParentBreakerID=sanitize($this->ParentBreakerID; + $this->ParentBreakerID=sanitize($this->ParentBreakerID); } function MakeDisplay(){ @@ -1432,7 +1432,7 @@ function CreatePanel(){ ":NumberOfPoles"=>$this->NumberOfPoles, ":MainBreakerSize"=>$this->MainBreakerSize, ":PanelVoltage"=>$this->PanelVoltage, - ":NumberScheme"=>this->NumberScheme, + ":NumberScheme"=>$this->NumberScheme, ":ParentPanelID"=>$this->ParentPanelID, ":ParentBreakerID"=>$this->ParentBreakerID ))){ $this->PanelID=$dbh->lastInsertId(); diff --git a/power_panel.php b/power_panel.php index ef64c3855..fffa6dcef 100644 --- a/power_panel.php +++ b/power_panel.php @@ -38,6 +38,8 @@ $panel->MainBreakerSize=$_POST["mainbreakersize"]; $panel->PanelVoltage=$_POST["panelvoltage"]; $panel->NumberScheme=$_POST["numberscheme"]; + $panel->ParentPanelID=$_POST["parentpanelid"]; + $panel->ParentBreakerID=$_POST["parentbreakerid"]; if($_POST["action"]=="Create"){ $panel->CreatePanel(); @@ -156,6 +158,24 @@ +
+
+
+
+
+
+
+
PanelID >0){ diff --git a/unauthorized.php b/unauthorized.php new file mode 100644 index 000000000..9fe150ec0 --- /dev/null +++ b/unauthorized.php @@ -0,0 +1,8 @@ + + +Unauthorized + + +

UserID not found in the database for authorized access. Please contact your site administrator if this is in error.

+ + \ No newline at end of file