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


PHP commonModel::createChanges方法代码示例

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


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

示例1: update

 /**
  * Update a product.
  * 
  * @param  int $productID 
  * @access public
  * @return void
  */
 public function update($productID)
 {
     $oldProduct = $this->getByID($productID);
     $product = fixer::input('post')->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->get();
     $this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()->batchCheck($this->config->product->require->edit, 'notempty')->where('id')->eq($productID)->exec();
     if (dao::isError()) {
         return false;
     }
     return commonModel::createChanges($oldProduct, $product);
 }
开发者ID:leowh,项目名称:colla,代码行数:17,代码来源:model.php

示例2: update

 /**
  * Update a balance.
  * 
  * @param  int    $balanceID 
  * @access public
  * @return string|bool
  */
 public function update($balanceID)
 {
     $oldBalance = $this->getByID($balanceID);
     $depositor = $this->loadModel('depositor')->getByID($this->post->depositor);
     $balance = fixer::input('post')->add('currency', $depositor->currency)->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->removeIF($this->post->type == 'cash', 'public')->get();
     $this->dao->delete()->from(TABLE_BALANCE)->where('depositor')->eq($balance->depositor)->andWhere('date')->eq($balance->date)->andWhere('id')->ne($balanceID)->exec();
     $this->dao->update(TABLE_BALANCE)->data($balance)->autoCheck()->where('id')->eq($balanceID)->exec();
     if (!dao::isError()) {
         return commonModel::createChanges($oldBalance, $balance);
     }
     return false;
 }
开发者ID:leowh,项目名称:colla,代码行数:19,代码来源:model.php

示例3: update

 /**
  * Update a doc.
  * 
  * @param  int    $docID 
  * @access public
  * @return void
  */
 public function update($docID)
 {
     $oldDoc = $this->getById($docID);
     $doc = fixer::input('post')->cleanInt('module')->setDefault('module', 0)->specialChars('title, digest, keywords')->encodeURL('url')->stripTags('content', $this->config->allowedTags->admin)->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->remove('comment,files,labels')->get();
     $uniqueCondition = "lib = '{$oldDoc->lib}' AND module = {$doc->module} AND id != {$docID}";
     $doc = $this->loadModel('file')->processEditor($doc, $this->config->doc->editor->edit['id']);
     $this->dao->update(TABLE_DOC)->data($doc, 'uid')->autoCheck()->batchCheck($this->config->doc->require->edit, 'notempty')->check('title', 'unique', $uniqueCondition)->where('id')->eq((int) $docID)->exec();
     if (!dao::isError()) {
         return commonModel::createChanges($oldDoc, $doc);
     }
 }
开发者ID:leowh,项目名称:colla,代码行数:18,代码来源:model.php

示例4: update

 /**
  * Update a customer.
  * 
  * @param  int    $customerID 
  * @access public
  * @return array
  */
 public function update($customerID)
 {
     $oldCustomer = $this->getByID($customerID);
     $customer = fixer::input('post')->add('editedBy', $this->app->user->account)->add('editedDate', helper::now())->setIF(!$this->post->public and $oldCustomer->relation == 'client', 'public', 0)->stripTags('desc', $this->config->allowedTags->admin)->get();
     /* Add http:// in head when that has not http:// or https://. */
     if (strpos($customer->site, '://') === false) {
         $customer->site = 'http://' . $customer->site;
     }
     if (strpos($customer->weibo, 'http://weibo.com/') === false) {
         $customer->weibo = 'http://weibo.com/' . $customer->weibo;
     }
     if ($customer->site == 'http://') {
         $customer->site = '';
     }
     if ($customer->weibo == 'http://weibo.com/') {
         $customer->weibo = '';
     }
     $customer = $this->loadModel('file')->processEditor($customer, $this->config->customer->editor->edit['id']);
     $this->dao->update(TABLE_CUSTOMER)->data($customer, $skip = 'uid')->autoCheck()->batchCheck($this->config->customer->require->edit, 'notempty')->where('id')->eq($customerID)->exec();
     if (dao::isError()) {
         return array('result' => 'fail', 'message' => dao::getError());
     }
     $changes = commonModel::createChanges($oldCustomer, $customer);
     if ($changes) {
         $actionID = $this->loadModel('action')->create('customer', $customerID, 'Edited');
         $this->action->logHistory($actionID, $changes);
     }
     $locate = strpos($this->server->http_referer, 'provider') ? helper::createLink('provider', 'view', "customerID={$customerID}") : helper::createLink('customer', 'view', "customerID={$customerID}");
     return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate);
 }
开发者ID:leowh,项目名称:crm,代码行数:37,代码来源:model.php

示例5: editReturn

 /**
  * Edit return.
  * 
  * @param  object    $return 
  * @access public
  * @return bool
  */
 public function editReturn($return, $purchase)
 {
     $now = helper::now();
     $data = fixer::input('post')->add('contract', $purchase->id)->setDefault('returnedBy', $this->app->user->account)->setDefault('returnedDate', $now)->remove('finish,handlers')->get();
     $this->dao->update(TABLE_PLAN)->data($data, $skip = 'uid, comment')->where('id')->eq($return->id)->autoCheck()->batchCheck($this->config->purchase->require->receive, 'notempty')->exec();
     if (!dao::isError()) {
         $changes = commonModel::createChanges($return, $data);
         if ($changes) {
             $actionID = $this->loadModel('action')->create('contract', $purchase->id, 'editReturned');
             $this->action->logHistory($actionID, $changes);
         }
         $returnList = $this->getReturnList($return->contract, 'returnedDate_desc');
         $purchaseData = new stdclass();
         $purchaseData->return = 'doing';
         $purchaseData->editedBy = $this->app->user->account;
         $purchaseData->editedDate = $now;
         $purchaseData->handlers = implode(',', $this->post->handlers);
         $purchaseData->returnedBy = current($returnList)->returnedBy;
         $purchaseData->returnedDate = current($returnList)->returnedDate;
         if ($this->post->finish) {
             $purchaseData->return = 'done';
         }
         $this->dao->update(TABLE_CONTRACT)->data($purchaseData, $skip = 'uid, comment')->where('id')->eq($purchase->id)->exec();
         if (!dao::isError() and $this->post->finish) {
             $this->dao->update(TABLE_CUSTOMER)->set('status')->eq('payed')->where('id')->eq($purchase->customer)->exec();
         }
         return !dao::isError();
     }
     return false;
 }
开发者ID:leowh,项目名称:crm,代码行数:37,代码来源:model.php

示例6: close

 /**
  * Close task. 
  * 
  * @param  int    $taskID 
  * @access public
  * @return array
  */
 public function close($taskID)
 {
     $oldTask = $this->getById($taskID);
     $now = helper::now();
     $task = fixer::input('post')->setDefault('status', 'closed')->setDefault('assignedTo', 'closed')->setDefault('assignedDate', $now)->setDefault('closedBy, editedBy', $this->app->user->account)->setDefault('closedDate, editedDate', $now)->setIF($oldTask->status == 'done', 'closedReason', 'done')->setIF($oldTask->status == 'cancel', 'closedReason', 'cancel')->remove('taskIDList')->get();
     $this->dao->update(TABLE_TASK)->data($task, 'uid,comment')->autoCheck()->where('id')->eq((int) $taskID)->exec();
     $this->updateParent($oldTask);
     if (!dao::isError()) {
         return commonModel::createChanges($oldTask, $task);
     }
 }
开发者ID:leowh,项目名称:colla,代码行数:18,代码来源:model.php

示例7: updateMembers

 /**
  * Update project's members. 
  * 
  * @param  int    $projectID 
  * @access public
  * @return array
  */
 public function updateMembers($projectID)
 {
     $oldProject = $this->getById($projectID);
     $members = array();
     $project = new stdclass();
     /* Delete old member. */
     $this->dao->delete()->from(TABLE_TEAM)->where('type')->eq('project')->andWhere('id')->eq($projectID)->andWhere('role')->ne('manager')->exec();
     /* save new members. */
     if (!empty($_POST['member'])) {
         foreach ($this->post->member as $key => $account) {
             if (empty($account)) {
                 continue;
             }
             $member = new stdclass();
             $member->type = 'project';
             $member->id = $projectID;
             $member->account = $account;
             $member->role = $this->post->role[$key];
             $this->dao->insert(TABLE_TEAM)->data($member)->autoCheck()->exec();
             $members[$account] = $member;
         }
     }
     $project->members = $members;
     return commonModel::createChanges($oldProject, $project);
 }
开发者ID:leowh,项目名称:colla,代码行数:32,代码来源:model.php

示例8: assignTo

 /**
  * Assign to. 
  * 
  * @param  int    $todoID 
  * @access public
  * @return array|bool
  */
 public function assignTo($todoID)
 {
     $oldTodo = $this->getById($todoID);
     $todo = fixer::input('post')->remove('account')->add('assignedBy', $this->app->user->account)->add('assignedDate', helper::now())->get();
     $this->dao->update(TABLE_TODO)->data($todo)->autoCheck()->where('id')->eq($todoID)->exec();
     if (!dao::isError()) {
         return commonModel::createChanges($oldTodo, $todo);
     }
     return false;
 }
开发者ID:leowh,项目名称:colla,代码行数:17,代码来源:model.php

示例9: leave

 /**
  * leave 
  * 
  * @param  int    $resumeID 
  * @access public
  * @return void
  */
 public function leave($resumeID)
 {
     $oldResume = $this->getByID($resumeID);
     $resume = new stdclass();
     $resume->left = helper::today();
     $this->dao->update(TABLE_RESUME)->data($resume)->where('id')->eq($resumeID)->exec();
     /* Update contact info if exists another same resume. */
     $sameResume = $this->dao->select('id')->from(TABLE_RESUME)->where('contact')->eq($oldResume->contact)->andWhere('customer')->eq($oldResume->customer)->andWhere('`left`')->eq('')->orWhere('contact')->eq($oldResume->contact)->andWhere('customer')->eq($oldResume->customer)->andWhere('`left`')->gt(helper::today())->fetch('id');
     if ($sameResume) {
         $this->dao->update(TABLE_CONTACT)->set('resume')->eq($sameResume)->exec();
     }
     return commonModel::createChanges($oldResume, $resume);
 }
开发者ID:leowh,项目名称:colla,代码行数:20,代码来源:model.php

示例10: update

 /**
  * Update schema.
  * 
  * @param  int    $schemaID 
  * @access public
  * @return array
  */
 public function update($schemaID)
 {
     $oldSchema = $this->getByID($schemaID);
     $schema = fixer::input('post')->setIF($this->post->feeRow, 'fee', '')->setIF($this->post->diffCol, 'money', "{$this->post->in},{$this->post->out}")->remove('feeRow,diffCol')->get();
     if ($this->post->diffCol) {
         $this->config->schema->require->edit = str_replace(',type,', ',in,out,', $this->config->schema->require->edit);
     }
     $this->dao->update(TABLE_SCHEMA)->data($schema, 'in,out')->autoCheck()->batchCheck($this->config->schema->require->edit, 'notempty')->where('id')->eq($schemaID)->exec();
     if (!dao::isError()) {
         return commonModel::createChanges($oldSchema, $schema);
     }
     return false;
 }
开发者ID:leowh,项目名称:colla,代码行数:20,代码来源:model.php


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