61 lines
1.9 KiB
PHP
61 lines
1.9 KiB
PHP
|
|
<?
|
||
|
|
require_once('include/formbase.php');
|
||
|
|
require_once("modules/EcmDocuments/dirstree.php");
|
||
|
|
|
||
|
|
$z="select name from ecmdocuments where id='".$_GET['fromdir']."'";
|
||
|
|
$w=mysql_query($z);
|
||
|
|
$r=mysql_fetch_array($w);
|
||
|
|
$name=$r['name'];
|
||
|
|
$project_id=createdir($_GET['todir'],$name,getnextdirnumber($_GET['todir']));
|
||
|
|
$projectoneid=269;
|
||
|
|
clone_dir($projectoneid,$project_id);
|
||
|
|
|
||
|
|
$z="select id from ecmdocuments where name='Building Docs' and iddir='".$project_id."'";
|
||
|
|
$w=mysql_query($z);
|
||
|
|
$r=mysql_fetch_array($w);
|
||
|
|
$delbuilding=$r['id'];
|
||
|
|
|
||
|
|
$z="select id from ecmdocuments where name='Corporate' and iddir='".$project_id."'";
|
||
|
|
$w=mysql_query($z);
|
||
|
|
$r=mysql_fetch_array($w);
|
||
|
|
$delcorporate=$r['id'];
|
||
|
|
|
||
|
|
$z="select id from ecmdocuments where name='Acquistion' and iddir='".$project_id."'";
|
||
|
|
$w=mysql_query($z);
|
||
|
|
$r=mysql_fetch_array($w);
|
||
|
|
$delacquisition=$r['id'];
|
||
|
|
|
||
|
|
mysql_query("delete from ecmdocuments where id='".$delbuilding."'");
|
||
|
|
mysql_query("delete from ecmdocuments where id='".$delcorporate."'");
|
||
|
|
mysql_query("delete from ecmdocuments where id='".$delacquisition."'");
|
||
|
|
$acquisition_id=createdir($project_id,"Acquisition",1);
|
||
|
|
|
||
|
|
$z="select name,id from ecmdocuments where iddir='".$_GET['fromdir']."'";
|
||
|
|
$w=mysql_query($z);
|
||
|
|
while($r=mysql_fetch_array($w))
|
||
|
|
{
|
||
|
|
if($r['name']=="Building Docs")$buildingdocs_id=$r['id'];
|
||
|
|
if($r['name']=="Corporate Docs")$corporatedocs_id=$r['id'];
|
||
|
|
if($r['name']!="Corporate Docs" && $r['name']!="Building Docs")
|
||
|
|
{
|
||
|
|
$tab_id[]=$r['id'];
|
||
|
|
$tab_name[]=$r['name'];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
movedir($buildingdocs_id,$project_id,"Building Docs",2);
|
||
|
|
movedir($corporatedocs_id,$project_id,"Corporate Docs",3);
|
||
|
|
$nnn=4;
|
||
|
|
for($i=0;$i<=count($tab_id)-1;$i++)
|
||
|
|
{
|
||
|
|
$name=$tab_name[$i];
|
||
|
|
movedir($tab_id[$i],$acquisition_id,$name,$nnn);
|
||
|
|
$nnn++;
|
||
|
|
}
|
||
|
|
reorganizedir($project_id);
|
||
|
|
reorganizedir($acquisition_id);
|
||
|
|
|
||
|
|
delete_recursive($_GET['fromdir']);
|
||
|
|
|
||
|
|
handleRedirect($project_id,'EcmDocuments');
|
||
|
|
?>
|