コード例 #1
1
ファイル: odoo.php プロジェクト: funbaker/odoozpush
 public function Logon($username, $domain, $password)
 {
     $common = ripcord::client(ODOO_SERVER . '/xmlrpc/2/common');
     $this->uid = $common->authenticate(ODOO_DB, $username, $password, []);
     $this->username = $username;
     $this->domain = $domain;
     $this->password = $password;
     if ($this->uid) {
         $this->models = ripcord::client(ODOO_SERVER . '/xmlrpc/2/object');
         $this->models->_throwExceptions = true;
         $partners = $this->models->execute_kw(ODOO_DB, $this->uid, $password, 'res.users', 'search_read', [[['id', '=', $this->uid]]], ['fields' => ['partner_id']]);
         if (count($partners) == 0) {
             return false;
         }
         ZLog::Write(LOGLEVEL_DEBUG, 'Odoo::Logon: $partners = (' . print_r($partners, true)) . ')';
         $this->partnerID = $partners[0]['partner_id'][0];
         ZLOG::Write(LOGLEVEL_INFO, 'Odoo:Logon: Logged in with partner/user id ' . $this->partnerID . '/' . $this->uid);
         # timezone
         $users = $this->models->execute_kw(ODOO_DB, $this->uid, $password, 'res.users', 'search_read', [[['id', '=', $this->uid]]], ['fields' => ['tz']]);
         $user = $users[0];
         $this->utz = $user['tz'];
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * Use the submitted CPO type for next setters/getters
  *
  * @param string    $options    (opt) If not specified, the default Options (CPO) will be used
  *                              Valid option SyncParameters::SMSOPTIONS (string "SMS")
  *
  * @access public
  * @return
  */
 public function UseCPO($options = self::DEFAULTOPTIONS)
 {
     if ($options !== self::DEFAULTOPTIONS && $options !== self::SMSOPTIONS) {
         throw new FatalNotImplementedException(sprintf("SyncParameters->UseCPO('%s') ContentParameters is invalid. Such type is not available.", $options));
     }
     ZLOG::Write(LOGLEVEL_DEBUG, sprintf("SyncParameters->UseCPO('%s')", $options));
     $this->currentCPO = $options;
     $this->checkCPO($this->currentCPO);
 }
コード例 #3
0
 /**
  * Use the submitted CPO type for next setters/getters
  *
  * @param string    $options    (opt) If not specified, the default Options (CPO) will be used
  *                              Valid option SyncParameters::SMSOPTIONS (string "SMS")
  *
  * @access public
  * @return
  */
 public function UseCPO($options = self::DEFAULTOPTIONS)
 {
     $options = strtoupper($options);
     $this->isValidType($options);
     // remove potential old default CPO if available
     if (isset($this->contentParameters[self::DEFAULTOPTIONS]) && $options != self::DEFAULTOPTIONS && $options !== self::SMSOPTIONS) {
         $a = $this->contentParameters;
         unset($a[self::DEFAULTOPTIONS]);
         $this->contentParameters = $a;
         ZLog::Write(LOGLEVEL_DEBUG, "SyncParameters->UseCPO(): removed existing DEFAULT CPO as it is obsolete");
     }
     ZLOG::Write(LOGLEVEL_DEBUG, sprintf("SyncParameters->UseCPO('%s')", $options));
     $this->currentCPO = $options;
     $this->checkCPO($this->currentCPO);
 }
コード例 #4
0
ファイル: ox.php プロジェクト: aniesshsethh/z-push-ox
 private function GetSubFolders($id)
 {
     ZLog::Write(LOGLEVEL_DEBUG, 'BackendOX::GetSubFolders(' . $id . ')');
     $lst = array();
     $response = $this->OXConnector->OXreqGET('/ajax/folders', array('action' => 'list', 'session' => $this->OXConnector->getSession(), 'parent' => $id, 'columns' => '1,301,'));
     ZLOG::Write(LOGLEVEL_DEBUG, 'BackendOX::GetSubFolder(' . $id . ') - response: ' . print_r($response, true));
     foreach ($response["data"] as &$folder) {
         // restrict to contacts | calendar | mail
         if (in_array($folder[1], array("contacts", "calendar", "mail"))) {
             $lst[] = $folder[0];
             $subfolders = $this->GetSubFolders($folder[0]);
             foreach ($subfolders as &$subfolder) {
                 $lst[] = $subfolder;
             }
         }
     }
     ZLOG::Write(LOGLEVEL_DEBUG, 'BackendOX::GetSubFolder() - lst: ' . print_r($lst, true));
     return $lst;
 }