insertschooldetails als ze nog niet bestaan

This commit is contained in:
Monique
2022-11-07 15:04:41 +01:00
parent bbb934ed61
commit c00017d36e
2 changed files with 23 additions and 10 deletions
+15 -2
View File
@@ -171,11 +171,24 @@ class Compactsop extends MY_Controller{
rename($source, $target);
chmod($target, '0777');
//TODO: unlink eventueel oud logo
$logo = $this->Schooldetails_model->getLogo($schoolID);
$details = $this->Schooldetails_model->get_records_where(['organisatie_id' => $schoolID]);
if ($details) {
$logo = $details['logo'];
if ($logo) {
$padNaam = $savePath . $logo;
unlink($padNaam);
}
$this->Schooldetails_model->update_record_where(['logo' => $filename], ['organisatie_id' => $schoolID]);
} else {
$org = $this->Organisaties_model->get_record_by_id($schoolID);
$this->Schooldetails_model->insert_record([
'logo' => $filename,
'organisatie_id' => $schoolID,
'plaats' => $org->plaats ? $org->plaats : ''
]);
}
}
function getLogo(){
+1 -1
View File
@@ -79,7 +79,7 @@ class MY_Controller extends CI_Controller{
// public $version = '1.18.05';// fout schoolgegevens compactsop
// public $version = '1.18.08';// kleurenfout
// public $version = '1.18.09';// zoek gebruikers sneller
public $version = '1.18.12';// compactsops maken van valtonderorgs
public $version = '1.18.13';// compactsops maken van valtonderorgs