diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index 2aa853b4243..862de4b82f5 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -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);
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 501984d9460..3d1bfce1bb4 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -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('');
+ $("#customerandsales").html('');
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(\'\');';
+ } else {
+ dol_print_error($db);
}
$s = '';
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 0ce0e2f1bbd..17bf6c8ebde 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -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')
{