@@ -81,7 +81,7 @@ public function processInit($init)
8181 parent ::processInit ($ init );
8282 if (is_array ($ init ) && array_key_exists ('dbNazev ' , $ init )) {
8383 $ companyInfo = $ this ->getFlexiData ('/c/ ' .$ init ['dbNazev ' ]);
84- if (!array_key_exists ('message ' , $ companyInfo )){
84+ if (!array_key_exists ('message ' , $ companyInfo )) {
8585 $ this ->takeData (current ($ companyInfo ));
8686 }
8787 }
@@ -177,17 +177,41 @@ public function saveBackupTo($filename)
177177 /**
178178 * Restore company from given file
179179 *
180- * @param string $filename
180+ * @link https://www.flexibee.eu/api/dokumentace/ref/restore-backup/ Obnovení ze zálohy
181+ *
182+ * @param string $filename *.winstrom-backup file
183+ * @param string $name Extra name for restored company
184+ * @param boolean $disableEet Disable EET on restored company
185+ * @param boolean $disableAutoSendMail Dsable auto sending of all documents
186+ * @param boolean $disableWebHooks Remove Registered webhooks
181187 *
182- * @return boolean result
188+ * @return boolean restore result
183189 */
184- public function restoreBackupFrom ($ filename )
190+ public function restoreBackupFrom ($ filename , $ name = null ,
191+ $ disableEet = false ,
192+ $ disableAutoSendMail = false ,
193+ $ disableWebHooks = false )
185194 {
195+ $ options = [];
196+ if (!empty ($ name )) {
197+ $ options ['name ' ] = $ name ;
198+ }
199+ if ($ disableEet === true ) {
200+ $ options ['disableEet ' ] = 1 ;
201+ }
202+ if ($ disableAutoSendMail === true ) {
203+ $ options ['disableAutoSendMail ' ] = 1 ;
204+ }
205+ if ($ disableWebHooks === true ) {
206+ $ options ['disableWebHooks ' ] = 1 ;
207+ }
208+
186209 $ headersBackup = $ this ->defaultHttpHeaders ;
187210 $ this ->defaultHttpHeaders ['Accept ' ] = '*/* ' ;
188211 $ this ->defaultHttpHeaders ['Content-Type ' ] = 'application/x-winstrom-backup ' ;
189212 $ this ->setPostFields (file_get_contents ($ filename ));
190- $ this ->performRequest ('restore ' , 'PUT ' );
213+ $ this ->performRequest ('restore ' .(empty ($ options ) ? '' : '? ' .http_build_query ($ options ) ),
214+ 'PUT ' );
191215 return $ this ->lastResponseCode == 200 ;
192216 }
193217
0 commit comments