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/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; dol_include_once('/importzugferd/class/zugferdimport.class.php'); dol_include_once('/importzugferd/lib/importzugferd.lib.php'); // Load translation files $langs->loadLangs(array("importzugferd@importzugferd", "bills", "companies")); // Security check if (!$user->hasRight('importzugferd', 'import', 'read')) { accessforbidden(); } // Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'zugferdimportlist'; // Search parameters $search_ref = GETPOST('search_ref', 'alpha'); $search_invoice_number = GETPOST('search_invoice_number', 'alpha'); $search_seller_name = GETPOST('search_seller_name', 'alpha'); $search_status = GETPOST('search_status', 'int'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (!$sortfield) { $sortfield = 'i.date_creation'; } if (!$sortorder) { $sortorder = 'DESC'; } // Initialize objects $object = new ZugferdImport($db); $form = new Form($db); $formother = new FormOther($db); /* * Actions */ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; $search_invoice_number = ''; $search_seller_name = ''; $search_status = ''; $toselect = array(); } /* * View */ $title = $langs->trans('ImportList'); llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-importzugferd page-list'); // Build SQL query $sql = "SELECT i.rowid, i.ref, i.invoice_number, i.invoice_date, i.seller_name, i.seller_vat,"; $sql .= " i.buyer_reference, i.total_ht, i.total_ttc, i.currency, i.fk_soc, i.fk_facture_fourn,"; $sql .= " i.status, i.error_message, i.date_creation, i.pdf_filename,"; $sql .= " s.nom as supplier_name"; $sql .= " FROM ".MAIN_DB_PREFIX."importzugferd_import as i"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = i.fk_soc"; $sql .= " WHERE i.entity IN (".getEntity('importzugferd_import').")"; if (!empty($search_ref)) { $sql .= natural_search('i.ref', $search_ref); } if (!empty($search_invoice_number)) { $sql .= natural_search('i.invoice_number', $search_invoice_number); } if (!empty($search_seller_name)) { $sql .= natural_search('i.seller_name', $search_seller_name); } if ($search_status !== '' && $search_status >= 0) { $sql .= " AND i.status = ".(int)$search_status; } // Count total $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $sqlforcount = preg_replace('/^SELECT[^FROM]*FROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql); $sqlforcount = preg_replace('/ORDER BY .*$/', '', $sqlforcount); $resqlforcount = $db->query($sqlforcount); if ($resqlforcount) { $objforcount = $db->fetch_object($resqlforcount); $nbtotalofrecords = $objforcount->nbtotalofrecords; } $db->free($resqlforcount); if (($page * $limit) > $nbtotalofrecords) { $page = 0; $offset = 0; } } $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); if (!$resql) { dol_print_error($db); exit; } $num = $db->num_rows($resql); // List header $param = ''; if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref); if (!empty($search_invoice_number)) $param .= '&search_invoice_number='.urlencode($search_invoice_number); if (!empty($search_seller_name)) $param .= '&search_seller_name='.urlencode($search_seller_name); if ($search_status !== '') $param .= '&search_status='.urlencode($search_status); print '
'; llxFooter(); $db->close();