biz9-logic 4.8.144 → 4.8.147

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 +142 -154
  3. package/package.json +1 -1
  4. package/test.js +5 -0
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='6.2.4'
1
+ VERSION='6.2.7'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -34,6 +34,20 @@ class Item_Logic {
34
34
  }
35
35
  return item;
36
36
  }
37
+ static get_not_found = (data_type,id,option) =>{
38
+ if(!id){
39
+ id=0;
40
+ }
41
+ let item = Item_Logic.get_test("",data_type,id,{get_blank:true})
42
+ item.id = 0;
43
+ item.id_key = id;
44
+ item.title = "Item Not Found";
45
+ item.title_url = Str.get_title_url(item.title);
46
+ if(option.app_id){
47
+ item.app_id = option.app_id;
48
+ }
49
+ return item;
50
+ };
37
51
  static get_test_list = (data_type,option) =>{
38
52
  option = Field_Logic.get_option(data_type,option?option:{});
39
53
  let item_list = [];
@@ -45,10 +59,7 @@ class Item_Logic {
45
59
  static get_search = (data_type,filter,sort_by,page_current,page_size) => {
46
60
  return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
47
61
  }
48
- static get_note = () => {
49
- return "Note "+String(Number.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
50
- }
51
- static get_search_query(search){
62
+ static get_search_query(search){
52
63
  let url = "";
53
64
  if(search.data_type){
54
65
  url = url + "&data_type="+search.data_type;
@@ -218,97 +229,17 @@ class Page_Logic {
218
229
  return item_list;
219
230
  }
220
231
  }
221
- class Order_Logic {
222
- static get_order_id = () => {
223
- return FieldType.ORDER_ID + Number.get_id();
224
- }
225
- static get_test_order_item = (order_item_id,order_id,user_id,parent_data_type,parent_id,option) =>{
226
- option = Field_Logic.get_option(DataType.ORDER_ITEM,option?option:{generate_id:Str.check_is_null(order_item_id)? true : false });
227
- let order_item = DataItem.get_new(DataType.ORDER_ITEM,Number.get_guid(),Field_Logic.get_test("Order Item "+Number.get_id(),option));
228
- order_item.order_id = order_id;
229
- order_item.user_id = user_id;
230
- order_item.parent_data_type = parent_data_type;
231
- order_item.parent_id = parent_id;
232
- order_item.cost = Field_Logic.get_test_cost();
233
- if(option.get_order_sub_item){
234
- order_item.order_sub_item_list = [];
235
- for(let a = 0;a<option.order_sub_item_count;a++){
236
- order_item.order_sub_item_list.push(Order_Logic.get_test_order_sub_item(order_id,user_id,order_item.id,parent_data_type,parent_id,{get_value:true,get_order_sub_item:option.get_order_sub_item,order_sub_item_count:option.order_sub_item_count}));
237
- }
238
- }
239
- return order_item;
240
- };
241
- static get_test_order_sub_item = (order_id,user_id,order_item_id,parent_data_type,parent_id,option) =>{
242
- option = Field_Logic.get_option(DataType.ORDER_SUB_ITEM,option?option:{});
243
- let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,Number.get_guid(),Field_Logic.get_test("Order Sub Item "+Number.get_id(),option));
244
- order_sub_item.user_id = user_id;
245
- order_sub_item.order_id = order_id;
246
- order_sub_item.order_item_id = order_item_id;
247
- order_sub_item.parent_data_type = parent_data_type;
248
- order_sub_item.parent_id = parent_id;
249
- order_sub_item.cost = Field_Logic.get_test_cost();
250
- return order_sub_item;
251
- };
252
- static get_test_order_item = (order_id,user_id,parent_data_type,parent_id,option) =>{
253
- option = Field_Logic.get_option(DataType.ORDER_ITEM,option?option:{});
254
- let order_item = DataItem.get_new(DataType.ORDER_ITEM,Number.get_guid(),Field_Logic.get_test("Order Item "+Number.get_id(),option));
255
- order_item.order_id = order_id;
256
- order_item.user_id = user_id;
257
- order_item.parent_data_type = parent_data_type;
258
- order_item.parent_id = parent_id;
259
- order_item.cost = Field_Logic.get_test_cost();
260
- order_item.order_sub_item_list = [];
261
- if(option.get_order_sub_item){
262
- for(let a = 0;a<option.order_sub_item_count;a++){
263
- order_item.order_sub_item_list.push(Order_Logic.get_test_order_sub_item(order_id,user_id,order_item.id,parent_data_type,parent_id,{get_value:true,get_order_sub_item:option.get_order_sub_item,order_sub_item_count:option.order_sub_item_count}));
264
- }
265
- }
266
- return order_item;
267
- };
268
- static get_test_order_sub_item = (order_id,user_id,order_item_id,parent_data_type,parent_id,option) =>{
269
- option = Field_Logic.get_option(DataType.ORDER_SUB_ITEM,option?option:{});
270
- let order_sub_item = DataItem.get_new(DataType.ORDER_SUB_ITEM,Number.get_guid(),Field_Logic.get_test("Order Sub Item "+Number.get_id(),option));
271
- order_sub_item.user_id = user_id;
272
- order_sub_item.order_id = order_id;
273
- order_sub_item.order_item_id = order_item_id;
274
- order_sub_item.parent_data_type = parent_data_type;
275
- order_sub_item.parent_id = parent_id;
276
- order_sub_item.cost = Field_Logic.get_test_cost();
277
- return order_sub_item;
278
- };
279
- static get_test_list = (option) =>{
280
- option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
281
- let item_list = [];
282
- for(let a=0;a<option.product_count+1;a++){
283
- item_list.push(Product_Logic.get_test("Product "+String(parseInt(a+1)),option));
284
- }
285
- return item_list;
286
- }
287
- static get_test_list_by_category = (option) =>{
288
- option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
289
- let product_list = [];
290
- let category_list = Category_Logic.get_type_category_list(DataType.PRODUCT,option.category_count);
291
- let item_count = 0;
292
- for(let a=0;a<category_list.length;a++){
293
- for(let b=0;b<option.product_count;b++){
294
- item_count++;
295
- let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
296
- product.category = category_list[Number.get_id(category_list.length+1)].title;
297
- product_list.push(product);
298
- }
299
- }
300
- return [category_list,product_list]
301
- };
302
-
303
- //static get_product_order = (order,product_list,,parent_data_type,parent_id,option) =>{
304
- //return order_item;
305
- //};
306
- }
307
232
  class Cart_Logic {
308
233
  static get_cart_number = () => {
309
234
  return FieldType.CART_NUMBER + Number.get_id(99999);
310
- }
311
- static get_test_cart_item = (cart_item_id,cart_number,user_id,parent_data_type,parent_id,option) =>{
235
+ };
236
+ static get_cart = (user_id) => {
237
+ return DataItem.get_new(DataType.CART,0,{user_id:user_id,cart_number:Cart_Logic.get_cart_number(),quanity:1,grand_total:0,cart_item_list:[]});
238
+ };
239
+ static get_cart_item = (parent_data_type,parent_id,cart_number,user_id,quanity) =>{
240
+ return DataItem.get_new(DataType.CART_ITEM,0,{parent_data_type:parent_data_type,parent_id:parent_id,cart_number:cart_number,user_id:user_id,quanity:quanity,sub_total:0,cart_sub_item_list:[]});
241
+ };
242
+ static get_test_item = (cart_item_id,cart_number,user_id,parent_data_type,parent_id,option) =>{
312
243
  option = Field_Logic.get_option(DataType.CART_ITEM,option?option:{generate_id:Str.check_is_null(cart_item_id)? true : false });
313
244
  let cart_item = DataItem.get_new(DataType.CART_ITEM,Number.get_guid(),Field_Logic.get_test("Cart Item "+Number.get_id(),option));
314
245
  cart_item.cart_item_id = cart_item_id;
@@ -319,13 +250,13 @@ class Cart_Logic {
319
250
  if(option.get_cart_sub_item){
320
251
  cart_item.cart_sub_item_list = [];
321
252
  for(let a = 0;a<option.cart_sub_item_count;a++){
322
- let cart_sub_item = Cart_Logic.get_test_cart_sub_item(cart_number,user_id,cart_item.id,parent_data_type,parent_id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count});
253
+ let cart_sub_item = Cart_Logic.get_test_sub_item(cart_number,user_id,cart_item.id,parent_data_type,parent_id,{get_value:true,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count});
323
254
  cart_item.cart_sub_item_list.push(cart_sub_item);
324
255
  }
325
256
  }
326
257
  return cart_item;
327
258
  };
328
- static get_test_cart_sub_item = (cart_number,user_id,cart_item_id,parent_data_type,parent_id,option) =>{
259
+ static get_test_sub_item = (cart_number,user_id,cart_item_id,parent_data_type,parent_id,option) =>{
329
260
  option = Field_Logic.get_option(DataType.CART_SUB_ITEM,option?option:{});
330
261
  let item_blank = Item_Logic.get_test('Sub Item '+Number.get_id(),DataType.ITEM,0,{generate_id:true});
331
262
  let cart_sub_item = DataItem.get_new(DataType.CART_SUB_ITEM,Number.get_guid(),Field_Logic.get_test("Cart Sub Item "+Number.get_id(),option));
@@ -400,7 +331,7 @@ class Product_Logic {
400
331
  let product_list = Product_Logic.get_test_list(product_option);
401
332
  cart.cart_item_list = [];
402
333
  for(let a = 0;a<product_list.length;a++){
403
- let product_cart_item =Cart_Logic.get_test_cart_item(cart_number,cart.id,user_id,product_list[a].data_type,product_list[a].id,{get_value:false,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count,generate_id:true});
334
+ let product_cart_item =Cart_Logic.get_test_item(cart_number,cart.id,user_id,product_list[a].data_type,product_list[a].id,{get_value:false,get_cart_sub_item:option.get_cart_sub_item,cart_sub_item_count:option.cart_sub_item_count,generate_id:true});
404
335
  product_cart_item.parent_item = product_list[a];
405
336
  cart.cart_item_list.push(product_cart_item);
406
337
  }
@@ -517,8 +448,14 @@ class Blog_Post_Logic {
517
448
  [title,option] = Field_Logic.get_option_title(title,option);
518
449
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
519
450
  let blog_post = DataItem.get_new(DataType.BLOG_POST,0,Field_Logic.get_test(title,option));
520
- blog_post.author="First Name "+ Number.get_id();
521
- blog_post.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
451
+
452
+ if(!option.get_blank){
453
+ blog_post.author="First Name "+ Number.get_id();
454
+ blog_post.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
455
+ }else{
456
+ blog_post.author="";
457
+ blog_post.tag = "";
458
+ }
522
459
  if(option.get_item){
523
460
  blog_post.items = Sub_Item_Logic.get_test_list(blog_post,blog_post,option);
524
461
  }
@@ -552,11 +489,8 @@ class Event_Logic {
552
489
  static get_test = (title,option) =>{
553
490
  [title,option] = Field_Logic.get_option_title(title,option);
554
491
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
555
- let event = DataItem.get_new_full_item(
556
- DataItem.get_new(DataType.EVENT,0),
557
- DataItem.get_new(DataType.EVENT,0),
558
- DataItem.get_new(DataType.EVENT,0),
559
- Field_Logic.get_test(title,option));
492
+ let event = DataItem.get_new(DataType.EVENT,0,Field_Logic.get_test(title,option));
493
+ if(!option.get_blank){
560
494
  event.cost = Field_Logic.get_test_cost();
561
495
  event.old_cost = Field_Logic.get_test_cost();
562
496
  event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
@@ -567,6 +501,18 @@ class Event_Logic {
567
501
  event.stock = String(Number.get_id(3-1));
568
502
  event.category ="Category " + String(Number.get_id());
569
503
  event.tag = "Tag "+ Number.get_id() + ", Tag "+Number.get_id() + ", Tag "+ Number.get_id();
504
+ }else{
505
+ event.cost = "";
506
+ event.old_cost = "";
507
+ event.date = "";
508
+ event.time = "";
509
+ event.website = "";
510
+ event.location = "";
511
+ event.meeting_link = "";
512
+ event.stock = "";
513
+ event.category ="";
514
+ event.tag = "";
515
+ }
570
516
  if(option.get_item){
571
517
  event.items = Sub_Item_Logic.get_test_list(event,event,option);
572
518
  }
@@ -597,6 +543,12 @@ class Event_Logic {
597
543
  };
598
544
  }
599
545
  class Field_Logic {
546
+ static get_test_cost(){
547
+ return String(Number.get_id(999)) + "." + String(Number.get_id(99));
548
+ }
549
+ static get_test_note = () => {
550
+ return "Note "+String(Number.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
551
+ }
600
552
  static get_test = (title,option) =>{
601
553
  option = !Obj.check_is_empty(option) ? option : {};
602
554
  let item = {};
@@ -616,7 +568,7 @@ class Field_Logic {
616
568
  setting_visible:"1",
617
569
  title_url:Str.get_title_url(title),
618
570
  sub_note:"Sub Note "+String(Number.get_id()),
619
- note:Item_Logic.get_note(),
571
+ note:Field_Logic.get_test_note(),
620
572
  view_count:0,
621
573
  id:0,
622
574
  date_create:new moment().toISOString(),
@@ -714,7 +666,6 @@ class Field_Logic {
714
666
  if(data_type==DataType.CART){
715
667
  option.category_title = option.category_title ? option.category_title : "";
716
668
  option.value_count = option.value_count ? option.value_count : 9;
717
- option.generate_id = option.generate_id ? option.generate_id : true;
718
669
  option.get_cart_item = option.get_cart_item ? option.get_cart_item : false;
719
670
  option.cart_item_count = option.cart_item_count ? option.cart_item_count : 5;
720
671
  option.get_cart_sub_item = option.get_cart_sub_item ? option.get_cart_sub_item : false;
@@ -768,9 +719,6 @@ class Field_Logic {
768
719
  }
769
720
  return [title,option];
770
721
  }
771
- static get_test_cost(){
772
- return String(Number.get_id(999)) + "." + String(Number.get_id(99));
773
- }
774
722
  static get_option_admin(req){
775
723
  let option = {};
776
724
  option.value_count = req.query.value_count ? req.query.value_count : 9;
@@ -847,6 +795,7 @@ class FieldType {
847
795
  static KEY_ADMIN="key_admin";
848
796
  static KEY_APP_ID="key_app_id";
849
797
  static KEY_BUSINESS="key_business";
798
+ static KEY_TEMPLATE="key_template";
850
799
  static KEY_CART="key_cart";
851
800
  static KEY_GUEST="key_guest";
852
801
  static KEY_ORDER="key_order";
@@ -1053,16 +1002,19 @@ class Faq_Logic {
1053
1002
  [title,option] = Field_Logic.get_option_title(title,option);
1054
1003
  option = Field_Logic.get_option(DataType.FAQ,option?option:{});
1055
1004
  option.get_value = false;
1056
- let faq = DataItem.get_new_full_item(
1057
- DataItem.get_new(DataType.FAQ,0),
1058
- DataItem.get_new(DataType.FAQ,0),
1059
- DataItem.get_new(DataType.FAQ,0),
1060
- Field_Logic.get_test(title,option));
1005
+ let faq = DataItem.get_new(DataType.FAQ,0,Field_Logic.get_test(title,option));
1061
1006
  for(let a=0;a<option.question_count+1;a++){
1007
+ if(!option.get_blank){
1062
1008
  let question_title = "FAQ Question " + String(parseInt(a+1));
1063
1009
  let answer = "My answer "+ Number.get_id() + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
1064
1010
  faq[Str.get_title_url(question_title).toLowerCase()] = answer;
1065
1011
  faq['field_'+parseInt(a+1)] =question_title;
1012
+ }else{
1013
+ let question_title = "";
1014
+ let answer = "";
1015
+ faq[Str.get_title_url(question_title).toLowerCase()] = answer;
1016
+ faq['field_'+parseInt(a+1)] =question_title;
1017
+ }
1066
1018
  }
1067
1019
  return faq;
1068
1020
  };
@@ -1098,16 +1050,16 @@ class Favorite_Logic {
1098
1050
  static get_user_search_filter = (parent_data_type,user_id) =>{
1099
1051
  return {
1100
1052
  $and: [
1101
- { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1102
- { user_id: { $regex:user_id, $options: "i" } }
1053
+ { parent_data_type: { $regex:String(parent_data_type), $options: "i" } },
1054
+ { user_id: { $regex:String(user_id), $options: "i" } }
1103
1055
  ] };
1104
1056
  }
1105
1057
  static get_search_filter = (parent_data_type,parent_id,user_id) =>{
1106
1058
  return {
1107
1059
  $and: [
1108
- { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1109
- { parent_id: { $regex:parent_id, $options: "i" } },
1110
- { user_id: { $regex:user_id, $options: "i" } }
1060
+ { parent_data_type: { $regex:String(parent_data_type), $options: "i" } },
1061
+ { parent_id: { $regex:String(parent_id), $options: "i" } },
1062
+ { user_id: { $regex:String(user_id), $options: "i" } }
1111
1063
  ] };
1112
1064
  }
1113
1065
  }
@@ -1126,24 +1078,28 @@ class Review_Logic {
1126
1078
  static get_search_filter = (parent_data_type,parent_id) =>{
1127
1079
  return {
1128
1080
  $and: [
1129
- { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1130
- { parent_id: { $regex:parent_id, $options: "i" } },
1081
+ { parent_data_type: { $regex:String(parent_data_type), $options: "i" } },
1082
+ { parent_id: { $regex:String(parent_id), $options: "i" } },
1131
1083
  ] };
1132
1084
  }
1133
1085
  static get_test = (parent_data_type,parent_id,user_id,option) =>{
1134
1086
  option = Field_Logic.get_option(DataType.REVIEW,option?option:{});
1135
1087
  let review = DataItem.get_new(DataType.REVIEW,0);
1136
- if(option.generate_id){
1137
- review.id = Number.get_id();
1138
- }
1088
+ if(!option.get_blank){
1139
1089
  review.title = 'Title ' + Number.get_id();
1140
1090
  review.parent_data_type = parent_data_type;
1141
1091
  review.parent_id = parent_id;
1142
-
1143
1092
  review.rating = Number.get_id(6);
1144
1093
  review.user_id = user_id;
1145
- review.comment = "My comment "+ Item_Logic.get_note();
1146
-
1094
+ review.comment = "My comment "+ Field_Logic.get_test_note();
1095
+ }else{
1096
+ review.title = '';
1097
+ review.parent_data_type = parent_data_type;
1098
+ review.parent_id = parent_id;
1099
+ review.rating = 0;
1100
+ review.user_id = user_id;
1101
+ review.comment = "";
1102
+ }
1147
1103
  return review;
1148
1104
  };
1149
1105
  static get_test_list=(option)=>{
@@ -1170,13 +1126,14 @@ class Admin_Logic {
1170
1126
  [title,option] = Field_Logic.get_option_title(title,option);
1171
1127
  option = Field_Logic.get_option(DataType.ADMIN,option?option:{});
1172
1128
  let item = DataItem.get_new(DataType.ADMIN,0);
1173
- let admin = DataItem.get_new_full_item(
1174
- DataItem.get_new(DataType.ADMIN,Number.get_id()),
1175
- DataItem.get_new(DataType.ADMIN,0),
1176
- DataItem.get_new(DataType.ADMIN,0),
1177
- Field_Logic.get_test(title,option));
1178
- admin.email="ceo@admin"+Number.get_id()+".com";
1179
- admin.password="1234567";
1129
+ let admin = DataItem.get_new(DataType.ADMIN,0,Field_Logic.get_test(title,option));
1130
+ if(!option.get_blank){
1131
+ admin.email="ceo@admin"+Number.get_id()+".com";
1132
+ admin.password="1234567";
1133
+ }else{
1134
+ admin.email="";
1135
+ admin.password="";
1136
+ }
1180
1137
  return admin;
1181
1138
  };
1182
1139
  static get_full_address(admin){
@@ -1216,11 +1173,8 @@ class Business_Logic {
1216
1173
  let item = DataItem.get_new(DataType.BUSINESS,0);
1217
1174
  let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
1218
1175
  let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
1219
- let business = DataItem.get_new_full_item(
1220
- DataItem.get_new(DataType.BUSINESS,Number.get_id()),
1221
- DataItem.get_new(DataType.BUSINESS,0),
1222
- DataItem.get_new(DataType.BUSINESS,0),
1223
- Field_Logic.get_test(title,option));
1176
+ let business = DataItem.get_new(DataType.BUSINESS,0,Field_Logic.get_test(title,option));
1177
+ if(!option.get_blank){
1224
1178
  business.email="ceo@business"+Number.get_id()+".com";
1225
1179
  business.phone=Number.get_id(parseInt(777+100)) + "-" + Number.get_id(parseInt(777+100)) + "-"+Number.get_id(parseInt(7777+1000));
1226
1180
  business.address_1=Number.get_id(99)+" Main St.";
@@ -1233,6 +1187,20 @@ class Business_Logic {
1233
1187
  business.instagram="instagram_"+Number.get_id(9999);
1234
1188
  business.facebook="facebook_"+Number.get_id(9999);
1235
1189
  business.twitter="twitter_"+Number.get_id(9999);
1190
+ }else{
1191
+ business.email="";
1192
+ business.phone="";
1193
+ business.address_1="";
1194
+ business.address_2="";
1195
+ business.city="";
1196
+ business.state="";
1197
+ business.zip="";
1198
+ business.website="";
1199
+ business.youtube="";
1200
+ business.instagram="";
1201
+ business.facebook="";
1202
+ business.twitter="";
1203
+ }
1236
1204
  return business;
1237
1205
  };
1238
1206
  static get_full_address(business){
@@ -1578,11 +1546,7 @@ class Category_Logic {
1578
1546
  static get_test = (title,option) =>{
1579
1547
  title = (title) ? title : "Category 1";
1580
1548
  option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
1581
- let category = DataItem.get_new_full_item(
1582
- DataItem.get_new(DataType.CATEGORY,0),
1583
- DataItem.get_new(DataType.CATEGORY,0),
1584
- DataItem.get_new(DataType.CATEGORY,0),
1585
- Field_Logic.get_test(title,option));
1549
+ let category = DataItem.get_new(DataType.CATEGORY,0,Field_Logic.get_test(title,option));
1586
1550
  if(option.get_item){
1587
1551
  category.items = Sub_Item_Logic.get_test_list(category,category,option);
1588
1552
  }
@@ -1938,32 +1902,57 @@ class User_Logic {
1938
1902
  }
1939
1903
  return country_state_city;
1940
1904
  }
1941
- static get_user(req){
1905
+ static get_guest(){
1906
+ return DataItem.get_new(DataType.USER,Number.get_id(999),{is_guest:true,title:"Guest",country:"United States"});
1907
+ }
1908
+ static get_request_user(req){
1942
1909
  if(!req || !req.session.user){
1943
1910
  let user=DataItem.get_new(DataType.USER,Number.get_id(9999999),{is_guest:true});
1944
1911
  req.session.user=user;
1945
1912
  }
1946
1913
  return req.session.user;
1947
1914
  }
1948
- static set_user(req){
1915
+ static set_request_user(req){
1949
1916
  req.session.user=user;
1950
1917
  }
1951
- static del_user(req){
1918
+ static del_request_user(req){
1952
1919
  req.session.user=null;
1953
1920
  delete req.session.user;
1954
1921
  }
1922
+ static get_not_found = (user_id) =>{
1923
+ if(!user_id){
1924
+ user_id=0;
1925
+ }
1926
+ let user = User_Logic.get_test("",{get_blank:true})
1927
+ user.id = 0;
1928
+ user.id_key = user_id;
1929
+ user.title = "User Not Found";
1930
+ user.first_name = "User Not Found";
1931
+ user.title_url = Str.get_title_url(user.title);
1932
+ return user;
1933
+ };
1955
1934
  static get_test = (title,option) =>{
1956
1935
  [title,option] = Field_Logic.get_option_title(title,option);
1957
1936
  option = Field_Logic.get_option(DataType.USER,option?option:{});
1958
1937
  let user = DataItem.get_new(DataType.USER,0,
1959
1938
  Field_Logic.get_test(title,option));
1960
- user.first_name="First Name "+ Number.get_id();
1961
- user.last_name="First Name "+ Number.get_id();
1962
- user.email="email"+ Number.get_id() + "@email.com";
1963
- user.city="City"+ Number.get_id();
1964
- user.state="State"+ Number.get_id();
1965
- user.password="1234567";
1966
- user.country="United States";
1939
+ if(option.get_blank){
1940
+ user.first_name="";
1941
+ user.last_name="";
1942
+ user.email="";
1943
+ user.city="";
1944
+ user.state="";
1945
+ user.password="";
1946
+ user.country="";
1947
+ }else{
1948
+ user.first_name="First Name "+ Number.get_id();
1949
+ user.last_name="First Name "+ Number.get_id();
1950
+ user.email="email"+ Number.get_id() + "@email.com";
1951
+ user.city="City"+ Number.get_id();
1952
+ user.state="State"+ Number.get_id();
1953
+ user.password="1234567";
1954
+ user.country="United States";
1955
+ }
1967
1956
  return user;
1968
1957
  };
1969
1958
  static get_test_list = (option) =>{
@@ -1988,7 +1977,7 @@ class Sub_Item_Logic {
1988
1977
  title:item_title,
1989
1978
  title_url:Str.get_title_url(item_title),
1990
1979
  sub_note:"Sub Note "+String(Number.get_id()),
1991
- note:Item_Logic.get_note()
1980
+ note:Field_Logic.get_test_note()
1992
1981
  }
1993
1982
  );
1994
1983
  if(option.get_value){
@@ -2066,7 +2055,6 @@ module.exports = {
2066
2055
  Review_Logic,
2067
2056
  Review_Url,
2068
2057
  Order_Url,
2069
- Order_Logic,
2070
2058
  Service_Logic,
2071
2059
  Service_Url,
2072
2060
  Social,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.144",
3
+ "version": "4.8.147",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -103,6 +103,7 @@ describe("connect", () => {
103
103
  //let user_list = User_Logic.get_test_list();
104
104
  //Log.w('user',user);
105
105
  //Log.w('user_list',user_list);
106
+ //Log.w('guest',User_Logic.get_guest());
106
107
  /* --USER--END */
107
108
 
108
109
  /* --SEARCH--START */
@@ -152,6 +153,8 @@ describe("connect", () => {
152
153
 
153
154
 
154
155
  /* --CONTENT--START */
156
+ let item_list = Content_Logic.get_test_list({content_count:6,get_item:false,get_value:false,get_blank:true});
157
+ Log.w('content_list',item_list);
155
158
  //let content = Content_Logic.get_test("cool 1");
156
159
  //let content = Content_Logic.get_test("Content 1",{get_value:true,get_item:true})
157
160
  //Log.w("content",content);
@@ -360,12 +363,14 @@ describe("connect", () => {
360
363
 
361
364
 
362
365
  /* --REVIEW--START */
366
+ /*
363
367
  let parent_data_type = DataType.PRODUCT;
364
368
  let parent_id = Number.get_id();
365
369
  let user = User_Logic.get_test({generate_id:false});
366
370
  let product_review = Review_Logic.get_test(parent_data_type,parent_id,user.id);
367
371
  let review = Review_Logic.get_new(parent_data_type,parent_id,user,product_review);
368
372
  Log.w('review',review);
373
+ */
369
374
  //Log.w("Review",Review_Logic.get_new(parent_data_type,parent_id,user_id));
370
375
  //Log.w("Review",Review_Logic.get_test({generate_id:true}));
371
376
  //Log.w("Review List",Review_Logic.get_test_list({generate_id:true,review_count:3}));