Plugin Directory

Changeset 2620128


Ignore:
Timestamp:
10/26/2021 12:06:45 PM (4 years ago)
Author:
mbmipak
Message:

fix bug

Location:
mbm-ipak/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mbm-ipak/trunk/include/ajax/form.php

    r2619847 r2620128  
    7777                        return $this->field_date($field);
    7878                    } else if ($field["type"]["type"] == "select") {
    79                         if(isset($field["type"]["auto-select"]) && $field["type"]["auto-select"])
    80                         {
     79                        if (isset($field["type"]["auto-select"]) && $field["type"]["auto-select"]) {
    8180                            return $this->field_select_auto($field);
    82                         }
    83                         else
    84                         {
     81                        } else {
    8582                            return $this->field_select($field);
    86                         }                       
    87                     } 
     83                        }
     84                    }
    8885                } else {
    8986                    $field["type"]["type"] = "text";
     
    122119        $values["class"] = "col-md-4";
    123120
    124         if (isset($values["type"]["class"])) {
     121        if (isset($field["type"]["class"])) {
    125122            $values["class"] = $values["type"]["class"];
    126123        }
     
    128125        $values["type_field"] = '';
    129126
    130         if ($values["type"] == "number") {
     127        if ($field["type"] == "number") {
    131128            $values["type_field"]  = ' type="number" ';
    132129        }
     
    135132        $values["input_class"] = '';
    136133
    137         if (isset($values["type"]["input_class"])) {
     134        if (isset($field["type"]["input_class"])) {
    138135            $values["input_class"] = $values["type"]["input_class"];
    139136        }
     
    204201        $values = $this->get_values($field);
    205202        $table = $field["type"]["select"]["model"];
     203        $title_value="";
     204        $ret='';
     205
     206        if($values["value"] > 0 || $values["value"] < 0)
     207        {
     208            $sql="select * from $table where  ".$field["type"]["select"]["key"]."=".$values["value"];
     209            $query_string       = $wpdb->prepare($sql, array());
     210            $items       = $wpdb->get_results($query_string, ARRAY_A);
     211            $title_value=$items[0][$field["type"]["select"]["label"]];
     212           // $ret .= $sql;
     213        }
    206214
    207215        $where = '';
    208216
    209         if (isset($field["type"]["select"]["where"])) {
     217        if (isset($field["type"]["select"]["where"])&& strlen(trim($field["type"]["select"]["where"]))>0) {
    210218            $where = " and " . $field["type"]["select"]["where"];
    211219        }
    212220
    213         $ret = sprintf('<div id="%s" class="%s form-group auto-select-box">',esc_html($field["title"]."_box_auto"), esc_attr($values["class"]));
     221        $ret .= sprintf('<div id="%s" class="%s form-group auto-select-box">', esc_html($field["title"] . "_box_auto"), esc_attr($values["class"]));
    214222        $ret .= sprintf('<label class="label-control">%s</label>', esc_html($values["label_title"]));
     223        $ret .= sprintf('<input model-label="%s" model-table="%s" model-where="%s" onKeyUp="ipak_auto_select_item_key_down(jQuery(this))" autocomplete="off" target-id="%s" id="%s"  class="form-control" value="%s" onclick="ipak_auto_select_input(jQuery(this));" />', $field["type"]["select"]["label"], $table, $where, esc_html($field["title"]), esc_html($field["title"] . "_auto_complete"), esc_html($title_value));
    215224        $ret .= sprintf('<input type="hidden" id="%s" name="%s" value="%s" />', esc_html($field["title"]), esc_html($field["title"]), esc_html($values["value"]));
    216         $ret .= sprintf('<input model-label="%s" model-table="%s" model-where="%s" onKeyUp="ipak_auto_select_item_key_down(jQuery(this))" autocomplete="off" target-id="%s" id="%s"  class="form-control" value="%s" onclick="ipak_auto_select_input(jQuery(this));" />',$field["type"]["select"]["label"],$table,$where,esc_html($field["title"]), esc_html($field["title"]."_auto_complete"), esc_html($values["value"]));
    217        
    218         $query_string       = $wpdb->prepare("select * from $table where 1=1 " . $where . " limit 100 ", array());
     225
     226        $sql="select * from $table where 1=1 " . $where . " limit 100 ";
     227       
     228        $query_string       = $wpdb->prepare($sql, array());
    219229        $items       = $wpdb->get_results($query_string, ARRAY_A);
    220230
     
    224234            $selected = "";
    225235            if ($values["value"] == $item["id"])
    226                 $selected = "selected";
     236            {
     237                //$edit_id = $item["id"];
     238            }
     239               
    227240            // for ($x = 0; $x < 50; $x++) {
    228241            //     $ret .= sprintf('<div onclick="ipak_auto_select_item(jQuery(this));" class="auto-select-item" %s value="%s">%s</div>', esc_attr($selected), esc_attr($item["id"]), esc_html($item[$field["type"]["select"]["label"]]));
    229242            // }
    230             $ret .= sprintf('<div target-id="%s" onclick="ipak_auto_select_item(jQuery(this));" class="auto-select-item" %s value="%s" title="%s" >%s</div>',esc_html($field["title"]), esc_attr($selected), esc_attr($item["id"]), esc_html($item[$field["type"]["select"]["label"]]), esc_html($item[$field["type"]["select"]["label"]]));
     243            $ret .= sprintf('<div target-id="%s" onclick="ipak_auto_select_item(jQuery(this));" class="auto-select-item" %s value="%s" title="%s" >%s</div>', esc_html($field["title"]), esc_attr($selected), esc_attr($item[$field["type"]["select"]["key"]]), esc_html($item[$field["type"]["select"]["label"]]), esc_html($item[$field["type"]["select"]["label"]]));
    231244        }
    232245
     
    235248        $ret .= sprintf('</div>');
    236249
     250
     251//$ret .= $sql;
    237252        return $ret;
    238253    }
     
    264279        $values = $this->get_values($field);
    265280
     281        $height = '100px;';
     282        if (isset($field["type"]["height"])) {
     283            $height = $field["type"]["height"] . 'px;';
     284        }
     285       
     286
    266287        $ret = sprintf('<div class="%s form-group">', esc_attr($values["class"]));
    267288        $ret .= sprintf('<label class="label-control">%s</label>', esc_html($values["label_title"]));
    268         $ret .= sprintf('<textarea  id="%s" name="%s" %s class="form-control %s" >%s</textarea>', esc_attr($field["title"]), esc_attr($field["title"]), esc_attr($values["type_field"]), esc_attr($values["input_class"]), esc_html($values["value"]));
     289        $ret .= sprintf('<textarea style="height: %s"  id="%s" name="%s" %s class="form-control %s" >%s</textarea>', $height, esc_attr($field["title"]), esc_attr($field["title"]), esc_attr($values["type_field"]), esc_attr($values["input_class"]), esc_html($values["value"]));
    269290        $ret .= sprintf('</div>');
    270291
  • mbm-ipak/trunk/mbm-ipak.php

    r2619863 r2620128  
    88 *
    99 * @link              http://mbmti.ir
    10  * @since             2.0.6
     10 * @since             2.0.7
    1111 * @package           MBM_IPAK
    1212 *
     
    1515 * Plugin URI:        http://mbmti.ir
    1616 * Description:       سیستم حسابداری ایپک
    17  * Version:           2.0.6
     17 * Version:           2.0.7
    1818 * Author:            ایپک
    1919 * Author URI:        http://mbmti.ir/our-team
     
    2727/* General Definition
    2828******************************/
    29 define('MBM_IPAK_VERSION', '2.0.6');
     29define('MBM_IPAK_VERSION', '2.0.7');
    3030
    3131define('MBM_IPAK_BASE', plugin_dir_path(__FILE__));
  • mbm-ipak/trunk/readme.txt

    r2619863 r2620128  
    55Requires at least: 3.0.1
    66Tested up to: 5.8.1
    7 Stable tag: 2.0.6
     7Stable tag: 2.0.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • mbm-ipak/trunk/view/model/list.php

    r2615853 r2620128  
    1616       
    1717        <form action="?page=<?php echo !empty($_REQUEST["page"])?esc_attr(sanitize_text_field($_REQUEST["page"])) : ''; ?>" method="post" class="form-search-table">
    18             <input value="<?php echo esc_attr($this->model_obj->text_search); ?>" id="search-main-table" name="search-main-table" class="form-control" placeholder="جستجو.." />
     18            <input value="<?php echo !empty($_REQUEST["page"])?esc_attr(get_option(sanitize_text_field($_REQUEST["page"]). "_search")) : ''; ?>" id="search-main-table" name="search-main-table" class="form-control" placeholder="جستجو.." />
    1919            <input class="btn btn-primary" type="submit" value="بگرد" />
    2020        </form>
Note: See TracChangeset for help on using the changeset viewer.