diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 24e36cfecc2..2b551ed14d1 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -455,10 +455,13 @@ class FormMail extends Form
// Zone to select email template
if (count($modelmail_array) > 0)
{
+ $model_mail_selected_id = GETPOSTISSET('modelmailselected') ? GETPOST('modelmailselected', 'int') : $arraydefaultmessage->id;
+
// If list of template is filled
$out .= '
'."\n";
+
$out .= ''.$langs->trans('SelectMailModel').': ';
- $out .= $this->selectarray('modelmailselected', $modelmail_array, 0, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
+ $out .= $this->selectarray('modelmailselected', $modelmail_array, $model_mail_selected_id, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1, '', 0, 1);
if ($user->admin) $out .= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')), 1);
$out .= ' ';
$out .= ' ';
diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php
index ec012a8ddcd..e2c556a2dd4 100644
--- a/htdocs/takepos/index.php
+++ b/htdocs/takepos/index.php
@@ -777,10 +777,9 @@ $( document ).ready(function() {
print "ModalBox('ModalTerminal');";
}
if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING)
- {
- $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE ";
- $sql .= "date(date_creation) = CURDATE() ";
- $sql .= "";
+ $sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
+ $sql .= " entity = ".$conf->entity." AND ";
+ $sql .= " date(date_creation) = CURDATE()";
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
@@ -1026,8 +1025,9 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
);
}
-$sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE ";
-$sql .= "date(date_creation) = CURDATE() ";
+$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
+$sql .= " entity = ".$conf->entity." AND ";
+$sql .= " date(date_creation) = CURDATE()";
$resql = $db->query($sql);
if ($resql)
{