本文整理汇总了PHP中Companies::createEmptyCompany方法的典型用法代码示例。如果您正苦于以下问题:PHP Companies::createEmptyCompany方法的具体用法?PHP Companies::createEmptyCompany怎么用?PHP Companies::createEmptyCompany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Companies
的用法示例。
在下文中一共展示了Companies::createEmptyCompany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uploadDocuments
//.........这里部分代码省略.........
if ($existingW9) {
$W9->Revision_ID = -1;
} else {
$W9->Revision_ID = 0;
}
$vendor = Vendors::model()->findByAttributes(array(
'Client_Client_ID' => Yii::app()->user->clientID,
'Vendor_Client_ID' => $client->Client_ID,
));
if (isset($vendor->Active_Relationship) && $vendor->Active_Relationship == Vendors::NOT_ACTIVE_RELATIONSHIP) {
$vendor->Active_Relationship = Vendors::ACTIVE_RELATIONSHIP;
$vendor->save();
} else if (!$vendor && Yii::app()->user->clientID != 0 && Yii::app()->user->clientID != $client->Client_ID) {
$vendor = new Vendors();
$vendor->Vendor_ID_Shortcut = '';
$vendor->Vendor_Client_ID = $client->Client_ID;
$vendor->Client_Client_ID = Yii::app()->user->clientID;
$vendor->Vendor_Name_Checkprint = '';
$vendor->Vendor_1099 = '';
$vendor->Vendor_Default_GL = '';
$vendor->Vendor_Default_GL_Note = '';
$vendor->Vendor_Note_General = '';
$vendor->Vendor_Contact = trim($current_upload_file['contact']);
$vendor->Vendor_Phone = trim($current_upload_file['phone']);
$vendor->save();
}
} else {
//if company does not exists, create new company
$client = Companies::createEmptyCompany($fedId, $newCompanyName);
$company_model = Companies::model()->findByPk($client->Company_ID);
//fill created company with dataentry values from session
Companies::fillWithSessionDataEntry($company_model,$current_upload_file);
if (Yii::app()->user->clientID != 0) {
$vendor = new Vendors();
$vendor->Vendor_ID_Shortcut = '';
$vendor->Vendor_Client_ID = $client->Client_ID;
$vendor->Client_Client_ID = Yii::app()->user->clientID;
$vendor->Vendor_Name_Checkprint = '';
$vendor->Vendor_1099 = '';
$vendor->Vendor_Default_GL = '';
$vendor->Vendor_Default_GL_Note = '';
$vendor->Vendor_Note_General = '';
$vendor->Vendor_Contact = trim($current_upload_file['contact']);
$vendor->Vendor_Phone = trim($current_upload_file['phone']);
$vendor->save();
}
$W9->Revision_ID = 0;
}
// save w9
$W9->Client_ID = $client->Client_ID;
$W9->save();
if ($person_to_email) {
Mail::sendNewW9ForDataEntry($person_to_email->person->Email, $person_to_email->person->First_Name, $person_to_email->person->Last_Name);
}
} else if ($current_upload_file['doctype'] == self::AP) {
示例2: importVendors
/**
* Import Vendors
* @param $clientID
* @param $importedVendors
*/
public static function importVendors($clientID, $importedVendors)
{
$all_amount=count($importedVendors);
$i=0;
$pb= ProgressBar::init();
foreach($importedVendors as $importedVendor) {
$company = Companies::model()->with('client')->findByAttributes(array(
'Company_Fed_ID' => $importedVendor['fedId'],
));
if ($company) {
$client = $company->client;
} else {
//if company does not exists, create new company
$client = Companies::createEmptyCompany($importedVendor['fedId'], $importedVendor['companyName'], $importedVendor);
}
$vendorClientId = $client->Client_ID;
$vendor = Vendors::model()->findByAttributes(array(
'Client_Client_ID' => $clientID,
'Vendor_Client_ID' => $vendorClientId,
));
$newVendor = false;
if (!$vendor) {
$vendor = new Vendors();
$newVendor = true;
} else {
$vendor->Active_Relationship = self::ACTIVE_RELATIONSHIP;
$vendor->save();
}
$vendor->Vendor_ID_Shortcut = $importedVendor['shortcut'];
$vendor->Vendor_Client_ID = $vendorClientId;
$vendor->Client_Client_ID = $clientID;
$vendor->Vendor_Name_Checkprint = $importedVendor['checkprint'];
$vendor->Vendor_1099 = $importedVendor['v1099'];
$vendor->Vendor_Default_GL = $importedVendor['defG'];
$vendor->Vendor_Default_GL_Note = $importedVendor['defGLNote'];
$vendor->Vendor_Note_General = $importedVendor['noteGeneral'];
if ($vendor->validate()) {
$vendor->save();
} else if ($newVendor) {
$vendor = new Vendors();
$vendor->Vendor_ID_Shortcut = '';
$vendor->Vendor_Client_ID = $vendorClientId;
$vendor->Client_Client_ID = $clientID;
$vendor->Vendor_Name_Checkprint = '';
$vendor->Vendor_1099 = '';
$vendor->Vendor_Default_GL = '';
$vendor->Vendor_Default_GL_Note = '';
$vendor->Vendor_Note_General = '';
$vendor->Active_Relationship = self::ACTIVE_RELATIONSHIP;
$vendor->save();
}
$i++;
$percent=intval($i/$all_amount*100);
session_start();
$_SESSION['progress']=$percent;
session_write_close();
}
}