biz9-logic 4.8.70 → 4.8.72

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 CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='5.5.0'
1
+ VERSION='5.5.2'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -75,8 +75,8 @@ class Item_Logic {
75
75
  }
76
76
  for(let a=1;a<19;a++){
77
77
  if(!Str.check_is_null(search['filter_key_'+String(a)])){
78
- url = url + "&filter_key_"+String(a)+"="+ search['filter_key_'+String(a)];
79
- url = url + "&filter_value_"+String(a)+"="+ search['filter_value_'+String(a)];
78
+ url = url + "&filter_key_"+String(a)+"="+ search['filter_key_'+String(a)];
79
+ url = url + "&filter_value_"+String(a)+"="+ search['filter_value_'+String(a)];
80
80
  }
81
81
  }
82
82
  return url;
@@ -453,12 +453,13 @@ class Field_Logic {
453
453
  item = Field_Logic.get_value_list(item,option);
454
454
  }
455
455
  if(option.fields){
456
- for(let a = 0; a<option.fields.length;a++){
457
- if(!option.get_blank == true){
458
- item[option.fields[a]] = Str.get_title(option.fields[a]) +"_" + Number.get_id();
456
+ let field_list = option.fields.split(',');
457
+ Log.w('field_list',field_list);
458
+ for(let a = 0; a<field_list.length;a++){
459
+ if(option.get_blank == true){
460
+ item[field_list[a]] = "";
459
461
  }else{
460
- item[option.fields[a]] = "";
461
-
462
+ item[Str.get_title_url(field_list[a])] = Str.get_title(field_list[a]) +"_" + Number.get_id();
462
463
  }
463
464
  }
464
465
  }
@@ -505,7 +506,7 @@ class Field_Logic {
505
506
  option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
506
507
  option.event_count = req.query.event_count ? req.query.event_count : 9;
507
508
 
508
- option.get_admin = req.query.get_admin ? req.query.get_admin : false;
509
+ option.get_admin = req.query.get_admin ? req.query.get_admin : false;
509
510
  option.get_business = req.query.get_business ? req.query.get_business : false;
510
511
  option.get_faq = req.query.get_faq ? req.query.get_faq : false;
511
512
  option.get_template = req.query.get_template ? req.query.get_template : false;
@@ -566,7 +567,7 @@ class Field_Logic {
566
567
  let title = '';
567
568
  }
568
569
  if(!option){
569
- let option = {};
570
+ let option = {};
570
571
  }
571
572
  if(!Str.check_is_null(title) && Obj.check_is_empty(option)){
572
573
  if(Obj.check_is_empty(option)){
@@ -580,10 +581,10 @@ class Field_Logic {
580
581
  }
581
582
  }
582
583
  }else{
583
- if(Str.check_is_null(title) && Obj.check_is_empty(option)){
584
- title = "Test " + Number.get_id();
585
- option = {};
586
- }
584
+ if(Str.check_is_null(title) && Obj.check_is_empty(option)){
585
+ title = "Test " + Number.get_id();
586
+ option = {};
587
+ }
587
588
  }
588
589
  return [title,option];
589
590
  }
@@ -803,7 +804,7 @@ class Blank_Logic {
803
804
  };
804
805
  }
805
806
  class Faq_Logic {
806
- static get_test = (title,option) =>{
807
+ static get_test = (title,option) =>{
807
808
  [title,option] = Field_Logic.get_option_title(title,option);
808
809
  option = Field_Logic.get_option(DataType.FAQ,option?option:{});
809
810
  option.get_value = false;
@@ -812,12 +813,12 @@ static get_test = (title,option) =>{
812
813
  DataItem.get_new(DataType.FAQ,0),
813
814
  DataItem.get_new(DataType.FAQ,0),
814
815
  Field_Logic.get_test(title,option));
815
- for(let a=0;a<option.question_count+1;a++){
816
+ for(let a=0;a<option.question_count+1;a++){
816
817
  let question_title = "FAQ Question " + String(parseInt(a+1));
817
818
  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.";
818
- faq[Str.get_title_url(question_title).toLowerCase()] = answer;
819
- faq['field_'+parseInt(a+1)] =question_title;
820
- }
819
+ faq[Str.get_title_url(question_title).toLowerCase()] = answer;
820
+ faq['field_'+parseInt(a+1)] =question_title;
821
+ }
821
822
  return faq;
822
823
  };
823
824
  static get_test_list = (option) =>{
@@ -830,12 +831,12 @@ static get_test = (title,option) =>{
830
831
  }
831
832
  static get_faq_question_list(faq){
832
833
  let item_list = [];
833
- for(let a=0;a<19;a++){
834
- let row = a + 1;
835
- if(!Str.check_is_null(faq['field_'+a])) {
836
- item_list.push({ id: Number.get_id(333), question:faq['field_'+a], answer: String(faq[Str.get_title_url(faq['field_'+a]).toLowerCase() ]) });
837
- }
838
- }
834
+ for(let a=0;a<19;a++){
835
+ let row = a + 1;
836
+ if(!Str.check_is_null(faq['field_'+a])) {
837
+ item_list.push({ id: Number.get_id(333), question:faq['field_'+a], answer: String(faq[Str.get_title_url(faq['field_'+a]).toLowerCase() ]) });
838
+ }
839
+ }
839
840
  return item_list;
840
841
  }
841
842
  }
@@ -899,7 +900,7 @@ class Business_Logic {
899
900
  DataItem.get_new(DataType.BUSINESS,0),
900
901
  DataItem.get_new(DataType.BUSINESS,0),
901
902
  Field_Logic.get_test(title,option));
902
- business.email="ceo@business.com";
903
+ business.email="ceo@business.com";
903
904
  business.phone=Number.get_id(parseInt(777+100)) + "-" + Number.get_id(parseInt(777+100)) + "-"+Number.get_id(parseInt(7777+1000));
904
905
  business.address_1=Number.get_id(99)+" Main St.";
905
906
  business.address_2="PO "+Number.get_id(99);
@@ -1467,34 +1468,50 @@ class Schedule {
1467
1468
  }
1468
1469
  };
1469
1470
  class Storage {
1470
- static get = (window,key) => {
1471
- return JSON.parse(window.localStorage.getItem(key));
1471
+ static get = (window,key) => {
1472
+ if(window){
1473
+ return window.localStorage.getItem(key);
1474
+ }else{
1475
+ return null;
1476
+ }
1472
1477
  }
1473
1478
  static set = (window,key,obj) => {
1474
- window.localStorage.setItem(key,JSON.stringify(obj));
1479
+ if(window){
1480
+ if(window.localStorage){
1481
+ window.localStorage.setItem(key,JSON.stringify(obj));
1482
+ }
1483
+ }
1475
1484
  }
1476
1485
  static remove = (window,key) =>{
1477
- window.localStorage.removeItem(key);
1486
+ if(window){
1487
+ if(window.localStorage){
1488
+ window.localStorage.removeItem(key);
1489
+ }
1490
+ }
1478
1491
  }
1479
1492
  static clear = (window) =>{
1480
- window.localStorage.clear();
1493
+ if(window){
1494
+ if(window.localStorage){
1495
+ window.localStorage.clear();
1496
+ }
1497
+ }
1481
1498
  }
1482
1499
  }
1483
1500
  class User_Logic {
1484
1501
  static get_user(req){
1485
- if(!req || !req.session.user){
1486
- let user=DataItem.get_new(DataType.USER,0,{is_guest:true,customer_id:Number.get_id(99999)});
1487
- req.session.user=user;
1488
- }
1489
- return req.session.user;
1490
- }
1502
+ if(!req || !req.session.user){
1503
+ let user=DataItem.get_new(DataType.USER,0,{is_guest:true,customer_id:Number.get_id(99999)});
1504
+ req.session.user=user;
1505
+ }
1506
+ return req.session.user;
1507
+ }
1491
1508
  static set_user(req){
1492
- req.session.user=user;
1493
- }
1509
+ req.session.user=user;
1510
+ }
1494
1511
  static del_user(req){
1495
- req.session.user=null;
1496
- delete req.session.user;
1497
- }
1512
+ req.session.user=null;
1513
+ delete req.session.user;
1514
+ }
1498
1515
  }
1499
1516
  class Sub_Item_Logic {
1500
1517
  static get_test(title,parent_item,top_item,option){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.70",
3
+ "version": "4.8.72",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -47,6 +47,10 @@ describe("connect", () => {
47
47
  },
48
48
 
49
49
  function(call) {
50
+ //console.log('STORAGE-START');
51
+ //console.log(Storage.get({},'apples'));
52
+ //Log.w('storage-start',Storage.set(Number.get_id()));
53
+ //console.log('STORAGE-END');
50
54
  /* --PAGE--START */
51
55
  //let page = Page_Logic.get_test()
52
56
  //let page = Page_Logic.get_test("Page "+Number.get_id())
@@ -145,13 +149,13 @@ describe("connect", () => {
145
149
  /* --CONTENT--END */
146
150
 
147
151
 
148
- /* --BLOG_POST--START */
149
- let blog_post = Blog_Post_Logic.get_test("Blog_Post 1")
152
+ /* --BLOG_POST--START */
153
+ // let blog_post = Blog_Post_Logic.get_test("Blog_Post 1")
150
154
  //let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true})
151
155
  //let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true})
152
156
  //let blog_post = Blog_Post_Logic.get_test("Blog_Post 1",{get_value:true,get_item:true})
153
157
  //let [category_list,blog_post_list]=Blog_Post_Logic.get_test_list_by_category();
154
- Log.w("blog_post",blog_post);
158
+ //Log.w("blog_post",blog_post);
155
159
  //let blog_post_list = Blog_Post_Logic.get_test_list({get_value:true,get_item:true});
156
160
  //Log.w('blog_post_list',blog_post_list);
157
161
  //Log.w('blog_post_list',blog_post_list[0].items);
@@ -192,8 +196,9 @@ describe("connect", () => {
192
196
  //let product = Product_Logic.get_test({fields:["cool_beanj]})
193
197
  //Log.w("product",product);
194
198
  //let product_list = Product_Logic.get_test_list({product_count:10,get_blank:true});
199
+ let product_list = Product_Logic.get_test_list({product_count:2,get_blank:false,fields:'delivery_time,apple'})
195
200
  //let product_list = Product_Logic.get_test_list();
196
- //Log.w('product_list',product_list);
201
+ Log.w('product_list',product_list);
197
202
  //let [category_list,product_list]=Product.get_test_list_by_category({category_count:5,product_count:9});
198
203
  //Log.w('category_list',category_list);
199
204