';
@@ -1063,7 +1072,7 @@ else
$objsoc->fetch($object->socid);
// Thirdparty
$morehtmlref.=$langs->trans('ThirdParty') . ' : ';
- if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1);
+ if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1, 'contact');
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
}
$morehtmlref.='';
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index ebf7bc611f9..05fcf3e0916 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -160,7 +160,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 2afee019bed..64f2b6b94f2 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -133,7 +133,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index ddb19e3e88c..945b5b8b983 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -134,7 +134,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
{
foreach($extrafields->attribute_label as $key => $val)
{
- $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
+ if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php
index 433288606ec..b6e70059da3 100644
--- a/htdocs/core/actions_extrafields.inc.php
+++ b/htdocs/core/actions_extrafields.inc.php
@@ -159,6 +159,7 @@ if ($action == 'add')
$params['options'][$key] = $value;
}
}
+
$result=$extrafields->addExtraField(
GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'),
@@ -172,7 +173,7 @@ if ($action == 'add')
$params,
(GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
- (GETPOST('list', 'alpha')?1:0),
+ GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
(GETPOST('ishidden', 'alpha')?1:0),
GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:''),
@@ -334,7 +335,7 @@ if ($action == 'update')
$params,
(GETPOST('alwayseditable', 'alpha')?1:0),
(GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''),
- (GETPOST('list', 'alpha')?1:0),
+ GETPOST('list', 'alpha'), // Same as visible -1=not visible by default in list, 1=visible, 0=not visible in list
(GETPOST('ishidden', 'alpha')?1:0),
GETPOST('default_value','alpha'),
GETPOST('computed_value','alpha'),
diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php
index 535200ab95a..937634de5d4 100644
--- a/htdocs/core/class/commondocgenerator.class.php
+++ b/htdocs/core/class/commondocgenerator.class.php
@@ -418,6 +418,21 @@ abstract class CommonDocGenerator
$resarray[$array_key.'_total_discount_ht'] = '';
}
+ // Fetch project information if there is a project assigned to this object
+ if ($object->element != "project" && ! empty($object->fk_project) && $object->fk_project > 0)
+ {
+ if (! is_object($object->project))
+ {
+ $object->fetch_projet();
+ }
+
+ $resarray[$array_key.'_project_ref'] = $object->project->ref;
+ $resarray[$array_key.'_project_title'] = $object->project->title;
+ $resarray[$array_key.'_project_description'] = $object->project->description;
+ $resarray[$array_key.'_project_date_start'] = dol_print_date($object->project->date_start, 'day');
+ $resarray[$array_key.'_project_date_end'] = dol_print_date($object->project->date_end, 'day');
+ }
+
// Add vat by rates
if (is_array($object->lines) && count($object->lines)>0)
{
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index bd6f658185d..ac2c1482682 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4594,23 +4594,28 @@ abstract class CommonObject
}else {
$colspan='3';
}
+
switch($mode) {
case "view":
$value=$this->array_options["options_".$key];
break;
case "edit":
- if (isset($_POST["options_" . $key])) {
- if (is_array($_POST["options_" . $key])) {
- // $_POST["options"] is an array but following code expects a comma separated string
- $value = implode(",", $_POST["options_" . $key]);
+ // GETPOST("options_" . $key) can be 'abc' or array(0=>'abc')
+ $getposttemp = GETPOST('options_'.$key, 'none'); // GETPOST can get value from GET, POST or setup of default values.
+ if (isset($getposttemp)) {
+ if (is_array($getposttemp)) {
+ // $getposttemp is an array but following code expects a comma separated string
+ $value = implode(",", $getposttemp);
} else {
- $value = $_POST["options_" . $key];
+ $value = $getposttemp;
}
} else {
- $value = $this->array_options["options_" . $key];
+ $value = $this->array_options["options_" . $key]; // No GET, no POST, no default value, so we take value of object.
}
break;
}
+ //var_dump($value);
+
if ($extrafields->attribute_type[$key] == 'separate')
{
$out .= $extrafields->showSeparator($key);
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index aa1651d6fc6..e0e032d7e25 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -259,9 +259,8 @@ class Conf
// Load translation object with current language
if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US";
- // By default, we repeat info on all tabs
- if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
- if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
+ //if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1;
+ //if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1;
$rootfordata = DOL_DATA_ROOT;
$rootforuser = DOL_DATA_ROOT;
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index f79198a7096..c8779b388c0 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -140,14 +140,14 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
- * @param int $list Into list view by default
+ * @param int $list Into list view by default (-1, 0 or 1)
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $computed Computed value
* @param string $entity Entity of extrafields
* @param string $langfile Language file
* @return int <=0 if KO, >0 if OK
*/
- function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $computed='', $entity='', $langfile='')
+ function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $computed='', $entity='', $langfile='')
{
if (empty($attrname)) return -1;
if (empty($label)) return -1;
@@ -279,7 +279,7 @@ class ExtraFields
* @param array|string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
- * @param int $list Into list view by default
+ * @param int $list Into list view by default (-1, 0 or 1)
* @param int $ishidden Is hidden extrafield (warning, do not rely on this. If your module need a hidden data, it must use its own table)
* @param string $default Default value (in database. use the default_value feature for default value on screen).
* @param string $computed Computed value
@@ -287,7 +287,7 @@ class ExtraFields
* @param string $langfile Language file
* @return int <=0 if KO, >0 if OK
*/
- private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=0, $ishidden=0, $default='', $computed='',$entity='', $langfile='')
+ private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list=-1, $ishidden=0, $default='', $computed='',$entity='', $langfile='')
{
global $conf,$user;
@@ -893,7 +893,7 @@ class ExtraFields
if (! is_object($form)) $form=new Form($this->db);
// TODO Must also support $moreparam
- $out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1);
+ $out = $form->select_date($value, $keysuffix.'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, ($keysuffix != 'search_' ? 1 : 0), 1, 0, 1);
}
elseif (in_array($type,array('int')))
{
@@ -1323,7 +1323,8 @@ class ExtraFields
}
elseif ($type == 'password')
{
- $out='';
+ // If prefix is 'search_', field is used as a filter, we use a common text field.
+ $out='';
}
if (!empty($hidden)) {
$out='';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 1df33c7bccf..0151833f13b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5975,7 +5975,7 @@ class Form
if ($previous_ref || $next_ref || $morehtml)
{
- $ret.='
';
+ $ret.='
';
}
if ($morehtml)
{
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 9d01a3c70b2..73198771b93 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -57,21 +57,22 @@ class FormFile
/**
* Show form to upload a new file
*
- * @param string $url Url
- * @param string $title Title zone (Title or '' or 'none')
+ * @param string $url Url
+ * @param string $title Title zone (Title or '' or 'none')
* @param int $addcancel 1=Add 'Cancel' button
* @param int $sectionid If upload must be done inside a particular ECM section
* @param int $perm Value of permission to allow upload
- * @param int $size Length of input file area. Deprecated.
- * @param Object $object Object to use (when attachment is done on an element)
- * @param string $options Add an option column
- * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
- * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
- * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
- * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
+ * @param int $size Length of input file area. Deprecated.
+ * @param Object $object Object to use (when attachment is done on an element)
+ * @param string $options Add an option column
+ * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used.
+ * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
+ * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files
+ * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
+ * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*')
* @return int <0 if KO, >0 if OK
*/
- function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile')
+ function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='')
{
global $conf,$langs, $hookmanager;
$hookmanager->initHooks(array('formfile'));
@@ -130,6 +131,7 @@ class FormFile
$out .= 'global->MAIN_DISABLE_MULTIPLE_FILEUPLOAD) || $conf->browser->layout != 'classic')?' name="userfile"':' name="userfile[]" multiple');
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
+ $out .= (!empty($accept)?' accept="'.$accept.'"':'accept=""');
$out .= '>';
$out .= ' ';
$out .= 'param["models_id"];
}
- $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id);
+ $arraydefaultmessage=$this->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, ($model_id ? $model_id : -1)); // we set -1 if model_id empty
}
//var_dump($this->param["models"]);
//var_dump($model_id);
@@ -914,7 +914,7 @@ class FormMail extends Form
* @param string $type_template Get message for type=$type_template, type='all' also included.
* @param string $user Use template public or limited to this user
* @param Translate $outputlangs Output lang object
- * @param int $id Id template to find
+ * @param int $id Id of template to find, or -1 for first found with position = 0, or 0 for all
* @param int $active 1=Only active template, 0=Only disabled, -1=All
* @return array array('topic'=>,'content'=>,..)
*/
@@ -929,8 +929,10 @@ class FormMail extends Form
$sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned
if ($active >= 0) $sql.=" AND active = ".$active;
if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
- if (!empty($id)) $sql.= " AND rowid=".$id;
+ if ($id > 0) $sql.= " AND rowid=".$id;
+ if ($id == -1) $sql.= " AND position=0";
$sql.= $db->order("position,lang,label","ASC");
+ if ($id == -1) $sql.= $db->plimit(1);
//print $sql;
$resql = $db->query($sql);
diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 7ed49d004d2..9f8e64a7847 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -506,26 +506,26 @@ function getDateFromFormat(val,format)
if (substr == "MM" ||substr == "M")
{
month=getIntegerInString(val,d,1,2);
- d -= 2- month.length;
+ if (month) d -= 2- month.length;
}
if (substr == "dd")
{
day=getIntegerInString(val,d,1,2);
- d -= 2- day.length;
+ if (day) d -= 2- day.length;
}
if (substr == "HH" ||substr == "hh" )
{
hour=getIntegerInString(val,d,1,2);
- d -= 2- hour.length;
+ if (dhouray) d -= 2- hour.length;
}
if (substr == "mm"){
minute=getIntegerInString(val,d,1,2);
- d -= 2- minute.length;
+ if (minute) d -= 2- minute.length;
}
if (substr == "ss")
{
seconde=getIntegerInString(val,d,1,2);
- d -= 2- seconde.length;
+ if (seconde) d -= 2- seconde.length;
}
i+=substr.length;
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 159e7a6435a..f22da301ec4 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -48,6 +48,28 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'card';
$h++;
+ if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
+ {
+ //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
+ $nbContact = 0; // TODO
+
+ $sql = "SELECT COUNT(p.rowid) as nb";
+ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
+ $sql .= " WHERE p.fk_soc = ".$object->id;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $nbContact = $obj->nb;
+ }
+
+ $head[$h][0] = DOL_URL_ROOT.'/societe/contact.php?socid='.$object->id;
+ $head[$h][1] = $langs->trans('ContactsAddresses');
+ if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.'';
+ $head[$h][2] = 'contact';
+ $h++;
+ }
+
if ($object->client==1 || $object->client==2 || $object->client==3)
{
$head[$h][0] = DOL_URL_ROOT.'/comm/card.php?socid='.$object->id;
@@ -748,7 +770,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '';
- print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+ print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print "\n".'
'."\n";
$param="socid=".$object->id;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 7fe650f7c2c..28a98d6df7c 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -314,111 +314,126 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
{
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
- if (! empty($user->default_values)) // $user->default_values defined from menu default values
+ if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
{
- $qualified=1;
- if (isset($user->default_values[$relativepathstring]['createform_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
- {
- $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['createform_queries']);
- $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
- foreach($tmpqueryarraytohave as $tmpquerytohave)
- {
- if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
- }
- }
- if ($qualified)
+ if (isset($user->default_values[$relativepathstring]['createform']))
{
- //var_dump($user->default_values[$relativepathstring]['createform']);
- if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
+ foreach($user->default_values[$relativepathstring]['createform'] as $defkey => $defval)
+ {
+ $qualified = 0;
+ if ($defkey != '_noquery_')
+ {
+ $tmpqueryarraytohave=explode('&', $defkey);
+ $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
+ $foundintru=0;
+ foreach($tmpqueryarraytohave as $tmpquerytohave)
+ {
+ if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
+ }
+ if (! $foundintru) $qualified=1;
+ //var_dump($defkey.'-'.$qualified);
+ }
+ else $qualified = 1;
+
+ if ($qualified)
+ {
+ //var_dump($user->default_values[$relativepathstring][$defkey]['createform']);
+ if (isset($user->default_values[$relativepathstring]['createform'][$defkey][$paramname]))
+ {
+ $out = $user->default_values[$relativepathstring]['createform'][$defkey][$paramname];
+ break;
+ }
+ }
+ }
}
- }
+ }
}
// Management of default search_filters and sort order
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
- if (! empty($user->default_values)) // $user->default_values defined from menu default values
+ if (! empty($user->default_values)) // $user->default_values defined from menu 'Setup - Default values'
{
//var_dump($user->default_values[$relativepathstring]);
- if ($paramname == 'sortfield') // Sorted on which fields ?
+ if ($paramname == 'sortfield' || $paramname == 'sortorder') // Sorted on which fields ? ASC or DESC ?
{
- $qualified=1;
- if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
+ if (isset($user->default_values[$relativepathstring]['sortorder'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
{
- $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
- $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
- foreach($tmpqueryarraytohave as $tmpquerytohave)
+ foreach($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval)
{
- if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
- }
- }
- if ($qualified)
- {
- if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the key of $user->default_values[path][sortorder]
- {
- $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
- foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
- {
- if ($out) $out.=', ';
- $out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
- }
+ $qualified = 0;
+ if ($defkey != '_noquery_')
+ {
+ $tmpqueryarraytohave=explode('&', $defkey);
+ $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
+ $foundintru=0;
+ foreach($tmpqueryarraytohave as $tmpquerytohave)
+ {
+ if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
+ }
+ if (! $foundintru) $qualified=1;
+ //var_dump($defkey.'-'.$qualified);
+ }
+ else $qualified = 1;
+
+ if ($qualified)
+ {
+ $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
+ foreach($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val)
+ {
+ if ($out) $out.=', ';
+ if ($paramname == 'sortfield')
+ {
+ $out.=dol_string_nospecial($key, '', $forbidden_chars_to_replace);
+ }
+ if ($paramname == 'sortorder')
+ {
+ $out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
+ }
+ }
+ //break; // No break for sortfield and sortorder so we can cumulate fields (is it realy usefull ?)
+ }
}
}
}
- elseif ($paramname == 'sortorder') // ASC or DESC ?
+ elseif (isset($user->default_values[$relativepathstring]['filters']))
{
- $qualified=1;
- if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
+ foreach($user->default_values[$relativepathstring]['filters'] as $defkey => $defval)
{
- $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
- $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
- foreach($tmpqueryarraytohave as $tmpquerytohave)
- {
- if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
- }
- }
- if ($qualified)
- {
- if (isset($user->default_values[$relativepathstring]['sortorder'])) // We will use the val of $user->default_values[path][sortorder]
- {
- $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
- foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
- {
- if ($out) $out.=', ';
- $out.=dol_string_nospecial($val, '', $forbidden_chars_to_replace);
- }
- }
- }
- }
- elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
- {
- $qualified=1;
- if (isset($user->default_values[$relativepathstring]['filters_queries']))
- {
- $tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
- $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
- foreach($tmpqueryarraytohave as $tmpquerytohave)
- {
- if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
- }
- }
- if ($qualified)
- {
- if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
+ $qualified = 0;
+ if ($defkey != '_noquery_')
{
- // We made a search from quick search menu, do we still use default filter ?
- if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
+ $tmpqueryarraytohave=explode('&', $defkey);
+ $tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
+ $foundintru=0;
+ foreach($tmpqueryarraytohave as $tmpquerytohave)
{
- $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
- $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
+ if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
}
+ if (! $foundintru) $qualified=1;
+ //var_dump($defkey.'-'.$qualified);
}
- else
- {
- $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
- $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '', $forbidden_chars_to_replace);
- }
- }
+ else $qualified = 1;
+
+ if ($qualified)
+ {
+ if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all']))
+ {
+ // We made a search from quick search menu, do we still use default filter ?
+ if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH))
+ {
+ $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
+ $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
+ }
+ }
+ else
+ {
+ $forbidden_chars_to_replace=array(" ","'","/","\\",":","*","?","\"","<",">","|","[","]",";","="); // we accept _, -, . and ,
+ $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
+ }
+ break;
+ }
+ }
}
}
}
@@ -426,14 +441,14 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
}
- // Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
- // Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
- // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
- if (! is_array($out) && empty($_POST[$paramname]))
+ // Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
+ // Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
+ // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
+ if (! is_array($out) && empty($_POST[$paramname]))
+ {
+ $maxloop=20; $loopnb=0; // Protection against infinite loop
+ while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
{
- $maxloop=20; $loopnb=0; // Protection against infinite loop
- while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
- {
$loopnb++; $newout = '';
if ($reg[1] == 'DAY') { $tmp=dol_getdate(dol_now(), true); $newout = $tmp['mday']; }
@@ -464,57 +479,57 @@ function GETPOST($paramname, $check='alpha', $method=0, $filter=NULL, $options=N
else $newout = ''; // Key not found, we replace with empty string
//var_dump('__'.$reg[1].'__ -> '.$newout);
$out = preg_replace('/__'.preg_quote($reg[1],'/').'__/', $newout, $out);
- }
}
+ }
- // Check is done after replacement
- switch ($check)
- {
- case 'none':
- break;
- case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
- if (! is_numeric($out)) { $out=''; }
- break;
- case 'intcomma':
- if (preg_match('/[^0-9,]+/i',$out)) $out='';
- break;
- case 'alpha':
- $out=trim($out);
- // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
- // '../' is dangerous because it allows dir transversals
- if (preg_match('/"/',$out)) $out='';
- else if (preg_match('/\.\.\//',$out)) $out='';
- break;
- case 'san_alpha':
- $out=filter_var($out,FILTER_SANITIZE_STRING);
- break;
- case 'aZ':
- $out=trim($out);
- if (preg_match('/[^a-z]+/i',$out)) $out='';
- break;
- case 'aZ09':
- $out=trim($out);
- if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
- break;
- case 'array':
- if (! is_array($out) || empty($out)) $out=array();
- break;
- case 'nohtml':
- $out=dol_string_nohtmltag($out);
- break;
- case 'alphanohtml': // Recommended for search params
- $out=trim($out);
- // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
- // '../' is dangerous because it allows dir transversals
- if (preg_match('/"/',$out)) $out='';
- else if (preg_match('/\.\.\//',$out)) $out='';
- $out=dol_string_nohtmltag($out);
- break;
- case 'custom':
- if (empty($filter)) return 'BadFourthParameterForGETPOST';
- $out=filter_var($out, $filter, $options);
- break;
- }
+ // Check is done after replacement
+ switch ($check)
+ {
+ case 'none':
+ break;
+ case 'int': // Check param is a numeric value (integer but also float or hexadecimal)
+ if (! is_numeric($out)) { $out=''; }
+ break;
+ case 'intcomma':
+ if (preg_match('/[^0-9,]+/i',$out)) $out='';
+ break;
+ case 'alpha':
+ $out=trim($out);
+ // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
+ // '../' is dangerous because it allows dir transversals
+ if (preg_match('/"/',$out)) $out='';
+ else if (preg_match('/\.\.\//',$out)) $out='';
+ break;
+ case 'san_alpha':
+ $out=filter_var($out,FILTER_SANITIZE_STRING);
+ break;
+ case 'aZ':
+ $out=trim($out);
+ if (preg_match('/[^a-z]+/i',$out)) $out='';
+ break;
+ case 'aZ09':
+ $out=trim($out);
+ if (preg_match('/[^a-z0-9_\-\.]+/i',$out)) $out='';
+ break;
+ case 'array':
+ if (! is_array($out) || empty($out)) $out=array();
+ break;
+ case 'nohtml':
+ $out=dol_string_nohtmltag($out);
+ break;
+ case 'alphanohtml': // Recommended for search params
+ $out=trim($out);
+ // '"' is dangerous because param in url can close the href= or src= and add javascript functions.
+ // '../' is dangerous because it allows dir transversals
+ if (preg_match('/"/',$out)) $out='';
+ else if (preg_match('/\.\.\//',$out)) $out='';
+ $out=dol_string_nohtmltag($out);
+ break;
+ case 'custom':
+ if (empty($filter)) return 'BadFourthParameterForGETPOST';
+ $out=filter_var($out, $filter, $options);
+ break;
+ }
// Code for search criteria persistence.
// Save data into session if key start with 'search_' or is 'smonth', 'syear', 'month', 'year'
@@ -5236,7 +5251,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
- '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
+ '__MYCOMPANY_FULLADDRESS__' => $mysoc->getFullAddress(1, ', '),
+ '__MYCOMPANY_ADDRESS__' => $mysoc->address,
+ '__MYCOMPANY_ZIP__' => $mysoc->zip,
+ '__MYCOMPANY_TOWN__' => $mysoc->town,
+ '__MYCOMPANY_COUNTRY__' => $mysoc->country,
+ '__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
));
}
if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude)))
@@ -5392,8 +5412,14 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__USER_FIRSTNAME__' => (string) $user->firstname,
'__USER_FULLNAME__' => (string) $user->getFullName($outputlangs),
'__USER_SUPERVISOR_ID__' => (string) $user->fk_user,
- '__SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
- ));
+ '__USER_SIGNATURE__' => (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '')
+ )
+ );
+ // For backward compatibility
+ if ($onlykey != 2)
+ {
+ $substitutionarray['__SIGNATURE__'] = (string) (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($user->signature), 30) : $user->signature) : '');
+ }
}
if (! empty($conf->multicompany->enabled))
{
diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php
index 6f268fda3a7..cb594259c9f 100644
--- a/htdocs/core/lib/geturl.lib.php
+++ b/htdocs/core/lib/geturl.lib.php
@@ -55,7 +55,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false)); // We use @ here because this may return warning if safe mode is on or open_basedir is on
-
+
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
@@ -63,7 +63,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
// You can force, if supported a version like TLSv1 or TLSv1.2
if (! empty($conf->global->MAIN_CURL_SSLVERSION)) curl_setopt($ch, CURLOPT_SSLVERSION, $conf->global->MAIN_CURL_SSLVERSION);
//curl_setopt($ch, CURLOPT_SSLVERSION, 6); for tls 1.2
-
+
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
@@ -82,12 +82,12 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
{
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT'
if (! is_array($param)) parse_str($param, $array_param);
- else
+ else
{
dol_syslog("parameter param must be a string", LOG_WARNING);
$array_param=$param;
}
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
+ curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($array_param)); // Setting param x=a&y=z as PUT fields
}
else if ($postorget == 'PUTALREADYFORMATED')
{
@@ -121,7 +121,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
$response = curl_exec($ch);
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
-
+
dol_syslog("getURLContent request=".$request);
dol_syslog("getURLContent response=".$response);
@@ -130,7 +130,7 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
{
// Ad keys to $rep
$rep['content']=$response;
-
+
// moving to display page to display curl errors
$rep['curl_error_no']=curl_errno($ch);
$rep['curl_error_msg']=curl_error($ch);
@@ -146,12 +146,12 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
//$rep['header_size']=$info['header_size'];
//$rep['http_code']=$info['http_code'];
dol_syslog("getURLContent http_code=".$rep['http_code']);
-
+
// Add more keys to $rep
$rep['content']=$response;
$rep['curl_error_no']='';
$rep['curl_error_msg']='';
-
+
//closing the curl
curl_close($ch);
}
@@ -159,3 +159,19 @@ function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addhea
return $rep;
}
+
+/**
+ * Function get second level domain name.
+ * For example: https://www.abc.mydomain.com/dir/page.html return 'mydomain'
+ *
+ * @param string $url Full URL.
+ * @return string Returns domaine name
+ */
+function getDomainFromURL($url)
+{
+ $tmpdomain = preg_replace('/^https?:\/\//i', '', $url); // Remove http(s)://
+ $tmpdomain = preg_replace('/\/.*$/i', '', $tmpdomain); // Remove part after domain
+ $tmpdomain = preg_replace('/\.[^\.]+$/', '', $tmpdomain); // Remove first level domain (.com, .net, ...)
+ $tmpdomain = preg_replace('/^[^\.]+\./', '', $tmpdomain); // Remove part www. before domain name
+ return $tmpdomain;
+}
diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php
index 89bbe24ea47..5d9f9280cc8 100644
--- a/htdocs/core/lib/order.lib.php
+++ b/htdocs/core/lib/order.lib.php
@@ -48,6 +48,16 @@ function commande_prepare_head(Commande $object)
$h++;
}
+ if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
+ {
+ $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
+ $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
+ $head[$h][1] = $langs->trans('ContactsAddresses');
+ if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.'';
+ $head[$h][2] = 'contact';
+ $h++;
+ }
+
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{
@@ -60,16 +70,6 @@ function commande_prepare_head(Commande $object)
$h++;
}
- if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
- {
- $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
- $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
- $head[$h][1] = $langs->trans('ContactsAddresses');
- if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.'';
- $head[$h][2] = 'contact';
- $h++;
- }
-
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 581c324674a..c02fbbbb220 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -252,7 +252,8 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
{
//print ' feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write;
if (empty($user->rights->$feature->creer)
- && empty($user->rights->$feature->write)) { $createok=0; $nbko++; }
+ && empty($user->rights->$feature->write)
+ && empty($user->rights->$feature->create)) { $createok=0; $nbko++; }
}
}
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 6d473c77086..336928ce408 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -122,6 +122,8 @@ class pdf_paiement
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
+
+ $file = $dir . "/payments-".$year."-".$month.".pdf";
switch ($this->doc_type) {
case "client":
$file = $dir . "/payments-".$year."-".$month.".pdf";
diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index 6c5f563e106..e04f4e0cb92 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -26,6 +26,8 @@
* $elementtype
*/
+$langs->load("modulebuilder");
+
?>
@@ -101,13 +103,13 @@
if (type == 'separate')
{
- required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.val('').prop('disabled', true);
+ required.removeAttr('checked').prop('disabled', true); alwayseditable.removeAttr('checked').prop('disabled', true); list.removeAttr('checked').prop('disabled', true);
jQuery('#size, #default_value').val('').prop('disabled', true);
}
else
{
default_value.removeAttr('disabled');
- required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.val('').removeAttr('disabled');
+ required.removeAttr('disabled'); alwayseditable.removeAttr('disabled'); list.removeAttr('disabled');
}
}
init_typeoffields('');
@@ -178,12 +180,9 @@
multicompany->enabled) { ?>
\n__(Sincerely)__ \n__USER_SIGNATURE__',null);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 1, 'VENTES', 'Income of products/services', 'Exemple: 7xxxxx', 0, 0, '', '10', 1, 1);
INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 2, 'DEPENSES', 'Expenses of products/services', 'Exemple: 6xxxxx', 0, 0, '', '20', 1, 1);
@@ -99,6 +103,7 @@ ALTER TABLE llx_website_page MODIFY COLUMN pageurl varchar(255);
ALTER TABLE llx_website_page ADD COLUMN lang varchar(6);
ALTER TABLE llx_website_page ADD COLUMN fk_page integer;
ALTER TABLE llx_website_page ADD COLUMN grabbed_from varchar(255);
+ALTER TABLE llx_website_page ADD COLUMN htmlheader text;
ALTER TABLE llx_website_page MODIFY COLUMN status INTEGER DEFAULT 1;
UPDATE llx_website_page set status = 1 WHERE status IS NULL;
@@ -257,6 +262,12 @@ ALTER TABLE llx_extrafields ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_extrafields ADD COLUMN datec datetime;
ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
+-- We fix value of 'list' fro m0 to 1 for all extrafields created before this migration
+UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
+
+ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
+--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
+
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql
index 9d82d37768a..69cbc186ebd 100644
--- a/htdocs/install/mysql/tables/llx_c_email_templates.sql
+++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql
@@ -23,13 +23,14 @@ create table llx_c_email_templates
entity integer DEFAULT 1 NOT NULL, -- multi company id
module varchar(32), -- Nom du module en rapport avec le modele
type_template varchar(32), -- template for which type of email (send invoice by email, send order, ...)
- lang varchar(6),
+ lang varchar(6) DEFAULT '', -- We use a default to '' so the unique index that include this field will work
private smallint DEFAULT 0 NOT NULL, -- Template public or private
fk_user integer, -- Id user owner if template is private, or null
datec datetime,
tms timestamp,
label varchar(255), -- Label of predefined email
position smallint, -- Position
+ enabled varchar(255) DEFAULT '1', -- Condition to have this module visible
active tinyint DEFAULT 1 NOT NULL,
topic text, -- Predefined topic
content text, -- Predefined text
diff --git a/htdocs/install/mysql/tables/llx_extrafields.sql b/htdocs/install/mysql/tables/llx_extrafields.sql
index 3b9a9b2d72b..548508d451d 100644
--- a/htdocs/install/mysql/tables/llx_extrafields.sql
+++ b/htdocs/install/mysql/tables/llx_extrafields.sql
@@ -34,7 +34,7 @@ create table llx_extrafields
pos integer DEFAULT 0,
alwayseditable integer DEFAULT 0, -- 1 if field can be edited whatever is element status
param text, -- extra parameters to define possible values of field
- list integer DEFAULT 0, -- list of values for field that are combo lists
+ list integer DEFAULT 1, -- list of values for field that are combo lists
langs varchar(64), -- example: fileofmymodule@mymodule
ishidden integer DEFAULT 0, -- Can be foreign key of external system
fk_user_author integer, -- user making creation
diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql
index f3d1cca4786..5393177a3bb 100644
--- a/htdocs/install/mysql/tables/llx_website_page.sql
+++ b/htdocs/install/mysql/tables/llx_website_page.sql
@@ -27,6 +27,7 @@ CREATE TABLE llx_website_page
keywords varchar(255),
lang varchar(6),
fk_page integer,
+ htmlheader text,
content mediumtext, -- text is not enough in size
status integer DEFAULT 1,
grabbed_from varchar(255),
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 3c10edc86ca..bd868cf4e9e 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -452,8 +452,8 @@ DependsOn=This module need the module(s)
RequiredBy=This module is required by module(s)
TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field.
PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples:
-PageUrlForDefaultValuesCreate= For form to create a new thirdparty, it is %s, If we want default only if url has some parameter, we can use %s
-PageUrlForDefaultValuesList= For page that list thirdparties, it is %s, If we want default only if url has some parameter, we can use %s
+PageUrlForDefaultValuesCreate= For form to create a new thirdparty, it is %s, If you want default value only if url has some parameter, you can use %s
+PageUrlForDefaultValuesList= For page that list thirdparties, it is %s, If you want default value only if url has some parameter, you can use %s
EnableDefaultValues=Enable usage of personalized default values
EnableOverwriteTranslation=Enable usage of overwrote translation
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation.
@@ -1089,6 +1089,11 @@ ShowProfIdInAddress=Show professionnal id with addresses on documents
ShowVATIntaInAddress=Hide VAT Intra num with addresses on documents
TranslationUncomplete=Partial translation
MAIN_DISABLE_METEO=Disable meteo view
+MeteoStdMod=Standard mode
+MeteoStdModEnabled=Standard mode enabled
+MeteoPercentageMod=Percentage mode
+MeteoPercentageModEnabled=Percentage mode enabled
+MeteoUseMod=Click to use %s
TestLoginToAPI=Test login to API
ProxyDesc=Some features of Dolibarr need to have an Internet access to work. Define here parameters for this. If the Dolibarr server is behind a Proxy server, those parameters tells Dolibarr how to access Internet through it.
ExternalAccess=External access
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index caed4498f3b..d45c0c15c1c 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -157,4 +157,6 @@ NewVariousPayment=New miscellaneous payments
VariousPayment=Miscellaneous payments
VariousPayments=Miscellaneous payments
ShowVariousPayment=Show miscellaneous payments
-AddVariousPayment=Add miscellaneous payments
\ No newline at end of file
+AddVariousPayment=Add miscellaneous payments
+YourSEPAMandate=Your SEPA mandate
+FindYourSEPAMandate=This is your SEPA mandate to authorize our company to make direct debit order to your bank. Thanks to return it signed (scan of the signed document) or sent it by mail to
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 93616b6151c..bfcbb5a2010 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -262,6 +262,7 @@ DateBuild=Report build date
DatePayment=Date of payment
DateApprove=Approving date
DateApprove2=Approving date (second approval)
+RegistrationDate=Registration date
UserCreation=Creation user
UserModification=Modification user
UserCreationShort=Creat. user
@@ -770,6 +771,7 @@ Genderwoman=Woman
ViewList=List view
Mandatory=Mandatory
Hello=Hello
+GoodBye=GoodBye
Sincerely=Sincerely
DeleteLine=Delete line
ConfirmDeleteLine=Are you sure you want to delete this line?
diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index f1cca6a1696..a78981f32a1 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -87,8 +87,8 @@ PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __REF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendShipping=__CONTACTCIVNAME__\n\nYou will find here the shipping __SHIPPINGREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
PredefinedMailContentSendFichInter=__CONTACTCIVNAME__\n\nYou will find here the intervention __FICHINTERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
-PredefinedMailContentThirdparty=__CONTACTCIVNAME__\n\n__PERSONALIZED__\n\n__SIGNATURE__
-PredefinedMailContentUser=aa__PERSONALIZED__\n\n__SIGNATURE__
+PredefinedMailContentThirdparty=\n\n__SIGNATURE__
+PredefinedMailContentUser=\n\n__SIGNATURE__
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
ChooseYourDemoProfilMore=...or build your own profile (manual module selection)
diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang
index e42504f4706..514b76af16c 100644
--- a/htdocs/langs/en_US/website.lang
+++ b/htdocs/langs/en_US/website.lang
@@ -37,7 +37,7 @@ VirtualHostUrlNotDefined=URL of the virtual host served by external web server n
NoPageYet=No pages yet
SyntaxHelp=Help on specific syntax tips
YouCanEditHtmlSourceckeditor=You can edit HTML source code using the "Source" button in editor.
-YouCanEditHtmlSource=You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.
You can also include content of another Page/Container with the following syntax: <?php dolIncludeHtmlContent($websitekey.'/contentaliastoinclude.php'); ?>
To include a link to download a file stored into the documents directory, use the document.php wrapper: Example, for a file into documents/ecm (need to be logged), syntax is: <a href="/document.php?modulepart=ecm&file=reldir/filename.ext">. for a file into documents/media (open public access), syntax is: <a href="/document.php?modulepart=medias[&hashp=publicsharekey if modulepart != medias]">.
To include an image stored into the documents directory, use the viewimage.php wrapper: Example, for an image into documents/media (open access), syntax is: <a href="/viewimage.php?modulepart=medias&file=filename.ext">.
+YouCanEditHtmlSource=You can include PHP code into this source using tags <?php ?>. The following global variables are available: $conf, $langs, $db, $mysoc, $user, $website.
You can also include content of another Page/Container with the following syntax: <?php dolIncludeHtmlContent($websitekey.'/alias_of_content_to_include.php'); ?>
To include a link to download a file stored into the documents directory, use the document.php wrapper: Example, for a file into documents/ecm (need to be logged), syntax is: <a href="/document.php?modulepart=ecm&file=relative_dir/filename.ext"> For same file into documents/ecm (open access using the sharing hash key), syntax is: <a href="/document.php?modulepart=ecm&file=relative_dir/filename.ext&hashp=publicsharekeyoffile"> For a file into documents/media (open directory for public access), syntax is: <a href="/document.php?modulepart=medias&file=relative_dir/filename.ext">
To include an image stored into the documents directory, use the viewimage.php wrapper: Example, for an image into documents/media (open access), syntax is: <a href="/viewimage.php?modulepart=medias&file=relative_dir/filename.ext">
ClonePage=Clone page/container
CloneSite=Clone site
ConfirmClonePage=Please enter code/alias of new page and if it is a translation of the cloned page.
@@ -49,3 +49,4 @@ CreateByFetchingExternalPage=Create page/container by fetching page from externa
OrEnterPageInfoManually=Or create empty page from scratch...
FetchAndCreate=Fetch and Create
ExportSite=Export site
+IDOfPage=Id of page
\ No newline at end of file
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 4a5f349215b..e91a9751b60 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -81,8 +81,10 @@ class MyObject extends CommonObject
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20),
- 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1),
+ 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200'),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Amount'),
+ 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>45),
+ 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>46),
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
diff --git a/htdocs/modulebuilder/template/lib/myobject.lib.php b/htdocs/modulebuilder/template/lib/myobject.lib.php
index 25f85052133..5ce7c4f7c97 100644
--- a/htdocs/modulebuilder/template/lib/myobject.lib.php
+++ b/htdocs/modulebuilder/template/lib/myobject.lib.php
@@ -29,7 +29,7 @@
*/
function myobjectPrepareHead($object)
{
- global $langs, $conf;
+ global $db, $langs, $conf;
$langs->load("mymodule@mymodule");
@@ -40,17 +40,30 @@ function myobjectPrepareHead($object)
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
- if (isset($object->fields['note_public']) || isset($object->fields['note_pricate']))
+
+ if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
{
- $head[$h][0] = dol_buildpath("/mymodule/myobject_note.php", 1).'?id='.$object->id;
- $head[$h][1] = $langs->trans("Notes");
+ $nbNote = 0;
+ if(!empty($object->fields['note_private'])) $nbNote++;
+ if(!empty($object->fields['note_public'])) $nbNote++;
+ $head[$h][0] = dol_buildpath('/mymodule/myobject_note.php', 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Notes');
+ if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.'';
$head[$h][2] = 'note';
$h++;
}
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+ $upload_dir = $conf->mymodule->dir_output . "/myobject/" . dol_sanitizeFileName($object->ref);
+ $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
+ $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
- $head[$h][1] = $langs->trans("Documents");
+ $head[$h][1] = $langs->trans('Documents');
+ if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).'';
$head[$h][2] = 'document';
$h++;
+
$head[$h][0] = dol_buildpath("/mymodule/myobject_agenda.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda';
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index 515768b8011..4160b2045fd 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -166,8 +166,9 @@ if (empty($reshook))
{
foreach ($object->fields as $key => $val)
{
+ if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields
+
$object->$key=GETPOST($key,'alpha');
- if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
if ($val['notnull'] > 0 && $object->$key == '')
{
$error++;
@@ -280,6 +281,7 @@ if ($action == 'create')
print $langs->trans($val['label']);
print '
';
print '
';
+ $defaultcss='minwidth100';
if ($val['type'] == 'text')
{
print '
';
print '
';
}
+
+ // Other attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
+
print '
'."\n";
dol_fiche_end();
@@ -307,8 +313,6 @@ if ($action == 'create')
print '';
}
-
-
// Part to edit record
if (($id || $ref) && $action == 'edit')
{
@@ -325,6 +329,7 @@ if (($id || $ref) && $action == 'edit')
foreach($object->fields as $key => $val)
{
if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue;
+
print '