Spoje-NET /
php-flexibee
| 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
introduced
by
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', |
||
| 29 | 'error'); |
||
| 30 | } |
||
| 31 | |||
| 32 |