Example #1
0
 /**
  * @param Client $client
  * @param string $paypalSubscrId
  */
 function onSubscrCancel($client, $paypalSubscrId)
 {
     if ($client) {
         $client->SetSettingValue(CLIENT_SETTINGS::ZOHOCRM_UNSUBSCR_DATE, date("m/d/Y"));
         $this->updateClient($client, array('contact'));
     }
 }
Example #2
0
 /**
  * Load client by ID
  *
  * @param integer $id
  * @return Client
  */
 static function Load($id)
 {
     $db = Core::GetDBInstance();
     $userinfo = $db->GetRow("SELECT * FROM users WHERE id=?", array($id));
     if (!$userinfo) {
         throw new Exception(sprintf(_("Client ID#%s not found in database"), $id));
     }
     $Client = new Client($userinfo["login"], $userinfo["password"], $userinfo["email"]);
     $Client->ID = $id;
     foreach (self::$FieldPropertyMap as $k => $v) {
         // Не помню почему игнорировать пустые. Но нужно устанавливать vat в 0
         if ($userinfo[$k] || $k == "vat") {
             $Client->{$v} = $userinfo[$k];
         }
     }
     $custom_fields = $db->Execute("SELECT *, (SELECT name FROM client_fields \r\n\t\t\t\tWHERE id=client_info.fieldid) as fieldname FROM client_info WHERE clientid=?", array($id));
     while ($field = $custom_fields->FetchRow()) {
         $Client->{$field['fieldname']} = $field['value'];
     }
     $settings = $db->Execute("SELECT * FROM user_settings WHERE userid=?", array($id));
     while ($setting = $settings->FetchRow()) {
         $Client->SetSettingValue($setting['key'], $setting['value']);
     }
     return $Client;
 }
Example #3
0
					
					$Client = new Client($_SESSION['wizard']['newclient']["login"], $Crypto->Hash($password), $_SESSION['wizard']['newclient']["email"]);
					$Client->Name = $_SESSION['wizard']['newclient']["name"];
					$Client->Organization = $_SESSION['wizard']['newclient']["org"];
					$Client->Business = $_SESSION['wizard']['newclient']["business"];
					$Client->Address = $_SESSION['wizard']['newclient']["address"];
					$Client->Address2 = $_SESSION['wizard']['newclient']["address2"];
					$Client->City = $_SESSION['wizard']['newclient']["city"];
					$Client->State = $_SESSION['wizard']['newclient']["state"];
					$Client->Country = $_SESSION['wizard']['newclient']["country"];
					$Client->ZipCode = $_SESSION['wizard']['newclient']["zipcode"];
					$Client->Phone = $_SESSION['wizard']['newclient']["phone"];
					$Client->Fax = $_SESSION['wizard']['newclient']["fax"];
					$Client->Status = CONFIG::$CLIENT_MANUAL_APPROVAL ? 0 : 1;
					
					$Client->SetSettingValue('inline_help', 1);
					try
					{
						foreach ((array)$_SESSION['wizard']['newclient']["add"] as $k=>$v)
							$Client->{$k} = $v;
					}
					catch(Exception $e){}
					
					try
					{
						$_SESSION["userid"] = $Client->Save()->ID;
					}
					catch(Exception $e)
					{
						throw new ApplicationException($e->getMessage(), $e->getCode());
					}