carlosomarrd / clients-oriented-ftp

Automatically exported from code.google.com/p/clients-oriented-ftp
0 stars 0 forks source link

bug in manage-files.php when deleting unaffected file #452

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.upload a file with no affectation
2.try to delete this file

What is the expected output? What do you see instead?
The file should be deleted. But it deleted the file just Under.

What version of the product are you using? On what operating system?
I am using R553 on internet explorer 9,10 and 11.

I checked the html generated code. The checkbox has the same value than the 
next file.

Original issue reported on code.google.com by evcwa...@gmail.com on 12 Mar 2014 at 9:54

GoogleCodeExporter commented 9 years ago
I suggest you add a entry in tbl_files_relations even if the file is unaffected.

It should do the trick

Original comment by evcwa...@gmail.com on 12 Mar 2014 at 10:29

GoogleCodeExporter commented 9 years ago
I made this little workaround in PSend_Upload_File class :

in PSend_Upload_File::upload_add_assignment i add this :

.
..
...
$this->users = $arguments['all_users'];

if (empty($arguments['assign_to'])) {
 $arguments['assign_to'] = array("c");
}

And near this :
.
..
...
    case 'g':
        $this->add_to = 'group_id';
        $this->account_name = $this->groups[$this->id_only];
        $this->action_number = 26;
        break;
}

$this->assignment = substr($this->assignment, 1);
if (empty($this->assignment)){
    $assignment_sql = 'NULL';
}else{
    $assignment_sql = "'$this->assignment'";
}

and i updated the query like this :
$assign_file = $database->query("INSERT INTO tbl_files_relations (file_id, 
$this->add_to, hidden)"
                                            ."VALUES ('$this->file_id', $assignment_sql, '$this->hidden')");

Now, it should be interesting to check the way orphan file is designed. Because 
tbl_files_relations could have private file unassigned to anything.

Original comment by evcwa...@gmail.com on 12 Mar 2014 at 1:50

GoogleCodeExporter commented 9 years ago
In upload-import-orphans.php

I change the query like this :

SELECT DISTINCT file_id FROM tbl_files_relations WHERE client_id IS NOT NULL OR 
group_id IS NOT NULL OR folder_id IS NOT NULL

Original comment by evcwa...@gmail.com on 12 Mar 2014 at 2:08

GoogleCodeExporter commented 9 years ago
I submitted change to github

Original comment by evcwa...@gmail.com on 14 Mar 2014 at 3:33