forked from edwardjrp/license_manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
licensing_customerscontent_events.php
executable file
·1418 lines (1205 loc) · 56 KB
/
licensing_customerscontent_events.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// //Events @1-F81417CB
//licensing_customerscontent_alm_customers_lbgoback_BeforeShow @29-8BF832A2
function licensing_customerscontent_alm_customers_lbgoback_BeforeShow(& $sender)
{
$licensing_customerscontent_alm_customers_lbgoback_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_lbgoback_BeforeShow
//Custom Code @30-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_lbgoback_BeforeShow @29-96EFD0D9
return $licensing_customerscontent_alm_customers_lbgoback_BeforeShow;
}
//End Close licensing_customerscontent_alm_customers_lbgoback_BeforeShow
//licensing_customerscontent_alm_customers_businesspartner_BeforeShow @73-8A682B49
function licensing_customerscontent_alm_customers_businesspartner_BeforeShow(& $sender)
{
$licensing_customerscontent_alm_customers_businesspartner_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_businesspartner_BeforeShow
//Custom Code @74-2A29BDB7
// -------------------------
// Write your own code here.
$businesspartner = explode(",",$licensing_customerscontent->alm_customers->businesspartner->GetValue());
$licensing_customerscontent->alm_customers->businesspartner->Multiple = true;
$licensing_customerscontent->alm_customers->businesspartner->SetValue($businesspartner);
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_businesspartner_BeforeShow @73-6350EF1C
return $licensing_customerscontent_alm_customers_businesspartner_BeforeShow;
}
//End Close licensing_customerscontent_alm_customers_businesspartner_BeforeShow
//licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect @73-D8B8E715
function licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect(& $sender)
{
$licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect
//Custom Code @215-2A29BDB7
// -------------------------
// Write your own code here.
//Will hide the non selected business partners from the list, this custom code is larger
//because getting the value of the businesspartner listbox does not work.
$guid = trim(CCGetFromGet("guid",""));
if (strlen($guid) > 0) {
$db = new clsDBdbConnection();
$businesspartners = trim(CCDLookup("businesspartner","alm_customers","guid = '$guid'",$db),",");
if (strlen($businesspartners) > 0)
$licensing_customerscontent->alm_customers->businesspartner->ds->Where = "id in ($businesspartners)";
else
$licensing_customerscontent->alm_customers->businesspartner->ds->Where = "id in (0)";
$db->close();
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect @73-E8D70D73
return $licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect;
}
//End Close licensing_customerscontent_alm_customers_businesspartner_ds_BeforeBuildSelect
//licensing_customerscontent_alm_customers_manufacturer_BeforeShow @153-1B691D2B
function licensing_customerscontent_alm_customers_manufacturer_BeforeShow(& $sender)
{
$licensing_customerscontent_alm_customers_manufacturer_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_manufacturer_BeforeShow
//Custom Code @40-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_manufacturer_BeforeShow @153-B542AFFB
return $licensing_customerscontent_alm_customers_manufacturer_BeforeShow;
}
//End Close licensing_customerscontent_alm_customers_manufacturer_BeforeShow
//DEL // -------------------------
//DEL // Write your own code here.
//DEL $idstatus = (int)$sender->GetValue();
//DEL if ($idstatus > 0) {
//DEL $db = new clsDBdbConnection();
//DEL $sql = "select status_name,icon_name,css_color from alm_license_status where id = $idstatus";
//DEL $db->query($sql);
//DEL $db->next_record();
//DEL $licensing_customerscontent->licensing->lblicense_status_css->SetValue($db->f("css_color"));
//DEL $sender->SetValue($db->f("status_name"));
//DEL $db->close();
//DEL }
//DEL // -------------------------
//licensing_customerscontent_alm_customers_BeforeInsert @2-B15A5E44
function licensing_customerscontent_alm_customers_BeforeInsert(& $sender)
{
$licensing_customerscontent_alm_customers_BeforeInsert = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_BeforeInsert
//Custom Code @146-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_BeforeInsert @2-F7D0B9A4
return $licensing_customerscontent_alm_customers_BeforeInsert;
}
//End Close licensing_customerscontent_alm_customers_BeforeInsert
//licensing_customerscontent_alm_customers_AfterInsert @2-BBE26E55
function licensing_customerscontent_alm_customers_AfterInsert(& $sender)
{
$licensing_customerscontent_alm_customers_AfterInsert = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_AfterInsert
//Custom Code @147-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_AfterInsert @2-435E7DA5
return $licensing_customerscontent_alm_customers_AfterInsert;
}
//End Close licensing_customerscontent_alm_customers_AfterInsert
//licensing_customerscontent_alm_customers_BeforeUpdate @2-FDC9CF7B
function licensing_customerscontent_alm_customers_BeforeUpdate(& $sender)
{
$licensing_customerscontent_alm_customers_BeforeUpdate = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_BeforeUpdate
//Custom Code @148-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_BeforeUpdate @2-38F9782B
return $licensing_customerscontent_alm_customers_BeforeUpdate;
}
//End Close licensing_customerscontent_alm_customers_BeforeUpdate
//licensing_customerscontent_alm_customers_AfterUpdate @2-A112A8AF
function licensing_customerscontent_alm_customers_AfterUpdate(& $sender)
{
$licensing_customerscontent_alm_customers_AfterUpdate = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_AfterUpdate
//Custom Code @149-2A29BDB7
// -------------------------
// Write your own code here.
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_AfterUpdate @2-8C77BC2A
return $licensing_customerscontent_alm_customers_AfterUpdate;
}
//End Close licensing_customerscontent_alm_customers_AfterUpdate
//licensing_customerscontent_alm_customers_BeforeShow @2-C2BF2231
function licensing_customerscontent_alm_customers_BeforeShow(& $sender)
{
$licensing_customerscontent_alm_customers_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_alm_customers_BeforeShow
//Custom Code @150-2A29BDB7
// -------------------------
// Write your own code here.
$guid = CCGetFromGet("guid","");
$license_guid = CCGetFromGet("license_guid","");
$tab = CCGetFromGet("tab","");
$o = CCGetFromGet("o","");
$params = array();
$params["customer_guid"] = $guid;
$params["license_guid"] = $license_guid;
if (strlen($guid) > 0) {
global $Tpl;
global $FileName;
$customers = new Customers();
$contacts = $customers->getCustomerContacts($params);
$contacts = $contacts["contacts"];
$querystring = CCGetQueryString("QueryString",array());
$db = new clsDBdbConnection();
foreach($contacts as $contact) {
//$editurl = $FileName."?$querystring&contact_guid=".$contact["guid"]."&tab=addcontact";
//$deleteurl = $FileName."?$querystring&contact_guid=".$contact["guid"]."&tab=addcontact&o=delcontact";
//$Tpl->setvar("lbedit","");
//$Tpl->setvar("lbdelete","");
$Tpl->setvar("lbcontact",$contact["contact"]);
if ($contact["maincontact"] == "1")
$Tpl->setvar("lbmaincontact","");
else
$Tpl->setvar("lbmaincontact","hide");
$jobposition = $contact["jobposition"];
$jobposition = CCDLookup("jobposition","alm_jobpositions","id = $jobposition",$db);
$Tpl->setvar("lbcontact_jobposition",$jobposition);
$Tpl->setvar("lbcontact_phone",$contact["phone"]);
$Tpl->setvar("lbcontact_extension",$contact["extension"]);
$Tpl->setvar("lbcontact_mobile",$contact["mobile"]);
$Tpl->setvar("lbcontact_workemail",$contact["workemail"]);
$Tpl->setvar("lbcontact_personalemail",$contact["personalemail"]);
$dateupdated = $contact["dateupdated"];
if (strlen($dateupdated) > 0) {
$dateupdated_array = CCParseDate($dateupdated,array("yyyy","-","mm","-","dd"," ","H",":","n",":","s"));
$format = array("mm","/","dd","/","yyyy"," ","hh",":","nn"," ","AM/PM");
$dateupdated = CCFormatDate($dateupdated_array,$format);
$Tpl->setvar("lbcontact_dateupdated",$dateupdated);
}
$Tpl->parse("contact_list",true);
}
$db->close();
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_alm_customers_BeforeShow @2-4616A461
return $licensing_customerscontent_alm_customers_BeforeShow;
}
//End Close licensing_customerscontent_alm_customers_BeforeShow
//licensing_customerscontent_licensing_manufacturer_BeforeShow @166-033039ED
function licensing_customerscontent_licensing_manufacturer_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_manufacturer_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_manufacturer_BeforeShow
//Custom Code @167-2A29BDB7
// -------------------------
// Write your own code here.
$suite_id = $licensing_customerscontent->licensing->suite_code->GetValue();
$db = new clsDBdbConnection();
$manufacturer_id = CCDLookup("id_manufacturer","alm_product_suites","id = $suite_id",$db);
$licensing_customerscontent->licensing->manufacturer->SetValue($manufacturer_id);
$db->close();
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_manufacturer_BeforeShow @166-81B8E820
return $licensing_customerscontent_licensing_manufacturer_BeforeShow;
}
//End Close licensing_customerscontent_licensing_manufacturer_BeforeShow
//licensing_customerscontent_licensing_suite_code_BeforeShow @7-2AFDE115
function licensing_customerscontent_licensing_suite_code_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_suite_code_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_suite_code_BeforeShow
//Custom Code @39-2A29BDB7
// -------------------------
// Write your own code here.
$suite_id = $licensing_customerscontent->licensing->suite_code->GetValue();
$db = new clsDBdbConnection();
$suite_description = CCDLookup("suite_description","alm_product_suites","id = $suite_id",$db);
$licensing_customerscontent->licensing->suitedescription->SetValue($suite_description);
$db->close();
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_suite_code_BeforeShow @7-78DE9778
return $licensing_customerscontent_licensing_suite_code_BeforeShow;
}
//End Close licensing_customerscontent_licensing_suite_code_BeforeShow
//licensing_customerscontent_licensing_expiration_date_BeforeShow @184-994A6DD9
function licensing_customerscontent_licensing_expiration_date_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_expiration_date_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_expiration_date_BeforeShow
//Custom Code @221-2A29BDB7
// -------------------------
// Write your own code here.
$licenseType = $licensing_customerscontent->licensing->id_license_type->GetValue();
//Checking if licenseType is perpetual to disabled expirationDate input
//There is alsi a js code for clientside behavior
if ( ( $licenseType == "7" ) || ($licenseType == "12") ) {
global $Tpl;
$Tpl->setvar("expirationDisabled","disabled");
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_expiration_date_BeforeShow @184-068C01A9
return $licensing_customerscontent_licensing_expiration_date_BeforeShow;
}
//End Close licensing_customerscontent_licensing_expiration_date_BeforeShow
//licensing_customerscontent_licensing_hidtab_BeforeShow @195-D622CAAE
function licensing_customerscontent_licensing_hidtab_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_hidtab_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_hidtab_BeforeShow
//Retrieve Value for Control @201-DF450422
$Container->hidtab->SetValue(CCGetFromGet("tab", ""));
//End Retrieve Value for Control
//Close licensing_customerscontent_licensing_hidtab_BeforeShow @195-D811FA38
return $licensing_customerscontent_licensing_hidtab_BeforeShow;
}
//End Close licensing_customerscontent_licensing_hidtab_BeforeShow
//licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow @199-E47F0B95
function licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow
//Retrieve Value for Control @200-5C6E50E5
$Container->hidcustomer_guid->SetValue(CCGetFromGet("guid", ""));
//End Retrieve Value for Control
//Close licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow @199-DB8AF303
return $licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow;
}
//End Close licensing_customerscontent_licensing_hidcustomer_guid_BeforeShow
//licensing_customerscontent_licensing_lbgoback_BeforeShow @202-0518E9CD
function licensing_customerscontent_licensing_lbgoback_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_lbgoback_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_lbgoback_BeforeShow
//Custom Code @203-2A29BDB7
// -------------------------
// Write your own code here.
$remove = array("guid","tab","license_guid");
$querystring = CCGetQueryString("QueryString",$remove);
if (strlen($querystring) > 0)
$newlink = "?".$querystring;
else
$newlink = $querystring;
$sender->setValue($newlink);
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_lbgoback_BeforeShow @202-2A9D98C1
return $licensing_customerscontent_licensing_lbgoback_BeforeShow;
}
//End Close licensing_customerscontent_licensing_lbgoback_BeforeShow
//licensing_customerscontent_licensing_id_license_status_BeforeShow @205-17C5A635
function licensing_customerscontent_licensing_id_license_status_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_id_license_status_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_id_license_status_BeforeShow
//Custom Code @207-2A29BDB7
// -------------------------
// Write your own code here.
$idstatus = (int)$sender->GetValue();
if ($idstatus > 0) {
$db = new clsDBdbConnection();
$sql = "select status_name,icon_name,css_color from alm_license_status where id = $idstatus";
$db->query($sql);
$db->next_record();
$licensing_customerscontent->licensing->lblicense_status_css->SetValue($db->f("css_color"));
$sender->SetValue($db->f("status_name"));
$db->close();
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_id_license_status_BeforeShow @205-C8AA0A17
return $licensing_customerscontent_licensing_id_license_status_BeforeShow;
}
//End Close licensing_customerscontent_licensing_id_license_status_BeforeShow
//licensing_customerscontent_licensing_params_BeforeShow @49-02262C70
function licensing_customerscontent_licensing_params_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_params_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_params_BeforeShow
//Custom Code @50-2A29BDB7
// -------------------------
// Write your own code here.
$querystring = CCGetQueryString("QueryString",array("license_guid","dguid","o"));
if (strlen($querystring) > 0)
$querystring .= "&tab=licenselist";
else
$querystring = "tab=licenselist";
$sender->SetValue("$querystring");
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_params_BeforeShow @49-47F0CBB8
return $licensing_customerscontent_licensing_params_BeforeShow;
}
//End Close licensing_customerscontent_licensing_params_BeforeShow
//licensing_customerscontent_licensing_pncanceledit_BeforeShow @208-BF490B96
function licensing_customerscontent_licensing_pncanceledit_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_pncanceledit_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_pncanceledit_BeforeShow
//Custom Code @209-2A29BDB7
// -------------------------
// Write your own code here.
$guid = trim(CCGetFromGet("license_guid",""));
$o = trim(CCGetFromGet("o",""));
if ( (strlen($guid) > 0) || ($o == "addsupport") )
$licensing_customerscontent->licensing->pncanceledit->Visible = true;
else
$licensing_customerscontent->licensing->pncanceledit->Visible = false;
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_pncanceledit_BeforeShow @208-7285F64D
return $licensing_customerscontent_licensing_pncanceledit_BeforeShow;
}
//End Close licensing_customerscontent_licensing_pncanceledit_BeforeShow
//licensing_customerscontent_licensing_hidlicense_guid_BeforeShow @211-C8E0892C
function licensing_customerscontent_licensing_hidlicense_guid_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_hidlicense_guid_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_hidlicense_guid_BeforeShow
//Retrieve Value for Control @212-836879CA
$Container->hidlicense_guid->SetValue(CCGetFromGet("license_guid", ""));
//End Retrieve Value for Control
//Close licensing_customerscontent_licensing_hidlicense_guid_BeforeShow @211-F077FEBE
return $licensing_customerscontent_licensing_hidlicense_guid_BeforeShow;
}
//End Close licensing_customerscontent_licensing_hidlicense_guid_BeforeShow
//licensing_customerscontent_licensing_id_product_BeforeShow @173-47584CC4
function licensing_customerscontent_licensing_id_product_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_id_product_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_id_product_BeforeShow
//Custom Code @174-2A29BDB7
// -------------------------
// Write your own code here.
$suite_id = (int)$licensing_customerscontent->licensing->suite_code->GetValue();
$id_product_type = (int)$licensing_customerscontent->licensing->id_product_type->GetValue();
$id_license_sector = (int)$licensing_customerscontent->licensing->id_license_sector->GetValue();
$id_license_type = (int)$licensing_customerscontent->licensing->id_license_type->GetValue();
if ( ($suite_id > 0) || ($id_product_type > 0) || ($id_license_sector > 0) || ($id_license_type > 0) ) {
$products = new \Alm\Products();
$params = array();
$params["suite_id"] = $suite_id;
$params["id_product_type"] = $id_product_type;
$params["id_license_sector"] = $id_license_sector;
$params["id_license_type"] = $id_license_type;
$productList = $products->getProductsBySuiteID($params);
$allProducts = $productList["products"];
$valueList = array();
foreach($allProducts as $product) {
$min = $product["range_min"];
$max = $product["range_max"];
$shortDescription = $product["short_description"];
$channelSku = $product["channel_sku"];
$description = $product["description"];
$valueList[] = array($product["id"],"$description ( Nodes: $min - $max )");
}
$licensing_customerscontent->licensing->id_product->Values = $valueList;
$params["product_id"] = $licensing_customerscontent->licensing->id_product->GetValue();
$productDetails = $products->getProductByID($params);
$productDetails = $productDetails["products"];
$suite = $products->getSuiteByID($params);
$licensing_customerscontent->licensing->suitedescription->SetValue($suite["suite_description"]);
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_id_product_BeforeShow @173-36830841
return $licensing_customerscontent_licensing_id_product_BeforeShow;
}
//End Close licensing_customerscontent_licensing_id_product_BeforeShow
//licensing_customerscontent_licensing_totalcost_BeforeShow @218-B8E8E8C4
function licensing_customerscontent_licensing_totalcost_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_totalcost_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_totalcost_BeforeShow
//Custom Code @219-2A29BDB7
// -------------------------
// Write your own code here.
$price = $licensing_customerscontent->licensing->msrp_price->GetValue();
$licenseBy = $licensing_customerscontent->licensing->id_licensed_by->GetValue();
$nodes = $licensing_customerscontent->licensing->nodes->GetValue();
$licenseAmount = $licensing_customerscontent->licensing->licensed_amount->GetValue();
$totalCost = 0;
switch ($licenseBy) {
case "1" :
//Nodes
$totalCost = ( $price * $nodes );
break;
case "2" :
//Qty
$totalCost = ( $price * $licenseAmount );
break;
case "3" :
//Percentage
$totalCost = ( $price * ($licenseAmount/100) ) + $price;
break;
}
$sender->SetValue($totalCost);
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_totalcost_BeforeShow @218-9CA8A2EF
return $licensing_customerscontent_licensing_totalcost_BeforeShow;
}
//End Close licensing_customerscontent_licensing_totalcost_BeforeShow
//licensing_customerscontent_licensing_params1_BeforeShow @222-BD7189EE
function licensing_customerscontent_licensing_params1_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_params1_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_params1_BeforeShow
//Custom Code @223-2A29BDB7
// -------------------------
// Write your own code here.
$guid = trim(CCGetFromGet("license_guid",""));
$querystring = CCGetQueryString("QueryString",array("license_guid"));
if (strlen($querystring) > 0)
$querystring = "&$querystring";
$sender->SetValue("&dguid=$guid$querystring");
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_params1_BeforeShow @222-F2A98F9D
return $licensing_customerscontent_licensing_params1_BeforeShow;
}
//End Close licensing_customerscontent_licensing_params1_BeforeShow
//licensing_customerscontent_licensing_pnaddsupport_BeforeShow @51-7CF57775
function licensing_customerscontent_licensing_pnaddsupport_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_pnaddsupport_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_pnaddsupport_BeforeShow
//Custom Code @224-2A29BDB7
// -------------------------
// Write your own code here.
//Will only show addsupport button to perpetual license types (7,12) and doesnt have support added
$guid = trim(CCGetFromGet("license_guid",""));
if (strlen($guid) > 0) {
$products = new Alm\Products();
$params = array();
$params["license_guid"] = $guid;
$isPerpetual = $products->licenseIsPerpetual($params);
if ($isPerpetual["isPerpetual"] == 1) {
$hasSupport = $products->licenseHasSupport($params);
if ($hasSupport["hasSupport"] == 1)
$licensing_customerscontent->licensing->pnaddsupport->Visible = false;
else
$licensing_customerscontent->licensing->pnaddsupport->Visible = true;
} else
$licensing_customerscontent->licensing->pnaddsupport->Visible = false;
} else
$licensing_customerscontent->licensing->pnaddsupport->Visible = false;
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_pnaddsupport_BeforeShow @51-F7C008AF
return $licensing_customerscontent_licensing_pnaddsupport_BeforeShow;
}
//End Close licensing_customerscontent_licensing_pnaddsupport_BeforeShow
//licensing_customerscontent_licensing_hido_BeforeShow @226-AA199BD8
function licensing_customerscontent_licensing_hido_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_hido_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_hido_BeforeShow
//Retrieve Value for Control @227-E68DB893
$Container->hido->SetValue(CCGetFromGet("o", ""));
//End Retrieve Value for Control
//Close licensing_customerscontent_licensing_hido_BeforeShow @226-F67D72E8
return $licensing_customerscontent_licensing_hido_BeforeShow;
}
//End Close licensing_customerscontent_licensing_hido_BeforeShow
//licensing_customerscontent_licensing_hiddguid_BeforeShow @228-751ACE87
function licensing_customerscontent_licensing_hiddguid_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_hiddguid_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_hiddguid_BeforeShow
//Retrieve Value for Control @229-08CAA933
$Container->hiddguid->SetValue(CCGetFromGet("dguid", ""));
//End Retrieve Value for Control
//Close licensing_customerscontent_licensing_hiddguid_BeforeShow @228-A3B4A5B0
return $licensing_customerscontent_licensing_hiddguid_BeforeShow;
}
//End Close licensing_customerscontent_licensing_hiddguid_BeforeShow
//licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow @236-069EFBE8
function licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow
//Custom Code @237-2A29BDB7
// -------------------------
// Write your own code here.
$licenseType = $licensing_customerscontent->licensing->id_license_type->GetValue();
//Checking if licenseType is perpetual to disabled expirationDate input
//There is alsi a js code for clientside behavior
if ( ( $licenseType == "7" ) || ($licenseType == "12") ) {
global $Tpl;
$Tpl->setvar("expirationDisabled","disabled");
} else {
$businessPartnerDate = $licensing_customerscontent->licensing->renew_businesspartner_date->GetValue();
if (count($businessPartnerDate) <= 1 ) {
$today = date("Y-m-d");
$twoMonths = date("Y-m-d",strtotime("$today +2 months"));
//For default date values on text input, the date must be converted to a date array to avoid errors, see below
$twoMonths_array = CCParseDate($twoMonths,array("yyyy","-","mm","-","dd"," ","H",":","n",":","s"));
$licensing_customerscontent->licensing->renew_businesspartner_date->SetValue($twoMonths_array);
}
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow @236-3C2113A8
return $licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow;
}
//End Close licensing_customerscontent_licensing_renew_businesspartner_date_BeforeShow
//licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow @234-8BAA8F54
function licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow
//Custom Code @235-2A29BDB7
// -------------------------
// Write your own code here.
$licenseStatus = (int)$licensing_customerscontent->licensing->hidlicensestatus->GetValue();
$o = CCGetFromGet("o","");
if ( ($licenseStatus == 3) && ($o == "renew_competitor") )
$licensing_customerscontent->licensing->pnrenewcompetitor->Visible = true;
else
$licensing_customerscontent->licensing->pnrenewcompetitor->Visible = false;
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow @234-1349357A
return $licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow;
}
//End Close licensing_customerscontent_licensing_pnrenewcompetitor_BeforeShow
//licensing_customerscontent_licensing_competitor_date_BeforeShow @242-656654CF
function licensing_customerscontent_licensing_competitor_date_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_competitor_date_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_competitor_date_BeforeShow
//Custom Code @243-2A29BDB7
// -------------------------
// Write your own code here.
$licenseType = $licensing_customerscontent->licensing->id_license_type->GetValue();
//Checking if licenseType is perpetual to disabled expirationDate input
//There is alsi a js code for clientside behavior
if ( ( $licenseType == "7" ) || ($licenseType == "12") ) {
global $Tpl;
$Tpl->setvar("expirationDisabled","disabled");
} else {
$businessPartnerDate = $licensing_customerscontent->licensing->renew_businesspartner_date->GetValue();
if (count($businessPartnerDate) <= 1 ) {
$today = date("Y-m-d");
$twoMonths = date("Y-m-d",strtotime("$today +2 months"));
//For default date values on text input, the date must be converted to a date array to avoid errors, see below
$twoMonths_array = CCParseDate($twoMonths,array("yyyy","-","mm","-","dd"," ","H",":","n",":","s"));
$licensing_customerscontent->licensing->renew_businesspartner_date->SetValue($twoMonths_array);
}
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_competitor_date_BeforeShow @242-F359297C
return $licensing_customerscontent_licensing_competitor_date_BeforeShow;
}
//End Close licensing_customerscontent_licensing_competitor_date_BeforeShow
//licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow @241-F81975C3
function licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow(& $sender)
{
$licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow
//Custom Code @245-2A29BDB7
// -------------------------
// Write your own code here.
$licenseStatus = (int)$licensing_customerscontent->licensing->hidlicensestatus->GetValue();
$o = CCGetFromGet("o","");
if ( ($licenseStatus == 3) && ($o == "product_displacement") )
$licensing_customerscontent->licensing->pnproduct_displacement->Visible = true;
else
$licensing_customerscontent->licensing->pnproduct_displacement->Visible = false;
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow @241-F369AC9B
return $licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow;
}
//End Close licensing_customerscontent_licensing_pnproduct_displacement_BeforeShow
//Used because the last_user_id query on afterinsert was not working
$lastguid = "";
//licensing_customerscontent_licensing_BeforeInsert @154-4688020F
function licensing_customerscontent_licensing_BeforeInsert(& $sender)
{
$licensing_customerscontent_licensing_BeforeInsert = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_BeforeInsert
//Custom Code @188-2A29BDB7
// -------------------------
// Write your own code here.
$suiteId = $licensing_customerscontent->licensing->suite_code->GetValue();
$params = array();
$params["suite_id"] = $suiteId;
$products = new Alm\Products();
$suiteStatus = $products->getSuiteStatusById($params);
//Check if suite status is active or legacy before adding any new licenses to a customer
if ( ($suiteStatus["suiteStatus"] == "1") || ($suiteStatus["suiteStatus"] == "2") ) {
$guid = uuid_create();
global $lastguid;
$lastguid = $guid;
$licensing_customerscontent->licensing->created_iduser->SetValue(CCGetUserID());
$licensing_customerscontent->licensing->hidguid->SetValue($guid);
//Customer ID for the license
$customer_guid = trim($licensing_customerscontent->licensing->hidcustomer_guid->GetValue());
$db = new clsDBdbConnection();
$customer_id = CCDLookup("id","alm_customers","guid = '$customer_guid'",$db);
$db->close();
$licensing_customerscontent->licensing->hidcustomer_id->SetValue($customer_id);
//Changing license status to active when inactive and grant,expdate,expirdate are present
$grantNo = trim($licensing_customerscontent->licensing->grant_number->GetValue());
$expDate = $licensing_customerscontent->licensing->expedition_date->GetValue();
$expirDate = $licensing_customerscontent->licensing->expiration_date->GetValue();
$licenseStatus = (int)$licensing_customerscontent->licensing->hidlicensestatus->GetValue();
$licenseType = (int)$licensing_customerscontent->licensing->id_license_type->GetValue();
$o = trim($licensing_customerscontent->licensing->hido->GetValue());
$dguid = trim($licensing_customerscontent->licensing->hiddguid->GetValue());
$params = array();
$params["guid"] = $dguid;
if ($o == "renew") {
//Keeps the expired license guid reference on the new renewed license
$licensing_customerscontent->licensing->hidexpired_license_guid->SetValue($dguid);
}
//Making sure that perpetual licenses dont get expiration date values
//And change status to active if grantnumber, expiration date have values
//This changed, perpetuals will be autoactivated and user redirected to add the support license automatically
if ( ($licenseStatus == 1) && (strlen($grantNo) > 0) && (count($expDate) > 1) && (count($expirDate) > 1) ) {
if ( ($licenseType == 7) || ($licenseType == 12) )
$licensing_customerscontent->licensing->expiration_date->SetValue("");
$licensing_customerscontent->licensing->hidlicensestatus->SetValue("2");
//If renewing and new license is activated, sets expired license as archived
if ($o == "renew") {
$products = new Alm\Products();
$products->setLicenseArchivedByGuid($params);
}
} else {
//Its a perpetual license
if ( ($licenseStatus == 1) && ( ( ($licenseType == 7) || ($licenseType == 12) ) ) ) {
$licensing_customerscontent->licensing->expiration_date->SetValue("");
$licensing_customerscontent->licensing->hidlicensestatus->SetValue("2");
}
}
//Checking if its an addsupport operation to set the support parent perpetual license
$parentLicenseGuid = trim($licensing_customerscontent->licensing->hiddguid->GetValue());
$o = trim($licensing_customerscontent->licensing->hido->GetValue());
if ( ($o == "addsupport") && (strlen($parentLicenseGuid) > 0) ) {
$licensing_customerscontent->licensing->hidparent_license_guid->SetValue($parentLicenseGuid);
}
//Upgrade licensing
$o = $licensing_customerscontent->licensing->hido->GetValue();
if ( (strlen($dguid) > 0) && ($o == "upgrade_license") ) {
//Keeps the expired license guid reference on the new renewed license
$licensing_customerscontent->licensing->hidexpired_license_guid->SetValue($dguid);
$params = array();
$params["guid"] = $dguid;
$products = new Alm\Products();
$products->setLicenseArchivedByGuid($params);
}
} else {
global $CCSLocales;
$licensing_customerscontent->licensing->InsertAllowed = false;
$licensing_customerscontent->licensing->Errors->clear();
$licensing_customerscontent->licensing->Errors->addError($CCSLocales->GetText("suite_status_notactivelegacy"));
}
// -------------------------
//End Custom Code
//Close licensing_customerscontent_licensing_BeforeInsert @154-8C89F39C
return $licensing_customerscontent_licensing_BeforeInsert;
}
//End Close licensing_customerscontent_licensing_BeforeInsert
//licensing_customerscontent_licensing_AfterInsert @154-657082FF
function licensing_customerscontent_licensing_AfterInsert(& $sender)
{
$licensing_customerscontent_licensing_AfterInsert = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $licensing_customerscontent; //Compatibility
//End licensing_customerscontent_licensing_AfterInsert
//Custom Code @189-2A29BDB7
// -------------------------
// Write your own code here.
//Show message alert after saving information
CCSetSession("showalert","show");
global $lastguid;
global $FileName;
global $Redirect;
global $MainPage;
//Checking if there was a duplicity error
$errors = (Array)$sender->DataSource->Errors;
$errorcount = (int)$errors["ErrorsCount"];
if (count($errors["Errors"]) > 0)
$error = $errors["Errors"][0];
else
$error = "";
if ($errorcount >= 1) {
$position = strpos($error,"Duplicate entry");
if ( !($position === false)) {
global $CCSLocales;
//Duplicate entry error
$sender->DataSource->Errors->clear();
$sender->DataSource->Errors->addError($CCSLocales->GetText("duplicate_record"));
//Not showuing the saving popup
CCSetSession("showalert","hide");
}
}
$customer_guid = trim($licensing_customerscontent->licensing->hidcustomer_guid->GetValue());
//Getting querystring parameter to include in redirect, redirect will set licensing to add mode even when editing
//$querystring = CCGetFromPost("querystring","");
$Redirect = $FileName."?guid=$customer_guid&tab=licenselist";