public function save($con = null)
 {
     $c = new Client();
     $c->setName($this->getValue("name"));
     $c->setDepartment($this->getValue("department"));
     $c->setAddress($this->getValue("address"));
     $c->setEmail($this->getValue("email"));
     $c->setPhone($this->getValue("phone"));
     $c->save();
 }
Example #2
0
 function test_setName()
 {
     //Arrange
     $name = "Sasha";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $c_name = "Garry Gergich";
     $phone = "503-472-8959";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($c_name, $phone, $id, $stylist_id);
     $new_c_name = "Jerry Gergich";
     //Act
     $test_client->setName($new_c_name);
     //Assert
     $this->assertEquals($test_client->getName(), $new_c_name);
 }
Example #3
0
 public static function fromArray($data)
 {
     $client = new Client();
     if (isset($data['name'])) {
         $client->setName($data['name']);
     }
     if (isset($data['company'])) {
         $client->setCompany($data['company']);
     }
     if (isset($data['vat_number'])) {
         $client->setVatNumber($data['vat_number']);
     }
     if (isset($data['tax_number'])) {
         $client->setTaxNumber($data['tax_number']);
     }
     if (isset($data['address'])) {
         $client->setAddress(Address::fromArray($data['address']));
     }
     return $client;
 }
Example #4
0
 public function testSetGet()
 {
     $client = new Client();
     $id = 'test_id';
     $client->setId($id);
     $this->assertEquals($id, $client->getId(), 'Unable to setup id!');
     $name = 'test_name';
     $client->setName($name);
     $this->assertEquals($name, $client->getName(), 'Unable to setup name!');
     $title = 'test_title';
     $client->setTitle($title);
     $this->assertEquals($title, $client->getTitle(), 'Unable to setup title!');
     $userAttributes = ['attribute1' => 'value1', 'attribute2' => 'value2'];
     $client->setUserAttributes($userAttributes);
     $this->assertEquals($userAttributes, $client->getUserAttributes(), 'Unable to setup user attributes!');
     $normalizeUserAttributeMap = ['name' => 'some/name', 'email' => 'some/email'];
     $client->setNormalizeUserAttributeMap($normalizeUserAttributeMap);
     $this->assertEquals($normalizeUserAttributeMap, $client->getNormalizeUserAttributeMap(), 'Unable to setup normalize user attribute map!');
     $viewOptions = ['option1' => 'value1', 'option2' => 'value2'];
     $client->setViewOptions($viewOptions);
     $this->assertEquals($viewOptions, $client->getViewOptions(), 'Unable to setup view options!');
 }
Example #5
0
 public function transformJobs()
 {
     $statusHash = array();
     $statusObjects = StatusPeer::doSelect(new Criteria());
     foreach ($statusObjects as $s) {
         $statusHash[$s->getState()] = $s->getId();
     }
     $this->jobKeys = array();
     $dom = DOMDocument::load("tuftsph_jm2db.xml");
     $jobs = $dom->getElementsByTagName("jobs");
     $total = $jobs->length;
     $count = 1;
     $jobList = array();
     foreach ($jobs as $job) {
         $jid = 0;
         $childNodes = $job->childNodes;
         $j = new Job();
         $del = new Delivery();
         $jid = 1;
         $startTime = null;
         $shootStart = null;
         $shootEnd = null;
         $endTime = null;
         $notes = "";
         $photog = 0;
         $slug = "";
         $childNodes = $job->childNodes;
         foreach ($childNodes as $child) {
             switch ($child->nodeName) {
                 case "id":
                     $jid = $child->textContent;
                     break;
                 case "shoot_name":
                     $j->setEvent($child->textContent);
                     break;
                 case "shoot_date":
                     $j->setDate($child->textContent);
                     break;
                 case "shoot_startT":
                     $startTime = $child->textContent;
                     break;
                 case "shoot_start":
                     $shootStart = $child->textContent;
                     break;
                 case "shoot_endT":
                     $endTime = $child->textContent;
                     break;
                 case "shoot_end":
                     $shootEnd = $child->textContent;
                     break;
                 case "shoot_duedate":
                     $j->setDueDate($child->textContent);
                     break;
                 case "submitted_at":
                     $j->setCreatedAt($child->textContent);
                     break;
                 case "requester_address":
                     $j->setStreet($child->textContent);
                     break;
                 case "requester_campus":
                     $j->setCity($child->textContent);
                     break;
                 case "requester_name":
                     $j->setContactName($child->textContent);
                     break;
                 case "requester_email":
                     $j->setContactEmail($child->textContent);
                     break;
                 case "requester_phone":
                     $j->setContactPhone($child->textContent);
                     break;
                 case "internal_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "billing_notes":
                     $notes .= $child->textContent . "<br/>";
                     break;
                 case "estimate":
                     $j->setEstimate($child->textContent);
                     break;
                 case "billing_acctnum":
                     $j->setAcctNum($child->textContent);
                     break;
                 case "billing_deptid":
                     $j->setDeptId($child->textContent);
                     break;
                 case "billing_grantid":
                     $j->setGrantId($child->textContent);
                     break;
                 case "shoot_directions":
                     $j->setOther($child->textContent);
                     break;
                 case "status":
                     $j->setStatusId($statusHash[$child->textContent]);
                     break;
                 case "photog_id":
                     $photog = $child->textContent;
                     break;
                 case "delivery_pubname":
                     $del->setPubName($child->textContent);
                     break;
                 case "delivery_pubtype":
                     $del->setPubType($child->textContent);
                     break;
                 case "delivery_other":
                     $del->setOther($child->textContent);
                     break;
                 case "delivery_format":
                     break;
                 case "delivery_color":
                     $del->setColor($child->textContent);
                     break;
                 case "delivery_format":
                     $del->setFormat($child->textContent);
                     break;
                 case "delivery_size":
                     $del->setSize($child->textContent);
                     break;
                 case "delivery_method":
                     $del->setMethod($child->textContent);
                     break;
                 case "delivery_special":
                     $del->setInstructions($child->textContent);
                     break;
                 case "slug":
                     $slug = $child->textContent;
                     break;
                 case "#text":
                 default:
                     break;
             }
         }
         if (is_null($endTime)) {
             $endTime = $shootEnd;
         }
         if (is_null($startTime)) {
             $startTime = $shootStart;
         }
         if ($j->getCity() == "Boston") {
             $j->setZip("02101");
         } else {
             $j->setZip("02155");
         }
         $j->setNotes($notes);
         $j->setState("Massachusetts");
         list($hour, $min, $sec) = explode(":", $endTime);
         list($shour, $smin, $ssec) = explode(":", $startTime);
         $t = new DateTime();
         $t->setTime($hour, $min, $sec);
         $j->setEndTime($t);
         $t = new DateTime();
         $t->setTime($shour, $smin, $ssec);
         $j->setStartTime($t);
         $j->addTag($slug);
         if (isset($this->jobProjectKeys[$jid])) {
             $j->setProjectId($this->projectKeys[$this->jobProjectKeys[$jid]]);
         }
         while (count($jobList) - 1 != $jid) {
             $jobList[] = false;
         }
         $jobList[intval($jid)] = array("job" => $j, "del" => $del, "photog" => $photog);
     }
     for ($i = 1; $i < count($jobList); $i++) {
         sleep(1);
         $obj = $jobList[$i];
         $c = new Criteria();
         $c->add(JobPeer::ID, $i);
         if (JobPeer::doCount($c) > 0) {
             continue;
         }
         echo $i . "/" . $total . "\n";
         // keep the ids lined up
         if ($obj == false) {
             $myJob = new Job();
             try {
                 $myJob->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
             }
             $myJob->delete();
         } else {
             $j = $obj["job"];
             $del = $obj["del"];
             $photog = $obj["photog"];
             try {
                 $j->save();
             } catch (Exception $ex) {
                 echo $ex->getMessage();
                 echo $ex->getTraceAsString();
             }
             $del->setJobId($j->getId());
             $del->save();
             $this->jobKeys[$jid] = $j->getId();
             if ($photog) {
                 $jp = new JobPhotographer();
                 $jp->setPhotographerId($this->photogKeys[$photog]);
                 $jp->setJobId($j->getId());
                 try {
                     $jp->save();
                 } catch (Exception $ex) {
                     echo $ex->getMessage();
                 }
             }
             // add the requester as a client
             $c = new Criteria();
             $c->add(sfGuardUserPeer::USERNAME, $j->getContactEmail());
             if (ClientPeer::doCount($c) == 0 && trim(strlen($j->getContactEmail())) != 0) {
                 $user = new sfGuardUser();
                 $user->setUsername($j->getContactEmail());
                 $user->setPassword("admin");
                 $user->save();
                 $userProfile = new sfGuardUserProfile();
                 $userProfile->setUserId($user->getId());
                 $userProfile->setUserTypeId(sfConfig::get("app_user_type_client"));
                 $userProfile->save();
                 $clientProfile = new Client();
                 $clientProfile->setUserId($userProfile->getId());
                 $clientProfile->setName($j->getContactName());
                 $clientProfile->setEmail($j->getContactEmail());
                 $clientProfile->setPhone($j->getContactPhone());
                 $clientProfile->save();
                 $jobClient = new JobClient();
                 $jobClient->setClientId($clientProfile->getId());
                 $jobClient->setJobId($j->getId());
                 $jobClient->save();
             }
         }
         $count += 1;
     }
 }
 public function save($con = null)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Object', 'Tag', 'Text', 'PMRender', 'Asset', 'Helper'));
     $j = new Job();
     $j->setEvent($this->getValue("event"));
     $j->setStartTime($this->getValue("start_time"));
     $j->setEndTime($this->getValue("end_time"));
     $j->setDate($this->getValue("date"));
     $j->setDueDate($this->getValue("due_date"));
     $j->setAcctNum($this->getValue("acct_num"));
     $j->setDeptId($this->getValue("dept_id"));
     $j->setPublicationId($this->getValue("publication_id"));
     $j->setStreet($this->getValue("street"));
     $j->setCity($this->getValue("city"));
     $j->setState($this->getValue("state"));
     $j->setZip($this->getValue("zip"));
     if (is_array($this->getValue("photo_type"))) {
         $j->setPhotoType(implode(", ", $this->getValue("photo_type")));
     } else {
         $j->setPhotoType($this->getValue("photo_type"));
     }
     $j->setOther($this->getValue("other"));
     $j->setQues1($this->getValue("ques1"));
     $j->setQues2($this->getValue("ques2"));
     $j->setQues3($this->getValue("ques3"));
     $j->setContactName($this->getValue("contact_name"));
     $j->setContactPhone($this->getValue("contact_phone"));
     $j->setContactEmail($this->getValue("contact_email"));
     $j->setStatusId(sfConfig::get("app_job_status_pending", 1));
     $j->setProjectId($this->getValue("project_id"));
     $j->save();
     $body = "Dear {$this->getValue("name")},\r\n\r\nYour job, {$this->getValue("event")}, has been entered into our system. \r\nIf you wish to track the progress of your job, you may do so at http://jobs.tuftsphoto.com \r\n\r\nThanks for using University Photography; we look forward to working with you! \r\n\r\nThe Tufts Photo Team \r\nUniversity Photography\r\n80 George St., First Floor\r\nMedford, MA 02155\r\nTel: 617.627.4282\r\nFax: 617.627.3549\r\nphoto@tufts.edu\r\n\r\n\r\n" . getJobDetails($j);
     mail($this->getValue("email") . ", photo@tufts.edu", "University Photography Job #" . $j->getId() . " - " . $j->getEvent(), $body, "From: photo@tufts.edu");
     $user = sfContext::getInstance()->getUser();
     if ($this->getValue("clientId") > 0 && ($user->hasCredential("client") || $user->hasCredential("admin"))) {
         $client = ClientPeer::retrieveByPK($this->getValue("clientId"));
         $j->addClient($client);
     }
     // if they are a user lets make them a client
     if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_user")) {
         $clientProfile = new Client();
         $clientProfile->setUserId($user->getProfile()->getId());
         $clientProfile->setName($this->getValue("name"));
         $clientProfile->setDepartment($this->getValue("department"));
         $clientProfile->setAddress($this->getValue("address"));
         $clientProfile->setEmail($this->getValue("email"));
         $clientProfile->setPhone($this->getValue("phone"));
         $clientProfile->save();
         $user->getProfile()->setUserTypeId(sfConfig::get("app_user_type_client"));
         $user->getProfile()->save();
         $user->clearCredentials();
         $user->addCredential("client");
     } else {
         if ($user->getProfile()->getUserType()->getId() == sfConfig::get("app_user_type_client")) {
             $c = new Criteria();
             $c->add(ClientPeer::USER_ID, $user->getProfile()->getId());
             $clientProfile = ClientPeer::doSelectOne($c);
             if (is_null($clientProfile)) {
                 $clientProfile = new Client();
             }
             $clientProfile->setUserId($user->getProfile()->getId());
             $clientProfile->setName($this->getValue("name"));
             $clientProfile->setDepartment($this->getValue("department"));
             $clientProfile->setAddress($this->getValue("address"));
             $clientProfile->setEmail($this->getValue("email"));
             $clientProfile->setPhone($this->getValue("phone"));
             $clientProfile->save();
         }
     }
     if (isset($clientProfile) && !is_null($clientProfile)) {
         $j->addClient($clientProfile);
     }
     return $j->getId();
 }
Example #7
0
 function importAction()
 {
     if (!isset($_POST['client'])) {
         $this->setOutPut(array("error" => $this->errorCode['param_not_found']));
         return false;
     }
     $client = json_decode(urldecode($_POST['client']));
     //$client = $this->utf8Decode($client1);
     //var_dumpas($client['projectKey']);
     if (!isset($client->projectKey) || is_null($client->projectKey)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     $project = $this->getProject($client->projectKey, $client);
     if (!is_object($project)) {
         return false;
     }
     if (!isset($client->name) || is_null($client->name)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     if (!isset($client->email) || is_null($client->email)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     if (!isset($client->telephone) || is_null($client->telephone)) {
         $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
         return false;
     }
     /*if (!isset($client->comment) || is_null($client->comment)){
           $this->setOutPut(array("error" => $this->errorCode['wrong_param']));
           return false;
       }*/
     $now = Carbon::Now();
     //Kuriam nauja klienta
     $newClient = new Client();
     $newClient->setPid($project->getId());
     $newClient->setName(substr($client->name, 0, 255));
     $newClient->setEmail(substr($client->email, 0, 255));
     $newClient->setTelephone(substr($client->telephone, 0, 50));
     $newClient->setComment(substr($client->comment, 0, 255));
     $newClient->setCustomer(substr($client->customer, 0, 255));
     $newClient->setActive(true);
     $newClient->setPeriodical(false);
     $newClient->setPeriodicalid(0);
     $newClient->setR_date($now->toDateTimeString());
     $newClient->setR_user(977);
     $store = $this->storeClient($newClient);
     if (!$store) {
         $this->setOutPut(array("error" => $this->errorCode['client_not_stored']));
         $mail_ob = new Mail();
         $mail_ob->setTo("*****@*****.**");
         $mail_ob->setText(print_r($newClient, true));
         $mail_ob->setSubject("WorkFlow.kaizensistema.lt | Nepavyko sukurti importo kliento.");
         $mail_ob->sendMail();
         return false;
     } else {
         $eventHistory = new EventHistory();
         $eventHistory->setPid($newClient->getPid());
         $eventHistory->setCid($newClient->getId());
         $eventHistory->setR_date($newClient->getR_date());
         $eventHistory->setDescription(!is_null($client->from) ? $client->from : "Sukurtas integracijos metu");
         $this->storeEventHistory($eventHistory);
     }
     $this->setOutPut(array("ok" => "ok"));
 }
Example #8
0
 }
 // validation for $keyuan
 $keyuan = isset($_POST["keyuan"]) ? strip_tags($_POST["keyuan"]) : null;
 // validation for $beizhu
 $beizhu = isset($_POST["beizhu"]) ? $_POST["beizhu"] : null;
 /// proceed submission
 // proceed for $user_id
 if (!empty($user_id)) {
     $object->setUserId($user_id);
 }
 // proceed for $type
 if (!empty($type)) {
     $object->setType($type);
 }
 // proceed for $name
 $object->setName($name);
 // proceed for $dob
 $object->setDob($dob);
 // proceed for $chushengriqi
 $object->setChushengriqi($chushengriqi);
 // proceed for $xueli
 if (!empty($xueli)) {
     $object->setXueli($xueli);
 }
 // proceed for $yasichengji
 if (!empty($yasichengji)) {
     $object->setYasichengji($yasichengji);
 }
 // proceed for $dianhua
 $object->setDianhua($dianhua);
 // proceed for $dizhi
require_once "bootstrap.php";
require_once 'src/product.php';
require_once 'src/client.php';
// $newProductName = $argv[1];
$product0 = new Product();
$product1 = new Product();
$product2 = new Product();
$product0->setName($argv[1]);
$product1->setName($argv[2]);
$product2->setName($argv[3]);
$client0 = new Client();
$client1 = new Client();
$client2 = new Client();
$client0->setName("Phoenix");
$client1->setName("Kayzen");
$client2->setName("SuperNova");
$client0->setAge(23);
$client1->setAge(21);
$client2->setAge(25);
$client0->products[] = $product0;
$client0->products[] = $product1;
$client0->products[] = $product2;
// $client0->add($product0);
// $client0->add($product1);
// $client0->add($product2);
$client0->products[] = $product0;
$client0->products[] = $product1;
$client0->products[] = $product2;
// $product0->add($client0);
// $product0->add($client1);
// $product0->add($client2);
Example #10
0
 public function api()
 {
     $this->load->language('sale/order');
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->validate() && isset($this->request->get['api'])) {
         // Change the client
         Client::setName('catalog');
         // App
         $app = new Catalog();
         // Initialise main classes
         $app->initialise();
         // Include any URL perameters
         foreach ($this->request->get as $key => $value) {
             if ($key != 'route' && $key != 'token' && $key != 'store_id') {
                 $app->request->get[$key] = $value;
             }
         }
         $app->request->get['route'] = $this->request->get['api'];
         if ($this->request->post) {
             $app->request->post = $this->request->post;
         }
         $app->session->data['api_id'] = $this->config->get('config_api_id');
         // Load eCommerce classes
         $app->ecommerce();
         // Route the app
         $app->route();
         // Dispatch the app
         $app->dispatch();
         // Get the output
         $json = $app->response->getOutput();
         unset($app);
         // Return back to admin
         Client::setName('admin');
     } else {
         $response = array();
         $response['error'] = $this->error;
         unset($this->error);
         $json = json_encode($response);
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput($json);
 }
Example #11
0
 function actionSaveClient($currentUser)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $client = new Client();
     $clientErrs = array();
     $client->setId($this->context->getRequestAttr("id"));
     $client->setPid($this->context->getRequestAttr("projectID"));
     $client->setName($this->context->getRequestAttr("name"));
     if (!is_null($client->getName())) {
         $client->setName(trim($client->getName()));
         if (strlen($client->getName()) < 1) {
             $client->setName(null);
         }
     }
     if (is_null($client->getName())) {
         $clientErrs["name"] = "field.error.empty";
     }
     $client->setEmail($this->context->getRequestAttr("email"));
     if (!is_null($client->getEmail())) {
         $client->setEmail(trim($client->getEmail()));
         if (strlen($client->getEmail()) < 1) {
             $client->setEmail(null);
         }
     }
     if (is_null($client->getEmail())) {
         $clientErrs["email"] = "field.error.empty";
     }
     $client->setTelephone($this->context->getRequestAttr("telephone"));
     if (!is_null($client->getTelephone())) {
         $client->setTelephone(trim($client->getTelephone()));
         if (strlen($client->getTelephone()) < 1) {
             $client->setTelephone(null);
         }
     }
     $client->setCustomer($this->context->getRequestAttr("customer"));
     if (!is_null($client->getCustomer())) {
         $client->setCustomer(trim($client->getCustomer()));
         if (strlen($client->getCustomer()) < 1) {
             $client->setCustomer(null);
         }
     }
     $client->setComment($this->context->getRequestAttr("comment"));
     if (!is_null($client->getComment())) {
         $client->setComment(trim($client->getComment()));
         if (strlen($client->getComment()) < 1) {
             $client->setComment(null);
         }
     }
     $periodicalID = $this->context->getRequestAttr("periodicalid");
     $periodical = $this->context->getRequestAttr("periodCustomer");
     $client->setPeriodical($periodical == 1 ? true : false);
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $client->setR_date($time->format("Y-m-d H:i:s"));
     $client->setR_user($currentUser->getId());
     $client->setActive(true);
     if (!is_null($periodicalID) && !$client->isPeriodical()) {
         $this->clientPeriodicalDao->delete($periodicalID);
         $this->clientDaol->resetPeriodicalClients($periodicalID);
         $client->setPeriodicalid(0);
     }
     if ($client->isPeriodical()) {
         $clientPeriodical = new ClientPeriodical();
         $clientPeriodical->setId($periodicalID);
         $clientPeriodical->setPid($client->getPid());
         $clientPeriodical->setName($client->getName());
         $clientPeriodical->setEmail($client->getEmail());
         $clientPeriodical->setCustomer($client->getCustomer());
         $clientPeriodical->setTelephone($client->getTelephone());
         $clientPeriodical->setComment($client->getComment());
         $clientPeriodical->setR_date($time->format("Y-m-d H:i:s"));
         $clientPeriodical->setR_user($currentUser->getId());
         $clientPeriodical->setPeriod_type($this->context->getRequestAttr("period_type"));
         $clientPeriodical->setWeek_day($this->context->getRequestAttr("week_day"));
         $clientPeriodical->setMonth_day($this->context->getRequestAttr("month_day"));
         $clientPeriodical->setHour($this->context->getRequestAttr("hour"));
     } else {
         $clientPeriodical = new ClientPeriodical();
     }
     $this->context->setFlashScopeAttr("client", $client);
     $this->context->setFlashScopeAttr("clientPeriodical", $clientPeriodical);
     $this->context->setFlashScopeAttr("clientErrs", $clientErrs);
     $projectID = $client->getPid();
     if (!$this->setStoreProject($projectID, "clientProject")) {
         $this->cancelClientEdit();
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     if (count($clientErrs) >= 1) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $insert = false;
     if (is_null($client->getId())) {
         $insert = true;
     }
     $periodicalStore = false;
     $clientStore = false;
     // Jei klientas periodinis - sukuriam periodini klienta atskirai
     if ($client->isPeriodical()) {
         $storePeriodical = $this->storeClientPeriodical($clientPeriodical);
         if (!$storePeriodical) {
             if (!is_null($backUrl)) {
                 header("Location: " . $backUrl);
                 return true;
             }
             return false;
         }
         $client->setPeriodicalid($clientPeriodical->getId());
         $periodicalStore = true;
     }
     if ($client->isPeriodical() && !$insert || !$client->isPeriodical()) {
         $store = $this->storeClient($client);
         if (!$store) {
             if (!is_null($backUrl)) {
                 header("Location: " . $backUrl);
                 return true;
             }
             return false;
         }
         if ($insert) {
             $eventHistory = new EventHistory();
             $eventHistory->setPid($client->getPid());
             $eventHistory->setCid($client->getId());
             $eventHistory->setR_date($client->getR_date());
             $eventHistory->setDescription("Sukurtas projekto vadovo");
             $this->storeEventHistory($eventHistory);
         }
         $clientStore = true;
     }
     if ($periodicalStore && !$clientStore) {
         $this->context->setRequestScopeAttr("success", "Periodinis klientas suskurtas sėkmingai.");
     }
     $this->cancelClientEdit();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
Example #12
0
<?php

/**
 * @package		Arastta eCommerce
 * @copyright	Copyright (C) 2015 Arastta Association. All rights reserved. (arastta.org)
 * @credits		See CREDITS.txt for credits and other copyright notices.
 * @license		GNU General Public License version 3; see LICENSE.txt
 */
if (version_compare(PHP_VERSION, '5.3.10', '<')) {
    die('Your host needs to use PHP 5.3.10 or higher to run Arastta.');
}
define('AREXE', 1);
require_once 'define.php';
// Startup
require_once DIR_SYSTEM . 'library/client.php';
Client::setName('catalog');
require_once DIR_SYSTEM . 'startup.php';
// App
$app = new Catalog();
// Initialise main classes
$app->initialise();
// Load eCommerce classes
$app->ecommerce();
// Route the app
$app->route();
// Dispatch the app
$app->dispatch();
// Render the output
$app->render();
Example #13
0
 function actionSaveClient($currentProject)
 {
     $backUrl = $this->context->getFlowScopeAttr("backUrl");
     $projectID = $this->context->getRequestAttr("projectID");
     $edit = $this->context->getRequestAttr("edit");
     $client = new Client();
     $clientErrs = array();
     $client->setId($this->context->getRequestAttr("id"));
     $client->setPid($this->context->getRequestAttr("projectID"));
     $client->setName($this->context->getRequestAttr("name"));
     if (!is_null($client->getName())) {
         $client->setName(trim($client->getName()));
         if (strlen($client->getName()) < 1) {
             $client->setName(null);
         }
     }
     if (is_null($client->getName())) {
         $clientErrs["name"] = "field.error.empty";
     }
     $client->setEmail($this->context->getRequestAttr("email"));
     if (!is_null($client->getEmail())) {
         $client->setEmail(trim($client->getEmail()));
         if (strlen($client->getEmail()) < 1) {
             $client->setEmail(null);
         }
     }
     if (is_null($client->getEmail())) {
         $clientErrs["email"] = "field.error.empty";
     }
     $client->setTelephone($this->context->getRequestAttr("telephone"));
     if (!is_null($client->getTelephone())) {
         $client->setTelephone(trim($client->getTelephone()));
         if (strlen($client->getTelephone()) < 1) {
             $client->setTelephone(null);
         }
     }
     $client->setCustomer($this->context->getRequestAttr("customer"));
     if (!is_null($client->getCustomer())) {
         $client->setCustomer(trim($client->getCustomer()));
         if (strlen($client->getCustomer()) < 1) {
             $client->setCustomer(null);
         }
     }
     $client->setComment($this->context->getRequestAttr("comment"));
     if (!is_null($client->getComment())) {
         $client->setComment(trim($client->getComment()));
         if (strlen($client->getComment()) < 1) {
             $client->setComment(null);
         }
     }
     $client->setPeriodical(false);
     $client->setPeriodicalid(0);
     $timeZone = new DateTimeZone("Europe/Vilnius");
     $time = new DateTime("now", $timeZone);
     $client->setR_date($time->format("Y-m-d H:i:s"));
     $client->setR_user(777);
     $client->setActive(true);
     $this->context->setFlashScopeAttr("createClient", $client);
     $this->context->setFlashScopeAttr("clientErrs", $clientErrs);
     $this->context->setFlashScopeAttr("projectID", $projectID);
     if (count($clientErrs) >= 1) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     $insert = true;
     $store = $this->storeClient($client);
     if (!$store) {
         if (!is_null($backUrl)) {
             header("Location: " . $backUrl);
             return true;
         }
         return false;
     }
     if ($insert && $edit == 0) {
         $eventHistory = new EventHistory();
         $eventHistory->setPid($client->getPid());
         $eventHistory->setCid($client->getId());
         $eventHistory->setR_date($client->getR_date());
         $eventHistory->setDescription("Sukurtas partnerio");
         $this->storeEventHistory($eventHistory);
     }
     $this->cancelClientCreate();
     if (!is_null($backUrl)) {
         header("Location: " . $backUrl);
         return true;
     }
     return false;
 }
Example #14
0
 public function pdf($dest = 'D')
 {
     $url = '';
     if (isset($this->request->get['filter_invoice_number'])) {
         $url .= '&filter_invoice_number=' . urlencode(html_entity_decode($this->request->get['filter_invoice_number'], ENT_QUOTES, 'UTF-8'));
     }
     if (isset($this->request->get['filter_order_id'])) {
         $url .= '&filter_order_id=' . $this->request->get['filter_order_id'];
     }
     if (isset($this->request->get['filter_customer'])) {
         $url .= '&filter_customer=' . urlencode(html_entity_decode($this->request->get['filter_customer'], ENT_QUOTES, 'UTF-8'));
     }
     if (isset($this->request->get['filter_total'])) {
         $url .= '&filter_total=' . $this->request->get['filter_total'];
     }
     if (isset($this->request->get['filter_invoice_date'])) {
         $url .= '&filter_invoice_date=' . $this->request->get['filter_invoice_date'];
     }
     if (isset($this->request->get['sort'])) {
         $url .= '&sort=' . $this->request->get['sort'];
     }
     if (isset($this->request->get['order'])) {
         $url .= '&order=' . $this->request->get['order'];
     }
     if (isset($this->request->get['page'])) {
         $url .= '&page=' . $this->request->get['page'];
     }
     if (!$this->validate()) {
         $this->response->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . $url, 'SSL'));
     }
     $this->load->language('sale/order');
     $this->load->language('sale/invoice');
     $this->load->model('sale/order');
     $this->load->model('sale/invoice');
     if (isset($this->request->get['invoice_id'])) {
         $invoice_id = $this->request->get['invoice_id'];
     } else {
         $invoice_id = 0;
     }
     $invoice_info = $this->model_sale_invoice->getInvoice($invoice_id);
     if (!$invoice_info) {
         $this->session->data['error'] = $this->language->get('error_invoice_not_found');
         $this->response->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . $url, 'SSL'));
     }
     Client::setName('catalog');
     $app = new Catalog();
     $app->initialise();
     $app->request->get['route'] = 'account/order/invoice';
     $app->request->get['order_id'] = $invoice_info['order_id'];
     $app->request->get['dest'] = $dest;
     $app->request->post = array();
     $app->ecommerce();
     $app->route();
     $app->dispatch();
     unset($app);
     // Return back to admin
     Client::setName('admin');
 }
$iwasaki->setName("岩崎", "拓海");
$iwasaki->setEmail("*****@*****.**");
$hayashi = new User();
$hayashi->setName("早矢仕", "玄");
$hayashi->setEmail("*****@*****.**");
$object_seminar = new Seminar();
$object_seminar->setTitle("オブジェクト指向セミナー");
echo $object_seminar->getTitle() . '<BR>';
$object_seminar->attendAccept($iwasaki);
$object_seminar->attendAccept($saji);
$object_seminar->attendAccept($hayashi);
$object_seminar->getAttendList();
$object_seminar->cancelAccept($saji);
$object_seminar->getCancelList();
$object_seminar->getAttendList();
echo "<BR><BR><hr>";
echo "<h2>クライアントセミナーテスト</h2>";
echo "<BR>";
$client_seminar = new ClientSeminar();
$google = new Client();
$google->setName("Google");
$google->setEmail("*****@*****.**");
$client_seminar->setClient($google);
$client_seminar->setTitle("Google説明会");
$client_seminar->attendAccept($iwasaki);
$client_seminar->attendAccept($saji);
$client_seminar->attendAccept($hayashi);
$client_seminar->getAttendList();
$client_seminar->cancelAccept($saji);
$client_seminar->getCancelList();
$client_seminar->getAttendList();
Example #16
0
 //     Session::flush();
 //$pos = PosBackup::createNew();
 // DB::table('pos_backups')->insert(
 //     array('user_id' => '1', 'json' => 'json data','created_at'=>date())
 // );
 // return 0;
 // $pos = new PosBackup();
 // $pos->user_id = 1;
 // $pos->json ="json saved";
 // $pos->save();
 // return  0;
 return Session::get('branch_id');
 // facturacion.ipx
 $client = new Client();
 $client->setNit(trim('888888'));
 $client->setName(trim(Input::get('Happy')));
 $client->setBussinesName(trim('hope'));
 $client->save();
 // $clientPOS = array(
 //     'id'=>$client->id,
 //     'public_id'=>$client->public_id,
 //     'name'=>$client->name,
 //     'nit'=>$client->nit,
 //     'business_name'=>$client->business_name
 //     );
 //     $datos = array(
 //       'resultado' => 0,
 //       'cliente' => $clientPOS
 //     );
 return Response::json($client);
 // return Response::json(array('codigo de control generado: ' => 'borrado las sessiones'));
Example #17
0
<?php

/**
 * @package		Arastta eCommerce
 * @copyright	Copyright (C) 2015 Arastta Association. All rights reserved. (arastta.org)
 * @credits		See CREDITS.txt for credits and other copyright notices.
 * @license		GNU General Public License version 3; see LICENSE.txt
 */
if (version_compare(PHP_VERSION, '5.3.10', '<')) {
    die('Your host needs to use PHP 5.3.10 or higher to run Arastta.');
}
define('AREXE', 1);
require_once 'define.php';
// Startup
require_once DIR_SYSTEM . 'library/client.php';
Client::setName('admin');
require_once DIR_SYSTEM . 'startup.php';
// App
$app = new Admin();
// Initialise main classes
$app->initialise();
// Load eCommerce classes
$app->ecommerce();
// Route the app
$app->route();
// Dispatch the app
$app->dispatch();
// Render the output
$app->render();
Example #18
0
 public function getSeoLink($information_id, $language_code)
 {
     // Change the client
     Client::setName('catalog');
     $app = new Catalog();
     $app->initialise();
     $app->ecommerce();
     $app->route();
     $site_url = $app->url->link('information/information', 'information_id=' . $information_id . '&lang=' . $language_code, 'SSL');
     $admin_folder = str_replace(DIR_ROOT, '', DIR_ADMIN);
     $seo_url = str_replace($admin_folder, '', $site_url);
     // Return back to admin
     Client::setName('admin');
     return $seo_url;
 }
Example #19
0
<?php

/**
 * @package		Arastta eCommerce
 * @copyright	Copyright (C) 2015 Arastta Association. All rights reserved. (arastta.org)
 * @license		GNU General Public License version 3; see LICENSE.txt
 */
// Error Reporting
error_reporting(E_ALL);
if (version_compare(PHP_VERSION, '5.3.10', '<')) {
    die('Your host needs to use PHP 5.3.10 or higher to run Arastta.');
}
define('AREXE', 1);
require_once 'define.php';
require_once DIR_SYSTEM . 'library/client.php';
Client::setName('install');
// Startup
require_once DIR_SYSTEM . 'startup.php';
// Registry
$registry = new Registry();
// File System
$filesystem = new Filesystem();
$registry->set('filesystem', $filesystem);
// Loader
$loader = new Loader($registry);
$registry->set('load', $loader);
// Trigger
$trigger = new Trigger($registry);
$registry->set('trigger', $trigger);
// Url
$url = new Url(HTTP_SERVER, HTTPS_SERVER, $registry);
Example #20
0
<?php

require_once __DIR__ . DS . '..' . DS . '..' . DS . 'bootstrap.php';
if (is_cli()) {
    $names = array('ZHENG XIAOHONG', 'WANG LIANGLIANG', 'LI YUNQIAN', 'LIU SHITAO', 'CHENG LANLAN', 'SUN XINWEI', 'QIAN WUCHAO', 'ZHAO LIUYUN', 'TAN GUOQIANG', 'WEI BEIFEI', 'XIA FEIFEI');
    $shengs = array('上海市', '江苏省', '湖南省', '四川省', '云南省', '广西省', '广东省', '台湾省');
    $qus = array('宝山区', '周口店', '宁乡', '沩水镇', '张家界', '小四通', '黄埔区', '晋安区');
    $address = rand(10, 99) . '村' . rand(300, 900) . '号';
    $dob_range_start = 381416400;
    $dob_range_end = 917874000;
    foreach ($names as $name) {
        $client = new Client();
        $client->setType(array_rand(Client::$TYPEs));
        $client->setName($name);
        $client->setDob(rand($dob_range_start, $dob_range_end));
        $client->setXueli(array_rand(Client::$XUELIs));
        $client->setYasichengji(array_rand(Client::$YASIs));
        $client->setDianhua('+86 ' . rand(2156299999, 2156292999));
        $client->setDizhi($shengs[array_rand($shengs)] . ' ' . $qus[array_rand($qus)] . ' ' . $address);
        $client->setEmail(get_random_string(5) . '@gmail.com');
        $client->setKeyuan(array_rand(Client::$KEYUANs));
        $client->setCreatedAt(rand(1439164648, 1439264648));
        $client->setUserId(rand(3, 4));
        $client->save();
    }
}
Example #21
0
 function createperiodicalClients()
 {
     $now = Carbon::Now();
     $criteria = new AndStatement();
     $field = $this->clientPeriodicalDao->getQHourName();
     $criteria->addStatement($field . "=" . $now->hour);
     $periodicalClients = $this->clientPeriodicalDao->find($criteria, null);
     if (is_null($periodicalClients) || is_string($periodicalClients)) {
         $mail_ob = new Mail();
         $mail_ob->setTo("*****@*****.**");
         $mail_ob->setText("Nepavyko nuskaityti periodiniu klientu." . (is_string($periodicalClients) ? $periodicalClients : ""));
         $mail_ob->setSubject("WorkFlow.kaizensistema.lt | Nepavyko nuskaityti periodiniu klientu.");
         $mail_ob->sendMail();
         return false;
     }
     foreach ($periodicalClients as $client) {
         $createNewClient = false;
         if ($client->getPeriod_type() == 1) {
             $createNewClient = true;
         }
         if ($client->getPeriod_type() == 2 && $now->isWeekday()) {
             $createNewClient = true;
         }
         if ($client->getPeriod_type() == 3 && $now->day == $client->getMonth_day()) {
             $createNewClient = true;
         }
         if ($client->getPeriod_type() == 4) {
             $monthBegin = $now->copy()->startOfMonth();
             while ($monthBegin->dayOfWeek != $client->getWeek_day()) {
                 $monthBegin->addDay();
             }
             if ($monthBegin->isSameDay($now)) {
                 $createNewClient = true;
             }
         }
         if ($client->getPeriod_type() == 5) {
             $monthEnd = $now->copy()->endOfMonth();
             while ($monthEnd->dayOfWeek != $client->getWeek_day()) {
                 $monthEnd->subDay();
             }
             if ($monthEnd->isSameDay($now)) {
                 $createNewClient = true;
             }
         }
         if ($createNewClient) {
             $newClient = new Client();
             $newClient->setPid($client->getPid());
             $newClient->setName($client->getName());
             $newClient->setEmail($client->getEmail());
             $newClient->setCustomer($client->getCustomer());
             $newClient->setTelephone($client->getTelephone());
             $newClient->setComment($client->getComment());
             $newClient->setActive(true);
             $newClient->setPeriodical(true);
             $newClient->setPeriodicalid($client->getId());
             $newClient->setR_date($now->toDateTimeString());
             $newClient->setR_user(988);
             $store = $this->storeClient($newClient);
             if (!$store) {
                 $mail_ob = new Mail();
                 $mail_ob->setTo("*****@*****.**");
                 $mail_ob->setText(print_r($newClient, true));
                 $mail_ob->setSubject("WorkFlow.kaizensistema.lt | Nepavyko sukurti periodinio kliento.");
                 $mail_ob->sendMail();
             } else {
                 $eventHistory = new EventHistory();
                 $eventHistory->setPid($newClient->getPid());
                 $eventHistory->setCid($newClient->getId());
                 $eventHistory->setR_date($newClient->getR_date());
                 $eventHistory->setDescription("Sukurtas kaip periodinis klientas");
                 $this->storeEventHistory($eventHistory);
             }
         }
     }
 }
Example #22
0
 function find($criteria = null, $order = null, $limit = 1000, $from = 0)
 {
     $result = $this->database->query($this->buildFindQuery($criteria, $order, $limit, $from));
     if (!is_null($result->getError())) {
         return $result->getError();
     }
     $clients = array();
     while ($row = $result->fetchRow()) {
         $client = new Client();
         $value = $row[0];
         $client->setId($value);
         $value = $row[1];
         $client->setPid($value);
         $value = $row[2];
         $client->setName($value);
         $value = $row[3];
         $client->setEmail($value);
         $value = $row[4];
         $client->setTelephone($value);
         $value = $row[5];
         $client->setCustomer($value);
         $value = $row[6];
         $client->setComment($value);
         $value = $row[7];
         $value = $this->database->toBoolean($value);
         $client->setActive($value);
         $value = $row[8];
         $value = $this->database->toBoolean($value);
         $client->setEnded($value);
         $value = $row[9];
         $value = $this->database->toBoolean($value);
         $client->setEnded_eve($value);
         $value = $row[10];
         $value = $this->database->toBoolean($value);
         $client->setMoved($value);
         $value = $row[11];
         $value = $this->database->toBoolean($value);
         $client->setPeriodical($value);
         $value = $row[12];
         $client->setPeriodicalid($value);
         $value = $row[13];
         $value = $this->database->toBoolean($value);
         $client->setCan_create($value);
         $value = $row[14];
         $client->setR_date($value);
         $value = $row[15];
         $client->setR_user($value);
         if ($order != null) {
             array_push($clients, $client);
         } else {
             $clients[$client->getId()] = $client;
         }
     }
     return $clients;
 }