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


PHP Shipment::unsetAttributes方法代码示例

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


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

示例1: actionInfo

 /**
  * Displays the currently logged in user's account information
  */
 public function actionInfo()
 {
     // Get id of logged in user
     $user_id = Yii::app()->user->getId();
     $customer = Customer::model()->findByPk($user_id);
     $commande = Commande::model()->findAllByAttributes(array('bilkey' => $user_id));
     $service_details = Customer::model()->getCustomerServiceDetails($user_id);
     $shipment_details = Customer::model()->getShipmentsByCustomerBilkey($user_id);
     if (isset($_POST['Customer'])) {
         $customer->setScenario('user_edit');
         // Populate our new models from the input arrays
         $customer->attributes = $_POST['Customer'];
         // If a model saves, we know it's valid
         if ($customer->validate()) {
             // Send email to info@mailnetwork and client
             $customer->save();
             $this->actionEmailChanges('customer', $customer, $customer);
         }
     }
     $shipment_model = new Shipment('search');
     $shipment_model->unsetAttributes();
     // clear any default values
     $shipment_model->bilkey = $user_id;
     if (isset($_GET['Shipment'])) {
         $shipment_model->attributes = $_GET['Shipment'];
     }
     $this->render('//shared/user-info', array('customer_model' => $customer, 'customer' => $customer, 'commande' => $commande, 'service_details' => $service_details, 'shipment_details' => $shipment_details, 'shipment_model' => $shipment_model));
 }
开发者ID:E-SOFTinc,项目名称:Mailnetwork_Yii,代码行数:31,代码来源:UserController.php

示例2: actionCustomerService

 /**
  *  for Customer Service View
  */
 public function actionCustomerService()
 {
     $this->layout = '//layouts/column1';
     $model = new Shipment('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Shipment'])) {
         $model->attributes = $_GET['Shipment'];
     }
     $this->render('admin', array('model' => $model));
 }
开发者ID:aantonw,项目名称:dcourier.system,代码行数:14,代码来源:ShipmentController.php

示例3: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Customer'])) {
         $model->attributes = $_POST['Customer'];
         $model->save();
         $this->redirect("#info");
         //				$this->redirect(array('view','id'=>$model->bilkey));
     }
     if (isset($_GET['Shipment'])) {
         $shipment_model->attributes = $_GET['Shipment'];
     }
     $service_details = Customer::model()->getCustomerServiceDetails($id);
     $shipment_details = Customer::model()->getShipmentsByCustomerBilkey($id);
     $customer = Customer::model()->findByPk($id);
     $commande = Commande::model()->findAllByAttributes(array('bilkey' => $id));
     $shipment_model = new Shipment('search');
     $shipment_model->unsetAttributes();
     // clear any default values
     $shipment_model->bilkey = $id;
     // DEBUGGING
     //		print "New total: " + $total_balance . '<br />';
     //		print "Old total: " + $customer->bilbalance;
     //		die;
     // TODO: We really should link the billing activity with the comkey...
     if (isset($_POST['Shipment'])) {
         // Check if it's an update
         if (isset($_POST['update'])) {
             $shipment = Shipment::model()->findByPk($_POST['update']);
             $shipment->attributes = $_POST['Shipment'];
             // We have to cast these manually.  For some reason this fails on the production server...
             $shipment->shipdebit = floatval($shipment->shipdebit);
             $shipment->shipcredit = floatval($shipment->shipcredit);
             // If the user leaves these fields blank, let's assume
             //  they meant to input a 0.
             if (empty($shipment->shipdebit) || $shipment->shipdebit == null) {
                 $shipment->shipdebit = 0;
             }
             if (empty($shipment->shipcredit) || $shipment->shipcredit == null) {
                 $shipment->shipcredit = 0;
             }
             // TODO: We should prolly check this
             $shipment->save();
         } else {
             $shipment = new Shipment();
             $shipment->attributes = $_POST['Shipment'];
             // We have to cast these manually.  For some reason this fails on the production server...
             $shipment->shipdebit = floatval($shipment->shipdebit);
             $shipment->shipcredit = floatval($shipment->shipcredit);
             // If the user leaves these fields blank, let's assume
             //  they meant to input a 0.
             if (empty($shipment->shipdebit) || $shipment->shipdebit == null) {
                 $shipment->shipdebit = 0;
             }
             if (empty($shipment->shipcredit) || $shipment->shipcredit == null) {
                 $shipment->shipcredit = 0;
             }
             if ($shipment->validate()) {
                 $shipment->comkey = $commande[0]->comkey;
                 $shipment->bilkey = $customer->bilkey;
                 $shipment->save();
             }
         }
         //            $this->redirect("customer/update/id/" + $customer->bilkey);
         $this->redirect("#billing");
     }
     $conn = Yii::app()->db;
     //        $total_balance = 0;
     // Update individual account balances
     foreach ($commande as $c) {
         $command = $conn->createCommand("SELECT SUM(shipcredit) - SUM(shipdebit) as balance FROM shipment WHERE comkey='" . $c->comkey . "'  GROUP BY comkey");
         $results = $command->queryRow();
         $balance = $results['balance'];
         //            $total_balance += $balance;
         $c->dest_bilbalance = $balance;
         $c->save();
     }
     // Fix for Support Request #430
     $command = $conn->createCommand("SELECT SUM(shipcredit) - SUM(shipdebit) as balance FROM shipment WHERE bilkey='" . $customer->bilkey . "'");
     $results = $command->queryRow();
     $total_balance = $results['balance'];
     // Update overall account balance
     $customer->bilbalance = $total_balance;
     $customer->save();
     $this->render('//shared/user-info', array('admin' => 1, 'commande' => $commande, 'customer' => $customer, 'customer_model' => $customer, 'service_details' => $service_details, 'shipment_details' => $shipment_details, 'shipment_model' => $shipment_model));
 }
开发者ID:E-SOFTinc,项目名称:Mailnetwork_Yii,代码行数:93,代码来源:CustomerController.php

示例4: actionAdmin

 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Shipment('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Shipment'])) {
         $model->attributes = $_GET['Shipment'];
     }
     $this->render('admin', array('model' => $model));
 }
开发者ID:E-SOFTinc,项目名称:Mailnetwork_Yii,代码行数:13,代码来源:ShipmentController.php


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