当前位置: 首页>>代码示例>>PHP>>正文


PHP Company::set方法代码示例

本文整理汇总了PHP中Company::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::set方法的具体用法?PHP Company::set怎么用?PHP Company::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Company的用法示例。


在下文中一共展示了Company::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDestroyAssociatedRecords

 function testDestroyAssociatedRecords()
 {
     $c = new Company();
     $c->set(array('name' => 'destroy_test'));
     $c->save();
     $p = new Project();
     $p->set(array('company_id' => $c->id, 'name' => 'destroy_project_test'));
     $p->save();
     $e = new Estimate();
     $e->set(array('project_id' => $p->id, 'name' => 'destroy_estimate_test'));
     $e->save();
     $h = new Hour();
     $h->set(array('estimate_id' => $e->id, 'name' => 'destroy_hour_test'));
     $h->save();
     $ch = new Charge();
     $ch->set(array('company_id' => $c->id, 'name' => 'destroy_charge_test'));
     $ch->save();
     $con = new SupportContract();
     $con->set(array('company_id' => $c->id, 'name' => 'destroy_contract_test'));
     $con->save();
     $sup_hr = new Hour();
     $sup_hr->set(array('support_contract_id' => $con->id, 'description' => 'destroy_support_hour_test'));
     $sup_hr->save();
     $pay = new Payment();
     $pay->set(array('company_id' => $c->id, 'name' => 'destroy_payment_test'));
     $pay->save();
     $deleted_items = array('company' => $c->id, 'project' => $p->id, 'estimate' => $e->id, 'hour' => $h->id, 'support_hour' => $sup_hr->id, 'charge' => $ch->id, 'support_contract' => $con->id, 'payment' => $pay->id);
     $c->destroyAssociatedRecords();
     $c->delete();
     $dbcon = AMP::getDb();
     foreach ($deleted_items as $table => $id) {
         if ($table == 'support_hour') {
             $table = 'hour';
         }
         $sql = 'SELECT * FROM ' . $table . ' WHERE id = ' . $id;
         if ($records = $dbcon->Execute($sql)) {
             $this->assertEqual($records->RecordCount(), 0, "{$table} not deleted correctly: %s");
         } else {
             trigger_error($dbcon->ErrorMsg());
         }
     }
 }
开发者ID:radicaldesigns,项目名称:gtd,代码行数:42,代码来源:model_tests.php

示例2: testSendEmail

 function testSendEmail()
 {
     $company = new Company();
     $company->set(array('name' => 'Test Company'));
     $company->save();
     $contact = new Contact();
     $contact->set(array('first_name' => 'Testy', 'last_name' => 'test', 'email' => 'ted@radicaldesigns.org', 'is_billing_contact' => true, 'company_id' => $company->id));
     $contact->save();
     $i = new Invoice();
     $i->set(array('company_id' => $company->id, 'start_date' => '2010-01-01', 'end_date' => '2010-03-31'));
     $i->execute();
     $i->save();
     # here i test sending my invoice
     require_once 'controller/InvoiceController.php';
     $invoice_controller = new InvoiceController();
     $invoice_controller->disableRedirect();
     $invoice_controller->execute('email', array('id' => $i->id));
     $msg = Render::_dumpMessages();
     $this->assertPattern('/Email Sent/', $msg);
 }
开发者ID:radicaldesigns,项目名称:gtd,代码行数:20,代码来源:invoicing_tests.php

示例3: testCalculateBalanceWithDateRange

 function testCalculateBalanceWithDateRange()
 {
     #Company
     $cp = new Company();
     $cp->set(array('name' => 'Test Company', 'status' => 'active'));
     $cp->save();
     $pb = new CompanyPreviousBalance();
     $pb->set(array('company_id' => $cp->id, 'amount' => 600.25, 'date' => '2010-01-30'));
     $pb->save();
     $this->assertWithinMargin($pb->getAmount(), '600.25', '.01');
     ######### Support
     $sc = new SupportContract();
     $sc->set(array('company_id' => $cp->id, 'domain_name' => 'Test', 'start_date' => '2010-01-01', 'end_date' => '2010-04-30', 'hourly_rate' => '120', 'support_hours' => '.5', 'monthly_rate' => '50'));
     $sc->save();
     # add support hours
     # before previous balance
     $h = new Hour();
     $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-01-20', 'hours' => '2.5'));
     $h->save();
     # in range
     $h = new Hour();
     $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-02-20', 'hours' => '2.5'));
     $h->save();
     # in range
     $h = new Hour();
     $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-03-20', 'hours' => '2.5'));
     $h->save();
     # out of range
     $h = new Hour();
     $h->set(array('description' => 'Test', 'support_contract_id' => $sc->id, 'date' => '2010-05-20', 'hours' => '2'));
     $h->save();
     ### Support Totals = in range is 2 months x 50 = 100, 4 @ 120 = 480 = 580
     $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31');
     $total = $cp->calculateSupportTotal($date_range);
     $this->assertEqual($total, 580);
     ###### Project
     $pj = new Project();
     $pj->set(array('name' => 'Test Project', 'company_id' => $cp->id, 'hourly_rate' => '120'));
     $pj->save();
     # Add an Estimate item #1
     $es1 = new Estimate();
     $es1->set(array('project_id' => $pj->id, 'name' => 'Test Estimate 1', 'high_hours' => '10', 'low_hours' => '5'));
     $es1->save();
     # Add an Estimate item #2
     $es2 = new Estimate();
     $es2->set(array('project_id' => $pj->id, 'name' => 'Test Estimate 2', 'high_hours' => '10', 'low_hours' => '5'));
     $es2->save();
     # Add some before previous balance hours for #1 - 5 hours at 120 = 600
     $hr = new Hour();
     $hr->set(array('estimate_id' => $es1->id, 'description' => 'Test Hours for Estimate 1', 'date' => '2010-01-15', 'hours' => '5'));
     $hr->save();
     # Add some in range hours for #1 - 5 hours at 120 = 600
     $hr = new Hour();
     $hr->set(array('estimate_id' => $es1->id, 'description' => 'Test Hours for Estimate 1', 'date' => '2010-02-15', 'hours' => '5'));
     $hr->save();
     # Add some in range hours for #2 - 5 hours at 120 = 600
     $hr = new Hour();
     $hr->set(array('estimate_id' => $es2->id, 'description' => 'Test Hours for Estimate 2', 'date' => '2010-02-15', 'hours' => '5'));
     $hr->save();
     # Add some out of range hours for #2 - 5 hours at 120 = 600
     $hr = new Hour();
     $hr->set(array('estimate_id' => $es2->id, 'description' => 'Test Hours for Estimate 2', 'date' => '2010-05-15', 'hours' => '5'));
     $hr->save();
     ## Project Totals = In range 1200, out of range 1800
     $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31');
     $total = $cp->calculateProjectsTotal($date_range);
     $this->assertEqual($total, 1200);
     #Charge
     # before previous balance
     $cr = new Charge();
     $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-01-10', 'amount' => '20.50'));
     $cr->save();
     # in date range
     $cr = new Charge();
     $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-03-14', 'amount' => '50.25'));
     $cr->save();
     # in date range
     $cr = new Charge();
     $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-03-20', 'amount' => '50'));
     $cr->save();
     # out of date range
     $cr = new Charge();
     $cr->set(array('name' => 'Test', 'company_id' => $cp->id, 'date' => '2010-05-15', 'amount' => '50'));
     $cr->save();
     # Total Charges = in range 100.25, out of range 150.25
     $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31');
     $charge_total = $cp->calculateChargesTotal($date_range);
     $this->assertEqual($charge_total, 100.25);
     ## Test Total Costs
     # Charges 100.25 + project 1200 + support 580
     $date_range = array('start_date' => '2010-01-01', 'end_date' => '2010-03-31');
     $total = $cp->calculateCosts($date_range);
     $this->assertEqual($total, 1880.25);
     ## Payments
     # add payment before previous balance date
     $py = new Payment();
     $py->set(array('company_id' => $cp->id, 'date' => '2010-01-22', 'amount' => '20.50'));
     $py->save();
     # add payment in range
     $py = new Payment();
//.........这里部分代码省略.........
开发者ID:radicaldesigns,项目名称:gtd,代码行数:101,代码来源:billing_tests.php

示例4: getPageTemplate

 public static function getPageTemplate($url)
 {
     if (count(Request::getAllRequest())) {
         switch (Request::post("type")) {
             case 'user':
                 $user = new User();
                 $user->set("email_id", Request::post("email"));
                 $user->set("password", Request::post("password"));
                 $user->set("re_pass", Request::post("r_password"));
                 $user->set("name", Request::post("name"));
                 $user->set("mobile", Request::post("mobile"));
                 $user->set("website", Request::post("website"));
                 $user->set("add", Request::post("add"));
                 $user->set("city", Request::post("city"));
                 $user->set("location", Request::post("location"));
                 $user->set("experience", Request::post("experience"));
                 $user->set("education", Request::post("education"));
                 $user->set("specialization", Request::post("specialization"));
                 $user->set("pra_court", Request::post("pra_court"));
                 $action = Request::post("action");
                 $result = $user->{$action}();
                 $page = new Page();
                 if ($result && $action == 'login') {
                     $page->set("access_id", Session::read("access_type"));
                     $pageType = $page->getPageTypeUrl();
                     $r_url = SERVER_URL . "/{$pageType}/home";
                 } elseif ($result && $action == 'registration') {
                     $page->set("access_id", Session::read("access_type"));
                     $pageType = $page->getPageTypeUrl();
                     $r_url = SERVER_URL . "/{$pageType}/home";
                 } elseif ($result && $action == 'editProfile') {
                     $page->set("access_id", Session::read("access_type"));
                     $pageType = $page->getPageTypeUrl();
                     $r_url = SERVER_URL . "/{$pageType}/profile";
                 } else {
                     $r_url = SERVER_URL . "/login";
                 }
                 General::redirectUrl($r_url);
                 break;
             case 'company':
                 $company = new Company();
                 $company->set("user_id", Request::post("userid"));
                 $company->set("name", Request::post("name"));
                 $company->set("city", Request::post("city"));
                 $company->set("location", Request::post("location"));
                 $company->set("website", Request::post("website"));
                 $company->set("email", Request::post("email"));
                 $company->set("phone", Request::post("phone"));
                 $company->set("specialization", Request::post("specialization"));
                 $company->set("description", Request::post("description"));
                 $action = Request::post("action");
                 $result = $company->{$action}();
                 //                        print_r($result);                        exit();
                 $page = new Page();
                 if ($result && $action == 'addcompany') {
                     $page->set("access_id", Session::read("access_type"));
                     $pageType = $page->getPageTypeUrl();
                     $r_url = SERVER_URL . "/{$pageType}/company";
                 } else {
                     $r_url = SERVER_URL . "/lpo-training";
                 }
                 General::redirectUrl($r_url);
                 break;
             case 'question':
                 $ques = new Questions();
                 $ques->set("user_id", Request::post("userid"));
                 $ques->set("question", Request::post("question"));
                 $ques->set("heading", Request::post("heading"));
                 $ques->set("topic_id", Request::post("topic_id"));
                 $ques->set("city", Request::post("city"));
                 $action = Request::post("action");
                 $result = $ques->{$action}();
                 //                       print_r($result);                        exit();
                 $page = new Page();
                 if ($result && $action == 'addquestion') {
                     $page->set("access_id", Session::read("access_type"));
                     $pageType = $page->getPageTypeUrl();
                     $r_url = SERVER_URL . "/{$pageType}/online-legal-advice";
                 } else {
                     $r_url = SERVER_URL . "/home";
                 }
                 General::redirectUrl($r_url);
                 break;
             case 'jobs':
                 $job = new Jobs();
                 $job->set("user_id", Request::post("userid"));
                 $job->set("heading", Request::post("heading"));
                 $job->set("education", Request::post("education"));
                 $job->set("exp_min", Request::post("exp_min"));
                 $job->set("exp_max", Request::post("exp_max"));
                 $job->set("salary", Request::post("salary"));
                 $job->set("description", Request::post("description"));
                 $job->set("c_name", Request::post("companyname"));
                 $job->set("email", Request::post("email"));
                 $job->set("phone", Request::post("phone"));
                 $job->set("city", Request::post("city"));
                 $job->set("address", Request::post("address"));
                 $result = $company->{$action}();
                 //                        print_r($result);                        exit();
                 $page = new Page();
//.........这里部分代码省略.........
开发者ID:sonaljain888,项目名称:project-legal-lawyer-,代码行数:101,代码来源:class.General.php

示例5: array

$ok = $DB->Execute($sql);
if ($ok) {
    echo "CREATED STAFF RECORDS\n";
} else {
    echo "FAILED TO CREATE STAFF RECORDS\n";
}
// CREATE COMPANIES FROM PREAMP EXPORT
$rows = $DB->Execute('select * from userdata where modin=66');
while (!$rows->EOF) {
    $status = $rows->Fields('custom16');
    if ($status == 'rEvent') {
        $status = 'active';
    }
    $company_data = array('name' => $rows->Fields('Company'), 'notes' => $rows->Fields('custom9'), 'street' => $rows->Fields('Street'), 'street_2' => $rows->Fields('Street_2'), 'city' => $rows->Fields('City'), 'state' => $rows->Fields('State'), 'zip' => $rows->Fields('Zip'), 'preamp_id' => $rows->Fields('custom1'), 'status' => $status, 'bay_area' => $rows->Fields('custom11'), 'date_started' => $rows->Fields('custom8'));
    $c = new Company();
    $c->set($company_data);
    $c->save();
    $billing_name = explode(' ', $rows->Fields('custom18'), 2);
    $billing_first = !empty($billing_name[0]) ? $billing_name[0] : '';
    $billing_last = !empty($billing_name[1]) ? $billing_name[1] : '';
    $billing_data = array('first_name' => $billing_first, 'last_name' => $billing_last, 'company_id' => $c->id, 'email' => $rows->Fields('custom2'), 'phone' => $rows->Fields('Cell_Phone'), 'is_billing_contact' => true, 'preamp_id' => $rows->Fields('custom1'));
    $billing_contact = new Contact();
    $billing_contact->set($billing_data);
    $billing_contact->save();
    $primary_name = explode(' ', $rows->Fields('custom17'), 2);
    $primary_first = !empty($primary_name[0]) ? $primary_name[0] : '';
    $primary_last = !empty($primary_name[1]) ? $primary_name[1] : '';
    $primary_data = array('first_name' => $primary_first, 'last_name' => $primary_last, 'company_id' => $c->id, 'email' => $rows->Fields('custom3'), 'phone' => $rows->Fields('Phone'), 'is_primary_contact' => true, 'preamp_id' => $rows->Fields('custom1'));
    $primary_contact = new Contact();
    $primary_contact->set($primary_data);
    $primary_contact->save();
开发者ID:radicaldesigns,项目名称:gtd,代码行数:31,代码来源:seed_db_with_preamp_data.php


注:本文中的Company::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。