function displayList(&$layout_def)
 {
     $module = '';
     $record = '';
     if (isset($layout_def['varname'])) {
         $key = strtoupper($layout_def['varname']);
     } else {
         $key = $this->_get_column_alias($layout_def);
         $key = strtoupper($key);
     }
     if (empty($layout_def['fields'][$key])) {
         return "";
     } else {
         $value = $layout_def['fields'][$key];
     }
     if (empty($layout_def['target_record_key'])) {
         $record = $layout_def['fields']['ID'];
     } else {
         $record_key = strtoupper($layout_def['target_record_key']);
         $record = $layout_def['fields'][$record_key];
     }
     if (!empty($layout_def['target_module_key'])) {
         if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) {
             $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])];
         }
     }
     if (empty($module)) {
         if (empty($layout_def['target_module'])) {
             $module = $layout_def['module'];
         } else {
             $module = $layout_def['target_module'];
         }
     }
     $action = 'DetailView';
     $value = $layout_def['fields'][$key];
     global $current_user;
     if (isset($layout_def['custom']) && $layout_def['custom'] == true && $key == "BEAN_NAME") {
         $productlog = new ProductLog();
         $productlog->retrieve($layout_def['fields']['ID']);
         $module = $productlog->bean_name;
         if ($productlog->bean_name == 'Quote') {
             $module = 'Quotes';
         }
         $record = $layout_def['fields']['BEAN_ID'];
         return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
     } elseif ($layout_def['DetailView'] && !$layout_def['owner_module'] || $layout_def['DetailView'] && !ACLController::moduleSupportsACL($layout_def['owner_module']) || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id)) {
         return '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" class="listViewTdLinkS1">' . "{$value}</a>";
     } else {
         return $value;
     }
 }
 function product_log($id, $status, $bean, $status_action, $old_status)
 {
     $productLog = new ProductLog();
     $product = new Products();
     $product->retrieve($id);
     if ($old_status != $status || empty($product->date_modified)) {
         $productLog->product_name = $product->name;
         $productLog->product_id = $product->id;
         $productLog->from_status = $old_status;
         $product->status = $status;
         $product->save($GLOBALS['check_notify']);
         $productLog->to_status = $product->status;
         var_dump($productLog->object_name);
         var_dump($productLog->object_id);
         $productLog->bean_name = $bean->object_name;
         $productLog->bean_id = $bean->id;
         var_dump($productLog->object_name);
         var_dump($productLog->object_id);
         var_dump($bean->object_name);
         var_dump($bean->object_id);
         $productLog->action = $status_action;
         if (!empty($_REQUEST['status_action'])) {
             $productLog->action = $_REQUEST['status_action'];
         }
         $productLog->save($GLOBALS['check_notify']);
     }
 }
 public function commit()
 {
     global $db;
     $ac = $db->is_autocommit();
     if ($ac) {
         $db->autocommit(false);
     }
     if (isset($this->_old_price) && $this->_old_price != $this->price) {
         $log = new ProductLog();
         $log->user_id = $_SESSION['login'];
         $log->old_price = $this->_old_price;
         $log->new_price = $this->price;
         $log->product_id = $this->id;
         $log->commit();
     }
     parent::commit();
     if ($ac) {
         $db->commit();
         $db->autocommit(true);
     }
 }
 * License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'modules/ProductLogs/ProductLog.php';
$sugarbean = new ProductLog();
// perform the delete if given a record to delete
if (empty($_REQUEST['record'])) {
    $GLOBALS['log']->info('delete called without a record id specified');
} else {
    $record = $_REQUEST['record'];
    $sugarbean->retrieve($record);
    if (!$sugarbean->ACLAccess('Delete')) {
        ACLController::displayNoAccess(true);
        sugar_cleanup(true);
    }
    $GLOBALS['log']->info("deleting record: {$record}");
    $sugarbean->mark_deleted($record);
}
// handle the return location variables
$return_module = empty($_REQUEST['return_module']) ? 'Project' : $_REQUEST['return_module'];
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
require_once 'XTemplate/xtpl.php';
require_once 'data/Tracker.php';
require_once 'modules/ProductLogs/ProductLog.php';
require_once 'include/time.php';
require_once 'modules/ProductLogs/Forms.php';
global $timedate;
global $app_strings;
global $app_list_strings;
global $current_language;
global $current_user;
global $sugar_version, $sugar_config;
$focus = new ProductLog();
if (!empty($_REQUEST['record'])) {
    $focus->retrieve($_REQUEST['record']);
}
echo "\n<p>\n";
echo get_module_title($mod_strings['LBL_MODULE_NAME'], $mod_strings['LBL_MODULE_NAME'] . ": " . $focus->name, true);
echo "\n</p>\n";
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
require_once $theme_path . 'layout_utils.php';
$GLOBALS['log']->info("ProductLogs detail view");
$xtpl = new XTemplate('modules/ProductLogs/EditView.html');
/// Users Popup
$json = getJSONobj();
$popup_request_data = array('call_back_function' => 'set_return', 'form_name' => 'EditView', 'field_to_name_array' => array('id' => 'assigned_user_id', 'user_name' => 'assigned_user_name'));
 public function getUserLastProductNote($p_id)
 {
     return ProductLog::whereRaw('product_id = ? AND user_id = ?', array($p_id, $this->logged_user_id))->orderBy('id', 'DESC')->pluck('notes');
 }
<?php

if (empty($_SESSION['login'])) {
    kick('login?kickback=' . htmlspecialchars(kickback_url()));
}
$prices = ProductLog::selection();
?>
<table>
	<thead>
		<tr>
			<th>Produkt</th>
			<th>Pris före</th>
			<th>Pris efter</th>
			<th>datum</th>
			<th>användare</th>
		</tr>
	</thead>
	<tbody>
		<? foreach($prices as $price): ?>
			<tr>
				<td><a href="/product/<?php 
echo $price->product_id;
?>
"><?php 
echo $price->Product;
?>
</a></td>
				<td class="numeric"><?php 
echo $price->old_price;
?>
 kr</td>