Sort order

This commit is contained in:
Laurent Destailleur 2020-03-23 14:12:48 +01:00
parent 26e9500c26
commit 2177afecd9
3 changed files with 22 additions and 6 deletions

View File

@ -710,12 +710,14 @@ function getSocialNetworkSharingLinks()
* WARNING: This function can be used by websites.
*
* @param string $type Type of container to search into (Example: '', 'page', 'blogpost', 'page,blogpost', ...)
* @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination, ...)
* @param string $algo Algorithm used for search (Example: 'meta' is searching into meta information like title and description, 'content', 'sitefiles', or any combination 'meta,content,...')
* @param string $searchstring Search string
* @param int $max Max number of answers
* @param string $sortfield Sort Fields
* @param string $sortorder Sort order ('DESC' or 'ASC')
* @return string HTML content
*/
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield='date_creation', $sortorder='DESC')
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
@ -778,6 +780,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
}
$sql .= $searchalgo;
$sql .= ")";
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($max);
$resql = $db->query($sql);

View File

@ -395,6 +395,14 @@ if ($action == "deleteline") {
if ($action == "delete") {
// $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at begining of page works.
/*$reg = array();
if (preg_match('/^(\d+)-(\d+)$/', $place, $reg)) {
$place = $reg[1];
var_dump($place);
}*/
if ($placeid > 0) {
$result = $invoice->fetch($placeid);
@ -407,7 +415,8 @@ if ($action == "delete") {
$resql1 = $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet where fk_facture = ".$placeid;
$resql2 = $db->query($sql);
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]};
$sql.= " WHERE ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
$resql3 = $db->query($sql);
if ($resql1 && $resql2 && $resql3)
@ -713,10 +722,12 @@ $( document ).ready(function() {
}
?>
$("#customerandsales").html('<a class="valignmiddle" id="customer" onclick="Customer();"><?php print dol_escape_js($s); ?></a>');
$("#customerandsales").html('<a class="valignmiddle" id="customer" onclick="Customer();"><?php print dol_escape_js($s); ?></a>');
<?php
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture where ref LIKE '(PROV-POS".$_SESSION["takeposterminal"]."-0%'";
$sql = "SELECT rowid, datec, ref FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE ref LIKE '(PROV-POS".$_SESSION["takeposterminal"]."-0%'";
$sql.= $db->order('datec', 'ASC');
$resql = $db->query($sql);
if ($resql) {
while ($obj = $db->fetch_object($resql)) {
@ -733,6 +744,8 @@ $( document ).ready(function() {
echo '$("#customerandsales").append(\'<a onclick="location.href=\\\'index.php?place=0-';
echo $max_sale+1;
echo '\\\'"><span class="fa fa-plus-square"></a>\');';
} else {
dol_print_error($db);
}
$s = '';

View File

@ -121,7 +121,7 @@ if ($websiteid > 0 || $websitekey)
$website = $object;
// Check pageid received as aprameter
// Check pageid received as parameter
if ($pageid < 0) $pageid = 0;
if (($pageid > 0 || $pageref) && $action != 'addcontainer')
{