biz9-logic 4.9.85 → 4.9.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +8 -22
  3. package/package.json +1 -1
  4. package/test.js +111 -36
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='9.5.5'
1
+ VERSION='9.6.1'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='9.5.3'
package/index.js CHANGED
@@ -205,6 +205,9 @@ class Type {
205
205
  static DATE_CREATE='date_create';
206
206
  static DATE_SAVE='date_save';
207
207
  static ID='id';
208
+ static OBJ='obj';
209
+ static LIST='list';
210
+ static COUNT='count';
208
211
  static N_A='n/a';
209
212
  static USER='user';
210
213
  static USER_ID='user_id';
@@ -1111,27 +1114,10 @@ class Field_Logic {
1111
1114
  {value:'list',label:'List'},
1112
1115
  ];
1113
1116
  };
1114
- static get_field_value_value = (value_type,item,value_id) =>{
1115
- switch(value_type){
1116
- case Type.FIELD_VALUE_TEXT:
1117
- case Type.FIELD_VALUE_NOTE:
1118
- case Type.FIELD_VALUE_IMAGE:
1119
- return !Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id)]) ? item[Field_Logic.get_field_value_title(value_type,value_id)] : "";
1120
- break;
1121
- case Type.FIELD_VALUE_LIST:
1122
- let r_list = [];
1123
- for(let a=0;a<30;a++){
1124
- if(!Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id,a+1)])){
1125
- r_list.push(item[Field_Logic.get_field_value_title(value_type,value_id,a+1)]);
1126
- }
1127
- }
1128
- return r_list;
1129
- break;
1130
- default:
1131
- return "";
1132
- };
1133
- }
1134
- static get_field_value_title = (value_type,value_id,row_id) =>{
1117
+ static get_field_value_value = (value_type,item,value_id,sub_field_title) =>{
1118
+ return !Str.check_is_null(item[Field_Logic.get_field_value_title(value_type,value_id,sub_field_title)]) ? item[Field_Logic.get_field_value_title(value_type,value_id,sub_field_title)] : "";
1119
+ };
1120
+ static get_field_value_title = (value_type,value_id,sub_field_title) =>{
1135
1121
  let type_str = '';
1136
1122
  switch(value_type){
1137
1123
  case Type.FIELD_VALUE_TEXT:
@@ -1144,7 +1130,7 @@ class Field_Logic {
1144
1130
  return 'image'+'_value_'+value_id;
1145
1131
  break;
1146
1132
  case Type.FIELD_VALUE_LIST:
1147
- return 'list'+'_value_'+value_id +'_row_'+row_id;
1133
+ return 'list'+'_value_'+value_id +"_"+Str.get_title_url(sub_field_title);
1148
1134
  break;
1149
1135
  default:
1150
1136
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.9.85",
3
+ "version": "4.9.91",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -30,27 +30,102 @@ describe("connect", () => {
30
30
  it("_connect", () => {
31
31
  series([
32
32
 
33
- function(call) {
34
- console.log('CONNECT-BASE-START');
35
- let data_type = DataType.PRODUCT;
36
- let id = 0;
37
- let parent_data_type = DataType.PRODUCT;
38
- let parent_id = 3334;
39
- let user_id = 0;
40
- let item_list = [];
41
- Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
42
- Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));
43
- //Log.w('item_list',item_list);
44
- //Log.w('bind_obj_list',App_Logic.bind_item_parent_user_list(item_list));
33
+ function(call) {
34
+ let my_template = {
35
+ title1: "About Us",
36
+ title2: "aboout_link",
37
+ title3: "Categories",
38
+ title4: "category_link",
39
+ title5: "Create Gigs",
40
+ title6: "gigs_link",
41
+ title7: "Home",
42
+ title8: "home_link",
43
+ title9: "Service",
44
+ title10: "service_link",
45
+ title11: "Faq",
46
+ title12: "faq_link",
47
+ title13: "Contact",
48
+ title14: "contact_link"
49
+ };
50
+ /*
51
+ let my_template = {
52
+ title1: "About Us",
53
+ title2: "aboout_link",
54
+ title3: "about_id",
55
+ title4: "Create Gigs",
56
+ title5: "gigs_link",
57
+ title6: "gigs_id",
58
+ title7: "Service",
59
+ title8: "service_link",
60
+ title9: "service_id",
61
+ title10: "Contact",
62
+ title11: "contact_link",
63
+ title12: "contact_id"
64
+ };
65
+ */
66
+
67
+ value_count = 2;
68
+ let new_list = [];
69
+ let row_count = 1;
70
+ for(let a = 1; a < 90; a++){
71
+ if(!Str.check_is_null(my_template['title'+row_count])){
72
+ let item = {};
73
+ item['value_1'] = my_template['title'+row_count];
74
+ if(value_count >=2){
75
+ item['value_2'] = my_template['title'+Number(row_count+1)];
76
+ }
77
+ if(value_count >=3){
78
+ item['value_3'] = my_template['title'+Number(row_count+2)];
79
+ }
80
+ new_list.push(item);
81
+ row_count = row_count + value_count;
82
+ }else{
83
+ break;
84
+ }
85
+ }
86
+ /*--work
87
+ list_value_count = 2;
88
+ let title_row = 1;
89
+ let link_row = 2;
90
+ for(let a = 1; a < 900; a++){
91
+ if(!Str.check_is_null(my_template['title'+title_row])){
92
+ new_list.push(
93
+ {
94
+ value_1:my_template['title'+title_row],
95
+ value_2:my_template['title'+link_row]
96
+ });
97
+ title_row = title_row + list_value_count;
98
+ link_row = title_row + 1;
99
+ }else{
100
+ console.log('bbbbbbbbb');
101
+ break;
102
+ }
103
+ }
104
+ */
45
105
 
46
- //item.id = 333;
47
- //item.items = ['a','b'];
48
- //Log.w('bind_obj',App_Logic.bind_item_parent_user_obj(item,parent_item,user));
49
- //let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
50
- //Log.w('stat',stat);
51
- console.log('CONNECT-BASE-END');
52
- }
53
- /*
106
+ Log.w('cool',new_list);
107
+ },
108
+ function(call) {
109
+ console.log('CONNECT-BASE-START');
110
+ let data_type = DataType.PRODUCT;
111
+ let id = 0;
112
+ let parent_data_type = DataType.PRODUCT;
113
+ let parent_id = 3334;
114
+ let user_id = 0;
115
+ let item_list = [];
116
+ Log.w('Title',Type.get_title(Type.ORDER_STATUS_NEW));
117
+ Log.w('Title 2',Type.get_title(Type.ORDER_STATUS_COMPLETE));
118
+ //Log.w('item_list',item_list);
119
+ //Log.w('bind_obj_list',App_Logic.bind_item_parent_user_list(item_list));
120
+
121
+ //item.id = 333;
122
+ //item.items = ['a','b'];
123
+ //Log.w('bind_obj',App_Logic.bind_item_parent_user_obj(item,parent_item,user));
124
+ //let stat = Stat_Logic.get_new(parent_data_type,parent_id,Type.STAT_VIEW,user_id,item);
125
+ //Log.w('stat',stat);
126
+ console.log('CONNECT-BASE-END');
127
+ }
128
+ /*
54
129
  function(call) {
55
130
  console.log('CONNECT-CMS-DEMO-START');
56
131
  let category_type = DataType.PRODUCT;
@@ -64,7 +139,7 @@ describe("connect", () => {
64
139
  let category_title_list = '';
65
140
 
66
141
  let item_title_list = [];
67
- let post_type_list = [];
142
+ let post_type_list = [];
68
143
  let val_category_title = '';
69
144
  let cat_max = 0;
70
145
  let option = {get_category:true,category_count:category_count,category_data_type:category_type,categorys:val_category_title?val_category_title:null,
@@ -77,25 +152,25 @@ describe("connect", () => {
77
152
  }
78
153
  console.log('CONNECT-CMS-DEMO-SUCCESS');
79
154
  },
80
- */
155
+ */
81
156
  /*
82
157
  function(call) {
83
- //console.log('CONNECT-START');
84
- //let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
85
- //let post_cart_list = [];
86
- //let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
87
- //let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
88
- //let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
89
- //post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
90
- //post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
91
- //post_cart.cart_item_list.push(post_cart_item);
158
+ //console.log('CONNECT-START');
159
+ //let post_cart = Cart_Logic.get_new(DataType.PRODUCT,0,);
160
+ //let post_cart_list = [];
161
+ //let post_cart_item = Cart_Logic.get_new_cart_item(DataType.PRODUCT,123,post_cart.cart_number,1,30);
162
+ //let post_cart_sub_item = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,10);
163
+ //let post_cart_sub_item_2 = Cart_Logic.get_new_cart_sub_item(DataType.PRODUCT,1234,post_cart.cart_number,1,30);
164
+ //post_cart_item.cart_sub_item_list.push(post_cart_sub_item);
165
+ //post_cart_item.cart_sub_item_list.push(post_cart_sub_item_2);
166
+ //post_cart.cart_item_list.push(post_cart_item);
92
167
 
93
- //Log.w('post_cart',post_cart);
94
- //Log.w('post_order',Order_Logic.get_new(post_cart,{get_payment_plan:true,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN}));
95
- //Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
168
+ //Log.w('post_cart',post_cart);
169
+ //Log.w('post_order',Order_Logic.get_new(post_cart,{get_payment_plan:true,payment_plan:Title.ORDER_PAYMENT_PLAN_1,payment_plan_status:Title.ORDER_PAYMENT_STATUS_OPEN}));
170
+ //Log.w('post_cart_2',Cart_Logic.get_total(post_cart));
96
171
 
97
- //console.log('CONNECT-END');
98
- //call();
172
+ //console.log('CONNECT-END');
173
+ //call();
99
174
  },
100
175
  /* --- TEST LOGIC - CONNECT - END --- */
101
176