Odyssey
2019070900_ccloadSupport.php
1 <?php
2 /**
3  * Notes:
4  * 1. Anything complicated needs to be done with SQL.
5  * 2. Always have a check to know if the migration needs to occur (up or down).
6  * 3. Use up() and down(), not change(), because of the SQL
7  */
8 use Phinx\Migration\AbstractMigration;
9 
10 class CcloadSupport extends AbstractMigration {
11  public function up() {
12  $tableName = "cucmsdocs";
13  // Check for table
14  if ($this->hasTable($tableName)) {
15  $index = 169;
16  $section = "Credit Card";
17  $doctype = 4;
18 
19  $fbgDesc = "CCard Presentation Script.";
20  $cfgDesc = "Client specific Credit Card configuration file.";
21  $disclaimerDesc = "Disclaimer.";
22 
23  $vendor = "SYMITAR_CUSTOM";
24  $sort = 1;
25  $loadDesc = "Custom credit card include routines for $vendor core applications.";
26  $filterDesc = "Custom credit card prefiltering program for $vendor core applications.";
27  $sql = "insert into $tableName (docsid, docsname, docsdesc, docstype, docstitle, docsmaintsection, docsmaintsort)
28  values (" . $index++ . ", 'ccardFBG.pl', '$fbgDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
29  (" . $index++ . ", 'ccardload.cfg', '$cfgDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
30  (" . $index++ . ", 'ccardload.pi', '$loadDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
31  (" . $index++ . ", 'ccardloadprefltr.pl', '$filterDesc', $doctype, '$vendor', '$section', " . $sort++ . ")";
32  $this->query($sql);
33 
34  $vendor = "XPSystems";
35  $sort = 1;
36  $loadDesc = "Custom credit card include routines for $vendor core applications.";
37  $filterDesc = "Custom credit card prefiltering program for $vendor core applications.";
38  $sql = "insert into $tableName (docsid, docsname, docsdesc, docstype, docstitle, docsmaintsection, docsmaintsort)
39  values (" . $index++ . ", 'ccardload.cfg', '$cfgDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
40  (" . $index++ . ", 'ccardload.pi', '$loadDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
41  (" . $index++ . ", 'ccardloadprefltr.pl', '$filterDesc', $doctype, '$vendor', '$section', " . $sort++ . "),
42  (" . $index++ . ", 'disclaimerCC', '$disclaimerDesc', $doctype, '$vendor', 'Disclosure', " . $sort++ . ")";
43  $this->query($sql);
44 
45  // Change "Extra" section to "Disclosure"
46  $sql = "update $tableName
47  set docsmaintsection = 'Disclosure'
48  where docsmaintsection = 'Extra' and docstype = $doctype";
49  $this->query($sql);
50 
51  // Update description for the statement version of the FBG file.
52  $sql = "update $tableName
53  set docsdesc = 'Stmnt Presentation Script.'
54  where docsname = 'stmntFBG.pl' and docstype = $doctype";
55  $this->query($sql);
56  }
57  }
58 
59  public function down() {
60 
61  }
62 }