1 | <?php |
||
17 | class Priloha extends FlexiBeeRW |
||
18 | { |
||
19 | /** |
||
20 | * Evidence užitá objektem. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | public $evidence = 'priloha'; |
||
25 | |||
26 | /** |
||
27 | * Evidence s přílohami |
||
28 | * |
||
29 | * @var array |
||
30 | */ |
||
31 | public static $relatedEvidence = [ |
||
32 | 'prodejka' => 'doklFak', 'pohledavka' => 'doklFak', 'zavazek' => 'doklFak', |
||
33 | 'faktura-prijata' => 'doklFak', 'faktura-vydana' => 'doklFak', |
||
34 | 'interni-doklad' => 'doklInt', 'pokladni-pohyb' => 'doklInt', 'vzajemny-zapocet' => 'doklInt', |
||
35 | 'banka' => 'doklInt', |
||
36 | 'poptavka-vydana' => 'doklObch', 'poptavka-prijata' => 'doklObch', 'objednavka-prijata' => 'doklObch', |
||
37 | 'nabidka-vydana' => 'doklObch', |
||
38 | 'objednavka-vydana' => 'doklObch', 'nabidka-prijata' => 'doklObch', |
||
39 | 'skladovy-pohyb' => 'doklSklad', |
||
40 | 'cenik' => 'cenik', |
||
41 | 'adresar' => 'adresar', 'kontakt' => 'kontakt' |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * Attach file |
||
46 | * Přilož Soubor |
||
47 | * |
||
48 | * @param string $filepath |
||
49 | * @param array $attachmentData |
||
50 | */ |
||
51 | 1 | public function attachFile($filepath, $attachmentData = []) |
|
68 | |||
69 | /** |
||
70 | * Obtain url for Attachment Download |
||
71 | * |
||
72 | * @param \FlexiBeeRO $object Source object |
||
73 | * @return string url |
||
74 | */ |
||
75 | public static function getDownloadUrl($object) |
||
76 | { |
||
77 | $urlParts = parse_url($object->apiURL); |
||
78 | $pathParts = pathinfo($urlParts['path']); |
||
79 | return $urlParts['scheme'].'://'.$urlParts['host'] .( array_key_exists('port',$urlParts) ? ':'.$urlParts['port'] : '') .$pathParts['dirname'].'/'.$pathParts['filename'].'/content'; |
||
80 | } |
||
81 | |||
82 | /** |
||
83 | * Obtain first attachment for given object |
||
84 | * |
||
85 | * @param FlexiBeeRO $object |
||
86 | * @return array |
||
87 | */ |
||
88 | public static function getFirstAttachment($object) |
||
93 | |||
94 | /** |
||
95 | * Gives you attachment body as return value |
||
96 | * |
||
97 | * @param int $attachmentID |
||
98 | * |
||
99 | * @return string |
||
100 | */ |
||
101 | public static function getAttachment($attachmentID) |
||
114 | |||
115 | /** |
||
116 | * Send "download" headers first and then file itself |
||
117 | * |
||
118 | * @param FlexiBeeRO $object |
||
119 | * @param int|string $attachmentID |
||
120 | */ |
||
121 | public static function download($object, $format = 'pdf', |
||
144 | |||
145 | /** |
||
146 | * Save attachment to file |
||
147 | * |
||
148 | * @param int $attachmentID |
||
149 | * @param string $destination directory or filename with path |
||
150 | * @return int |
||
151 | */ |
||
152 | public static function saveToFile($attachmentID, $destination) |
||
169 | |||
170 | /** |
||
171 | * Add Attachment from File |
||
172 | * |
||
173 | * @param FlexiBeeRW $object |
||
174 | * @param string $filename |
||
175 | * |
||
176 | * @return int HTTP response code |
||
177 | */ |
||
178 | public static function addAttachmentFromFile($object, $filename) |
||
183 | |||
184 | /** |
||
185 | * Add Attachment related to current $object content |
||
186 | * |
||
187 | * @param FlexiBeeRW $object |
||
188 | * @param string $filename |
||
189 | * @param string $attachment Body |
||
190 | * @param string $contentType Attachment Content-Type |
||
191 | * |
||
192 | * @return int HTTP Response code |
||
193 | */ |
||
194 | public static function addAttachment($object, $filename, $attachment, |
||
206 | |||
207 | /** |
||
208 | * Obtain Record related attachments list |
||
209 | * |
||
210 | * @param FlexiBeeRO $object |
||
211 | * @return array |
||
212 | */ |
||
213 | public static function getAttachmentsList($object) |
||
227 | } |
||
228 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: