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


PHP Part::get_manual_order方法代码示例

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


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

示例1: switch

 *   Execute actions
 *
 *********************************************************************************/
if (!$fatal_error) {
    switch ($action) {
        case 'apply_changes':
            // save new "selected_supplier" + "order_quantity", and delete or change "instock"
            for ($i = 0; $i < $table_rowcount; $i++) {
                $part_id = isset($_REQUEST['id_' . $i]) ? (int) $_REQUEST['id_' . $i] : 0;
                $order_orderdetails_id = isset($_REQUEST['orderdetails_' . $i]) ? (int) $_REQUEST['orderdetails_' . $i] : 0;
                $order_quantity = isset($_REQUEST['order_quantity_' . $i]) ? max(0, (int) $_REQUEST['order_quantity_' . $i]) : 0;
                try {
                    $part = new Part($database, $current_user, $log, $part_id);
                    $part->set_order_orderdetails_id($order_orderdetails_id);
                    $part->set_order_quantity($order_quantity);
                    if (isset($_REQUEST['remove_' . $i]) && $part->get_manual_order()) {
                        $part->set_manual_order(false);
                    }
                    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 {
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:show_order_parts.php

示例2: 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

示例3: array

 $html->set_variable('name', $part->get_name(), 'string');
 $html->set_variable('manufacturer_product_url', $part->get_manufacturer_product_url(), 'string');
 $html->set_variable('description', $part->get_description(), 'string');
 $html->set_variable('category_full_path', $part->get_category()->get_full_path(), 'string');
 $html->set_variable('instock', $part->get_instock(), 'integer');
 $html->set_variable('mininstock', $part->get_mininstock(), 'integer');
 $html->set_variable('visible', $part->get_visible(), 'boolean');
 $html->set_variable('comment', nl2br($part->get_comment()), 'string');
 $html->set_variable('footprint_full_path', is_object($footprint) ? $footprint->get_full_path() : '-', 'string');
 $html->set_variable('footprint_filename', is_object($footprint) ? str_replace(BASE, BASE_RELATIVE, $footprint->get_filename()) : '', 'string');
 $html->set_variable('storelocation_full_path', is_object($storelocation) ? $storelocation->get_full_path() : '-', 'string');
 $html->set_variable('storelocation_is_full', is_object($storelocation) ? $storelocation->get_is_full() : false, 'boolean');
 $html->set_variable('manufacturer_full_path', is_object($manufacturer) ? $manufacturer->get_full_path() : '-', 'string');
 $html->set_variable('category_full_path', is_object($category) ? $category->get_full_path() : '-', 'string');
 $html->set_variable('auto_order_exists', $part->get_instock() < $part->get_mininstock(), 'boolean');
 $html->set_variable('manual_order_exists', $part->get_manual_order() && $part->get_instock() >= $part->get_mininstock(), 'boolean');
 // build orderdetails loop
 $orderdetails_loop = array();
 $row_odd = true;
 foreach ($all_orderdetails as $orderdetails) {
     $pricedetails_loop = array();
     foreach ($orderdetails->get_pricedetails() as $pricedetails) {
         $pricedetails_loop[] = array('min_discount_quantity' => $pricedetails->get_min_discount_quantity(), 'price' => $pricedetails->get_price(true, $pricedetails->get_price_related_quantity()), 'price_related_quantity' => $pricedetails->get_price_related_quantity(), 'single_price' => $pricedetails->get_price(true, 1));
     }
     $orderdetails_loop[] = array('row_odd' => $row_odd, 'supplier_full_path' => $orderdetails->get_supplier()->get_full_path(), 'supplierpartnr' => $orderdetails->get_supplierpartnr(), 'supplier_product_url' => $orderdetails->get_supplier_product_url(), 'obsolete' => $orderdetails->get_obsolete(), 'pricedetails' => count($pricedetails_loop) > 0 ? $pricedetails_loop : NULL);
     $row_odd = !$row_odd;
 }
 $html->set_loop('orderdetails', $orderdetails_loop);
 if ($part->get_average_price(false, 1) > 0) {
     $html->set_variable('average_price', $part->get_average_price(true, 1), 'string');
 }
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:31,代码来源:show_part_info.php


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