List website into combo sorted by position, ref fields
This commit is contained in:
parent
34d7dbe7e9
commit
264c1d6491
@ -49,8 +49,6 @@ $acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
|
||||
$status = 1;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
@ -61,6 +59,9 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (empty($sortfield)) $sortfield = 'position, ref';
|
||||
if (empty($sortorder)) $sortorder = 'ASC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('website'));
|
||||
|
||||
@ -74,7 +75,7 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql = array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.position, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort = array();
|
||||
@ -82,15 +83,15 @@ $tabsqlsort[1] = "ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield = array();
|
||||
$tabfield[1] = "ref,description,virtualhost";
|
||||
$tabfield[1] = "ref,description,virtualhost,position";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost,position";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,position,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
|
||||
@ -106,7 +106,7 @@ if (empty($action)) $action = 'preview';
|
||||
$object = new Website($db);
|
||||
$objectpage = new WebsitePage($db);
|
||||
|
||||
$object->fetchAll(); // Init $object->records with list of websites
|
||||
$object->fetchAll('ASC', 'position'); // Init $object->records with list of websites
|
||||
|
||||
// If website not defined, we take first found
|
||||
if (!($websiteid > 0) && empty($websitekey))
|
||||
@ -2207,7 +2207,6 @@ if (!GETPOST('hide_websitemenu'))
|
||||
|
||||
print '<span class="websiteselection hideonsmartphoneimp">';
|
||||
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=createsite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddWebsite")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
|
||||
//print ' <input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'" name="createsite">';
|
||||
print '</span>';
|
||||
|
||||
// List of website
|
||||
|
||||
Loading…
Reference in New Issue
Block a user