Issues (103)

Examples/AttachmentUpload.php (2 issues)

1
#!/usr/bin/php -f
2
<?php
3
/**
4
 * FlexiPeeHP - Example how to upload Attachment
5
 *
6
 * @author     Vítězslav Dvořák <[email protected]>
7
 * @copyright  (G) 2017 Vitex Software
8
 */
9
10
namespace Example\FlexiPeeHP;
11
12
include_once './config.php';
13
include_once '../vendor/autoload.php';
14
include_once './common.php';
15
16
$invoiceID = askForFlexiBeeID();
17
18
$invoice = new \FlexiPeeHP\FakturaVydana($invoiceID);
19
20
$result = \FlexiPeeHP\Priloha::addAttachmentFromFile($invoice,
21
        '../flexipeehp.png');
22
if ($result == 201) {
0 ignored issues
show
The condition $result == 201 is always false.
Loading history...
23
    $allAttachments = \FlexiPeeHP\Priloha::getAttachmentsList($invoice);
24
    $lastAttachment = end($allAttachments);
25
    $invoice->addStatusMessage('Attachment '.$invoice->getFlexiBeeURL().'/prilohy/'.$lastAttachment['id'].'/content OK',
26
        'success');
27
} else {
28
    $invoice->addStatusMessage('Attachment '.$invoice->getFlexiBeeURL().' Failed',
0 ignored issues
show
Deprecated Code introduced by
The function FlexiPeeHP\RO::getFlexiBeeURL() has been deprecated: since version 2.0 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

28
    $invoice->addStatusMessage('Attachment './** @scrutinizer ignore-deprecated */ $invoice->getFlexiBeeURL().' Failed',

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
29
        'error');
30
}
31
32