Purchase : test $_FILES before trying to save file
This commit is contained in:
parent
9f3e308a21
commit
067434e520
2 changed files with 4 additions and 2 deletions
|
|
@ -262,6 +262,9 @@ class Acc_Document extends Document {
|
|||
/**
|
||||
* pj is the $_FILES key
|
||||
*/
|
||||
if ( $_FILES['pj']['name']=="") {
|
||||
return false;
|
||||
}
|
||||
$a_file= $this->db->upload('pj',only_oid:false);
|
||||
if ($a_file == false) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1052,9 +1052,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
|
|||
}
|
||||
|
||||
/* Save the attachment */
|
||||
if ( isset ($_FILES))
|
||||
if ( isset ($_FILES) && sizeof($_FILES) != 0 && $_FILES["pj"]["name"] != 0 )
|
||||
{
|
||||
if ( sizeof($_FILES) != 0 )
|
||||
$acc_document=new \Acc_Document($this->db, $this->jr_id);
|
||||
$acc_document->save_receipt();
|
||||
$this->doc=HtmlInput::show_receipt_document($this->jr_id,h($_FILES['pj']['name']));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue