Merge branch '9.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/core/class/html.formmail.class.php
	htdocs/core/lib/functions.lib.php
	htdocs/index.php
This commit is contained in:
Laurent Destailleur 2019-05-02 17:40:41 +02:00
commit 8442c86436
5 changed files with 30 additions and 11 deletions

View File

@ -2120,7 +2120,7 @@ class Contrat extends CommonObject
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->societe_id) $this->from.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($mode == 'inactives')
if ($mode == 'inactive')
{
$sql = "SELECT cd.rowid, cd.date_ouverture_prevue as datefin";
$sql.= $this->from;
@ -2135,25 +2135,43 @@ class Contrat extends CommonObject
$sql.= " WHERE c.statut = 1";
$sql.= " AND c.rowid = cd.fk_contrat";
$sql.= " AND cd.statut = 4";
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(time())."'";
$sql.= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'";
}
elseif ($mode == 'active')
{
$sql = "SELECT cd.rowid, cd.date_fin_validite as datefin";
$sql.= $this->from;
$sql.= " WHERE c.statut = 1";
$sql.= " AND c.rowid = cd.fk_contrat";
$sql.= " AND cd.statut = 4";
//$datetouse = dol_now();
//$sql.= " AND cd.date_fin_validite < '".$this->db->idate($datetouse)."'";
}
$sql.= " AND c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity;
if ($user->societe_id) $sql.=" AND c.fk_soc = ".$user->societe_id;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
$resql=$this->db->query($sql);
if ($resql)
{
$langs->load("contracts");
$now=dol_now();
if ($mode == 'inactives') {
if ($mode == 'inactive') {
$warning_delay = $conf->contrat->services->inactifs->warning_delay;
$label = $langs->trans("BoardNotActivatedServices");
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=0';
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc';
}
elseif ($mode == 'expired') {
$warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc';
$label = $langs->trans("BoardExpiredServices");
} else {
$warning_delay = $conf->contrat->services->expires->warning_delay;
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;mode=4&amp;filter=expired';
$url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&sortfield=cd.date_fin_validite&sortorder=asc';
//$url.= '&op2day='.$arraydatetouse['mday'].'&op2month='.$arraydatetouse['mon'].'&op2year='.$arraydatetouse['year'];
//if ($warning_delay >= 0) $url.='&amp;filter=expired';
$label = $langs->trans("BoardRunningServices");
}

View File

@ -710,7 +710,7 @@ class FormMail extends Form
}
else
{
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
$out.= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((! is_array($this->withtocc) && ! is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
if (! empty($this->withtocc) && is_array($this->withtocc))
{
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
@ -1022,7 +1022,7 @@ class FormMail extends Form
if (! empty($this->withtocccreadonly)) {
$out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
} else {
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
$out.= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
if (! empty($this->withtoccc) && is_array($this->withtoccc)) {
$out.= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time

View File

@ -307,7 +307,7 @@ function GETPOST($paramname, $check = 'none', $method = 0, $filter = null, $opti
}
if (! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
{
if (! empty($_GET['action']) && preg_match('/^create/', $_GET['action']) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
if (! empty($_GET['action']) && (preg_match('/^create/', $_GET['action']) || preg_match('/^presend/', $_GET['action'])) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
// Now search in setup to overwrite default values
if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'

View File

@ -433,9 +433,9 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$board=new Contrat($db);
$dashboardlines[] = $board->load_board($user, "inactives");
$dashboardlines[] = $board->load_board($user, "inactive");
// Number of active services (expired)
$dashboardlines[] = $board->load_board($user, "expired");
$dashboardlines[] = $board->load_board($user, "active");
}
// Number of invoices customers (has paid)
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)

View File

@ -64,7 +64,8 @@ DateStartRealShort=Real start date
DateEndReal=Real end date
DateEndRealShort=Real end date
CloseService=Close service
BoardRunningServices=Expired running services
BoardRunningServices=Services running
BoardExpiredServices=Services expired
ServiceStatus=Status of service
DraftContracts=Drafts contracts
CloseRefusedBecauseOneServiceActive=Contract can't be closed as there is at least one open service on it