rechnungsanhang handlign
charts bugfix only empty database
This commit is contained in:
@@ -56,6 +56,9 @@ class Charts extends BaseController {
|
||||
GROUP BY description, account_id
|
||||
EOD;
|
||||
$data = array();
|
||||
$werte = array();
|
||||
$ids = array();
|
||||
$labels = array();
|
||||
$result = $this->db->query($query);
|
||||
foreach ($result->getResult() as $row) {
|
||||
$werte[] = $row->amount;
|
||||
|
||||
@@ -160,17 +160,23 @@ class Home extends BaseController
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function viewBill($filename) {
|
||||
public function viewBill(string $filename) {
|
||||
$filePath= WRITEPATH . '/uploads';
|
||||
$file = new \CodeIgniter\Files\File($filePath."/".$filename);
|
||||
log_message('debug',$file->getMimeType());
|
||||
if ($file->getMimeType() == 'application/pdf')
|
||||
$this->viewPdf($filename);
|
||||
else
|
||||
return view('viewBillImg', ['filename'=>WRITEPATH . '/uploads'.$filename]);
|
||||
else{
|
||||
$imginfo = getimagesize($filePath."/".$filename);
|
||||
header("Content-type: {$imginfo['mime']}");
|
||||
readfile($filePath."/".$filename);
|
||||
exit;
|
||||
}
|
||||
// return view('viewBillImg', ['filename'=>'writable/uploads/'.$filename]);
|
||||
}
|
||||
|
||||
public function viewPdf($filename) {
|
||||
|
||||
public function viewPdf(string $filename) {
|
||||
$view = \Config\Services::renderer();
|
||||
log_message('debug',$filename);
|
||||
$filePath= WRITEPATH . '/uploads';
|
||||
@@ -212,7 +218,7 @@ class Home extends BaseController
|
||||
if (! $file->isValid() && ($file->getError() != UPLOAD_ERR_NO_FILE)) {
|
||||
throw new \RuntimeException($file->getErrorString() . '(' . $file->getError() . ')');
|
||||
} else if ($file->isValid()) {
|
||||
$rules['billfile'] = ['uploaded[billfile]','max_size[billfile,10000]','mime_in[billfile,application/pdf]'];
|
||||
$rules['billfile'] = ['uploaded[billfile]','max_size[billfile,10000]','mime_in[billfile,application/pdf,image/jpg,image/jpeg]'];
|
||||
$errors['billfile'] = ['uploaded'=>'Fehler beim Upload','max_size' => 'Zu Groß', 'mime_in' => "Ungültiger Datentyp"];
|
||||
$uploading = true;
|
||||
}
|
||||
@@ -223,23 +229,30 @@ class Home extends BaseController
|
||||
}
|
||||
else{
|
||||
$data = $this->request->getPost();
|
||||
//log_message('debug',print_r($data,true));
|
||||
log_message('debug',print_r($data,true));
|
||||
|
||||
if ($this->request->getPost('scheduled') =="0"){
|
||||
if ($uploading){
|
||||
$date = Time::parse($this->request->getPost('datum'));
|
||||
$file->move(WRITEPATH . 'uploads',$date->toLocalizedString('yyyyMMdd')." ".$this->request->getPost('receiver')." ".$this->request->getPost("comment[0]").".".$file->guessExtension());
|
||||
$data['rechnung'] = $file->getName();
|
||||
log_message('debug', $file->getName());
|
||||
}
|
||||
$bills = model('App\Models\mBills');
|
||||
$bills->saveBill($data);
|
||||
if ($this->request->getPost('removeBillFile')){
|
||||
$bills->deleteBillFile($data['id']);
|
||||
unlink(WRITEPATH . 'uploads/'.$this->request->getPost('removeBillFile'));
|
||||
}
|
||||
$billId = $bills->saveBill($data);
|
||||
|
||||
if ($uploading){
|
||||
$date = Time::parse($data['datum']);
|
||||
$file->move(WRITEPATH . 'uploads',$date->toLocalizedString('yyyyMMdd')." ".$data['receiver']." ".$billId.".".$file->guessExtension());
|
||||
log_message('debug', $file->getName());
|
||||
$bills->storeBillFile($billId, $file->getName());
|
||||
}
|
||||
|
||||
$redirectURL = session('redirect_url') ?? site_url('/');
|
||||
unset($_SESSION['redirect_url']);
|
||||
return redirect()->to($redirectURL);
|
||||
}
|
||||
else{
|
||||
$scheduled = model('App\Models\mScheduled');
|
||||
$scheduled->saveBill($this->request->getPost());
|
||||
$scheduled->saveBill($data);
|
||||
}
|
||||
$this->response->redirect(site_url('/'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user