Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| zbsDAL_addresses | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
56 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
56 | |||
| 1 | <?php |
| 2 | /* |
| 3 | * Jetpack CRM |
| 4 | * https://jetpackcrm.com |
| 5 | * V3.0+ |
| 6 | * |
| 7 | * Copyright 2020 Automattic |
| 8 | * |
| 9 | * Date: 05/07/19 |
| 10 | */ |
| 11 | |
| 12 | defined( 'ZEROBSCRM_PATH' ) || exit( 0 ); |
| 13 | |
| 14 | /** |
| 15 | * ZBS DAL >> Addresses |
| 16 | * |
| 17 | * @author Woody Hayday <hello@jetpackcrm.com> |
| 18 | * @version 2.0 |
| 19 | * @access public |
| 20 | * @see https://jetpackcrm.com/kb |
| 21 | */ |
| 22 | class zbsDAL_addresses extends zbsDAL_ObjectLayer { |
| 23 | |
| 24 | protected $objectType = ZBS_TYPE_ADDRESS; |
| 25 | // protected $objectDBPrefix = 'zbsadd_'; |
| 26 | protected $include_in_templating = true; |
| 27 | protected $objectModel = array( |
| 28 | |
| 29 | // ID |
| 30 | 'ID' => array( |
| 31 | 'fieldname' => 'ID', |
| 32 | 'format' => 'int', |
| 33 | ), |
| 34 | |
| 35 | // site + team generics |
| 36 | 'zbs_site' => array( |
| 37 | 'fieldname' => 'zbs_site', |
| 38 | 'format' => 'int', |
| 39 | ), |
| 40 | 'zbs_team' => array( |
| 41 | 'fieldname' => 'zbs_team', |
| 42 | 'format' => 'int', |
| 43 | ), |
| 44 | 'zbs_owner' => array( |
| 45 | 'fieldname' => 'zbs_owner', |
| 46 | 'format' => 'int', |
| 47 | ), |
| 48 | |
| 49 | // other fields |
| 50 | 'addr1' => array( |
| 51 | // db model: |
| 52 | 'fieldname' => 'zbsa_addr1', |
| 53 | 'format' => 'str', |
| 54 | // output model |
| 55 | 'input_type' => 'text', |
| 56 | 'label' => 'Address Line 1', |
| 57 | 'placeholder' => '', |
| 58 | ), |
| 59 | 'addr2' => array( |
| 60 | // db model: |
| 61 | 'fieldname' => 'zbsa_addr2', |
| 62 | 'format' => 'str', |
| 63 | // output model |
| 64 | 'input_type' => 'text', |
| 65 | 'label' => 'Address Line 2', |
| 66 | 'placeholder' => '', |
| 67 | ), |
| 68 | 'city' => array( |
| 69 | // db model: |
| 70 | 'fieldname' => 'zbsa_city', |
| 71 | 'format' => 'str', |
| 72 | // output model |
| 73 | 'input_type' => 'text', |
| 74 | 'label' => 'City', |
| 75 | 'placeholder' => 'e.g. New York', |
| 76 | ), |
| 77 | 'county' => array( |
| 78 | // db model: |
| 79 | 'fieldname' => 'zbsa_county', |
| 80 | 'format' => 'str', |
| 81 | // output model |
| 82 | 'input_type' => 'text', |
| 83 | 'label' => 'County', |
| 84 | 'placeholder' => 'e.g. Kings County', |
| 85 | ), |
| 86 | 'postcode' => array( |
| 87 | // db model: |
| 88 | 'fieldname' => 'zbsa_postcode', |
| 89 | 'format' => 'str', |
| 90 | // output model |
| 91 | 'input_type' => 'text', |
| 92 | 'label' => 'Post Code', |
| 93 | 'placeholder' => 'e.g. 10019', |
| 94 | ), |
| 95 | 'country' => array( |
| 96 | // db model: |
| 97 | 'fieldname' => 'zbsa_country', |
| 98 | 'format' => 'str', |
| 99 | // output model |
| 100 | 'input_type' => 'selectcountry', |
| 101 | 'label' => 'Country', |
| 102 | 'placeholder' => '', |
| 103 | ), |
| 104 | |
| 105 | 'created' => array( |
| 106 | 'fieldname' => 'zbsa_created', |
| 107 | 'format' => 'uts', |
| 108 | ), |
| 109 | 'lastupdated' => array( |
| 110 | 'fieldname' => 'zbsa_lastupdated', |
| 111 | 'format' => 'uts', |
| 112 | ), |
| 113 | |
| 114 | ); |
| 115 | |
| 116 | function __construct( $args = array() ) { |
| 117 | |
| 118 | #} =========== LOAD ARGS ============== |
| 119 | $defaultArgs = array( |
| 120 | |
| 121 | // 'tag' => false, |
| 122 | |
| 123 | ); |
| 124 | foreach ( $defaultArgs as $argK => $argV ) { |
| 125 | $this->$argK = $argV; |
| 126 | if ( is_array( $args ) && isset( $args[ $argK ] ) ) { |
| 127 | if ( is_array( $args[ $argK ] ) ) { |
| 128 | $newData = $this->$argK; |
| 129 | if ( ! is_array( $newData ) ) { |
| 130 | $newData = array(); |
| 131 | } foreach ( $args[ $argK ] as $subK => $subV ) { |
| 132 | $newData[ $subK ] = $subV; |
| 133 | }$this->$argK = $newData; |
| 134 | } else { |
| 135 | $this->$argK = $args[ $argK ]; } |
| 136 | } |
| 137 | } |
| 138 | #} =========== / LOAD ARGS ============= |
| 139 | } |
| 140 | |
| 141 | // =============================================================================== |
| 142 | // =========== ADDRESS ======================================================== |
| 143 | |
| 144 | /* |
| 145 | Addresses as distinct objects didn't make the v3.0 cut. |
| 146 | They'd be a valid area for expansion post v3.0. |
| 147 | |
| 148 | This file is here as a precursor, and is used by the 3.0 migration routine |
| 149 | to stop custom field keys colliding with field names (the obj model above) |
| 150 | (function zeroBSCRM_AJAX_dbMigration300open()) |
| 151 | |
| 152 | |
| 153 | */ |
| 154 | |
| 155 | // =========== / ADDRESS ===================================================== |
| 156 | // =============================================================================== |
| 157 | } // / class |