DAY-1 Source code fix remove_logo
proposal for ci4 upgrade code to a stable version, manage remove_logo
// IN /root/app/Controllers/Config.php
Categories
Keywords
DAY 1
thanks @owlbrudder
following explanation:
the company_logo config option allows you to replace the OSPOS logo with the company logo, OK
- Add company logo YES
- validate the config modification YES after fix
- delete the logo NO because it does not disappear on disk, only in the database TABLE ospos_app_config KEY company_logo
- if we reload a new company logo the name on the disk will be indexed filename_1...
NOTE company logo can only be loaded once.
Like /root/app/controllers/Config.php --- remove_logo method
FIX rename remove_logo with postRemove_logo
code
public function postRemove_logo(): void
{
$file = FCPATH.'uploads/' . $this->config['company_logo'];
if (is_readable($file) && unlink($file)) {
$success = $this->appconfig->save(['company_logo' => '']);
} else {
$success = "The file was not found";
}
$success = $this->appconfig->save(['company_logo' => '']);
echo json_encode (['success' => $success]);
}
PS I use code tags, I don't understand why it's buggy??? OK I found thanks @objecttothis your code
best regards