biz9-logic 4.8.156 → 4.8.159
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.
- package/biz9_config +1 -1
- package/index.js +82 -75
- package/main.js +1 -1
- package/main_test.js +33 -33
- package/package.json +1 -1
- package/test.js +19 -19
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ License GNU General Public License v3.0
|
|
|
5
5
|
Description: BiZ9 Framework: Logic-JS
|
|
6
6
|
*/
|
|
7
7
|
const moment = require('moment'); const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_new_full_item_main } = require('./main');
|
|
8
|
-
const { Log,Str,DateTime,
|
|
8
|
+
const { Log,Str,DateTime,Num,Obj } = require('/home/think2/www/doqbox/biz9-framework/biz9-utility/code');
|
|
9
9
|
class Message {
|
|
10
10
|
static SUCCESS="Update Success";
|
|
11
11
|
static LOGIN_GOOD="Login Success";
|
|
@@ -130,7 +130,7 @@ class Template_Logic {
|
|
|
130
130
|
static get_test = (title,option) =>{
|
|
131
131
|
if(!Str.check_is_null(title) && Obj.check_is_empty(option)){
|
|
132
132
|
option = title;
|
|
133
|
-
title = "Test " +
|
|
133
|
+
title = "Test " + Num.get_id();
|
|
134
134
|
}
|
|
135
135
|
option = Field_Logic.get_option(DataType.TEMPLATE,option?option:{});
|
|
136
136
|
let template = DataItem.get_new_full_item(
|
|
@@ -181,11 +181,11 @@ class Team_Logic {
|
|
|
181
181
|
DataItem.get_new(DataType.TEAM,team.id),
|
|
182
182
|
DataItem.get_new(DataType.TEAM,team.id),
|
|
183
183
|
Field_Logic.get_test(title,option));
|
|
184
|
-
team_member.first_name = "First Name "+
|
|
185
|
-
team_member.last_name = "Last Name "+
|
|
186
|
-
team_member.position = "Position "+
|
|
187
|
-
team_member.city = "City "+
|
|
188
|
-
team_member.state = "State "+
|
|
184
|
+
team_member.first_name = "First Name "+ Num.get_id();
|
|
185
|
+
team_member.last_name = "Last Name "+ Num.get_id();
|
|
186
|
+
team_member.position = "Position "+ Num.get_id();
|
|
187
|
+
team_member.city = "City "+ Num.get_id();
|
|
188
|
+
team_member.state = "State "+ Num.get_id();
|
|
189
189
|
return team_member;
|
|
190
190
|
};
|
|
191
191
|
static get_test_member_list = (team,option) =>{
|
|
@@ -231,12 +231,15 @@ class Page_Logic {
|
|
|
231
231
|
}
|
|
232
232
|
class Order_Logic {
|
|
233
233
|
static get_order_number = () => {
|
|
234
|
-
return FieldType.ORDER_NUMBER +
|
|
234
|
+
return FieldType.ORDER_NUMBER + Num.get_id(99999);
|
|
235
235
|
};
|
|
236
|
+
static get_transaction_id = () => {
|
|
237
|
+
return FieldType.TRANSACTION_ID + Num.get_id(99999);
|
|
238
|
+
};
|
|
236
239
|
}
|
|
237
240
|
class Cart_Logic {
|
|
238
241
|
static get_cart_number = () => {
|
|
239
|
-
return FieldType.CART_NUMBER +
|
|
242
|
+
return FieldType.CART_NUMBER + Num.get_id(99999);
|
|
240
243
|
};
|
|
241
244
|
static get_cart = (user_id) => {
|
|
242
245
|
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:[]});
|
|
@@ -246,7 +249,7 @@ class Cart_Logic {
|
|
|
246
249
|
};
|
|
247
250
|
static get_test_item = (cart_item_id,cart_number,user_id,parent_data_type,parent_id,option) =>{
|
|
248
251
|
option = Field_Logic.get_option(DataType.CART_ITEM,option?option:{generate_id:Str.check_is_null(cart_item_id)? true : false });
|
|
249
|
-
let cart_item = DataItem.get_new(DataType.CART_ITEM,
|
|
252
|
+
let cart_item = DataItem.get_new(DataType.CART_ITEM,Num.get_guid(),Field_Logic.get_test("Cart Item "+Num.get_id(),option));
|
|
250
253
|
cart_item.cart_item_id = cart_item_id;
|
|
251
254
|
cart_item.cart_number = cart_number;
|
|
252
255
|
cart_item.user_id = user_id;
|
|
@@ -263,8 +266,8 @@ class Cart_Logic {
|
|
|
263
266
|
};
|
|
264
267
|
static get_test_sub_item = (cart_number,user_id,cart_item_id,parent_data_type,parent_id,option) =>{
|
|
265
268
|
option = Field_Logic.get_option(DataType.CART_SUB_ITEM,option?option:{});
|
|
266
|
-
let item_blank = Item_Logic.get_test('Sub Item '+
|
|
267
|
-
let cart_sub_item = DataItem.get_new(DataType.CART_SUB_ITEM,
|
|
269
|
+
let item_blank = Item_Logic.get_test('Sub Item '+Num.get_id(),DataType.ITEM,0,{generate_id:true});
|
|
270
|
+
let cart_sub_item = DataItem.get_new(DataType.CART_SUB_ITEM,Num.get_guid(),Field_Logic.get_test("Cart Sub Item "+Num.get_id(),option));
|
|
268
271
|
cart_sub_item.cart_number = cart_number;
|
|
269
272
|
cart_sub_item.user_id = user_id;
|
|
270
273
|
cart_sub_item.cart_item_id = cart_item_id;
|
|
@@ -291,7 +294,7 @@ static get_test_list = (option) =>{
|
|
|
291
294
|
for(let b=0;b<option.product_count;b++){
|
|
292
295
|
item_count++;
|
|
293
296
|
let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
|
|
294
|
-
product.category = category_list[
|
|
297
|
+
product.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
295
298
|
product_list.push(product);
|
|
296
299
|
}
|
|
297
300
|
}
|
|
@@ -308,10 +311,10 @@ class Product_Logic {
|
|
|
308
311
|
product.old_cost = Field_Logic.get_test_cost();
|
|
309
312
|
product.cart_count = 0;
|
|
310
313
|
product.order_count = 0;
|
|
311
|
-
product.type = "Type "+String(
|
|
312
|
-
product.sub_type = "Sub Type "+String(
|
|
313
|
-
product.stock = String(
|
|
314
|
-
product.tag = "Tag "+
|
|
314
|
+
product.type = "Type "+String(Num.get_id());
|
|
315
|
+
product.sub_type = "Sub Type "+String(Num.get_id());
|
|
316
|
+
product.stock = String(Num.get_id(3-1));
|
|
317
|
+
product.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
315
318
|
}else{
|
|
316
319
|
product.cost = "";
|
|
317
320
|
product.old_cost = "";
|
|
@@ -328,7 +331,7 @@ class Product_Logic {
|
|
|
328
331
|
static get_test_cart = (cart_number,user_id,option) =>{
|
|
329
332
|
[cart_number,option] = Field_Logic.get_option_title(cart_number,option);
|
|
330
333
|
option = Field_Logic.get_option(DataType.CART,option?option:{});
|
|
331
|
-
let cart = DataItem.get_new(DataType.CART,
|
|
334
|
+
let cart = DataItem.get_new(DataType.CART,Num.get_guid(),Field_Logic.get_test(cart_number,option));
|
|
332
335
|
cart.user_id = user_id;
|
|
333
336
|
cart.cart_number = cart_number;
|
|
334
337
|
if(option.get_cart_item){
|
|
@@ -360,7 +363,7 @@ static get_test_list = (option) =>{
|
|
|
360
363
|
for(let b=0;b<option.product_count;b++){
|
|
361
364
|
item_count++;
|
|
362
365
|
let product = Product_Logic.get_test("Product "+String(parseInt(b+1)),option);
|
|
363
|
-
product.category = category_list[
|
|
366
|
+
product.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
364
367
|
product_list.push(product);
|
|
365
368
|
}
|
|
366
369
|
}
|
|
@@ -374,10 +377,10 @@ class Service_Logic {
|
|
|
374
377
|
let service = DataItem.get_new(DataType.SERVICE,0,Field_Logic.get_test(title,option));
|
|
375
378
|
service.cost = Field_Logic.get_test_cost();
|
|
376
379
|
service.old_cost = Field_Logic.get_test_cost();
|
|
377
|
-
service.type = "Type "+String(
|
|
378
|
-
service.sub_type = "Sub Type "+String(
|
|
379
|
-
service.stock = String(
|
|
380
|
-
service.tag = "Tag "+
|
|
380
|
+
service.type = "Type "+String(Num.get_id());
|
|
381
|
+
service.sub_type = "Sub Type "+String(Num.get_id());
|
|
382
|
+
service.stock = String(Num.get_id(3-1));
|
|
383
|
+
service.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
381
384
|
if(option.get_item){
|
|
382
385
|
service.items = Sub_Item_Logic.get_test_list(service,service,option);
|
|
383
386
|
}
|
|
@@ -400,7 +403,7 @@ class Service_Logic {
|
|
|
400
403
|
for(let b=0;b<option.service_count;b++){
|
|
401
404
|
item_count++;
|
|
402
405
|
let service = Service_Logic.get_test("Service "+String(parseInt(b+1)),option);
|
|
403
|
-
service.category = category_list[
|
|
406
|
+
service.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
404
407
|
service_list.push(service);
|
|
405
408
|
}
|
|
406
409
|
}
|
|
@@ -441,7 +444,7 @@ class Content_Logic {
|
|
|
441
444
|
for(let b=0;b<option.content_count;b++){
|
|
442
445
|
item_count++;
|
|
443
446
|
let content = Content_Logic.get_test("Content "+String(parseInt(b+1)),option);
|
|
444
|
-
content.category = category_list[
|
|
447
|
+
content.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
445
448
|
content_list.push(content);
|
|
446
449
|
}
|
|
447
450
|
}
|
|
@@ -455,8 +458,8 @@ class Blog_Post_Logic {
|
|
|
455
458
|
let blog_post = DataItem.get_new(DataType.BLOG_POST,0,Field_Logic.get_test(title,option));
|
|
456
459
|
|
|
457
460
|
if(!option.get_blank){
|
|
458
|
-
blog_post.author="First Name "+
|
|
459
|
-
blog_post.tag = "Tag "+
|
|
461
|
+
blog_post.author="First Name "+ Num.get_id();
|
|
462
|
+
blog_post.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
460
463
|
}else{
|
|
461
464
|
blog_post.author="";
|
|
462
465
|
blog_post.tag = "";
|
|
@@ -483,7 +486,7 @@ class Blog_Post_Logic {
|
|
|
483
486
|
for(let b=0;b<option.blog_post_count;b++){
|
|
484
487
|
item_count++;
|
|
485
488
|
let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
|
|
486
|
-
blog_post.category = category_list[
|
|
489
|
+
blog_post.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
487
490
|
blog_post_list.push(blog_post);
|
|
488
491
|
}
|
|
489
492
|
}
|
|
@@ -498,14 +501,14 @@ class Event_Logic {
|
|
|
498
501
|
if(!option.get_blank){
|
|
499
502
|
event.cost = Field_Logic.get_test_cost();
|
|
500
503
|
event.old_cost = Field_Logic.get_test_cost();
|
|
501
|
-
event.date = String(String(
|
|
502
|
-
event.time = String(
|
|
503
|
-
event.website = "Website "+String(
|
|
504
|
-
event.location = "Location "+String(
|
|
505
|
-
event.meeting_link = "Meeting Link "+String(
|
|
506
|
-
event.stock = String(
|
|
507
|
-
event.category ="Category " + String(
|
|
508
|
-
event.tag = "Tag "+
|
|
504
|
+
event.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
|
|
505
|
+
event.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
|
|
506
|
+
event.website = "Website "+String(Num.get_id());
|
|
507
|
+
event.location = "Location "+String(Num.get_id());
|
|
508
|
+
event.meeting_link = "Meeting Link "+String(Num.get_id());
|
|
509
|
+
event.stock = String(Num.get_id(3-1));
|
|
510
|
+
event.category ="Category " + String(Num.get_id());
|
|
511
|
+
event.tag = "Tag "+ Num.get_id() + ", Tag "+Num.get_id() + ", Tag "+ Num.get_id();
|
|
509
512
|
}else{
|
|
510
513
|
event.cost = "";
|
|
511
514
|
event.old_cost = "";
|
|
@@ -540,7 +543,7 @@ class Event_Logic {
|
|
|
540
543
|
for(let b=0;b<option.event_count;b++){
|
|
541
544
|
item_count++;
|
|
542
545
|
let event = Event_Logic.get_test("Event "+String(parseInt(b+1)),option);
|
|
543
|
-
event.category = category_list[
|
|
546
|
+
event.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
544
547
|
event_list.push(event);
|
|
545
548
|
}
|
|
546
549
|
}
|
|
@@ -549,10 +552,10 @@ class Event_Logic {
|
|
|
549
552
|
}
|
|
550
553
|
class Field_Logic {
|
|
551
554
|
static get_test_cost(){
|
|
552
|
-
return String(
|
|
555
|
+
return String(Num.get_id(999)) + "." + String(Num.get_id(99));
|
|
553
556
|
}
|
|
554
557
|
static get_test_note = () => {
|
|
555
|
-
return "Note "+String(
|
|
558
|
+
return "Note "+String(Num.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.";
|
|
556
559
|
}
|
|
557
560
|
static get_test = (title,option) =>{
|
|
558
561
|
option = !Obj.check_is_empty(option) ? option : {};
|
|
@@ -572,7 +575,7 @@ class Field_Logic {
|
|
|
572
575
|
title:title,
|
|
573
576
|
setting_visible:"1",
|
|
574
577
|
title_url:Str.get_title_url(title),
|
|
575
|
-
sub_note:"Sub Note "+String(
|
|
578
|
+
sub_note:"Sub Note "+String(Num.get_id()),
|
|
576
579
|
note:Field_Logic.get_test_note(),
|
|
577
580
|
view_count:0,
|
|
578
581
|
id:0,
|
|
@@ -581,10 +584,10 @@ class Field_Logic {
|
|
|
581
584
|
}
|
|
582
585
|
}
|
|
583
586
|
if(!Str.check_is_null(option.category_title)){
|
|
584
|
-
item.category = 'Category ' +
|
|
587
|
+
item.category = 'Category ' + Num.get_id();
|
|
585
588
|
}
|
|
586
589
|
if(option.generate_id){
|
|
587
|
-
item.id=
|
|
590
|
+
item.id=Num.get_guid();
|
|
588
591
|
}
|
|
589
592
|
if(option.get_value){
|
|
590
593
|
item = Field_Logic.get_value_list(item,option);
|
|
@@ -598,7 +601,7 @@ class Field_Logic {
|
|
|
598
601
|
}
|
|
599
602
|
}else{
|
|
600
603
|
if(!Str.check_is_null(field_list[a])){
|
|
601
|
-
item[Str.get_title_url(field_list[a])] = Str.get_title(field_list[a]) +"_" +
|
|
604
|
+
item[Str.get_title_url(field_list[a])] = Str.get_title(field_list[a]) +"_" + Num.get_id();
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
}
|
|
@@ -712,13 +715,13 @@ class Field_Logic {
|
|
|
712
715
|
option = {};
|
|
713
716
|
}else{
|
|
714
717
|
option = title;
|
|
715
|
-
title = "Test " +
|
|
718
|
+
title = "Test " + Num.get_id();
|
|
716
719
|
}
|
|
717
720
|
}
|
|
718
721
|
}
|
|
719
722
|
}else{
|
|
720
723
|
if(Str.check_is_null(title) && Obj.check_is_empty(option)){
|
|
721
|
-
title = "Test " +
|
|
724
|
+
title = "Test " + Num.get_id();
|
|
722
725
|
option = {};
|
|
723
726
|
}
|
|
724
727
|
}
|
|
@@ -809,21 +812,24 @@ class FieldType {
|
|
|
809
812
|
|
|
810
813
|
static ORDER_NUMBER="OR-";
|
|
811
814
|
static CART_NUMBER="CA-";
|
|
815
|
+
static TRANSACTION_ID="TR-";
|
|
812
816
|
|
|
813
|
-
static PAYMENT_PLAN_PENDING="Pending";
|
|
814
817
|
static PAYMENT_PLAN_1="1 Payment";
|
|
815
818
|
static PAYMENT_PLAN_2="2 Payments";
|
|
816
819
|
static PAYMENT_PLAN_3="3 Payments";
|
|
817
820
|
static PAYMENT_PLAN_4="4 Payments";
|
|
818
821
|
|
|
819
|
-
static
|
|
822
|
+
static ORDER_STATUS_NEW="New";
|
|
820
823
|
static ORDER_STATUS_OPEN="Open";
|
|
821
824
|
static ORDER_STATUS_PAYMENT="Payment Plan";
|
|
822
825
|
static ORDER_STATUS_COMPLETE="Complete";
|
|
823
826
|
|
|
827
|
+
static PAYMENT_PLAN="Open";
|
|
824
828
|
|
|
825
|
-
static
|
|
826
|
-
|
|
829
|
+
static ORDER_PAYMENT_TYPE_STRIPE="Stripe";
|
|
830
|
+
static ORDER_PAYMENT_TYPE_CASH="Cash";
|
|
831
|
+
static ORDER_PAYMENT_TYPE_OTHER="Other";
|
|
832
|
+
static ORDER_PAYMENT_TYPE_TEST="Test";
|
|
827
833
|
}
|
|
828
834
|
class Social {
|
|
829
835
|
static FACEBOOK_URL="https://facebook.com/";
|
|
@@ -966,6 +972,7 @@ class DataType {
|
|
|
966
972
|
static ORDER="order_biz";
|
|
967
973
|
static ORDER_ITEM="order_item_biz";
|
|
968
974
|
static ORDER_SUB_ITEM="order_sub_item_biz";
|
|
975
|
+
static ORDER_PAYMENT="order_payment_biz";
|
|
969
976
|
|
|
970
977
|
static PROJECT='project_biz';
|
|
971
978
|
static PRODUCT='product_biz';
|
|
@@ -1011,7 +1018,7 @@ class Blank_Logic {
|
|
|
1011
1018
|
for(let b=0;b<option.blank_count;b++){
|
|
1012
1019
|
item_count++;
|
|
1013
1020
|
let blank = Blank_Logic.get_test("Blank "+String(parseInt(b+1)),option);
|
|
1014
|
-
blank.category = category_list[
|
|
1021
|
+
blank.category = category_list[Num.get_id(category_list.length+1)].title;
|
|
1015
1022
|
blank_list.push(blank);
|
|
1016
1023
|
}
|
|
1017
1024
|
}
|
|
@@ -1027,7 +1034,7 @@ class Faq_Logic {
|
|
|
1027
1034
|
for(let a=0;a<option.question_count+1;a++){
|
|
1028
1035
|
if(!option.get_blank){
|
|
1029
1036
|
let question_title = "FAQ Question " + String(parseInt(a+1));
|
|
1030
|
-
let answer = "My answer "+
|
|
1037
|
+
let answer = "My answer "+ Num.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.";
|
|
1031
1038
|
faq[Str.get_title_url(question_title).toLowerCase()] = answer;
|
|
1032
1039
|
faq['field_'+parseInt(a+1)] =question_title;
|
|
1033
1040
|
}else{
|
|
@@ -1052,7 +1059,7 @@ class Faq_Logic {
|
|
|
1052
1059
|
for(let a=0;a<19;a++){
|
|
1053
1060
|
let row = a + 1;
|
|
1054
1061
|
if(!Str.check_is_null(faq['field_'+a])) {
|
|
1055
|
-
item_list.push({ id:
|
|
1062
|
+
item_list.push({ id: Num.get_id(333), question:faq['field_'+a], answer: String(faq[Str.get_title_url(faq['field_'+a]).toLowerCase() ]) });
|
|
1056
1063
|
}
|
|
1057
1064
|
}
|
|
1058
1065
|
return item_list;
|
|
@@ -1107,10 +1114,10 @@ class Review_Logic {
|
|
|
1107
1114
|
option = Field_Logic.get_option(DataType.REVIEW,option?option:{});
|
|
1108
1115
|
let review = DataItem.get_new(DataType.REVIEW,0);
|
|
1109
1116
|
if(!option.get_blank){
|
|
1110
|
-
review.title = 'Title ' +
|
|
1117
|
+
review.title = 'Title ' + Num.get_id();
|
|
1111
1118
|
review.parent_data_type = parent_data_type;
|
|
1112
1119
|
review.parent_id = parent_id;
|
|
1113
|
-
review.rating =
|
|
1120
|
+
review.rating = Num.get_id(6);
|
|
1114
1121
|
review.user_id = user_id;
|
|
1115
1122
|
review.comment = "My comment "+ Field_Logic.get_test_note();
|
|
1116
1123
|
}else{
|
|
@@ -1149,7 +1156,7 @@ class Admin_Logic {
|
|
|
1149
1156
|
let item = DataItem.get_new(DataType.ADMIN,0);
|
|
1150
1157
|
let admin = DataItem.get_new(DataType.ADMIN,0,Field_Logic.get_test(title,option));
|
|
1151
1158
|
if(!option.get_blank){
|
|
1152
|
-
admin.email="ceo@admin"+
|
|
1159
|
+
admin.email="ceo@admin"+Num.get_id()+".com";
|
|
1153
1160
|
admin.password="1234567";
|
|
1154
1161
|
}else{
|
|
1155
1162
|
admin.email="";
|
|
@@ -1196,18 +1203,18 @@ class Business_Logic {
|
|
|
1196
1203
|
let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
|
|
1197
1204
|
let business = DataItem.get_new(DataType.BUSINESS,0,Field_Logic.get_test(title,option));
|
|
1198
1205
|
if(!option.get_blank){
|
|
1199
|
-
business.email="ceo@business"+
|
|
1200
|
-
business.phone=
|
|
1201
|
-
business.address_1=
|
|
1202
|
-
business.address_2="PO "+
|
|
1203
|
-
business.city=city_list[
|
|
1204
|
-
business.state=state_list[
|
|
1205
|
-
business.zip=
|
|
1206
|
-
business.website="website_" +
|
|
1207
|
-
business.youtube="youtube_"+
|
|
1208
|
-
business.instagram="instagram_"+
|
|
1209
|
-
business.facebook="facebook_"+
|
|
1210
|
-
business.twitter="twitter_"+
|
|
1206
|
+
business.email="ceo@business"+Num.get_id()+".com";
|
|
1207
|
+
business.phone=Num.get_id(parseInt(777+100)) + "-" + Num.get_id(parseInt(777+100)) + "-"+Num.get_id(parseInt(7777+1000));
|
|
1208
|
+
business.address_1=Num.get_id(99)+" Main St.";
|
|
1209
|
+
business.address_2="PO "+Num.get_id(99);
|
|
1210
|
+
business.city=city_list[Num.get_id(city_list.length-1)];
|
|
1211
|
+
business.state=state_list[Num.get_id(state_list.length-1)];
|
|
1212
|
+
business.zip=Num.get_id(parseInt(77777+1000));
|
|
1213
|
+
business.website="website_" + Num.get_id(9999);
|
|
1214
|
+
business.youtube="youtube_"+Num.get_id(9999);
|
|
1215
|
+
business.instagram="instagram_"+Num.get_id(9999);
|
|
1216
|
+
business.facebook="facebook_"+Num.get_id(9999);
|
|
1217
|
+
business.twitter="twitter_"+Num.get_id(9999);
|
|
1211
1218
|
}else{
|
|
1212
1219
|
business.email="";
|
|
1213
1220
|
business.phone="";
|
|
@@ -1891,11 +1898,11 @@ class User_Logic {
|
|
|
1891
1898
|
return country_state_city;
|
|
1892
1899
|
}
|
|
1893
1900
|
static get_guest(){
|
|
1894
|
-
return DataItem.get_new(DataType.USER,
|
|
1901
|
+
return DataItem.get_new(DataType.USER,Num.get_id(999),{is_guest:true,title:"Guest",country:"United States"});
|
|
1895
1902
|
}
|
|
1896
1903
|
static get_request_user(req){
|
|
1897
1904
|
if(!req || !req.session.user){
|
|
1898
|
-
let user=DataItem.get_new(DataType.USER,
|
|
1905
|
+
let user=DataItem.get_new(DataType.USER,Num.get_id(9999999),{is_guest:true});
|
|
1899
1906
|
req.session.user=user;
|
|
1900
1907
|
}
|
|
1901
1908
|
return req.session.user;
|
|
@@ -1936,11 +1943,11 @@ class User_Logic {
|
|
|
1936
1943
|
user.password="";
|
|
1937
1944
|
user.country="";
|
|
1938
1945
|
}else{
|
|
1939
|
-
user.first_name="First Name "+
|
|
1940
|
-
user.last_name="First Name "+
|
|
1941
|
-
user.email="email"+
|
|
1942
|
-
user.city="City"+
|
|
1943
|
-
user.state="State"+
|
|
1946
|
+
user.first_name="First Name "+ Num.get_id();
|
|
1947
|
+
user.last_name="First Name "+ Num.get_id();
|
|
1948
|
+
user.email="email"+ Num.get_id() + "@email.com";
|
|
1949
|
+
user.city="City"+ Num.get_id();
|
|
1950
|
+
user.state="State"+ Num.get_id();
|
|
1944
1951
|
user.password="1234567";
|
|
1945
1952
|
user.country="United States";
|
|
1946
1953
|
}
|
|
@@ -1967,7 +1974,7 @@ class Sub_Item_Logic {
|
|
|
1967
1974
|
parent_data_type:parent_item.data_type,
|
|
1968
1975
|
title:item_title,
|
|
1969
1976
|
title_url:Str.get_title_url(item_title),
|
|
1970
|
-
sub_note:"Sub Note "+String(
|
|
1977
|
+
sub_note:"Sub Note "+String(Num.get_id()),
|
|
1971
1978
|
note:Field_Logic.get_test_note()
|
|
1972
1979
|
}
|
|
1973
1980
|
);
|
package/main.js
CHANGED
|
@@ -4,7 +4,7 @@ Author: certifiedcoderz@gmail.com (Certified CoderZ)
|
|
|
4
4
|
License GNU General Public License v3.0
|
|
5
5
|
Description: BiZ9 Framework: Logic - Main
|
|
6
6
|
*/
|
|
7
|
-
const { DateTime,
|
|
7
|
+
const { DateTime,Num } = require('biz9-utility');
|
|
8
8
|
const biz9_config_local=__dirname+"/../../"+"biz9_config";
|
|
9
9
|
const get_cloud_param_obj_main = (data_type,filter,sort_by,page_current,page_size) => {
|
|
10
10
|
return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
|
package/main_test.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
const { DataItem,DataType } = require('biz9-logic');
|
|
2
2
|
const get_template_test = () =>{
|
|
3
3
|
let template = DataItem.get_new_full_item(
|
|
4
|
-
DataItem.get_new(DataType.TEMPLATE,
|
|
4
|
+
DataItem.get_new(DataType.TEMPLATE,Num.get_id()),
|
|
5
5
|
DataItem.get_new(DataType.TEMPLATE,0),
|
|
6
6
|
DataItem.get_new(DataType.TEMPLATE,0),
|
|
7
7
|
Field.get_test("Primary"));
|
|
8
8
|
let template_sub_title_list = ["Header","Navigation","Body","Footer"];
|
|
9
9
|
for(let a=0;a<template_sub_title_list.length;a++){
|
|
10
|
-
template = Sub_Item.get_test_bind_new_child(
|
|
10
|
+
template = Sub_Item.get_test_bind_new_child(Num.get_id(),template_sub_title_list[a],template,template,template);
|
|
11
11
|
}
|
|
12
12
|
template = Sub_Item.get_test_bind_item_sub_item(template);
|
|
13
13
|
return template;
|
|
14
14
|
};
|
|
15
15
|
const get_page_test = (title) =>{
|
|
16
16
|
let page = DataItem.get_new_full_item(
|
|
17
|
-
DataItem.get_new(DataType.PAGE,
|
|
17
|
+
DataItem.get_new(DataType.PAGE,Num.get_id()),
|
|
18
18
|
DataItem.get_new(DataType.PAGE,0),
|
|
19
19
|
DataItem.get_new(DataType.PAGE,0),
|
|
20
20
|
Field.get_test(title));
|
|
21
21
|
for(let a=0;a<20;a++){
|
|
22
|
-
page=Sub_Item.get_test_bind_new_child(
|
|
22
|
+
page=Sub_Item.get_test_bind_new_child(Num.get_id(),"Section "+a,page,page,page);
|
|
23
23
|
}
|
|
24
24
|
page = Sub_Item.get_test_bind_item_sub_item(page);
|
|
25
25
|
return page;
|
|
26
26
|
}
|
|
27
27
|
const get_product_test = (title) =>{
|
|
28
28
|
let product = DataItem.get_new_full_item(
|
|
29
|
-
DataItem.get_new(DataType.PRODUCT,
|
|
29
|
+
DataItem.get_new(DataType.PRODUCT,Num.get_id()),
|
|
30
30
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
31
31
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
32
32
|
Field.get_test(title));
|
|
33
|
-
product = Sub_Item.get_test_bind_new_child(
|
|
34
|
-
product.cost = String(
|
|
35
|
-
product.old_cost = String(
|
|
36
|
-
product.type = "Type "+String(
|
|
37
|
-
product.sub_type = "Sub Type "+String(
|
|
38
|
-
product.stock = String(
|
|
33
|
+
product = Sub_Item.get_test_bind_new_child(Num.get_id(),title,product,product,product);
|
|
34
|
+
product.cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
35
|
+
product.old_cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
36
|
+
product.type = "Type "+String(Num.get_id());
|
|
37
|
+
product.sub_type = "Sub Type "+String(Num.get_id());
|
|
38
|
+
product.stock = String(Num.get_id(3-1));
|
|
39
39
|
for(let a=0;a<10;a++){
|
|
40
|
-
product=Sub_Item.get_test_bind_new_child(
|
|
40
|
+
product=Sub_Item.get_test_bind_new_child(Num.get_id(),"Section " + String(a),product,product,product);
|
|
41
41
|
}
|
|
42
42
|
product = Sub_Item.get_test_bind_item_sub_item(product);
|
|
43
43
|
return product;
|
|
44
44
|
};
|
|
45
45
|
const get_service_test = (title) =>{
|
|
46
46
|
let service = DataItem.get_new_full_item(
|
|
47
|
-
DataItem.get_new(DataType.SERVICE,
|
|
47
|
+
DataItem.get_new(DataType.SERVICE,Num.get_id()),
|
|
48
48
|
DataItem.get_new(DataType.SERVICE,0),
|
|
49
49
|
DataItem.get_new(DataType.SERVICE,0),
|
|
50
50
|
Field.get_test(title));
|
|
51
|
-
service = Sub_Item.get_test_bind_new_child(
|
|
52
|
-
service.cost = String(
|
|
53
|
-
service.old_cost = String(
|
|
54
|
-
service.type = "Type "+String(
|
|
55
|
-
service.sub_type = "Sub Type "+String(
|
|
56
|
-
service.stock = String(
|
|
51
|
+
service = Sub_Item.get_test_bind_new_child(Num.get_id(),title,service,service,service);
|
|
52
|
+
service.cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
53
|
+
service.old_cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
54
|
+
service.type = "Type "+String(Num.get_id());
|
|
55
|
+
service.sub_type = "Sub Type "+String(Num.get_id());
|
|
56
|
+
service.stock = String(Num.get_id(3-1));
|
|
57
57
|
for(let a=0;a<10;a++){
|
|
58
|
-
service=Sub_Item.get_test_bind_new_child(
|
|
58
|
+
service=Sub_Item.get_test_bind_new_child(Num.get_id(),"Section " + String(a),service,service,service);
|
|
59
59
|
}
|
|
60
60
|
service = Sub_Item.get_test_bind_item_sub_item(service);
|
|
61
61
|
return service;
|
|
62
62
|
};
|
|
63
63
|
const get_event_test = (title) =>{
|
|
64
64
|
let event = DataItem.get_new_full_item(
|
|
65
|
-
DataItem.get_new(DataType.EVENT,
|
|
65
|
+
DataItem.get_new(DataType.EVENT,Num.get_id()),
|
|
66
66
|
DataItem.get_new(DataType.EVENT,0),
|
|
67
67
|
DataItem.get_new(DataType.EVENT,0),
|
|
68
68
|
Field.get_test(title));
|
|
69
|
-
event = Sub_Item.get_test_bind_new_child(
|
|
70
|
-
event.cost = String(
|
|
71
|
-
event.old_cost = String(
|
|
72
|
-
event.date = String(String(
|
|
73
|
-
event.time = String(
|
|
74
|
-
event.website = "Website "+String(
|
|
75
|
-
event.location = "Location "+String(
|
|
76
|
-
event.meeting_link = "Meeting Link "+String(
|
|
77
|
-
event.stock = String(
|
|
69
|
+
event = Sub_Item.get_test_bind_new_child(Num.get_id(),title,event,event,event);
|
|
70
|
+
event.cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
71
|
+
event.old_cost = String(Num.get_id()) + "." + String(Num.get_id());
|
|
72
|
+
event.date = String(String(Num.get_id(2030)) + "-" + String(Num.get_id(13)) + "-" + String(Num.get_id(30))).trim();
|
|
73
|
+
event.time = String(Num.get_id(24)) + ":" + String(Num.get_id(59));
|
|
74
|
+
event.website = "Website "+String(Num.get_id());
|
|
75
|
+
event.location = "Location "+String(Num.get_id());
|
|
76
|
+
event.meeting_link = "Meeting Link "+String(Num.get_id());
|
|
77
|
+
event.stock = String(Num.get_id(3-1));
|
|
78
78
|
for(let a=0;a<10;a++){
|
|
79
|
-
event=Sub_Item.get_test_bind_new_child(
|
|
79
|
+
event=Sub_Item.get_test_bind_new_child(Num.get_id(),"Section " + String(a),event,event,event);
|
|
80
80
|
}
|
|
81
81
|
event = Sub_Item.get_test_bind_item_sub_item(event);
|
|
82
82
|
return event;
|
|
@@ -90,8 +90,8 @@ const get_field_test = (title) =>{
|
|
|
90
90
|
setting_visible:"1",
|
|
91
91
|
photo_data:"/images/no_img.jpg",
|
|
92
92
|
title_url:Str.get_title_url(title),
|
|
93
|
-
sub_note : "Sub Note "+String(
|
|
94
|
-
note : "Note "+String(
|
|
93
|
+
sub_note : "Sub Note "+String(Num.get_id()),
|
|
94
|
+
note : "Note "+String(Num.get_id())
|
|
95
95
|
}
|
|
96
96
|
for(let b = 1;b<20;b++){
|
|
97
97
|
item['value_'+String(b)] = 'value ' + String(b);
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const series = require('async-series');
|
|
3
3
|
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Sub_Item_Logic,Page_Url,Review_Logic,User_Logic,Field_Logic,Order_Logic,Cart_Logic} = require('./index');
|
|
4
|
-
const {Log,
|
|
4
|
+
const {Log,Num} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
7
7
|
/* --- TEST CONFIG START --- */
|
|
@@ -49,12 +49,12 @@ describe("connect", () => {
|
|
|
49
49
|
function(call) {
|
|
50
50
|
//console.log('STORAGE-START');
|
|
51
51
|
//console.log(Storage.get({},'apples'));
|
|
52
|
-
//Log.w('storage-start',Storage.set(
|
|
52
|
+
//Log.w('storage-start',Storage.set(Num.get_id()));
|
|
53
53
|
//console.log('STORAGE-END');
|
|
54
54
|
/* --PAGE--START */
|
|
55
55
|
//let page = Page_Logic.get_test()
|
|
56
|
-
//let page = Page_Logic.get_test("Page "+
|
|
57
|
-
//let page = Page_Logic.get_test("Page "+
|
|
56
|
+
//let page = Page_Logic.get_test("Page "+Num.get_id())
|
|
57
|
+
//let page = Page_Logic.get_test("Page "+Num.get_id(),{get_value:true,value_count:5,get_section:false,section_count:2,get_photo:true,get_blank:true})
|
|
58
58
|
//Log.w("page",page);
|
|
59
59
|
//Log.w("page_section_1",page.section_1);
|
|
60
60
|
//Log.w("page_section_6",page.section_6.items);
|
|
@@ -222,7 +222,7 @@ describe("connect", () => {
|
|
|
222
222
|
Log.w('product_cart_sub_item_list',product_cart.cart_item_list[0].cart_sub_item_list);
|
|
223
223
|
//cart.cart_number = cart_number;
|
|
224
224
|
//Log.w('cart',cart);
|
|
225
|
-
//let product = Product_Logic.get_test("Product "+
|
|
225
|
+
//let product = Product_Logic.get_test("Product "+Num.get_id(),{get_value:false,get_item:false})
|
|
226
226
|
//cart_item_id,cart_number,user_id,parent_data_type,parent_id
|
|
227
227
|
//let cart_item = Cart_Logic.get_test_cart_item(0,Order_Logic.get_cart_number(),user.id,product.data_type,product.id);
|
|
228
228
|
//Log.w('user',user);
|
|
@@ -240,7 +240,7 @@ describe("connect", () => {
|
|
|
240
240
|
|
|
241
241
|
/*
|
|
242
242
|
console.log('PRODUCT-ORDER-START');
|
|
243
|
-
let order_id = "OR"+
|
|
243
|
+
let order_id = "OR"+Num.get_id();
|
|
244
244
|
let user = User_Logic.get_test({generate_id:true});
|
|
245
245
|
let product_order = Product_Logic.get_test_order(order_id,user.id,{get_order_item:true,order_item_count:1,get_order_sub_item:true,order_sub_item_count:2 });
|
|
246
246
|
Log.w('product_order',product_order);
|
|
@@ -271,7 +271,7 @@ describe("connect", () => {
|
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
/* --ITEM-TEST--START */
|
|
274
|
-
//let item = Item_Logic.get_test("Item_" +
|
|
274
|
+
//let item = Item_Logic.get_test("Item_" +Num.get_id(),DataType.BLOG_POST,0,{get_blank:false});
|
|
275
275
|
//Log.w('item',item);
|
|
276
276
|
/*
|
|
277
277
|
let item_list = Item_Logic.get_test_list(DataType.BLANK,{item_count:10,get_value:true});
|
|
@@ -365,7 +365,7 @@ describe("connect", () => {
|
|
|
365
365
|
/* --REVIEW--START */
|
|
366
366
|
/*
|
|
367
367
|
let parent_data_type = DataType.PRODUCT;
|
|
368
|
-
let parent_id =
|
|
368
|
+
let parent_id = Num.get_id();
|
|
369
369
|
let user = User_Logic.get_test({generate_id:false});
|
|
370
370
|
let product_review = Review_Logic.get_test(parent_data_type,parent_id,user.id);
|
|
371
371
|
let review = Review_Logic.get_new(parent_data_type,parent_id,user,product_review);
|
|
@@ -381,7 +381,7 @@ describe("connect", () => {
|
|
|
381
381
|
/* --REVIEW--END */
|
|
382
382
|
|
|
383
383
|
/* --BUSINESS--START */
|
|
384
|
-
//Log.w("Business",Business_Logic.get_test("Business " +
|
|
384
|
+
//Log.w("Business",Business_Logic.get_test("Business " + Num.get_id()));
|
|
385
385
|
//Log.w("Business",Business_Logic.get_test());
|
|
386
386
|
/* --BUSINESS--END */
|
|
387
387
|
|
|
@@ -421,7 +421,7 @@ describe("connect", () => {
|
|
|
421
421
|
|
|
422
422
|
function(call) {
|
|
423
423
|
console.log('GET_START_STORAGE-START');
|
|
424
|
-
Log.w('storage-start',Storage.set(
|
|
424
|
+
Log.w('storage-start',Storage.set(Num.get_id()));
|
|
425
425
|
console.log('GET_START_STORAGE-END');
|
|
426
426
|
//call();
|
|
427
427
|
},
|
|
@@ -457,16 +457,16 @@ describe("connect", () => {
|
|
|
457
457
|
console.log('SET-ITEM-BIZ-BY-LIST-START');
|
|
458
458
|
let item_test_list = [];
|
|
459
459
|
let item_test = Item_Logic.get_test_item('dt_blank',0);
|
|
460
|
-
item_test.cost = String(
|
|
461
|
-
item_test.old_cost = String(
|
|
462
|
-
item_test.title ='_title_'+
|
|
460
|
+
item_test.cost = String(Num.get_id())+'.55';
|
|
461
|
+
item_test.old_cost = String(Num.get_id())+'.20';
|
|
462
|
+
item_test.title ='_title_'+Num.get_id();
|
|
463
463
|
|
|
464
464
|
item_test_list.push(item_test);
|
|
465
465
|
|
|
466
466
|
let item_test_1 = Item_Logic.get_test_item('dt_blank',0);
|
|
467
467
|
item_test_1.cost = '5.55';
|
|
468
468
|
item_test_1.old_cost = '9.55';
|
|
469
|
-
item_test_1.title ='_title_'+
|
|
469
|
+
item_test_1.title ='_title_'+Num.get_id();
|
|
470
470
|
|
|
471
471
|
item_test_list.push(item_test_1);
|
|
472
472
|
|
|
@@ -498,9 +498,9 @@ describe("connect", () => {
|
|
|
498
498
|
console.log('SET_CATEGORY_DROP_DOWN_LIST-START');
|
|
499
499
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
500
500
|
let category_list = [];
|
|
501
|
-
category_list.push({data_type:DataType.BLANK,id:0,title:
|
|
502
|
-
category_list.push({data_type:DataType.BLANK,id:0,title:
|
|
503
|
-
category_list.push({data_type:DataType.BLANK,id:0,title:
|
|
501
|
+
category_list.push({data_type:DataType.BLANK,id:0,title:Num.get_id()});
|
|
502
|
+
category_list.push({data_type:DataType.BLANK,id:0,title:Num.get_id()});
|
|
503
|
+
category_list.push({data_type:DataType.BLANK,id:0,title:Num.get_id()});
|
|
504
504
|
Log.w('cat',Cat.set_category_drop_down_list(category_list));
|
|
505
505
|
//let cloud_url = CMS.get_new_query_item_by_item(item);
|
|
506
506
|
//Log.w('connect_url',cloud_url);
|
|
@@ -515,9 +515,9 @@ describe("connect", () => {
|
|
|
515
515
|
console.log('GET-NEW-QUERY-ITEM-BY-ITEM-START');
|
|
516
516
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
517
517
|
let item = DataItem.get_new(DataType.BLANK,0);
|
|
518
|
-
item.parent_id =
|
|
518
|
+
item.parent_id = Num.get_id();
|
|
519
519
|
item.parent_data_type = DataType.BLANK;
|
|
520
|
-
item.top_id =
|
|
520
|
+
item.top_id = Num.get_id();
|
|
521
521
|
item.top_data_type = DataType.BLANK;
|
|
522
522
|
Log.w('item',item);
|
|
523
523
|
//let cloud_url = CMS.get_new_query_item_by_item(item);
|