$ecmdir->label = trim($_POST["label"]); $ecmdir->description = trim($_POST["desc"]); $ecmdir->fk_parent = $_POST["catParent"]; $ok=true; if (! $ecmdir->label) { $mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>'; $_GET["action"] = "create"; $ok=false; } if ($ok) { $id = $ecmdir->create($user); if ($id > 0) { Header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); exit; } else { $langs->load("errors"); $mesg='<div class="error">'.$langs->trans($ecmdir->error).'</div>'; $_GET["action"] = "create"; } } }
{ $fk_parent=0; // Parent is root } if ($fk_parent >= 0) { $ecmdirtmp=new ECMDirectory($db); $ecmdirtmp->ref = 'NOTUSEDYET'; $ecmdirtmp->label = basename($dirdesc['fullname']); $ecmdirtmp->description = ''; $ecmdirtmp->fk_parent = $fk_parent; $txt="We create directory ".$ecmdirtmp->label." with parent ".$fk_parent; dol_syslog($txt); //print $txt."<br>\n"; $id = $ecmdirtmp->create($user); if ($id > 0) { $newdirsql=array('id'=>$id, 'id_mere'=>$ecmdirtmp->fk_parent, 'label'=>$ecmdirtmp->label, 'description'=>$ecmdirtmp->description, 'fullrelativename'=>$relativepathmissing); $sqltree[]=$newdirsql; // We complete fulltree for following loops //var_dump($sqltree); $adirwascreated=1; } } else { $txt="Parent of ".$dirdesc['fullname']." not found"; dol_syslog($txt);