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


PHP Part::get_min_order_quantity方法代码示例

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


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

示例1: get_order_parts

 /**
  * @brief Get all parts which should be ordered
  *
  * "parts which should be ordered" means:
  * ((("instock" is less than "mininstock") AND (Part isn't already ordered))
  *  OR (Part was manually marked as "should be ordered"))
  *
  * @param Database  &$database          reference to the database object
  * @param User      &$current_user      reference to the user which is logged in
  * @param Log       &$log               reference to the Log-object
  * @param array     $supplier_ids       @li array of all supplier IDs which will be listed
  *                                      @li an empty array means, the parts from ALL suppliers will be listed
  * @param boolean   $with_devices       if true, parts which are in devices, marked as "to order", will be listed too
  *
  * @retval array    all parts as a one-dimensional array of Part objects, sorted by their names
  *
  * @throws Exception if there was an error
  */
 public static function get_order_parts(&$database, &$current_user, &$log, $supplier_ids = array(), $with_devices = true)
 {
     if (get_class($database) != 'Database') {
         throw new Exception('$database ist kein Database-Objekt!');
     }
     $parts = array();
     $query = 'SELECT parts.id FROM parts ' . 'LEFT JOIN orderdetails ON orderdetails.id = parts.order_orderdetails_id ' . 'WHERE (parts.instock < parts.mininstock ' . 'OR parts.manual_order = true ' . 'OR parts.id IN ' . '(SELECT device_parts.id_part FROM device_parts ' . 'LEFT JOIN devices ON devices.id = device_parts.id_device ' . 'WHERE devices.order_quantity > 0)) ';
     if (count($supplier_ids) > 0) {
         $query .= 'AND ((false) OR ';
         foreach ($supplier_ids as $id) {
             $query .= '(orderdetails.id_supplier <=> ?) ';
         }
         $query .= ') ';
     }
     $query .= 'ORDER BY parts.name ASC';
     $query_data = $database->query($query, $supplier_ids);
     foreach ($query_data as $row) {
         $part = new Part($database, $current_user, $log, $row['id']);
         if ($part->get_manual_order() || $part->get_min_order_quantity() > 0) {
             $parts[] = $part;
         }
     }
     return $parts;
 }
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:42,代码来源:class.Part.php

示例2: catch

             }
             if (isset($_REQUEST['tostock_' . $i])) {
                 $part->set_instock($part->get_instock() + $order_quantity);
             }
         } catch (Exception $e) {
             $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
         }
     }
     $reload_site = true;
     break;
 case 'autoset_quantities':
     for ($i = 0; $i < $table_rowcount; $i++) {
         $part_id = isset($_REQUEST['id_' . $i]) ? (int) $_REQUEST['id_' . $i] : 0;
         try {
             $part = new Part($database, $current_user, $log, $part_id);
             $part->set_order_quantity($part->get_min_order_quantity());
         } catch (Exception $e) {
             $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
         }
     }
     $reload_site = true;
     break;
 case 'remove_device':
     try {
         $device = new Device($database, $current_user, $log, $device_id);
         $device->set_order_quantity(0);
         $reload_site = true;
     } catch (Exception $e) {
         $messages[] = array('text' => nl2br($e->getMessage()), 'strong' => true, 'color' => 'red');
     }
     break;
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:show_order_parts.php


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