';
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index 54e4d271c6d..51061b4b6ad 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -223,7 +223,7 @@ if ($mode == "5") $sql.= " AND cd.statut = 5";
if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'";
if ($filter == "notexpired") $sql.= " AND cd.date_fin_validite >= '".$db->idate($now)."'";
if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'";
-if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'";
+if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract)."%' ";
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear);
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index cee16f923f5..74d9db0ec6d 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -32,7 +32,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
-
if (! isset($mode) || $mode != 'noajax') // For ajax call
{
require_once '../../main.inc.php';
@@ -45,6 +44,7 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call
$section=GETPOST("section");
$module=GETPOST("module");
$urlsource=GETPOST("urlsource");
+ $search_doc_ref=GETPOST('search_doc_ref','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@@ -188,12 +188,16 @@ if ($type == 'directory')
if (in_array($module, $automodules))
{
$param.='&module='.$module;
+ if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref;
+
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
- $filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
- $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
+ $filter=preg_quote($search_doc_ref, '/');
+ $filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1);
+
+ $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url,1);
}
// Manual list
else
@@ -211,6 +215,8 @@ if ($type == 'directory')
if ($section)
{
$param.='§ion='.$section;
+ if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref;
+
$textifempty = $langs->trans('NoFileFound');
}
else if ($section === '0') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'
';
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 0db46e416cb..b6ce8c69178 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -835,9 +835,9 @@ class FormFile
$out='';
$this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array());
- //if (! empty($conf->dol_use_jmobile)) return '';
+ $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+';
- $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
+ $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files)
// For ajax treatment
$out.= ''."\n";
@@ -922,9 +922,10 @@ class FormFile
* @param string $sortfield Sort field ('name', 'size', 'position', ...)
* @param string $sortorder Sort order ('ASC' or 'DESC')
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
+ * @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
*/
- function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1)
+ function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0)
{
global $user, $conf, $langs, $hookmanager;
global $bc,$bcdd;
@@ -1006,6 +1007,18 @@ class FormFile
print '
';
print '
'."\n";
+ if (! empty($addfilterfields))
+ {
+ print '
';
+ print '
';
+ print '
';
+ print '
';
+ if (empty($useinecm)) print '
';
+ print '
';
+ if (! $disablemove) print '
';
+ print "
\n";
+ }
+
print '
';
print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder);
@@ -1291,21 +1304,47 @@ class FormFile
* @param int $useinecm Change output for use in ecm module
* @param int $textifempty Text to show if filearray is empty
* @param int $maxlength Maximum length of file name shown
- * @param string $url Full url to use for click links ('' = autodetect)
+ * @param string $url Full url to use for click links ('' = autodetect)
+ * @param int $addfilterfields Add line with filters
* @return int <0 if KO, nb of files shown if OK
*/
- function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='')
+ function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='',$addfilterfields=0)
{
- global $user, $conf, $langs;
+ global $user, $conf, $langs, $form;
global $bc;
global $sortfield, $sortorder;
+ global $search_doc_ref;
dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart);
// Show list of documents
if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles"));
if (empty($url)) $url=$_SERVER["PHP_SELF"];
+
+ if (! empty($addfilterfields))
+ {
+ print '';
// Fin de zone
}
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index d81d8f22ac5..a34754b8d4c 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -120,7 +120,7 @@ class Interfaces
if (! $qualified)
{
- dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG);
+ //dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG);
continue;
}
diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 202a598d8ae..71912714b90 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2011 Regis Houssin
* Copyright (C) 2011-2015 Juanjo Menent
+ * Copyright (C) 2017 Ferran Marcet
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -419,7 +420,7 @@ function dol_get_next_week($day, $week, $month, $year)
{
$tmparray = dol_get_first_day_week($day, $month, $year);
- $time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
+ $time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
$time+=24*60*60*7;
$tmparray=dol_getdate($time,true);
diff --git a/htdocs/core/modules/modECM.class.php b/htdocs/core/modules/modECM.class.php
index bfe0e45e02c..b263b16e29e 100644
--- a/htdocs/core/modules/modECM.class.php
+++ b/htdocs/core/modules/modECM.class.php
@@ -63,7 +63,7 @@ class modECM extends DolibarrModules
$this->picto='dir';
// Data directories to create when module is enabled
- $this->dirs = array("/ecm/My_First_Directory","/ecm/temp");
+ $this->dirs = array("/ecm/temp");
// Config pages. Put here list of php page names stored in admmin directory used to setup module
$this->config_page_url = array('ecm.php');
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index b613d336fc4..9d314e20bbd 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -50,10 +50,11 @@ $result = restrictedArea($user, 'ecm', 0);
// Get parameters
$socid=GETPOST('socid','int');
$action=GETPOST('action','aZ09');
-$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int");
-$module=GETPOST("module");
+$section=GETPOST('section','int')?GETPOST('section','int'):GETPOST('section_id','int');
+$module=GETPOST('module','alpha');
if (! $section) $section=0;
-$section_dir=GETPOST('section_dir');
+$section_dir=GETPOST('section_dir','alpha');
+$search_doc_ref=GETPOST('search_doc_ref','alpha');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@@ -88,6 +89,12 @@ $error=0;
* Actions
*/
+// Purge search criteria
+if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
+{
+ $search_doc_ref='';
+}
+
// Upload file
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang
index 826379f57f4..eb3b5a054e5 100644
--- a/htdocs/langs/en_US/cron.lang
+++ b/htdocs/langs/en_US/cron.lang
@@ -10,7 +10,7 @@ CronSetup= Scheduled job management setup
URLToLaunchCronJobs=URL to check and launch qualified cron jobs
OrToLaunchASpecificJob=Or to check and launch a specific job
KeyForCronAccess=Security key for URL to launch cron jobs
-FileToLaunchCronJobs=Command line to launch cron jobs
+FileToLaunchCronJobs=Command line to check and launch qualified cron jobs
CronExplainHowToRunUnix=On Unix environment you should use the following crontab entry to run the command line each 5 minutes
CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Scheduled task tools to run the command line each 5 minutes
CronMethodDoesNotExists=Class %s does not contains any method %s
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index a93d2fa6565..49aa42ad96d 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -443,8 +443,12 @@ class MyObject extends CommonObject
{
global $conf, $langs;
+ $this->output = '';
+ $this->error='';
+
dol_syslog(__METHOD__, LOG_DEBUG);
+ // ...
return 0;
}
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index 1000388cb56..949711b4a1b 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -1172,6 +1172,9 @@ if ($action == 'edit_price' && $object->getRights()->creer)
print '';
print '
';
+ $parameters=array('colspan' => 2);
+ $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
+
print '
';
dol_fiche_end();
diff --git a/htdocs/theme/eldy/img/object_stripe.png b/htdocs/theme/eldy/img/object_stripe.png
new file mode 100644
index 00000000000..287bd24910c
Binary files /dev/null and b/htdocs/theme/eldy/img/object_stripe.png differ
diff --git a/htdocs/theme/md/img/object_stripe.png b/htdocs/theme/md/img/object_stripe.png
new file mode 100644
index 00000000000..287bd24910c
Binary files /dev/null and b/htdocs/theme/md/img/object_stripe.png differ