@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | private function read_object($person) : bool |
| 142 | 142 | { |
| 143 | - if ( !is_object($person) |
|
| 143 | + if (!is_object($person) |
|
| 144 | 144 | || !$person instanceof midcom_db_person) { |
| 145 | 145 | // Given $person is not one |
| 146 | 146 | return false; |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( $this->_config->get('jabber_enable_presence') |
|
| 167 | + if ($this->_config->get('jabber_enable_presence') |
|
| 168 | 168 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
| 169 | 169 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if ( $this->_config->get('skype_enable_presence') |
|
| 172 | + if ($this->_config->get('skype_enable_presence') |
|
| 173 | 173 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
| 174 | 174 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
| 175 | 175 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | if (!empty($attachments[$type])) { |
| 209 | 209 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
| 210 | 210 | } |
| 211 | - if ( $this->_config->get('gravatar_enable') |
|
| 211 | + if ($this->_config->get('gravatar_enable') |
|
| 212 | 212 | && !empty($this->contact_details['email'])) { |
| 213 | 213 | $size = ($type == 'view') ? 500 : 32; |
| 214 | 214 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | private function _show_groups() |
| 322 | 322 | { |
| 323 | - if ( !$this->show_groups |
|
| 323 | + if (!$this->show_groups |
|
| 324 | 324 | || empty($this->contact_details['id'])) { |
| 325 | 325 | return; |
| 326 | 326 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $default_shown = true; |
| 386 | 386 | $cards_to_show[] = $cardname; |
| 387 | 387 | } |
| 388 | - } elseif ( $customer->$property |
|
| 388 | + } elseif ($customer->$property |
|
| 389 | 389 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
| 390 | 390 | $inherited_cards_only = false; |
| 391 | 391 | $multiple_addresses = true; |
@@ -406,8 +406,8 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | foreach ($cards_to_show as $cardname) { |
| 408 | 408 | echo '<div class="vcard">'; |
| 409 | - if ( $multiple_addresses |
|
| 410 | - || ( $cardname != 'visiting' |
|
| 409 | + if ($multiple_addresses |
|
| 410 | + || ($cardname != 'visiting' |
|
| 411 | 411 | && !$inherited_cards_only)) { |
| 412 | 412 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
| 413 | 413 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | |
| 63 | 63 | private function get_units($units = false) : float |
| 64 | 64 | { |
| 65 | - if ( $this->_deliverable->invoiceByActualUnits |
|
| 65 | + if ($this->_deliverable->invoiceByActualUnits |
|
| 66 | 66 | || $this->_deliverable->plannedUnits == 0) { |
| 67 | 67 | // In most cases we calculate the price based on the actual units entered |
| 68 | 68 | return $units ?: $this->_deliverable->units; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | $this->calculate_price(false); |
| 83 | 83 | |
| 84 | - if ( $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 84 | + if ($this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION |
|
| 85 | 85 | && $this->continuous == true) { |
| 86 | 86 | $this->end = 0; |
| 87 | 87 | } elseif ($this->end < $this->start) { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | $calculator->run($this); |
| 170 | 170 | $cost = $calculator->get_cost(); |
| 171 | 171 | $price = $calculator->get_price(); |
| 172 | - if ( $price != $this->price |
|
| 172 | + if ($price != $this->price |
|
| 173 | 173 | || $cost != $this->cost) { |
| 174 | 174 | $this->price = $price; |
| 175 | 175 | $this->cost = $cost; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $units = $agreement_hours['invoiceable']; |
| 217 | 217 | $uninvoiceableUnits = $agreement_hours['reported'] - ($agreement_hours['invoiceable'] + $agreement_hours['invoiced']); |
| 218 | 218 | |
| 219 | - if ( $units != $this->units |
|
| 219 | + if ($units != $this->units |
|
| 220 | 220 | || $uninvoiceableUnits != $this->uninvoiceableUnits) { |
| 221 | 221 | debug_add("agreement values have changed, setting units to " . $units . ", uninvoiceable: " . $uninvoiceableUnits); |
| 222 | 222 | $this->units = $units; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function invoice() : bool |
| 272 | 272 | { |
| 273 | - if ( $this->state >= self::STATE_INVOICED |
|
| 273 | + if ($this->state >= self::STATE_INVOICED |
|
| 274 | 274 | || $this->orgOpenpsaObtype == org_openpsa_products_product_dba::DELIVERY_SUBSCRIPTION) { |
| 275 | 275 | return false; |
| 276 | 276 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) : self |
| 62 | 62 | { |
| 63 | 63 | if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
| 64 | - // check if the customerContact is set and has invoice_data |
|
| 64 | + // check if the customerContact is set and has invoice_data |
|
| 65 | 65 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
| 66 | 66 | $bd = new self(); |
| 67 | 67 | $due = midcom_baseclasses_components_configuration::get('org.openpsa.invoices', 'config')->get('default_due_days'); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) : self |
| 62 | 62 | { |
| 63 | - if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
| 63 | + if (!($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
| 64 | 64 | // check if the customerContact is set and has invoice_data |
| 65 | 65 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
| 66 | 66 | $bd = new self(); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | private function load_controller(org_openpsa_invoices_billing_data_dba $bd) : controller |
| 34 | 34 | { |
| 35 | 35 | $schemadb = schemadb::from_path($this->_config->get('schemadb_billing_data')); |
| 36 | - $vat =& $schemadb->get('default')->get_field('vat'); |
|
| 36 | + $vat = & $schemadb->get('default')->get_field('vat'); |
|
| 37 | 37 | // Fill VAT select |
| 38 | 38 | $vat_array = explode(',', $this->_config->get('vat_percentages')); |
| 39 | 39 | if (!empty($vat_array)) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $data['controller'] = $this->load_controller($bd); |
| 83 | 83 | |
| 84 | 84 | $workflow = $this->get_workflow('datamanager', ['controller' => $data['controller']]); |
| 85 | - if ( $mode == 'edit' |
|
| 85 | + if ($mode == 'edit' |
|
| 86 | 86 | && $bd->can_do('midgard:delete')) { |
| 87 | 87 | $delete = $this->get_workflow('delete', [ |
| 88 | 88 | 'object' => $bd, |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function write_acls(midcom_core_dbaobject $object, $owner_id, $accesstype) : bool |
| 17 | 17 | { |
| 18 | - if ( empty($owner_id) |
|
| 18 | + if (empty($owner_id) |
|
| 19 | 19 | || empty($accesstype)) { |
| 20 | 20 | return false; |
| 21 | 21 | } |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | if ($privileges) { |
| 65 | 65 | foreach ($privileges as $privilege) { |
| 66 | - if ( !empty($needed_privileges[$privilege->privilegename]) |
|
| 66 | + if (!empty($needed_privileges[$privilege->privilegename]) |
|
| 67 | 67 | && $needed_privileges[$privilege->privilegename]['assignee'] == $privilege->assignee |
| 68 | 68 | && $needed_privileges[$privilege->privilegename]['value'] == $privilege->value) { |
| 69 | 69 | unset($needed_privileges[$privilege->privilegename]); |
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | // Clear old ACLs applying to others than current user or selected owner group |
| 73 | - if ( $privilege->assignee != midcom::get()->auth->user->id |
|
| 73 | + if ($privilege->assignee != midcom::get()->auth->user->id |
|
| 74 | 74 | && $privilege->assignee != $owner_id) { |
| 75 | 75 | debug_add("Removing privilege {$privilege->privilegename} from {$privilege->assignee}"); |
| 76 | 76 | $object->unset_privilege($privilege->privilegename, $privilege->assignee); |
@@ -40,31 +40,31 @@ |
||
| 40 | 40 | return $output; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * @param midcom_core_dbaobject $object The object we're working on |
|
| 45 | - * @param string $field The schema field name |
|
| 46 | - * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
| 47 | - */ |
|
| 48 | - public static function get_dm2_attachments($object, $field) : array |
|
| 49 | - { |
|
| 50 | - $attachments = []; |
|
| 51 | - $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
| 52 | - if (empty($identifiers)) { |
|
| 53 | - return $attachments; |
|
| 54 | - } |
|
| 55 | - foreach ($identifiers as $identifier) { |
|
| 56 | - $parts = explode(':', $identifier); |
|
| 57 | - if (count($parts) != 2) { |
|
| 58 | - continue; |
|
| 59 | - } |
|
| 60 | - $guid = $parts[1]; |
|
| 61 | - try { |
|
| 62 | - $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
| 63 | - } catch (midcom_error $e) { |
|
| 64 | - $e->log(); |
|
| 65 | - } |
|
| 66 | - } |
|
| 43 | + /** |
|
| 44 | + * @param midcom_core_dbaobject $object The object we're working on |
|
| 45 | + * @param string $field The schema field name |
|
| 46 | + * @return midcom_db_attachment[] List of attachments, indexed by identifier |
|
| 47 | + */ |
|
| 48 | + public static function get_dm2_attachments($object, $field) : array |
|
| 49 | + { |
|
| 50 | + $attachments = []; |
|
| 51 | + $identifiers = explode(',', $object->get_parameter('midcom.helper.datamanager2.type.blobs', 'guids_' . $field)); |
|
| 52 | + if (empty($identifiers)) { |
|
| 53 | + return $attachments; |
|
| 54 | + } |
|
| 55 | + foreach ($identifiers as $identifier) { |
|
| 56 | + $parts = explode(':', $identifier); |
|
| 57 | + if (count($parts) != 2) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 60 | + $guid = $parts[1]; |
|
| 61 | + try { |
|
| 62 | + $attachments[$parts[0]] = midcom_db_attachment::get_cached($guid); |
|
| 63 | + } catch (midcom_error $e) { |
|
| 64 | + $e->log(); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return $attachments; |
|
| 69 | - } |
|
| 68 | + return $attachments; |
|
| 69 | + } |
|
| 70 | 70 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | private function _get_invoices_for_subscription($deliverable, $at_entry) : array |
| 66 | 66 | { |
| 67 | - if ( $deliverable->invoiceByActualUnits |
|
| 67 | + if ($deliverable->invoiceByActualUnits |
|
| 68 | 68 | && $at_entry->arguments['cycle'] > 1) { |
| 69 | 69 | $invoice_sum = $deliverable->invoiced / ($at_entry->arguments['cycle'] - 1); |
| 70 | 70 | if ($invoice_sum == 0) { |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | $time = $at_entry->start; |
| 81 | 81 | $scheduler = new org_openpsa_invoices_scheduler($deliverable); |
| 82 | 82 | |
| 83 | - while ( $time < $this->_request_data['end'] |
|
| 84 | - && ( $time < $deliverable->end |
|
| 83 | + while ($time < $this->_request_data['end'] |
|
| 84 | + && ($time < $deliverable->end |
|
| 85 | 85 | || $deliverable->continuous)) { |
| 86 | 86 | $invoices[] = $this->get_invoice_for_deliverable($deliverable, $invoice_sum, $time, $calculation_base); |
| 87 | 87 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | foreach ($qb->execute() as $at_entry) { |
| 124 | 124 | try { |
| 125 | 125 | $deliverable = org_openpsa_sales_salesproject_deliverable_dba::get_cached($at_entry->arguments['deliverable']); |
| 126 | - if ( $deliverable->continuous |
|
| 127 | - || ( $deliverable->start < $this->_request_data['end'] |
|
| 126 | + if ($deliverable->continuous |
|
| 127 | + || ($deliverable->start < $this->_request_data['end'] |
|
| 128 | 128 | && $deliverable->end > $this->_request_data['start'])) { |
| 129 | 129 | $invoices = array_merge($invoices, $this->_get_invoices_for_subscription($deliverable, $at_entry)); |
| 130 | 130 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | private function add_misc_rule(array $rule, $class, $person_property) : bool |
| 319 | 319 | { |
| 320 | - $persons = [ 0 => -1]; |
|
| 320 | + $persons = [0 => -1]; |
|
| 321 | 321 | $match = $rule['match']; |
| 322 | 322 | $constraint_match = "IN"; |
| 323 | 323 | if ($rule['match'] == '<>') { |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $ret = []; |
| 394 | 394 | |
| 395 | 395 | foreach ($object->get_properties() as $property) { |
| 396 | - if ( preg_match('/^_/', $property) |
|
| 396 | + if (preg_match('/^_/', $property) |
|
| 397 | 397 | || in_array($property, $skip_properties) |
| 398 | 398 | || property_exists($object, $property)) { |
| 399 | 399 | // Skip private or otherwise invalid properties |