示例#1
0
文件: view.php 项目: nemein/openpsa
 /**
  * Helper function that populates the toolbar with the necessary items
  *
  * @param string $handler_id the ID of the current handler
  */
 private function _populate_toolbar($handler_id)
 {
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "person/edit/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:update'), MIDCOM_TOOLBAR_ACCESSKEY => 'e'));
     $siteconfig = org_openpsa_core_siteconfig::get_instance();
     $invoices_url = $siteconfig->get_node_full_url('org.openpsa.invoices');
     $user_url = $siteconfig->get_node_full_url('org.openpsa.user');
     if ($invoices_url && midcom::get('auth')->can_user_do('midgard:create', null, 'org_openpsa_invoices_invoice_dba')) {
         $billing_data_url = "create/" . $this->_contact->guid . "/";
         $qb_billing_data = org_openpsa_invoices_billing_data_dba::new_query_builder();
         $qb_billing_data->add_constraint('linkGuid', '=', $this->_contact->guid);
         $billing_data = $qb_billing_data->execute();
         if (count($billing_data) > 0) {
             $billing_data_url = $billing_data[0]->guid . "/";
         }
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $invoices_url . "billingdata/" . $billing_data_url, MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('edit billingdata'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:update')));
     }
     if ($user_url && (midcom_connection::get_user() == $this->_contact->id || midcom::get('auth')->can_user_do('org.openpsa.user:access', null, 'org_openpsa_user_interface'))) {
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => $user_url . "view/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => midcom::get('i18n')->get_string('user management', 'org.openpsa.user'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png'));
     }
     $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "person/delete/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png', MIDCOM_TOOLBAR_ENABLED => $this->_contact->can_do('midgard:delete'), MIDCOM_TOOLBAR_ACCESSKEY => 'd'));
     $mycontacts = new org_openpsa_contacts_mycontacts();
     if ($mycontacts->is_member($this->_contact->guid)) {
         // We're buddies, show remove button
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "mycontacts/remove/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('remove from my contacts'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png'));
     } else {
         // We're not buddies, show add button
         $this->_view_toolbar->add_item(array(MIDCOM_TOOLBAR_URL => "mycontacts/add/{$this->_contact->guid}/", MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('add to my contacts'), MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person.png'));
     }
 }
示例#2
0
文件: create.php 项目: nemein/openpsa
 /**
  * This is what Datamanager calls to actually create a person
  */
 public function &dm2_create_callback(&$datamanager)
 {
     $person = new org_openpsa_contacts_person_dba();
     if (!$person->create()) {
         debug_print_r('We operated on this object:', $person);
         throw new midcom_error("Failed to create a new person, cannot continue. Error: " . midcom_connection::get_error_string());
     }
     $this->_person =& $person;
     return $person;
 }
示例#3
0
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_remove($handler_id, array $args, array &$data)
 {
     $target = org_openpsa_contacts_person_dba::get_cached($args[0]);
     $mycontacts = new org_openpsa_contacts_mycontacts();
     $mycontacts->remove($args[0]);
     return new midcom_response_relocate("person/{$target->guid}/");
 }
示例#4
0
 public function __construct($rules = false)
 {
     // if querybuilder is used response-time will increase -> set_key_property hast to be removed
     $this->_result_mc = org_openpsa_contacts_person_dba::new_collector('metadata.deleted', false);
     if ($rules) {
         return $this->resolve($rules);
     }
 }
示例#5
0
 public function testCRUD()
 {
     midcom::get('auth')->request_sudo('org.openpsa.contacts');
     $person = new org_openpsa_contacts_person_dba();
     $person->lastname = 'TEST PERSON ' . __CLASS__;
     $stat = $person->create();
     $this->assertTrue($stat);
     $this->register_object($person);
     $this->assertEquals(org_openpsa_contacts_person_dba::TYPE_PERSON, $person->orgOpenpsaObtype);
     $this->assertEquals('rname', $person->get_label_property());
     $person->firstname = 'FIRSTNAME';
     $stat = $person->update();
     $this->assertTrue($stat);
     $this->assertEquals('TEST PERSON ' . __CLASS__ . ', FIRSTNAME', $person->get_label());
     $stat = $person->delete();
     $this->assertTrue($stat);
     midcom::get('auth')->drop_sudo();
 }
示例#6
0
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_notifications($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_user_do('org.openpsa.user:manage', null, 'org_openpsa_user_interface');
     $person = new org_openpsa_contacts_person_dba($args[0]);
     $person->require_do('midgard:update');
     $controller = $this->get_controller('simple', $person);
     switch ($controller->process_form()) {
         case 'save':
             // Fall-through
         // Fall-through
         case 'cancel':
             return new midcom_response_relocate("view/" . $person->guid . "/");
     }
     $data['notifications_dm'] =& $controller;
     $data['object'] = $person;
     midcom::get('head')->set_pagetitle($person->get_label() . ": " . $this->_l10n->get("notification settings"));
     $this->add_breadcrumb('view/' . $person->guid . '/', $person->get_label());
     $this->add_breadcrumb("", $this->_l10n->get("notification settings"));
     org_openpsa_helpers::dm2_savecancel($this);
 }
示例#7
0
 private function get_person_qb($kept = false)
 {
     $qb = org_openpsa_contacts_person_dba::new_query_builder();
     if ($kept) {
         $qb->begin_group('OR');
         $qb->add_constraint('metadata.revised', '>=', $this->get_deletion_timestamp());
         $qb->add_constraint('username', '<>', '');
         $qb->end_group();
     } else {
         $qb->add_constraint('metadata.revised', '<', $this->get_deletion_timestamp());
         // Don't delete OpenPSA users
         $qb->add_constraint('username', '=', '');
     }
     return $qb;
 }
示例#8
0
 /**
  * Find duplicates for given all org_openpsa_contacts_person_dba objects in database
  *
  * @return array array of persons with their possible duplicates
  */
 function check_all_persons($threshold = 1)
 {
     midcom::get()->disable_limits();
     // PONDER: Can we do this in smaller batches using find_duplicated_person
     /*
       IDEA: Make an AT method for checking single persons duplicates, then another to batch
       register a check for every person in batches of say 500.
     */
     $ret = array();
     $ret['objects'] = array();
     $ret['p_map'] = array();
     $ret['threshold'] =& $threshold;
     $persons = array();
     $mc = org_openpsa_contacts_person_dba::new_collector('metadata.deleted', false);
     $mc->add_value_property('firstname');
     $mc->add_value_property('id');
     $mc->add_value_property('lastname');
     $mc->add_value_property('email');
     $mc->add_value_property('handphone');
     $mc->add_value_property('homephone');
     $mc->add_value_property('city');
     $mc->add_value_property('street');
     $mc->execute();
     $results = $mc->list_keys();
     if (empty($results)) {
         return $ret;
     }
     foreach ($results as $guid => $result) {
         $person = $mc->get($guid);
         $persons[] = self::_normalize_person_fields($person, $guid);
     }
     $params = array();
     $params['ret'] =& $ret;
     $params['finder'] =& $this;
     $params['objects'] =& $persons;
     $params['mode'] = 'person';
     array_walk($persons, array('self', '_check_all_arraywalk'), $params);
     return $ret;
 }
示例#9
0
    try {
        $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer);
        $entry['index_customer'] = $customer->official;
        if ($data['invoices_url']) {
            $entry['customer'] = "<a href=\"{$data['invoices_url']}list/customer/all/{$customer->guid}/\" title=\"{$customer->name}: {$customer->official}\">{$customer->official}</a>";
        } else {
            $entry['customer'] = $customer->official;
        }
    } catch (midcom_error $e) {
        $entry['customer'] = '';
        $entry['index_customer'] = '';
    }
    $entry['index_contact'] = '';
    $entry['contact'] = '';
    try {
        $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact);
        $entry['index_contact'] = $contact->rname;
        $contact_card = org_openpsa_widgets_contact::get($invoice->customerContact);
        $entry['contact'] = $contact_card->show_inline();
    } catch (midcom_error $e) {
    }
    $entry['sum'] = $invoice->sum;
    $entry['index_vat'] = $invoice->vat;
    $entry['vat'] = $invoice->vat . ' %';
    $entry['vat_sum'] = $vat_sum;
    $entries[] = $entry;
}
echo '<script type="text/javascript">//<![CDATA[';
echo "\nvar " . $grid_id . '_entries = ' . json_encode($entries);
echo "\n//]]></script>";
?>
示例#10
0
文件: main.php 项目: nemein/openpsa
 /**
  * Retrieve a reference to an object, uses in-request caching
  *
  * @param mixed $src GUID of object (ids work but are discouraged)
  * @return mixed reference to device object or false
  */
 static function &get($src)
 {
     static $cache = array();
     if (isset($cache[$src])) {
         return $cache[$src];
     }
     try {
         if (class_exists('org_openpsa_contacts_person_dba')) {
             $person = org_openpsa_contacts_person_dba::get_cached($src);
         } else {
             $person = new midcom_db_person($src);
         }
     } catch (midcom_error $e) {
         $widget = new self();
         $cache[$src] = $widget;
         return $widget;
     }
     $widget = new self($person);
     $cache[$person->guid] = $widget;
     $cache[$person->id] =& $cache[$person->guid];
     return $cache[$person->guid];
 }
示例#11
0
     if ($customer = $salesproject->get_customer()) {
         $label = $customer->get_label();
         $row['index_customer'] = $label;
         if ($data['contacts_url']) {
             $type = 'group';
             if (is_a($customer, 'org_openpsa_contacts_person_dba')) {
                 $type = 'person';
             }
             $row['customer'] = "<a href=\"{$data['contacts_url']}{$type}/{$customer->guid}/\">{$label}</a>";
         } else {
             $row['customer'] = $label;
         }
     }
 }
 try {
     $owner = org_openpsa_contacts_person_dba::get_cached($salesproject->owner);
     $owner_widget = org_openpsa_widgets_contact::get($salesproject->owner);
     $row['index_owner'] = $owner->rname;
     $row['owner'] = $owner_widget->show_inline();
 } catch (midcom_error $e) {
     $row['index_owner'] = '';
     $row['owner'] = '';
 }
 $row['index_closeest'] = '';
 $row['closeest'] = '';
 if ($salesproject->closeEst) {
     $row['index_closeest'] = $salesproject->closeEst;
     $row['closeest'] = strftime("%x", $salesproject->closeEst);
 }
 $row['index_value'] = $salesproject->value;
 $row['value'] = org_openpsa_helpers::format_number($salesproject->value);
示例#12
0
文件: export.php 项目: nemein/openpsa
 private function _process_member($member)
 {
     $adder = array();
     $adder['campaign_member'] = $member;
     try {
         $adder['person'] = org_openpsa_contacts_person_dba::get_cached($member->person);
     } catch (midcom_error $e) {
         $e->log();
         return false;
     }
     $qb_memberships = midcom_db_member::new_query_builder();
     $qb_memberships->add_constraint('uid', '=', $member->person);
     $memberships = $qb_memberships->execute_unchecked();
     if (!is_array($memberships) || count($memberships) == 0) {
         return $adder;
     }
     switch ($this->membership_mode) {
         case 'all':
             foreach ($memberships as $k2 => $membership) {
                 $adder['organization_member'] = $membership;
                 try {
                     $adder['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid);
                 } catch (midcom_error $e) {
                     debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN);
                     return false;
                 }
                 return $adder;
             }
             break;
         default:
             // Fall-trough intentional
         // Fall-trough intentional
         case 'first':
             // Fall-trough intentional
         // Fall-trough intentional
         case 'last':
             foreach ($memberships as $k2 => $membership) {
                 $adder['organization_member'] = $membership;
                 try {
                     $adder['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid);
                 } catch (midcom_error $e) {
                     debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN);
                     return false;
                 }
                 // Get only first or last membership
                 if ($this->membership_mode != 'last') {
                     break;
                 }
             }
             return $adder;
             break;
     }
 }
示例#13
0
文件: event.php 项目: nemein/openpsa
 /**
  * Returns a comma separated list of persons from array
  */
 function implode_members($array)
 {
     if (!is_array($array)) {
         debug_add('input was not an array, aborting', MIDCOM_LOG_ERROR);
         return false;
     }
     $str = '';
     reset($array);
     $cnt = count($array) - 1;
     $i = 0;
     foreach ($array as $pid => $bool) {
         $person = org_openpsa_contacts_person_dba::get_cached($pid);
         debug_add('pid: ' . $pid . ', person->id: ' . $person->id . ', person->firstname: ' . $person->firstname . ', person->lastname: ' . $person->lastname . ', person->name: ' . $person->name . ', person->rname: ' . $person->rname);
         $str .= $person->name;
         if ($i != $cnt) {
             $str .= ', ';
         }
         $i++;
     }
     return $str;
 }
示例#14
0
文件: report.php 项目: nemein/openpsa
 private function _get_link_data($segmentation_param)
 {
     $this->_request_data['report']['link_data'] = array();
     $link_data =& $this->_request_data['report']['link_data'];
     $link_data['counts'] = array();
     $link_data['percentages'] = array('of_links' => array(), 'of_recipients' => array());
     $link_data['rules'] = array();
     $link_data['tokens'] = array();
     if ($segmentation_param) {
         $link_data['segments'] = array();
     }
     $segment_prototype = array();
     $segment_prototype['counts'] = array();
     $segment_prototype['percentages'] = array('of_links' => array(), 'of_recipients' => array());
     $segment_prototype['rules'] = array();
     $segment_prototype['tokens'] = array();
     $qb_links = org_openpsa_directmarketing_link_log_dba::new_query_builder();
     $qb_links->add_constraint('message', '=', $this->_request_data['message']->id);
     $qb_links->add_constraint('target', 'NOT LIKE', '%unsubscribe%');
     $links = $qb_links->execute_unchecked();
     $link_data['total'] = count($links);
     foreach ($links as $link) {
         $segment = '';
         $segment_notfound = false;
         if ($segmentation_param && !empty($link->person)) {
             try {
                 $person = org_openpsa_contacts_person_dba::get_cached($link->person);
                 $segment = $person->parameter('org.openpsa.directmarketing.segments', $segmentation_param);
             } catch (midcom_error $e) {
             }
             if (empty($segment)) {
                 $segment = $this->_l10n->get('no segment');
                 $segment_notfound = true;
             }
             if (!isset($link_data['segments'][$segment])) {
                 $link_data['segments'][$segment] = $segment_prototype;
             }
             $segment_data =& $link_data['segments'][$segment];
         } else {
             $segment_data = $segment_prototype;
         }
         $this->_increment_totals($link_data, $link);
         $this->_increment_totals($segment_data, $link);
         $this->_calculate_percentages($link_data, $link);
         $this->_calculate_percentages($segment_data, $link);
         if (!isset($link_data['rules'][$link->target])) {
             $link_data['rules'][$link->target] = array('comment' => sprintf($this->_l10n->get('all persons who have clicked on link "%s" in message #%d and have not unsubscribed from campaign #%d'), $link->target, $link->message, $this->_request_data['message']->campaign), 'type' => 'AND', 'classes' => array(array('comment' => $this->_l10n->get('link and message limits'), 'type' => 'AND', 'class' => 'org_openpsa_directmarketing_link_log_dba', 'rules' => array(array('property' => 'target', 'match' => '=', 'value' => $link->target), array('property' => 'message', 'match' => '=', 'value' => $link->message))), array('comment' => $this->_l10n->get('not-unsubscribed -limits'), 'type' => 'AND', 'class' => 'org_openpsa_directmarketing_campaign_member_dba', 'rules' => array(array('property' => 'orgOpenpsaObtype', 'match' => '<>', 'value' => org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED), array('property' => 'campaign', 'match' => '=', 'value' => $this->_request_data['message']->campaign)))));
         }
         if (!isset($segment_data['rules'][$link->target])) {
             $segment_data['rules'][$link->target] = $link_data['rules'][$link->target];
             if (!$segment_notfound) {
                 $segmentrule = array('comment' => $this->_l10n->get('segment limits'), 'type' => 'AND', 'class' => 'org_openpsa_contacts_person_dba', 'rules' => array(array('property' => 'parameter.domain', 'match' => '=', 'value' => 'org.openpsa.directmarketing.segments'), array('property' => 'parameter.name', 'match' => '=', 'value' => $segmentation_param), array('property' => 'parameter.value', 'match' => '=', 'value' => $segment)));
                 // On a second thought, we cannot query for empty parameter values...
                 $segment_data['rules'][$link->target]['comment'] = sprintf($this->_l10n->get('all persons in market segment "%s" who have clicked on link "%s" in message #%d and have not unsubscribed from campaign #%d'), $segment, $link->target, $link->message, $this->_request_data['message']->campaign);
                 $segment_data['rules'][$link->target]['classes'][] = $segment;
             }
         }
     }
     arsort($link_data['counts']);
     arsort($link_data['percentages']['of_links']);
     arsort($link_data['percentages']['of_recipients']);
     if ($segmentation_param) {
         ksort($link_data['segments']);
         foreach ($link_data['segments'] as $segment => $dummy) {
             $segment_data =& $link_data['segments'][$segment];
             arsort($segment_data['counts']);
             arsort($segment_data['percentages']['of_links']);
             arsort($segment_data['percentages']['of_recipients']);
         }
     }
 }
示例#15
0
文件: index.php 项目: nemein/openpsa
 /**
  * Sort the reports by task and day
  */
 private function _get_sorted_reports($hours_mc)
 {
     $reports = array();
     $hours = $hours_mc->list_keys();
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     foreach ($hours as $guid => $empty) {
         $task_id = $hours_mc->get_subkey($guid, 'task');
         try {
             $task = org_openpsa_projects_task_dba::get_cached($task_id);
         } catch (midcom_error $e) {
             // Task couldn't be loaded, probably because of ACL
             continue;
         }
         $person = $hours_mc->get_subkey($guid, 'person');
         $date = $hours_mc->get_subkey($guid, 'date');
         $date_identifier = date('Y-m-d', $date);
         $row_identifier = $task->id . '-' . $person;
         if (!isset($reports[$row_identifier])) {
             $reports[$row_identifier] = array($date_identifier => 0, 'task' => "<a href=\"{$prefix}hours/task/{$task->guid}/\">" . $task->get_label() . "</a>", 'task_index' => $task->get_label());
             try {
                 $person = org_openpsa_contacts_person_dba::get_cached($person);
                 $reports[$row_identifier]['person'] = $person->name;
             } catch (midcom_error $e) {
                 $reports[$row_identifier]['person'] = $this->_l10n->get('no person');
             }
         }
         if (!isset($reports[$row_identifier][$date_identifier])) {
             $reports[$row_identifier][$date_identifier] = 0;
         }
         $reports[$row_identifier][$date_identifier] += $hours_mc->get_subkey($guid, 'hours');
     }
     return array_values($reports);
 }
示例#16
0
文件: view.php 项目: nemein/openpsa
 public function get_row(midcom_core_dbaobject $document)
 {
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     $entry = array();
     $entry['id'] = $document->id;
     $entry['index_title'] = $document->title;
     $entry['index_filesize'] = 0;
     $entry['filesize'] = '';
     $entry['mimetype'] = '';
     $icon = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png';
     $alt = '';
     $att = $document->load_attachment();
     if ($att) {
         $icon = midcom_helper_misc::get_mime_icon($att->mimetype);
         $alt = $att->name;
         $stats = $att->stat();
         $entry['index_filesize'] = $stats[7];
         $entry['filesize'] = midcom_helper_misc::filesize_to_string($stats[7]);
         $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype);
     }
     $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"';
     $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>';
     $entry['title'] = $title;
     $entry['created'] = strftime('%Y-%m-%d %X', $document->metadata->created);
     $entry['index_author'] = '';
     $entry['author'] = '';
     if ($document->author) {
         $author = org_openpsa_contacts_person_dba::get_cached($document->author);
         $entry['index_author'] = $author->rname;
         $author_card = org_openpsa_widgets_contact::get($author->guid);
         $entry['author'] = $author_card->show_inline();
     }
     return $entry;
 }
示例#17
0
 public function list_members()
 {
     $group = $this->_get_group();
     if (!$group) {
         return array();
     }
     $memberships = $group->list_members();
     if (sizeof($memberships) == 0) {
         return array();
     }
     $qb = org_openpsa_contacts_person_dba::new_query_builder();
     $qb->add_constraint('id', 'IN', $memberships);
     return $qb->execute();
 }
示例#18
0
文件: ical.php 项目: nemein/openpsa
 /**
  * Finds a person by username
  *
  * Returns full object or false in case of failure.
  *
  * @param string username
  * @return object person
  */
 private function _find_person_by_name($username)
 {
     if (empty($username)) {
         return false;
     }
     midcom::get('auth')->request_sudo();
     $qb = org_openpsa_contacts_person_dba::new_query_builder();
     $qb->add_constraint('username', '=', $username);
     $persons = $qb->execute();
     midcom::get('auth')->drop_sudo();
     if (empty($persons)) {
         // Error getting user object
         return false;
     }
     return $persons[0];
 }
示例#19
0
文件: person.php 项目: nemein/openpsa
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_sidebyside($handler_id, array $args, array &$data)
 {
     $this->set_active_leaf('persons_merge');
     midcom::get('auth')->require_valid_user();
     // Process the selection if present.
     if (!empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) && !empty($_POST['org_openpsa_contacts_handler_duplicates_person_options']) && count($_POST['org_openpsa_contacts_handler_duplicates_person_options']) == 2) {
         $option1 = new org_openpsa_contacts_person_dba($_POST['org_openpsa_contacts_handler_duplicates_person_options'][1]);
         $option2 = new org_openpsa_contacts_person_dba($_POST['org_openpsa_contacts_handler_duplicates_person_options'][2]);
         foreach ($_POST['org_openpsa_contacts_handler_duplicates_person_keep'] as $keep => $dummy) {
             switch (true) {
                 case $keep == 'both':
                     $option1->require_do('midgard:update');
                     $option2->require_do('midgard:update');
                     if (!$option1->parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) || !$option2->parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) {
                         $errstr = midcom_connection::get_error_string();
                         // Failed to set as not duplicate, clear parameters that might have been set
                         $option1->parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, '');
                         $option2->parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, '');
                         // TODO: Localize
                         midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.contacts'), "Failed to mark #{$option1->id} and # {$option2->id} as not duplicates, errstr: {$errstr}", 'error');
                         // Switch is a "loop" so we continue 2 levels to get out of the foreach as well
                         continue 2;
                     }
                     // Clear the possible duplicate parameters
                     $option1->parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option2->guid, '');
                     $option2->parameter('org.openpsa.contacts.duplicates:possible_duplicate', $option1->guid, '');
                     // TODO: Localize
                     midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.contacts'), "Keeping both \"{$option1->name}\" and \"{$option2->name}\", they will not be marked as duplicates in the future", 'ok');
                     // Switch is a "loop" so we continue 2 levels to get out of the foreach as well
                     continue 2;
                     // Safety break
                     break;
                 case $keep == $option1->guid:
                     $person1 =& $option1;
                     $person2 =& $option2;
                     break;
                 case $keep == $option2->guid:
                     $person1 =& $option2;
                     $person2 =& $option1;
                     break;
                 default:
                     throw new midcom_error('Something weird happened (basically we got bogus data)');
             }
             $person1->require_do('midgard:update');
             $person2->require_do('midgard:delete');
             // TODO: Merge person2 data to person1 and then delete person2
             $merger = new org_openpsa_contacts_duplicates_merge('person');
             if (!$merger->merge_delete($person1, $person2)) {
                 // TODO: Localize
                 midcom::get('uimessages')->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $merger->errstr(), 'error');
             }
         }
         //PONDER: redirect to avoid reloading the POST in case user presses reload ??
     }
     // Then find us next pair we have sufficient rights for...
     $this->_request_data['notfound'] = false;
     $this->_request_data['person1'] = false;
     $this->_request_data['person2'] = false;
     $this->_request_data['loop_i'] = 0;
     $i =& $this->_request_data['loop_i'];
     if (isset($_REQUEST['org_openpsa_contacts_handler_duplicates_person_decide_later']) && isset($_REQUEST['org_openpsa_contacts_handler_duplicates_person_loop_i'])) {
         $i = $_REQUEST['org_openpsa_contacts_handler_duplicates_person_loop_i'] + 1;
     }
     while ($i < 100) {
         debug_add("Loop iteration {$i}");
         $qb = new midgard_query_builder('midgard_parameter');
         $qb->add_constraint('domain', '=', 'org.openpsa.contacts.duplicates:possible_duplicate');
         $qb->add_order('name', 'ASC');
         $qb->set_limit(1);
         if ($i > 0) {
             $qb->set_offset($i);
         }
         $ret = @$qb->execute();
         if (empty($ret)) {
             debug_add("No more results to be had, setting notfound and breaking out of loop");
             $this->_request_data['notfound'] = true;
             break;
         }
         $param =& $ret[0];
         debug_add("Found duplicate mark on person #{$param->parentguid} for person {$param->name}");
         try {
             $person1 = new org_openpsa_contacts_person_dba($param->parentguid);
             $person2 = new org_openpsa_contacts_person_dba($param->name);
         } catch (midcom_error $e) {
             $i++;
             continue;
         }
         // Make sure we actually have enough rights to do this
         if (!$person1->can_do('midgard:update') || !$person1->can_do('midgard:delete') || !$person2->can_do('midgard:update') || !$person2->can_do('midgard:delete')) {
             debug_add("Insufficient rights to merge these two, continuing to see if we have more");
             $i++;
             continue;
         }
         // Extra sanity check (in case of semi-successful not-duplicate mark)
         if ($person1->parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) || $person2->parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) {
             debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN);
             $i++;
             continue;
         }
         $this->_request_data['probability'] = (double) $param->value;
         $this->_request_data['person1'] = $person1;
         $this->_request_data['person2'] = $person2;
         break;
     }
 }
示例#20
0
 private function _send_sms_member(&$smsbroker, $member, &$content, &$from, &$data_array)
 {
     if ($this->_check_member_deny($member, 'sms')) {
         return;
     }
     if (!isset($GLOBALS['org_openpsa_directmarketing_campaign_message_send_i'])) {
         $GLOBALS['org_openpsa_directmarketing_campaign_message_send_i'] = 0;
     }
     $GLOBALS['org_openpsa_directmarketing_campaign_message_send_i']++;
     $person =& org_openpsa_contacts_person_dba::get_cached($member->person);
     $person->handphone = $this->_normalize_phone($person->handphone);
     $content_p = $member->personalize_message($content, $this->orgOpenpsaObtype, $person);
     //TODO: Add sender support
     $status = $smsbroker->send_sms($person->handphone, $content_p, $from);
     if ($status) {
         debug_add('SMS sent to: ' . $person->handphone);
         if (!$this->test_mode) {
             $member->create_receipt($this->id, org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT);
         }
     } else {
         $message = sprintf('FAILED to send SMS to: %s, reason: %s', $person->handphone, $smsbroker->errstr);
         debug_add($message, MIDCOM_LOG_WARN);
         if (!$this->test_mode) {
             $params = array(array('domain' => 'org.openpsa.directmarketing', 'name' => 'send_error_message', 'value' => $message));
             $member->create_receipt($this->id, ORG_OPENPSA_MESSAGERECEIPT_FAILURE, $token, $params);
         }
         if ($this->send_output) {
             midcom::get('uimessages')->add(midcom::get('i18n')->get_string('org.openpsa.directmarketing', 'org.openpsa.directmarketing'), sprintf(midcom::get('i18n')->get_string('FAILED to send SMS to: %s, reason: %s', 'org.openpsa.directmarketing'), $person->handphone, $smsbroker->errstr), 'error');
         }
     }
     return $status;
 }
示例#21
0
文件: member.php 项目: nemein/openpsa
 /**
  * Substitutes magic strings in content with values from the membership
  * and/or the person.
  */
 function personalize_message($content, $message_type = -1, &$person = false, $node = false)
 {
     if (!$node) {
         $nap = new midcom_helper_nav();
         $node = $nap->get_node($nap->get_current_node());
     }
     if (!is_object($person)) {
         $person =& org_openpsa_contacts_person_dba::get_cached($this->person);
     }
     $sep_start = '<';
     $sep_end = '>';
     if ($message_type == org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) {
         $sep_start = '&lt;';
         $sep_end = '&gt;';
     }
     // Unsubscribe URL
     $content = str_replace($sep_start . 'UNSUBSCRIBE_URL' . $sep_end, $this->get_unsubscribe_url($node, $person), $content);
     // Unsubscribe from all URL
     $content = str_replace($sep_start . 'UNSUBSCRIBE_ALL_URL' . $sep_end, "{$node[MIDCOM_NAV_FULLURL]}campaign/unsubscribe_all/{$person->guid}/", $content);
     // Unsubscribe from all URL
     $content = str_replace($sep_start . 'UNSUBSCRIBE_ALL_FUTURE_URL' . $sep_end, "{$node[MIDCOM_NAV_FULLURL]}campaign/unsubscribe_all_future/{$person->guid}/all.html", $content);
     // General membership GUID
     $content = str_replace($sep_start . 'MEMBER_GUID' . $sep_end, $this->guid, $content);
     // General person GUID
     $content = str_replace($sep_start . 'PERSON_GUID' . $sep_end, $person->guid, $content);
     // E-Mail
     $content = str_replace($sep_start . 'EMAIL' . $sep_end, $person->email, $content);
     // Firstname
     $content = str_replace($sep_start . 'FNAME' . $sep_end, $person->firstname, $content);
     // Lastname
     $content = str_replace($sep_start . 'LNAME' . $sep_end, $person->lastname, $content);
     // Username
     $content = str_replace($sep_start . 'UNAME' . $sep_end, $person->username, $content);
     // Password (if plaintext)
     if (preg_match('/^\\*\\*(.*)/', $person->password, $pwd_matches)) {
         $plaintext_password = $pwd_matches[1];
     } else {
         $plaintext_password = $sep_start . 'unknown' . $sep_end;
     }
     $content = str_replace($sep_start . 'PASSWD' . $sep_end, $plaintext_password, $content);
     // Callback functions
     if (preg_match_all('/' . $sep_start . 'CALLBACK:(.*?)' . $sep_end . '/', $content, $callback_matches)) {
         foreach ($callback_matches[0] as $k => $search) {
             $callback_func =& $callback_matches[1][$k];
             if (!is_callable($callback_func)) {
                 continue;
             }
             $replace = call_user_func($callback_func, $person, $this);
             $content = str_replace($search, $replace, $content);
         }
     }
     return $content;
 }
示例#22
0
文件: search.php 项目: nemein/openpsa
 /**
  * Does a QB query for persons, returns false or number of matched entries
  */
 private function _search_qb_persons()
 {
     if (!$this->_query_string) {
         return false;
     }
     $qb = org_openpsa_contacts_person_dba::new_query_builder();
     // Search using only the fields defined in config
     $person_fields = explode(',', $this->_config->get('person_search_fields'));
     if (!is_array($person_fields) || count($person_fields) == 0) {
         throw new midcom_error('Invalid person search configuration');
     }
     $this->_apply_constraints($qb, $person_fields);
     $this->_persons = $qb->execute();
 }
示例#23
0
文件: crud.php 项目: nemein/openpsa
 private function _populate_schema_contacts_for_customer(&$customer)
 {
     $fields =& $this->_schemadb['default']->fields;
     // We know the customer company, present contact as a select widget
     $persons_array = array();
     $member_mc = midcom_db_member::new_collector('gid', $customer->id);
     $members = $member_mc->get_values('uid');
     foreach ($members as $member) {
         try {
             $person = org_openpsa_contacts_person_dba::get_cached($member);
             $persons_array[$person->id] = $person->rname;
         } catch (midcom_error $e) {
         }
     }
     asort($persons_array);
     $fields['customerContact']['widget'] = 'select';
     $fields['customerContact']['type_config']['options'] = $persons_array;
     // And display the organization too
     $organization_array = array();
     $organization_array[$customer->id] = $customer->official;
     $fields['customer']['widget'] = 'select';
     $fields['customer']['type_config']['options'] = $organization_array;
 }
示例#24
0
 private function _check_person_url(org_openpsa_contacts_person_dba $person)
 {
     $data = org_openpsa_contacts_interface::_get_data_from_url($person->homepage);
     // Use the data we got
     if (array_key_exists('georss_url', $data)) {
         // GeoRSS subscription is a good way to keep track of person's location
         $person->parameter('org.routamc.positioning:georss', 'georss_url', $data['georss_url']);
     } else {
         if (array_key_exists('icbm', $data)) {
             // Instead of using the ICBM position data directly we can subscribe to it so we get modifications too
             $person->parameter('org.routamc.positioning:html', 'icbm_url', $person->homepage);
         }
     }
     if (array_key_exists('rss_url', $data)) {
         // Instead of using the ICBM position data directly we can subscribe to it so we get modifications too
         $person->parameter('net.nemein.rss', 'url', $data['rss_url']);
     }
     if (array_key_exists('hcards', $data)) {
         // Process those hCard values that are interesting for us
         foreach ($data['hcards'] as $hcard) {
             foreach ($hcard as $key => $val) {
                 $person = $this->_update_from_hcard($person, $hcard);
             }
         }
         $person->update();
     }
     return true;
 }
示例#25
0
文件: task.php 项目: nemein/openpsa
 /**
  * This function is called from the DM2 schema
  */
 static function get_task_resources()
 {
     $resource_array = array();
     $view_data =& midcom_core_context::get()->get_custom_key('request_data');
     if (!array_key_exists('task', $view_data)) {
         return $resource_array;
     }
     $mc = org_openpsa_projects_task_resource_dba::new_collector('task', $view_data['task']->id);
     $mc->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_PROJECTRESOURCE);
     $resources = $mc->get_values('person');
     foreach ($resources as $resource) {
         try {
             $person = org_openpsa_contacts_person_dba::get_cached($resource);
             $resource_array[$person->id] = $person->rname;
         } catch (midcom_error $e) {
         }
     }
     return $resource_array;
 }
示例#26
0
</div>

<script type="text/javascript">
    <?php 
//add static data to jqgrid if wanted
$start = true;
if (!array_key_exists('dynamic_load', $data) && array_key_exists('entries', $data)) {
    $rows = array();
    foreach ($data['entries'] as $entry) {
        $row = array('id' => $entry->id, 'index_name' => $entry->title, 'description' => $entry->text, 'index_date' => $entry->followUp);
        $link_html = "<a href='" . $data['url_prefix'] . "edit/" . $entry->guid . "/'>";
        $link_html .= "<span >" . $entry->title . "</span></a>";
        $row['name'] = $link_html;
        $row['date'] = date('Y-m-d', $entry->metadata->created);
        try {
            $creator = org_openpsa_contacts_person_dba::get_cached($entry->metadata->creator);
            $row['creator_index'] = $creator->rname;
            $creator_card = org_openpsa_widgets_contact::get($entry->metadata->creator);
            $row['creator'] = $creator_card->show_inline();
        } catch (midcom_error $e) {
            $row['creator_index'] = '';
            $row['creator'] = '';
        }
        if ($entry->closed) {
            $row['closed'] = midcom::get('i18n')->get_string('finished', 'org.openpsa.relatedto');
        } else {
            $row['closed'] = midcom::get('i18n')->get_string('open', 'org.openpsa.relatedto');
        }
        $rows[] = $row;
    }
    echo 'var entries = ' . json_encode($rows) . ";\n";
示例#27
0
文件: import.php 项目: nemein/openpsa
 private function _import_subscribers_person($subscriber)
 {
     $person = null;
     if ($this->_config->get('csv_import_check_duplicates')) {
         if (array_key_exists('email', $subscriber['person']) && $subscriber['person']['email']) {
             // Perform a simple email test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker
             $qb = org_openpsa_contacts_person_dba::new_query_builder();
             $qb->add_constraint('email', '=', $subscriber['person']['email']);
             $persons = $qb->execute_unchecked();
             if (count($persons) > 0) {
                 // Match found, use it
                 $person = $persons[0];
             }
         }
         if (!$person && array_key_exists('handphone', $subscriber['person']) && $subscriber['person']['handphone']) {
             // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker
             $qb = org_openpsa_contacts_person_dba::new_query_builder();
             $qb->add_constraint('handphone', '=', $subscriber['person']['handphone']);
             $persons = $qb->execute_unchecked();
             if (count($persons) > 0) {
                 // Match found, use it
                 $person = $persons[0];
             }
         }
     }
     if (!$person) {
         // We didn't have person matching the email in DB. Create a new one.
         $person = new org_openpsa_contacts_person_dba();
         // Populate at least one field for the new person
         if (isset($subscriber['person']) && isset($subscriber['person']['email'])) {
             $person->email = $subscriber['person']['email'];
         }
         if (!$person->create()) {
             $this->_request_data['new_objects']['person'] =& $person;
             debug_add("Failed to create person, reason " . midcom_connection::get_error_string());
             $this->_request_data['import_status']['failed_create']++;
             return false;
             // This will skip to next
         }
     }
     if (!$this->_datamanager_process('person', $subscriber, $person)) {
         return false;
     }
     return $person;
 }
示例#28
0
文件: member.php 项目: nemein/openpsa
 /**
  * Find amount (seconds) of free
  * time for person between start and end
  */
 public static function find_free_times($amount, $person, $start, $end)
 {
     static $event_cache = array();
     $slots = array();
     if (!is_object($person)) {
         $person = org_openpsa_contacts_person_dba::get_cached($person);
     }
     // Get current events for person
     $qb = org_openpsa_calendar_event_participant_dba::new_query_builder();
     $qb->begin_group('OR');
     $qb->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_EVENTPARTICIPANT);
     $qb->add_constraint('orgOpenpsaObtype', '=', 0);
     $qb->end_group();
     $qb->add_constraint('uid', '=', $person->id);
     // All events that somehow overlap the given time.
     $qb->begin_group('OR');
     $qb->begin_group('AND');
     $qb->add_constraint('eid.start', '>=', $start);
     $qb->add_constraint('eid.start', '<=', $end);
     $qb->end_group();
     $qb->begin_group('AND');
     $qb->add_constraint('eid.end', '<=', $end);
     $qb->add_constraint('eid.end', '>=', $start);
     $qb->end_group();
     $qb->begin_group('AND');
     $qb->add_constraint('eid.start', '<=', $start);
     $qb->add_constraint('eid.end', '>=', $end);
     $qb->end_group();
     $qb->end_group();
     $qb->add_order('eid.start', 'ASC');
     $qb->add_order('eid.end', 'ASC');
     $eventmembers = $qb->execute();
     if (!is_array($eventmembers)) {
         // QB error
         return $slots;
     }
     $events_by_date = array();
     foreach ($eventmembers as $eventmember) {
         if (!array_key_exists($eventmember->eid, $event_cache)) {
             try {
                 $event_cache[$eventmember->eid] = new org_openpsa_calendar_event_dba($eventmember->eid);
             } catch (midcom_error $e) {
                 continue;
             }
         }
         $event =& $event_cache[$eventmember->eid];
         $ymd = date('Ymd', $event->start);
         if (array_key_exists($ymd, $events_by_date)) {
             $events_by_date[$ymd] = array();
         }
         $events_by_date[$ymd][] = $event;
     }
     // Make sure each date between start and end has at least a dummy event
     $stamp = mktime(0, 0, 1, date('m', $start), date('d', $start), date('Y', $start));
     while ($stamp <= $end) {
         $ymd = date('Ymd', $stamp);
         debug_add("making sure date {$ymd} has at least one event");
         $stamp = mktime(0, 0, 1, date('m', $stamp), date('d', $stamp) + 1, date('Y', $stamp));
         if (array_key_exists($ymd, $events_by_date)) {
             continue;
         }
         debug_add('none found, adding a dummy one');
         $dummy = new org_openpsa_calendar_event_dba();
         $dummy->start = $stamp;
         $dummy->end = $stamp + 1;
         $events_by_date[$ymd] = array($dummy);
     }
     foreach ($events_by_date as $ymd => $events) {
         preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})/', $ymd, $ymd_matches);
         // TODO: get from persons data based on events weekday
         // PONDER: What to do with persons that do not have this data defined ??
         $workday_starts = 8;
         $workday_ends = 16;
         if (empty($workday_starts) || empty($workday_ends)) {
             // No work on that day
             continue;
         }
         $workday_starts_ts = mktime($workday_starts, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]);
         $workday_ends_ts = mktime($workday_ends, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]);
         $last_end_time = false;
         $last_event = false;
         foreach ($events as $event_key => $event) {
             if ($event->end <= $workday_starts_ts) {
                 // We need not to consider this event, it ends before we start working
                 unset($events[$event_key]);
                 continue;
             }
             if ($event->start >= $workday_ends_ts) {
                 // We need not to consider this event, it starts after we stop working
                 unset($events[$event_key]);
                 continue;
             }
             debug_add("checking event #{$event->id} ({$event->title})");
             if ($last_end_time === false) {
                 if ($event->start > $workday_starts_ts) {
                     // First event of the day starts after we have started working, use work start time as last end time.
                     $last_end_time = $workday_starts_ts;
                 } else {
                     // Make the first event of the day the last end time and skip rest of the checks
                     $last_end_time = $event->end;
                     // PHP5-TODO: Must be copy by value
                     $last_event = $event;
                     continue;
                 }
             }
             $diff = $event->start - $last_end_time;
             if ($diff >= $amount) {
                 // slot found
                 $slot = array('start' => $last_end_time, 'end' => $event->start, 'previous' => $last_event, 'next' => $event);
                 // PHP5-TODO: This must be copy-by-value
                 $slots[] = $slot;
             }
             $last_end_time = $event->end;
             $last_event = $event;
         }
         // End of day slot
         if ($last_end_time === false) {
             $last_end_time = $workday_starts_ts;
         }
         if ($last_end_time < $workday_ends_ts && $workday_ends_ts - $last_end_time >= $amount) {
             $slot = array('start' => $last_end_time, 'end' => $workday_ends_ts, 'previous' => $last_event, 'next' => false);
             // PHP5-TODO: This must be copy-by-value
             $slots[] = $slot;
         }
     }
     return $slots;
 }
示例#29
0
 public function get_customer()
 {
     try {
         $customer = org_openpsa_contacts_group_dba::get_cached($this->customer);
     } catch (midcom_error $e) {
         try {
             $customer = org_openpsa_contacts_person_dba::get_cached($this->customerContact);
         } catch (midcom_error $e) {
             $customer = null;
             $e->log();
         }
     }
     return $customer;
 }
示例#30
0
文件: list.php 项目: nemein/openpsa
 public function get_row(midcom_core_dbaobject $invoice)
 {
     $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     $entry = array();
     $number = $invoice->get_label();
     $link_html = "<a href='{$prefix}invoice/{$invoice->guid}/'>" . $number . "</a>";
     if ($number == "") {
         $number = "n/a";
     }
     $entry['id'] = $invoice->id;
     $entry['index_number'] = $number;
     $entry['number'] = $link_html;
     if (!is_a($this->_customer, 'org_openpsa_contacts_group_dba')) {
         try {
             $customer = org_openpsa_contacts_group_dba::get_cached($invoice->customer);
             $entry['customer'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$customer->guid}/\">" . $customer->get_label() . "</a>";
         } catch (midcom_error $e) {
             $entry['customer'] = '';
         }
     }
     if (!is_a($this->_customer, 'org_openpsa_contacts_person_dba')) {
         try {
             $contact = org_openpsa_contacts_person_dba::get_cached($invoice->customerContact);
             $entry['contact'] = "<a href=\"{$this->_request_data['invoices_url']}list/customer/all/{$contact->guid}/\">" . $contact->get_label() . "</a>";
         } catch (midcom_error $e) {
             $entry['contact'] = '';
         }
     }
     if (!empty($this->_request_data['deliverable'])) {
         $constraints = array('invoice' => $invoice->id, 'deliverable' => $this->_request_data['deliverable']->id);
         $item_sum = org_openpsa_invoices_invoice_item_dba::get_sum($constraints);
         $this->_request_data['totals']['deliverable'] += $item_sum;
         $entry['index_item_sum'] = $item_sum;
         $entry['item_sum'] = '<span title="' . $this->_l10n->get('sum including vat') . ': ' . org_openpsa_helpers::format_number($item_sum / 100 * $invoice->vat + $item_sum) . '">' . org_openpsa_helpers::format_number($item_sum) . '</span>';
     }
     $entry['index_sum'] = $invoice->sum;
     $entry['sum'] = '<span title="' . $this->_l10n->get('sum including vat') . ': ' . org_openpsa_helpers::format_number($invoice->sum / 100 * $invoice->vat + $invoice->sum) . '">' . org_openpsa_helpers::format_number($invoice->sum) . '</span>';
     $entry['due'] = '';
     if ($invoice->due > 0) {
         $entry['due'] = strftime('%Y-%m-%d', $invoice->due);
     }
     $colname = 'action';
     if ($this->_list_type == 'paid') {
         $colname = 'paid';
     }
     $entry[$colname] = $this->_master->render_invoice_actions($invoice);
     return $entry;
 }