evaluate {$op_deleteObject} in the right context
authorDenis Ovsienko <denis@ovsienko.info>
Tue, 6 Apr 2021 13:07:39 +0000 (14:07 +0100)
committerDenis Ovsienko <denis@ovsienko.info>
Tue, 6 Apr 2021 13:07:39 +0000 (14:07 +0100)
op=deleteObject used to live at depot-addmore, which resulted in
fixContext() not adding the current object into the context. Move the
operation to object-edit and fix Mantis issue #2021.

* renderEditObjectForm(): When calling getOpLink(), specify only "op"
  and leave the rest to be derived.
* deleteObject(): After deleting the object redirect to depot-addmore
  via buildRedirectURL().

ChangeLog
wwwroot/inc/interface.php
wwwroot/inc/navigation.php
wwwroot/inc/ophandlers.php

index 135f322876fa4ec02b9a9ffecdf971e73a553775..5fbcc058e4485e2c3928e22ff4f48f3be2aaa24f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 0.22.0
        update: drop support for PHP 5.x
        bugfix: display log records consistently
+       bugfix: evaluate {$op_deleteObject} in the right context (Mantis#2021)
 0.21.5 2020-10-05
        update: fix assorted URL and notes
        update: add SNMP support for HPE 5130 (JG937A) and A5120 (JG237A)
index ef72fae75e24e730ee86bed919cd21329b8211ce..3a11dab3d165bdba52148bb01c19e4ebf23fcc80 100644 (file)
@@ -1173,7 +1173,7 @@ function renderEditObjectForm()
                echo ' checked';
        echo "></td></tr>\n";
        echo "<tr><td>&nbsp;</td><th class=tdright>Actions:</th><td class=tdleft>";
-       echo getOpLink (array ('op'=>'deleteObject', 'page'=>'depot', 'tab'=>'addmore', 'object_id'=>$object_id), '' ,'destroy', 'Delete object', 'need-confirmation');
+       echo getOpLink (array ('op' => 'deleteObject'), '' ,'destroy', 'Delete object', 'need-confirmation');
        echo "&nbsp;";
        echo getOpLink (array ('op'=>'resetObject'), '' ,'clear', 'Reset (cleanup) object', 'need-confirmation');
        echo "</td></tr>\n";
index d64c407eb772a3b2af8ac49eb026f30765dae6f4..61d035b6d6291cf541341bcacc0760e7a8b13573 100644 (file)
@@ -83,7 +83,6 @@ $tabhandler['depot']['default'] = 'renderDepot';
 $tabhandler['depot']['addmore'] = 'renderAddMultipleObjectsForm';
 $ophandler['depot']['addmore']['addObjects'] = 'addMultipleObjects';
 $ophandler['depot']['addmore']['addLotOfObjects'] = 'addLotOfObjects';
-$ophandler['depot']['addmore']['deleteObject'] = 'deleteObject';
 
 $page['location']['bypass'] = 'location_id';
 $page['location']['bypass_type'] = 'natural';
@@ -248,6 +247,7 @@ $ophandler['object']['ip']['add'] = 'addIPAllocation';
 $ophandler['object']['ip']['del'] = 'delIPAllocation';
 $ophandler['object']['edit']['clearSticker'] = 'clearSticker';
 $ophandler['object']['edit']['update'] = 'updateObject';
+$ophandler['object']['edit']['deleteObject'] = 'deleteObject';
 $ophandler['object']['edit']['resetObject'] = 'resetObject';
 $ophandler['object']['log']['add'] = 'addObjectlog';
 $ophandler['object']['log']['del'] = 'tableHandler';
index 4a3ba25645e8d72a30b87d4c59fc74b877be180d..14527341823e80f602e78f1ccabb7f43cd8d7081 100644 (file)
@@ -1475,6 +1475,7 @@ function deleteObject ()
        foreach ($racklist as $rack_id)
                usePreparedDeleteBlade ('RackThumbnail', array ('rack_id' => $rack_id));
        showFuncMessage (__FUNCTION__, 'OK', array ($oinfo['dname']));
+       return buildRedirectURL ('depot', 'addmore');
 }
 
 function resetObject ()