diff --git a/.stickler.yml b/.stickler.yml
index b68804448b2..642dec27412 100644
--- a/.stickler.yml
+++ b/.stickler.yml
@@ -8,3 +8,7 @@ linters:
fixers:
enable: true
+
+files:
+ ignore:
+ - 'htdocs/includes/*'
diff --git a/COPYRIGHT b/COPYRIGHT
index 1af09e6fdaf..fe707c1d63d 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -2,7 +2,7 @@
License
-------
-Dolibarr is released under the terms of the GNU General Public License as
+Dolibarr is released under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version (GPL-3+).
More information: https://www.gnu.org/licenses/gpl-3.0.txt
@@ -15,13 +15,13 @@ PHP libraries:
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation
-Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
+Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
-PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
+PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
@@ -37,7 +37,7 @@ TCPDF 6.3.2 LGPL-3+ Yes
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
-Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
+Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php
index d5af14f9171..8a3096ef72a 100755
--- a/build/generate_filelist_xml.php
+++ b/build/generate_filelist_xml.php
@@ -164,7 +164,7 @@ foreach ($files as $filetmp) {
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
- fputs($fp, ' '.$md5.''."\n");
+ fputs($fp, ' '.$md5.''."\n");
}
}
fputs($fp, ' '."\n");
@@ -207,7 +207,7 @@ foreach ($files as $filetmp) {
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
- fputs($fp, ' '.$md5.''."\n");
+ fputs($fp, ' '.$md5.''."\n");
}
}
fputs($fp, ' '."\n");
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index e34cd54863b..10a65cab2fe 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -138,7 +138,7 @@ if (empty($reshook))
if ($result > 0)
{
- setEventMessages($langs->trans("ChartLoaded"), null);
+ setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs');
}
else
{
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 5158e12ebb6..f449a99c8bf 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -922,8 +922,8 @@ while ($i < min($num, $limit))
{
print '
' . ($line->debit ? price($line->debit) : ''). '
';
if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
- $totalarray['totaldebit'] += $line->debit;
+ if (! $i) $totalarray['pos'][$totalarray['nbfield']]='totaldebit';
+ $totalarray['val']['totaldebit'] += $line->debit;
}
// Amount credit
@@ -931,8 +931,8 @@ while ($i < min($num, $limit))
{
print '
';
- }
- $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
- $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
-
- print '
';
@@ -796,9 +827,12 @@ if ($rowid > 0)
$doleditor->Create();
print "";
+ // Other attributes
+ include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
+
// Other attributes
$parameters=array();
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $act, $action); // Note that $action and $object may have been modified by hook
+ $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook))
{
@@ -807,33 +841,6 @@ if ($rowid > 0)
print '';
- // Extra field
- if (empty($reshook))
- {
- print '
';
- if (is_array($extrafields->attributes['adherent_type']['label']))
- {
- foreach($extrafields->attributes['adherent_type']['label'] as $key=>$label)
- {
- 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]);
- } else {
- $value = $_POST["options_" . $key];
- }
- } else {
- $value = $object->array_options["options_" . $key];
- }
-
- print '
'."\n";
diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index 0c3514015f2..92919886512 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -119,6 +119,7 @@ if (! empty($conf->global->CLICKTODIAL_URL))
if (GETPOST('phonefortest')) $phonefortest=GETPOST('phonefortest');
print '
';
+ print '';
print $langs->trans("LinkToTestClickToDial", $user->login).' : ';
print '';
print '';
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index af61dd1c09f..974fba8fa1d 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -11,6 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro
* Copyright (C) 2015 Ferran Marcet
* Copyright (C) 2016 Raphaël Doursenaud
+ * Copyright (C) 2019 Frédéric France
*
* 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
@@ -88,7 +89,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
-$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
+$taborder=array(9,0,4,3,2,0,1,8,19,16,27,38,0,5,11,0,32,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,37,0,25,0);
// Name of SQL tables of dictionaries
$tabname=array();
@@ -130,6 +131,7 @@ $tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
$tabname[37]= MAIN_DB_PREFIX."c_units";
+$tabname[38]= MAIN_DB_PREFIX."c_socialnetworks";
// Dictionary labels
$tablib=array();
@@ -170,6 +172,7 @@ $tablib[34]= "DictionaryFunction";
$tablib[35]= "DictionaryExpenseTaxCat";
$tablib[36]= "DictionaryExpenseTaxRange";
$tablib[37]= "DictionaryMeasuringUnits";
+$tablib[38]= "DictionarySocialNetworks";
// Requests to extract data
$tabsql=array();
@@ -210,6 +213,7 @@ $tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PRE
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
+$tabsql[38]= "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
// Criteria to sort dictionaries
$tabsqlsort=array();
@@ -250,6 +254,7 @@ $tabsqlsort[34]="code ASC";
$tabsqlsort[35]="c.label ASC";
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
$tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC";
+$tabsqlsort[38]="rowid, code ASC";
// Field names in select result for dictionary display
$tabfield=array();
@@ -290,6 +295,7 @@ $tabfield[34]= "code,label";
$tabfield[35]= "label";
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
$tabfield[37]= "code,label,short_label,unit_type,scale";
+$tabfield[38]= "code,label,url,icon,entity";
// Edit field names for editing a record
$tabfieldvalue=array();
@@ -330,6 +336,7 @@ $tabfieldvalue[34]= "code,label";
$tabfieldvalue[35]= "label";
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
$tabfieldvalue[37]= "code,label,short_label,unit_type,scale";
+$tabfieldvalue[38]= "code,label,url,icon";
// Field names in the table for inserting a record
$tabfieldinsert=array();
@@ -371,6 +378,7 @@ $tabfieldinsert[34]= "code,label";
$tabfieldinsert[35]= "label";
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
+$tabfieldinsert[38]= "entity,code,label,url,icon";
// Rowid name of field depending if field is autoincrement on or off..
// Use "" if id field is "rowid" and has autoincrement on
@@ -413,6 +421,7 @@ $tabrowid[34]= "rowid";
$tabrowid[35]= "";
$tabrowid[36]= "";
$tabrowid[37]= "";
+$tabrowid[38]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@@ -453,6 +462,7 @@ $tabcond[34]= ! empty($conf->hrm->enabled);
$tabcond[35]= ! empty($conf->expensereport->enabled);
$tabcond[36]= ! empty($conf->expensereport->enabled);
$tabcond[37]= ! empty($conf->product->enabled);
+$tabcond[38]= ! empty($conf->socialnetworks->enabled);
// List of help for fields
$tabhelp=array();
@@ -493,6 +503,7 @@ $tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[35] = array();
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"));
+$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -533,6 +544,7 @@ $tabfieldcheck[34] = array();
$tabfieldcheck[35] = array();
$tabfieldcheck[36] = array();
$tabfieldcheck[37] = array();
+$tabfieldcheck[38] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index 04accc01bbf..f3985bc70a4 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -80,10 +80,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
-$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php
+$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink=$user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php
-$permissionedit=$user->rights->emailcollector->write; // Used by the include of actions_lineupdown.inc.php
-$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$debuginfo='';
diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index e8b2e280a7f..9cb83e3784b 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -156,8 +156,8 @@ if (empty($reshook))
// Mass actions
$objectclass='EmailCollector';
$objectlabel='EmailCollector';
- $permtoread = $user->rights->emailcollector->read;
- $permtodelete = $user->rights->emailcollector->delete;
+ $permissiontoread = $user->rights->emailcollector->read;
+ $permissiontodelete = $user->rights->emailcollector->delete;
$uploaddir = $conf->emailcollector->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -497,26 +497,8 @@ while ($i < min($num, $limit))
}
// Show total line
-if (isset($totalarray['pos']))
-{
- print '
';
- $i=0;
- while ($i < $totalarray['nbfield'])
- {
- $i++;
- if (! empty($totalarray['pos'][$i])) print '
';
diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php
index edeb32e8353..53139b0df8c 100644
--- a/htdocs/api/class/api_access.class.php
+++ b/htdocs/api/class/api_access.class.php
@@ -148,11 +148,13 @@ class DolibarrApiAccess implements iAuthenticate
$fuser->getrights();
static::$user = $fuser;
- if($fuser->societe_id)
+ if ($fuser->socid) {
static::$role = 'external';
+ }
- if($fuser->admin)
+ if ($fuser->admin) {
static::$role = 'admin';
+ }
}
else
{
diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php
index 50102b76b93..b32eea1f57f 100644
--- a/htdocs/api/class/api_setup.class.php
+++ b/htdocs/api/class/api_setup.class.php
@@ -45,6 +45,68 @@ class Setup extends DolibarrApi
$this->db = $db;
}
+ /**
+ * Get the list of ordering methods.
+ *
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Number of items per page
+ * @param int $page Page number {@min 0}
+ * @param int $active Payment type is active or not {@min 0} {@max 1}
+ * @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'CHQ')"
+ *
+ * @url GET dictionary/ordering_methods
+ *
+ * @return array [List of ordering methods]
+ *
+ * @throws 400 RestException
+ * @throws 200 OK
+ */
+ public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
+ {
+ $list = array();
+
+ $sql = "SELECT rowid, code, libelle as label, module";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_input_method as t";
+ $sql.= " WHERE t.active = ".$active;
+ // Add sql filters
+ if ($sqlfilters)
+ {
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ }
+
+
+ $sql.= $this->db->order($sortfield, $sortorder);
+
+ if ($limit) {
+ if ($page < 0) {
+ $page = 0;
+ }
+ $offset = $limit * $page;
+
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $result = $this->db->query($sql);
+
+ if ($result) {
+ $num = $this->db->num_rows($result);
+ $min = min($num, ($limit <= 0 ? $num : $limit));
+ for ($i = 0; $i < $min; $i++) {
+ $list[] = $this->db->fetch_object($result);
+ }
+ } else {
+ throw new RestException(400, $this->db->lasterror());
+ }
+
+ return $list;
+ }
+
/**
* Get the list of payments types.
*
@@ -963,7 +1025,7 @@ class Setup extends DolibarrApi
* @param string $sortorder Sort order
* @param int $limit Number of items per page
* @param int $page Page number (starting from zero)
- * @param int $active Payment term is active or not {@min 0} {@max 1}
+ * @param int $active Measuring unit is active or not {@min 0} {@max 1}
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
* @return array List of measuring unit
*
@@ -1016,6 +1078,67 @@ class Setup extends DolibarrApi
return $list;
}
+ /**
+ * Get the list of social networks.
+ *
+ * @param string $sortfield Sort field
+ * @param string $sortorder Sort order
+ * @param int $limit Number of items per page
+ * @param int $page Page number (starting from zero)
+ * @param int $active Social network is active or not {@min 0} {@max 1}
+ * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
+ * @return array List of social networks
+ *
+ * @url GET dictionary/socialnetworks
+ *
+ * @throws RestException
+ */
+ public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
+ {
+ $list = array();
+ //TODO link with multicurrency module
+ $sql = "SELECT t.rowid, t.entity, t.code, t.label, t.url, t.icon, t.active";
+ $sql.= " FROM ".MAIN_DB_PREFIX."c_socialnetworks as t";
+ $sql.= " WHERE t.entity IN (".getEntity('c_socialnetworks').")";
+ $sql.= " AND t.active = ".$active;
+ // Add sql filters
+ if ($sqlfilters)
+ {
+ if (! DolibarrApi::_checkFilters($sqlfilters))
+ {
+ throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
+ }
+ $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ }
+
+
+ $sql.= $this->db->order($sortfield, $sortorder);
+
+ if ($limit) {
+ if ($page < 0) {
+ $page = 0;
+ }
+ $offset = $limit * $page;
+
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $result = $this->db->query($sql);
+
+ if ($result) {
+ $num = $this->db->num_rows($result);
+ $min = min($num, ($limit <= 0 ? $num : $limit));
+ for ($i = 0; $i < $min; $i++) {
+ $list[] = $this->db->fetch_object($result);
+ }
+ } else {
+ throw new RestException(503, 'Error when retrieving list of social networks: '.$this->db->lasterror());
+ }
+
+ return $list;
+ }
+
/**
* Get the list of tickets categories.
*
diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php
index 7d49d253755..ddde75ee463 100644
--- a/htdocs/asset/card.php
+++ b/htdocs/asset/card.php
@@ -69,8 +69,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
$permissionnote=$user->rights->asset->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink=$user->rights->asset->write; // Used by the include of actions_dellink.inc.php
-$permissionedit=$user->rights->asset->write; // Used by the include of actions_lineupdown.inc.php
-$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php
+$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
/*
diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php
index 8ea4f46c89d..c43bd73eae8 100644
--- a/htdocs/asset/list.php
+++ b/htdocs/asset/list.php
@@ -152,8 +152,8 @@ if (empty($reshook))
// Mass actions
$objectclass='Asset';
$objectlabel='Asset';
- $permtoread = $user->rights->asset->read;
- $permtodelete = $user->rights->asset->delete;
+ $permissiontoread = $user->rights->asset->read;
+ $permissiontodelete = $user->rights->asset->delete;
$uploaddir = $conf->asset->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -407,9 +407,13 @@ print '
'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine=0;
-foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
-{
- if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
+if (is_array($extrafields->attributes[$object->table_element]['computed'])) {
+ foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
+ if (preg_match('/\$object/', $val)) {
+ // There is at least one compute field that use $object
+ $needToFetchEachLine++;
+ }
+ }
}
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 231679f7b3a..941eb621e7c 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -72,14 +72,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
// Security check - Protection if external user
//if ($user->socid > 0) access_forbidden();
//if ($user->socid > 0) $socid = $user->socid;
-//$isdraft = (($object->statut == BillOfMaterials::STATUS_DRAFT) ? 1 : 0);
+//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'bom', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissionnote=$user->rights->bom->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink=$user->rights->bom->write; // Used by the include of actions_dellink.inc.php
-$permissionedit=$user->rights->bom->write; // Used by the include of actions_lineupdown.inc.php
-$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php
-$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
+$permissiontoadd=$user->rights->bom->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
/*
@@ -112,6 +111,12 @@ if (empty($reshook))
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+ // Action to move up and down lines of object
+ //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
+
+ // Action to build doc
+ include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+
// Actions to send emails
$trigger_name='BOM_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
@@ -146,8 +151,8 @@ if (empty($reshook))
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->qty = $qty;
- $bomline->qty_frozen = $qty_frozen;
- $bomline->disable_stock_change = $disable_stock_change;
+ $bomline->qty_frozen = (int) $qty_frozen;
+ $bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
$result = $bomline->create($user);
@@ -184,8 +189,8 @@ if (empty($reshook))
$bomline = new BOMLine($db);
$bomline->fetch($lineid);
$bomline->qty = $qty;
- $bomline->qty_frozen = $qty_frozen;
- $bomline->disable_stock_change = $disable_stock_change;
+ $bomline->qty_frozen = (int) $qty_frozen;
+ $bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
$result = $bomline->update($user);
@@ -457,7 +462,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{
$langs->load("projects");
$morehtmlref.=' '.$langs->trans('Project') . ' ';
- if ($user->rights->bom->write)
+ if ($permissiontoadd)
{
if ($action != 'classify')
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
@@ -532,7 +537,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
print '
';
// Build graphic number of object
-$data = $stats->getNbByMonth($endyear, $startyear);
+$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
print '
';
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index 7c6f525a0c4..1360dc6efcd 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -3,6 +3,7 @@
* Copyright (C) 2016 Christophe Battarel
* Copyright (C) 2018 Regis Houssin
* Copyright (C) 2019 Juanjo Menent
+ * Copyright (C) 2019 Laurent Destailleur
*
* 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
@@ -175,8 +176,8 @@ if (empty($reshook))
// Mass actions
$objectclass='Ticket';
$objectlabel='Ticket';
- $permtoread = $user->rights->ticket->read;
- $permtodelete = $user->rights->ticket->delete;
+ $permissiontoread = $user->rights->ticket->read;
+ $permissiontodelete = $user->rights->ticket->delete;
$uploaddir = $conf->ticket->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -686,26 +687,8 @@ while ($i < min($num, $limit))
}
// Show total line
-if (isset($totalarray['pos']))
-{
- print '
';
- $i=0;
- while ($i < $totalarray['nbfield'])
- {
- $i++;
- if (! empty($totalarray['pos'][$i])) print '
';
- else
- {
- if ($i == 1)
- {
- if ($num < $limit) print '
'.$langs->trans("Total").'
';
- else print '
'.$langs->trans("Totalforthispage").'
';
- }
- else print '
';
- }
- }
- print '
';
-}
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
// If no record found
if ($num == 0)
diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php
index 284c88a867b..b24b6db9381 100644
--- a/htdocs/user/bank.php
+++ b/htdocs/user/bank.php
@@ -308,7 +308,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
print '
';
+ } else {
+ // if social network is not active but value exist we do not want to loose it
+ print '';
+ }
}
- else
- {
- print '';
- print $object->skype;
- }
- print '';
}
- // Twitter
- if (! empty($conf->socialnetworks->enabled))
- {
- print '