biz9-logic 4.8.69 → 4.8.71

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.4.9'
1
+ VERSION='5.5.1'
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;
@@ -455,7 +455,7 @@ class Field_Logic {
455
455
  if(option.fields){
456
456
  for(let a = 0; a<option.fields.length;a++){
457
457
  if(!option.get_blank == true){
458
- item[option.fields[a]] = Str.get_title(option.fields[a]) +"_" + Number.get_id();
458
+ item[option.fields[a]] = Str.get_title(option.fields[a]) +"_" + Number.get_id();
459
459
  }else{
460
460
  item[option.fields[a]] = "";
461
461
 
@@ -505,7 +505,7 @@ class Field_Logic {
505
505
  option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
506
506
  option.event_count = req.query.event_count ? req.query.event_count : 9;
507
507
 
508
- option.get_admin = req.query.get_admin ? req.query.get_admin : false;
508
+ option.get_admin = req.query.get_admin ? req.query.get_admin : false;
509
509
  option.get_business = req.query.get_business ? req.query.get_business : false;
510
510
  option.get_faq = req.query.get_faq ? req.query.get_faq : false;
511
511
  option.get_template = req.query.get_template ? req.query.get_template : false;
@@ -566,7 +566,7 @@ class Field_Logic {
566
566
  let title = '';
567
567
  }
568
568
  if(!option){
569
- let option = {};
569
+ let option = {};
570
570
  }
571
571
  if(!Str.check_is_null(title) && Obj.check_is_empty(option)){
572
572
  if(Obj.check_is_empty(option)){
@@ -580,10 +580,10 @@ class Field_Logic {
580
580
  }
581
581
  }
582
582
  }else{
583
- if(Str.check_is_null(title) && Obj.check_is_empty(option)){
584
- title = "Test " + Number.get_id();
585
- option = {};
586
- }
583
+ if(Str.check_is_null(title) && Obj.check_is_empty(option)){
584
+ title = "Test " + Number.get_id();
585
+ option = {};
586
+ }
587
587
  }
588
588
  return [title,option];
589
589
  }
@@ -616,6 +616,11 @@ class FieldType {
616
616
  static STAT_VIEW_ID='1';
617
617
  static STAT_LIKE_ID='2';
618
618
  static STAT_POST_ID='3';
619
+ static KEY_ADMIN="key_admin";
620
+ static KEY_USER="key_user";
621
+ static KEY_BUSINESS="key_business";
622
+ static KEY_GUEST="key_guest";
623
+ static KEY_APP_ID="key_app_id";
619
624
  }
620
625
  class Social {
621
626
  static FACEBOOK_URL="https://facebook.com/";
@@ -798,7 +803,7 @@ class Blank_Logic {
798
803
  };
799
804
  }
800
805
  class Faq_Logic {
801
- static get_test = (title,option) =>{
806
+ static get_test = (title,option) =>{
802
807
  [title,option] = Field_Logic.get_option_title(title,option);
803
808
  option = Field_Logic.get_option(DataType.FAQ,option?option:{});
804
809
  option.get_value = false;
@@ -807,12 +812,12 @@ static get_test = (title,option) =>{
807
812
  DataItem.get_new(DataType.FAQ,0),
808
813
  DataItem.get_new(DataType.FAQ,0),
809
814
  Field_Logic.get_test(title,option));
810
- for(let a=0;a<option.question_count+1;a++){
815
+ for(let a=0;a<option.question_count+1;a++){
811
816
  let question_title = "FAQ Question " + String(parseInt(a+1));
812
817
  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.";
813
- faq[Str.get_title_url(question_title).toLowerCase()] = answer;
814
- faq['field_'+parseInt(a+1)] =question_title;
815
- }
818
+ faq[Str.get_title_url(question_title).toLowerCase()] = answer;
819
+ faq['field_'+parseInt(a+1)] =question_title;
820
+ }
816
821
  return faq;
817
822
  };
818
823
  static get_test_list = (option) =>{
@@ -825,12 +830,12 @@ static get_test = (title,option) =>{
825
830
  }
826
831
  static get_faq_question_list(faq){
827
832
  let item_list = [];
828
- for(let a=0;a<19;a++){
829
- let row = a + 1;
830
- if(!Str.check_is_null(faq['field_'+a])) {
831
- item_list.push({ id: Number.get_id(333), question:faq['field_'+a], answer: String(faq[Str.get_title_url(faq['field_'+a]).toLowerCase() ]) });
832
- }
833
- }
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
839
  return item_list;
835
840
  }
836
841
  }
@@ -894,7 +899,7 @@ class Business_Logic {
894
899
  DataItem.get_new(DataType.BUSINESS,0),
895
900
  DataItem.get_new(DataType.BUSINESS,0),
896
901
  Field_Logic.get_test(title,option));
897
- business.email="ceo@business.com";
902
+ business.email="ceo@business.com";
898
903
  business.phone=Number.get_id(parseInt(777+100)) + "-" + Number.get_id(parseInt(777+100)) + "-"+Number.get_id(parseInt(7777+1000));
899
904
  business.address_1=Number.get_id(99)+" Main St.";
900
905
  business.address_2="PO "+Number.get_id(99);
@@ -1462,39 +1467,50 @@ class Schedule {
1462
1467
  }
1463
1468
  };
1464
1469
  class Storage {
1465
- static KEY_ADMIN="key_admin";
1466
- static KEY_USER="key_user";
1467
- static KEY_BUSINESS="key_business";
1468
- static KEY_GUEST="key_guest";
1469
- static KEY_APP_ID="key_app_id";
1470
1470
  static get = (window,key) => {
1471
- return JSON.parse(window.localStorage.getItem(key));
1471
+ if(window){
1472
+ return window.localStorage.getItem(key);
1473
+ }else{
1474
+ return null;
1475
+ }
1472
1476
  }
1473
1477
  static set = (window,key,obj) => {
1474
- window.localStorage.setItem(key,JSON.stringify(obj));
1478
+ if(window){
1479
+ if(window.localStorage){
1480
+ window.localStorage.setItem(key,JSON.stringify(obj));
1481
+ }
1482
+ }
1475
1483
  }
1476
1484
  static remove = (window,key) =>{
1477
- window.localStorage.removeItem(key);
1485
+ if(window){
1486
+ if(window.localStorage){
1487
+ window.localStorage.removeItem(key);
1488
+ }
1489
+ }
1478
1490
  }
1479
1491
  static clear = (window) =>{
1480
- window.localStorage.clear();
1492
+ if(window){
1493
+ if(window.localStorage){
1494
+ window.localStorage.clear();
1495
+ }
1496
+ }
1481
1497
  }
1482
1498
  }
1483
1499
  class User_Logic {
1484
1500
  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
- }
1501
+ if(!req || !req.session.user){
1502
+ let user=DataItem.get_new(DataType.USER,0,{is_guest:true,customer_id:Number.get_id(99999)});
1503
+ req.session.user=user;
1504
+ }
1505
+ return req.session.user;
1506
+ }
1491
1507
  static set_user(req){
1492
- req.session.user=user;
1493
- }
1508
+ req.session.user=user;
1509
+ }
1494
1510
  static del_user(req){
1495
- req.session.user=null;
1496
- delete req.session.user;
1497
- }
1511
+ req.session.user=null;
1512
+ delete req.session.user;
1513
+ }
1498
1514
  }
1499
1515
  class Sub_Item_Logic {
1500
1516
  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.69",
3
+ "version": "4.8.71",
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);