0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../main.inc.php")) { $res = @include "../main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; dol_include_once('/importzugferd/lib/importzugferd.lib.php'); // Load translations $langs->loadLangs(array("importzugferd@importzugferd", "products", "bills")); // Security check if (!$user->hasRight('produit', 'lire')) { accessforbidden(); } // Get parameters $action = GETPOST('action', 'aZ09'); $batch_id = GETPOST('batch_id', 'alphanohtml'); $fk_product = GETPOSTINT('fk_product'); $fk_soc = GETPOSTINT('fk_soc'); $date_start = GETPOST('date_start', 'alpha'); $date_end = GETPOST('date_end', 'alpha'); // Pagination $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page'); $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $offset = $limit * $page; if (!$sortfield) $sortfield = 'l.date_change'; if (!$sortorder) $sortorder = 'DESC'; // Initialize objects $form = new Form($db); $formcompany = new FormCompany($db); /* * View */ $title = $langs->trans('DatanormChangeLog'); llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-importzugferd page-datanorm-changelog'); print load_fiche_titre($title, ''.$langs->trans('DatanormMassUpdate').'', 'fa-history'); // Filter form print '
'; // Build SQL query $sql = "SELECT l.*, p.ref as product_ref, p.label as product_label, s.nom as supplier_name, u.login as user_login"; $sql .= " FROM ".MAIN_DB_PREFIX."importzugferd_datanorm_log l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = l.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = l.fk_user"; $sql .= " WHERE l.entity IN (".getEntity('product').")"; if (!empty($batch_id)) { $sql .= " AND l.batch_id = '".$db->escape($batch_id)."'"; } if ($fk_soc > 0) { $sql .= " AND l.fk_soc = ".((int)$fk_soc); } if ($fk_product > 0) { $sql .= " AND l.fk_product = ".((int)$fk_product); } if (!empty($date_start)) { $sql .= " AND l.date_change >= '".$db->escape($date_start)." 00:00:00'"; } if (!empty($date_end)) { $sql .= " AND l.date_change <= '".$db->escape($date_end)." 23:59:59'"; } // Count total $sqlcount = preg_replace('/SELECT.*FROM/', 'SELECT COUNT(*) as total FROM', $sql); $resqlcount = $db->query($sqlcount); $total = 0; if ($resqlcount) { $objcount = $db->fetch_object($resqlcount); $total = $objcount->total; } $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); print '| '.dol_print_date($db->jdate($obj->date_change), 'dayhour').' | '; // Product print '';
$product = new Product($db);
if ($product->fetch($obj->fk_product) > 0) {
print $product->getNomUrl(1);
print ' '.$obj->product_label.''; } print ' | ';
// Supplier
print ''.dol_escape_htmltag($obj->supplier_name).' | '; // Datanorm ref print ''.dol_escape_htmltag($obj->datanorm_ref).' | '; // Field changed print ''; $field_label = ''; switch ($obj->field_changed) { case 'price': $field_label = $langs->trans('Price'); print ''; break; case 'description': $field_label = $langs->trans('Description'); print ''; break; case 'label': $field_label = $langs->trans('Label'); print ''; break; default: $field_label = $obj->field_changed; } print $field_label; print ' | '; // Old value print ''; if ($obj->field_changed == 'price') { print price($obj->old_value); } else { print dol_escape_htmltag(dol_trunc($obj->old_value, 100)); } print ' | '; // New value print '';
if ($obj->field_changed == 'price') {
print price($obj->new_value);
// Show difference
$diff = $obj->new_value - $obj->old_value;
if ($obj->old_value > 0) {
$diff_percent = ($diff / $obj->old_value) * 100;
print ' '; if ($diff > 0) { print '+'.number_format($diff_percent, 1).'%'; } else { print ''.number_format($diff_percent, 1).'%'; } } } else { print dol_escape_htmltag(dol_trunc($obj->new_value, 100)); } print ' | ';
// User
print ''.dol_escape_htmltag($obj->user_login).' | '; print '
| '.$langs->trans('NoChangesRecorded').' | |||||||